Skip to main content
Version: 3.2.0

Get Account Nonce

Returns the nonce of a given AvN account for different nonce types.

await api.query.getNonce("replace with user's address");
important

You can get the AVN_GATEWAY_URL here.

Possible Nonce Types

  • token
  • payment
  • staking
  • confirmation
const { AvnApi, SetupMode, SigningMode } = require("avn-api");
const AVN_GATEWAY_URL = "gateway url of your chosen network";
const options = {
suri: "suri of your account",
setupMode: SetupMode.SingleUser,
signingMode: SigningMode.SuriBased,
};

const ACCOUNT = "5DAgx...";
const NONCE_TYPE = "payment";

async function main() {
await avnSdk.init();
const api = await avnSdk.apis();

//See other nonce type options below
let nonce = await api.query.getNonce(ACCOUNT, NONCE_TYPE);
console.log(nonce);
}

(async () => {
await main();
})();