Skip to content

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

james-a-morris
Copy link
Member

Ongoing work to incorporate solana into the hubpool client

Copy link

linear bot commented Apr 1, 2025

@amateima amateima self-requested a review April 2, 2025 13:41
@james-a-morris james-a-morris marked this pull request as ready for review April 2, 2025 16:24
);
}
// Store the full Solana address
dataToAdd.spokePool = solanaSpokePool;
Copy link
Contributor

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.

Copy link
Member Author

@james-a-morris james-a-morris Apr 15, 2025

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.

82e469f

if (chainIsSvm(args.destinationChainId)) {
const usdcTokenSol = TOKEN_SYMBOLS_MAP.USDC.addresses[args.destinationChainId];
const truncatedAddress = SvmAddress.from(usdcTokenSol).toEvmAddress();
if (destinationToken.toLowerCase() !== truncatedAddress.toLowerCase()) {
Copy link
Contributor

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Comment on lines 244 to 246
override toEvmAddress(): string {
return `0x${this.toBytes32().slice(-40)}`;
}
Copy link
Contributor

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

james-a-morris and others added 2 commits April 8, 2025 10:24
…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.
@james-a-morris james-a-morris requested a review from pxrl April 15, 2025 20:44
Signed-off-by: james-a-morris <[email protected]>
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