Class: Solace::Instructions::SplToken::CloseAccountInstruction
- Inherits:
-
Object
- Object
- Solace::Instructions::SplToken::CloseAccountInstruction
- Defined in:
- lib/solace/instructions/spl_token/close_account_instruction.rb
Overview
Instruction builder for SPL Token Program CloseAccount.
The CloseAccount instruction closes a token account and transfers all remaining lamports to a destination account. The token account must have a balance of zero.
Instruction discriminator: 9
Accounts:
- writable
-
Token account to close
- writable
-
Destination account to receive lamports
- signer
-
Account authority
Constant Summary collapse
- INSTRUCTION_DISCRIMINATOR =
Instruction discriminator for CloseAccount
[9].freeze
Class Method Summary collapse
-
.build(account_index:, destination_index:, authority_index:, program_index:) ⇒ Solace::Instruction
Builds a CloseAccount instruction.
-
.data ⇒ Array
Builds the data for a CloseAccount instruction.
Class Method Details
.build(account_index:, destination_index:, authority_index:, program_index:) ⇒ Solace::Instruction
Builds a CloseAccount instruction
30 31 32 33 34 35 36 |
# File 'lib/solace/instructions/spl_token/close_account_instruction.rb', line 30 def self.build(account_index:, destination_index:, authority_index:, program_index:) Solace::Instruction.new.tap do |ix| ix.program_index = program_index ix.accounts = [account_index, destination_index, ] ix.data = data end end |
.data ⇒ Array
Builds the data for a CloseAccount instruction
The BufferLayout is:
- [Instruction Index (1 byte)]
44 45 46 |
# File 'lib/solace/instructions/spl_token/close_account_instruction.rb', line 44 def self.data INSTRUCTION_DISCRIMINATOR end |