You might want to check out Helius' parsed transaction API.
const response = await fetch('https://api.helius.xyz/v0/transactions', {
method: 'POST',
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({}),
});
const data = await response.json();
It's far richer than the default getTransaction
method, if you don't want the hustle of going through the hassle of interpreting the instruction, post and pre balances.
[
{
"description": "Human readable interpretation of the transaction",
"type": "UNKNOWN",
"source": "FORM_FUNCTION",
"fee": 5000,
"feePayer": "8cRrU1NzNpjL3k2BwjW3VixAcX6VFc29KHr4KZg8cs2Y",
"signature": "yy5BT9benHhx8fGCvhcAfTtLEHAtRJ3hRTzVL16bdrTCWm63t2vapfrZQZLJC3RcuagekaXjSs2zUGQvbcto8DK",
"slot": 148277128,
"timestamp": 1656442333,
"nativeTransfers": [
{
"fromUserAccount": "text",
"toUserAccount": "text"
}
],
"tokenTransfers": [
{
"fromUserAccount": "text",
"toUserAccount": "text",
"fromTokenAccount": "text",
"toTokenAccount": "text",
"tokenAmount": 0,
"mint": "DsfCsbbPH77p6yeLS1i4ag9UA5gP9xWSvdCx72FJjLsx"
}
],
"accountData": [
{
"account": "text",
"nativeBalanceChange": 0,
"tokenBalanceChanges": [
{
"userAccount": "F54ZGuxyb2gA7vRjzWKLWEMQqCfJxDY1whtqtjdq4CJ",
"tokenAccount": "2kvmbRybhrcptDnwyNv6oiFGFEnRVv7MvVyqsxkirgdn",
"mint": "DUSTawucrTsGU8hcqRdHDCbuYhCPADMLM2VcCb8VnFnQ",
"rawTokenAmount": {
"tokenAmount": "text"
}
}
]
}
],
"transactionError": {
"error": "text"
},
"instructions": [
{
"accounts": [
"8uX6yiUuH4UjUb1gMGJAdkXorSuKshqsFGDCFShcK88B"
],
"data": "kdL8HQJrbbvQRGXmoadaja1Qvs",
"programId": "MEisE1HzehtrDpAAT8PnLHjpSSkRYakotTuJRPjTpo8",
"innerInstructions": [
{
"accounts": [
"text"
],
"data": "text",
"programId": "text"
}
]
}
],
"events": {
"nft": {
"description": "text",
"type": "NFT_SALE",
"source": "FORM_FUNCTION",
"amount": 1000000,
"fee": 5000,
"feePayer": "8cRrU1NzNpjL3k2BwjW3VixAcX6VFc29KHr4KZg8cs2Y",
"signature": "4jzQxVTaJ4Fe4Fct9y1aaT9hmVyEjpCqE2bL8JMnuLZbzHZwaL4kZZvNEZ6bEj6fGmiAdCPjmNQHCf8v994PAgDf",
"slot": 148277128,
"timestamp": 1656442333,
"saleType": "AUCTION",
"buyer": "text",
"seller": "text",
"staker": "text",
"nfts": [
{
"mint": "DsfCsbbPH77p6yeLS1i4ag9UA5gP9xWSvdCx72FJjLsx",
"tokenStandard": "NonFungible"
}
]
},
"swap": {
"nativeInput": {
"account": "2uySTNgvGT2kwqpfgLiSgeBLR3wQyye1i1A2iQWoPiFr",
"amount": "100000000"
},
"nativeOutput": {
"account": "2uySTNgvGT2kwqpfgLiSgeBLR3wQyye1i1A2iQWoPiFr",
"amount": "100000000"
},
"tokenInputs": [
{
"userAccount": "F54ZGuxyb2gA7vRjzWKLWEMQqCfJxDY1whtqtjdq4CJ",
"tokenAccount": "2kvmbRybhrcptDnwyNv6oiFGFEnRVv7MvVyqsxkirgdn",
"mint": "DUSTawucrTsGU8hcqRdHDCbuYhCPADMLM2VcCb8VnFnQ",
"rawTokenAmount": {
"tokenAmount": "text"
}
}
],
"tokenOutputs": [
{
"userAccount": "F54ZGuxyb2gA7vRjzWKLWEMQqCfJxDY1whtqtjdq4CJ",
"tokenAccount": "2kvmbRybhrcptDnwyNv6oiFGFEnRVv7MvVyqsxkirgdn",
"mint": "DUSTawucrTsGU8hcqRdHDCbuYhCPADMLM2VcCb8VnFnQ",
"rawTokenAmount": {
"tokenAmount": "text"
}
}
],
"tokenFees": [
{
"userAccount": "F54ZGuxyb2gA7vRjzWKLWEMQqCfJxDY1whtqtjdq4CJ",
"tokenAccount": "2kvmbRybhrcptDnwyNv6oiFGFEnRVv7MvVyqsxkirgdn",
"mint": "DUSTawucrTsGU8hcqRdHDCbuYhCPADMLM2VcCb8VnFnQ",
"rawTokenAmount": {
"tokenAmount": "text"
}
}
],
"nativeFees": [
{
"account": "2uySTNgvGT2kwqpfgLiSgeBLR3wQyye1i1A2iQWoPiFr",
"amount": "100000000"
}
],
"innerSwaps": [
{
"tokenInputs": [
{
"fromUserAccount": "text",
"toUserAccount": "text",
"fromTokenAccount": "text",
"toTokenAccount": "text",
"tokenAmount": 0,
"mint": "DsfCsbbPH77p6yeLS1i4ag9UA5gP9xWSvdCx72FJjLsx"
}
],
"tokenOutputs": [
{
"fromUserAccount": "text",
"toUserAccount": "text",
"fromTokenAccount": "text",
"toTokenAccount": "text",
"tokenAmount": 0,
"mint": "DsfCsbbPH77p6yeLS1i4ag9UA5gP9xWSvdCx72FJjLsx"
}
],
"tokenFees": [
{
"fromUserAccount": "text",
"toUserAccount": "text",
"fromTokenAccount": "text",
"toTokenAccount": "text",
"tokenAmount": 0,
"mint": "DsfCsbbPH77p6yeLS1i4ag9UA5gP9xWSvdCx72FJjLsx"
}
],
"nativeFees": [
{
"fromUserAccount": "text",
"toUserAccount": "text"
}
],
"programInfo": {
"source": "ORCA",
"account": "whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc",
"programName": "ORCA_WHIRLPOOLS",
"instructionName": "whirlpoolSwap"
}
}
]
}
}
}
]