getNonceForRelay method

Future<String> getNonceForRelay()

Implementation

Future<String> getNonceForRelay() async {
  BigInt block = BigInt.from(await _client.getBlockNumber());
  print('block: $block');
  BigInt timestamp = BigInt.from(DateTime.now().millisecondsSinceEpoch);
  print('timestamp: $timestamp');
  String blockHex = hexZeroPad(hexlify(block), 16);
  String timestampHex = hexZeroPad(hexlify(timestamp), 16);
  return '0x' +
      blockHex.substring(2, blockHex.length) +
      timestampHex.substring(
        2,
        timestampHex.length,
      );
}