Class: Solace::Composers::AssociatedTokenAccountProgramCreateIdempotentAccountComposer

Inherits:
AssociatedTokenAccountProgramCreateAccountComposer show all
Defined in:
lib/solace/composers/associated_token_account_program_create_idempotent_account_composer.rb

Overview

Composer for creating an associated token account program create account instruction with idempotency

This composer resolves and orders the required accounts for a ‘CreateIdempotentAssociatedTokenAccount` instruction, sets up their access permissions, and delegates construction to the appropriate instruction builder (`Instructions::AssociatedTokenAccount::CreateIdempotentAssociatedTokenAccountInstruction`).

Required accounts:

  • Funder: the account that will pay for fees and rent.

  • Owner: the account that will own the new ATA.

  • ATA: the address of the new ATA.

  • Mint: the mint address of the token.

  • **System Program**: the system program id.

  • **Token Program**: the token program id.

  • **Associated Token Account Program**: the associated token account program id.

rubocop:disable Layout

Examples:

Compose and build a create account instruction

composer = AssociatedTokenAccountProgramCreateAccountComposer.new(
  funder: funder_address,
  owner: owner_address,
  ata_address: ata_address,
  mint: mint_address
)

See Also:

Since:

  • 0.1.3

Instance Attribute Summary

Attributes inherited from Base

#account_context, #params

Instance Method Summary collapse

Methods inherited from AssociatedTokenAccountProgramCreateAccountComposer

#associated_token_account_program_id, #ata_address, #funder, #mint, #owner, #setup_accounts, #system_program_id, #token_program_id

Methods inherited from Base

#initialize, #setup_accounts

Constructor Details

This class inherits a constructor from Solace::Composers::Base

Instance Method Details

#build_instruction(account_context) ⇒ Solace::Instruction

Builds the instruction for the associated token account program create account instruction

Parameters:

Returns:

Since:

  • 0.1.3



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/solace/composers/associated_token_account_program_create_idempotent_account_composer.rb', line 37

def build_instruction()
  Instructions::AssociatedTokenAccount::CreateIdempotentAccountInstruction.build(
    funder_index: .index_of(funder),
    owner_index: .index_of(owner),
    mint_index: .index_of(mint),
    associated_token_account_index: .index_of(ata_address),
    system_program_index: .index_of(system_program_id),
    token_program_index: .index_of(token_program_id),
    program_index: .index_of()
  )
end