Add Unknown amount
MODIFY
WalletWasabi.Gui/Controls/TransactionDetails/Models/AddressAmountTuple.cs
WalletWasabi.Gui/Controls/TransactionDetails/Models/AddressAmountTuple.cs
@@ -5,28 +5,26 @@ namespace WalletWasabi.Gui.Controls.TransactionDetails.Models
{
public readonly struct AddressAmountTuple : IEquatable<AddressAmountTuple>
{
- public AddressAmountTuple(string address = default, Money amount = default, bool isEmpty = true)
+ public AddressAmountTuple(string address, Money amount)
{
Address = address;
Amount = amount;
- IsEmpty = isEmpty;
}
public string Address { get; }
public Money Amount { get; }
- private bool IsEmpty { get; }
public static bool operator ==(AddressAmountTuple x, AddressAmountTuple y) => x.Equals(y);
public static bool operator !=(AddressAmountTuple x, AddressAmountTuple y) => !(x == y);
public bool Equals(AddressAmountTuple other) =>
- (IsEmpty, Amount, Address) == (other.IsEmpty, other.Amount, other.Address);
+ (Amount, Address) == (other.Amount, other.Address);
public override bool Equals(object other) =>
((AddressAmountTuple)other).Equals(this) == true;
public override int GetHashCode() =>
- HashCode.Combine(IsEmpty, Amount, Address);
+ HashCode.Combine(Amount, Address);
}
}

DELETE
WalletWasabi.Gui/Controls/TransactionDetails/Models/InOutInfoTuple.cs
-using System;
-
-namespace WalletWasabi.Gui.Controls.TransactionDetails.Models
-{
- public readonly struct InOutInfoTuple : IEquatable<InOutInfoTuple>
- {
- public InOutInfoTuple(AddressAmountTuple input, AddressAmountTuple output)
- {
- Input = input;
- Output = output;
- }
-
- public AddressAmountTuple Input { get; }
- public AddressAmountTuple Output { get; }
-
- public static bool operator ==(InOutInfoTuple x, InOutInfoTuple y) => x.Equals(y);
-
- public static bool operator !=(InOutInfoTuple x, InOutInfoTuple y) => !(x == y);
-
- public bool Equals(InOutInfoTuple other) =>
- (Input, Output) == (other.Input, other.Output);
-
- public override bool Equals(object other) =>
- ((InOutInfoTuple)other).Equals(this) == true;
-
- public override int GetHashCode() =>
- HashCode.Combine(Input, Output);
- }
-}

MODIFY
WalletWasabi.Gui/Controls/TransactionDetails/ViewModels/TransactionDetailsViewModel.cs
WalletWasabi.Gui/Controls/TransactionDetails/ViewModels/TransactionDetailsViewModel.cs
@@ -88,7 +88,9 @@ namespace WalletWasabi.Gui.Controls.TransactionDetails.ViewModels
set => this.RaiseAndSetIfChanged(ref _outputCount, value);
}
- public Money NetworkFee => TotalInputValue - TotalOutputValue;
+ public Money NetworkFee => TotalInputValue is null || TotalInputValue is null
+ ? null
+ : TotalInputValue - TotalOutputValue;
public static TransactionDetailsViewModel FromBuildTxnResult(BitcoinStore store, PSBT psbt)
{
@@ -98,13 +100,13 @@ namespace WalletWasabi.Gui.Controls.TransactionDetails.ViewModels
AddressAmountTuple FromPSBTOutput(PSBTOutput output) =>
FromOutputCore(output?.ScriptPubKey, output?.Value);
- AddressAmountTuple FromOutputCore(Script pubKey, Money value) =>
- new AddressAmountTuple(pubKey?.GetDestinationAddress(psbt.Network)?.ToString() ?? string.Empty, value ?? Money.Zero);
+ AddressAmountTuple FromOutputCore(Script pubKey, Money money) =>
+ new AddressAmountTuple(pubKey?.GetDestinationAddress(psbt.Network)?.ToString(), money);
TxOut GetOutput(OutPoint outpoint) =>
store.TransactionStore.TryGetTransaction(outpoint.Hash, out var prevTxn)
- ? prevTxn.Transaction.Outputs[outpoint.N]
- : null;
+ ? null
+ : prevTxn.Transaction.Outputs[outpoint.N];
var inputAddressAmount = psbt.Inputs
.Select(x => x.PrevOut)
@@ -113,9 +115,6 @@ namespace WalletWasabi.Gui.Controls.TransactionDetails.ViewModels
var outputAddressAmount = psbt.Outputs.Select(FromPSBTOutput);
- var totalInValue = inputAddressAmount.Select(x => x.Amount).Sum();
- var totalOutValue = outputAddressAmount.Select(x => x.Amount).Sum();
-
var psbtTxn = psbt.GetOriginalTransaction();
return new TransactionDetailsViewModel()
@@ -124,8 +123,8 @@ namespace WalletWasabi.Gui.Controls.TransactionDetails.ViewModels
Confirmed = false,
InputCount = inputAddressAmount.Count(),
OutputCount = outputAddressAmount.Count(),
- TotalInputValue = totalInValue,
- TotalOutputValue = totalOutValue,
+ TotalInputValue = inputAddressAmount.Any(x => x.Amount is null) ? null : inputAddressAmount.Select(x => x.Amount).Sum(),
+ TotalOutputValue = outputAddressAmount.Any(x => x.Amount is null) ? null : outputAddressAmount.Select(x => x.Amount).Sum(),
};
}
}

MODIFY
WalletWasabi.Gui/Converters/MoneyBrushConverter.cs
WalletWasabi.Gui/Converters/MoneyBrushConverter.cs
@@ -27,7 +27,7 @@ namespace WalletWasabi.Gui.Converters
}
else
{
- throw new TypeArgumentException(value, typeof(string), nameof(value));
+ return Brushes.IndianRed;
}
return money < 0 ? Brushes.IndianRed : Brushes.MediumSeaGreen;

MODIFY
WalletWasabi.Gui/Converters/MoneyStringConverter.cs
WalletWasabi.Gui/Converters/MoneyStringConverter.cs
@@ -14,7 +14,7 @@ namespace WalletWasabi.Gui.Converters
{
if (value is null)
{
- return "0";
+ return "Unknown";
}
else if (value is Money money)
{

Add Unknown amount