This script facilitates the swapping of tokens and adding liquidity to markets on the Raydium.io decentralized exchange. It's designed to work with the Raydium pools and liquidity markets.
- Node.js installed on your machine
- ts-node installed
- A valid JavaScript environment
-
Clone the repository:
git clone <repository-url> cd <repository-directory>
-
Install dependencies:
npm install
-
Generate Keys for buying and adding liquidity to the
keys/
folder in this repository -
Edit the
MARKET_ID
constant in of thesrc/fetchMarketInfo.ts
file with the appropriate market ID for the pool on raydium -
run
npm run fetchMarket
to download the market data atpool_info/<market_id>.json
-
Configure your script by editing the script file (
src/main.ts
). Update the following variables at the beginning of the script:const TOKEN_TO_BUY_MINT = "<TOKEN MINT ADDRESS TO BUY>"; const SWAP_AMOUNT = "<AMOUNT OF TOKEN TO SWAP>"; const SWAP_SLIPPAGE = "SLIPPAGE TOLERANCE FOR SWAP"; const LIQUIDITY_INPUT_TOKEN_MINT = "<INPUT TOKEN MINT ADDRESS FOR LIQUIDITY>"; const LIQUIDITY_INPUT_TOKEN_AMOUNT = "<LIQUIDITY TOKEN INPUT AMOUNT>"; const LIQUIDITY_SLIPPAGE = "<LIQUIDITY SLIPPAGE>"; const POOL_MARKET_ID = "<MARKET ID OF THE POOL ON RAYDIUM>";
To execute the script:
npm run script
The script will connect to the Raydium mainnet RPC, perform the specified swap and liquidity addition, and log the result.
- Ensure that your wallet and necessary private keys are securely configured in the environment where the script is run.
- Be cautious when adjusting slippage values, as they affect the likelihood of transaction success.
- Double-check token mints and market IDs to match your specific use case.
Happy Hacking 🇳🇬🚀🤖