I need to extract this info from a transaction:
from
,to
wallet addressesasset
:SOL
or a token (what token?)amount
transferedblock_timestamp
I know how to get info of a transaction - https://docs.solana.com/developing/clients/jsonrpc-api#gettransaction
{
"jsonrpc": "2.0",
"result": {
"meta": {
"err": null,
"fee": 5000,
"innerInstructions": [],
"postBalances": [499998932500, 26858640, 1, 1, 1],
"postTokenBalances": [],
"preBalances": [499998937500, 26858640, 1, 1, 1],
"preTokenBalances": [],
"rewards": [],
"status": {
"Ok": null
}
},
"slot": 430,
"transaction": {
"message": {
"accountKeys": [
"3UVYmECPPMZSCqWKfENfuoTv51fTDTWicX9xmBD2euKe",
"AjozzgE83A3x1sHNUR64hfH7zaEBWeMaFuAN9kQgujrc",
"SysvarS1otHashes111111111111111111111111111",
"SysvarC1ock11111111111111111111111111111111",
"Vote111111111111111111111111111111111111111"
],
"header": {
"numReadonlySignedAccounts": 0,
"numReadonlyUnsignedAccounts": 3,
"numRequiredSignatures": 1
},
"instructions": [
{
"accounts": [1, 2, 3, 0],
"data": "37u9WtQpcm6ULa3WRQHmj49EPs4if7o9f1jSRVZpm2dvihR9C8jY4NqEwXUbLwx15HBSNcP1",
"programIdIndex": 4
}
],
"recentBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B"
},
"signatures": [
"2nBhEBYYvfaAe16UMNqRHre4YNSskvuYgx3M6E4JP1oDYvZEJHvoPzyUidNgNX5r9sTyN1J9UxtbCXy2rqYcuyuv"
]
}
},
"blockTime": null,
"id": 1
}
However, how to extract all the information above?
I see blockTime
which may be it.
Also, preBalances
and postBalances
- are they the ones to calculate the balances by? Why are they arrays? What each digit correspond to? Are the digits supposed to be subtracted from as in postBalances[N] - preBalances[N]
?
All in all, how to extract all the information I need?
P.S.
At the moment I'm only interested in SOL
and USDT/USDC
assets.