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
{
"address": "6e371a05d5766c692172744f4907940ef324fcb9"
}
A promise that resolves with the current nonce value.