Skip to content

Commit 75fa06c

Browse files
Create send max button and fee types (#148)
* Create send max button and fee types * Fix some html * add max button and fee to cold staking * Add Max button * Add icons to buttons & improve tables * Add button icons * Fix xds fees * Show staking balance of hot accounts on staking UI * Improve UI Home Dashboard * Add network status to wallet page * Update Calculation for Wallet Sync * Revert xds min tx fee * change text for connection direction Co-authored-by: Hunter <thecryptohunter@protonmail.com>
1 parent 81a7f68 commit 75fa06c

15 files changed

Lines changed: 661 additions & 415 deletions

File tree

src/Features/Blockcore.Features.ColdStaking/UI/Pages/ColdStake.razor

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,15 @@
6969
<div class="card">
7070
<div class="card-body">
7171
<h4 class="card-title">Balances</h4>
72-
<div class="table-responsive">
72+
<div class="table-responsive small">
7373
<table class="table table-border-bottom table-striped table-sm table-hover">
7474
<thead class="thead">
7575
<tr>
76-
<th>Wallet</th>
77-
<th>Account balance</th>
78-
<th>Cold balance</th>
79-
<th>Hot balance</th>
76+
<th class="text-primary"><strong>WALLET</strong></th>
77+
<th class="text-primary"><strong>MAIN BALANCE</strong></th>
78+
<th class="text-primary"><strong>COLD BALANCE</strong></th>
79+
<th class="text-primary"><strong>HOT BALANCE</strong></th>
80+
<th class="text-primary text-center"><strong>DETAILS</strong></th>
8081
</tr>
8182
</thead>
8283
<tbody>
@@ -85,25 +86,25 @@
8586
var coldStakingWalletEnabled = ColdStakingManager.GetColdStakingAccount(this.WalletManager.GetWallet(walletName), true);
8687
if (coldStakingWalletEnabled != null) {
8788
<tr @onclick="() => { NavigateToColdStakeView(walletName); }" >
88-
<td>@walletName</td>
89+
<td class="align-middle">@walletName</td>
8990
@foreach (var account in this.WalletManager.GetAccounts(walletName)) {
9091

9192
var accountBalance = this.WalletManager.GetBalances(walletName, account.Name).Single();
9293

9394
@if (@accountBalance.AmountUnconfirmed >0) {
94-
<td>@accountBalance.AmountConfirmed (@accountBalance.AmountUnconfirmed )</td>
95+
<td class="align-middle">@accountBalance.AmountConfirmed (@accountBalance.AmountUnconfirmed )</td>
9596
} else {
96-
<td>@accountBalance.AmountConfirmed</td>
97+
<td class="align-middle">@accountBalance.AmountConfirmed</td>
9798
}
9899

99100
var coldStakingAccount = ColdStakingManager.GetColdStakingAccount(this.WalletManager.GetWallet(walletName), true);
100101

101102
if (coldStakingAccount != null) {
102103
var coldAccountBalance = ColdStakingManager.GetBalances(walletName, coldStakingAccount.Name).Single();
103104
@if (@coldAccountBalance.AmountUnconfirmed >0) {
104-
<td>@coldAccountBalance.AmountConfirmed (@coldAccountBalance.AmountUnconfirmed )</td>
105+
<td class="align-middle">@coldAccountBalance.AmountConfirmed (@coldAccountBalance.AmountUnconfirmed )</td>
105106
} else {
106-
<td>@coldAccountBalance.AmountConfirmed</td>
107+
<td class="align-middle">@coldAccountBalance.AmountConfirmed</td>
107108
}
108109
}
109110

@@ -112,15 +113,18 @@
112113
if (hotStakingAccount != null) {
113114
var hotAccountBalance = ColdStakingManager.GetBalances(walletName, hotStakingAccount.Name).Single();
114115
@if (@hotAccountBalance.AmountUnconfirmed >0) {
115-
<td>@hotAccountBalance.AmountConfirmed (@hotAccountBalance.AmountUnconfirmed )</td>
116+
<td class="align-middle">@hotAccountBalance.AmountConfirmed (@hotAccountBalance.AmountUnconfirmed )</td>
116117
} else {
117-
<td>@hotAccountBalance.AmountConfirmed</td>
118+
<td class="align-middle">@hotAccountBalance.AmountConfirmed</td>
118119
}
119120
}
120121
}
122+
<td class="text-center">
123+
<button class="btn btn-sm btn-primary"><span class="oi oi-zoom-in" aria-hidden="true"></span></button>
124+
</td>
121125
</tr>
122126
}
123-
}
127+
}
124128
</tbody>
125129
</table>
126130
</div>

src/Features/Blockcore.Features.ColdStaking/UI/Pages/ColdStakeDelegate.razor

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
@inject NodeDeployments NodeDeployments
1515

