Transactions

Accounts that store different types of transactions

Transactions are split into two types, each with their own execution instructions and parameters. Both types are subject to consensus. The two types are:

Both types of transactions are bound to a transaction index, which denotes where the transaction is in the continuity of the multisig. This index is also used to derivation. Because of this, you can use the method below to derive the address of either account type:

Getting a Transaction address

import * as multisig from "@sqds/multisig";
import { PublicKey } from "@solana/web3.js";

async function main() {
    // Public Key of the Multisig PDA
    const multisigPda = new PublicKey("<my multisig>");
    
    // Fetch the deserialized Multisig account
    const multisigInfo = await multisig.accounts.Multisig.fromAccountAddress(
      connection,
      multisigPda
    );

    // Get the current transaction index
    const currentTransactionIndex = Number(multisigInfo.transactionIndex);
    const transactionIndex = BigInt(currentTransactionIndex + 1);
    // or, if this is your first transaction
    // const transactionIndex = 1n;
    
    // Can be either a VaultTransaction or ConfigTransaction
    const [transactionPda] = multisig.getTransactionPda({
        multisigPda,
        index: transactionIndex,
    });
}

Vault Transactions

This transaction type is by far the most common. Most actions you conduct via your multisig will be Vault Transactions. These take a Transaction Message containing a number of arbitrary instructions, and saves them in an account for voting and execution.

See Create Vault Transaction for more information about how to create this account.

Fetch Vault Transaction Info

// Fetch the deserialized account
let transactionAccount = 
    await multisig.accounts.VaultTransaction.fromAccountAddress(
        connection,
        transactionPda
    );
      
// Log the Vault Transaction structure
console.log("Transaction: ", transactionAccount);

Config Transactions

Less common, but equally important is the config transaction, which is used to manage configurations (spending limits, members, time-locks, etc...) on your Multisig. These consist of a set of predefined actions that any given transaction can take, with some invalidating all previous transactions on execution.

See Create Config Transaction for more information about how to create this account.

Fetch Config Transaction Info

// Fetch the deserialized account
const configTransactionAccount =
        await multisig.accounts.ConfigTransaction.fromAccountAddress(
                connection, 
                transactionPda
        );
        
// Log the Config Transaction structure
console.log("Config Transaction: ", configTransactionAccount);

Notes

  • Two types of transactions: Vault Transactions, and Config Transactions

  • They require a proposal account to be voted on, and subsequently executed

  • See their reference for more information on account structure and seeds.

Last updated