Decode token instructions (#11281)

* Token->SplToken

* Add spl_token instruction parsing

* Rebase on master

* Gracefully fail key len mismatches
This commit is contained in:
Tyera Eulberg
2020-07-31 13:26:09 -06:00
committed by GitHub
parent 1733f6c9e9
commit 0f551d4f75
7 changed files with 908 additions and 22 deletions

View File

@@ -5,6 +5,7 @@ extern crate serde_derive;
pub mod parse_accounts;
pub mod parse_instruction;
pub mod parse_token;
use crate::{parse_accounts::parse_accounts, parse_instruction::parse};
use serde_json::Value;
@@ -220,7 +221,11 @@ impl EncodedTransaction {
.map(|instruction| {
let program_id =
instruction.program_id(&transaction.message.account_keys);
if let Some(parsed_instruction) = parse(program_id, instruction) {
if let Ok(parsed_instruction) = parse(
program_id,
instruction,
&transaction.message.account_keys,
) {
UiInstruction::Parsed(parsed_instruction)
} else {
UiInstruction::Compiled(instruction.into())