mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-11 13:14:32 +00:00
decode hex
This commit is contained in:
parent
04403d5e1e
commit
59ac1563bc
1 changed files with 11 additions and 16 deletions
|
@ -260,25 +260,20 @@ mixin FusionWalletInterface {
|
||||||
Map<String, dynamic> tx = await _cachedElectrumX.getTransaction(
|
Map<String, dynamic> tx = await _cachedElectrumX.getTransaction(
|
||||||
coin: _coin,
|
coin: _coin,
|
||||||
txHash: e.txid,
|
txHash: e.txid,
|
||||||
verbose: true); // TODO is verbose needed?
|
verbose: true,
|
||||||
|
);
|
||||||
|
|
||||||
// Check if scriptPubKey is available.
|
// Check if scriptPubKey is available.
|
||||||
if (tx["vout"] == null) {
|
final scriptPubKeyHex =
|
||||||
throw Exception("Vout in transaction ${e.txid} is null");
|
tx["vout"]?[e.vout]?["scriptPubKey"]?["hex"] as String?;
|
||||||
}
|
if (scriptPubKeyHex == null) {
|
||||||
if (tx["vout"][e.vout] == null) {
|
throw Exception(
|
||||||
throw Exception("Vout index ${e.vout} in transaction is null");
|
"hex in scriptPubKey of vout index ${e.vout} in transaction is null",
|
||||||
}
|
);
|
||||||
if (tx["vout"][e.vout]["scriptPubKey"] == null) {
|
|
||||||
throw Exception("scriptPubKey at vout index ${e.vout} is null");
|
|
||||||
}
|
|
||||||
if (tx["vout"][e.vout]["scriptPubKey"]["hex"] == null) {
|
|
||||||
throw Exception("hex in scriptPubKey at vout index ${e.vout} is null");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assign scriptPubKey to pubKey. TODO verify this is correct.
|
// Assign scriptPubKey to pubKey. TODO verify this is correct.
|
||||||
List<int> pubKey =
|
List<int> pubKey = scriptPubKeyHex.toUint8ListFromHex;
|
||||||
utf8.encode("${tx["vout"][e.vout]["scriptPubKey"]["hex"]}");
|
|
||||||
|
|
||||||
// Add UTXO to coinList.
|
// Add UTXO to coinList.
|
||||||
coinList.add((e.txid, e.vout, e.value, pubKey));
|
coinList.add((e.txid, e.vout, e.value, pubKey));
|
||||||
|
|
Loading…
Reference in a new issue