A command-line tool to interact with Raydium AMM pools on the Solana blockchain. This application allows you to add or remove liquidity to a specified Raydium pool using your local Solana keypair.
- Add Liquidity: Deposit tokens into a Raydium pool to earn LP tokens.
- Remove Liquidity: Withdraw tokens from a Raydium pool by burning LP tokens.
-
Rust & Cargo:
Ensure that you have Rust and Cargo installed.
Visit: https://www.rust-lang.org/tools/install -
Solana CLI & SPL-Token CLI (Optional):
The Solana CLI helps manage your configuration and keys, while thespl-token
CLI assists in creating associated token accounts (ATAs).
Visit: https://docs.solana.com/cli/install-solana-cli-tools -
Funded Solana Keypair:
You must have a Solana keypair file (e.g.~/.config/solana/id.json
) funded with sufficient SOL and any required tokens.
Recommended: Create a dedicated keypair for programmatic operations and fund it from your Phantom wallet.
-
Clone the Repository:
git clone https://github.com/guilhermeyoshida/raydium_demo.git cd raydium_demo
-
Build the Project: cargo build
Once the build completes, the binary will be located in
target/debug
.
SOLANA_WALLET
(optional):
By default, the application uses~/.config/solana/id.json
as the keypair. To specify a custom keypair path:export SOLANA_WALLET=~/.config/solana/custom-id.json
- Solana Cluster:
Ensure the Solana CLI is configured for the correct network:solana config set --url https://api.mainnet-beta.solana.com
Display all available commands and flags: cargo run -- --help
-
Identify Pool Information:
Obtain the pool’sammId
,coinMint
,pcMint
, andlpMint
from Raydium’s official pool configuration data. -
Run the Command:
cargo run -- add AMM_ID AMOUNT
-
Check LP Balance:
Ensure your LP ATA holds LP tokens from the pool. -
Run the Command:
cargo run -- remove AMM_ID AMOUNT
-
InvalidProgramAddress
:
Ensure you are using the correct pool configuration data (lpMint
,coinMint
,pcMint
) and that your ATAs are valid and funded. -
Transaction simulation failed
:
Confirm that you have enough SOL and tokens in your ATAs, and verify that you’re on the correct network. Double-check the mint addresses.
- Keep your keypair and seed phrase private.
- Use dedicated wallets for programmatic operations to minimize risk.
This project is licensed under the MIT License.
For support, open an issue in the repository or contact the maintainers.