TokenMetadataClient

Struct TokenMetadataClient 

Source
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: Pubkey

Implementations§

Source§

impl TokenMetadataClient

Source

pub fn new(program_id: Pubkey) -> Self

Source

pub fn metadata_pda(&self, mint: &Pubkey) -> Pubkey

Derive the metadata PDA for a given mint.

Source

pub fn metadata_pda_and_bump(&self, mint: &Pubkey) -> (Pubkey, u8)

Derive the metadata PDA for a given mint, with the bump.

Source

pub fn attributes_pda(&self, mint: &Pubkey) -> Pubkey

Derive the attributes PDA for a given mint.

Source

pub fn attributes_pda_and_bump(&self, mint: &Pubkey) -> (Pubkey, u8)

Derive the attributes PDA for a given mint, with the bump.

Source

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)
Source

pub fn update_metadata_ix( &self, params: UpdateMetadataParams, ) -> Result<Instruction>

Build an UpdateMetadata instruction.

Accounts (strict order):

  • metadata_pda (writable)
  • update_authority (readonly, signer)
Source

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)
Source

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)
Source

pub fn transfer_authority_ix( &self, params: TransferAuthorityParams, ) -> Result<Instruction>

Build a TransferAuthority instruction.

Accounts (strict order):

  • metadata_pda (writable)
  • current_update_authority (readonly, signer)
Source

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)
Source

pub fn create_mint_account_ix(&self, payer: Pubkey, mint: Pubkey) -> Instruction

Build a SystemProgram create_account to allocate an APL Token mint account.

Source

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.

Source

pub fn set_mint_authority_ix( &self, mint: Pubkey, new_authority: Option<Pubkey>, current_authority: Pubkey, ) -> Result<Instruction>

Build an APL Token set_authority(MintTokens) instruction.

Source

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 with: [create_mint, initialize_mint2, create_metadata].

Source

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.

Source

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].

Source

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.

Source

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]

Source

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.

Source

pub fn create_attributes_tx( &self, params: CreateAttributesParams, ) -> Result<Vec<Instruction>>

Convenience wrapper returning one-instruction Vec for create_attributes.

Source

pub fn create_attributes_tx_with_budget( &self, params: CreateAttributesParams, budget: ComputeBudgetOptions, ) -> Result<Vec<Instruction>>

create_attributes_tx with compute-budget instructions prepended.

Source

pub fn replace_attributes_tx( &self, params: ReplaceAttributesParams, ) -> Result<Vec<Instruction>>

Convenience wrapper returning one-instruction Vec for replace_attributes.

Source

pub fn replace_attributes_tx_with_budget( &self, params: ReplaceAttributesParams, budget: ComputeBudgetOptions, ) -> Result<Vec<Instruction>>

replace_attributes_tx with compute-budget instructions prepended.

Source

pub fn transfer_authority_then_update_tx( &self, params: TxTransferAuthorityThenUpdateParams, ) -> Result<Vec<Instruction>>

Transfer authority then immediately update metadata. Requires both current and new authorities to sign. Returns: [transfer_authority, update_metadata]

Source

pub fn transfer_authority_then_update_tx_with_budget( &self, params: TxTransferAuthorityThenUpdateParams, budget: ComputeBudgetOptions, ) -> Result<Vec<Instruction>>

transfer_authority_then_update_tx with compute-budget instructions prepended.

Source

pub fn make_immutable_tx( &self, params: MakeImmutableParams, ) -> Result<Vec<Instruction>>

Convenience wrapper returning one-instruction Vec for make_immutable.

Source

pub fn make_immutable_tx_with_budget( &self, params: MakeImmutableParams, budget: ComputeBudgetOptions, ) -> Result<Vec<Instruction>>

make_immutable_tx with compute-budget instructions prepended.

Source

pub fn set_compute_unit_limit_ix(&self, units: u32) -> Instruction

Compute budget: set a per-transaction compute unit limit.

Source

pub fn request_heap_frame_ix(&self, bytes: u32) -> Instruction

Compute budget: request a specific heap frame size in bytes (multiple of 1024).

Trait Implementations§

Source§

impl Default for TokenMetadataClient

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,