Skip to content

chore: use spl-* crates#212

Merged
lpahlavi merged 25 commits intomainfrom
lpahlavi/use-spl-associated-token-account-interface
Aug 22, 2025
Merged

chore: use spl-* crates#212
lpahlavi merged 25 commits intomainfrom
lpahlavi/use-spl-associated-token-account-interface

Conversation

@lpahlavi
Copy link
Contributor

@lpahlavi lpahlavi commented Aug 22, 2025

(XC-297) This is a follow-up to #197. Now that the solana-sdk dependencies are upgraded to v3, use the spl_associated_token_account_interface crate to compute associated token addresses (ATAs) and spl-token-interface crate to create an SPL transfer instruction in the basic_solana example and integration tests.

@lpahlavi lpahlavi changed the base branch from main to lpahlavi/remove-solana-sdk-fork August 22, 2025 08:32
@lpahlavi lpahlavi requested a review from gregorydemay August 22, 2025 09:03
@lpahlavi lpahlavi marked this pull request as ready for review August 22, 2025 09:03
@lpahlavi lpahlavi requested a review from a team as a code owner August 22, 2025 09:03
Copy link
Contributor

@gregorydemay gregorydemay left a comment

Choose a reason for hiding this comment

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

Nice clean-up @lpahlavi !


/// Creates an instruction to run the [`Transfer` instruction](https://github.com/solana-program/token/blob/main/interface/src/instruction.rs)
/// in the SPL Token program.
pub fn transfer_instruction_with_program_id(
Copy link
Contributor

Choose a reason for hiding this comment

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

@lpahlavi Did you check if we could also replace that function? (There is for example transfer in spl-token)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had a quick look actually. The problem is the spl-token crate still depends on the old v2 solana-* crates... This means we can't use it (yet). I thought I'd take care of the low-hanging fruits for now.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, thanks for having checked!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dug a bit deeper, turns out actually there is a different crate that did update their dependencies 💪 So done as well!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, well it turns out this would have been too easy... Actually the spl-token-2022-interface crate has a transitive dependency on wasm-bindgen through solana-zk-sdk. Also in case one would be tempted to use the spl-token-interface crate, it does not work with SPL 2022 tokens (see this check).

So I guess back to hardcoded transfer instructions 🫠

@lpahlavi lpahlavi changed the title chore: use spl-associated-token-account-interface chore: use spl-* crates Aug 22, 2025
Base automatically changed from lpahlavi/remove-solana-sdk-fork to main August 22, 2025 13:43
@lpahlavi lpahlavi merged commit 37729ba into main Aug 22, 2025
13 checks passed
@lpahlavi lpahlavi deleted the lpahlavi/use-spl-associated-token-account-interface branch August 22, 2025 14:50
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.

2 participants