Vault

Accounts that store assets, and sign for executed transactions

Vaults are the accounts that store assets and handle execution of Vault Transactions. They function differently from any other account associated with Squads, not holding any data directly.

Understanding Vaults

Vaults are derived via a vaultIndex, which allows you select a specific vault by chronological number. Using this index will allow the SDK, and associated instructions to get the correct vault to target.

When you lookup a newly derived vault address on an explorer, it will show as an uninitialized account. This is because Solana requires any initialized account to have a non-zero SOL balance. Because of this, the account is never "created" by any instruction, only marked initialized as the user adds SOL.

When you create a new wallet with something like Phantom, that key will initially show as "uninitialized" on an explorer until you deposit funds. Same principle with Vaults!

Getting the Vault account

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

const { Multisig } = multisig.accounts;

async function main() {
    // One-time keypair, used for derivation 
    const createKey = Keypair.generate();

    const [multisigPda] = multisig.getMultisigPda({
        createKey.publicKey,
    });
    
    const [vaultPda] = multisig.getVaultPda({
        multisigPda,
        index: 0
    });
   
    console.log(vaultPda);
}

Notes:

  • Vault accounts hold assets, and handle the execution of Vault Transactions

  • Vaults hold no data, and are derived via an index

  • They are not "created" via any instruction, and will appear as "uninitialized" on an explorer until SOL is deposited

Last updated