Skip to content

Retrieving transactions

luiziov42 edited this page Aug 24, 2020 · 2 revisions

Retrieving transactions

A transaction (transfer) contains information about transfer of ownership or value.

Retrieve transactions

The helper method getTransactions retrieves the transactions of an asset.

import { v4 as uuidv4 } from "uuid";
import { PlatformClient } from "../iov42/core-sdk";

const rpcUrl = "https://api.sandbox.iov42.dev"; //Url of the iov42 API server
const platformClient = new PlatformClient(rpcUrl);
const keyPair: IKeyPairData = "<previously generated key pair>";
const accountId = "<existing accountId>"
const assetTypeId: string = "<assetTypeId of accountId>";
const query: ITransferQuery = {
    assetId: accountId,
    assetTypeId: assetTypeId,
};
platformClient.getTransactions(query, keyPair)
.then( (response) => {
    // Check response
})
.catch( (error) => {
    console.error(error);
});