Using JS, how would I go about getting transaction information on transactions that affect the balance of a specific account?
I've been able to listen for account changes with the following code, but it only provides the updated account information. Specifically, I want to know the amount of the transfer, what token was transferred, and what account it was transferred from.
import { clusterApiUrl, Connection, PublicKey } from '@solana/web3.js';
const connection = new Connection(clusterApiUrl('devnet'), 'confirmed');
const subscriptionID = connection.onAccountChange(
new PublicKey('xxxxxxxxxxx'),
(updatedAccountInfo, context) => {
console.log(updatedAccountInfo, context)
},
"confirmed"
)