Class: Solace::SquadsSmartAccounts::Instructions::ApproveProposalInstruction
- Inherits:
-
Object
- Object
- Solace::SquadsSmartAccounts::Instructions::ApproveProposalInstruction
- Defined in:
- lib/solace/squads_smart_accounts/instructions/approve_proposal_instruction.rb
Overview
Encodes the ‘approveProposal` instruction for the Squads Smart Account program.
Registers an approval vote on a proposal on behalf of a signer with the Vote permission. Once approvals reach the settings threshold the proposal becomes Approved and (after the time lock) its transaction can execute.
Accounts (in order):
0. settings — readonly, non-signer (consensus account)
1. signer — writable, signer (must have the Vote permission)
2. proposal — writable, non-signer
3. systemProgram — optional; absent here, so the Squads program id fills the slot
4. program — readonly, non-signer (the Squads program itself)
The trailing ‘program` account and the absent-optional-as-program-id slot follow the deployed program (see memory `reference-deployed-program-drift`).
Constant Summary collapse
- DISCRIMINATOR =
8-byte Anchor discriminator: SHA256(“global:approve_proposal”)
[136, 108, 102, 85, 98, 114, 7, 147].freeze
Class Method Summary collapse
-
.build(memo:, settings_index:, signer_index:, proposal_index:, system_program_index:, program_index:) ⇒ Solace::Instruction
Builds a Instruction for approveProposal.
-
.data(memo:) ⇒ Array<Integer>
Encodes the ‘VoteOnProposalArgs { memo: Option<String> }` in Borsh.
Class Method Details
.build(memo:, settings_index:, signer_index:, proposal_index:, system_program_index:, program_index:) ⇒ Solace::Instruction
Builds a Instruction for approveProposal.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/solace/squads_smart_accounts/instructions/approve_proposal_instruction.rb', line 34 def self.build( memo:, settings_index:, signer_index:, proposal_index:, system_program_index:, program_index: ) Solace::Instruction.new.tap do |ix| ix.program_index = program_index ix.accounts = [ settings_index, signer_index, proposal_index, system_program_index, program_index ] ix.data = data(memo:) end end |
.data(memo:) ⇒ Array<Integer>
Encodes the ‘VoteOnProposalArgs { memo: Option<String> }` in Borsh.
60 61 62 |
# File 'lib/solace/squads_smart_accounts/instructions/approve_proposal_instruction.rb', line 60 def self.data(memo:) DISCRIMINATOR + Solace::Utils::Codecs.encode_option_string(memo) end |