Skip to main content

Crate hopper_token_2022

Crate hopper_token_2022 

Source
Expand description

Hopper-owned Token-2022 builder and screening surface.

Thin first-class Hopper wrappers over the canonical runtime builders, plus Token-2022 extension screening re-exports from hopper-solana.

Modules§

instructions

Structs§

Approve
Builder for Token-2022 Approve (instruction index 4).
Burn
Builder for Token-2022 Burn (instruction index 8).
CloseAccount
Builder for Token-2022 CloseAccount (instruction index 9).
InitializeAccount
Builder for Token-2022 InitializeAccount (instruction index 1).
MintTo
Builder for Token-2022 MintTo (instruction index 7).
Revoke
Builder for Token-2022 Revoke (instruction index 5).
Transfer
Builder for Token-2022 Transfer (instruction index 3).
TransferFeeConfig
Transfer fee configuration extracted from a Token-2022 mint.
TransferHook
Transfer-hook binding extracted from a Token-2022 mint.

Constants§

ACCOUNT_TYPE_MINT
Account-type discriminator byte: Mint.
ACCOUNT_TYPE_OFFSET
Offset of the AccountType discriminator on any extended Token-2022 account (mint or token account).
ACCOUNT_TYPE_TOKEN
Account-type discriminator byte: Token Account.
EXT_CONFIDENTIAL_TRANSFER_ACCOUNT
Confidential Transfer Account extension.
EXT_CONFIDENTIAL_TRANSFER_MINT
Confidential Transfer Mint extension.
EXT_CPI_GUARD
CPI Guard extension (token account).
EXT_DEFAULT_ACCOUNT_STATE
Default Account State extension (mint).
EXT_GROUP_MEMBER_POINTER
Group Member Pointer extension (mint).
EXT_GROUP_POINTER
Group Pointer extension (mint).
EXT_IMMUTABLE_OWNER
Immutable Owner extension (token account).
EXT_INTEREST_BEARING
Interest-Bearing Mint extension.
EXT_MEMO_TRANSFER
Memo Transfer extension.
EXT_METADATA_POINTER
Metadata Pointer extension (mint).
EXT_MINT_CLOSE_AUTHORITY
Mint Close Authority extension.
EXT_NON_TRANSFERABLE
Non-Transferable extension (mint).
EXT_PERMANENT_DELEGATE
Permanent Delegate extension (mint).
EXT_TOKEN_METADATA
Token Metadata extension (mint).
EXT_TRANSFER_FEE_AMOUNT
Transfer Fee Amount extension (token account).
EXT_TRANSFER_FEE_CONFIG
Transfer Fee Config extension (mint).
EXT_TRANSFER_HOOK
Transfer Hook extension (mint).
MINT_BASE_SIZE
Base mint account data size (before extensions).
MINT_LEN
SPL Mint Account total size.
TLV_OFFSET
Offset at which the TLV extension region begins on any extended Token-2022 account (mint or token account).
TOKEN_2022_PROGRAM_ID
Token-2022 program.
TOKEN_ACCOUNT_BASE_SIZE
Base token account data size (before extensions). Also equal to ACCOUNT_TYPE_OFFSET: an extended mint is padded up to this length so its AccountType discriminator lives at the same offset as on an extended token account.
TOKEN_ACCOUNT_LEN
SPL Token Account total size.

Functions§

check_mint_authority
Check that mint_authority matches the expected pubkey.
check_mint_initialized
Check the mint is initialized.
check_no_confidential_transfer
Reject mints with Confidential Transfer.
check_no_permanent_delegate
Reject mints with a Permanent Delegate.
check_no_transfer_fee
Reject mints that have a Transfer Fee Config extension.
check_no_transfer_hook
Reject mints with a Transfer Hook.
check_not_frozen
Check the token account is not frozen.
check_safe_token_2022_mint
Blanket safety check: reject mints with any DeFi-unsafe extension.
check_token_balance_gte
Check the token balance >= min_amount.
check_token_initialized
Check the token account is initialized (state != 0).
check_token_mint
Check the token account mint matches expected.
check_token_owner
Check the token account owner matches expected.
check_transfer_hook_program
Assert that the mint has a transfer-hook extension and that it invokes the expected program. Pairs with read_transfer_hook when the program’s business logic depends on a specific hook binding.
check_transferable
Reject non-transferable (soul-bound) mints.
find_extension_data
Find the first TLV entry of ext_type in a Token-2022 account’s data.
mint_authority
Read the mint authority (returns None if COption tag is 0).
mint_decimals
Read the decimals from a mint account.
mint_freeze_authority
Read the freeze authority (returns None if COption tag is 0).
mint_has_extension
Check if a Token-2022 mint account has a specific extension.
mint_supply
Read the supply from a mint account.
read_transfer_fee_config
Read the active transfer fee config from a Token-2022 mint.
read_transfer_hook
Read the Transfer Hook binding from a Token-2022 mint, or return None if the mint has no transfer-hook extension.
token_account_amount
Read the amount from a token account.
token_account_mint
Read the mint pubkey from a token account.
token_account_owner
Read the owner pubkey from a token account.
token_account_state
Read the state byte (0=uninitialized, 1=initialized, 2=frozen).
token_has_extension
Check if a Token-2022 token account has a specific extension.