Show Immature Balance in walletsend page (#2731)

* Wallet Send page also shows immature balance

* changes ans to and

* Immature Balance msg is not tooltip

* Make msg more clear
This commit is contained in:
Manan Sharma 2021-08-01 17:42:00 +05:30 committed by GitHub
parent 2207d836f1
commit 906c7eb7ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 4 deletions

View file

@ -4,7 +4,7 @@
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="NBXplorer.Client" Version="4.0.0" />
<PackageReference Include="NBXplorer.Client" Version="4.0.1" />
</ItemGroup>
<ItemGroup Condition="'$(Altcoins)' != 'true'">
<Compile Remove="Altcoins\**\*.cs"></Compile>

View file

@ -489,8 +489,13 @@ namespace BTCPayServer.Controllers
.ToArray();
var balance = _walletProvider.GetWallet(network).GetBalance(paymentMethod.AccountDerivation);
model.NBXSeedAvailable = await GetSeed(walletId, network) != null;
model.CurrentBalance = (await balance).Total.GetValue(network);
var Balance= await balance;
model.CurrentBalance = (Balance.Available ?? Balance.Total).GetValue(network);
if (Balance.Immature is null)
model.ImmatureBalance = 0;
else
model.ImmatureBalance = Balance.Immature.GetValue(network);
await Task.WhenAll(recommendedFees);
model.RecommendedSatoshiPerByte =
recommendedFees.Select(tuple => tuple.Result).Where(option => option != null).ToList();

View file

@ -35,6 +35,7 @@ namespace BTCPayServer.Models.WalletViewModels
public bool SubtractFeesFromOutput { get; set; }
}
public decimal CurrentBalance { get; set; }
public decimal ImmatureBalance { get; set; }
public string CryptoCode { get; set; }

View file

@ -33,6 +33,7 @@
<input type="hidden" asp-for="Fiat" />
<input type="hidden" asp-for="Rate" />
<input type="hidden" asp-for="CurrentBalance" />
<input type="hidden" asp-for="ImmatureBalance" />
<input type="hidden" asp-for="CryptoCode" />
<input type="hidden" name="BIP21" id="BIP21" />
@ -79,8 +80,12 @@
</div>
<span asp-validation-for="Outputs[0].Amount" class="text-danger"></span>
<p class="form-text text-secondary crypto-info">
Your current balance is
Your available balance is
<button type="button" class="crypto-balance-link btn btn-link p-0 align-baseline">@Model.CurrentBalance</button> <span>@Model.CryptoCode</span>.
@if (Model.ImmatureBalance>0)
{
<span><br>Note: @Model.ImmatureBalance @Model.CryptoCode are still immature and require additional confirmations.</span>
}
</p>
</div>
}
@ -109,6 +114,10 @@
<p class="form-text text-secondary crypto-info mb-2">
Your current balance is
<button type="button" class="crypto-balance-link btn btn-link p-0 align-baseline">@Model.CurrentBalance</button> <span>@Model.CryptoCode</span>.
@if (Model.ImmatureBalance > 0)
{
<span><br>Note: @Model.ImmatureBalance @Model.CryptoCode are still immature and require additional confirmations.</span>
}
</p>
<span asp-validation-for="Outputs[index].Amount" class="text-danger"></span>
</div>