raydium-io / raydium-sdk-V2-demo

Open-source Typescript SDK demos
68 stars 35 forks source link

Program log: Error: ExpectedAccount', #82

Closed mmdcuan closed 1 month ago

mmdcuan commented 1 month ago

Program log: Error: ExpectedAccount', on routeSwap

cruzshia commented 1 month ago

Please provide full code block and wallet address so I can test it out, thanks

mmdcuan commented 1 month ago
        const transaction = transactions[0]
        transaction.sign([owner]);
        txid = await connection.sendTransaction(transaction, {
            skipPreflight: false,
            maxRetries: 2,
        });
mmdcuan commented 1 month ago

how to filter fetchRoutePoolBasicInfo(), only new token?

mmdcuan commented 1 month ago

'Program log: Instruction: InitializeAccount', 'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 3442 of 599550 compute units', 'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success', 'Program routeUGWgWzqBWFcrCfv8tritsqukccJPu3q5GPP3xS invoke [1]', 'Program log: process_swap_base_in_with_user_account:RouteSwapBaseInArgs { amount_in: 80044744, minimum_amount_out: 80102364 }', 'Program log: Error: ExpectedAccount', 'Program routeUGWgWzqBWFcrCfv8tritsqukccJPu3q5GPP3xS consumed 12244 of 596108 compute units', 'Program routeUGWgWzqBWFcrCfv8tritsqukccJPu3q5GPP3xS failed: custom program error: 0x3'

cruzshia commented 1 month ago

fetchRoutePoolBasicInfo doesn't support any filter I can't debug with only logs, I need full code block, thx also, I suggest using src/api/swap.ts to do routing swap.

mmdcuan commented 1 month ago

expected account, successfully used swapbaseout

mmdcuan commented 1 month ago

I use routeSwap, only send transaction,

const { execute, transactions } = await raydium.tradeV2.swap({ routeProgram: Router, txVersion, swapInfo: targetRoute, swapPoolKeys: poolKeys, ownerInfo: { associatedOnly: true, checkCreateATAOwner: true, }, computeBudgetConfig: { units: 600000, microLamports: 10000, }, })

const transaction = transactions[0] transaction.sign([owner]); txid = await connection.sendTransaction(transaction, { skipPreflight: false, maxRetries: 2, });

cruzshia commented 1 month ago

please try run demo code, I tested it and works well and try not to sign and manipulate transactions by yourself

image
mmdcuan commented 1 month ago

actually just want skipPreflight: false, in the original menu it doesn't exist or const { txIds } = await execute({ sequentially: true,skipPreflight: false }) ?

cruzshia commented 1 month ago

yes, just use const { txIds } = await execute({ sequentially: true, skipPreflight: false }) cuz routeSwap might have more than 1 tx and your code might have bugs sometimes. and according to our exp, set skipPreflight to false might encounter some unexpected bugs too, we don't suggest set it to false

mmdcuan commented 1 month ago

if using jito or fee from api?

const { data } = await axios.get<{ id: string success: boolean data: { default: { vh: number; h: number; m: number } } }>(${API_URLS.BASE_HOST}${API_URLS.PRIORITY_FEE}) how ?

mmdcuan commented 1 month ago

skipPreflight: true will drain the fee if an error occurs and the bot continues to execute

mmdcuan commented 1 month ago

on log 1728421175428 Raydium_tradeV2 sdk logger debug ["direct error",6,"HAwjqG1Vg1XHvYqudzX9xAtb8akyttYStDC7NBWj9NWW","No enough initialized tickArray"]

cruzshia commented 1 month ago

That means your clmm pool don't have enough liquidity so it will not able to be swappable route.

mmdcuan commented 1 month ago

thanks