Class: Solace::SquadsSmartAccounts::Instructions::ExecuteSettingsTransactionInstruction

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

Overview

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

Applies the stored SettingsActions of an Approved proposal’s SettingsTransaction to the settings account. Takes no arguments — the actions are read from the stored transaction on-chain.

Accounts (in order):

0. settings      — writable, non-signer
1. signer        — readonly, signer (must have the Execute permission)
2. proposal      — writable, non-signer
3. transaction   — readonly, non-signer (the SettingsTransaction)
4. rentPayer     — writable, signer (funds any settings realloc)
5. systemProgram — readonly, non-signer (needed for realloc)
6. program       — readonly, non-signer (the Squads program itself)
Remaining accounts: SpendingLimit PDAs initialized/closed by
  AddSpendingLimit / RemoveSpendingLimit actions, in action order.

rentPayer and systemProgram are optional in the program, but this builder always includes them so a realloc-triggering action never fails.

Constant Summary collapse

DISCRIMINATOR =
[131, 210, 27, 88, 27, 204, 143, 189].freeze

Class Method Summary collapse

Class Method Details

.build(settings_index:, signer_index:, proposal_index:, transaction_index:, rent_payer_index:, system_program_index:, program_index:, spending_limit_indices: []) ⇒ Solace::Instruction

Builds a Instruction for executeSettingsTransaction.

Parameters:

  • settings_index (Integer)

    Account index of the settings account.

  • signer_index (Integer)

    Account index of the executing signer.

  • proposal_index (Integer)

    Account index of the proposal.

  • transaction_index (Integer)

    Account index of the SettingsTransaction PDA.

  • rent_payer_index (Integer)

    Account index of the rent payer.

  • system_program_index (Integer)

    Account index of systemProgram.

  • program_index (Integer)

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

  • spending_limit_indices (Array<Integer>) (defaults to: [])

    Account indices of SpendingLimit PDAs touched by the actions, in action order (default: []).

Returns:

  • (Solace::Instruction)


42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/solace/squads_smart_accounts/instructions/execute_settings_transaction_instruction.rb', line 42

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

    ix.data = data
  end
end

.dataArray<Integer>

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

Returns:

  • (Array<Integer>)

    Byte array of the encoded instruction data.



73
74
75
# File 'lib/solace/squads_smart_accounts/instructions/execute_settings_transaction_instruction.rb', line 73

def self.data
  DISCRIMINATOR
end