spl-token: New program feature flag (#21354)
* spl-token: Add feature flag for new release * Remove all spl token version declarations
This commit is contained in:
@ -25,9 +25,9 @@ solana-metrics = { path = "../metrics", version = "=1.9.0" }
|
||||
solana-runtime = { path = "../runtime", version = "=1.9.0" }
|
||||
solana-sdk = { path = "../sdk", version = "=1.9.0" }
|
||||
solana-vote-program = { path = "../programs/vote", version = "=1.9.0" }
|
||||
spl-associated-token-account-v1-0 = { package = "spl-associated-token-account", version = "=1.0.3", features = ["no-entrypoint"] }
|
||||
spl-associated-token-account = { version = "=1.0.3", features = ["no-entrypoint"] }
|
||||
spl-memo = { version = "=3.0.1", features = ["no-entrypoint"] }
|
||||
spl-token-v2-0 = { package = "spl-token", version = "=3.2.0", features = ["no-entrypoint"] }
|
||||
spl-token = { version = "=3.2.0", features = ["no-entrypoint"] }
|
||||
thiserror = "1.0"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
|
@ -6,10 +6,10 @@ use {
|
||||
solana_sdk::{instruction::CompiledInstruction, pubkey::Pubkey},
|
||||
};
|
||||
|
||||
// A helper function to convert spl_associated_token_account_v1_0::id() as spl_sdk::pubkey::Pubkey
|
||||
// A helper function to convert spl_associated_token_account::id() as spl_sdk::pubkey::Pubkey
|
||||
// to solana_sdk::pubkey::Pubkey
|
||||
pub fn spl_associated_token_id_v1_0() -> Pubkey {
|
||||
Pubkey::new_from_array(spl_associated_token_account_v1_0::id().to_bytes())
|
||||
pub fn spl_associated_token_id() -> Pubkey {
|
||||
Pubkey::new_from_array(spl_associated_token_account::id().to_bytes())
|
||||
}
|
||||
|
||||
pub fn parse_associated_token(
|
||||
@ -51,7 +51,7 @@ fn check_num_associated_token_accounts(
|
||||
mod test {
|
||||
use {
|
||||
super::*,
|
||||
spl_associated_token_account_v1_0::{
|
||||
spl_associated_token_account::{
|
||||
create_associated_token_account,
|
||||
solana_program::{
|
||||
instruction::CompiledInstruction as SplAssociatedTokenCompiledInstruction,
|
||||
|
@ -1,7 +1,7 @@
|
||||
use {
|
||||
crate::{
|
||||
extract_memos::{spl_memo_id_v1, spl_memo_id_v3},
|
||||
parse_associated_token::{parse_associated_token, spl_associated_token_id_v1_0},
|
||||
parse_associated_token::{parse_associated_token, spl_associated_token_id},
|
||||
parse_bpf_loader::{parse_bpf_loader, parse_bpf_upgradeable_loader},
|
||||
parse_stake::parse_stake,
|
||||
parse_system::parse_system,
|
||||
@ -10,7 +10,7 @@ use {
|
||||
},
|
||||
inflector::Inflector,
|
||||
serde_json::Value,
|
||||
solana_account_decoder::parse_token::spl_token_id_v2_0,
|
||||
solana_account_decoder::parse_token::spl_token_id,
|
||||
solana_sdk::{instruction::CompiledInstruction, pubkey::Pubkey, stake, system_program},
|
||||
std::{
|
||||
collections::HashMap,
|
||||
@ -20,14 +20,14 @@ use {
|
||||
};
|
||||
|
||||
lazy_static! {
|
||||
static ref ASSOCIATED_TOKEN_PROGRAM_ID: Pubkey = spl_associated_token_id_v1_0();
|
||||
static ref ASSOCIATED_TOKEN_PROGRAM_ID: Pubkey = spl_associated_token_id();
|
||||
static ref BPF_LOADER_PROGRAM_ID: Pubkey = solana_sdk::bpf_loader::id();
|
||||
static ref BPF_UPGRADEABLE_LOADER_PROGRAM_ID: Pubkey = solana_sdk::bpf_loader_upgradeable::id();
|
||||
static ref MEMO_V1_PROGRAM_ID: Pubkey = spl_memo_id_v1();
|
||||
static ref MEMO_V3_PROGRAM_ID: Pubkey = spl_memo_id_v3();
|
||||
static ref STAKE_PROGRAM_ID: Pubkey = stake::program::id();
|
||||
static ref SYSTEM_PROGRAM_ID: Pubkey = system_program::id();
|
||||
static ref TOKEN_PROGRAM_ID: Pubkey = spl_token_id_v2_0();
|
||||
static ref TOKEN_PROGRAM_ID: Pubkey = spl_token_id();
|
||||
static ref VOTE_PROGRAM_ID: Pubkey = solana_vote_program::id();
|
||||
static ref PARSABLE_PROGRAM_IDS: HashMap<Pubkey, ParsableProgram> = {
|
||||
let mut m = HashMap::new();
|
||||
|
@ -3,12 +3,12 @@ use {
|
||||
check_num_accounts, ParsableProgram, ParseInstructionError, ParsedInstructionEnum,
|
||||
},
|
||||
serde_json::{json, Map, Value},
|
||||
solana_account_decoder::parse_token::{pubkey_from_spl_token_v2_0, token_amount_to_ui_amount},
|
||||
solana_account_decoder::parse_token::{pubkey_from_spl_token, token_amount_to_ui_amount},
|
||||
solana_sdk::{
|
||||
instruction::{AccountMeta, CompiledInstruction, Instruction},
|
||||
pubkey::Pubkey,
|
||||
},
|
||||
spl_token_v2_0::{
|
||||
spl_token::{
|
||||
instruction::{AuthorityType, TokenInstruction},
|
||||
solana_program::{
|
||||
instruction::Instruction as SplTokenInstruction, program_option::COption,
|
||||
@ -438,14 +438,14 @@ fn check_num_token_accounts(accounts: &[u8], num: usize) -> Result<(), ParseInst
|
||||
check_num_accounts(accounts, num, ParsableProgram::SplToken)
|
||||
}
|
||||
|
||||
pub fn spl_token_v2_0_instruction(instruction: SplTokenInstruction) -> Instruction {
|
||||
pub fn spl_token_instruction(instruction: SplTokenInstruction) -> Instruction {
|
||||
Instruction {
|
||||
program_id: pubkey_from_spl_token_v2_0(&instruction.program_id),
|
||||
program_id: pubkey_from_spl_token(&instruction.program_id),
|
||||
accounts: instruction
|
||||
.accounts
|
||||
.iter()
|
||||
.map(|meta| AccountMeta {
|
||||
pubkey: pubkey_from_spl_token_v2_0(&meta.pubkey),
|
||||
pubkey: pubkey_from_spl_token(&meta.pubkey),
|
||||
is_signer: meta.is_signer,
|
||||
is_writable: meta.is_writable,
|
||||
})
|
||||
@ -459,7 +459,7 @@ mod test {
|
||||
use {
|
||||
super::*,
|
||||
solana_sdk::instruction::CompiledInstruction,
|
||||
spl_token_v2_0::{
|
||||
spl_token::{
|
||||
instruction::*,
|
||||
solana_program::{
|
||||
instruction::CompiledInstruction as SplTokenCompiledInstruction, message::Message,
|
||||
@ -493,7 +493,7 @@ mod test {
|
||||
|
||||
// Test InitializeMint variations
|
||||
let initialize_mint_ix = initialize_mint(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[0]),
|
||||
&convert_pubkey(keys[2]),
|
||||
Some(&convert_pubkey(keys[3])),
|
||||
@ -517,7 +517,7 @@ mod test {
|
||||
);
|
||||
|
||||
let initialize_mint_ix = initialize_mint(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[0]),
|
||||
&convert_pubkey(keys[2]),
|
||||
None,
|
||||
@ -541,7 +541,7 @@ mod test {
|
||||
|
||||
// Test InitializeAccount
|
||||
let initialize_account_ix = initialize_account(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[0]),
|
||||
&convert_pubkey(keys[1]),
|
||||
&convert_pubkey(keys[2]),
|
||||
@ -564,7 +564,7 @@ mod test {
|
||||
|
||||
// Test InitializeMultisig
|
||||
let initialize_multisig_ix = initialize_multisig(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[0]),
|
||||
&[
|
||||
&convert_pubkey(keys[2]),
|
||||
@ -591,7 +591,7 @@ mod test {
|
||||
|
||||
// Test Transfer, incl multisig
|
||||
let transfer_ix = transfer(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[1]),
|
||||
&convert_pubkey(keys[2]),
|
||||
&convert_pubkey(keys[0]),
|
||||
@ -615,7 +615,7 @@ mod test {
|
||||
);
|
||||
|
||||
let transfer_ix = transfer(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[2]),
|
||||
&convert_pubkey(keys[3]),
|
||||
&convert_pubkey(keys[4]),
|
||||
@ -641,7 +641,7 @@ mod test {
|
||||
|
||||
// Test Approve, incl multisig
|
||||
let approve_ix = approve(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[1]),
|
||||
&convert_pubkey(keys[2]),
|
||||
&convert_pubkey(keys[0]),
|
||||
@ -665,7 +665,7 @@ mod test {
|
||||
);
|
||||
|
||||
let approve_ix = approve(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[2]),
|
||||
&convert_pubkey(keys[3]),
|
||||
&convert_pubkey(keys[4]),
|
||||
@ -691,7 +691,7 @@ mod test {
|
||||
|
||||
// Test Revoke
|
||||
let revoke_ix = revoke(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[1]),
|
||||
&convert_pubkey(keys[0]),
|
||||
&[],
|
||||
@ -712,7 +712,7 @@ mod test {
|
||||
|
||||
// Test SetOwner
|
||||
let set_authority_ix = set_authority(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[0]),
|
||||
Some(&convert_pubkey(keys[2])),
|
||||
AuthorityType::FreezeAccount,
|
||||
@ -736,7 +736,7 @@ mod test {
|
||||
);
|
||||
|
||||
let set_authority_ix = set_authority(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[1]),
|
||||
None,
|
||||
AuthorityType::CloseAccount,
|
||||
@ -762,7 +762,7 @@ mod test {
|
||||
|
||||
// Test MintTo
|
||||
let mint_to_ix = mint_to(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[1]),
|
||||
&convert_pubkey(keys[2]),
|
||||
&convert_pubkey(keys[0]),
|
||||
@ -787,7 +787,7 @@ mod test {
|
||||
|
||||
// Test Burn
|
||||
let burn_ix = burn(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[1]),
|
||||
&convert_pubkey(keys[2]),
|
||||
&convert_pubkey(keys[0]),
|
||||
@ -812,7 +812,7 @@ mod test {
|
||||
|
||||
// Test CloseAccount
|
||||
let close_account_ix = close_account(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[1]),
|
||||
&convert_pubkey(keys[2]),
|
||||
&convert_pubkey(keys[0]),
|
||||
@ -835,7 +835,7 @@ mod test {
|
||||
|
||||
// Test FreezeAccount
|
||||
let freeze_account_ix = freeze_account(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[1]),
|
||||
&convert_pubkey(keys[2]),
|
||||
&convert_pubkey(keys[0]),
|
||||
@ -858,7 +858,7 @@ mod test {
|
||||
|
||||
// Test ThawAccount
|
||||
let thaw_account_ix = thaw_account(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[1]),
|
||||
&convert_pubkey(keys[2]),
|
||||
&convert_pubkey(keys[0]),
|
||||
@ -881,7 +881,7 @@ mod test {
|
||||
|
||||
// Test TransferChecked, incl multisig
|
||||
let transfer_ix = transfer_checked(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[0]),
|
||||
&convert_pubkey(keys[1]),
|
||||
&convert_pubkey(keys[2]),
|
||||
@ -913,7 +913,7 @@ mod test {
|
||||
);
|
||||
|
||||
let transfer_ix = transfer_checked(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[2]),
|
||||
&convert_pubkey(keys[3]),
|
||||
&convert_pubkey(keys[4]),
|
||||
@ -947,7 +947,7 @@ mod test {
|
||||
|
||||
// Test ApproveChecked, incl multisig
|
||||
let approve_ix = approve_checked(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[1]),
|
||||
&convert_pubkey(keys[2]),
|
||||
&convert_pubkey(keys[3]),
|
||||
@ -979,7 +979,7 @@ mod test {
|
||||
);
|
||||
|
||||
let approve_ix = approve_checked(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[2]),
|
||||
&convert_pubkey(keys[3]),
|
||||
&convert_pubkey(keys[4]),
|
||||
@ -1013,7 +1013,7 @@ mod test {
|
||||
|
||||
// Test MintToChecked
|
||||
let mint_to_ix = mint_to_checked(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[1]),
|
||||
&convert_pubkey(keys[2]),
|
||||
&convert_pubkey(keys[0]),
|
||||
@ -1044,7 +1044,7 @@ mod test {
|
||||
|
||||
// Test BurnChecked
|
||||
let burn_ix = burn_checked(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[1]),
|
||||
&convert_pubkey(keys[2]),
|
||||
&convert_pubkey(keys[0]),
|
||||
@ -1074,7 +1074,7 @@ mod test {
|
||||
);
|
||||
|
||||
// Test SyncNative
|
||||
let sync_native_ix = sync_native(&spl_token_v2_0::id(), &convert_pubkey(keys[0])).unwrap();
|
||||
let sync_native_ix = sync_native(&spl_token::id(), &convert_pubkey(keys[0])).unwrap();
|
||||
let message = Message::new(&[sync_native_ix], None);
|
||||
let compiled_instruction = convert_compiled_instruction(&message.instructions[0]);
|
||||
assert_eq!(
|
||||
@ -1098,7 +1098,7 @@ mod test {
|
||||
|
||||
// Test InitializeMint variations
|
||||
let initialize_mint_ix = initialize_mint(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[0]),
|
||||
&convert_pubkey(keys[1]),
|
||||
Some(&convert_pubkey(keys[2])),
|
||||
@ -1113,7 +1113,7 @@ mod test {
|
||||
assert!(parse_token(&compiled_instruction, &keys).is_err());
|
||||
|
||||
let initialize_mint_ix = initialize_mint(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[0]),
|
||||
&convert_pubkey(keys[1]),
|
||||
None,
|
||||
@ -1129,7 +1129,7 @@ mod test {
|
||||
|
||||
// Test InitializeAccount
|
||||
let initialize_account_ix = initialize_account(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[0]),
|
||||
&convert_pubkey(keys[1]),
|
||||
&convert_pubkey(keys[2]),
|
||||
@ -1144,7 +1144,7 @@ mod test {
|
||||
|
||||
// Test InitializeMultisig
|
||||
let initialize_multisig_ix = initialize_multisig(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[0]),
|
||||
&[
|
||||
&convert_pubkey(keys[1]),
|
||||
@ -1163,7 +1163,7 @@ mod test {
|
||||
|
||||
// Test Transfer, incl multisig
|
||||
let transfer_ix = transfer(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[1]),
|
||||
&convert_pubkey(keys[2]),
|
||||
&convert_pubkey(keys[0]),
|
||||
@ -1179,7 +1179,7 @@ mod test {
|
||||
assert!(parse_token(&compiled_instruction, &keys).is_err());
|
||||
|
||||
let transfer_ix = transfer(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[2]),
|
||||
&convert_pubkey(keys[3]),
|
||||
&convert_pubkey(keys[4]),
|
||||
@ -1196,7 +1196,7 @@ mod test {
|
||||
|
||||
// Test Approve, incl multisig
|
||||
let approve_ix = approve(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[1]),
|
||||
&convert_pubkey(keys[2]),
|
||||
&convert_pubkey(keys[0]),
|
||||
@ -1212,7 +1212,7 @@ mod test {
|
||||
assert!(parse_token(&compiled_instruction, &keys).is_err());
|
||||
|
||||
let approve_ix = approve(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[2]),
|
||||
&convert_pubkey(keys[3]),
|
||||
&convert_pubkey(keys[4]),
|
||||
@ -1229,7 +1229,7 @@ mod test {
|
||||
|
||||
// Test Revoke
|
||||
let revoke_ix = revoke(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[1]),
|
||||
&convert_pubkey(keys[0]),
|
||||
&[],
|
||||
@ -1244,7 +1244,7 @@ mod test {
|
||||
|
||||
// Test SetAuthority
|
||||
let set_authority_ix = set_authority(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[1]),
|
||||
Some(&convert_pubkey(keys[2])),
|
||||
AuthorityType::FreezeAccount,
|
||||
@ -1261,7 +1261,7 @@ mod test {
|
||||
|
||||
// Test MintTo
|
||||
let mint_to_ix = mint_to(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[1]),
|
||||
&convert_pubkey(keys[2]),
|
||||
&convert_pubkey(keys[0]),
|
||||
@ -1278,7 +1278,7 @@ mod test {
|
||||
|
||||
// Test Burn
|
||||
let burn_ix = burn(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[1]),
|
||||
&convert_pubkey(keys[2]),
|
||||
&convert_pubkey(keys[0]),
|
||||
@ -1295,7 +1295,7 @@ mod test {
|
||||
|
||||
// Test CloseAccount
|
||||
let close_account_ix = close_account(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[1]),
|
||||
&convert_pubkey(keys[2]),
|
||||
&convert_pubkey(keys[0]),
|
||||
@ -1311,7 +1311,7 @@ mod test {
|
||||
|
||||
// Test FreezeAccount
|
||||
let freeze_account_ix = freeze_account(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[1]),
|
||||
&convert_pubkey(keys[2]),
|
||||
&convert_pubkey(keys[0]),
|
||||
@ -1327,7 +1327,7 @@ mod test {
|
||||
|
||||
// Test ThawAccount
|
||||
let thaw_account_ix = thaw_account(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[1]),
|
||||
&convert_pubkey(keys[2]),
|
||||
&convert_pubkey(keys[0]),
|
||||
@ -1343,7 +1343,7 @@ mod test {
|
||||
|
||||
// Test TransferChecked, incl multisig
|
||||
let transfer_ix = transfer_checked(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[1]),
|
||||
&convert_pubkey(keys[2]),
|
||||
&convert_pubkey(keys[3]),
|
||||
@ -1361,7 +1361,7 @@ mod test {
|
||||
assert!(parse_token(&compiled_instruction, &keys).is_err());
|
||||
|
||||
let transfer_ix = transfer_checked(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[2]),
|
||||
&convert_pubkey(keys[3]),
|
||||
&convert_pubkey(keys[4]),
|
||||
@ -1380,7 +1380,7 @@ mod test {
|
||||
|
||||
// Test ApproveChecked, incl multisig
|
||||
let approve_ix = approve_checked(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[1]),
|
||||
&convert_pubkey(keys[2]),
|
||||
&convert_pubkey(keys[3]),
|
||||
@ -1398,7 +1398,7 @@ mod test {
|
||||
assert!(parse_token(&compiled_instruction, &keys).is_err());
|
||||
|
||||
let approve_ix = approve_checked(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[2]),
|
||||
&convert_pubkey(keys[3]),
|
||||
&convert_pubkey(keys[4]),
|
||||
@ -1417,7 +1417,7 @@ mod test {
|
||||
|
||||
// Test MintToChecked
|
||||
let mint_to_ix = mint_to_checked(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[1]),
|
||||
&convert_pubkey(keys[2]),
|
||||
&convert_pubkey(keys[0]),
|
||||
@ -1435,7 +1435,7 @@ mod test {
|
||||
|
||||
// Test BurnChecked
|
||||
let burn_ix = burn_checked(
|
||||
&spl_token_v2_0::id(),
|
||||
&spl_token::id(),
|
||||
&convert_pubkey(keys[1]),
|
||||
&convert_pubkey(keys[2]),
|
||||
&convert_pubkey(keys[0]),
|
||||
@ -1452,7 +1452,7 @@ mod test {
|
||||
assert!(parse_token(&compiled_instruction, &keys).is_err());
|
||||
|
||||
// Test SyncNative
|
||||
let sync_native_ix = sync_native(&spl_token_v2_0::id(), &convert_pubkey(keys[0])).unwrap();
|
||||
let sync_native_ix = sync_native(&spl_token::id(), &convert_pubkey(keys[0])).unwrap();
|
||||
let message = Message::new(&[sync_native_ix], None);
|
||||
let mut compiled_instruction = convert_compiled_instruction(&message.instructions[0]);
|
||||
assert!(parse_token(&compiled_instruction, &[]).is_err());
|
||||
|
@ -1,14 +1,14 @@
|
||||
use {
|
||||
crate::TransactionTokenBalance,
|
||||
solana_account_decoder::parse_token::{
|
||||
pubkey_from_spl_token_v2_0, spl_token_id_v2_0, spl_token_v2_0_native_mint,
|
||||
token_amount_to_ui_amount, UiTokenAmount,
|
||||
pubkey_from_spl_token, spl_token_id, spl_token_native_mint, token_amount_to_ui_amount,
|
||||
UiTokenAmount,
|
||||
},
|
||||
solana_measure::measure::Measure,
|
||||
solana_metrics::datapoint_debug,
|
||||
solana_runtime::{bank::Bank, transaction_batch::TransactionBatch},
|
||||
solana_sdk::{account::ReadableAccount, pubkey::Pubkey},
|
||||
spl_token_v2_0::{
|
||||
spl_token::{
|
||||
solana_program::program_pack::Pack,
|
||||
state::{Account as TokenAccount, Mint},
|
||||
},
|
||||
@ -36,12 +36,12 @@ impl TransactionTokenBalancesSet {
|
||||
}
|
||||
|
||||
fn is_token_program(program_id: &Pubkey) -> bool {
|
||||
program_id == &spl_token_id_v2_0()
|
||||
program_id == &spl_token_id()
|
||||
}
|
||||
|
||||
fn get_mint_decimals(bank: &Bank, mint: &Pubkey) -> Option<u8> {
|
||||
if mint == &spl_token_v2_0_native_mint() {
|
||||
Some(spl_token_v2_0::native_mint::DECIMALS)
|
||||
if mint == &spl_token_native_mint() {
|
||||
Some(spl_token::native_mint::DECIMALS)
|
||||
} else {
|
||||
let mint_account = bank.get_account(mint)?;
|
||||
|
||||
@ -113,7 +113,7 @@ fn collect_token_balance_from_account(
|
||||
let account = bank.get_account(account_id)?;
|
||||
|
||||
let token_account = TokenAccount::unpack(account.data()).ok()?;
|
||||
let mint = pubkey_from_spl_token_v2_0(&token_account.mint);
|
||||
let mint = pubkey_from_spl_token(&token_account.mint);
|
||||
|
||||
let decimals = mint_decimals.get(&mint).cloned().or_else(|| {
|
||||
let decimals = get_mint_decimals(bank, &mint)?;
|
||||
|
Reference in New Issue
Block a user