pub struct TokenMetadataClient {
pub program_id: Pubkey,
}Expand description
Thin client for building PDAs and instructions for the Arch Token Metadata program.
The program_id must be the deployed Arch Token Metadata program id.
Fields§
§program_id: PubkeyImplementations§
Source§impl TokenMetadataClient
impl TokenMetadataClient
pub fn new(program_id: Pubkey) -> Self
Sourcepub fn metadata_pda(&self, mint: &Pubkey) -> Pubkey
pub fn metadata_pda(&self, mint: &Pubkey) -> Pubkey
Derive the metadata PDA for a given mint.
Sourcepub fn metadata_pda_and_bump(&self, mint: &Pubkey) -> (Pubkey, u8)
pub fn metadata_pda_and_bump(&self, mint: &Pubkey) -> (Pubkey, u8)
Derive the metadata PDA for a given mint, with the bump.
Sourcepub fn attributes_pda(&self, mint: &Pubkey) -> Pubkey
pub fn attributes_pda(&self, mint: &Pubkey) -> Pubkey
Derive the attributes PDA for a given mint.
Sourcepub fn attributes_pda_and_bump(&self, mint: &Pubkey) -> (Pubkey, u8)
pub fn attributes_pda_and_bump(&self, mint: &Pubkey) -> (Pubkey, u8)
Derive the attributes PDA for a given mint, with the bump.
Sourcepub fn create_metadata_ix(
&self,
params: CreateMetadataParams,
) -> Result<Instruction>
pub fn create_metadata_ix( &self, params: CreateMetadataParams, ) -> Result<Instruction>
Build a CreateMetadata instruction.
Accounts (strict order):
- payer (writable, signer)
- system_program (readonly)
- mint (readonly)
- metadata_pda (writable)
- mint_or_freeze_authority (readonly, signer)
Sourcepub fn update_metadata_ix(
&self,
params: UpdateMetadataParams,
) -> Result<Instruction>
pub fn update_metadata_ix( &self, params: UpdateMetadataParams, ) -> Result<Instruction>
Build an UpdateMetadata instruction.
Accounts (strict order):
- metadata_pda (writable)
- update_authority (readonly, signer)
Sourcepub fn create_attributes_ix(
&self,
params: CreateAttributesParams,
) -> Result<Instruction>
pub fn create_attributes_ix( &self, params: CreateAttributesParams, ) -> Result<Instruction>
Build a CreateAttributes instruction.
Accounts (strict order):
- payer (writable, signer)
- system_program (readonly)
- mint (readonly)
- attributes_pda (writable)
- update_authority (readonly, signer)
- metadata_pda (readonly)
Sourcepub fn replace_attributes_ix(
&self,
params: ReplaceAttributesParams,
) -> Result<Instruction>
pub fn replace_attributes_ix( &self, params: ReplaceAttributesParams, ) -> Result<Instruction>
Build a ReplaceAttributes instruction.
Accounts (strict order):
- attributes_pda (writable)
- update_authority (readonly, signer)
- metadata_pda (readonly)
Build a TransferAuthority instruction.
Accounts (strict order):
- metadata_pda (writable)
- current_update_authority (readonly, signer)
Sourcepub fn make_immutable_ix(
&self,
params: MakeImmutableParams,
) -> Result<Instruction>
pub fn make_immutable_ix( &self, params: MakeImmutableParams, ) -> Result<Instruction>
Build a MakeImmutable instruction.
Accounts (strict order):
- metadata_pda (writable)
- current_update_authority (readonly, signer)
Sourcepub fn create_mint_account_ix(&self, payer: Pubkey, mint: Pubkey) -> Instruction
pub fn create_mint_account_ix(&self, payer: Pubkey, mint: Pubkey) -> Instruction
Build a SystemProgram create_account to allocate an APL Token mint account.
Sourcepub fn initialize_mint2_ix(
&self,
mint: Pubkey,
mint_authority: Pubkey,
freeze_authority: Option<Pubkey>,
decimals: u8,
) -> Result<Instruction>
pub fn initialize_mint2_ix( &self, mint: Pubkey, mint_authority: Pubkey, freeze_authority: Option<Pubkey>, decimals: u8, ) -> Result<Instruction>
Build an APL Token initialize_mint2 instruction.
Build an APL Token set_authority(MintTokens) instruction.
Sourcepub fn create_token_with_metadata_tx(
&self,
params: TxCreateTokenWithMetadataParams,
) -> Result<Vec<Instruction>>
pub fn create_token_with_metadata_tx( &self, params: TxCreateTokenWithMetadataParams, ) -> Result<Vec<Instruction>>
Create an APL Token mint and Arch Token Metadata in one sequence.
Returns a Vec
Sourcepub fn create_token_with_metadata_tx_with_budget(
&self,
params: TxCreateTokenWithMetadataParams,
budget: ComputeBudgetOptions,
) -> Result<Vec<Instruction>>
pub fn create_token_with_metadata_tx_with_budget( &self, params: TxCreateTokenWithMetadataParams, budget: ComputeBudgetOptions, ) -> Result<Vec<Instruction>>
Same as create_token_with_metadata_tx, but allows prepending compute-budget instructions.
Sourcepub fn create_token_with_metadata_and_attributes_tx(
&self,
params: TxCreateTokenWithMetadataAndAttributesParams,
) -> Result<Vec<Instruction>>
pub fn create_token_with_metadata_and_attributes_tx( &self, params: TxCreateTokenWithMetadataAndAttributesParams, ) -> Result<Vec<Instruction>>
Create mint, initialize, create metadata, and create attributes in one sequence. Returns: [create_mint, initialize_mint2, create_metadata, create_attributes].
Sourcepub fn create_token_with_metadata_and_attributes_tx_with_budget(
&self,
params: TxCreateTokenWithMetadataAndAttributesParams,
budget: ComputeBudgetOptions,
) -> Result<Vec<Instruction>>
pub fn create_token_with_metadata_and_attributes_tx_with_budget( &self, params: TxCreateTokenWithMetadataAndAttributesParams, budget: ComputeBudgetOptions, ) -> Result<Vec<Instruction>>
Same as create_token_with_metadata_and_attributes_tx, with compute-budget instructions.
Sourcepub fn create_token_with_freeze_auth_metadata_tx(
&self,
params: TxCreateTokenWithFreezeAuthMetadataParams,
) -> Result<Vec<Instruction>>
pub fn create_token_with_freeze_auth_metadata_tx( &self, params: TxCreateTokenWithFreezeAuthMetadataParams, ) -> Result<Vec<Instruction>>
Create metadata using freeze authority by clearing mint authority beforehand. Returns: [create_mint, initialize_mint2(with freeze), set_authority(MintTokens -> None), create_metadata]
Sourcepub fn create_token_with_freeze_auth_metadata_tx_with_budget(
&self,
params: TxCreateTokenWithFreezeAuthMetadataParams,
budget: ComputeBudgetOptions,
) -> Result<Vec<Instruction>>
pub fn create_token_with_freeze_auth_metadata_tx_with_budget( &self, params: TxCreateTokenWithFreezeAuthMetadataParams, budget: ComputeBudgetOptions, ) -> Result<Vec<Instruction>>
Same as create_token_with_freeze_auth_metadata_tx, with compute-budget instructions.
Sourcepub fn create_attributes_tx(
&self,
params: CreateAttributesParams,
) -> Result<Vec<Instruction>>
pub fn create_attributes_tx( &self, params: CreateAttributesParams, ) -> Result<Vec<Instruction>>
Convenience wrapper returning one-instruction Vec for create_attributes.
Sourcepub fn create_attributes_tx_with_budget(
&self,
params: CreateAttributesParams,
budget: ComputeBudgetOptions,
) -> Result<Vec<Instruction>>
pub fn create_attributes_tx_with_budget( &self, params: CreateAttributesParams, budget: ComputeBudgetOptions, ) -> Result<Vec<Instruction>>
create_attributes_tx with compute-budget instructions prepended.
Sourcepub fn replace_attributes_tx(
&self,
params: ReplaceAttributesParams,
) -> Result<Vec<Instruction>>
pub fn replace_attributes_tx( &self, params: ReplaceAttributesParams, ) -> Result<Vec<Instruction>>
Convenience wrapper returning one-instruction Vec for replace_attributes.
Sourcepub fn replace_attributes_tx_with_budget(
&self,
params: ReplaceAttributesParams,
budget: ComputeBudgetOptions,
) -> Result<Vec<Instruction>>
pub fn replace_attributes_tx_with_budget( &self, params: ReplaceAttributesParams, budget: ComputeBudgetOptions, ) -> Result<Vec<Instruction>>
replace_attributes_tx with compute-budget instructions prepended.
Transfer authority then immediately update metadata. Requires both current and new authorities to sign. Returns: [transfer_authority, update_metadata]
transfer_authority_then_update_tx with compute-budget instructions prepended.
Sourcepub fn make_immutable_tx(
&self,
params: MakeImmutableParams,
) -> Result<Vec<Instruction>>
pub fn make_immutable_tx( &self, params: MakeImmutableParams, ) -> Result<Vec<Instruction>>
Convenience wrapper returning one-instruction Vec for make_immutable.
Sourcepub fn make_immutable_tx_with_budget(
&self,
params: MakeImmutableParams,
budget: ComputeBudgetOptions,
) -> Result<Vec<Instruction>>
pub fn make_immutable_tx_with_budget( &self, params: MakeImmutableParams, budget: ComputeBudgetOptions, ) -> Result<Vec<Instruction>>
make_immutable_tx with compute-budget instructions prepended.
Sourcepub fn set_compute_unit_limit_ix(&self, units: u32) -> Instruction
pub fn set_compute_unit_limit_ix(&self, units: u32) -> Instruction
Compute budget: set a per-transaction compute unit limit.
Sourcepub fn request_heap_frame_ix(&self, bytes: u32) -> Instruction
pub fn request_heap_frame_ix(&self, bytes: u32) -> Instruction
Compute budget: request a specific heap frame size in bytes (multiple of 1024).