Skip to content

Approve a Proposal ​

Casts an approval vote on an Active proposal. Once approvals reach the settings threshold, the proposal becomes Approved and its transaction can be executed (after any time lock).

The signer must hold the Vote permission. A signer may switch a prior rejection to an approval — the program removes the opposing vote. See the async lifecycle.

Program method — approve_proposal ​

Signs with payer + signer, then sends.

ParameterTypeRequiredDefaultDescription
payerKeypairyes—Pays the fee; co-signs.
settings#to_syes—The settings account address.
signer#to_s · Keypairyes—A Vote-holding member; must sign.
transaction_indexIntegeryes—Index of the proposal's transaction.
memoStringnonilOptional indexing memo.

Plus the shared sign: / execute: controls and Solace::Transaction return — see Conventions.

ruby
program.approve_proposal(
  payer:             member,
  settings:          identity.settings_address,
  signer:            member,
  transaction_index: 1
)

Composer — SquadsSmartAccountsApproveProposalComposer ​

ParameterTypeRequiredDefaultDescription
settings#to_syes—The settings account address.
signer#to_s · Keypairyes—A Vote-holding member; must sign.
proposal#to_syes—The Proposal PDA to vote on.
memoStringnonilIndexing memo.
ruby
proposal, = program.get_proposal_address(
  settings_address:  identity.settings_address,
  transaction_index: 1
)

composer = Solace::Composers::SquadsSmartAccountsApproveProposalComposer.new(
  settings: identity.settings_address,
  signer:   member.address,
  proposal:
)

tx = Solace::TransactionComposer.new(connection:)
                                .add_instruction(composer)
                                .set_fee_payer(member)
                                .compose_transaction

tx.sign(member)
connection.send_transaction(tx.serialize)

Low-level instruction (advanced) ​

  • Discriminator: [136, 108, 102, 85, 98, 114, 7, 147]
  • Encodes (data): option_string(memo)
ParameterTypeRequiredDefaultDescription
memoString, nilyes—Indexing memo, or nil.
settings_indexIntegeryes—Index of the settings account.
signer_indexIntegeryes—Index of the voting signer.
proposal_indexIntegeryes—Index of the Proposal PDA.
system_program_indexIntegeryes—The optional systemProgram slot — fill with the program id when absent.
program_indexIntegeryes—Index of the Squads program.

systemProgram is optional for a vote and absent here, so its slot is filled with the Squads program id (Anchor's convention for an absent optional account).

Built on Solace