Squads Docs
Development
Development
  • Introduction
    • What is Squads Protocol
    • Use Cases
    • Quickstart
  • Typescript
    • Overview
    • Instructions
      • Create Multisig
      • Create Config Transaction
      • Create Vault Transaction
      • Create Proposal
      • Approve Proposal
      • Reject Proposal
      • Cancel Proposal
      • Execute Config Transaction
      • Execute Vault Transaction
      • Create Batch
      • Add To Batch
      • Close Vault Transaction Account
      • Controlled Multisig Instructions
        • Add Member
        • Remove Member
        • Set Rent Collector
        • Add spending limit
        • Remove Spending Limit
    • Accounts
      • Multisig
      • Vault
      • Transactions
      • Proposal
      • Batch
  • Reference
    • Accounts
    • Permissions
    • Spending Limits
    • Time-locks
    • SDKs
    • Controlled Multisigs
  • API
    • Vault Check
  • CLI
    • Installation
    • Commands
  • Get Support
    • We're here to help
  • Other
    • Migrating from MultisigCreate v1 to v2
    • Squads Actions and Blinks
Powered by GitBook
On this page
  • Understanding Vaults
  • Getting the Vault account
  • Notes:
  1. Typescript
  2. Accounts

Vault

Accounts that store assets, and sign for executed transactions

PreviousMultisigNextTransactions

Last updated 8 months ago

Vaults are the accounts that store assets and handle execution of . 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

Vault Transactions