Skip to content

Best solana cli tool, gRPC trading bots for high-frequency trading dev integrated with Jito bundles, bloXroute, Jupiter, DEXes, and Pump.fun.

License

Notifications You must be signed in to change notification settings

MftFrank/solana-trading-cli

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”—doc

Main Features

  • Create your own Solana SPL tokens on mainnet | Pump.fun

  • Swap tokens on Jupiter, Raydium, Orca, Meteora, and pump.fun

    • how to use Jupiter cli & trading functions: here
    • how to use Raydium cli & trading functions: here
    • how to use Orca cli & trading functions: here
    • how to use Meteora cli & trading functions: here
  • 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

  • First Open-Source gRPC copy bot here

  • Open-source gRPC Raydium sniper bot here

  • Got everything needed to create your own trading bot

Credits

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 🚨

  1. 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).
  2. Add your mainnet wallet secret key(must), devnet wallet secret key (optional), RPC endpoint(must) and shyft api key(optional)
  3. rename the .env.copy file to .env

Usage βœ…:

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
  • boost volume of a token by creating buy and sell orders in just one transaction
  • Add or Remove liquidity to a pool
  • Buy, Sell, and launch token in pump.fun
  • monitor real-time pump-fun's create, trade, and complete bonding curve events

Trader CLI:

  • integrates both jito tips, bloXroute fee that land transactions faster
  • swap tokens on Raydium, Meteora, and Orca
  • swap tokens using Jupiter API
  • 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
  • geyser grpc Raydium sniper bot
  • 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).

    ts-node create --payer <PATH_TO_SECRET_KEY> --symbol <TOKEN_SYMBOL> --token_name <TOKEN_NAME> --mint <PATH_TO_MINT_KEYPAIR> --supply <SUPPLY_OF_TOKEN> --decimals <DECIMALS> --metadata <PATH_METADATA_JSON> --image <PATH_TO_IMAGE> --cluster <CLUSTER> --priority-fee <PRIORITY_FEE> --file_type <FILE_TYPE>
  2. Specify the token address, the percentage of the token you want to burn and the cluster you want to use.

    ts-node burn --payer <PATH_TO_SECRET_KEY> --token_address <ADDRESS_TOKEN> --percentage <BURN_PERCENTAGE> --cluster <CLUSTER>
  3. Specify the token address and the cluster you want to use.

    ts-node revoke_authority --payer <PATH_TO_SECRET_KEY> --mint_address <ADDRESS_TOKEN> --cluster <CLUSTER> --mint --freeze
  4. Specify the token address you want to query and the cluster for boosting the volume of the token.

    ts-node boost_volume --token_address <TOKEN_ADDRESS> --payer <PATH_TO_SECRET_KEY> --cluster <CLUSTER> --sol_per_order <SOL_PER_ORDER>
  5. Specify the token address, the amount of Sol you want to swap, and the cluster you want to use.

    ts-node buy --payer <PATH_TO_SECRET_KEY> --token_address <ADDRESS_TOKEN> --sol <NUMBER_OF_SOL> --cluster <CLUSTER>
  6. Specify the token address, the percentage of the token you want to sell, and the cluster you want to use.

    ts-node sell --payer <PATH_TO_SECRET_KEY> --token_address <ADDRESS_TOKEN> --percentage <SELL_PERCENTAGE> --cluster <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.

    ts-node add_pool --payer <PATH_WALLET> --token_address <ADDRESS_TOKEN> --pool_id <POOL_ID> --sol <NUMBER_OF_SOL> --cluster <CLUSTER> --priority_fee <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.

    ts-node remove_pool --payer <PATH_PAYER> --token_address <TOKEN_ADDRESS> --percentage <LP_TOKEN_PERCENTAGE> --cluster <CLUSTER>
  9. wrap your sol to wsol.

    ts-node wrap_sol.js --size <size>
  10. unwrap your wsol to sol.

    ts-node unwrap_sol.js

Pump.fun commands

  1. 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.

    ts-node createAndBuy --pathToMintKeypair <PATH_TO_MINT_KEYPAIR> --sol <NUMBER_OF_SOL> --name <TOKEN_NAME> --symbol <TOKEN_SYMBOL> --description <TOKEN_DESCRIPTION> --telegram <TELEGRAM_LINK> --twitter <TWITTER_LINK> --website <WEBSITE_LINK> --file <IMAGE_FILE_PATH>
  2. Specify the token address, the sol you want to buy

    ts-node buy --token_address <ADDRESS_TOKEN> --sol <NUMBER_OF_SOL>
  3. Specify the token address, the percentage of the token you want to sell

    ts-node sell --token_address <ADDRESS_TOKEN> --percentage <SELL_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

.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.πŸ€–

About

Best solana cli tool, gRPC trading bots for high-frequency trading dev integrated with Jito bundles, bloXroute, Jupiter, DEXes, and Pump.fun.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 99.9%
  • Shell 0.1%