getNonce method

Future<int?> getNonce(
  1. {bool txPool = true}
)

getNonce RPC gets the next nonce to use of an address. If txPool is false, result only counts transactions in ledger; if txPool is true, transactions in txPool are also counted.

Implementation

Future<int?> getNonce({bool txPool = true}) async {
  try {
    String? walletAddr = await Wallet.pubKeyToWalletAddr(hexEncode(this.publicKey));
    int? resp = await _methodChannel.invokeMethod('getNonce', {
      '_id': this.address,
      'address': walletAddr,
      'txPool': txPool,
    });
    return resp;
  } catch (e) {
    rethrow;
  }
}