@ -23,6 +23,7 @@ solana-runtime = { path = "../runtime", version = "1.6.0" }
|
||||
solana-stake-program = { path = "../programs/stake", version = "1.6.0" }
|
||||
solana-vote-program = { path = "../programs/vote", version = "1.6.0" }
|
||||
spl-memo-v1-0 = { package = "spl-memo", version = "=2.0.1", features = ["no-entrypoint"] }
|
||||
spl-memo-v3-0 = { package = "spl-memo", version = "=3.0.0", features = ["no-entrypoint"] }
|
||||
spl-token-v2-0 = { package = "spl-token", version = "=3.0.1", features = ["no-entrypoint"] }
|
||||
thiserror = "1.0"
|
||||
|
||||
|
@ -14,15 +14,18 @@ use thiserror::Error;
|
||||
|
||||
lazy_static! {
|
||||
static ref BPF_LOADER_PROGRAM_ID: Pubkey = solana_sdk::bpf_loader::id();
|
||||
static ref MEMO_PROGRAM_ID: Pubkey =
|
||||
static ref MEMO_V1_PROGRAM_ID: Pubkey =
|
||||
Pubkey::from_str(&spl_memo_v1_0::id().to_string()).unwrap();
|
||||
static ref MEMO_V3_PROGRAM_ID: Pubkey =
|
||||
Pubkey::from_str(&spl_memo_v3_0::id().to_string()).unwrap();
|
||||
static ref STAKE_PROGRAM_ID: Pubkey = solana_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 VOTE_PROGRAM_ID: Pubkey = solana_vote_program::id();
|
||||
static ref PARSABLE_PROGRAM_IDS: HashMap<Pubkey, ParsableProgram> = {
|
||||
let mut m = HashMap::new();
|
||||
m.insert(*MEMO_PROGRAM_ID, ParsableProgram::SplMemo);
|
||||
m.insert(*MEMO_V1_PROGRAM_ID, ParsableProgram::SplMemo);
|
||||
m.insert(*MEMO_V3_PROGRAM_ID, ParsableProgram::SplMemo);
|
||||
m.insert(*TOKEN_PROGRAM_ID, ParsableProgram::SplToken);
|
||||
m.insert(*BPF_LOADER_PROGRAM_ID, ParsableProgram::BpfLoader);
|
||||
m.insert(*STAKE_PROGRAM_ID, ParsableProgram::Stake);
|
||||
@ -131,10 +134,18 @@ mod test {
|
||||
data: vec![240, 159, 166, 150],
|
||||
};
|
||||
assert_eq!(
|
||||
parse(&MEMO_PROGRAM_ID, &memo_instruction, &[]).unwrap(),
|
||||
parse(&MEMO_V1_PROGRAM_ID, &memo_instruction, &[]).unwrap(),
|
||||
ParsedInstruction {
|
||||
program: "spl-memo".to_string(),
|
||||
program_id: MEMO_PROGRAM_ID.to_string(),
|
||||
program_id: MEMO_V1_PROGRAM_ID.to_string(),
|
||||
parsed: json!("🦖"),
|
||||
}
|
||||
);
|
||||
assert_eq!(
|
||||
parse(&MEMO_V3_PROGRAM_ID, &memo_instruction, &[]).unwrap(),
|
||||
ParsedInstruction {
|
||||
program: "spl-memo".to_string(),
|
||||
program_id: MEMO_V3_PROGRAM_ID.to_string(),
|
||||
parsed: json!("🦖"),
|
||||
}
|
||||
);
|
||||
|
Reference in New Issue
Block a user