-
Notifications
You must be signed in to change notification settings - Fork 274
Introduce Address type #186
Conversation
Great start, thanks! 😀 Does this already encompass everything from account.ts? |
No not yet, there are some functions for working with public and private keys there which didn't fit in here. There's another function which is somewhat related, which is |
Hmm, maybe we wait a bit until we have a bit of a broader picture how we relate these new structures to the existing code, how we can role out and this generally fit together. |
I was just reading about the TS migration and saw this PR.
IMO In my experience, non-checksummed addresses are especially frustrating for new smart contract/dapp developers, as the way the checksum is encoded is super weird. |
Couldn't they opt-in specifically to use In the internal libraries using a checksummed-address is very rare afaik, and I'm not sure if dapp devs would be using |
That's the current situation, you can call
I believe that's super common, at least for testing smart contracts. I use it all the time, and have seen it in lots of projects I audited. To clarify, I don't think this class should store a checksummed representation of the address. A |
@alcuadrado @s1na Hmm, I would also tend to not making stuff like this implicit but let the users (developers) decide what to choose. We can rather do some hint in the code comments? But also haven't completely made up my mind. |
After implementing EIP-1191, I reconsidered. As there are more than one checksum algorithms, |
This would be useful for me in ethereumjs/ethereumjs-monorepo#812 where I created my own I rebased this branch on master, updated the test file to ts, generated docs, and added a line in the readme. Would love to get this merged in and released. |
Just some reassurances before we proceed here:
|
yep! it's an additional class that doesn't affect anything else.
i don't anticipate so as the class is simply one reference to a buffer, however i would be interested in hearing others' opinions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I am through here with a review. Code + tests look good, I also like the API.
Side note: there were some issues raised on the library like #268 lately. Before we do another release we should first have a look here. |
TBH I'd be lying if I'd say anything about the performance impact based on intuition. |
As per the discussion in #182, this PR introduces a new class
Address
. It's experimental, and so I haven't yet exposed it. The API covers the most essential, but I think can probably be extended and improved, I'm open to ideas here. For the tests, I copied mostly fromtest/index.js
. I'm also thinking about what other types we can introduce, apart fromAddress
.