[RPC] Add "confirmations" field to "listunspentcoins" json response
MODIFY
WalletWasabi.Gui/Rpc/WasabiJsonRpcService.cs
WalletWasabi.Gui/Rpc/WasabiJsonRpcService.cs
@@ -27,6 +27,7 @@ namespace WalletWasabi.Gui.Rpc
public object[] GetUnspentCoinList()
{
AssertWalletIsLoaded();
+ var tipHeight = ActiveWallet.BitcoinStore.SmartHeaderChain.TipHeight;
return ActiveWallet.Coins.Where(x => x.Unspent).Select(x => new
{
txid = x.TransactionId.ToString(),
@@ -34,6 +35,7 @@ namespace WalletWasabi.Gui.Rpc
amount = x.Amount.Satoshi,
anonymitySet = x.AnonymitySet,
confirmed = x.Confirmed,
+ confirmations = tipHeight - x.Height + 1,
label = x.Label.ToString(),
keyPath = x.HdPubKey.FullKeyPath.ToString(),
address = x.HdPubKey.GetP2wpkhAddress(Global.Network).ToString()

MODIFY
WalletWasabi/Blockchain/TransactionOutputs/SmartCoin.cs
WalletWasabi/Blockchain/TransactionOutputs/SmartCoin.cs
@@ -36,6 +36,7 @@ namespace WalletWasabi.Blockchain.TransactionOutputs
private Cluster _clusters;
private bool _confirmed;
+ private int _confirmations;
private bool _unavailable;
private bool _unspent;
private bool _isBanned;
@@ -206,6 +207,12 @@ namespace WalletWasabi.Blockchain.TransactionOutputs
private set => RaiseAndSetIfChanged(ref _confirmed, value);
}
+ public int Confirmations
+ {
+ get => _confirmations;
+ private set => RaiseAndSetIfChanged(ref _confirmations, value);
+ }
+
/// <summary>
/// Spent || SpentAccordingToBackend || CoinJoinInProgress || IsDust;
/// </summary>

[RPC] Add "confirmations" field to "listunspentcoins" json response