This repository contains scripts for managing a Solana Native Token Transfer (NTT) program using the Squads multisig functionality.
By using these scripts, developers can:
- Transfer ownership of the NTT program to a multisig account, ensuring that changes require approval from multiple parties
- Set and manage rate limits for token transfers, helping to prevent overspending or unauthorized transfers
- Pause and unpause the NTT program to control token flow as needed
The project is organized as follows:
demo-ntt-solana-multisig-tools/
├── src/
│ ├── config/
│ │ ├── idl.json # Interface description for the NTT program
│ │ ├── keys.json # JSON file where the user inputs the wallet keypair array
│ ├── scripts/
│ │ ├── createSquad.ts # Script to create a new Squads multisig instance
│ │ ├── manageLimits.ts # Script to manage NTT parameters (rate limits, pause)
│ │ ├── transferOwnership.ts # Transfers ownership to Squads vault on Devnet
│ │ ├── transferOwnershipMainnet.ts # Transfers ownership on Mainnet with Squads UI support
├── .env # Environment file for storing the NTT manager program ID
├── .gitignore # Specifies files/folders to ignore in version control
├── package.json # Project dependencies and scripts
├── tsconfig.json # TypeScript configuration
├── README.md # Project overview and setup instructions
Ensure the following dependencies are installed and configured:
- Node.js with TypeScript
- Solana web3.js
- Anchor framework
- Squads SDK (@sqds/multisig)
- Wormhole NTT SDK
- Solana CLI
- Clone the Repository:
git clone https://github.com/wormhole-foundation/demo-ntt-solana-multisig-tools.git
cd demo-ntt-solana-multisig-tools- Install Dependencies:
npm install-
Configure Script Presets:
transferOwnership.tsandtransferOwnershipMainnet.ts: Update thetokenConfigobject with:ntt_manager: Your NTT Manager Program IDmultisig_account: Your Squads multisig accountsquads_vault_pda: Your Squads vault PDA (only for mainnet script)send_txn: Set tofalsefor dry runs,trueto execute transactions
createSquad.ts: UpdatewalletPath,membersorthresholdmanageLimits.ts: UpdatewalletPath, NTT manager program ID, rate limits, chain selection or pause status
-
Configure Your Wallet Keypair:
- Ensure that you have a funded wallet on the Solana Devnet. The keypair should be stored in the
src/config/keys.jsonfile - Update the wallet path in each script to point to this JSON file
- Ensure that you have a funded wallet on the Solana Devnet. The keypair should be stored in the
This script creates a new Squads multisig instance on Solana's Devnet. Sets up member permissions and threshold requirements.
Configurable Values:
walletPath: Path to your wallet keypair JSON filemembers: List of multisig members with their permissionsthreshold: Number of votes required to approve transactions
Run the script using the following command:
npm run create-squadNote: The script generates a
multisig-info.jsonfile containing the public keys of the Squads multisig instance
Handles the transfer of NTT program ownership to a Squads vault on Devnet.
Key Features:
- Transfers ownership to a temporary account
- Creates and executes a transaction proposal through Squads
- Claims ownership using the Squads vault
Configurable Variables:
RPC_ENDPOINT: RPC endpoint configuration that can be changed to a custom RPC endpoint if needed.tokenConfig.ntt_manager: Your NTT Manager Program ID on devnettokenConfig.send_txn: Set tofalsefor dry runs,trueto execute transactionstokenOwnerWalletPath: Path to your wallet keypair JSON file
Run the script using the following command:
npm run transfer-ownershipHandles the transfer of NTT program ownership to a Squads vault on mainnet in addition to the Squads UI.
Configurable Variables:
RPC_ENDPOINT: RPC endpoint configuration for mainnet that ideally should use a custom RPC endpoint for Solana mainnet.tokenConfig.ntt_manager: Your NTT Manager Program ID on mainnettokenConfig.multisig_account: Your Squads multisig account addresstokenConfig.squads_vault_pda: Your Squads vault PDA (found in Squads UI Settings)tokenConfig.send_txn: Set tofalsefor dry runs,trueto execute transactions
Note: This script only moves ownership to a temporary account. The actual ownership transfer to the Squads vault must be completed manually through the Squads UI by approving and executing the created proposal.
Run the script using the following command:
npm run transfer-ownership-mainnetManages NTT program parameters through Squads multisig.
Key Features:
- Sets inbound and outbound rate limits for token transfers
- Implements pause/unpause functionality
- Creates and executes Squads proposals for parameter changes
Configurable Values:
walletPath: Path to your wallet keypair JSON filenttManagerProgramId: Your NTT Manager Program IDoutbountLimit: Outbound transfer rate limit in token unitsinboundLimit: Inbound transfer rate limit in token unitschain: Target chain for inbound limits (currently 'Sepolia')paused: Whether the contract is pausedinstructions: Which instruction to execute (currently outboundLimitInstruction)RPC_ENDPOINT: RPC endpoint configuration (defaults to devnet)
Run the script using the following command:
npm run manage-limits