probable fix for some transaction creation bug

This commit is contained in:
julian 2024-07-04 15:44:45 -06:00
parent 810981dd40
commit 3f5ebee2ee

View file

@ -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) {
.where((e) => !e.isChange) return Amount(
.map((e) => e.amount) rawValue: BigInt.zero,
.reduce((total, amount) => total += amount) fractionDigits: recipients!.first.amount.fractionDigits,
: null; );
} else {
return recipients!
.where((e) => !e.isChange)
.map((e) => e.amount)
.reduce((total, amount) => total += amount);
}
} 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) {
.where((e) => !e.isChange) return Amount(
.map((e) => e.amount) rawValue: BigInt.zero,
.reduce((total, amount) => total += amount) fractionDigits: sparkRecipients!.first.amount.fractionDigits,
: null; );
} else {
return sparkRecipients!
.where((e) => !e.isChange)
.map((e) => e.amount)
.reduce((total, amount) => total += amount);
}
} 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()