A TypeScript-powered tool for executing batch SPL token transfers on the Solana blockchain using the Squads Multisig SDK. This script helps simplify complex batch transactions for multisig wallets, leveraging the power of the Squads SDK to handle multisig proposals and batching, while mitigating issues such as Solana blockhash expiry.
- Batch Transfers: Automates SPL token transfers in batches, supporting efficient execution.
- Multisig Integration: Uses Squads Multisig SDK for secure and transparent multisig transactions.
- Address Lookup Tables (ALTs): Supports ALTs for handling large sets of instructions efficiently.
- Customizable Parameters: Configure multisig address, vault index, RPC URL, and CSV file paths for flexibility.
- Optimized for Solana: Mitigates blockhash expiry challenges through proper batching and retries.
- Node.js (v16 or higher)
- Yarn or npm for dependency management
- A Solana wallet keypair in JSON format
- A valid RPC endpoint (e.g., Squads-provided endpoint or Solana mainnet)
- Proposer Permission: The wallet keypair must belong to a member of the target multisig (Squad) with the "Proposer" permission. Without this, the script will not be able to create transactions.
-
Clone this repository:
git clone https://github.com/squads-software/squads-batch-transfer.git cd squads-batch-transfer
-
Install dependencies:
yarn install
or
npm install
-
Make sure the TypeScript environment is set up:
yarn add typescript ts-node @types/node --dev
The script accepts the following CLI arguments:
Argument | Description | Required |
---|---|---|
--msAddress |
Multisig wallet address | ✅ |
--walletKeypairPath |
Path to the Solana wallet keypair JSON file | ✅ |
--rpcUrl |
RPC endpoint for the Solana blockchain | ❌ (default: https://api.mainnet-beta.solana.com ) |
--csvFilePath |
Path to the CSV file containing transfer data | ✅ |
--vaultIndex |
Vault Index for batching transactions | ❌ (default: 0 ) |
The CSV file should be structured as follows:
Column | Description |
---|---|
token_address |
SPL token mint address |
receiver |
Recipient wallet address |
amount |
Number of tokens to transfer |
Example (transfers.csv
):
token_address,receiver,amount
So11111111111111111111111111111111111111112,FoobarAddress1,100
So11111111111111111111111111111111111111112,FoobarAddress2,50
To execute the script, run:
yarn start -- --msAddress <MULTISIG_ADDRESS> --walletKeypairPath /path/to/keypair.json --rpcUrl https://your.rpc.endpoint --csvFilePath /path/to/transfers.csv --vaultIndex <VAULT_INDEX>
Example:
yarn start -- --msAddress 2ruoY9FridQjcxxmgzQWnTx6U9sBxoMkB3EU1UBg4PtK --walletKeypairPath ~/.config/solana/id.json --csvFilePath ./transfers.csv --vaultIndex 0
- Parses the CSV file to generate transfer instructions.
- Validates token accounts and handles token account creation if necessary.
- Batches transactions and submits them to the blockchain using Squads' Multisig SDK.
- Provides transaction signatures and confirmation statuses.
To compile the TypeScript code:
yarn build
To execute the TypeScript code without compiling:
yarn start
squads-batch-transfer/
├── main.ts # Main script
├── tsconfig.json # TypeScript configuration
├── package.json # Project dependencies and scripts
├── yarn.lock # Dependency lock file
├── README.md # Documentation
├── node_modules/ # Installed dependencies
Squads is the most advanced multisig platform for Solana, enabling on-chain collaboration and secure, flexible management of funds and programs. Visit Squads.so for more information.
This project is licensed under the MIT License.
This script is provided "as-is" and is intended for advanced users. Please use caution when handling private keys and interacting with on-chain resources.