You can get the Transactions and it's to/from hashes, and lamports exchanged yourself (without third-party providers) easily via getSignaturesForAddress
(via @solana/web3.js
)
You can query the public hash of a wallet for it's signatures, and here's what I wasn't understanding:
Signatures convert to transactions via getParsedTransactions(signatureList)
Each Transaction contains instructions
which is an array containing items which include the source
hash, destination
hash, and the number of lamports
which changed hands.
const getTransactions = async(address, numTx) => {
const pubKey = new solanaWeb3.PublicKey(address);
let transactionList = await solanaConnection.getSignaturesForAddress(pubKey, {limit:numTx});
let signatureList = transactionList.map(transaction=>transaction.signature);
let transactionDetails = await solanaConnection.getParsedTransactions(signatureList, {maxSupportedTransactionVersion:0});
transactionList.forEach((transaction, i) => {
const date = new Date(transaction.blockTime*1000);
const transactionInstructions = transactionDetails[i].transaction.message.instructions;
console.log(`Transaction No: ${i+1}`);
console.log(`Signature: ${transaction.signature}`);
console.log(`Time: ${date}`);
console.log(`Status: ${transaction.confirmationStatus}`);
transactionInstructions.forEach((instruction, n)=>{
console.log(`---Instructions ${n+1}: ${instruction.programId.toString()}`);
})
console.log(("-").repeat(20));
})
}
Source
Now we have a source of truth to reconcile against. A guarunteed way of knowing which transactions landed.
This solution does not enable the 'real time notification' aspect of collecting the transactions... but now that we actually have a way to get this data we can just use a webhook listener (see other answers) as the cataylist to invoke the re-checking process (using this answer)