Its parsing only transaction instructions, but not inner.
import { PublicKey, Connection, LAMPORTS_PER_SOL } from "@solana/web3.js";
import { SolanaParser } from "@debridge-finance/solana-transaction-parser";
import { RaydiumIDL } from "./idl/raydium.js";
import dotenv from "dotenv";
dotenv.config();
const rpcConnection = new Connection(process.env.SOLANA_RPC_ENDPOINT_2);
const txParser = new SolanaParser([{ idl: RaydiumIDL, programId: "CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK" }]);
const parsed = await txParser.parseTransaction(
rpcConnection,
"3bSaEg71kkWDPtG94mn9bY8k2D7mABaqrQqL4F5JvzAEwukjqqwkjGhHBCb9fS5wVe1AG1J8i76ScKTZ59VGgJzt",
false,
);
console.log(parsed);
const tokenSwapIx = parsed?.find((pix) => pix.name === "swap");
console.log(tokenSwapIx);
swap parsing output:
{
name: 'swap',
accounts: [
{
name: 'payer',
isSigner: true,
isWritable: true,
pubkey: [PublicKey [PublicKey(9vu7XMz8Brmfm4mT1T2E1YzemsUCwQEzeM3DrocPBxWc)]]
},
{
name: 'ammConfig',
isSigner: false,
isWritable: false,
pubkey: [PublicKey [PublicKey(HfERMT5DRA6C1TAqecrJQFpmkf3wsWTMncqnj3RDg5aw)]]
},
{
name: 'poolState',
isSigner: false,
isWritable: true,
pubkey: [PublicKey [PublicKey(2QdhepnKRTLjjSqPL1PtKNwqrUkoLee5Gqs8bvZhRdMv)]]
},
{
name: 'inputTokenAccount',
isSigner: false,
isWritable: true,
pubkey: [PublicKey [PublicKey(BkJFS1HF6JgrsB1VXdTVMsZ7R6WCKqokCqhUZqarPPVZ)]]
},
{
name: 'outputTokenAccount',
isSigner: false,
isWritable: true,
pubkey: [PublicKey [PublicKey(7exzsvjn46jweUp1uerS3SYMmHUdQcBgrQi2MHMv5fJV)]]
},
{
name: 'inputVault',
isSigner: false,
isWritable: true,
pubkey: [PublicKey [PublicKey(4d35yC7C8zhCDec7JbPptL9SEb4NUddKHxURgmvD8hfo)]]
},
{
name: 'outputVault',
isSigner: false,
isWritable: true,
pubkey: [PublicKey [PublicKey(E2BcoCeJLTa27mAXDA4xwEq3pBUcyH6XXEHYk4KvKYTv)]]
},
{
name: 'observationState',
isSigner: false,
isWritable: true,
pubkey: [PublicKey [PublicKey(4fEjbMXTet3w8qhScPmT6X79ypagRydKLHPqcGsrhcmP)]]
},
{
name: 'tokenProgram',
isSigner: false,
isWritable: false,
pubkey: [PublicKey [PublicKey(TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA)]]
},
{
name: 'tickArray',
isSigner: false,
isWritable: true,
pubkey: [PublicKey [PublicKey(BBG3DNdnJZXSxURzXSYZ7f8tW42EEDzsTt3Wj9AT1BBH)]]
},
{
name: 'Remaining 0',
isSigner: false,
isWritable: true,
pubkey: [PublicKey [PublicKey(4zNMSCni6fNg23uvgY8LjrZWYa1f4gnUHMM4u7CLs9FD)]]
}
],
programId: PublicKey [PublicKey(CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK)] {
_bn: <BN: a5d5ca9e04cf5db590b714ba2fe32cb159133fc1c192b72257fd07d39cb0401e>
},
args: {
amount: <BN: 16ea5efa4b>,
otherAmountThreshold: <BN: 0>,
sqrtPriceLimitX64: <BN: 3d19d07303606e50>,
isBaseInput: true
}
}