Querying a transaction
To query a transaction, you would need the request id returned after submitting your transaction to the AVN.
await api.poll.requestState(requestId);
Example
const AvnApi = require("avn-api");
const GATEWAY = "<endpoint_url>"; //Replace the endpoint_url with the url received from Aventus.
const api = new AvnApi(GATEWAY);
async function main() {
await api.init();
// Get the current state of a previously sent transaction.:
const state = await api.poll.requestState(requestId);
}
(async () => {
await main();
})();
Example Output
"Processed"
RESULT FIELDS
The resulting state could be any of the following ('Pending', 'Pending and Lost', 'Processed', 'Errored', 'Unknown').