https://github.com/leonyx007/solana-trading-cli
A command-line interface (CLI) trading bot for executing token swaps on the Solana blockchain, powered by the Jupiter Aggregator and other on-chain DEX routes.
https://github.com/leonyx007/solana-trading-cli
jupiter raydium-swap solana spl-token trading
Last synced: 3 months ago
JSON representation
A command-line interface (CLI) trading bot for executing token swaps on the Solana blockchain, powered by the Jupiter Aggregator and other on-chain DEX routes.
- Host: GitHub
- URL: https://github.com/leonyx007/solana-trading-cli
- Owner: leonyx007
- License: mit
- Created: 2025-04-27T12:04:43.000Z (about 1 year ago)
- Default Branch: typescript-main
- Last Pushed: 2025-04-27T15:19:45.000Z (about 1 year ago)
- Last Synced: 2026-02-24T23:40:38.716Z (4 months ago)
- Topics: jupiter, raydium-swap, solana, spl-token, trading
- Language: TypeScript
- Homepage:
- Size: 29.9 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[πdoc](https://outsmartchad.github.io/solana-trading-cli/)
## Main Features
- Trading any token using Jupiter API & Raydium swap function
- Create your own Solana **_SPL tokens_** on mainnet | Pump.fun
- Swap tokens on Raydium, Orca, Meteora, and pump.fun
- land transactions faster using Jito/bloXroute
- Fetch the real-time price, lp-burn percentage, pool reserve and market cap of any liquidity pool
- fixed % tp/sl module
- First Open-Source gRPC pump.fun sniper bot (0.4-2 seconds latency) [here](https://github.com/outsmartchad/solana-trading-cli/tree/typescript-main/src/grpc_streaming_dev/grpc-pf-sniper)
- First Open-Source gRPC copy bot [here](https://github.com/outsmartchad/solana-trading-cli/tree/typescript-main/src/grpc_streaming_dev/grpc-copy-bot)
- Open-source gRPC Raydium sniper bot [here](https://github.com/outsmartchad/solana-trading-cli/tree/typescript-main/src/grpc_streaming_dev/grpc-raydium-sniper)
- **_Got everything needed to create your own trading bot_**
## Credits
- https://github.com/raydium-io/raydium-sdk-V2
- https://github.com/rckprtr/pumpdotfun-sdk
- https://github.com/Al366io/solana-transactions-wrapper
### Installation π οΈ
1. `git clone https://github.com/outsmartchad/solana-trading-cli.git`
2. `cd solana-trading-cli`
3. `nvm install`
4. `nvm use`
5. `npm install`
6. `ts-node test.ts` (**Remember to run this to test all the cli script**)
### Prerequisites π¨
0. we have added a .env.copy file in src/helpers/.env.copy for you to follow and paste your keys to the code (specify the custom jito fee if you need).
1. Add your mainnet wallet secret key(must), devnet wallet secret key (optional), RPC endpoint(must) and shyft api key(optional)
2. rename the .env.copy file to .env
## Features β
:
### Developer CLI:
- Check the balance of a token in your wallet
- wrap/unwrap solana
- Create a new SPL token or zk-compressed token (on SOL mainnet/devnet/zk-devnet) and it will automatically mint to your wallet
- Integrates both **jito tips, bloXroute fee** that land transactions faster
- boost volume of a token by creating buy and sell orders in just **one transaction**
- **Add or Remove liquidity** to a pool
- Swap tokens in a **raydium, orca, meteora dex's AMM pool**
- Swap tokens using JUP Swap API
- **Buy, Sell, and launch token in pump.fun**
- monitor real-time pump-fun's create, trade, and complete bonding curve events
### Trader CLI:
- ws copy bot with auto-buy&sell
- geyser **grpc Pump.fun sniper bot** with 0.4-2 seconds latency
- geyser **grpc Copy bot** to copy trades from a target wallet address
- easy-to-use tp/sl module
## Features in Development π§:
- With user-defined Jito tips and priority Lamports supported for every command
- sniping tools on raydium using yellowstone geyser grpc
- **More Strategies** for Trading dev
- more features to come...
# Commands > (Please see the command examples in examples/ to get start~)
### payer options is by default use the private key in .env file, but you can also specify the path to the secret key if you want to use another wallet
1. Specify the token symbol, name, mint keypair(optional, will help u to generate), supply, decimals, path to metadata json file, path to image file, the cluster you want to use, and the file type(png, jpg, jpeg).
```sh
ts-node create --payer --symbol --token_name --mint --supply --decimals --metadata --image --cluster --priority-fee --file_type
```
2. Specify the token address, the percentage of the token you want to burn and the cluster you want to use.
```sh
ts-node burn --payer --token_address --percentage --cluster
```
3. Specify the token address and the cluster you want to use.
```sh
ts-node revoke_authority --payer --mint_address --cluster --mint --freeze
```
4. Specify the token address you want to query and the cluster for boosting the volume of the token.
```sh
ts-node boost_volume --token_address --payer --cluster --sol_per_order
```
5. Specify the token address, the amount of Sol you want to swap, and the cluster you want to use.
```sh
ts-node buy --payer --token_address --sol --cluster
```
6. Specify the token address, the percentage of the token you want to sell, and the cluster you want to use.
```sh
ts-node sell --payer --token_address --percentage --cluster
```
7. Specify the token address, the pool id(optional, will help to find the pool with the most liquidity using the given token address), the amount of Sol you want to add, and the cluster you want to use.
```sh
ts-node add_pool --payer --token_address --pool_id --sol --cluster --priority_fee
```
8. Specify the token address, the percentage of the LP token you want to remove(1=1%), and the cluster you want to use.
```sh
ts-node remove_pool --payer --token_address --percentage --cluster
```
9. wrap your sol to wsol.
```sh
ts-node wrap_sol.js --size
```
10. unwrap your wsol to sol.
```sh
ts-node unwrap_sol.js
```
### Pump.fun commands
9. Specify the path to your mint keypair, the amount of Sol you want to buy, the name of the token, the symbol of the token, the description of the token, the telegram link, the twitter link, the website link, and the image file path.
```sh
ts-node createAndBuy --pathToMintKeypair --sol --name --symbol --description --telegram --twitter --website --file
```
10. Specify the token address, the sol you want to buy
```sh
ts-node buy --token_address --sol
```
11. Specify the token address, the percentage of the token you want to sell
```sh
ts-node sell --token_address --percentage
```
# Code Usage >
## Token:
- src/Token/create.js: create a spl token on devnet or mainnet with a given name, symbol, token image(using irys decentralized storage), metadata json file, supply, decimals, the code by default revokes the mint authority and freeze authority after creating the token so that the token has a cap and no one can feeze the token of the token holder, it will then mint all the token to your wallet
- src/Token/burn.js: burn spl token with a given percentage of the token from your wallet
- src/Token/revoke_authority.js: revoke mint and freeze authority of a given token
## Trading:
- src/Trading/dex/raydium/sell.js: selling spl token for SOL in your wallet using raydium dex swap function
- src/Trading/dex/raydium/buy.js: buying spl token using SOL in your wallet using raydium dex swap function
- src/Trading/volume/boost_volume.js: boost the volume of a token by creating a buy and sell order in just one transaction in a way to avoid possible MEV
- src/Trading/memecoin_trading_strategies/copy-trading/copy-trade.js: copy trading program to follow a user-defined wallet address to auto-buy&sell
## Transactions:
- src/Transactions/jito_tips_tx_executor.js: execute the transaction by sending the bundles to Jito validators, they help us to land the transaction to the Solana blockchain faster than just using priority fee.
- src/Transactions/simple_tx_executor.js: execute the transaction by sending the request to the Solana blockchain with a given priority gas fee.
## Pool:
- src/Pool/add_pool.js: add liquidity to a pool in a given token address, the code find the most liquid pool (TOKEN_ADDRESS/SOL) in the raydium dex and add liquidity to it. You need to specify the amount of liquidity(sol) you want to add.
- src/Pool/remove_pool.js: remove liquidity from a pool in a given token address, the code find the most liquid pool (TOKEN_ADDRESS/SOL) in the raydium dex and remove liquidity from it. You need to specify the amount of percentage of liquidity you want to remove.
- src/Pool/swap.js: swap token for another token in the raydium dex, src/Trading/dex/raydium/buy.js and src/Trading/dex/raydium/sell.js are based on this code.
- src/Pool/query_pool.js: query the pool information of a given pool address in the raydium dex, it use shyft api to get the pool information. Please make sure you have your shyft api key inside the code before running this code.
## Helper methods:
- src/helpers/config.js: configuration file for the code.
- src/helpers/util.js: utility functions for the code, including: send transactions to Solana blockchain, dropped transactions handling, etc.
- src/helpers/check_balance.js: check the balance of a given token in your wallet
## Project Structure
```sh
.solana-memecoin-cli
βββ data
| βββ Image_file # store image file (jpeg, jpg,...)
| βββ metadata_file # store .json file about the token metadata
| βββ payer_keypair # store wallet keypair .json
| βββ token_keypair # store token keypair .json
βββ examples (Screenshots of Commands) # all screenshot to show how we use the command line tool
| βββ add_liquidity # see how to add liquidity to a pool on Raydium
| βββ burn_token # see how to burn a token with WSOL using Raydium swap
| βββ create_token # see how to create a SPL token on mainnet or devnet
| βββ buy_token # buy a token using raydium with both jito bundles and priority fees
| βββ create_token # create a token with 0% extra fees on solana (mainnet or devnet)
| βββ remove_liquidity # remove some liquidity from a pool on Raydium
| βββ boost_volume # boost the volume of a token on raydium
| βββ pump_createAndInitialBuy # create and initial buy token on pump.fun
| βββ pump_buy # buy token on pump.fun
| βββ pump_sell # sell token on pump.fun
| βββ sell_token # sell the token with a percentage using Raydium swap
βββ src
βββ helpers
β βββ .env
β βββ .env.copy
β βββ check_balance.js
β βββ config.js
β βββ unwrap_sol.js
β βββ util.js
β βββ wrap_sol.js
βββ Trading_dev
β βββ dex
β β βββ meteora
β β β βββ swap.js
β β β βββ buy.js
β β β βββ sell.js
β β β βββ constants.js
β β β βββ fetch-pool.js
β β β βββ fetch-price.js
β β β βββ idl.js
β β βββ orca
β β βββ #same as meteora/raydium
β βββ memecoin_trading_strategies/
β βββ copy-trading/
β β βββ copy-buy.js
β β βββ copy-sell.js
β β βββ copy-trade.js
β β βββ grpc-copy-bot/
β βββ tp_sl
β βββ stop-loss.js
β βββ take-profit.js
βββ Memecoin_dev
β βββ bundled_launcher
β βββ market-making_dev/
β β βββ boost_volume.js
β βββ sniping_dev
β βββ grpc_pump_sniper/
β βββ grpc_raydium_sniper/
βββ Transactions
β βββ bloXroute_tips_tx_executor.js
β βββ jito_tips_tx_executor.js
β βββ simple_tx_executor.js
βββ Token
β βββ zk-compression/
β βββ burn.js
β βββ create.js
β βββ revoke_authority.js
βββ raydium
β βββ Pool/
β β βββ add_pool.js
β β βββ create_pool.js
β β βββ fetch_pool.js
β β βββ formatAmmKeysById.js
β β βββ query_pool.js
β β βββ remove_pool.js
β β βββ swap.js
β βββ token-filters
β β βββ lp-burn.js
β β βββ maker-count.js
β β βββ marketcap.js
β β βββ pool-sol.js
β β βββ tx-count.js
β β βββ volume.js
β βββ buy.js
β βββ constants.js
β βββ fetch-price.js
β βββ raydium_config.js
β βββ sell.js
βββ jupiter
β βββ swap/
β β βββ buy-helper.js
β β βββ sell-helper.js
β β βββ swap-helper.js
β βββ dca.js
β βββ limit-order.js
βββ pumpfunsdk
βββ pump-keypair/
βββ pumpdotfun-sdk
βββ images/
βββ src
βββ IDL/
βββ pump-events-listener/
β βββ listeners.js
βββ amm.js
βββ buy.js
βββ createAndBuy.js
βββ pumpfun.js
βββ sell.js
βββ tools.js
βββ util.js
```
## Contributing
- Contributions is wellcome!!!
- Fork it
- `git checkout -b feature/YourNewFeature`
- `git commit -m 'bug Fixed/added new feature'`
- `git push origin feature/YourNewFeature`
- And Please open a pull request
## Apply Latest Changes from remote repo
- `git stash -u # Stash your changes`
- `git pull --rebase # Pull the latest changes`
- `git stash pop # Apply Your stashed changes`
## Disclaimer
This software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software.
**Use at your own risk.** The authors take no responsibility for any harm or damage caused by the use of this software. Users are responsible for ensuring the suitability and safety of this software for their specific use cases.
By using this software, you acknowledge that you have read, understood, and agree to this disclaimer.
### If you think this project is useful, please give us a starπ, it will help us a lot.
### It is a work in progress, if you have any suggestions or any problems, please let us know!
### **_Stay tuned for the updates.π€_**