-
Notifications
You must be signed in to change notification settings - Fork 18
feat: enable support for SVM in hubpool client #956
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat: enable support for SVM in hubpool client #956
Conversation
Signed-off-by: james-a-morris <[email protected]>
src/clients/HubPoolClient.ts
Outdated
); | ||
} | ||
// Store the full Solana address | ||
dataToAdd.spokePool = solanaSpokePool; |
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.
This address is formatted as a base58-encoded string, which makes a comparison with the truncated address difficult. Any considerations about whether we should reformat this to base 16? @bmzig's Address class might help with this.
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.
To do this effectively we'd have to change our interfaces/HubPool.ts
definitions. This would be a larger PR that I'd recommend we handle as a follow-up.
if (chainIsSvm(args.destinationChainId)) { | ||
const usdcTokenSol = TOKEN_SYMBOLS_MAP.USDC.addresses[args.destinationChainId]; | ||
const truncatedAddress = SvmAddress.from(usdcTokenSol).toEvmAddress(); | ||
if (destinationToken.toLowerCase() !== truncatedAddress.toLowerCase()) { |
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.
If we promote destinationToken
to an Address
type then we can do destinationToken.eq(truncatedAddress)
. This could be nice because you don't need to worry about string casing. Address
is not rolled out widely yet, but ideally we'll eventually be able to use it all over.
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.
src/utils/AddressUtils.ts
Outdated
override toEvmAddress(): string { | ||
return `0x${this.toBytes32().slice(-40)}`; | ||
} |
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.
We probably want to convert this to checksum case after truncating it.
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.
…context-aware-of-address
…ate address conversion Removed the unused deleteFromJson function from HubPoolClient and updated the toEvmAddress method in SvmAddress to use the toAddress utility for better clarity and consistency.
Signed-off-by: james-a-morris <[email protected]>
Ongoing work to incorporate solana into the hubpool client