buildSignedTokenTx function

Map<String, Object?> buildSignedTokenTx({
  1. String networkId = kNetworkId,
  2. required int timestamp,
  3. required Object fee,
  4. required int nonce,
  5. required String senderAddress,
  6. required String publicKey,
  7. required int op,
  8. String tokenId = '',
  9. String symbol = '',
  10. String name = '',
  11. int decimals = 0,
  12. String? cap,
  13. String? amount,
  14. String? recipient,
  15. required String privHex,
})

Build a fully-signed TokenTx body. cap/amount are integer base-unit strings.

Implementation

Map<String, Object?> buildSignedTokenTx({
  String networkId = kNetworkId,
  required int timestamp,
  required Object fee,
  required int nonce,
  required String senderAddress,
  required String publicKey,
  required int op,
  String tokenId = '',
  String symbol = '',
  String name = '',
  int decimals = 0,
  String? cap,
  String? amount,
  String? recipient,
  required String privHex,
}) {
  final s = _sign(
      networkId,
      timestamp,
      fee,
      nonce,
      senderAddress,
      privHex,
      p.tokenPayload(
          op: op,
          tokenId: tokenId,
          symbol: symbol,
          name: name,
          decimals: decimals,
          cap: cap,
          amount: amount,
          recipient: recipient));
  return {
    'timestamp': timestamp,
    'fee': normalizeAmount(fee),
    'nonce': nonce,
    'senderAddress': senderAddress,
    'op': op,
    'tokenId': tokenId,
    'symbol': symbol,
    'name': name,
    'decimals': decimals,
    'cap': cap,
    'amount': amount,
    'recipient': recipient,
    'hash': s['hash'],
    'senderSignature': s['signature'],
    'senderPublicKey': publicKey,
  };
}