UTXOTransaction.fromJson constructor
UTXOTransaction.fromJson( - Map json
)
Implementation
factory UTXOTransaction.fromJson(Map<dynamic, dynamic> json) {
if (json
case {
'hash': String hash,
'block': int block,
'confirmations': int confirmations,
'timeMilli': int timeMilli,
'amount': Map amount,
'fee': Map? fee,
'sender': String sender,
'recipient': String recipient,
'transferMethod': int transferMethod,
'status': int status,
'token': Map token,
'id': String id,
'version': int version,
'inputs': JsonList inputs,
'outputs': JsonList outputs,
}) {
return UTXOTransaction(
hash: hash,
block: block,
confirmations: confirmations,
timeMilli: timeMilli,
amount: Amount.fromJson(amount),
fee: fee != null ? Amount.fromJson(fee) : null,
sender: sender,
recipient: recipient,
transferMethod: TransactionTransferMethod.fromJson(transferMethod),
status: ConfirmationStatus.fromJson(status),
id: id,
version: version,
inputs: inputs.map((e) => ElectrumInput.fromJson(e)).toList(),
outputs: outputs.map((e) => ElectrumOutput.fromJson(e)).toList(),
token: CoinEntity.fromJson(token),
);
}
throw Exception("Could not parse UTXOTransaction from $json");
}