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

Add spending limit

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];

const spendingLimitCreateKey = Keypair.generate().publicKey;

const spendingLimitPda = multisig.getSpendingLimitPda({
    multisigPda
    createKey: spendingLimitCreateKey,
})[0];

multisig.rpc.multisigAddSpendingLimit({
    connection,
    feePayer,
    // The multisig account Public Key
    multisigPda,
    // The spending limit account Public Key
    spendingLimit: spendingLimitPda,
    createKey: spendingLimitCreateKey,
    // Rent payer for state
    rentPayer: feePayer,
    // Spending limit amount
    amount: BigInt(1000000000),
    configAuthority: null,
    // Spending limit will apply daily, see reference for more info
    period: multisig.generated.Period.Day,
    // The mint of the token to apply the spending limit on
    mint: Keypair.generate().publicKey,
    destinations: [Keypair.generate().publicKey],
    // null means it will apply to all members, make it an array of Public Keys to specify certain members
    members: null,
    vaultIndex: 1,
}),
PreviousAdd MemberNextRemove Spending Limit

Last updated 1 year ago