Module: Solace::Instructions

Defined in:
lib/solace/instructions/system_program/create_account_instruction.rb,
lib/solace/instructions/spl_token/mint_to_instruction.rb,
lib/solace/instructions/spl_token/transfer_instruction.rb,
lib/solace/instructions/spl_token/close_account_instruction.rb,
lib/solace/instructions/system_program/transfer_instruction.rb,
lib/solace/instructions/spl_token/initialize_mint_instruction.rb,
lib/solace/instructions/spl_token/transfer_checked_instruction.rb,
lib/solace/instructions/spl_token/initialize_account_instruction.rb,
lib/solace/instructions/associated_token_account/create_account_instruction.rb,
lib/solace/instructions/associated_token_account/create_idempotent_account_instruction.rb

Overview

The Instructions module contains low-level instruction builders for Solana programs.

Instructions are the fundamental building blocks of Solana transactions. Each instruction represents a single operation to be executed by an on-chain program. The classes in this module build the binary instruction data and specify the accounts required for each operation.

Instructions are organized by program:

Being a low-level primitive, you must build instructions manually.

Examples:

Building a system transfer instruction


# Assuming the transaction's accounts are ordered as follows:
accounts = %w[from_address to_address system_program_id]

# Build the instruction by specifying the account indices directly
instruction = Solace::Instructions::SystemProgram::TransferInstruction.build(
  from_index: 0,
  to_index: 1,
  program_index: 2,
  lamports: 1_000_000
)

See Also:

Since:

  • 0.0.1

Defined Under Namespace

Modules: AssociatedTokenAccount, SplToken, SystemProgram