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 Multisig

Typescript

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

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

// Random Public Key that will be used to derive a multisig PDA
const createKey = Keypair.generate().publicKey;

// Creator should be a Keypair or a Wallet Adapter wallet
const creator = 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];


await multisig.rpc.multisigCreate({
    connection,
    // One time random Key
    createKey,
    // The creator & fee payer
    creator,
    // The PDA of the multisig you are creating, derived by a random PublicKey
    multisigPda,
    // Here the config authority will be the system program
    configAuthority: null,
    // Create without any time-lock
    timeLock: 0,
    // List of the members to add to the multisig
    members: [{
            // Members Public Key
            key: creator.publicKey,
            // Members permissions inside the multisig
            permissions: Permissions.all(),
        },
        {
            key: secondMember.publicKey,
            // Member can only add votes to proposed transactions
            permissions: Permissions.fromPermissions([Permission.Vote]),
        },
    ],
    // This means that there needs to be 2 votes for a transaction proposal to be approved
    threshold: 2,
});

console.log("Multisig created: ", signature);
PreviousInstructions - Interact with the programNextAdd Member

Last updated 1 year ago