Class: Solace::Programs::SplToken

Inherits:
Base
  • Object
show all
Includes:
TokenProgramInterface
Defined in:
lib/solace/programs/spl_token.rb

Overview

Client for interacting with the legacy SPL Token Program.

This client provides methods for creating mints, minting tokens, and transferring tokens via the legacy SPL Token program (+TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA+). The shared method shape comes from TokenProgramInterface; this class supplies the SPL-bound composer classes.

Examples:

Create an SPL Token mint

# Initialize the program with a connection
program = Solace::Programs::SplToken.new(connection: connection)

# Create an SPL Token mint
result = program.create_mint(
  payer: payer,
  funder: funder,
  decimals: 6,
  mint_keypair: mint_keypair,
  mint_authority: mint_authority,
  freeze_authority: freeze_authority
)

# Wait for the transaction to be finalized
connection.wait_for_confirmed_signature('finalized') { result['result'] }

See Also:

Since:

  • 0.0.2

Instance Attribute Summary

Attributes inherited from Base

#connection, #program_id

Instance Method Summary collapse

Methods included from TokenProgramInterface

#compose_create_mint, #compose_mint_to, #compose_transfer, #compose_transfer_checked, #create_mint, #mint_to, #transfer, #transfer_checked

Constructor Details

#initialize(connection:) ⇒ SplToken

Initializes a new SPL Token client.

Parameters:

Since:

  • 0.0.2



38
39
40
# File 'lib/solace/programs/spl_token.rb', line 38

def initialize(connection:)
  super(connection: connection, program_id: Solace::Constants::TOKEN_PROGRAM_ID)
end