Squads Protocol Side Track for Hyperdrive
Submit your project
  • Introduction
    • Hyperdrive Hackathon
    • What is Squads Protocol
    • Quickstart
  • Development
    • Overview
    • Instructions - Interact with the program
      • Create Multisig
      • Add Member
      • Add spending limit
      • Remove Spending Limit
      • Create Vault Transaction
      • Create Config Transaction
      • Create Proposal
      • Approve Transaction
      • Reject Proposal
      • Cancel Proposal
      • Execute Transaction
    • PDAs - Read data from the Program
      • Multisig Account Info
      • Transaction Account Info
      • Proposal Account Info
  • Reference
    • Accounts
    • Spending Limits
    • Time-locks
    • Permissions
    • SDKs
    • Transaction Builder
  • Squads CLI
    • Installation
    • Commands
  • Submissions
    • Submit your project
    • Get support
Powered by GitBook
On this page
  1. Development
  2. Instructions - Interact with the program

Create Vault Transaction

Typescript

import * as multisig from "@sqds/multisig";

// Cluster Connection
const connection = new Connection( < your rpc url > );

// Fee payer is the a signer that pays the transaction fees
const feePayer = Keypair.generate();

// Derive the multisig PDA
const multisigPda = multisig.getMultisigPda({
    // The createKey has to be a Public Key, see accounts reference for more info
    createKey,
})[0];

// Derive the PDA of the Squads Vault
const [vaultPda] = multisig.getVaultPda({
    multisigPda,
    index: 0,
});

const transactionIndex = 1n;

const transferInstruction = SystemProgram.transfer(
    // The transfer is being signed from the Squads Vault, that is why we use the VaultPda
    vaultPda,
    to.publicKey,
    1 * LAMPORTS_PER_SOL
);

// Here we are adding all the instructions that we want to be executed in our transaction
const testTransferMessage = new TransactionMessage({
    payerKey: vaultPda,
    recentBlockhash: (await connection.getLatestBlockhash()).blockhash,
    instructions: [transferInstruction],
});

await multisig.rpc.vaultTransactionCreate({
    connection,
    feePayer,
    multisigPda,
    transactionIndex,
    creator: feePayer.publicKey,
    vaultIndex: 0,
    ephemeralSigners: 0,
    transactionMessage: testTransferMessage,
});
PreviousRemove Spending LimitNextCreate Config Transaction

Last updated 1 year ago