#key-pair #multisig #transaction #public-key #action #execute #account

app squads-multisig-cli

Command line interface to interact with the Squads v4 program

3 releases

0.1.3 Feb 27, 2024
0.1.2 Feb 26, 2024
0.1.0 Jan 27, 2024

#278 in Magic Beans

Download history 4/week @ 2024-02-16 250/week @ 2024-02-23 40/week @ 2024-03-01 11/week @ 2024-03-08 4/week @ 2024-03-15 29/week @ 2024-03-22 33/week @ 2024-03-29 2/week @ 2024-04-05

69 downloads per month

MIT/Apache

74KB
1.5K SLoC

Squads V4 CLI

The following is an overview of commands available to interact with the Squads V4 program via CLI.

Overview

  1. Installation
  2. Supported wallets
  3. Commands

1. Installation

You can install the CLI with Cargo. For this an installation of Rust will be needed. You can find installation steps here.

Now, install the Squads CLI.

cargo install squads-multisig-cli

2. Supported wallets

The Squads CLI has exactly the same wallet support as the Solana CLI, meaning it supports file system wallets as well as Ledger hardware wallets.

File system wallets

You can easily use your local filesystem wallet by using it as the "keypair" argument in commands.

squads-multisig-cli example-command --keypair /path/to/keypair.json

This specifies the path of the Keypair that you want to use to sign a CLI transaction.

Ledger support

To use a Ledger with the Squads CLI, just specify the Ledger device URL in the "keypair" argument.

squads-multisig-cli example-command --keypair usb://ledger

This will use the default derivation path of your Ledger.

squads-multisig-cli example-command --keypair usb://ledger/BsNsvfXqQTtJnagwFWdBS7FBXgnsK8VZ5CmuznN85swK?key=0/0

This specifies a custom derivation path. You can read more about it here.

3. Commands

Config Transaction Create

Description

Creates a new configuration proposal transaction for a specific action.

Syntax

config_transaction_create --rpc_url <RPC_URL> --program_id <PROGRAM_ID> --keypair <KEYPAIR_PATH> --multisig_pubkey <MULTISIG_PUBLIC_KEY> --action <ACTION> [--memo <MEMO>]

Parameters

  • --rpc_url <RPC_URL>: (Optional) The URL of the Solana RPC endpoint. Defaults to mainnet if not specified.
  • --program_id <PROGRAM_ID>: (Optional) The ID of the multisig program. Defaults to a standard ID if not specified.
  • --keypair <KEYPAIR_PATH>: Path to your keypair file.
  • --multisig_pubkey <MULTISIG_PUBLIC_KEY>: The public key of the multisig account.
  • --action <ACTION>: The action to execute. Format depends on the action type.
  • --memo <MEMO>: (Optional) A memo for the transaction.

Examples

  1. Add a New Member:

    config_transaction_create --keypair /path/to/keypair.json --multisig_pubkey <MULTISIG_PUBLIC_KEY> --action "AddMember <NEW_MEMBER_PUBLIC_KEY> <PERMISSIONS>"
    

    Adds a new member to the multisig configuration with specified permissions. Permissions: 1: Initiate only 7: All permissions (Initiate, Approve, Execute)

  2. Remove a Member:

    config_transaction_create --keypair /path/to/keypair.json --multisig_pubkey <MULTISIG_PUBLIC_KEY> --action "RemoveMember <MEMBER_PUBLIC_KEY>"
    

    Removes an existing member from the multisig configuration.

  3. Change Threshold:

    config_transaction_create --keypair /path/to/keypair.json --multisig_pubkey <MULTISIG_PUBLIC_KEY> --action "ChangeThreshold <NEW_THRESHOLD>"
    

    Changes the threshold number of signatures required for executing multisig transactions.

  4. Set Time Lock:

    config_transaction_create --keypair /path/to/keypair.json --multisig_pubkey <MULTISIG_PUBLIC_KEY> --action "SetTimeLock <TIME_LOCK_VALUE>"
    

    Sets a time lock for the multisig account.

  5. Add Spending Limit:

    config_transaction_create --keypair /path/to/keypair.json --multisig_pubkey <MULTISIG_PUBLIC_KEY> --action "AddSpendingLimit <CREATE_KEY> <VAULT_INDEX> <MINT> <AMOUNT> <PERIOD> <MEMBERS> <DESTINATIONS>"
    

    Adds a spending limit to the multisig account.

  6. Remove Spending Limit:

    config_transaction_create --keypair /path/to/keypair.json --multisig_pubkey <MULTISIG_PUBLIC_KEY> --action "RemoveSpendingLimit <SPENDING_LIMIT_PUBKEY>"
    

    Removes an existing spending limit from the multisig account.

  7. Set Rent Collector:

    config_transaction_create --keypair /path/to/keypair.json --multisig_pubkey <MULTISIG_PUBLIC_KEY> --action "SetRentCollector <NEW_RENT_COLLECTOR_PUBKEY>"
    

    Sets a new rent collector for the multisig account.