1616
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pb-2 mb-3 border-bottom">
17-
<h1 class="h2"><strong>Delegate Staking From: @walletname</strong></h1>
17+
<h1 class="h2"><strong>Delegate Staking from @walletname</strong></h1>
1818
<div class="btn-toolbar mb-2 mb-md-0">
1919
</div>
2020
</div>
@@ -40,7 +40,7 @@ var mainAccountBalance = this.WalletManager.GetBalances(walletname, "account 0")
4040
</div>
4141
</div>
4242
</div>
43-
<div class="col-xl-6 col-sm-6 grid-margin stretch-card">
43+
<div class="col-xl-6 col-sm-6 grid-margin stretch-card">
4444
<div class="card">
4545
<div class="card-body">
4646
<h5>Cold Balance</h5>
@@ -57,7 +57,6 @@ var mainAccountBalance = this.WalletManager.GetBalances(walletname, "account 0")
5757
</div>
5858
</div>
5959
</div>
60-
6160
<div class="row ">
6261
<div class="col-12 grid-margin">
6362
<div class="card">
@@ -69,35 +68,36 @@ var mainAccountBalance = this.WalletManager.GetBalances(walletname, "account 0")
6968
<input @bind="HotWalletAddress" type="text" class="form-control" placeholder="Your third party delegated staking address" />
7069
</div>
7170

72-
<div class="input-group mb-3">
73-
<div class="input-group-prepend">
74-
<span style="min-width: 15em" class="input-group-text">Amount:</span>
75-
</div>
76-
<input @bind="Amount" type="text" class="form-control" placeholder="amount" />
77-
<div class="input-group-append">
78-
<span style="min-width: 3em" class="input-group-text">@this.Network.CoinTicker.ToUpper()</span>
79-
</div>
71+
<div class="input-group mb-3">
72+
<div class="input-group-prepend">
73+
<span style="min-width: 15em" class="input-group-text">Amount (@this.Network.CoinTicker.ToUpper()):</span>
8074
</div>
75+
<input @bind="Amount" type="text" class="form-control" placeholder="amount" />
76+
<div class="input-group-append">
77+
<button class="btn btn-secondary" @onclick="MaxAmount">Max</button>
78+
</div>
79+
</div>
8180

82-
<div class="input-group mb-3">
83-
<div class="input-group-prepend">
84-
<span style="min-width: 15em" class="input-group-text">Fee:</span>
85-
</div>
86-
<input @bind="Fee" type="text" class="form-control" placeholder="fee" />
87-
<div class="input-group-append">
88-
<span style="min-width: 10em" class="input-group-text">Optional (<abbr title="The low fee may not be enough for every transaction">default to low</abbr>)</span>
89-
</div>
81+
<div class="input-group mb-3">
82+
<div class="input-group-prepend">
83+
<span style="min-width: 15em" class="input-group-text">Fee:</span>
84+
</div>
85+
<input @bind="Fee" type="text" class="form-control" placeholder="fee" />
86+
<div class="input-group-append">
87+
<span style="min-width: 6em" class="input-group-text"><abbr title="The low fee may not be enough for every transaction">Default to low</abbr></span>
9088
</div>
89+
</div>
9190

9291
<div class="input-group mb-3">
9392
<div class="input-group-prepend">
9493
<span style="min-width: 15em" class="input-group-text">Password:</span>
9594
</div>
9695
<input @bind="Password" type="password" class="form-control" placeholder="Please enter your password" />
9796
</div>
97+
9898
<div class="btn-toolbar mb-2 mb-md-0">
99-
<button class="btn btn-primary mr-1" @onclick="Setup">Delegate Staking Now</button>
100-
<button class="btn btn-primary" @onclick="ChangePayToScript">PayToScript: @PayToScript</button>
99+
<button class="btn btn-primary mr-1" @onclick="Setup">Delegate Staking Now</button>
100+
<button class="btn btn-primary" @onclick="ChangePayToScript">PayToScript: @PayToScript</button>
101101
</div>
102102
<div class="input-group">
103103
<div class="alert-warning">@Alert</div>
@@ -147,12 +147,25 @@ var mainAccountBalance = this.WalletManager.GetBalances(walletname, "account 0")
147147
}
148148
return Task.CompletedTask;
149149
}
150+
public void SendMax()
151+
{
152+
var mainAccountBalance = this.WalletManager.GetBalances(walletname, "account 0").Single();
150153

154+
this.Amount = mainAccountBalance.AmountConfirmed.ToUnit(MoneyUnit.BTC);
155+
156+
this.Amount = this.Amount - this.Fee;
157+
}
151158
private void ChangePayToScript()
152159
{
153160
this.PayToScript = !this.PayToScript;
154161
}
155162

163+
public void MaxAmount()
164+
{
165+
var accountBalance = this.WalletManager.GetBalances(walletname, "account 0").Single();
166+
this.Amount = accountBalance.AmountConfirmed.ToDecimal(MoneyUnit.BTC) - this.Fee;
167+
}
168+
156169
private async Task Setup()
157170
{
158171
if (string.IsNullOrEmpty(this.Password)) { this.Alert = "Please enter a password"; return; }

src/Features/Blockcore.Features.ColdStaking/UI/Pages/ColdStakeEnableWallet.razor

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@
99
@inject NavigationManager NavigationManager
1010
@inject NodeDeployments NodeDeployments
1111

12-
@if (!NodeDeployments.GetFlags().ScriptFlags.HasFlag(ScriptVerify.CheckColdStakeVerify))
13-
{
14-
<h2>Cold staking is not activated</h2>
15-
return;
16-
}
17-
1812
<h2><strong>Enable cold staking on an existing wallet</strong></h2>
1913

2014
<div class="row ">

0 commit comments

Comments
 (0)