Class: Solace::SquadsSmartAccounts::Instructions::CreateSettingsTransactionInstruction
- Inherits:
-
Object
- Object
- Solace::SquadsSmartAccounts::Instructions::CreateSettingsTransactionInstruction
- Defined in:
- lib/solace/squads_smart_accounts/instructions/create_settings_transaction_instruction.rb
Overview
Encodes the ‘createSettingsTransaction` instruction for the Squads Smart Account program.
Stores a batch of SettingsActions on-chain as a SettingsTransaction, to be applied later by ‘executeSettingsTransaction` once its proposal is approved. Autonomous accounts only — controlled accounts use the *AsAuthority instructions.
Accounts (in order):
0. settings — writable, non-signer
1. transaction — writable, non-signer (SettingsTransaction PDA to create)
2. creator — readonly, signer (must be a signer with Initiate permission)
3. rentPayer — writable, signer (funds the new account's rent)
4. systemProgram — readonly, non-signer
5. program — readonly, non-signer (the Squads program itself)
The SettingsTransaction PDA shares the vault Transaction seeds [“smart_account”, settings, “transaction”, u64(index)]; only the stored account type differs.
Constant Summary collapse
- DISCRIMINATOR =
8-byte Anchor discriminator: SHA256(“global:create_settings_transaction”)
[101, 168, 254, 203, 222, 102, 95, 192].freeze
Class Method Summary collapse
-
.build(actions:, memo:, settings_index:, transaction_index:, creator_index:, rent_payer_index:, system_program_index:, program_index:) ⇒ Solace::Instruction
Builds a Instruction for createSettingsTransaction.
-
.data(actions:, memo:) ⇒ Array<Integer>
Encodes the ‘CreateSettingsTransactionArgs { actions, memo }` in Borsh.
Class Method Details
.build(actions:, memo:, settings_index:, transaction_index:, creator_index:, rent_payer_index:, system_program_index:, program_index:) ⇒ Solace::Instruction
Builds a Instruction for createSettingsTransaction.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/solace/squads_smart_accounts/instructions/create_settings_transaction_instruction.rb', line 40 def self.build( actions:, memo:, settings_index:, transaction_index:, creator_index:, rent_payer_index:, system_program_index:, program_index: ) Solace::Instruction.new.tap do |ix| ix.program_index = program_index ix.accounts = [ settings_index, transaction_index, creator_index, rent_payer_index, system_program_index, program_index ] ix.data = data(actions:, memo:) end end |
.data(actions:, memo:) ⇒ Array<Integer>
Encodes the ‘CreateSettingsTransactionArgs { actions, memo }` in Borsh.
70 71 72 73 74 |
# File 'lib/solace/squads_smart_accounts/instructions/create_settings_transaction_instruction.rb', line 70 def self.data(actions:, memo:) DISCRIMINATOR + Solace::Utils::Codecs.encode_settings_actions(actions) + Solace::Utils::Codecs.encode_option_string(memo) end |