Cast an approval on a given transaction's proposal
Proposals require approvals equal to the threshold for the underlying transaction to be executed. Any qualifying member key with "Voter" permissions can cast an approval on proposal. Additionally, an approval will fail if the proposal is stale (Proposal transactionIndex < Multisig staleTransactionIndex).
Example
import*as multisig from"@sqds/multisig";import { Connection, PublicKey } from"@solana/web3.js"asyncfunctionmain(member:PublicKey) {// Cluster Connectionconstconnection=newConnection("<your rpc url>");// If you've saved your createKey, you can define it as a static PublicKeyconstcreateKey=newPublicKey("<your createkey>")// Derive the multisig PDAconst [multisigPda] =multisig.getMultisigPda({ createKey, });// or// const multisigPda = new PublicKey("<your multisig key>");// Get deserialized multisig account infoconstmultisigInfo=awaitmultisig.accounts.Multisig.fromAccountAddress( connection, multisigPda );// Get the current transaction indexconsttransactionIndex=Number(multisigInfo.transactionIndex);// or, if this is tied to your first transaction// const transactionIndex = 1n;constix=awaitmultisig.instructions.proposalApprove({ multisigPda, transactionIndex,// Member must have "Voter" permissions member: member, });}
Notes
Approving members must have "Voter" permissions
A Proposal can not be approved if the transaction index is less than the stale transaction index (see Multisig reference)