This code is written as proof of concept for demonstrating how we can buy new tokens immediately after liquidity pool is created.
Script listens to new raydium USDC/SOL pools and buys token for a fixed amount in USDC/SOL. Depending on speed of RPC node, the purchase usually happens before token is available on Raydium UI for swapping.
In order to run the script you need to:
in the .env file (remove the .copy from the file name when done). Make sure to replace default values.
npm install
npm run buy
in terminalYou should see following output:
If you see following error in your log file:
Error: 410 Gone: {"jsonrpc":"2.0","error":{"code": 410, "message":"The RPC call or parameters have been disabled."}, "id": "986f3599-b2b7-47c4-b951-074c19842bad" }
it means your RPC node doesn't support methods needed to execute script.
If you see following error in your log file:
Error: No SOL token account found in wallet:
it means that wallet you provided doesn't have USDC/WSOL token account.