#[non_exhaustive]pub struct MintInfo {
pub address: Address,
pub token_program: Address,
pub decimals: u8,
pub transfer_fee: Option<FeeSchedule>,
pub hook_program: Option<Address>,
pub hook: Option<HookState>,
}Expand description
A mint as the builders and route::trade take it.
Read the mint and the Clock in one call, then call load.
Fetch what missing names, insert it,
and repeat until missing is empty. Refresh it on a timer, like any
account: load it and fill it again. Do not insert new data for the mint
itself, because hook_program keeps the hook of the first read.
A builder quotes each transfer fee at the epoch of the read. Read the mint
again when the epoch changes, or call load_at with the
epoch the trade lands in.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.address: Address§token_program: Address§decimals: u8§transfer_fee: Option<FeeSchedule>None when the mint has no transfer fee.
hook_program: Option<Address>None when the mint has no transfer hook.
hook: Option<HookState>None when the mint has no transfer hook.
Implementations§
Source§impl MintInfo
impl MintInfo
Sourcepub fn load(
address: Address,
view: AccountView<'_>,
clock: AccountView<'_>,
) -> Result<Self, ProgramError>
pub fn load( address: Address, view: AccountView<'_>, clock: AccountView<'_>, ) -> Result<Self, ProgramError>
clock is the Clock sysvar, read with the mint.
Sourcepub fn load_at(
address: Address,
view: AccountView<'_>,
epoch: u64,
) -> Result<Self, ProgramError>
pub fn load_at( address: Address, view: AccountView<'_>, epoch: u64, ) -> Result<Self, ProgramError>
The mint read at epoch.
Fails with ProgramError::IncorrectProgramId if no token program owns
the mint, and with another error if its data is not an initialized
mint.
Sourcepub const fn plain(
address: Address,
token_program: Address,
decimals: u8,
) -> Self
pub const fn plain( address: Address, token_program: Address, decimals: u8, ) -> Self
A mint with no fee and no hook.
Sourcepub const fn launch(address: Address) -> Self
pub const fn launch(address: Address) -> Self
A mint that the launchpad or the DEX created: Token-2022,
TOKEN_DECIMALS, no fee, no hook.
Sourcepub fn validation_address(&self) -> Option<Address>
pub fn validation_address(&self) -> Option<Address>
The hook’s validation account, which holds its list. None when the
mint has no transfer hook.
Sourcepub fn missing(&self) -> Result<Vec<Address>, HookError>
pub fn missing(&self) -> Result<Vec<Address>, HookError>
The accounts to fetch next. Empty when the info is complete.
Sourcepub fn insert(&mut self, address: Address, account: Option<FetchedAccount>)
pub fn insert(&mut self, address: Address, account: Option<FetchedAccount>)
Records a fetched account: None for no account.