Class: Solace::SquadsSmartAccounts::Instructions::CloseSettingsTransactionInstruction

Inherits:
Object
  • Object
show all
Defined in:
lib/solace/squads_smart_accounts/instructions/close_settings_transaction_instruction.rb

Overview

Encodes the ‘closeSettingsTransaction` instruction for the Squads Smart Account program.

Closes a SettingsTransaction and its associated Proposal, refunding their rent. Closeable once the proposal is in a terminal state (Executed, Rejected, or Cancelled) or is stale. Takes no arguments and requires no smart-account signer — only the fee payer signs.

Accounts (in order):

0. settings                 — readonly, non-signer
1. proposal                 — writable, non-signer (closed; rent → proposalRentCollector)
2. transaction              — writable, non-signer (closed; rent → transactionRentCollector)
3. proposalRentCollector    — writable, non-signer (receives the proposal rent)
4. transactionRentCollector — writable, non-signer (must equal transaction.rent_collector)
5. systemProgram            — readonly, non-signer
6. program                  — readonly, non-signer (the Squads program itself)

Constant Summary collapse

DISCRIMINATOR =
[251, 112, 34, 108, 214, 13, 41, 116].freeze

Class Method Summary collapse

Class Method Details

.build(settings_index:, proposal_index:, transaction_index:, proposal_rent_collector_index:, transaction_rent_collector_index:, system_program_index:, program_index:) ⇒ Solace::Instruction

Builds a Instruction for closeSettingsTransaction.

Parameters:

  • settings_index (Integer)

    Account index of the settings account.

  • proposal_index (Integer)

    Account index of the proposal.

  • transaction_index (Integer)

    Account index of the SettingsTransaction PDA.

  • proposal_rent_collector_index (Integer)

    Account index of the proposal rent collector.

  • transaction_rent_collector_index (Integer)

    Account index of the transaction rent collector.

  • system_program_index (Integer)

    Account index of systemProgram.

  • program_index (Integer)

    Account index of the Squads program (the invoked program).

Returns:

  • (Solace::Instruction)


36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/solace/squads_smart_accounts/instructions/close_settings_transaction_instruction.rb', line 36

def self.build(
  settings_index:,
  proposal_index:,
  transaction_index:,
  proposal_rent_collector_index:,
  transaction_rent_collector_index:,
  system_program_index:,
  program_index:
)
  Solace::Instruction.new.tap do |ix|
    ix.program_index = program_index
    ix.accounts      = [
      settings_index,
      proposal_index,
      transaction_index,
      proposal_rent_collector_index,
      transaction_rent_collector_index,
      system_program_index,
      program_index
    ]

    ix.data = data
  end
end

.dataArray<Integer>

Encodes the instruction data — the discriminator only; closeSettingsTransaction takes no arguments.

Returns:

  • (Array<Integer>)

    Byte array of the encoded instruction data.



65
66
67
# File 'lib/solace/squads_smart_accounts/instructions/close_settings_transaction_instruction.rb', line 65

def self.data
  DISCRIMINATOR
end