Class: Solace::SquadsSmartAccounts::Instructions::RejectProposalInstruction
- Inherits:
-
Object
- Object
- Solace::SquadsSmartAccounts::Instructions::RejectProposalInstruction
- Defined in:
- lib/solace/squads_smart_accounts/instructions/reject_proposal_instruction.rb
Overview
Encodes the ‘rejectProposal` instruction for the Squads Smart Account program.
Registers a rejection vote on a proposal on behalf of a signer with the Vote permission. Once rejections reach the cutoff (threshold-relative) the proposal becomes Rejected and its transaction can never 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)
Shares the VoteOnProposal account context and args with approveProposal; only the discriminator differs.
Constant Summary collapse
- DISCRIMINATOR =
8-byte Anchor discriminator: SHA256(“global:reject_proposal”)
[114, 162, 164, 82, 191, 11, 102, 25].freeze
Class Method Summary collapse
-
.build(memo:, settings_index:, signer_index:, proposal_index:, system_program_index:, program_index:) ⇒ Solace::Instruction
Builds a Instruction for rejectProposal.
-
.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 rejectProposal.
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/reject_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/reject_proposal_instruction.rb', line 60 def self.data(memo:) DISCRIMINATOR + Solace::Utils::Codecs.encode_option_string(memo) end |