Reclaim rent from a stale, cancelled, or executed Vault Transaction
This instruction will reclaim rent from a Vault Transaction account, and close the account. This requires the transaction to be stale (transactionIndex < staleTransactionIndex), the corresponding proposal to be Cancelled, or the transaction itself be Executed.
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.vaultTransactionAccountsClose({
multisigPda,
// This value should be the current rent collector Public Key of the Multisig.
rentCollector: vaultPda,
transactionIndex,
multisig.programId,
});
}
Notes
Vault Transactions can be reclaimed when they are stale (transactionIndex < staleTransactionIndex), or of status Cancelled or Executed.
Reclaimed rent will be returned to the set rent collector on the Multisig account.