I keep getting this error and totally lost, can someone please help?
The code is in python, i am using raydium pool keys to send a simulated transaction so i can calculate the price for my swap.
Instructions i am passing:
def make_simulate_pool_info_instruction(accounts, mint, ctx):
accountProgramId = ctx.get_account_info_json_parsed(Pubkey.from_string(mint))
TOKEN_PROGRAM_ID = accountProgramId.value.owner
keys = [
AccountMeta(pubkey=accounts["amm_id"], is_signer=False, is_writable=False),
AccountMeta(pubkey=accounts["authority"], is_signer=False, is_writable=False),
AccountMeta(pubkey=accounts["open_orders"], is_signer=False, is_writable=False),
AccountMeta(pubkey=accounts["base_vault"], is_signer=False, is_writable=False),
AccountMeta(pubkey=accounts["quote_vault"], is_signer=False, is_writable=False),
AccountMeta(pubkey=accounts["lp_mint"], is_signer=False, is_writable=False),
AccountMeta(pubkey=accounts["market_id"], is_signer=False, is_writable=False),
]
data = POOL_INFO_LAYOUT.build(
dict(
instruction=12,
simulate_type=0
)
)
return Instruction(AMM_PROGRAM_ID, data, keys)
Rest of Python code:
pool_keys = fetch_pool_keys(mint)
sim_inst = make_simulate_pool_info_instruction(pool_keys, mint, solana_client)
recent_blockhash = solana_client.get_latest_blockhash().value.blockhash
txn = Transaction(fee_payer=sender.pubkey(), recent_blockhash=recent_blockhash)
txn.add(sim_inst)
txn.sign(sender)
temp = solana_client.simulate_transaction(txn)
Error that i keep getting:
[
'Program 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 invoke [1]',
"Program log: panicked at 'called `Result::unwrap()` on an `Err` value: Custom(27)', src/processor.rs:4251:85",
'Program 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 consumed 6492 of 200000 compute units',
'Program 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 failed: SBF program panicked'
]
I got the code from an old github repo of 2022 for transaction simulation.