How to get account transactions?

  • getTransactionsByAccount

This function is used to retrieve an array of transaction receipts for a specified account.

import { L1XProvider, GetTransactionsByAccountArg } from "@l1x/l1x-wallet-sdk";

let l1xProvider = new L1XProvider({
  clusterType: "mainnet",
    endpoint: "https://v2-mainnet-rpc.l1x.foundation",

});

const query: GetTransactionsByAccountArg = {
  address: "6e371a05d5766c692172744f4907940ef324fcb9",
  number_of_transactions: 10,
  starting_from: 0,
};

l1xProvider.core
  .getTransactionsByAccount(query)
  .then((response) => console.log(response)) // log response
  .catch((err) => console.error(err)); // log error

Parameters:

The account address and query parameters.

{
    "address": "6e371a05d5766c692172744f4907940ef324fcb9",
    "number_of_transactions": 10,
    "starting_from": 0
}

Returns:

A promise that resolves with an array of transaction receipts.

[
    {
        transaction: {
          tx_type: Number,
          nonce: String,
          fee_limit: String,
          signature: [Array],
          verifying_key: [Array],
          transaction: [Object]
        },
        block_hash: null,
        block_number: null,
        fee_used: null,
        timestamp: null,
        from: '',
        transaction_hash: ''
    }
]

Last updated