fromJson static method

Transaction fromJson(
  1. Map<String, dynamic> jsonTransaction
)

Implementation

static Transaction fromJson(Map<String, dynamic> jsonTransaction) {
  try {
    int txType = jsonTransaction['type'];
    switch (txType) {
      case 0:
        return TransactionScript.fromJson(jsonTransaction);
      case 1:
        return TransactionCreate.fromJson(jsonTransaction);
      case 2:
        return TransactionMint.fromJson(jsonTransaction);
      default:
        return UnknownTransaction(raw: jsonTransaction);
    }
  } catch (e) {
    return UnparsedTransaction(raw: jsonTransaction, err: e);
  }
}