TransferArgs.fromJson constructor

TransferArgs.fromJson(
  1. Map map
)

Implementation

factory TransferArgs.fromJson(Map map) {
  return TransferArgs(
    to: map['to'] is String
        ? isHex(map['to'])
            ? (map['to'] as String).toU8a().toList()
            : Principal.fromText(map['to'] as String).toAccountId().toList()
        : (u8aToU8a(map['to']).toList()),
    fee: Tokens.fromJson(map['fee']),
    memo: map['memo'],
    amount: Tokens.fromJson(map['amount']),
    fromSubAccount: map['from_subaccount'] != null
        ? List<int>.from(map['from_subaccount'])
        : null,
    createdAtTime: map['created_at_time'] != null
        ? TimeStamp.fromJson(map['created_at_time'])
        : null,
  );
}