Skip to content

Conversation

pxrl
Copy link
Collaborator

@pxrl pxrl commented Apr 8, 2025

SVM events emit addresses with base58-encoding. At least two addresses emitted within an FundsDeposited or FilledRelay event will need to be converted to a base16 EVM address. Make it easy by permitting the caller of EvmAddress.from() to specify the encoding, defaulting to base16. Also do the same for the SVM side (i.e. permit base16-encoded 32-byte addresses).

SVM events emit addresses with base58-encoding. At least two addresses
emitted within an FundsDeposited or FilledRelay event will need to be
converted to a base16 EVM address. Make it easy by permitting the caller
of EvmAddress.from() to specify the encoding, defaulting to base16.
@pxrl pxrl changed the title improve(Address): Support new EVM address from Base58 encoding improve(Address): Support new Address from nontraditional encoding Apr 9, 2025
@@ -223,8 +223,20 @@ export class EvmAddress extends Address {
}

// Constructs a new EvmAddress type.
static from(hexString: string): EvmAddress {
return new this(utils.arrayify(hexString));
static from(address: string, encoding: "base16" | "base58" = "base16"): EvmAddress {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nb. We have the option of inferring the encoding with a regex. That'd definitely be a UX improvement...not sure if we want to go there though.

@pxrl pxrl closed this May 20, 2025
@pxrl pxrl deleted the pxrl/base58EVMAddress branch May 20, 2025 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants