diff --git a/blockbuster/src/programs/token_extensions/extension.rs b/blockbuster/src/programs/token_extensions/extension.rs index c9a0b9b4a..6dba2b57c 100644 --- a/blockbuster/src/programs/token_extensions/extension.rs +++ b/blockbuster/src/programs/token_extensions/extension.rs @@ -13,7 +13,6 @@ use spl_token_2022::extension::{ default_account_state::DefaultAccountState, group_member_pointer::GroupMemberPointer, group_pointer::GroupPointer, - immutable_owner::ImmutableOwner, interest_bearing_mint::{BasisPoints, InterestBearingConfig}, memo_transfer::MemoTransfer, metadata_pointer::MetadataPointer, @@ -77,9 +76,6 @@ pub struct ShadowDefaultAccountState { pub state: PodAccountState, } -#[derive(Clone, Copy, Debug, Default, PartialEq, Zeroable, Serialize, Deserialize)] -pub struct ShadowImmutableOwner; - #[derive(Clone, Copy, Debug, Default, PartialEq, Zeroable, Serialize, Deserialize)] pub struct ShadowInterestBearingConfig { pub rate_authority: OptionalNonZeroPubkey, @@ -97,20 +93,16 @@ pub struct ShadowMemoTransfer { #[derive(Clone, Copy, Debug, Default, PartialEq, Zeroable, Serialize, Deserialize)] pub struct ShadowMetadataPointer { - pub authority: OptionalNonZeroPubkey, pub metadata_address: OptionalNonZeroPubkey, } #[derive(Clone, Copy, Debug, Default, PartialEq, Zeroable, Serialize, Deserialize)] pub struct ShadowGroupMemberPointer { - pub authority: OptionalNonZeroPubkey, pub member_address: OptionalNonZeroPubkey, } #[derive(Clone, Copy, Debug, Default, PartialEq, Zeroable, Serialize, Deserialize)] pub struct ShadowGroupPointer { - /// Authority that can set the group address - pub authority: OptionalNonZeroPubkey, /// Account address that holds the group pub group_address: OptionalNonZeroPubkey, } @@ -348,12 +340,6 @@ impl From for ShadowDefaultAccountState { } } -impl From for ShadowImmutableOwner { - fn from(_: ImmutableOwner) -> Self { - ShadowImmutableOwner - } -} - impl From for ShadowConfidentialTransferFeeAmount { fn from(original: ConfidentialTransferFeeAmount) -> Self { ShadowConfidentialTransferFeeAmount { @@ -381,7 +367,6 @@ impl From for ShadowMemoTransfer { impl From for ShadowMetadataPointer { fn from(original: MetadataPointer) -> Self { ShadowMetadataPointer { - authority: original.authority, metadata_address: original.metadata_address, } } @@ -390,7 +375,6 @@ impl From for ShadowMetadataPointer { impl From for ShadowGroupPointer { fn from(original: GroupPointer) -> Self { ShadowGroupPointer { - authority: original.authority, group_address: original.group_address, } } @@ -420,7 +404,6 @@ impl From for ShadowTokenGroupMember { impl From for ShadowGroupMemberPointer { fn from(original: GroupMemberPointer) -> Self { ShadowGroupMemberPointer { - authority: original.authority, member_address: original.member_address, } } diff --git a/blockbuster/src/programs/token_extensions/mod.rs b/blockbuster/src/programs/token_extensions/mod.rs index d890e5dbc..faf12b719 100644 --- a/blockbuster/src/programs/token_extensions/mod.rs +++ b/blockbuster/src/programs/token_extensions/mod.rs @@ -4,6 +4,7 @@ use crate::{ program_handler::{ParseResult, ProgramParser}, programs::ProgramParseResult, }; + use serde::{Deserialize, Serialize}; use solana_sdk::{pubkey::Pubkey, pubkeys}; use spl_token_2022::{ @@ -14,10 +15,12 @@ use spl_token_2022::{ default_account_state::DefaultAccountState, group_member_pointer::GroupMemberPointer, group_pointer::GroupPointer, + immutable_owner::ImmutableOwner, interest_bearing_mint::InterestBearingConfig, memo_transfer::MemoTransfer, metadata_pointer::MetadataPointer, mint_close_authority::MintCloseAuthority, + non_transferable::{NonTransferable, NonTransferableAccount}, permanent_delegate::PermanentDelegate, transfer_fee::{TransferFeeAmount, TransferFeeConfig}, transfer_hook::TransferHook, @@ -41,7 +44,6 @@ use self::extension::{ pub struct MintAccountExtensions { pub default_account_state: Option, pub confidential_transfer_mint: Option, - pub confidential_transfer_account: Option, pub confidential_transfer_fee_config: Option, pub interest_bearing_config: Option, pub transfer_fee_config: Option, @@ -54,6 +56,10 @@ pub struct MintAccountExtensions { pub token_group: Option, pub group_member_pointer: Option, pub token_group_member: Option, + // TODO : add this when spl-token-2022 is updated + // pub scaled_ui_amount: Option, + pub non_transferable: Option, + pub immutable_owner: Option, } impl MintAccountExtensions { @@ -82,6 +88,8 @@ pub struct TokenAccountExtensions { pub cpi_guard: Option, pub memo_transfer: Option, pub transfer_fee_amount: Option, + pub immutable_owner: Option, + pub non_transferable_account: Option, } impl TokenAccountExtensions { @@ -163,6 +171,16 @@ impl ProgramParser for Token2022AccountParser { let cpi_guard = account.get_extension::().ok().copied(); let memo_transfer = account.get_extension::().ok().copied(); let transfer_fee_amount = account.get_extension::().ok().copied(); + let immutable_owner = account + .get_extension::() + .ok() + .copied() + .map(|_| true); + let non_transferable_account = account + .get_extension::() + .ok() + .copied() + .map(|_| true); // Create a structured account with extensions let structured_account = TokenAccount { @@ -173,6 +191,8 @@ impl ProgramParser for Token2022AccountParser { cpi_guard: cpi_guard.map(ShadowCpiGuard::from), memo_transfer: memo_transfer.map(ShadowMemoTransfer::from), transfer_fee_amount: transfer_fee_amount.map(ShadowTransferFeeAmount::from), + immutable_owner, + non_transferable_account, }, }; @@ -182,10 +202,7 @@ impl ProgramParser for Token2022AccountParser { .get_extension::() .ok() .copied(); - let confidential_transfer_account = mint - .get_extension::() - .ok() - .copied(); + let confidential_transfer_fee_config = mint .get_extension::() .ok() @@ -203,14 +220,23 @@ impl ProgramParser for Token2022AccountParser { let group_member_pointer = mint.get_extension::().ok().copied(); let token_group_member = mint.get_extension::().ok().copied(); let transfer_hook = mint.get_extension::().ok().copied(); + let non_transferable = mint + .get_extension::() + .ok() + .copied() + .map(|_| true); + + let immutable_owner = mint + .get_extension::() + .ok() + .copied() + .map(|_| true); let structured_mint = MintAccount { account: mint.base, extensions: MintAccountExtensions { confidential_transfer_mint: confidential_transfer_mint .map(ShadowConfidentialTransferMint::from), - confidential_transfer_account: confidential_transfer_account - .map(ShadowConfidentialTransferAccount::from), confidential_transfer_fee_config: confidential_transfer_fee_config .map(ShadowConfidentialTransferFeeConfig::from), default_account_state: default_account_state @@ -227,6 +253,8 @@ impl ProgramParser for Token2022AccountParser { token_group: token_group.map(ShadowTokenGroup::from), group_member_pointer: group_member_pointer.map(ShadowGroupMemberPointer::from), token_group_member: token_group_member.map(ShadowTokenGroupMember::from), + non_transferable, + immutable_owner, }, }; result = TokenExtensionsProgramAccount::MintAccount(structured_mint);