Skip to content

Commit

Permalink
transaction-status: add token-metadata interface support
Browse files Browse the repository at this point in the history
  • Loading branch information
buffalojoec committed Apr 22, 2024
1 parent aadbc52 commit 3696991
Show file tree
Hide file tree
Showing 5 changed files with 363 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions transaction-status/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ spl-memo = { workspace = true, features = ["no-entrypoint"] }
spl-token = { workspace = true, features = ["no-entrypoint"] }
spl-token-2022 = { workspace = true, features = ["no-entrypoint"] }
spl-token-group-interface = { workspace = true }
spl-token-metadata-interface = { workspace = true, features = ["serde-traits"] }
thiserror = { workspace = true }

[package.metadata.docs.rs]
Expand Down
14 changes: 13 additions & 1 deletion transaction-status/src/parse_token.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use {
self::extension::token_group::parse_token_group_instruction,
self::extension::{
token_group::parse_token_group_instruction,
token_metadata::parse_token_metadata_instruction,
},
crate::parse_instruction::{
check_num_accounts, ParsableProgram, ParseInstructionError, ParsedInstructionEnum,
},
Expand All @@ -24,6 +27,7 @@ use {
},
},
spl_token_group_interface::instruction::TokenGroupInstruction,
spl_token_metadata_interface::instruction::TokenMetadataInstruction,
};

mod extension;
Expand Down Expand Up @@ -690,6 +694,14 @@ pub fn parse_token(
&instruction.accounts,
account_keys,
)
} else if let Ok(token_metadata_instruction) =
TokenMetadataInstruction::unpack(&instruction.data)
{
parse_token_metadata_instruction(
&token_metadata_instruction,
&instruction.accounts,
account_keys,
)
} else {
Err(ParseInstructionError::InstructionNotParsable(
ParsableProgram::SplToken,
Expand Down
1 change: 1 addition & 0 deletions transaction-status/src/parse_token/extension/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ pub(super) mod mint_close_authority;
pub(super) mod permanent_delegate;
pub(super) mod reallocate;
pub(super) mod token_group;
pub(super) mod token_metadata;
pub(super) mod transfer_fee;
pub(super) mod transfer_hook;
Loading

0 comments on commit 3696991

Please sign in to comment.