This automated script facilitates the swapping of targeted SPL-tokens and SOL on Raydium. Users can customize the script's parameters according to their preferences.For testing purposes, the script can be set to simulate swaps by settingexecuteSwap: false
insrc/swapConfig.ts
.
exportconstswapConfig={executeSwap:true,// Send tx when true, simulate tx when falseuseVersionedTransaction:true,// wether you want to user versioned transaction or legacy transactiontokenAAddress:"So11111111111111111111111111111111111111112",// Token to swap for the other, SOL in this casemaxLamports:2000000,// Micro lamports for priority feedirection:"in"as"in"|"out",// Swap direction: 'in' or 'out'liquidityFile:"https://api.raydium.io/v2/sdk/liquidity/mainnet.json",OwnerAddress:"",// Your wallet PublicKeyexitTarget:1,// Exit target in percentage (e.g. +1%)maxRetries:20,intervalMs:4000,// Interval between every swapretryCount:3,// Retry if the transaction fails.};