How to get current nonce?

  • getCurrentNonce

This function is used to retrieve the current nonce (transaction count) of an account.

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

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

const nonceDetails: GetCurrentNonceArg = {
  address: "6e371a05d5766c692172744f4907940ef324fcb9",
};

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

Parameters:

The address of the account for which the nonce needs to be retrieved

{
    "address": "6e371a05d5766c692172744f4907940ef324fcb9"
}

Returns:

A promise that resolves with the current nonce value.

4

Last updated