SPL Token decoder
Decode SPL Token instructions and accounts in Rust with carbon-token-program-decoder 2.0.0. Program ID TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA.
On this page
carbon-token-program-decoder decodes the instructions and accounts of the SPL Token program (TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA): 28 instructions, 3 account types. It is generated with Codama from the program's IDL; see decoders for how decoders plug into a pipeline.
| Crate | carbon-token-program-decoder 2.0.0 |
| Install | cargo add carbon-token-program-decoder@2. |
| Program ID | TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA (carbon_) |
| Category | Core & SPL |
| Decoder | carbon_ |
| Instruction enum | instructions:: |
| Account enum | accounts:: |
| Features | serde, postgres, graphql (none enabled by default) |
| API docs | docs.rs/carbon-token-program-decoder/2.0.0 |
| Source | decoders/token-program-decoder |
Other core and SPL decoders: Address Lookup Table, Associated Token Account, SPL Memo, SPL Name Service, Stake Program, System Program, Token-2022. To decode several in one pipeline, see core and SPL program decoders.
Guide: Index token transfers.
The serde feature derives Serialize/Deserialize on every type, postgres adds tables and processors for Postgres, and graphql adds a schema for the GraphQL server.
Usage#
This program crawls recent SPL Token transactions from the public RPC and prints every decoded TransferChecked instruction. Add the dependencies:
cargo add carbon-core@2.0.0 carbon-token-program-decoder@2.0.0 carbon-rpc-transaction-crawler-datasource@2.0.0 carbon-log-metrics@2.0.0 env_logger tokio --features tokio/fulluse {
carbon_core::{
error::CarbonResult, instruction::InstructionProcessorInputType, pipeline::Pipeline,
processor::Processor,
},
carbon_log_metrics::LogMetrics,
carbon_token_program_decoder::{
instructions::TokenProgramInstruction, TokenProgramDecoder, PROGRAM_ID,
},
carbon_rpc_transaction_crawler_datasource::{ConnectionConfig, Filters, RpcTransactionCrawler},
std::sync::Arc,
};
#[tokio::main]
async fn main() -> CarbonResult<()> {
env_logger::init();
// Fetches the program's recent transactions over JSON-RPC, newest first.
let datasource = RpcTransactionCrawler::new(
"https://api.mainnet-beta.solana.com".to_string(),
PROGRAM_ID,
ConnectionConfig::default(),
Filters::new(None, None, None),
None,
);
Pipeline::builder()
.datasource(datasource)
.metrics(Arc::new(LogMetrics::new()))
.instruction(TokenProgramDecoder, InstructionLogger)
.build()?
.run()
.await
}
struct InstructionLogger;
impl Processor<InstructionProcessorInputType<'_, TokenProgramInstruction>> for InstructionLogger {
async fn process(
&mut self,
input: &InstructionProcessorInputType<'_, TokenProgramInstruction>,
) -> CarbonResult<()> {
let signature = input.metadata.transaction_metadata.signature;
if let TokenProgramInstruction::TransferChecked { data, accounts, .. } = input.decoded_instruction {
println!("transfer_checked {signature}: {data:?} source={}", accounts.source);
}
Ok(())
}
}RUST_LOG=info cargo runEach TransferChecked instruction prints one line with the transaction signature and the decoded TransferChecked data. The public endpoint rate-limits requests, so the first lines can take a while; use your own RPC URL for anything beyond a test. See stream with RPC for the crawler options.
Decode accounts#
The transaction crawler emits transactions only. To decode accounts, use a datasource that emits account updates. This program subscribes to the program's accounts with programSubscribe on the public WebSocket endpoint and prints every decoded Mint account as it changes. Add the datasource and the Solana RPC types it takes:
cargo add carbon-rpc-program-subscribe-datasource@2.0.0 solana-client@4.2.2use {
carbon_core::{
account::AccountProcessorInputType, error::CarbonResult, pipeline::Pipeline,
processor::Processor,
},
carbon_log_metrics::LogMetrics,
carbon_token_program_decoder::{accounts::TokenProgramAccount, TokenProgramDecoder, PROGRAM_ID},
carbon_rpc_program_subscribe_datasource::{Filters, RpcProgramSubscribe},
solana_client::{
rpc_config::{RpcAccountInfoConfig, RpcProgramAccountsConfig, UiAccountEncoding},
rpc_filter::RpcFilterType,
},
std::sync::Arc,
};
#[tokio::main]
async fn main() -> CarbonResult<()> {
env_logger::init();
// Streams every change to an account owned by the program (programSubscribe).
let config = RpcProgramAccountsConfig {
// Mint accounts are 82 bytes; without a filter this streams every token account.
filters: Some(vec![RpcFilterType::DataSize(82)]),
account_config: RpcAccountInfoConfig {
encoding: Some(UiAccountEncoding::Base64),
..Default::default()
},
..Default::default()
};
let datasource = RpcProgramSubscribe::new(
"wss://api.mainnet-beta.solana.com".to_string(),
Filters::new(PROGRAM_ID, Some(config)),
);
Pipeline::builder()
.datasource(datasource)
.metrics(Arc::new(LogMetrics::new()))
.account(TokenProgramDecoder, AccountLogger)
.build()?
.run()
.await
}
struct AccountLogger;
impl Processor<AccountProcessorInputType<'_, TokenProgramAccount>> for AccountLogger {
async fn process(
&mut self,
input: &AccountProcessorInputType<'_, TokenProgramAccount>,
) -> CarbonResult<()> {
if let TokenProgramAccount::Mint(mint) = &input.decoded_account.data {
println!("mint {}: {mint:?}", input.metadata.pubkey);
}
Ok(())
}
}RUST_LOG=info cargo runEach update to a Mint account prints its address and decoded fields; the program runs until you stop it. Cargo resolves solana-client to 4.2.2, the exact version the datasource pins, so both use the same RpcProgramAccountsConfig type. To load every existing account once instead of streaming changes, see load account state.
Instructions#
Variants of TokenProgramInstruction. Each is TokenProgramInstruction::, where data and accounts are the types listed under the variant, exported from carbon_. Discriminators are the leading bytes of the instruction data, in hex.
How an instruction decodes. The decoder returns a variant only when all of these hold; otherwise the instruction is skipped and no processor is called:
- The instruction's program ID is
TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA. - The data starts with the variant's discriminator, and the rest deserializes into its data type.
- The instruction has at least as many accounts as the variant requires (the "Required accounts" count under each variant).
Accounts. They are matched by position, in the order listed. An account marked optional is None only when the instruction ends before it; Anchor programs pass the program ID as a placeholder for an omitted optional account, so check for Some(PROGRAM_ too. Accounts after the listed ones are in accounts. as AccountMetas. The decoder doesn't record whether an account signed or was writable: read that from input. and ., which follow the same order. It doesn't check signer, writable, owner or PDA constraints either; the program enforced those when the transaction executed, so a decoded instruction from a successful transaction already satisfied them.
AmountToUiAmount#
From the program's IDL:
Convert an Amount of tokens to a UiAmount
string, using the given mint. In this version of the program, the mint can only specify the number of decimals.
Fails on an invalid mint.
Return data can be fetched usingsol_and deserialized withget_ return_ data String::.from_ utf8
Discriminator 17 · data AmountToUiAmount · accounts AmountToUiAmountInstructionAccounts.
| Field | Type | Description |
|---|---|---|
amount | u64 | The amount of tokens to reformat. |
Required accounts: 1; extras go to remaining.
Fields of AmountToUiAmountInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | mint | Pubkey |
| 1… | remaining | Vec< |
Approve#
From the program's IDL:
Approves a delegate. A delegate is given the authority over tokens on behalf of the source account's owner.
Discriminator 04 · data Approve · accounts ApproveInstructionAccounts.
| Field | Type | Description |
|---|---|---|
amount | u64 | The amount of tokens the delegate is approved for. |
Required accounts: 3; extras go to remaining.
Fields of ApproveInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | source | Pubkey |
| 1 | delegate | Pubkey |
| 2 | owner | Pubkey |
| 3… | remaining | Vec< |
ApproveChecked#
From the program's IDL:
Approves a delegate. A delegate is given the authority over tokens on behalf of the source account's owner.
This instruction differs from Approve in that the token mint and decimals value is checked by the caller. This may be useful when creating transactions offline or within a hardware wallet.
Discriminator 0d · data ApproveChecked · accounts ApproveCheckedInstructionAccounts.
| Field | Type | Description |
|---|---|---|
amount | u64 | The amount of tokens the delegate is approved for. |
decimals | u8 | Expected number of base 10 digits to the right of the decimal place. |
Required accounts: 4; extras go to remaining.
Fields of ApproveCheckedInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | source | Pubkey |
| 1 | mint | Pubkey |
| 2 | delegate | Pubkey |
| 3 | owner | Pubkey |
| 4… | remaining | Vec< |
Batch#
From the program's IDL:
Executes a batch of instructions. The instructions to be executed are specified in sequence on the instruction data.
Discriminator ff · data Batch · accounts BatchInstructionAccounts.
| Field | Type | Description |
|---|---|---|
data | Vec< | Instruction data for batch instructions. |
No named accounts.
Burn#
From the program's IDL:
Burns tokens by removing them from an account.
Burndoes not support accounts associated with the native mint, useCloseAccountinstead.
Discriminator 08 · data Burn · accounts BurnInstructionAccounts.
| Field | Type |
|---|---|
amount | u64 |
Required accounts: 3; extras go to remaining.
Fields of BurnInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | account | Pubkey |
| 1 | mint | Pubkey |
| 2 | authority | Pubkey |
| 3… | remaining | Vec< |
BurnChecked#
From the program's IDL:
Burns tokens by removing them from an account.
BurnCheckeddoes not support accounts associated with the native mint, useCloseAccountinstead. This instruction differs from Burn in that the decimals value is checked by the caller. This may be useful when creating transactions offline or within a hardware wallet.
Discriminator 0f · data BurnChecked · accounts BurnCheckedInstructionAccounts.
| Field | Type | Description |
|---|---|---|
amount | u64 | The amount of tokens to burn. |
decimals | u8 | Expected number of base 10 digits to the right of the decimal place. |
Required accounts: 3; extras go to remaining.
Fields of BurnCheckedInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | account | Pubkey |
| 1 | mint | Pubkey |
| 2 | authority | Pubkey |
| 3… | remaining | Vec< |
CloseAccount#
From the program's IDL:
Close an account by transferring all its SOL to the destination account.
Non-native accounts may only be closed if its token amount is zero.
Discriminator 09 · data CloseAccount · accounts CloseAccountInstructionAccounts.
No data fields.
Required accounts: 3; extras go to remaining.
Fields of CloseAccountInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | account | Pubkey |
| 1 | destination | Pubkey |
| 2 | owner | Pubkey |
| 3… | remaining | Vec< |
FreezeAccount#
From the program's IDL:
Freeze an Initialized account using the Mint's freeze_authority (if set).
Discriminator 0a · data FreezeAccount · accounts FreezeAccountInstructionAccounts.
No data fields.
Required accounts: 3; extras go to remaining.
Fields of FreezeAccountInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | account | Pubkey |
| 1 | mint | Pubkey |
| 2 | owner | Pubkey |
| 3… | remaining | Vec< |
GetAccountDataSize#
From the program's IDL:
Gets the required size of an account for the given mint as a little-endian
u64.
Return data can be fetched usingsol_and deserializing the return data as a little-endianget_ return_ data u64.
Discriminator 15 · data GetAccountDataSize · accounts GetAccountDataSizeInstructionAccounts.
No data fields.
Required accounts: 1; extras go to remaining.
Fields of GetAccountDataSizeInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | mint | Pubkey |
| 1… | remaining | Vec< |
InitializeAccount#
From the program's IDL:
Initializes a new account to hold tokens. If this account is associated with the native mint then the token balance of the initialized account will be equal to the amount of SOL in the account. If this account is associated with another mint, that mint must be initialized before this command can succeed.
TheInitializeAccountinstruction requires no signers and MUST be included within the same Transaction as the system program'sCreateAccountinstruction that creates the account being initialized.
Otherwise another party can acquire ownership of the uninitialized account.
Discriminator 01 · data InitializeAccount · accounts InitializeAccountInstructionAccounts.
No data fields.
Required accounts: 4; extras go to remaining.
Fields of InitializeAccountInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | account | Pubkey |
| 1 | mint | Pubkey |
| 2 | owner | Pubkey |
| 3 | rent | Pubkey |
| 4… | remaining | Vec< |
InitializeAccount2#
From the program's IDL:
Like InitializeAccount, but the owner pubkey is passed via instruction data rather than the accounts list. This variant may be preferable when using Cross Program Invocation from an instruction that does not need the owner's
AccountInfootherwise.
Discriminator 10 · data InitializeAccount2 · accounts InitializeAccount2InstructionAccounts.
| Field | Type | Description |
|---|---|---|
owner | Pubkey | The new account's owner/multisignature. |
Required accounts: 3; extras go to remaining.
Fields of InitializeAccount2InstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | account | Pubkey |
| 1 | mint | Pubkey |
| 2 | rent | Pubkey |
| 3… | remaining | Vec< |
InitializeAccount3#
From the program's IDL:
Like InitializeAccount2, but does not require the Rent sysvar to be provided.
Discriminator 12 · data InitializeAccount3 · accounts InitializeAccount3InstructionAccounts.
| Field | Type | Description |
|---|---|---|
owner | Pubkey | The new account's owner/multisignature. |
Required accounts: 2; extras go to remaining.
Fields of InitializeAccount3InstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | account | Pubkey |
| 1 | mint | Pubkey |
| 2… | remaining | Vec< |
InitializeImmutableOwner#
From the program's IDL:
Initialize the Immutable Owner extension for the given token account
Fails if the account has already been initialized, so must be called beforeInitializeAccount.
No-ops in this version of the program, but is included for compatibility with the Associated Token Account program.
Discriminator 16 · data InitializeImmutableOwner · accounts InitializeImmutableOwnerInstructionAccounts.
No data fields.
Required accounts: 1; extras go to remaining.
Fields of InitializeImmutableOwnerInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | account | Pubkey |
| 1… | remaining | Vec< |
InitializeMint#
From the program's IDL:
Initializes a new mint and optionally deposits all the newly minted tokens in an account.
TheInitializeMintinstruction requires no signers and MUST be included within the same Transaction as the system program'sCreateAccountinstruction that creates the account being initialized.
Otherwise another party can acquire ownership of the uninitialized account.
Discriminator 00 · data InitializeMint · accounts InitializeMintInstructionAccounts.
| Field | Type | Description |
|---|---|---|
decimals | u8 | Number of decimals in token account amounts. |
mint_ | Pubkey | Minting authority. |
freeze_ | Option< | Optional authority that can freeze token accounts. |
Required accounts: 2; extras go to remaining.
Fields of InitializeMintInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | mint | Pubkey |
| 1 | rent | Pubkey |
| 2… | remaining | Vec< |
InitializeMint2#
From the program's IDL:
Like [
InitializeMint], but does not require the Rent sysvar to be provided.
Discriminator 14 · data InitializeMint2 · accounts InitializeMint2InstructionAccounts.
| Field | Type | Description |
|---|---|---|
decimals | u8 | Number of base 10 digits to the right of the decimal place. |
mint_ | Pubkey | The authority/multisignature to mint tokens. |
freeze_ | Option< | The optional freeze authority/multisignature of the mint. |
Required accounts: 1; extras go to remaining.
Fields of InitializeMint2InstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | mint | Pubkey |
| 1… | remaining | Vec< |
InitializeMultisig#
From the program's IDL:
Initializes a multisignature account with N provided signers.
Multisignature accounts can used in place of any single owner/delegate accounts in any token instruction that require an owner/delegate to be present. The variant field represents the number of signers (M) required to validate this multisignature account.
TheInitializeMultisiginstruction requires no signers and MUST be included within the same Transaction as the system program'sCreateAccountinstruction that creates the account being initialized.
Otherwise another party can acquire ownership of the uninitialized account.
Discriminator 02 · data InitializeMultisig · accounts InitializeMultisigInstructionAccounts.
| Field | Type | Description |
|---|---|---|
m | u8 | The number of signers (M) required to validate this multisignature account. |
Required accounts: 2; extras go to remaining.
Fields of InitializeMultisigInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | multisig | Pubkey |
| 1 | rent | Pubkey |
| 2… | remaining | Vec< |
InitializeMultisig2#
From the program's IDL:
Like InitializeMultisig, but does not require the Rent sysvar to be provided.
Discriminator 13 · data InitializeMultisig2 · accounts InitializeMultisig2InstructionAccounts.
| Field | Type | Description |
|---|---|---|
m | u8 | The number of signers (M) required to validate this multisignature account. |
Required accounts: 1; extras go to remaining.
Fields of InitializeMultisig2InstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | multisig | Pubkey |
| 1… | remaining | Vec< |
MintTo#
From the program's IDL:
Mints new tokens to an account. The native mint does not support minting.
Discriminator 07 · data MintTo · accounts MintToInstructionAccounts.
| Field | Type | Description |
|---|---|---|
amount | u64 | The amount of new tokens to mint. |
Required accounts: 3; extras go to remaining.
Fields of MintToInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | mint | Pubkey |
| 1 | token | Pubkey |
| 2 | mint_ | Pubkey |
| 3… | remaining | Vec< |
MintToChecked#
From the program's IDL:
Mints new tokens to an account. The native mint does not support minting.
This instruction differs from MintTo in that the decimals value is checked by the caller. This may be useful when creating transactions offline or within a hardware wallet.
Discriminator 0e · data MintToChecked · accounts MintToCheckedInstructionAccounts.
| Field | Type | Description |
|---|---|---|
amount | u64 | The amount of new tokens to mint. |
decimals | u8 | Expected number of base 10 digits to the right of the decimal place. |
Required accounts: 3; extras go to remaining.
Fields of MintToCheckedInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | mint | Pubkey |
| 1 | token | Pubkey |
| 2 | mint_ | Pubkey |
| 3… | remaining | Vec< |
Revoke#
From the program's IDL:
Revokes the delegate's authority.
Discriminator 05 · data Revoke · accounts RevokeInstructionAccounts.
No data fields.
Required accounts: 2; extras go to remaining.
Fields of RevokeInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | source | Pubkey |
| 1 | owner | Pubkey |
| 2… | remaining | Vec< |
SetAuthority#
From the program's IDL:
Sets a new authority of a mint or account.
Discriminator 06 · data SetAuthority · accounts SetAuthorityInstructionAccounts.
| Field | Type | Description |
|---|---|---|
authority_ | AuthorityType | The type of authority to update. |
new_ | Option< | The new authority |
Required accounts: 2; extras go to remaining.
Fields of SetAuthorityInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | owned | Pubkey |
| 1 | owner | Pubkey |
| 2… | remaining | Vec< |
SyncNative#
From the program's IDL:
Given a wrapped / native token account (a token account containing SOL) updates its amount field based on the account's underlying
lamports.
This is useful if a non-wrapped SOL account usessystem_to move lamports to a wrapped token account, and needs to have its tokeninstruction:: transfer amountfield updated.
Discriminator 11 · data SyncNative · accounts SyncNativeInstructionAccounts.
No data fields.
Required accounts: 1 (2 listed); extras go to remaining.
Fields of SyncNativeInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | account | Pubkey |
| 1 | rent | Option< |
| 2… | remaining | Vec< |
ThawAccount#
From the program's IDL:
Thaw a Frozen account using the Mint's freeze_authority (if set).
Discriminator 0b · data ThawAccount · accounts ThawAccountInstructionAccounts.
No data fields.
Required accounts: 3; extras go to remaining.
Fields of ThawAccountInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | account | Pubkey |
| 1 | mint | Pubkey |
| 2 | owner | Pubkey |
| 3… | remaining | Vec< |
Transfer#
From the program's IDL:
Transfers tokens from one account to another either directly or via a delegate. If this account is associated with the native mint then equal amounts of SOL and Tokens will be transferred to the destination account.
Discriminator 03 · data Transfer · accounts TransferInstructionAccounts.
| Field | Type | Description |
|---|---|---|
amount | u64 | The amount of tokens to transfer. |
Required accounts: 3; extras go to remaining.
Fields of TransferInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | source | Pubkey |
| 1 | destination | Pubkey |
| 2 | authority | Pubkey |
| 3… | remaining | Vec< |
TransferChecked#
From the program's IDL:
Transfers tokens from one account to another either directly or via a delegate. If this account is associated with the native mint then equal amounts of SOL and Tokens will be transferred to the destination account.
This instruction differs from Transfer in that the token mint and decimals value is checked by the caller. This may be useful when creating transactions offline or within a hardware wallet.
Discriminator 0c · data TransferChecked · accounts TransferCheckedInstructionAccounts.
| Field | Type | Description |
|---|---|---|
amount | u64 | The amount of tokens to transfer. |
decimals | u8 | Expected number of base 10 digits to the right of the decimal place. |
Required accounts: 4; extras go to remaining.
Fields of TransferCheckedInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | source | Pubkey |
| 1 | mint | Pubkey |
| 2 | destination | Pubkey |
| 3 | authority | Pubkey |
| 4… | remaining | Vec< |
UiAmountToAmount#
From the program's IDL:
Convert a UiAmount of tokens to a little-endian
u64raw Amount, using the given mint. In this version of the program, the mint can only specify the number of decimals.
Return data can be fetched usingsol_and deserializing the return data as a little-endianget_ return_ data u64.
Discriminator 18 · data UiAmountToAmount · accounts UiAmountToAmountInstructionAccounts.
| Field | Type | Description |
|---|---|---|
ui_amount | String | The ui_amount of tokens to reformat. |
Required accounts: 1; extras go to remaining.
Fields of UiAmountToAmountInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | mint | Pubkey |
| 1… | remaining | Vec< |
UnwrapLamports#
From the program's IDL:
Transfer lamports from a native SOL account to a destination account.
Discriminator 2d · data UnwrapLamports · accounts UnwrapLamportsInstructionAccounts.
| Field | Type | Description |
|---|---|---|
amount | Option<u64> | Optional amount of lamports to transfer. If not provided, the instruction will unwrap all lamports in excess of rent exemption. |
Required accounts: 3; extras go to remaining.
Fields of UnwrapLamportsInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | source | Pubkey |
| 1 | destination | Pubkey |
| 2 | authority | Pubkey |
| 3… | remaining | Vec< |
WithdrawExcessLamports#
From the program's IDL:
Rescue SOL sent to any TokenProgram-owned account by sending them to any other account, leaving behind only lamports for rent exemption.
Discriminator 26 · data WithdrawExcessLamports · accounts WithdrawExcessLamportsInstructionAccounts.
No data fields.
Required accounts: 3; extras go to remaining.
Fields of WithdrawExcessLamportsInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | source | Pubkey |
| 1 | destination | Pubkey |
| 2 | authority | Pubkey |
| 3… | remaining | Vec< |
Accounts#
Variants of TokenProgramAccount. Each wraps a boxed struct from carbon_. decode_ only considers accounts owned by PROGRAM_ID and returns the first variant that matches.
Mint#
Unpacked with spl_ · accounts::.
| Field | Type | Description |
|---|---|---|
mint_ | Option< | Optional authority used to mint new tokens. The mint authority may only be provided during mint creation. If no mint authority is present then the mint has a fixed supply and no further tokens may be minted. |
supply | u64 | Total supply of tokens. |
decimals | u8 | Number of base 10 digits to the right of the decimal place. |
is_ | bool | Is true if this structure has been initialized. |
freeze_ | Option< | Optional authority to freeze token accounts. |
Multisig#
Unpacked with spl_ · accounts::.
| Field | Type | Description |
|---|---|---|
m | u8 | Number of signers required. |
n | u8 | Number of valid signers. |
is_ | bool | Is true if this structure has been initialized. |
signers | [Pubkey; 11] | Signer public keys. |
Token#
Unpacked with spl_ · accounts::.
| Field | Type | Description |
|---|---|---|
mint | Pubkey | The mint associated with this account. |
owner | Pubkey | The owner of this account. |
amount | u64 | The amount of tokens this account holds. |
delegate | Option< | If delegate is Some then delegated_ represents the amount authorized by the delegate. |
state | AccountState | The account's state. |
is_native | Option<u64> | If is_native.is_some, this is a native token, and the value logs the rent-exempt reserve. An Account is required to be rent-exempt, so the value is used by the Processor to ensure that wrapped SOL accounts do not drop below this threshold. |
delegated_ | u64 | The amount delegated. |
close_ | Option< | Optional authority to close the account. |
Types#
Types used by the instructions, accounts and events above, exported from carbon_.
AccountState#
Enum types::.
| Variant |
|---|
Uninitialized |
Initialized |
Frozen |
AuthorityType#
Enum types::.
| Variant |
|---|
MintTokens |
FreezeAccount |
AccountOwner |
CloseAccount |
BatchItem#
Struct types::.
| Field | Type |
|---|---|
number_ | u8 |
instruction_ | Vec<u8> |