mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-16 17:27:39 +00:00
probable fix for some transaction creation bug
This commit is contained in:
parent
810981dd40
commit
3f5ebee2ee
1 changed files with 34 additions and 14 deletions
|
@ -133,21 +133,41 @@ class TxData {
|
||||||
.reduce((total, amount) => total += amount)
|
.reduce((total, amount) => total += amount)
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
Amount? get amountWithoutChange =>
|
Amount? get amountWithoutChange {
|
||||||
recipients != null && recipients!.isNotEmpty
|
if (recipients != null && recipients!.isNotEmpty) {
|
||||||
? recipients!
|
if (recipients!.where((e) => !e.isChange).isEmpty) {
|
||||||
|
return Amount(
|
||||||
|
rawValue: BigInt.zero,
|
||||||
|
fractionDigits: recipients!.first.amount.fractionDigits,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return recipients!
|
||||||
.where((e) => !e.isChange)
|
.where((e) => !e.isChange)
|
||||||
.map((e) => e.amount)
|
.map((e) => e.amount)
|
||||||
.reduce((total, amount) => total += amount)
|
.reduce((total, amount) => total += amount);
|
||||||
: null;
|
}
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Amount? get amountSparkWithoutChange =>
|
Amount? get amountSparkWithoutChange {
|
||||||
sparkRecipients != null && sparkRecipients!.isNotEmpty
|
if (sparkRecipients != null && sparkRecipients!.isNotEmpty) {
|
||||||
? sparkRecipients!
|
if (sparkRecipients!.where((e) => !e.isChange).isEmpty) {
|
||||||
|
return Amount(
|
||||||
|
rawValue: BigInt.zero,
|
||||||
|
fractionDigits: sparkRecipients!.first.amount.fractionDigits,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return sparkRecipients!
|
||||||
.where((e) => !e.isChange)
|
.where((e) => !e.isChange)
|
||||||
.map((e) => e.amount)
|
.map((e) => e.amount)
|
||||||
.reduce((total, amount) => total += amount)
|
.reduce((total, amount) => total += amount);
|
||||||
: null;
|
}
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int? get estimatedSatsPerVByte => fee != null && vSize != null
|
int? get estimatedSatsPerVByte => fee != null && vSize != null
|
||||||
? (fee!.raw ~/ BigInt.from(vSize!)).toInt()
|
? (fee!.raw ~/ BigInt.from(vSize!)).toInt()
|
||||||
|
|
Loading…
Reference in a new issue