mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 17:57:40 +00:00
move tx creation after ins/outs and added another null check
This commit is contained in:
parent
69dfbb5873
commit
5eb4b3bff5
1 changed files with 20 additions and 19 deletions
|
@ -152,24 +152,6 @@ mixin ElectrumXParsing {
|
||||||
type == TransactionType.incoming &&
|
type == TransactionType.incoming &&
|
||||||
transactionAddress.subType == AddressSubType.paynymNotification;
|
transactionAddress.subType == AddressSubType.paynymNotification;
|
||||||
|
|
||||||
final tx = Transaction(
|
|
||||||
walletId: walletId,
|
|
||||||
txid: txData["txid"] as String,
|
|
||||||
timestamp: txData["blocktime"] as int? ??
|
|
||||||
(DateTime.now().millisecondsSinceEpoch ~/ 1000),
|
|
||||||
type: type,
|
|
||||||
subType: isNotificationTx
|
|
||||||
? TransactionSubType.bip47Notification
|
|
||||||
: TransactionSubType.none,
|
|
||||||
amount: amount,
|
|
||||||
fee: fee,
|
|
||||||
height: txData["height"] as int?,
|
|
||||||
isCancelled: false,
|
|
||||||
isLelantus: false,
|
|
||||||
slateId: null,
|
|
||||||
otherData: null,
|
|
||||||
);
|
|
||||||
|
|
||||||
List<Output> outs = [];
|
List<Output> outs = [];
|
||||||
List<Input> ins = [];
|
List<Input> ins = [];
|
||||||
|
|
||||||
|
@ -196,7 +178,8 @@ mixin ElectrumXParsing {
|
||||||
scriptPubKeyType: json['scriptPubKey']?['type'] as String?,
|
scriptPubKeyType: json['scriptPubKey']?['type'] as String?,
|
||||||
scriptPubKeyAddress:
|
scriptPubKeyAddress:
|
||||||
json["scriptPubKey"]?["addresses"]?[0] as String? ??
|
json["scriptPubKey"]?["addresses"]?[0] as String? ??
|
||||||
json['scriptPubKey']['type'] as String,
|
json['scriptPubKey']?['type'] as String? ??
|
||||||
|
"",
|
||||||
value: Format.decimalAmountToSatoshis(
|
value: Format.decimalAmountToSatoshis(
|
||||||
Decimal.parse(json["value"].toString()),
|
Decimal.parse(json["value"].toString()),
|
||||||
coin,
|
coin,
|
||||||
|
@ -205,6 +188,24 @@ mixin ElectrumXParsing {
|
||||||
outs.add(output);
|
outs.add(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final tx = Transaction(
|
||||||
|
walletId: walletId,
|
||||||
|
txid: txData["txid"] as String,
|
||||||
|
timestamp: txData["blocktime"] as int? ??
|
||||||
|
(DateTime.now().millisecondsSinceEpoch ~/ 1000),
|
||||||
|
type: type,
|
||||||
|
subType: isNotificationTx
|
||||||
|
? TransactionSubType.bip47Notification
|
||||||
|
: TransactionSubType.none,
|
||||||
|
amount: amount,
|
||||||
|
fee: fee,
|
||||||
|
height: txData["height"] as int?,
|
||||||
|
isCancelled: false,
|
||||||
|
isLelantus: false,
|
||||||
|
slateId: null,
|
||||||
|
otherData: null,
|
||||||
|
);
|
||||||
|
|
||||||
return Tuple4(tx, outs, ins, transactionAddress);
|
return Tuple4(tx, outs, ins, transactionAddress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue