Class: Solace::SquadsSmartAccounts::Instructions::ExecuteTransactionSyncInstruction
- Inherits:
-
Object
- Object
- Solace::SquadsSmartAccounts::Instructions::ExecuteTransactionSyncInstruction
- Defined in:
- lib/solace/squads_smart_accounts/instructions/execute_transaction_sync_instruction.rb
Overview
Encodes the ‘executeTransactionSync` instruction for the Squads Smart Account program.
Synchronously executes inner instructions signed by a smart account (vault) PDA, provided the transaction is co-signed by enough signers to reach the settings threshold. Skips the proposal/voting lifecycle entirely.
IDL accounts (in order):
0. settings — readonly, non-signer
1. program — readonly, non-signer
Remaining accounts (in exact order):
2. The first `num_signers` accounts must be the threshold signers.
3. All accounts referenced by the inner instructions. Inner instruction
indexes are relative to the FULL remaining-accounts list, signers
included (0 = the first signer).
Constant Summary collapse
- DISCRIMINATOR =
8-byte Anchor discriminator: SHA256(“global:execute_transaction_sync”)
[43, 102, 248, 89, 231, 97, 104, 134].freeze
Class Method Summary collapse
-
.build(account_index:, num_signers:, instructions:, settings_index:, program_index:, signer_indices:, remaining_account_indices:) ⇒ Solace::Instruction
Builds a Instruction for executeTransactionSync.
-
.data(account_index:, num_signers:, instructions:) ⇒ Array<Integer>
Encodes the ‘SyncTransactionArgs` struct in Borsh format.
Class Method Details
.build(account_index:, num_signers:, instructions:, settings_index:, program_index:, signer_indices:, remaining_account_indices:) ⇒ Solace::Instruction
Builds a Instruction for executeTransactionSync.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/solace/squads_smart_accounts/instructions/execute_transaction_sync_instruction.rb', line 36 def self.build( account_index:, num_signers:, instructions:, settings_index:, program_index:, signer_indices:, remaining_account_indices: ) Solace::Instruction.new.tap do |ix| ix.program_index = program_index ix.accounts = [ settings_index, program_index, *signer_indices, *remaining_account_indices ] ix.data = data( account_index:, num_signers:, instructions: ) end end |
.data(account_index:, num_signers:, instructions:) ⇒ Array<Integer>
Encodes the ‘SyncTransactionArgs` struct in Borsh format.
The inner instructions are double-wrapped: serialized as a SmallVec<u8, CompiledInstruction>, then embedded as a Borsh bytes field (u32 LE length prefix).
69 70 71 72 73 74 75 76 |
# File 'lib/solace/squads_smart_accounts/instructions/execute_transaction_sync_instruction.rb', line 69 def self.data(account_index:, num_signers:, instructions:) DISCRIMINATOR + [account_index] + [num_signers] + Solace::Utils::Codecs.encode_bytes( Solace::Utils::Codecs.encode_compiled_instructions(instructions) ) end |