Create Config Transaction

Change global config on your multisig

Config Transactions are a little more complicated than the other ones, as there are multiple configuration arguments that you can supply to such a transaction.

Here are list of action types you can execute with Config Transactions, and their arguments:

  • AddMember

    • new_member (Member): Key & corresponding permissions for the member you want to add.

  • RemoveMember

    • old_member (PublicKey): Key of the member that you want to remove

  • ChangeThreshold

    • new_threshold (number): New approval threshold that you want to enforce

  • SetTimeLock

    • new_time_lock (number): Change the time_lock of the multisig.

  • AddSpendingLimit

    • create_key (PublicKey): Key that is used to seed the SpendingLimit PDA.

    • vault_index (number): The index of the vault that the spending limit is for.

    • mint (PublicKey): The token mint the spending limit is for.

    • amount (number): The amount of tokens that can be spent in a period. This is respective of the mint's decimals. (i.e USDC has 6 decimals, so 1 USDC would be 1_000_000)

    • members (PublicKey[]): Members of the multisig that can use the spending limit. In case a member is removed from the multisig, the spending limit will remain existent, but unusable until deleted.

    • destinations (PublicKey[]): The destination addresses the spending limit is allowed to sent funds to. If empty, funds can be sent to any address.

  • RemoveSpendingLimit

    • spending_limit (Pubkey): Account for the spending limit you want to remove.

  • SetRentCollector

    • new_rent_collector (PublicKey | null): Set the rent_collector config parameter of the multisig.

Example (Change Threshold)

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

async function main(member: PublicKey) {
    // Cluster Connection
    // Required argument if you use the .rpc method
    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>");
    
    // Derive the PDA of the Squads Vault
    const [vaultPda] = multisig.getVaultPda({
        multisigPda,
        index: 0,
    });
    
    // Get deserialized multisig account info
    const multisigInfo = await multisig.accounts.Multisig.fromAccountAddress(
      connection,
      multisigPda
    );

    // Get the updated transaction index
    const currentTransactionIndex = Number(multisigInfo.transactionIndex);
    const newTransactionIndex = BigInt(currentTransactionIndex + 1);
    
    // Create a config transaction, of type changeThreshold
    const ix = await multisig.instructions.configTransactionCreate({
        feePayer: member,
        multisigPda: controlledMultisigPda,
        // Replace with current index if needed
        transactionIndex: newTransactionIndex,
        // Member must have at least "Proposer" permissions
        creator: member,
        actions: [{
            // Type of action
            __kind: "ChangeThreshold",
            newThreshold: 3
        }],
    }),
}

Notes

  • This is instruction is used for changing config in most multisigs (ones with no configAuthority)

  • Exectuing certain config transactions will invalidate other Active transactions (both config and vault type). This behavior is present with AddMember, RemoveMember, ChangeThreshold, and SetTimeLock

  • Multiple actions can be specified between instructions

  • For more information, see the Config Transaction section and reference.

Last updated