feat: upgrade to v2.0.0 with major dependency updates

- Upgrade Solana dependencies from 2.3.x to 3.0.0 series
  - Upgrade solana-streamer-sdk from 0.4.13 to 0.5.0
  - Upgrade yellowstone-grpc from 8.0.0 to 9.0.0
  - Add new SPL token utility modules (spl_token.rs, spl_token_2022.rs,
  spl_associated_token_account.rs)
  - Remove deprecated gRPC protocol definitions (protos/ directory)
  - Remove event_subscription example and update all example dependencies
  - Update README documentation to reflect v2.0.0 changes
  - Refactor imports to use new dependency structure across examples

  BREAKING CHANGES:
  - Solana SDK upgraded to 3.0.0 with API changes
  - Removed gRPC protocol definitions
  - Updated import paths for SPL token operations
This commit is contained in:
ysq
2025-09-27 14:24:41 +08:00
parent e75b0c9480
commit a7f673b43d
70 changed files with 502 additions and 3001 deletions
+6 -7
View File
@@ -5,11 +5,10 @@ use solana_sdk::{
instruction::{AccountMeta, Instruction},
pubkey::Pubkey,
};
use spl_associated_token_account::{
get_associated_token_address_with_program_id, ID as ASSOCIATED_TOKEN_PROGRAM_ID,
};
use std::num::NonZeroUsize;
use crate::common::{spl_associated_token_account::get_associated_token_address_with_program_id, spl_token::close_account};
const MAX_PDA_CACHE_SIZE: usize = 10000;
const MAX_ATA_CACHE_SIZE: usize = 10000;
const MAX_INSTRUCTION_CACHE_SIZE: usize = 10000;
@@ -104,7 +103,7 @@ pub fn _create_associated_token_account_idempotent_fast(
if use_seed
&& !mint.eq(&crate::constants::WSOL_TOKEN_ACCOUNT)
&& !mint.eq(&crate::constants::SOL_TOKEN_ACCOUNT)
&& token_program.eq(&spl_token::ID)
&& token_program.eq(&crate::constants::TOKEN_PROGRAM)
{
// Use cache to get instruction
get_cached_instructions(cache_key, || {
@@ -120,7 +119,7 @@ pub fn _create_associated_token_account_idempotent_fast(
// Create Associated Token Account instruction
// Reference implementation of spl_associated_token_account::instruction::create_associated_token_account
vec![Instruction {
program_id: ASSOCIATED_TOKEN_PROGRAM_ID,
program_id: crate::constants::ASSOCIATED_TOKEN_PROGRAM_ID,
accounts: vec![
AccountMeta::new(*payer, true), // Payer (signer, writable)
AccountMeta::new(associated_token_address, false), // ATA address (writable, non-signer)
@@ -247,7 +246,7 @@ fn _get_associated_token_address_with_program_id_fast(
let ata = if use_seed
&& !token_mint_address.eq(&crate::constants::WSOL_TOKEN_ACCOUNT)
&& !token_mint_address.eq(&crate::constants::SOL_TOKEN_ACCOUNT)
&& token_program_id.eq(&spl_token::ID)
&& token_program_id.eq(&crate::constants::TOKEN_PROGRAM)
{
super::seed::get_associated_token_address_with_program_id_use_seed(
wallet_address,
@@ -292,7 +291,7 @@ pub fn fast_init(payer: &Pubkey) {
wsol_token_account,
},
|| {
vec![spl_token::instruction::close_account(
vec![close_account(
&crate::constants::TOKEN_PROGRAM,
&wsol_token_account,
&payer,