* Bump spl-token (#12395)
(cherry picked from commit e1a212fb79
)
# Conflicts:
# Cargo.lock
# account-decoder/Cargo.toml
# core/Cargo.toml
# transaction-status/Cargo.toml
* Fix conflicts
Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
Co-authored-by: Tyera Eulberg <tyera@solana.com>
This commit is contained in:
34
Cargo.lock
generated
34
Cargo.lock
generated
@ -3656,9 +3656,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "solana-crate-features"
|
||||
version = "1.3.5"
|
||||
version = "1.3.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f60a268f63ce5ccc4e7283077cc5c867764759f00fa4241ca58deaa74a29bd01"
|
||||
checksum = "0cb500621867cd1e9297ca989bd754f4bf52772c7ea8cd2cb3616c1c75e9f62d"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"bytes 0.4.12",
|
||||
@ -3994,9 +3994,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "solana-logger"
|
||||
version = "1.3.5"
|
||||
version = "1.3.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e79e1cece7027026b97a1aa87aeddaefd3241aad5159d8b1a63c0bc11d33576d"
|
||||
checksum = "10fa1615c22d1d63230e7aeaf421321c24ea4746e2e4842cc0694adf5916c1b8"
|
||||
dependencies = [
|
||||
"env_logger",
|
||||
"lazy_static",
|
||||
@ -4253,9 +4253,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "solana-sdk"
|
||||
version = "1.3.5"
|
||||
version = "1.3.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0cd7695b4a6ded0b3610a109dca3bd34f272fccf4f143864a30634658f5a7e68"
|
||||
checksum = "191c1799a2f43eb2f2a97ff8daaeed3bdeb7bee4a3e746bac4618b4eb8b81df9"
|
||||
dependencies = [
|
||||
"assert_matches",
|
||||
"bincode",
|
||||
@ -4283,9 +4283,9 @@ dependencies = [
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"sha2",
|
||||
"solana-crate-features 1.3.5",
|
||||
"solana-logger 1.3.5",
|
||||
"solana-sdk-macro 1.3.5",
|
||||
"solana-crate-features 1.3.12",
|
||||
"solana-logger 1.3.12",
|
||||
"solana-sdk-macro 1.3.12",
|
||||
"solana-sdk-macro-frozen-abi",
|
||||
"thiserror",
|
||||
]
|
||||
@ -4303,9 +4303,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "solana-sdk-macro"
|
||||
version = "1.3.5"
|
||||
version = "1.3.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc0d2d378b5563e04e56fc22f92164d1ba78a43d244b77ec054f564290ae8469"
|
||||
checksum = "a1c48e7c0d81123734b9074ad03546e89508e2ab12d3aca008184f284b62abc9"
|
||||
dependencies = [
|
||||
"bs58",
|
||||
"proc-macro2 1.0.19",
|
||||
@ -4316,9 +4316,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "solana-sdk-macro-frozen-abi"
|
||||
version = "1.3.5"
|
||||
version = "1.3.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a9b012fab0634311c8b6176ee1d6874a39f7b0bad8b647fe2cf36f687151728"
|
||||
checksum = "d64fed6f7a226c02c48b539cae879c0eef9f64be08986b248d8ad4cec4328945"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"proc-macro2 1.0.19",
|
||||
@ -4646,21 +4646,21 @@ version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b303bab17e0c696de6d7550ba6f05a5a6dbf5c5d1597e68a4592899072e1c07a"
|
||||
dependencies = [
|
||||
"solana-sdk 1.3.5",
|
||||
"solana-sdk 1.3.12",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spl-token"
|
||||
version = "2.0.3"
|
||||
version = "2.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "813ab51fcfeabfc60157e6556b96cf005bab55321508053ade8c9f9bcfe5ce0b"
|
||||
checksum = "8c27a47fea402cc7f6d33274310565222ec3213f2df5ba7877e625b17286423b"
|
||||
dependencies = [
|
||||
"arrayref",
|
||||
"num-derive 0.3.0",
|
||||
"num-traits",
|
||||
"num_enum",
|
||||
"remove_dir_all",
|
||||
"solana-sdk 1.3.5",
|
||||
"solana-sdk 1.3.12",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
|
@ -22,7 +22,7 @@ solana-config-program = { path = "../programs/config", version = "1.2.30" }
|
||||
solana-sdk = { path = "../sdk", version = "1.2.30" }
|
||||
solana-stake-program = { path = "../programs/stake", version = "1.2.30" }
|
||||
solana-vote-program = { path = "../programs/vote", version = "1.2.30" }
|
||||
spl-token-v2-0 = { package = "spl-token", version = "2.0.3", features = ["skip-no-mangle"] }
|
||||
spl-token-v2-0 = { package = "spl-token", version = "2.0.6", features = ["skip-no-mangle"] }
|
||||
thiserror = "1.0"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
|
@ -4,9 +4,7 @@ use crate::{
|
||||
};
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use spl_token_v2_0::{
|
||||
option::COption,
|
||||
pack::Pack,
|
||||
solana_sdk::pubkey::Pubkey as SplTokenPubkey,
|
||||
solana_sdk::{program_option::COption, program_pack::Pack, pubkey::Pubkey as SplTokenPubkey},
|
||||
state::{Account, AccountState, Mint, Multisig},
|
||||
};
|
||||
use std::str::FromStr;
|
||||
@ -202,16 +200,14 @@ mod test {
|
||||
let mint_pubkey = SplTokenPubkey::new(&[2; 32]);
|
||||
let owner_pubkey = SplTokenPubkey::new(&[3; 32]);
|
||||
let mut account_data = vec![0; Account::get_packed_len()];
|
||||
Account::unpack_unchecked_mut(&mut account_data, &mut |account: &mut Account| {
|
||||
account.mint = mint_pubkey;
|
||||
account.owner = owner_pubkey;
|
||||
account.amount = 42;
|
||||
account.state = AccountState::Initialized;
|
||||
account.is_native = COption::None;
|
||||
account.close_authority = COption::Some(owner_pubkey);
|
||||
Ok(())
|
||||
})
|
||||
.unwrap();
|
||||
let mut account = Account::unpack_unchecked(&account_data).unwrap();
|
||||
account.mint = mint_pubkey;
|
||||
account.owner = owner_pubkey;
|
||||
account.amount = 42;
|
||||
account.state = AccountState::Initialized;
|
||||
account.is_native = COption::None;
|
||||
account.close_authority = COption::Some(owner_pubkey);
|
||||
Account::pack(account, &mut account_data).unwrap();
|
||||
|
||||
assert!(parse_token(&account_data, None).is_err());
|
||||
assert_eq!(
|
||||
@ -234,15 +230,13 @@ mod test {
|
||||
);
|
||||
|
||||
let mut mint_data = vec![0; Mint::get_packed_len()];
|
||||
Mint::unpack_unchecked_mut(&mut mint_data, &mut |mint: &mut Mint| {
|
||||
mint.mint_authority = COption::Some(owner_pubkey);
|
||||
mint.supply = 42;
|
||||
mint.decimals = 3;
|
||||
mint.is_initialized = true;
|
||||
mint.freeze_authority = COption::Some(owner_pubkey);
|
||||
Ok(())
|
||||
})
|
||||
.unwrap();
|
||||
let mut mint = Mint::unpack_unchecked(&mint_data).unwrap();
|
||||
mint.mint_authority = COption::Some(owner_pubkey);
|
||||
mint.supply = 42;
|
||||
mint.decimals = 3;
|
||||
mint.is_initialized = true;
|
||||
mint.freeze_authority = COption::Some(owner_pubkey);
|
||||
Mint::pack(mint, &mut mint_data).unwrap();
|
||||
|
||||
assert_eq!(
|
||||
parse_token(&mint_data, None).unwrap(),
|
||||
@ -263,14 +257,13 @@ mod test {
|
||||
signers[0] = signer1;
|
||||
signers[1] = signer2;
|
||||
signers[2] = signer3;
|
||||
Multisig::unpack_unchecked_mut(&mut multisig_data, &mut |multisig: &mut Multisig| {
|
||||
multisig.m = 2;
|
||||
multisig.n = 3;
|
||||
multisig.is_initialized = true;
|
||||
multisig.signers = signers;
|
||||
Ok(())
|
||||
})
|
||||
.unwrap();
|
||||
let mut multisig = Multisig::unpack_unchecked(&multisig_data).unwrap();
|
||||
multisig.m = 2;
|
||||
multisig.n = 3;
|
||||
multisig.is_initialized = true;
|
||||
multisig.signers = signers;
|
||||
Multisig::pack(multisig, &mut multisig_data).unwrap();
|
||||
|
||||
assert_eq!(
|
||||
parse_token(&multisig_data, None).unwrap(),
|
||||
TokenAccountType::Multisig(UiMultisig {
|
||||
@ -293,11 +286,9 @@ mod test {
|
||||
fn test_get_token_account_mint() {
|
||||
let mint_pubkey = SplTokenPubkey::new(&[2; 32]);
|
||||
let mut account_data = vec![0; Account::get_packed_len()];
|
||||
Account::unpack_unchecked_mut(&mut account_data, &mut |account: &mut Account| {
|
||||
account.mint = mint_pubkey;
|
||||
Ok(())
|
||||
})
|
||||
.unwrap();
|
||||
let mut account = Account::unpack_unchecked(&account_data).unwrap();
|
||||
account.mint = mint_pubkey;
|
||||
Account::pack(account, &mut account_data).unwrap();
|
||||
|
||||
let expected_mint_pubkey = Pubkey::new(&[2; 32]);
|
||||
assert_eq!(
|
||||
|
@ -67,7 +67,7 @@ solana-version = { path = "../version", version = "1.2.30" }
|
||||
solana-vote-program = { path = "../programs/vote", version = "1.2.30" }
|
||||
solana-vote-signer = { path = "../vote-signer", version = "1.2.30" }
|
||||
solana-rayon-threadlimit = { path = "../rayon-threadlimit", version = "1.2.30" }
|
||||
spl-token-v2-0 = { package = "spl-token", version = "2.0.3", features = ["skip-no-mangle"] }
|
||||
spl-token-v2-0 = { package = "spl-token", version = "2.0.6", features = ["skip-no-mangle"] }
|
||||
tempfile = "3.1.0"
|
||||
thiserror = "1.0"
|
||||
tokio = { version = "0.2.22", features = ["full"] }
|
||||
|
164
core/src/rpc.rs
164
core/src/rpc.rs
@ -61,7 +61,7 @@ use solana_transaction_status::{
|
||||
};
|
||||
use solana_vote_program::vote_state::{VoteState, MAX_LOCKOUT_HISTORY};
|
||||
use spl_token_v2_0::{
|
||||
pack::Pack,
|
||||
solana_sdk::program_pack::Pack,
|
||||
state::{Account as TokenAccount, Mint},
|
||||
};
|
||||
use std::{
|
||||
@ -2513,8 +2513,9 @@ pub mod tests {
|
||||
vote_state::{Vote, VoteInit, MAX_LOCKOUT_HISTORY},
|
||||
};
|
||||
use spl_token_v2_0::{
|
||||
option::COption, solana_sdk::pubkey::Pubkey as SplTokenPubkey,
|
||||
state::AccountState as TokenAccountState, state::Mint,
|
||||
solana_sdk::{program_option::COption, pubkey::Pubkey as SplTokenPubkey},
|
||||
state::AccountState as TokenAccountState,
|
||||
state::Mint,
|
||||
};
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
@ -4859,20 +4860,17 @@ pub mod tests {
|
||||
let mint = SplTokenPubkey::new(&[2; 32]);
|
||||
let owner = SplTokenPubkey::new(&[3; 32]);
|
||||
let delegate = SplTokenPubkey::new(&[4; 32]);
|
||||
TokenAccount::unpack_unchecked_mut(&mut account_data, &mut |account: &mut TokenAccount| {
|
||||
*account = TokenAccount {
|
||||
mint,
|
||||
owner,
|
||||
delegate: COption::Some(delegate),
|
||||
amount: 420,
|
||||
state: TokenAccountState::Initialized,
|
||||
is_native: COption::None,
|
||||
delegated_amount: 30,
|
||||
close_authority: COption::Some(owner),
|
||||
};
|
||||
Ok(())
|
||||
})
|
||||
.unwrap();
|
||||
let token_account = TokenAccount {
|
||||
mint,
|
||||
owner,
|
||||
delegate: COption::Some(delegate),
|
||||
amount: 420,
|
||||
state: TokenAccountState::Initialized,
|
||||
is_native: COption::None,
|
||||
delegated_amount: 30,
|
||||
close_authority: COption::Some(owner),
|
||||
};
|
||||
TokenAccount::pack(token_account, &mut account_data).unwrap();
|
||||
let token_account = Account {
|
||||
lamports: 111,
|
||||
data: account_data.to_vec(),
|
||||
@ -4884,17 +4882,14 @@ pub mod tests {
|
||||
|
||||
// Add the mint
|
||||
let mut mint_data = vec![0; Mint::get_packed_len()];
|
||||
Mint::unpack_unchecked_mut(&mut mint_data, &mut |mint: &mut Mint| {
|
||||
*mint = Mint {
|
||||
mint_authority: COption::Some(owner),
|
||||
supply: 500,
|
||||
decimals: 2,
|
||||
is_initialized: true,
|
||||
freeze_authority: COption::Some(owner),
|
||||
};
|
||||
Ok(())
|
||||
})
|
||||
.unwrap();
|
||||
let mint_state = Mint {
|
||||
mint_authority: COption::Some(owner),
|
||||
supply: 500,
|
||||
decimals: 2,
|
||||
is_initialized: true,
|
||||
freeze_authority: COption::Some(owner),
|
||||
};
|
||||
Mint::pack(mint_state, &mut mint_data).unwrap();
|
||||
let mint_account = Account {
|
||||
lamports: 111,
|
||||
data: mint_data.to_vec(),
|
||||
@ -4959,20 +4954,17 @@ pub mod tests {
|
||||
// Add another token account with the same owner and delegate but different mint
|
||||
let mut account_data = vec![0; TokenAccount::get_packed_len()];
|
||||
let new_mint = SplTokenPubkey::new(&[5; 32]);
|
||||
TokenAccount::unpack_unchecked_mut(&mut account_data, &mut |account: &mut TokenAccount| {
|
||||
*account = TokenAccount {
|
||||
mint: new_mint,
|
||||
owner,
|
||||
delegate: COption::Some(delegate),
|
||||
amount: 42,
|
||||
state: TokenAccountState::Initialized,
|
||||
is_native: COption::None,
|
||||
delegated_amount: 30,
|
||||
close_authority: COption::Some(owner),
|
||||
};
|
||||
Ok(())
|
||||
})
|
||||
.unwrap();
|
||||
let token_account = TokenAccount {
|
||||
mint: new_mint,
|
||||
owner,
|
||||
delegate: COption::Some(delegate),
|
||||
amount: 42,
|
||||
state: TokenAccountState::Initialized,
|
||||
is_native: COption::None,
|
||||
delegated_amount: 30,
|
||||
close_authority: COption::Some(owner),
|
||||
};
|
||||
TokenAccount::pack(token_account, &mut account_data).unwrap();
|
||||
let token_account = Account {
|
||||
lamports: 111,
|
||||
data: account_data.to_vec(),
|
||||
@ -5184,17 +5176,14 @@ pub mod tests {
|
||||
|
||||
// Add new_mint, and another token account on new_mint with different balance
|
||||
let mut mint_data = vec![0; Mint::get_packed_len()];
|
||||
Mint::unpack_unchecked_mut(&mut mint_data, &mut |mint: &mut Mint| {
|
||||
*mint = Mint {
|
||||
mint_authority: COption::Some(owner),
|
||||
supply: 500,
|
||||
decimals: 2,
|
||||
is_initialized: true,
|
||||
freeze_authority: COption::Some(owner),
|
||||
};
|
||||
Ok(())
|
||||
})
|
||||
.unwrap();
|
||||
let mint_state = Mint {
|
||||
mint_authority: COption::Some(owner),
|
||||
supply: 500,
|
||||
decimals: 2,
|
||||
is_initialized: true,
|
||||
freeze_authority: COption::Some(owner),
|
||||
};
|
||||
Mint::pack(mint_state, &mut mint_data).unwrap();
|
||||
let mint_account = Account {
|
||||
lamports: 111,
|
||||
data: mint_data.to_vec(),
|
||||
@ -5206,20 +5195,17 @@ pub mod tests {
|
||||
&mint_account,
|
||||
);
|
||||
let mut account_data = vec![0; TokenAccount::get_packed_len()];
|
||||
TokenAccount::unpack_unchecked_mut(&mut account_data, &mut |account: &mut TokenAccount| {
|
||||
*account = TokenAccount {
|
||||
mint: new_mint,
|
||||
owner,
|
||||
delegate: COption::Some(delegate),
|
||||
amount: 10,
|
||||
state: TokenAccountState::Initialized,
|
||||
is_native: COption::None,
|
||||
delegated_amount: 30,
|
||||
close_authority: COption::Some(owner),
|
||||
};
|
||||
Ok(())
|
||||
})
|
||||
.unwrap();
|
||||
let token_account = TokenAccount {
|
||||
mint: new_mint,
|
||||
owner,
|
||||
delegate: COption::Some(delegate),
|
||||
amount: 10,
|
||||
state: TokenAccountState::Initialized,
|
||||
is_native: COption::None,
|
||||
delegated_amount: 30,
|
||||
close_authority: COption::Some(owner),
|
||||
};
|
||||
TokenAccount::pack(token_account, &mut account_data).unwrap();
|
||||
let token_account = Account {
|
||||
lamports: 111,
|
||||
data: account_data.to_vec(),
|
||||
@ -5270,20 +5256,17 @@ pub mod tests {
|
||||
let mint = SplTokenPubkey::new(&[2; 32]);
|
||||
let owner = SplTokenPubkey::new(&[3; 32]);
|
||||
let delegate = SplTokenPubkey::new(&[4; 32]);
|
||||
TokenAccount::unpack_unchecked_mut(&mut account_data, &mut |account: &mut TokenAccount| {
|
||||
*account = TokenAccount {
|
||||
mint,
|
||||
owner,
|
||||
delegate: COption::Some(delegate),
|
||||
amount: 420,
|
||||
state: TokenAccountState::Initialized,
|
||||
is_native: COption::Some(10),
|
||||
delegated_amount: 30,
|
||||
close_authority: COption::Some(owner),
|
||||
};
|
||||
Ok(())
|
||||
})
|
||||
.unwrap();
|
||||
let token_account = TokenAccount {
|
||||
mint,
|
||||
owner,
|
||||
delegate: COption::Some(delegate),
|
||||
amount: 420,
|
||||
state: TokenAccountState::Initialized,
|
||||
is_native: COption::Some(10),
|
||||
delegated_amount: 30,
|
||||
close_authority: COption::Some(owner),
|
||||
};
|
||||
TokenAccount::pack(token_account, &mut account_data).unwrap();
|
||||
let token_account = Account {
|
||||
lamports: 111,
|
||||
data: account_data.to_vec(),
|
||||
@ -5295,17 +5278,14 @@ pub mod tests {
|
||||
|
||||
// Add the mint
|
||||
let mut mint_data = vec![0; Mint::get_packed_len()];
|
||||
Mint::unpack_unchecked_mut(&mut mint_data, &mut |mint: &mut Mint| {
|
||||
*mint = Mint {
|
||||
mint_authority: COption::Some(owner),
|
||||
supply: 500,
|
||||
decimals: 2,
|
||||
is_initialized: true,
|
||||
freeze_authority: COption::Some(owner),
|
||||
};
|
||||
Ok(())
|
||||
})
|
||||
.unwrap();
|
||||
let mint_state = Mint {
|
||||
mint_authority: COption::Some(owner),
|
||||
supply: 500,
|
||||
decimals: 2,
|
||||
is_initialized: true,
|
||||
freeze_authority: COption::Some(owner),
|
||||
};
|
||||
Mint::pack(mint_state, &mut mint_data).unwrap();
|
||||
let mint_account = Account {
|
||||
lamports: 111,
|
||||
data: mint_data.to_vec(),
|
||||
|
@ -20,7 +20,7 @@ serde_json = "1.0.54"
|
||||
solana-account-decoder = { path = "../account-decoder", version = "1.2.30" }
|
||||
solana-sdk = { path = "../sdk", version = "1.2.30" }
|
||||
spl-memo-v1-0 = { package = "spl-memo", version = "1.0.7", features = ["skip-no-mangle"] }
|
||||
spl-token-v2-0 = { package = "spl-token", version = "2.0.3", features = ["skip-no-mangle"] }
|
||||
spl-token-v2-0 = { package = "spl-token", version = "2.0.6", features = ["skip-no-mangle"] }
|
||||
thiserror = "1.0"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
|
@ -4,7 +4,7 @@ use solana_account_decoder::parse_token::token_amount_to_ui_amount;
|
||||
use solana_sdk::{instruction::CompiledInstruction, pubkey::Pubkey};
|
||||
use spl_token_v2_0::{
|
||||
instruction::{AuthorityType, TokenInstruction},
|
||||
option::COption,
|
||||
solana_sdk::program_option::COption,
|
||||
};
|
||||
|
||||
pub fn parse_token(
|
||||
@ -314,7 +314,7 @@ pub fn parse_token(
|
||||
info: value,
|
||||
})
|
||||
}
|
||||
TokenInstruction::Transfer2 { amount, decimals } => {
|
||||
TokenInstruction::TransferChecked { amount, decimals } => {
|
||||
if instruction.accounts.len() < 4 {
|
||||
return Err(ParseInstructionError::InstructionKeyMismatch(
|
||||
ParsableProgram::SplToken,
|
||||
@ -336,11 +336,11 @@ pub fn parse_token(
|
||||
"multisigAuthority",
|
||||
);
|
||||
Ok(ParsedInstructionEnum {
|
||||
instruction_type: "transfer2".to_string(),
|
||||
instruction_type: "transferChecked".to_string(),
|
||||
info: value,
|
||||
})
|
||||
}
|
||||
TokenInstruction::Approve2 { amount, decimals } => {
|
||||
TokenInstruction::ApproveChecked { amount, decimals } => {
|
||||
if instruction.accounts.len() < 4 {
|
||||
return Err(ParseInstructionError::InstructionKeyMismatch(
|
||||
ParsableProgram::SplToken,
|
||||
@ -362,11 +362,11 @@ pub fn parse_token(
|
||||
"multisigOwner",
|
||||
);
|
||||
Ok(ParsedInstructionEnum {
|
||||
instruction_type: "approve2".to_string(),
|
||||
instruction_type: "approveChecked".to_string(),
|
||||
info: value,
|
||||
})
|
||||
}
|
||||
TokenInstruction::MintTo2 { amount, decimals } => {
|
||||
TokenInstruction::MintToChecked { amount, decimals } => {
|
||||
if instruction.accounts.len() < 3 {
|
||||
return Err(ParseInstructionError::InstructionKeyMismatch(
|
||||
ParsableProgram::SplToken,
|
||||
@ -387,11 +387,11 @@ pub fn parse_token(
|
||||
"multisigMintAuthority",
|
||||
);
|
||||
Ok(ParsedInstructionEnum {
|
||||
instruction_type: "mintTo2".to_string(),
|
||||
instruction_type: "mintToChecked".to_string(),
|
||||
info: value,
|
||||
})
|
||||
}
|
||||
TokenInstruction::Burn2 { amount, decimals } => {
|
||||
TokenInstruction::BurnChecked { amount, decimals } => {
|
||||
if instruction.accounts.len() < 3 {
|
||||
return Err(ParseInstructionError::InstructionKeyMismatch(
|
||||
ParsableProgram::SplToken,
|
||||
@ -412,7 +412,7 @@ pub fn parse_token(
|
||||
"multisigAuthority",
|
||||
);
|
||||
Ok(ParsedInstructionEnum {
|
||||
instruction_type: "burn2".to_string(),
|
||||
instruction_type: "burnChecked".to_string(),
|
||||
info: value,
|
||||
})
|
||||
}
|
||||
@ -887,8 +887,8 @@ mod test {
|
||||
}
|
||||
);
|
||||
|
||||
// Test Transfer2, incl multisig
|
||||
let transfer_ix = transfer2(
|
||||
// Test TransferChecked, incl multisig
|
||||
let transfer_ix = transfer_checked(
|
||||
&spl_token_v2_0::id(),
|
||||
&convert_pubkey(keys[0]),
|
||||
&convert_pubkey(keys[1]),
|
||||
@ -904,7 +904,7 @@ mod test {
|
||||
assert_eq!(
|
||||
parse_token(&compiled_instruction, &keys).unwrap(),
|
||||
ParsedInstructionEnum {
|
||||
instruction_type: "transfer2".to_string(),
|
||||
instruction_type: "transferChecked".to_string(),
|
||||
info: json!({
|
||||
"source": keys[1].to_string(),
|
||||
"destination": keys[2].to_string(),
|
||||
@ -919,7 +919,7 @@ mod test {
|
||||
}
|
||||
);
|
||||
|
||||
let transfer_ix = transfer2(
|
||||
let transfer_ix = transfer_checked(
|
||||
&spl_token_v2_0::id(),
|
||||
&convert_pubkey(keys[2]),
|
||||
&convert_pubkey(keys[3]),
|
||||
@ -935,7 +935,7 @@ mod test {
|
||||
assert_eq!(
|
||||
parse_token(&compiled_instruction, &keys).unwrap(),
|
||||
ParsedInstructionEnum {
|
||||
instruction_type: "transfer2".to_string(),
|
||||
instruction_type: "transferChecked".to_string(),
|
||||
info: json!({
|
||||
"source": keys[2].to_string(),
|
||||
"destination": keys[3].to_string(),
|
||||
@ -952,7 +952,7 @@ mod test {
|
||||
);
|
||||
|
||||
// Test Approve2, incl multisig
|
||||
let approve_ix = approve2(
|
||||
let approve_ix = approve_checked(
|
||||
&spl_token_v2_0::id(),
|
||||
&convert_pubkey(keys[1]),
|
||||
&convert_pubkey(keys[2]),
|
||||
@ -968,7 +968,7 @@ mod test {
|
||||
assert_eq!(
|
||||
parse_token(&compiled_instruction, &keys).unwrap(),
|
||||
ParsedInstructionEnum {
|
||||
instruction_type: "approve2".to_string(),
|
||||
instruction_type: "approveChecked".to_string(),
|
||||
info: json!({
|
||||
"source": keys[1].to_string(),
|
||||
"mint": keys[2].to_string(),
|
||||
@ -983,7 +983,7 @@ mod test {
|
||||
}
|
||||
);
|
||||
|
||||
let approve_ix = approve2(
|
||||
let approve_ix = approve_checked(
|
||||
&spl_token_v2_0::id(),
|
||||
&convert_pubkey(keys[2]),
|
||||
&convert_pubkey(keys[3]),
|
||||
@ -999,7 +999,7 @@ mod test {
|
||||
assert_eq!(
|
||||
parse_token(&compiled_instruction, &keys).unwrap(),
|
||||
ParsedInstructionEnum {
|
||||
instruction_type: "approve2".to_string(),
|
||||
instruction_type: "approveChecked".to_string(),
|
||||
info: json!({
|
||||
"source": keys[2].to_string(),
|
||||
"mint": keys[3].to_string(),
|
||||
@ -1016,7 +1016,7 @@ mod test {
|
||||
);
|
||||
|
||||
// Test MintTo2
|
||||
let mint_to_ix = mint_to2(
|
||||
let mint_to_ix = mint_to_checked(
|
||||
&spl_token_v2_0::id(),
|
||||
&convert_pubkey(keys[1]),
|
||||
&convert_pubkey(keys[2]),
|
||||
@ -1031,7 +1031,7 @@ mod test {
|
||||
assert_eq!(
|
||||
parse_token(&compiled_instruction, &keys).unwrap(),
|
||||
ParsedInstructionEnum {
|
||||
instruction_type: "mintTo2".to_string(),
|
||||
instruction_type: "mintToChecked".to_string(),
|
||||
info: json!({
|
||||
"mint": keys[1].to_string(),
|
||||
"account": keys[2].to_string(),
|
||||
@ -1046,7 +1046,7 @@ mod test {
|
||||
);
|
||||
|
||||
// Test Burn2
|
||||
let burn_ix = burn2(
|
||||
let burn_ix = burn_checked(
|
||||
&spl_token_v2_0::id(),
|
||||
&convert_pubkey(keys[1]),
|
||||
&convert_pubkey(keys[2]),
|
||||
@ -1061,7 +1061,7 @@ mod test {
|
||||
assert_eq!(
|
||||
parse_token(&compiled_instruction, &keys).unwrap(),
|
||||
ParsedInstructionEnum {
|
||||
instruction_type: "burn2".to_string(),
|
||||
instruction_type: "burnChecked".to_string(),
|
||||
info: json!({
|
||||
"account": keys[1].to_string(),
|
||||
"mint": keys[2].to_string(),
|
||||
@ -1328,8 +1328,8 @@ mod test {
|
||||
compiled_instruction.accounts[0..compiled_instruction.accounts.len() - 1].to_vec();
|
||||
assert!(parse_token(&compiled_instruction, &keys).is_err());
|
||||
|
||||
// Test Transfer2, incl multisig
|
||||
let transfer_ix = transfer2(
|
||||
// Test TransferChecked, incl multisig
|
||||
let transfer_ix = transfer_checked(
|
||||
&spl_token_v2_0::id(),
|
||||
&convert_pubkey(keys[1]),
|
||||
&convert_pubkey(keys[2]),
|
||||
@ -1347,7 +1347,7 @@ mod test {
|
||||
compiled_instruction.accounts[0..compiled_instruction.accounts.len() - 1].to_vec();
|
||||
assert!(parse_token(&compiled_instruction, &keys).is_err());
|
||||
|
||||
let transfer_ix = transfer2(
|
||||
let transfer_ix = transfer_checked(
|
||||
&spl_token_v2_0::id(),
|
||||
&convert_pubkey(keys[2]),
|
||||
&convert_pubkey(keys[3]),
|
||||
@ -1365,8 +1365,8 @@ mod test {
|
||||
compiled_instruction.accounts[0..compiled_instruction.accounts.len() - 3].to_vec();
|
||||
assert!(parse_token(&compiled_instruction, &keys).is_err());
|
||||
|
||||
// Test Approve2, incl multisig
|
||||
let approve_ix = approve2(
|
||||
// Test ApproveChecked, incl multisig
|
||||
let approve_ix = approve_checked(
|
||||
&spl_token_v2_0::id(),
|
||||
&convert_pubkey(keys[1]),
|
||||
&convert_pubkey(keys[2]),
|
||||
@ -1384,7 +1384,7 @@ mod test {
|
||||
compiled_instruction.accounts[0..compiled_instruction.accounts.len() - 1].to_vec();
|
||||
assert!(parse_token(&compiled_instruction, &keys).is_err());
|
||||
|
||||
let approve_ix = approve2(
|
||||
let approve_ix = approve_checked(
|
||||
&spl_token_v2_0::id(),
|
||||
&convert_pubkey(keys[2]),
|
||||
&convert_pubkey(keys[3]),
|
||||
@ -1402,8 +1402,8 @@ mod test {
|
||||
compiled_instruction.accounts[0..compiled_instruction.accounts.len() - 3].to_vec();
|
||||
assert!(parse_token(&compiled_instruction, &keys).is_err());
|
||||
|
||||
// Test MintTo2
|
||||
let mint_to_ix = mint_to2(
|
||||
// Test MintToChecked
|
||||
let mint_to_ix = mint_to_checked(
|
||||
&spl_token_v2_0::id(),
|
||||
&convert_pubkey(keys[1]),
|
||||
&convert_pubkey(keys[2]),
|
||||
@ -1420,8 +1420,8 @@ mod test {
|
||||
compiled_instruction.accounts[0..compiled_instruction.accounts.len() - 1].to_vec();
|
||||
assert!(parse_token(&compiled_instruction, &keys).is_err());
|
||||
|
||||
// Test Burn2
|
||||
let burn_ix = burn2(
|
||||
// Test BurnChecked
|
||||
let burn_ix = burn_checked(
|
||||
&spl_token_v2_0::id(),
|
||||
&convert_pubkey(keys[1]),
|
||||
&convert_pubkey(keys[2]),
|
||||
|
Reference in New Issue
Block a user