pub struct Token<T> { /* private fields */ }Implementations§
Source§impl<T> Token<T>where
T: SendTransaction + SimulateTransaction,
impl<T> Token<T>where
T: SendTransaction + SimulateTransaction,
pub fn new( client: Arc<dyn ProgramClient<T>>, program_id: &Pubkey, address: &Pubkey, decimals: Option<u8>, payer: Arc<dyn Signer>, ) -> Self
pub fn new_native( client: Arc<dyn ProgramClient<T>>, program_id: &Pubkey, payer: Arc<dyn Signer>, ) -> Self
pub fn is_native(&self) -> bool
Sourcepub fn get_address(&self) -> &Pubkey
pub fn get_address(&self) -> &Pubkey
Get token address.
pub fn with_payer(self, payer: Arc<dyn Signer>) -> Self
pub fn with_nonce( self, nonce_account: &Pubkey, nonce_authority: Arc<dyn Signer>, nonce_blockhash: &Hash, ) -> Self
pub fn with_transfer_hook_accounts( self, transfer_hook_accounts: Vec<AccountMeta>, ) -> Self
pub fn with_compute_unit_price(self, compute_unit_price: u64) -> Self
pub fn with_compute_unit_limit( self, compute_unit_limit: ComputeUnitLimit, ) -> Self
pub fn with_memo<M: AsRef<str>>(&self, memo: M, signers: Vec<Pubkey>) -> &Self
pub async fn get_new_latest_blockhash(&self) -> TokenResult<Hash>
pub async fn simulate_ixs<S: Signers>( &self, token_instructions: &[Instruction], signing_keypairs: &S, ) -> TokenResult<T::SimulationOutput>
pub async fn process_ixs<S: Signers>( &self, token_instructions: &[Instruction], signing_keypairs: &S, ) -> TokenResult<T::Output>
pub async fn create_mint<'a, S: Signers>( &self, mint_authority: &'a Pubkey, freeze_authority: Option<&'a Pubkey>, extension_initialization_params: Vec<ExtensionInitializationParams>, signing_keypairs: &S, ) -> TokenResult<T::Output>
Sourcepub async fn create_native_mint(
client: Arc<dyn ProgramClient<T>>,
program_id: &Pubkey,
payer: Arc<dyn Signer>,
) -> TokenResult<Self>
pub async fn create_native_mint( client: Arc<dyn ProgramClient<T>>, program_id: &Pubkey, payer: Arc<dyn Signer>, ) -> TokenResult<Self>
Create native mint
Sourcepub async fn create_multisig(
&self,
account: &dyn Signer,
multisig_members: &[&Pubkey],
minimum_signers: u8,
) -> TokenResult<T::Output>
pub async fn create_multisig( &self, account: &dyn Signer, multisig_members: &[&Pubkey], minimum_signers: u8, ) -> TokenResult<T::Output>
Create multisig
Sourcepub fn get_associated_token_address(&self, owner: &Pubkey) -> Pubkey
pub fn get_associated_token_address(&self, owner: &Pubkey) -> Pubkey
Get the address for the associated token account.
Sourcepub async fn create_associated_token_account(
&self,
owner: &Pubkey,
) -> TokenResult<T::Output>
pub async fn create_associated_token_account( &self, owner: &Pubkey, ) -> TokenResult<T::Output>
Create and initialize the associated account.
Sourcepub async fn create_auxiliary_token_account(
&self,
account: &dyn Signer,
owner: &Pubkey,
) -> TokenResult<T::Output>
pub async fn create_auxiliary_token_account( &self, account: &dyn Signer, owner: &Pubkey, ) -> TokenResult<T::Output>
Create and initialize a new token account.
Sourcepub async fn create_auxiliary_token_account_with_extension_space(
&self,
account: &dyn Signer,
owner: &Pubkey,
extensions: Vec<ExtensionType>,
) -> TokenResult<T::Output>
pub async fn create_auxiliary_token_account_with_extension_space( &self, account: &dyn Signer, owner: &Pubkey, extensions: Vec<ExtensionType>, ) -> TokenResult<T::Output>
Create and initialize a new token account.
Sourcepub async fn get_account(&self, account: Pubkey) -> TokenResult<BaseAccount>
pub async fn get_account(&self, account: Pubkey) -> TokenResult<BaseAccount>
Retrieve a raw account
Sourcepub async fn get_mint_info(&self) -> TokenResult<StateWithExtensionsOwned<Mint>>
pub async fn get_mint_info(&self) -> TokenResult<StateWithExtensionsOwned<Mint>>
Retrieve mint information.
Sourcepub async fn get_account_info(
&self,
account: &Pubkey,
) -> TokenResult<StateWithExtensionsOwned<Account>>
pub async fn get_account_info( &self, account: &Pubkey, ) -> TokenResult<StateWithExtensionsOwned<Account>>
Retrieve account information.
Sourcepub async fn get_or_create_associated_account_info(
&self,
owner: &Pubkey,
) -> TokenResult<StateWithExtensionsOwned<Account>>
pub async fn get_or_create_associated_account_info( &self, owner: &Pubkey, ) -> TokenResult<StateWithExtensionsOwned<Account>>
Retrieve the associated account or create one if not found.
Assign a new authority to the account.
Sourcepub async fn mint_to<S: Signers>(
&self,
destination: &Pubkey,
authority: &Pubkey,
amount: u64,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn mint_to<S: Signers>( &self, destination: &Pubkey, authority: &Pubkey, amount: u64, signing_keypairs: &S, ) -> TokenResult<T::Output>
Mint new tokens
Sourcepub async fn transfer<S: Signers>(
&self,
source: &Pubkey,
destination: &Pubkey,
authority: &Pubkey,
amount: u64,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn transfer<S: Signers>( &self, source: &Pubkey, destination: &Pubkey, authority: &Pubkey, amount: u64, signing_keypairs: &S, ) -> TokenResult<T::Output>
Transfer tokens to another account
Sourcepub async fn create_recipient_associated_account_and_transfer<S: Signers>(
&self,
source: &Pubkey,
destination: &Pubkey,
destination_owner: &Pubkey,
authority: &Pubkey,
amount: u64,
fee: Option<u64>,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn create_recipient_associated_account_and_transfer<S: Signers>( &self, source: &Pubkey, destination: &Pubkey, destination_owner: &Pubkey, authority: &Pubkey, amount: u64, fee: Option<u64>, signing_keypairs: &S, ) -> TokenResult<T::Output>
Transfer tokens to an associated account, creating it if it does not exist
Sourcepub async fn transfer_with_fee<S: Signers>(
&self,
source: &Pubkey,
destination: &Pubkey,
authority: &Pubkey,
amount: u64,
fee: u64,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn transfer_with_fee<S: Signers>( &self, source: &Pubkey, destination: &Pubkey, authority: &Pubkey, amount: u64, fee: u64, signing_keypairs: &S, ) -> TokenResult<T::Output>
Transfer tokens to another account, given an expected fee
Sourcepub async fn burn<S: Signers>(
&self,
source: &Pubkey,
authority: &Pubkey,
amount: u64,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn burn<S: Signers>( &self, source: &Pubkey, authority: &Pubkey, amount: u64, signing_keypairs: &S, ) -> TokenResult<T::Output>
Burn tokens from account
Sourcepub async fn approve<S: Signers>(
&self,
source: &Pubkey,
delegate: &Pubkey,
authority: &Pubkey,
amount: u64,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn approve<S: Signers>( &self, source: &Pubkey, delegate: &Pubkey, authority: &Pubkey, amount: u64, signing_keypairs: &S, ) -> TokenResult<T::Output>
Approve a delegate to spend tokens
Sourcepub async fn revoke<S: Signers>(
&self,
source: &Pubkey,
authority: &Pubkey,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn revoke<S: Signers>( &self, source: &Pubkey, authority: &Pubkey, signing_keypairs: &S, ) -> TokenResult<T::Output>
Revoke a delegate
Sourcepub async fn close_account<S: Signers>(
&self,
account: &Pubkey,
lamports_destination: &Pubkey,
authority: &Pubkey,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn close_account<S: Signers>( &self, account: &Pubkey, lamports_destination: &Pubkey, authority: &Pubkey, signing_keypairs: &S, ) -> TokenResult<T::Output>
Close an empty account and reclaim its lamports
Sourcepub async fn empty_and_close_account<S: Signers>(
&self,
account_to_close: &Pubkey,
lamports_destination: &Pubkey,
tokens_destination: &Pubkey,
authority: &Pubkey,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn empty_and_close_account<S: Signers>( &self, account_to_close: &Pubkey, lamports_destination: &Pubkey, tokens_destination: &Pubkey, authority: &Pubkey, signing_keypairs: &S, ) -> TokenResult<T::Output>
Close an account, reclaiming its lamports and tokens
Sourcepub async fn freeze<S: Signers>(
&self,
account: &Pubkey,
authority: &Pubkey,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn freeze<S: Signers>( &self, account: &Pubkey, authority: &Pubkey, signing_keypairs: &S, ) -> TokenResult<T::Output>
Freeze a token account
Sourcepub async fn thaw<S: Signers>(
&self,
account: &Pubkey,
authority: &Pubkey,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn thaw<S: Signers>( &self, account: &Pubkey, authority: &Pubkey, signing_keypairs: &S, ) -> TokenResult<T::Output>
Thaw / unfreeze a token account
Sourcepub async fn wrap<S: Signers>(
&self,
account: &Pubkey,
owner: &Pubkey,
lamports: u64,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn wrap<S: Signers>( &self, account: &Pubkey, owner: &Pubkey, lamports: u64, signing_keypairs: &S, ) -> TokenResult<T::Output>
Wrap lamports into native account
Sourcepub async fn wrap_with_mutable_ownership<S: Signers>(
&self,
account: &Pubkey,
owner: &Pubkey,
lamports: u64,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn wrap_with_mutable_ownership<S: Signers>( &self, account: &Pubkey, owner: &Pubkey, lamports: u64, signing_keypairs: &S, ) -> TokenResult<T::Output>
Wrap lamports into a native account that can always have its ownership changed
Sourcepub async fn sync_native(&self, account: &Pubkey) -> TokenResult<T::Output>
pub async fn sync_native(&self, account: &Pubkey) -> TokenResult<T::Output>
Sync native account lamports
Sourcepub async fn set_transfer_fee<S: Signers>(
&self,
authority: &Pubkey,
transfer_fee_basis_points: u16,
maximum_fee: u64,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn set_transfer_fee<S: Signers>( &self, authority: &Pubkey, transfer_fee_basis_points: u16, maximum_fee: u64, signing_keypairs: &S, ) -> TokenResult<T::Output>
Set transfer fee
Sourcepub async fn set_default_account_state<S: Signers>(
&self,
authority: &Pubkey,
state: &AccountState,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn set_default_account_state<S: Signers>( &self, authority: &Pubkey, state: &AccountState, signing_keypairs: &S, ) -> TokenResult<T::Output>
Set default account state on mint
Sourcepub async fn harvest_withheld_tokens_to_mint(
&self,
sources: &[&Pubkey],
) -> TokenResult<T::Output>
pub async fn harvest_withheld_tokens_to_mint( &self, sources: &[&Pubkey], ) -> TokenResult<T::Output>
Harvest withheld tokens to mint
Sourcepub async fn withdraw_withheld_tokens_from_mint<S: Signers>(
&self,
destination: &Pubkey,
authority: &Pubkey,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn withdraw_withheld_tokens_from_mint<S: Signers>( &self, destination: &Pubkey, authority: &Pubkey, signing_keypairs: &S, ) -> TokenResult<T::Output>
Withdraw withheld tokens from mint
Sourcepub async fn withdraw_withheld_tokens_from_accounts<S: Signers>(
&self,
destination: &Pubkey,
authority: &Pubkey,
sources: &[&Pubkey],
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn withdraw_withheld_tokens_from_accounts<S: Signers>( &self, destination: &Pubkey, authority: &Pubkey, sources: &[&Pubkey], signing_keypairs: &S, ) -> TokenResult<T::Output>
Withdraw withheld tokens from accounts
Sourcepub async fn reallocate<S: Signers>(
&self,
account: &Pubkey,
authority: &Pubkey,
extension_types: &[ExtensionType],
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn reallocate<S: Signers>( &self, account: &Pubkey, authority: &Pubkey, extension_types: &[ExtensionType], signing_keypairs: &S, ) -> TokenResult<T::Output>
Reallocate a token account to be large enough for a set of
ExtensionTypes
Sourcepub async fn enable_required_transfer_memos<S: Signers>(
&self,
account: &Pubkey,
authority: &Pubkey,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn enable_required_transfer_memos<S: Signers>( &self, account: &Pubkey, authority: &Pubkey, signing_keypairs: &S, ) -> TokenResult<T::Output>
Require memos on transfers into this account
Sourcepub async fn disable_required_transfer_memos<S: Signers>(
&self,
account: &Pubkey,
authority: &Pubkey,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn disable_required_transfer_memos<S: Signers>( &self, account: &Pubkey, authority: &Pubkey, signing_keypairs: &S, ) -> TokenResult<T::Output>
Stop requiring memos on transfers into this account
Sourcepub async fn pause<S: Signers>(
&self,
authority: &Pubkey,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn pause<S: Signers>( &self, authority: &Pubkey, signing_keypairs: &S, ) -> TokenResult<T::Output>
Pause transferring, minting, and burning on the mint
Sourcepub async fn resume<S: Signers>(
&self,
authority: &Pubkey,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn resume<S: Signers>( &self, authority: &Pubkey, signing_keypairs: &S, ) -> TokenResult<T::Output>
Resume transferring, minting, and burning on the mint
Sourcepub async fn enable_cpi_guard<S: Signers>(
&self,
account: &Pubkey,
authority: &Pubkey,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn enable_cpi_guard<S: Signers>( &self, account: &Pubkey, authority: &Pubkey, signing_keypairs: &S, ) -> TokenResult<T::Output>
Prevent unsafe usage of token account through CPI
Sourcepub async fn disable_cpi_guard<S: Signers>(
&self,
account: &Pubkey,
authority: &Pubkey,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn disable_cpi_guard<S: Signers>( &self, account: &Pubkey, authority: &Pubkey, signing_keypairs: &S, ) -> TokenResult<T::Output>
Stop preventing unsafe usage of token account through CPI
Sourcepub async fn update_interest_rate<S: Signers>(
&self,
authority: &Pubkey,
new_rate: i16,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn update_interest_rate<S: Signers>( &self, authority: &Pubkey, new_rate: i16, signing_keypairs: &S, ) -> TokenResult<T::Output>
Update interest rate
Sourcepub async fn update_multiplier<S: Signers>(
&self,
authority: &Pubkey,
new_multiplier: f64,
new_multiplier_effective_timestamp: i64,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn update_multiplier<S: Signers>( &self, authority: &Pubkey, new_multiplier: f64, new_multiplier_effective_timestamp: i64, signing_keypairs: &S, ) -> TokenResult<T::Output>
Update multiplier
Sourcepub async fn update_transfer_hook_program_id<S: Signers>(
&self,
authority: &Pubkey,
new_program_id: Option<Pubkey>,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn update_transfer_hook_program_id<S: Signers>( &self, authority: &Pubkey, new_program_id: Option<Pubkey>, signing_keypairs: &S, ) -> TokenResult<T::Output>
Update transfer hook program id
Sourcepub async fn update_metadata_address<S: Signers>(
&self,
authority: &Pubkey,
new_metadata_address: Option<Pubkey>,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn update_metadata_address<S: Signers>( &self, authority: &Pubkey, new_metadata_address: Option<Pubkey>, signing_keypairs: &S, ) -> TokenResult<T::Output>
Update metadata pointer address
Sourcepub async fn update_group_address<S: Signers>(
&self,
authority: &Pubkey,
new_group_address: Option<Pubkey>,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn update_group_address<S: Signers>( &self, authority: &Pubkey, new_group_address: Option<Pubkey>, signing_keypairs: &S, ) -> TokenResult<T::Output>
Update group pointer address
Sourcepub async fn update_group_member_address<S: Signers>(
&self,
authority: &Pubkey,
new_member_address: Option<Pubkey>,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn update_group_member_address<S: Signers>( &self, authority: &Pubkey, new_member_address: Option<Pubkey>, signing_keypairs: &S, ) -> TokenResult<T::Output>
Update group member pointer address
Sourcepub async fn confidential_transfer_update_mint<S: Signers>(
&self,
authority: &Pubkey,
auto_approve_new_account: bool,
auditor_elgamal_pubkey: Option<PodElGamalPubkey>,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn confidential_transfer_update_mint<S: Signers>( &self, authority: &Pubkey, auto_approve_new_account: bool, auditor_elgamal_pubkey: Option<PodElGamalPubkey>, signing_keypairs: &S, ) -> TokenResult<T::Output>
Update confidential transfer mint
Sourcepub async fn confidential_transfer_configure_token_account<S: Signers>(
&self,
account: &Pubkey,
authority: &Pubkey,
context_state_account: Option<&Pubkey>,
maximum_pending_balance_credit_counter: Option<u64>,
elgamal_keypair: &ElGamalKeypair,
aes_key: &AeKey,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn confidential_transfer_configure_token_account<S: Signers>( &self, account: &Pubkey, authority: &Pubkey, context_state_account: Option<&Pubkey>, maximum_pending_balance_credit_counter: Option<u64>, elgamal_keypair: &ElGamalKeypair, aes_key: &AeKey, signing_keypairs: &S, ) -> TokenResult<T::Output>
Configures confidential transfers for a token account. If the maximum
pending balance credit counter for the extension is not provided,
then it is set to be a default value of 2^16.
Sourcepub async fn confidential_transfer_configure_token_account_with_registry(
&self,
account: &Pubkey,
elgamal_registry_account: &Pubkey,
payer: Option<&Pubkey>,
) -> TokenResult<T::Output>
pub async fn confidential_transfer_configure_token_account_with_registry( &self, account: &Pubkey, elgamal_registry_account: &Pubkey, payer: Option<&Pubkey>, ) -> TokenResult<T::Output>
Configures confidential transfers for a token account using an ElGamal registry account
Sourcepub async fn confidential_transfer_approve_account<S: Signers>(
&self,
account: &Pubkey,
authority: &Pubkey,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn confidential_transfer_approve_account<S: Signers>( &self, account: &Pubkey, authority: &Pubkey, signing_keypairs: &S, ) -> TokenResult<T::Output>
Approves a token account for confidential transfers
Sourcepub async fn confidential_transfer_empty_account<S: Signers>(
&self,
account: &Pubkey,
authority: &Pubkey,
context_state_account: Option<&Pubkey>,
account_info: Option<EmptyAccountAccountInfo>,
elgamal_keypair: &ElGamalKeypair,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn confidential_transfer_empty_account<S: Signers>( &self, account: &Pubkey, authority: &Pubkey, context_state_account: Option<&Pubkey>, account_info: Option<EmptyAccountAccountInfo>, elgamal_keypair: &ElGamalKeypair, signing_keypairs: &S, ) -> TokenResult<T::Output>
Prepare a token account with the confidential transfer extension for closing
Sourcepub async fn confidential_transfer_deposit<S: Signers>(
&self,
account: &Pubkey,
authority: &Pubkey,
amount: u64,
decimals: u8,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn confidential_transfer_deposit<S: Signers>( &self, account: &Pubkey, authority: &Pubkey, amount: u64, decimals: u8, signing_keypairs: &S, ) -> TokenResult<T::Output>
Deposit SPL Tokens into the pending balance of a confidential token account
Sourcepub async fn confidential_transfer_withdraw<S: Signers>(
&self,
account: &Pubkey,
authority: &Pubkey,
equality_proof_account: Option<&Pubkey>,
range_proof_account: Option<&Pubkey>,
withdraw_amount: u64,
decimals: u8,
account_info: Option<WithdrawAccountInfo>,
elgamal_keypair: &ElGamalKeypair,
aes_key: &AeKey,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn confidential_transfer_withdraw<S: Signers>( &self, account: &Pubkey, authority: &Pubkey, equality_proof_account: Option<&Pubkey>, range_proof_account: Option<&Pubkey>, withdraw_amount: u64, decimals: u8, account_info: Option<WithdrawAccountInfo>, elgamal_keypair: &ElGamalKeypair, aes_key: &AeKey, signing_keypairs: &S, ) -> TokenResult<T::Output>
Withdraw SPL Tokens from the available balance of a confidential token account
Sourcepub async fn confidential_transfer_transfer<S: Signers>(
&self,
source_account: &Pubkey,
destination_account: &Pubkey,
source_authority: &Pubkey,
equality_proof_account: Option<&Pubkey>,
ciphertext_validity_proof_account_with_ciphertext: Option<&ProofAccountWithCiphertext>,
range_proof_account: Option<&Pubkey>,
transfer_amount: u64,
account_info: Option<TransferAccountInfo>,
source_elgamal_keypair: &ElGamalKeypair,
source_aes_key: &AeKey,
destination_elgamal_pubkey: &ElGamalPubkey,
auditor_elgamal_pubkey: Option<&ElGamalPubkey>,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn confidential_transfer_transfer<S: Signers>( &self, source_account: &Pubkey, destination_account: &Pubkey, source_authority: &Pubkey, equality_proof_account: Option<&Pubkey>, ciphertext_validity_proof_account_with_ciphertext: Option<&ProofAccountWithCiphertext>, range_proof_account: Option<&Pubkey>, transfer_amount: u64, account_info: Option<TransferAccountInfo>, source_elgamal_keypair: &ElGamalKeypair, source_aes_key: &AeKey, destination_elgamal_pubkey: &ElGamalPubkey, auditor_elgamal_pubkey: Option<&ElGamalPubkey>, signing_keypairs: &S, ) -> TokenResult<T::Output>
Transfer tokens confidentially
Sourcepub async fn confidential_transfer_create_record_account<S1: Signer, S2: Signer, ZK: Pod + ZkProofData<U>, U: Pod>(
&self,
record_account: &Pubkey,
record_authority: &Pubkey,
proof_data: &ZK,
record_account_signer: &S1,
record_authority_signer: &S2,
) -> TokenResult<Vec<T::Output>>
pub async fn confidential_transfer_create_record_account<S1: Signer, S2: Signer, ZK: Pod + ZkProofData<U>, U: Pod>( &self, record_account: &Pubkey, record_authority: &Pubkey, proof_data: &ZK, record_account_signer: &S1, record_authority_signer: &S2, ) -> TokenResult<Vec<T::Output>>
Create a record account containing zero-knowledge proof needed for a confidential transfer.
Sourcepub async fn confidential_transfer_close_record_account<S: Signers>(
&self,
record_account: &Pubkey,
lamport_destination_account: &Pubkey,
record_account_authority: &Pubkey,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn confidential_transfer_close_record_account<S: Signers>( &self, record_account: &Pubkey, lamport_destination_account: &Pubkey, record_account_authority: &Pubkey, signing_keypairs: &S, ) -> TokenResult<T::Output>
Close a record account.
Sourcepub async fn confidential_transfer_create_context_state_account<S: Signers, ZK: Pod + ZkProofData<U>, U: Pod>(
&self,
context_state_account: &Pubkey,
context_state_authority: &Pubkey,
proof_data: &ZK,
split_account_creation_and_proof_verification: bool,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn confidential_transfer_create_context_state_account<S: Signers, ZK: Pod + ZkProofData<U>, U: Pod>( &self, context_state_account: &Pubkey, context_state_authority: &Pubkey, proof_data: &ZK, split_account_creation_and_proof_verification: bool, signing_keypairs: &S, ) -> TokenResult<T::Output>
Create a context state account containing zero-knowledge proof needed for a confidential transfer instruction.
Sourcepub async fn confidential_transfer_create_context_state_account_from_record<S: Signers, ZK: Pod + ZkProofData<U>, U: Pod>(
&self,
context_state_account: &Pubkey,
context_state_authority: &Pubkey,
record_account: &Pubkey,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn confidential_transfer_create_context_state_account_from_record<S: Signers, ZK: Pod + ZkProofData<U>, U: Pod>( &self, context_state_account: &Pubkey, context_state_authority: &Pubkey, record_account: &Pubkey, signing_keypairs: &S, ) -> TokenResult<T::Output>
Create a context state account from another account containing zero-knowledge proof needed for a confidential transfer instruction.
Sourcepub async fn confidential_transfer_close_context_state_account<S: Signers>(
&self,
context_state_account: &Pubkey,
lamport_destination_account: &Pubkey,
context_state_authority: &Pubkey,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn confidential_transfer_close_context_state_account<S: Signers>( &self, context_state_account: &Pubkey, lamport_destination_account: &Pubkey, context_state_authority: &Pubkey, signing_keypairs: &S, ) -> TokenResult<T::Output>
Close a ZK Token proof program context state
Sourcepub async fn confidential_transfer_transfer_with_fee<S: Signers>(
&self,
source_account: &Pubkey,
destination_account: &Pubkey,
source_authority: &Pubkey,
equality_proof_account: Option<&Pubkey>,
transfer_amount_ciphertext_validity_proof_account_with_ciphertext: Option<&ProofAccountWithCiphertext>,
percentage_with_cap_proof_account: Option<&Pubkey>,
fee_ciphertext_validity_proof_account: Option<&Pubkey>,
range_proof_account: Option<&Pubkey>,
transfer_amount: u64,
account_info: Option<TransferAccountInfo>,
source_elgamal_keypair: &ElGamalKeypair,
source_aes_key: &AeKey,
destination_elgamal_pubkey: &ElGamalPubkey,
auditor_elgamal_pubkey: Option<&ElGamalPubkey>,
withdraw_withheld_authority_elgamal_pubkey: &ElGamalPubkey,
fee_rate_basis_points: u16,
maximum_fee: u64,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn confidential_transfer_transfer_with_fee<S: Signers>( &self, source_account: &Pubkey, destination_account: &Pubkey, source_authority: &Pubkey, equality_proof_account: Option<&Pubkey>, transfer_amount_ciphertext_validity_proof_account_with_ciphertext: Option<&ProofAccountWithCiphertext>, percentage_with_cap_proof_account: Option<&Pubkey>, fee_ciphertext_validity_proof_account: Option<&Pubkey>, range_proof_account: Option<&Pubkey>, transfer_amount: u64, account_info: Option<TransferAccountInfo>, source_elgamal_keypair: &ElGamalKeypair, source_aes_key: &AeKey, destination_elgamal_pubkey: &ElGamalPubkey, auditor_elgamal_pubkey: Option<&ElGamalPubkey>, withdraw_withheld_authority_elgamal_pubkey: &ElGamalPubkey, fee_rate_basis_points: u16, maximum_fee: u64, signing_keypairs: &S, ) -> TokenResult<T::Output>
Transfer tokens confidentially with fee
Sourcepub async fn confidential_transfer_apply_pending_balance<S: Signers>(
&self,
account: &Pubkey,
authority: &Pubkey,
account_info: Option<ApplyPendingBalanceAccountInfo>,
elgamal_secret_key: &ElGamalSecretKey,
aes_key: &AeKey,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn confidential_transfer_apply_pending_balance<S: Signers>( &self, account: &Pubkey, authority: &Pubkey, account_info: Option<ApplyPendingBalanceAccountInfo>, elgamal_secret_key: &ElGamalSecretKey, aes_key: &AeKey, signing_keypairs: &S, ) -> TokenResult<T::Output>
Applies the confidential transfer pending balance to the available balance
Sourcepub async fn confidential_transfer_enable_confidential_credits<S: Signers>(
&self,
account: &Pubkey,
authority: &Pubkey,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn confidential_transfer_enable_confidential_credits<S: Signers>( &self, account: &Pubkey, authority: &Pubkey, signing_keypairs: &S, ) -> TokenResult<T::Output>
Enable confidential transfer Deposit and Transfer instructions for a
token account
Sourcepub async fn confidential_transfer_disable_confidential_credits<S: Signers>(
&self,
account: &Pubkey,
authority: &Pubkey,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn confidential_transfer_disable_confidential_credits<S: Signers>( &self, account: &Pubkey, authority: &Pubkey, signing_keypairs: &S, ) -> TokenResult<T::Output>
Disable confidential transfer Deposit and Transfer instructions for
a token account
Sourcepub async fn confidential_transfer_enable_non_confidential_credits<S: Signers>(
&self,
account: &Pubkey,
authority: &Pubkey,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn confidential_transfer_enable_non_confidential_credits<S: Signers>( &self, account: &Pubkey, authority: &Pubkey, signing_keypairs: &S, ) -> TokenResult<T::Output>
Enable a confidential extension token account to receive non-confidential payments
Sourcepub async fn confidential_transfer_disable_non_confidential_credits<S: Signers>(
&self,
account: &Pubkey,
authority: &Pubkey,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn confidential_transfer_disable_non_confidential_credits<S: Signers>( &self, account: &Pubkey, authority: &Pubkey, signing_keypairs: &S, ) -> TokenResult<T::Output>
Disable non-confidential payments for a confidential extension token account
Sourcepub async fn confidential_transfer_withdraw_withheld_tokens_from_mint<S: Signers>(
&self,
destination_account: &Pubkey,
withdraw_withheld_authority: &Pubkey,
context_state_account: Option<&Pubkey>,
withheld_tokens_info: Option<WithheldTokensInfo>,
withdraw_withheld_authority_elgamal_keypair: &ElGamalKeypair,
destination_elgamal_pubkey: &ElGamalPubkey,
new_decryptable_available_balance: &DecryptableBalance,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn confidential_transfer_withdraw_withheld_tokens_from_mint<S: Signers>( &self, destination_account: &Pubkey, withdraw_withheld_authority: &Pubkey, context_state_account: Option<&Pubkey>, withheld_tokens_info: Option<WithheldTokensInfo>, withdraw_withheld_authority_elgamal_keypair: &ElGamalKeypair, destination_elgamal_pubkey: &ElGamalPubkey, new_decryptable_available_balance: &DecryptableBalance, signing_keypairs: &S, ) -> TokenResult<T::Output>
Withdraw withheld confidential tokens from mint
Sourcepub async fn confidential_transfer_withdraw_withheld_tokens_from_accounts<S: Signers>(
&self,
destination_account: &Pubkey,
withdraw_withheld_authority: &Pubkey,
context_state_account: Option<&Pubkey>,
withheld_tokens_info: Option<WithheldTokensInfo>,
withdraw_withheld_authority_elgamal_keypair: &ElGamalKeypair,
destination_elgamal_pubkey: &ElGamalPubkey,
new_decryptable_available_balance: &DecryptableBalance,
sources: &[&Pubkey],
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn confidential_transfer_withdraw_withheld_tokens_from_accounts<S: Signers>( &self, destination_account: &Pubkey, withdraw_withheld_authority: &Pubkey, context_state_account: Option<&Pubkey>, withheld_tokens_info: Option<WithheldTokensInfo>, withdraw_withheld_authority_elgamal_keypair: &ElGamalKeypair, destination_elgamal_pubkey: &ElGamalPubkey, new_decryptable_available_balance: &DecryptableBalance, sources: &[&Pubkey], signing_keypairs: &S, ) -> TokenResult<T::Output>
Withdraw withheld confidential tokens from accounts
Sourcepub async fn confidential_transfer_harvest_withheld_tokens_to_mint(
&self,
sources: &[&Pubkey],
) -> TokenResult<T::Output>
pub async fn confidential_transfer_harvest_withheld_tokens_to_mint( &self, sources: &[&Pubkey], ) -> TokenResult<T::Output>
Harvest withheld confidential tokens to mint
Sourcepub async fn confidential_transfer_enable_harvest_to_mint<S: Signers>(
&self,
withdraw_withheld_authority: &Pubkey,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn confidential_transfer_enable_harvest_to_mint<S: Signers>( &self, withdraw_withheld_authority: &Pubkey, signing_keypairs: &S, ) -> TokenResult<T::Output>
Enable harvest of confidential fees to mint
Sourcepub async fn confidential_transfer_disable_harvest_to_mint<S: Signers>(
&self,
withdraw_withheld_authority: &Pubkey,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn confidential_transfer_disable_harvest_to_mint<S: Signers>( &self, withdraw_withheld_authority: &Pubkey, signing_keypairs: &S, ) -> TokenResult<T::Output>
Disable harvest of confidential fees to mint
Sourcepub async fn confidential_transfer_rotate_supply_elgamal_pubkey<S: Signers>(
&self,
authority: &Pubkey,
current_supply_elgamal_keypair: &ElGamalKeypair,
new_supply_elgamal_pubkey: &ElGamalPubkey,
aes_key: &AeKey,
context_state_account: Option<&Pubkey>,
account_info: Option<SupplyAccountInfo>,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn confidential_transfer_rotate_supply_elgamal_pubkey<S: Signers>( &self, authority: &Pubkey, current_supply_elgamal_keypair: &ElGamalKeypair, new_supply_elgamal_pubkey: &ElGamalPubkey, aes_key: &AeKey, context_state_account: Option<&Pubkey>, account_info: Option<SupplyAccountInfo>, signing_keypairs: &S, ) -> TokenResult<T::Output>
Rotate supply ElGamal public key in a confidential mint
Sourcepub async fn confidential_transfer_update_decrypt_supply<S: Signers>(
&self,
authority: &Pubkey,
new_decryptable_supply: &DecryptableBalance,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn confidential_transfer_update_decrypt_supply<S: Signers>( &self, authority: &Pubkey, new_decryptable_supply: &DecryptableBalance, signing_keypairs: &S, ) -> TokenResult<T::Output>
Update decryptable supply in a confidential mint
Sourcepub async fn confidential_transfer_mint<S: Signers>(
&self,
authority: &Pubkey,
destination_account: &Pubkey,
equality_proof_account: Option<&Pubkey>,
ciphertext_validity_proof_account_with_ciphertext: Option<&ProofAccountWithCiphertext>,
range_proof_account: Option<&Pubkey>,
mint_amount: u64,
supply_elgamal_keypair: &ElGamalKeypair,
destination_elgamal_pubkey: &ElGamalPubkey,
auditor_elgamal_pubkey: Option<&ElGamalPubkey>,
aes_key: &AeKey,
account_info: Option<SupplyAccountInfo>,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn confidential_transfer_mint<S: Signers>( &self, authority: &Pubkey, destination_account: &Pubkey, equality_proof_account: Option<&Pubkey>, ciphertext_validity_proof_account_with_ciphertext: Option<&ProofAccountWithCiphertext>, range_proof_account: Option<&Pubkey>, mint_amount: u64, supply_elgamal_keypair: &ElGamalKeypair, destination_elgamal_pubkey: &ElGamalPubkey, auditor_elgamal_pubkey: Option<&ElGamalPubkey>, aes_key: &AeKey, account_info: Option<SupplyAccountInfo>, signing_keypairs: &S, ) -> TokenResult<T::Output>
Confidentially mint tokens
Sourcepub async fn confidential_transfer_burn<S: Signers>(
&self,
authority: &Pubkey,
source_account: &Pubkey,
equality_proof_account: Option<&Pubkey>,
ciphertext_validity_proof_account_with_ciphertext: Option<&ProofAccountWithCiphertext>,
range_proof_account: Option<&Pubkey>,
burn_amount: u64,
source_elgamal_keypair: &ElGamalKeypair,
supply_elgamal_pubkey: &ElGamalPubkey,
auditor_elgamal_pubkey: Option<&ElGamalPubkey>,
aes_key: &AeKey,
account_info: Option<BurnAccountInfo>,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn confidential_transfer_burn<S: Signers>( &self, authority: &Pubkey, source_account: &Pubkey, equality_proof_account: Option<&Pubkey>, ciphertext_validity_proof_account_with_ciphertext: Option<&ProofAccountWithCiphertext>, range_proof_account: Option<&Pubkey>, burn_amount: u64, source_elgamal_keypair: &ElGamalKeypair, supply_elgamal_pubkey: &ElGamalPubkey, auditor_elgamal_pubkey: Option<&ElGamalPubkey>, aes_key: &AeKey, account_info: Option<BurnAccountInfo>, signing_keypairs: &S, ) -> TokenResult<T::Output>
Confidentially burn tokens
Sourcepub async fn confidential_transfer_apply_pending_burn<S: Signers>(
&self,
authority: &Pubkey,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn confidential_transfer_apply_pending_burn<S: Signers>( &self, authority: &Pubkey, signing_keypairs: &S, ) -> TokenResult<T::Output>
Apply pending burn amount to the confidential supply amount
pub async fn withdraw_excess_lamports<S: Signers>( &self, source: &Pubkey, destination: &Pubkey, authority: &Pubkey, signing_keypairs: &S, ) -> TokenResult<T::Output>
Sourcepub async fn token_metadata_initialize<S: Signers>(
&self,
update_authority: &Pubkey,
mint_authority: &Pubkey,
name: String,
symbol: String,
uri: String,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn token_metadata_initialize<S: Signers>( &self, update_authority: &Pubkey, mint_authority: &Pubkey, name: String, symbol: String, uri: String, signing_keypairs: &S, ) -> TokenResult<T::Output>
Initialize token-metadata on a mint
Sourcepub async fn token_metadata_initialize_with_rent_transfer<S: Signers>(
&self,
payer: &Pubkey,
update_authority: &Pubkey,
mint_authority: &Pubkey,
name: String,
symbol: String,
uri: String,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn token_metadata_initialize_with_rent_transfer<S: Signers>( &self, payer: &Pubkey, update_authority: &Pubkey, mint_authority: &Pubkey, name: String, symbol: String, uri: String, signing_keypairs: &S, ) -> TokenResult<T::Output>
Initialize token-metadata on a mint
Sourcepub async fn token_metadata_update_field<S: Signers>(
&self,
update_authority: &Pubkey,
field: Field,
value: String,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn token_metadata_update_field<S: Signers>( &self, update_authority: &Pubkey, field: Field, value: String, signing_keypairs: &S, ) -> TokenResult<T::Output>
Update a token-metadata field on a mint
Sourcepub async fn token_metadata_update_field_with_rent_transfer<S: Signers>(
&self,
payer: &Pubkey,
update_authority: &Pubkey,
field: Field,
value: String,
transfer_lamports: Option<u64>,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn token_metadata_update_field_with_rent_transfer<S: Signers>( &self, payer: &Pubkey, update_authority: &Pubkey, field: Field, value: String, transfer_lamports: Option<u64>, signing_keypairs: &S, ) -> TokenResult<T::Output>
Update a token-metadata field on a mint. Includes a transfer for any additional rent-exempt SOL required.
Update the token-metadata authority in a mint
Sourcepub async fn token_metadata_remove_key<S: Signers>(
&self,
update_authority: &Pubkey,
key: String,
idempotent: bool,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn token_metadata_remove_key<S: Signers>( &self, update_authority: &Pubkey, key: String, idempotent: bool, signing_keypairs: &S, ) -> TokenResult<T::Output>
Remove a token-metadata field on a mint
Sourcepub async fn token_group_initialize<S: Signers>(
&self,
mint_authority: &Pubkey,
update_authority: &Pubkey,
max_size: u64,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn token_group_initialize<S: Signers>( &self, mint_authority: &Pubkey, update_authority: &Pubkey, max_size: u64, signing_keypairs: &S, ) -> TokenResult<T::Output>
Initialize token-group on a mint
Sourcepub async fn token_group_initialize_with_rent_transfer<S: Signers>(
&self,
payer: &Pubkey,
mint_authority: &Pubkey,
update_authority: &Pubkey,
max_size: u64,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn token_group_initialize_with_rent_transfer<S: Signers>( &self, payer: &Pubkey, mint_authority: &Pubkey, update_authority: &Pubkey, max_size: u64, signing_keypairs: &S, ) -> TokenResult<T::Output>
Initialize token-group on a mint
Sourcepub async fn token_group_update_max_size<S: Signers>(
&self,
update_authority: &Pubkey,
new_max_size: u64,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn token_group_update_max_size<S: Signers>( &self, update_authority: &Pubkey, new_max_size: u64, signing_keypairs: &S, ) -> TokenResult<T::Output>
Update a token-group max size on a mint
Update the token-group authority in a mint
Sourcepub async fn token_group_initialize_member<S: Signers>(
&self,
mint_authority: &Pubkey,
group_mint: &Pubkey,
group_update_authority: &Pubkey,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn token_group_initialize_member<S: Signers>( &self, mint_authority: &Pubkey, group_mint: &Pubkey, group_update_authority: &Pubkey, signing_keypairs: &S, ) -> TokenResult<T::Output>
Initialize a token-group member on a mint
Sourcepub async fn token_group_initialize_member_with_rent_transfer<S: Signers>(
&self,
payer: &Pubkey,
mint_authority: &Pubkey,
group_mint: &Pubkey,
group_update_authority: &Pubkey,
signing_keypairs: &S,
) -> TokenResult<T::Output>
pub async fn token_group_initialize_member_with_rent_transfer<S: Signers>( &self, payer: &Pubkey, mint_authority: &Pubkey, group_mint: &Pubkey, group_update_authority: &Pubkey, signing_keypairs: &S, ) -> TokenResult<T::Output>
Initialize a token-group member on a mint
Sourcepub async fn confidential_transfer_get_pending_balance(
&self,
account: &Pubkey,
elgamal_secret_key: &ElGamalSecretKey,
) -> TokenResult<u64>
pub async fn confidential_transfer_get_pending_balance( &self, account: &Pubkey, elgamal_secret_key: &ElGamalSecretKey, ) -> TokenResult<u64>
Get the pending balance for a confidential transfer account.
This decrypts and combines the low 16 bits and high 48 bits of the pending balance into a single u64 value.
Sourcepub async fn confidential_transfer_get_available_balance(
&self,
account: &Pubkey,
aes_key: &AeKey,
) -> TokenResult<u64>
pub async fn confidential_transfer_get_available_balance( &self, account: &Pubkey, aes_key: &AeKey, ) -> TokenResult<u64>
Get the available balance for a confidential transfer account.
This decrypts the decryptable available balance using the provided AES key.
Sourcepub async fn confidential_transfer_get_total_balance(
&self,
account: &Pubkey,
elgamal_secret_key: &ElGamalSecretKey,
aes_key: &AeKey,
) -> TokenResult<u64>
pub async fn confidential_transfer_get_total_balance( &self, account: &Pubkey, elgamal_secret_key: &ElGamalSecretKey, aes_key: &AeKey, ) -> TokenResult<u64>
Get the total balance (pending and available) for a confidential transfer account.
This combines both pending and available balances with overflow protection.
Sourcepub async fn confidential_transfer_has_pending_balance(
&self,
account: &Pubkey,
) -> TokenResult<bool>
pub async fn confidential_transfer_has_pending_balance( &self, account: &Pubkey, ) -> TokenResult<bool>
Check if a confidential transfer account has any pending balance.
This checks whether the pending_balance_credit_counter is greater than zero.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Token<T>
impl<T> !RefUnwindSafe for Token<T>
impl<T> !Send for Token<T>
impl<T> !Sync for Token<T>
impl<T> Unpin for Token<T>
impl<T> !UnwindSafe for Token<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more