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
  • Example
  • Notes
  1. Typescript
  2. Instructions
  3. Controlled Multisig Instructions

Add spending limit

Add a spending limit via Config Authority

PreviousSet Rent CollectorNextRemove Spending Limit

Last updated 8 months ago

This instruction adds a spending limit at the discretion of the .

Example

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,
}),

Notes

Can only be used with a .

Controlled Multisig
Config Authority