ElectrumInput.fromJson constructor
ElectrumInput.fromJson( - Map json
)
Implementation
factory ElectrumInput.fromJson(Map json) {
return switch (json) {
{
"txinwitness": [String sig, String pubKey],
"scriptSig": {
"asm": _,
"hex": String hex,
},
"sequence": int sequence,
"txid": String txid,
"vout": int vout,
} =>
ElectrumInput(
txinwitness: [sig, pubKey],
scriptSig: hex,
sequence: sequence,
txid: txid,
vout: vout,
),
{
"scriptSig": {
"asm": _,
"hex": String hex,
},
"sequence": int sequence,
"txid": String txid,
"vout": int vout,
} =>
ElectrumInput(
scriptSig: hex,
sequence: sequence,
txid: txid,
vout: vout,
),
{
"coinbase": String coinbase,
"sequence": int sequence,
} =>
ElectrumInput(
coinbase: coinbase,
sequence: sequence,
),
{
"scriptSig": {
"asm": _,
"hex": String hex,
},
"txid": String txid,
"vout": int vout,
"value_int": int _,
"weight": int weight,
} =>
ElectrumInput(
scriptSig: hex,
txid: txid,
vout: vout,
sequence: weight,
),
{
'scriptSig': String? scriptSig,
'sequence': int? sequence,
'txid': String? txid,
'vout': int? vout,
'txinwitness': List<String>? txinwitness,
'coinbase': String? coinbase,
} =>
ElectrumInput(
scriptSig: scriptSig,
sequence: sequence,
txid: txid,
vout: vout,
txinwitness: txinwitness,
coinbase: coinbase,
),
_ => throw Exception("Could not parse ElectrumInput from $json"),
};
}