#[repr(u8)]
pub enum TransferFeeInstruction {
InitializeTransferFeeConfig {
transfer_fee_config_authority: COption<Pubkey>,
withdraw_withheld_authority: COption<Pubkey>,
transfer_fee_basis_points: u16,
maximum_fee: u64,
},
TransferCheckedWithFee {
amount: u64,
decimals: u8,
fee: u64,
},
WithdrawWithheldTokensFromMint,
WithdrawWithheldTokensFromAccounts {
num_token_accounts: u8,
},
HarvestWithheldTokensToMint,
SetTransferFee {
transfer_fee_basis_points: u16,
maximum_fee: u64,
},
}
Expand description
Transfer Fee extension instructions
Variants
InitializeTransferFeeConfig
Fields
Pubkey that may update the fees
Withdraw instructions must be signed by this key
transfer_fee_basis_points: u16
Amount of transfer collected as fees, expressed as basis points of the transfer amount
maximum_fee: u64
Maximum fee assessed on transfers
Initialize the transfer fee on a new mint.
Fails if the mint has already been initialized, so must be called before
InitializeMint
.
The mint must have exactly enough space allocated for the base mint (82 bytes), plus 83 bytes of padding, 1 byte reserved for the account type, then space required for this extension, plus any others.
Accounts expected by this instruction:
[writable]
The mint to initialize.
TransferCheckedWithFee
Fields
amount: u64
The amount of tokens to transfer.
decimals: u8
Expected number of base 10 digits to the right of the decimal place.
fee: u64
Expected fee assessed on this transfer, calculated off-chain based on the transfer_fee_basis_points and maximum_fee of the mint.
Transfer, providing expected mint information and fees
Accounts expected by this instruction:
- Single owner/delegate
[writable]
The source account. Must include theTransferFeeAmount
extension.[]
The token mint. Must include theTransferFeeConfig
extension.[writable]
The destination account. Must include theTransferFeeAmount
extension.[signer]
The source account’s owner/delegate.
- Multisignature owner/delegate
[writable]
The source account.[]
The token mint.[writable]
The destination account.[]
The source account’s multisignature owner/delegate.- ..4+M
[signer]
M signer accounts.
WithdrawWithheldTokensFromMint
Transfer all withheld tokens in the mint to an account. Signed by the mint’s withdraw withheld tokens authority.
Accounts expected by this instruction:
- Single owner/delegate
[writable]
The token mint. Must include theTransferFeeConfig
extension.[writable]
The fee receiver account. Must include theTransferFeeAmount
extension associated with the provided mint.[signer]
The mint’swithdraw_withheld_authority
.
- Multisignature owner/delegate
[writable]
The token mint.[writable]
The destination account.[]
The mint’s multisigwithdraw_withheld_authority
.- ..3+M
[signer]
M signer accounts.
WithdrawWithheldTokensFromAccounts
Fields
num_token_accounts: u8
Number of token accounts harvested
Transfer all withheld tokens to an account. Signed by the mint’s withdraw withheld tokens authority.
Accounts expected by this instruction:
- Single owner/delegate
[]
The token mint. Must include theTransferFeeConfig
extension.[writable]
The fee receiver account. Must include theTransferFeeAmount
extension and be associated with the provided mint.[signer]
The mint’swithdraw_withheld_authority
.- ..3+N
[writable]
The source accounts to withdraw from.
- Multisignature owner/delegate
[]
The token mint.[writable]
The destination account.[]
The mint’s multisigwithdraw_withheld_authority
.- ..3+M
[signer]
M signer accounts. 3+M+1. ..3+M+N[writable]
The source accounts to withdraw from.
HarvestWithheldTokensToMint
Permissionless instruction to transfer all withheld tokens to the mint.
Succeeds for frozen accounts.
Accounts provided should include the TransferFeeAmount
extension. If not,
the account is skipped.
Accounts expected by this instruction:
[writable]
The mint.- ..1+N
[writable]
The source accounts to harvest from.
SetTransferFee
Fields
transfer_fee_basis_points: u16
Amount of transfer collected as fees, expressed as basis points of the transfer amount
maximum_fee: u64
Maximum fee assessed on transfers
Set transfer fee. Only supported for mints that include the TransferFeeConfig
extension.
Accounts expected by this instruction:
- Single authority
[writable]
The mint.[signer]
The mint’s fee account owner.
- Multisignature authority
[writable]
The mint.[]
The mint’s multisignature fee account owner.- ..2+M
[signer]
M signer accounts.
Implementations
Trait Implementations
sourceimpl Clone for TransferFeeInstruction
impl Clone for TransferFeeInstruction
sourcefn clone(&self) -> TransferFeeInstruction
fn clone(&self) -> TransferFeeInstruction
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for TransferFeeInstruction
impl Debug for TransferFeeInstruction
sourceimpl PartialEq<TransferFeeInstruction> for TransferFeeInstruction
impl PartialEq<TransferFeeInstruction> for TransferFeeInstruction
sourcefn eq(&self, other: &TransferFeeInstruction) -> bool
fn eq(&self, other: &TransferFeeInstruction) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &TransferFeeInstruction) -> bool
fn ne(&self, other: &TransferFeeInstruction) -> bool
This method tests for !=
.
impl Copy for TransferFeeInstruction
impl StructuralPartialEq for TransferFeeInstruction
Auto Trait Implementations
impl RefUnwindSafe for TransferFeeInstruction
impl Send for TransferFeeInstruction
impl Sync for TransferFeeInstruction
impl Unpin for TransferFeeInstruction
impl UnwindSafe for TransferFeeInstruction
Blanket Implementations
impl<T> AbiExample for T
impl<T> AbiExample for T
default fn example() -> T
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more