A command-line interface tool for managing Streamflow staking pools, rewards pools, and governors on Solana.
This project requires Node.js version 20. You can install it using:
# Install nvm if you don't have it
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
# Restart your terminal or run:
source ~/.bashrc
# Install and use Node.js 20
nvm install 20
nvm use 20Download and install Node.js 20 from nodejs.org
brew install node@20node --version
# Should output: v20.x.x# Install dependencies
npm install
# Build the project
npm run build
# Make the CLI script executable
chmod +x cli.shThe recommended way to run the CLI is using the shell script, which automatically detects whether to use TypeScript (development) or JavaScript (production):
./cli.sh <command> [options]Alternative methods:
- Direct TypeScript execution:
npx tsx src/index.ts <command> [options] - Direct JavaScript execution:
node dist/index.js <command> [options]
-u, --url <url>: Solana cluster URL (default: https://api.devnet.solana.com)-k, --keypair <path>: Filepath of a keypair or base58 encoded private key (default: ~/.config/solana/id.json)
./cli.sh create-stake-pool -m <mint-address> [options]Options:
-n, --nonce <number>: Nonce for PDA derivation (default: 0)--max-weight <number>: Maximum weight multiplier in basis points (default: 4000000000 for 4x)--min-duration <number>: Minimum staking duration in seconds (default: 0)--max-duration <number>: Maximum staking duration in seconds (default: 31536000)-p, --permissionless: Allow anyone to create reward pools (default: false)-f, --freeze: Freeze token accounts (default: true)--unstake-period <number>: Period required for unstaking in seconds (default: null)--token-22: Use token 2022 program (default: false)
./cli.sh set-token-metadata -p <pool-address> -n <name> -s <symbol> -m <metadata-uri> [--token-22]./cli.sh create-governor -p <pool-address> [-n <nonce>]./cli.sh add-proposal -g <governor-address> -t <text> -o <options> [options]Options:
-n, --nonce <number>: Nonce for PDA derivation (default: 0)-s, --start <number>: Voting start unix timestamp, 0 for now (default: 0)-e, --end <number>: Voting end unix timestamp, 0 for endless (default: 0)
./cli.sh activate-proposal -p <proposal-address>./cli.sh create-reward-pool -s <stake-pool-address> -m <mint-address> [options]Options:
-n, --nonce <number>: Nonce for PDA derivation (default: 0)-p, --permissionless: Allow anyone to create entries (default: false)-g, --governor <address>: Governor to be used for claiming and voting--claim-period <number>: Period between reward claims in seconds (default: 3600)--claim-start <number>: Unix timestamp when claims can start, 0 for current time (default: 0)--token-22: Use token 2022 program (default: false)
./cli.sh set-governor-for-reward-pool -r <reward-pool-address> -g <governor-address>./cli.sh fund-reward-pool -r <reward-pool-address> -a <amount> [--token-22]./cli.sh get-derived-addresses [options]Options:
--stake-pool <address>: Stake pool address-a, --authority <address>: Authority address (defaults to current wallet)-m, --mint <address>: Token mint address--reward-mint <address>: Reward mint address--reward-pool <address>: Reward pool address-g, --governor <address>: Governor address-p, --proposal <address>: Proposal address--stake-entry <address>: Stake entry address-n, --nonce <number>: Nonce for PDA derivation (default: 0)--stake-entry-nonce <number>: Nonce for stake entry PDA derivation (default: 0)--proposal-nonce <number>: Nonce for proposal PDA derivation (default: 0)
Create a new Address Lookup Table (ALT) and link it to a stake pool via an on-chain link (PDA) account. Optionally extend the ALT with provided addresses.
./cli.sh create-lookup-table -p <stake-pool-address> [options]Options:
-p, --stake-pool <address>: Stake pool address to link this ALT to. Required.-n, --nonce <number>: Unique nonce for the stake pool -> ALT link account (default: 0). Use a different nonce to create multiple links per pool.--recent-slot <number>: Recent slot to seed ALT creation. If omitted, the CLI fetches the current slot from the RPC.--authority <address>: Authority for the ALT (defaults to your wallet). Note: The CLI uses the configured wallet as payer and authority.--addresses <addresses...>: Space-separated list of addresses to add to the ALT immediately after creation. They will be added in chunks of up to 20 per transaction.
Notes:
- The command prints the "expected" ALT address before creation, derived from the provided or fetched recent slot, so you know the final ALT address ahead of time.
- Extending the ALT requires the ALT authority to sign. This CLI supports the common case where the payer and authority are the same (your wallet configured via
-k). - Addresses are extended in chunks of up to 20 per instruction due to Solana limits.
./cli.sh create-stake-pool -m 4NQJMooXchX5He3CTHC8usQYby7LQRX3eYmALzEBGQz5./cli.sh create-governor -p <stake-pool-address>./cli.sh create-reward-pool -s <stake-pool-address> -m <reward-mint-address>./cli.sh fund-reward-pool -r <reward-pool-address> -a <amount> -k <keypair-path> -u <rpc-url>./cli.sh get-derived-addresses -m <mint-address> -a <authority-address>./cli.sh transfer-stake-pool-authority -p <stake-pool-address> -n <new-authority-address> -k <keypair-path> -u <rpc-url>./cli.sh transfer-reward-pool-authority -p <reward-pool-address> -n <new-authority-address> -k <keypair-path> -u <rpc-url>./cli.sh transfer-fee-withdraw-authority -m <mint-address> -n <new-authority-address> -k <keypair-path> -u <rpc-url>A helper instruction that creates a Lookup Table and connects it to a specific stake pool (a PDA account that just stores stake pool -> ALT link).
./cli.sh create-lookup-table -p <stake-pool> --addresses ... -k <keypair-path> -u <rpc-url>ANCHOR_PROVIDER_URL: Solana cluster URLANCHOR_WALLET: Path to wallet keypair file
# Ensure you're using Node.js 20
nvm use 20
# Install dependencies
npm install
# Run in development mode
npm run dev
# Build for production
npm run build
# Run built version
npm start