I'm trying to make a swap WSOL-USDC, and I used this doc:
https://github.com/raydium-io/raydium-sdk-V1-demo/blob/master/src/swapOnlyAmm.ts#L51
In mainnet ✅ everything works fine
In devnet ❌ I get this error :
Error: Unable to retrieve account information for ID 58oQChx4yWmvKdwLLZzBi4ChoCc2fqCUWBkwMihLYQo2
In the code I just replaced:
const rpcUrl = 'https://api.mainnet-beta.solana.com';
with
const rpcUrl = 'https://api.devnet.solana.com';
FYI the addresses I use:
'SOL': new Currency(9, 'USDC', 'USDC'),
'WSOL': new Token(TOKEN_PROGRAM_ID, new PublicKey('So11111111111111111111111111111111111111112'), 9, 'WSOL', 'WSOL'),
'USDC': new Token(TOKEN_PROGRAM_ID, new PublicKey('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'), 6, 'USDC', 'USDC'),
const targetPool = '58oQChx4yWmvKdwLLZzBi4ChoCc2fqCUWBkwMihLYQo2';
But I need to do something else to make it work in devnet?
The program might not exist on devnet (or might have a different program id), the pools might have different addresses, and the mints will all be different on devnet.
It's not just a matter of changing the rpc to devnet.