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 repositoryEdit the
MARKET_IDconstant in of thesrc/fetchMarketInfo.tsfile with the appropriate market ID for the pool on raydiumrun
npm run fetchMarketto download the market data atpool_info/<market_id>.jsonConfigure your script by editing the script file (
src/main.ts). Update the following variables at the beginning of the script:constTOKEN_TO_BUY_MINT="<TOKEN MINT ADDRESS TO BUY>";constSWAP_AMOUNT="<AMOUNT OF TOKEN TO SWAP>";constSWAP_SLIPPAGE="SLIPPAGE TOLERANCE FOR SWAP";constLIQUIDITY_INPUT_TOKEN_MINT="<INPUT TOKEN MINT ADDRESS FOR LIQUIDITY>";constLIQUIDITY_INPUT_TOKEN_AMOUNT="<LIQUIDITY TOKEN INPUT AMOUNT>";constLIQUIDITY_SLIPPAGE="<LIQUIDITY SLIPPAGE>";constPOOL_MARKET_ID="<MARKET ID OF THE POOL ON RAYDIUM>";
To execute the script:
npm run scriptThe 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 🇳🇬🚀🤖