enter image description here

async function getTransactionHistory(address){

let addr = new web3.PublicKey(address)

let txns = await connection.getSignaturesForAddress(addr,{limit:1})
let txnList = txns.map(transaction => transaction.signature)
let txDetails = await connection.getParsedTransactions(txnList)
    console.log("Post Balance : ",transaction.meta.postBalances)
    console.log("Pre Balance : ",transaction.meta.preBalances)


} getTransactionHistory('')

1 Answer 1


in transaction.message you can find accountKeys those are the accounts for the postBalance and preBalance in order. This means the first preBalance and postBalance are for the first account in accountKeys.


doing this in rust, but it's gonna be similar in typescript since they both invoke the Solana JSON RPC API.

account_keys: [
    ParsedAccount {
        pubkey:  "9FunJaYzY97hcTNN95mAn8iEhXQjw9NpKDmng8NYLAbt",
        writable: true,
        signer: true 
    ParsedAccount {
        pubkey: "CXFCTHyuhcJL3fiFR5eRochz4k9dwzZWfLMU7knzaCp",
        writable: true,
        signer: false

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.