Config Transaction Execute

Description

Executes a proposed transaction for a multisig configuration change. This command is used to execute configuration transactions once they have reached threshold.

Syntax

config_transaction_execute --rpc_url <RPC_URL> --program_id <PROGRAM_ID> --keypair <KEYPAIR_PATH> --multisig_pubkey <MULTISIG_PUBLIC_KEY> --transaction_index <TRANSACTION_INDEX>

Parameters

  • --rpc_url <RPC_URL>: (Optional) The URL of the Solana RPC endpoint. Defaults to mainnet if not specified.
  • --program_id <PROGRAM_ID>: (Optional) The ID of the multisig program. Defaults to a standard ID if not specified.
  • --keypair <KEYPAIR_PATH>: Path to your keypair file.
  • --multisig_pubkey <MULTISIG_PUBLIC_KEY>: The public key of the multisig account.
  • --transaction_index <TRANSACTION_INDEX>: The index of the transaction to be executed.

Example Usage

config_transaction_execute --keypair /path/to/keypair.json --multisig_pubkey <MULTISIG_PUBLIC_KEY> --transaction_index 1

Multisig Create

Description

Creates a new multisig with initial members and threshold configuration.

Syntax

multisig_create --rpc_url <RPC_URL> --program_id <PROGRAM_ID> --keypair <KEYPAIR_PATH> --config_authority <CONFIG_AUTHORITY> --members <MEMBER_1> <MEMBER_2> ... --threshold <THRESHOLD>

Parameters

  • --rpc_url <RPC_URL>: (Optional) The URL of the Solana RPC endpoint. Defaults to mainnet if not specified.
  • --program_id <PROGRAM_ID>: (Optional) The ID of the multisig program. Defaults to a standard ID if not specified.
  • --keypair <KEYPAIR_PATH>: Path to your keypair file.
  • --config_authority <CONFIG_AUTHORITY>: (Optional) Address of the Program Config Authority.
  • --members <MEMBER_...>: List of members' public keys, separated by spaces.
  • --threshold <THRESHOLD>: The threshold number of signatures required for executing multisig transactions.
  • --rent_collector <RENT_COLLECTOR> : The Public key that will be able to reclaim rent from canceled and executed transactions.

Example Usage

  1. Creating a Multisig with Two Members:

    multisig_create --keypair /path/to/keypair.json --members "Member1PubKey,Permission1" "Member2PubKey,Permission2" --threshold 2
    

    Creates a new multisig account with two members and a threshold of 2.

  2. Creating a Multisig with Config Authority:

    multisig_create --keypair /path/to/keypair.json --config_authority <CONFIG_AUTHORITY_PUBKEY> --members "Member1PubKey,Permission1" "Member2PubKey,Permission2" --threshold 1
    

    Initializes a multisig account with a specified config authority and a threshold of 1.

  3. Creating a Multisig with Rent Collector:

    multisig_create --keypair /path/to/keypair.json --config_authority <RENT_COLLECTOR_PUBKEY> --members "Member1PubKey,Permission1" "Member2PubKey,Permission2" --threshold 1
    

    Initializes a multisig account with a specified rent collector and a threshold of 1.

Proposal Vote

Description

Casts a vote on a proposed transaction proposal. This command allows a member of a multisig to approve, reject, or cancel a transaction proposal.

Syntax

proposal_vote --rpc_url <RPC_URL> --program_id <PROGRAM_ID> --keypair <KEYPAIR_PATH> --multisig_pubkey <MULTISIG_PUBLIC_KEY> --transaction_index <TRANSACTION_INDEX> --action <ACTION> [--memo <MEMO>]

Parameters

  • --rpc_url <RPC_URL>: (Optional) The URL of the Solana RPC endpoint. Defaults to mainnet if not specified.
  • --program_id <PROGRAM_ID>: (Optional) The ID of the multisig program. Defaults to a standard ID if not specified.
  • --keypair <KEYPAIR_PATH>: Path to your keypair file.
  • --multisig_pubkey <MULTISIG_PUBLIC_KEY>: The public key of the multisig account.
  • --transaction_index <TRANSACTION_INDEX>: The index of the transaction to vote on.
  • --action <ACTION>: The vote action to cast (Approve, Reject, Cancel).
  • --memo <MEMO>: (Optional) A memo for the vote.

