fromJson static method

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

Implementation

static Transaction fromJson(Map<String, dynamic> jsonTransaction) {
  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:
      throw Exception('Cannot parse transaction');
  }
}