Class: Solace::SquadsSmartAccounts::Instructions::ExecuteSettingsTransactionSyncInstruction
- Inherits:
-
Object
- Object
- Solace::SquadsSmartAccounts::Instructions::ExecuteSettingsTransactionSyncInstruction
- Defined in:
- lib/solace/squads_smart_accounts/instructions/execute_settings_transaction_sync_instruction.rb
Overview
Encodes the ‘executeSettingsTransactionSync` instruction for the Squads Smart Account program.
Synchronously applies a batch of SettingsActions to an autonomous smart account, provided the transaction is co-signed by enough signers to reach the settings threshold. The program rejects controlled accounts (NotSupportedForControlled) — those use the *AsAuthority instructions.
IDL accounts (in order):
0. settings — writable, non-signer
1. rentPayer — writable, signer (pays for settings realloc)
2. systemProgram — readonly, non-signer
3. program — readonly, non-signer
Remaining accounts (in exact order):
4. The first `num_signers` accounts must be the threshold co-signers.
5. SpendingLimit PDAs initialized/closed by AddSpendingLimit and
RemoveSpendingLimit actions follow, in action order.
Constant Summary collapse
- DISCRIMINATOR =
8-byte Anchor discriminator: SHA256(“global:execute_settings_transaction_sync”)
[138, 209, 64, 163, 79, 67, 233, 76].freeze
Class Method Summary collapse
-
.build(num_signers:, actions:, memo:, settings_index:, rent_payer_index:, system_program_index:, program_index:, signer_indices:, spending_limit_indices: []) ⇒ Solace::Instruction
Builds a Instruction for executeSettingsTransactionSync.
-
.data(num_signers:, actions:, memo:) ⇒ Array<Integer>
Encodes the ‘SyncSettingsTransactionArgs` struct in Borsh format.
Class Method Details
.build(num_signers:, actions:, memo:, settings_index:, rent_payer_index:, system_program_index:, program_index:, signer_indices:, spending_limit_indices: []) ⇒ Solace::Instruction
Builds a Instruction for executeSettingsTransactionSync.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/solace/squads_smart_accounts/instructions/execute_settings_transaction_sync_instruction.rb', line 40 def self.build( num_signers:, actions:, memo:, settings_index:, rent_payer_index:, system_program_index:, program_index:, signer_indices:, spending_limit_indices: [] ) Solace::Instruction.new.tap do |ix| ix.program_index = program_index ix.accounts = [ settings_index, rent_payer_index, system_program_index, program_index, *signer_indices, *spending_limit_indices ] ix.data = data(num_signers:, actions:, memo:) end end |
.data(num_signers:, actions:, memo:) ⇒ Array<Integer>
Encodes the ‘SyncSettingsTransactionArgs` struct in Borsh format.
69 70 71 72 73 74 |
# File 'lib/solace/squads_smart_accounts/instructions/execute_settings_transaction_sync_instruction.rb', line 69 def self.data(num_signers:, actions:, memo:) DISCRIMINATOR + [num_signers] + Solace::Utils::Codecs.encode_settings_actions(actions) + Solace::Utils::Codecs.encode_option_string(memo) end |