Example Usage

  1. Approving a Transaction:

    proposal_vote --keypair /path/to/keypair.json --multisig_pubkey <MULTISIG_PUBLIC_KEY> --transaction_index 1 --action Approve
    

    Casts an approval vote for the transaction at index 1 in the specified multisig account.

  2. Rejecting a Transaction:

    proposal_vote --keypair /path/to/keypair.json --multisig_pubkey <MULTISIG_PUBLIC_KEY> --transaction_index 1 --action Reject
    

    Casts a rejection vote for the transaction at index 1.

  3. Cancelling a Transaction:

    proposal_vote --keypair /path/to/keypair.json --multisig_pubkey <MULTISIG_PUBLIC_KEY> --transaction_index 1 --action Cancel
    

    Cancels the transaction at index 1 in the multisig account.

Vault Transaction Accounts Close

Description

Closes the proposal and transaction accounts associated with a specific Vault Transaction. The rent will be returned to the multisigs "rent_collector".

Syntax

vault_transaction_accounts_close --rpc_url <RPC_URL> --program_id <PROGRAM_ID> --keypair <KEYPAIR_PATH> --multisig_pubkey <MULTISIG_PUBLIC_KEY> --transaction_index <TRANSACTION_INDEX> --rent_collector <RENT_COLLECTOR_PUBKEY>

Parameters

  • --rpc_url <RPC_URL>: (Optional) The URL of the Solana RPC endpoint. Defaults to mainnet if not specified.
  • --program_id <PROGRAM_ID>: (Optional) The ID of the multisig program. Defaults to a standard ID if not specified.
  • --keypair <KEYPAIR_PATH>: Path to your keypair file.
  • --multisig_pubkey <MULTISIG_PUBLIC_KEY>: The public key of the multisig account.
  • --transaction_index <TRANSACTION_INDEX>: The index of the transaction whose accounts are to be closed.
  • --rent_collector <RENT_COLLECTOR_PUBKEY>: The public key of the account responsible for collecting rent.

Example Usage

vault_transaction_accounts_close --keypair /path/to/keypair.json --multisig_pubkey <MULTISIG_PUBLIC_KEY> --transaction_index 1 --rent_collector <RENT_COLLECTOR_PUBKEY>

In this example, the command closes the transaction accounts for the transaction at index 1 in the specified multisig account and collects rent using the provided rent collector public key.

Vault Transaction Create

Description

Creates a new vault transaction with a custom transaction message.

Syntax

vault_transaction_create --rpc_url <RPC_URL> --program_id <PROGRAM_ID> --keypair <KEYPAIR_PATH> --multisig_pubkey <MULTISIG_PUBLIC_KEY> --vault_index <VAULT_INDEX> --transaction_message <TRANSACTION_MESSAGE> [--memo <MEMO>]

Parameters

  • --rpc_url <RPC_URL>: (Optional) The URL of the Solana RPC endpoint. Defaults to mainnet if not specified.
  • --program_id <PROGRAM_ID>: (Optional) The ID of the multisig program. Defaults to a standard ID if not specified.
  • --keypair <KEYPAIR_PATH>: Path to your keypair file.
  • --multisig_pubkey <MULTISIG_PUBLIC_KEY>: The public key of the multisig account.
  • --vault_index <VAULT_INDEX>: The index of the vault where the transaction is being created.
  • --transaction_message <TRANSACTION_MESSAGE>: The message or payload of the transaction.
  • --memo <MEMO>: (Optional) A memo for the transaction.

Example Usage

vault_transaction_create --keypair /path/to/keypair.json --multisig_pubkey <MULTISIG_PUBLIC_KEY> --vault_index 1 --transaction_message [1, 2, 3, 5, 5, 6, 7, 8]

In this example, a new transaction with the specified message is proposed in the multisig vault at vault index 1.

Vault Transaction Execute

Description

Executes a transaction once its proposal has reachen threshold.

Syntax

vault_transaction_execute --rpc_url <RPC_URL> --program_id <PROGRAM_ID> --keypair <KEYPAIR_PATH> --multisig_pubkey <MULTISIG_PUBLIC_KEY> --transaction_index <TRANSACTION_INDEX>

Parameters

  • --rpc_url <RPC_URL>: (Optional) The URL of the Solana RPC endpoint. Defaults to mainnet if not specified.
  • --program_id <PROGRAM_ID>: (Optional) The ID of the multisig program. Defaults to a standard ID if not specified.
  • --keypair <KEYPAIR_PATH>: Path to your keypair file.
  • --multisig_pubkey <MULTISIG_PUBLIC_KEY>: The public key of the multisig account.
  • --transaction_index <TRANSACTION_INDEX>: The index of the transaction to be executed.

Example Usage

vault_transaction_execute --keypair /path/to/keypair.json --multisig_pubkey <MULTISIG_PUBLIC_KEY> --transaction_index 1

This example executes the transaction at index 1 in the specified multisig.

Dependencies

~78MB
~1.5M SLoC