Class: Solace::SquadsSmartAccounts::Instructions::AddSignerAsAuthorityInstruction
- Inherits:
-
Object
- Object
- Solace::SquadsSmartAccounts::Instructions::AddSignerAsAuthorityInstruction
- Defined in:
- lib/solace/squads_smart_accounts/instructions/add_signer_as_authority_instruction.rb
Overview
Encodes the ‘addSignerAsAuthority` instruction for the Squads Smart Account program.
Adds a new signer (with a permission mask) to a controlled smart account. Only callable by the account’s settings authority — no consensus involved.
IDL accounts (in order):
0. settings — writable, non-signer
1. settingsAuthority — readonly, signer
2. rentPayer — writable, signer (pays for settings realloc)
3. systemProgram — readonly, non-signer
4. program — readonly, non-signer
Constant Summary collapse
- DISCRIMINATOR =
8-byte Anchor discriminator: SHA256(“global:add_signer_as_authority”)
[80, 198, 228, 154, 7, 234, 99, 56].freeze
Class Method Summary collapse
-
.build(new_signer:, memo:, settings_index:, settings_authority_index:, rent_payer_index:, system_program_index:, program_index:) ⇒ Solace::Instruction
Builds a Instruction for addSignerAsAuthority.
-
.data(new_signer:, memo:) ⇒ Array<Integer>
Encodes the ‘AddSignerArgs` struct in Borsh format.
Class Method Details
.build(new_signer:, memo:, settings_index:, settings_authority_index:, rent_payer_index:, system_program_index:, program_index:) ⇒ Solace::Instruction
Builds a Instruction for addSignerAsAuthority.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/solace/squads_smart_accounts/instructions/add_signer_as_authority_instruction.rb', line 31 def self.build( new_signer:, memo:, settings_index:, settings_authority_index:, rent_payer_index:, system_program_index:, program_index: ) Solace::Instruction.new.tap do |ix| ix.program_index = program_index ix.accounts = [ settings_index, , rent_payer_index, system_program_index, program_index ] ix.data = data(new_signer:, memo:) end end |
.data(new_signer:, memo:) ⇒ Array<Integer>
Encodes the ‘AddSignerArgs` struct in Borsh format.
The signer is a bare struct (32-byte pubkey + 1-byte permission mask), not a Vec — no length prefix.
60 61 62 63 64 65 |
# File 'lib/solace/squads_smart_accounts/instructions/add_signer_as_authority_instruction.rb', line 60 def self.data(new_signer:, memo:) DISCRIMINATOR + Solace::Utils::Codecs.encode_pubkey(new_signer.pubkey) + [new_signer.] + Solace::Utils::Codecs.encode_option_string(memo) end |