Handle consensus and enable execution for Transactions
Proposals are tied to transactions one-to-one, enabling consensus and subsequent execution. They use the transactionIndex for mapping, which means that the index you used to create a transaction will be used to create a proposal for it.
Example
import * as multisig from "@sqds/multisig";
import { Connection, PublicKey } from "@solana/web3.js"
async function main(member: PublicKey) {
// Cluster Connection
const connection = new Connection("<your rpc url>");
// If you've saved your createKey, you can define it as a static PublicKey
const createKey = new PublicKey("<your createkey>")
// Derive the multisig PDA
const [multisigPda] = multisig.getMultisigPda({
createKey,
});
// or
// const multisigPda = new PublicKey("<your multisig key>");
// Get deserialized multisig account info
const multisigInfo = await multisig.accounts.Multisig.fromAccountAddress(
connection,
multisigPda
);
// Get the current transaction index
const transactionIndex = Number(multisigInfo.transactionIndex);
// or, if this is tied to your first transaction
// const transactionIndex = 1n;
const ix = await multisig.instructions.proposalCreate({
multisigPda,
transactionIndex,
// Must have "Voter" permissions at minimum
creator: member,
});
}
Notes
Proposal accounts must be created to successfully vote and execute vault transactions