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
  1. Reference

Permissions

Limit members to certain interactions

Permissions allow you to limit what actions specific members can take in your Squad. This is particularly useful when you want to assign different roles or responsibilities to different members. For example, you might want some members to only be able to vote on proposals, while others can initiate and execute transactions.

By assigning specific permissions, you can create a more secure and flexible Squads setup. For instance, you could have:

  • Proposers: Members who can initiate transactions

  • Voters: Members who can vote on proposals

  • Executors: Members who can execute transactions

  • Almighty: Members with full permissions to manage all aspects of the multisig (this is all of the above assigned to one member)

With the SDK, we provide a Permissions enum, that abstracts any of the complexities related to assigning permissions. Here's an example of how this is used with multisigCreate:

import * as multisig from "@sqds/multisig";
import { Connection, Keypair } from "@solana/web3.js";

// Enums
// "Permission" gives single permissions to aggregate in any combination
// "Permissions" provides a method for almighty, and method to aggregate other permissions
const { Permission, Permissions } = multisig.types;

async function main() {
    /*
    See Instructions -> Create Multisig for full snippet
    */
    
    const ix = await multisig.instructions.multisigCreateV2({
        createKey: createKey.publicKey,
        creator: creator.publicKey,
        multisigPda,
        configAuthority: null,
        timeLock: 0,
        members: [{
                key: creator.publicKey,
                // Granted Proposer, Voter, and Executor permissions
                permissions: Permissions.all(),
            },
            {
                key: secondMember.publicKey,
                // Member can only add votes to proposed transactions
                permissions: Permissions.fromPermissions([Permission.Vote]),
            },
        ],
        threshold: 2,
        rentCollector: null
    });
}

Permission Mappings

Permissions in the program are just mappings of u8 values. Stacking permissions for a single member requires adding up the combination of the permission mappings. Each permission maps to the following value:

  • Proposer - 1

  • Voter - 2

  • Executor - 4

  • Almighty (combination of all) - 7

This is only required to be understood if you are using the CLI, or interacting with the program without using the SDK.

PreviousAccountsNextSpending Limits

Last updated 8 months ago