Skip to content

Commit 9ed85ef

Browse files
Remove parameters after coins sent (#188)
* Remove parameters after send * Add spinner whilst withdrawing from coldstaking
1 parent 6c28848 commit 9ed85ef

2 files changed

Lines changed: 29 additions & 14 deletions

File tree

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

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,18 @@ var mainAccountBalance = this.WalletManager.GetBalances(walletname, "account 0")
115115
</div>
116116
<input @bind="Password" type="password" class="form-control bg-secondary text-light m-1" placeholder="Please enter your password" />
117117
</div>
118-
<div class="input-group mb-3">
119-
<button class="btn btn-primary" @onclick="Withdraw">Withdraw Now</button>
120-
</div>
118+
119+
@if (IsWithdrawing)
120+
{
121+
<button class="btn btn-danger ml-1" disabled>
122+
<span class="spinner-border spinner-border-sm"></span> Working ...
123+
</button>
124+
}
125+
else
126+
{
127+
<button class="btn btn-primary ml-1" @onclick="callWithdraw">Withdraw Now</button>
128+
}
129+
121130
<div class="input-group">
122131
<div class="text-danger">@Alert</div>
123132
</div>
@@ -167,6 +176,18 @@ var mainAccountBalance = this.WalletManager.GetBalances(walletname, "account 0")
167176
var accountBalance = this.WalletManager.GetBalances(walletname, "coldStakingColdAddresses").Single();
168177
this.Amount = accountBalance.AmountConfirmed.ToDecimal(MoneyUnit.BTC) - this.Fee;
169178
}
179+
180+
private bool IsWithdrawing { get; set; }
181+
private async Task callWithdraw()
182+
{
183+
IsWithdrawing = true;
184+
StateHasChanged();
185+
await Task.Delay(1); // flush changes
186+
await Withdraw();
187+
IsWithdrawing = false;
188+
StateHasChanged();
189+
await Task.Delay(1);
190+
}
170191
private async Task Withdraw()
171192
{
172193
if (string.IsNullOrEmpty(this.Password)) { this.Alert = "Please enter a password"; return; }

src/Features/Blockcore.Features.Wallet/UI/Pages/WalletSend.razor

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
<textarea @bind="TransactionHex" class="form-control bg-secondary text-light" rows="4">@TransactionHex</textarea>
123123
</div>
124124
</div>
125+
<button class="btn btn-primary mt-3" @onclick="() => { NavigateToWallet(walletname, accountname); }">View Wallet</button>
125126
</div>
126127
</div>
127128
}
@@ -136,21 +137,13 @@
136137
public string walletname { get; set; }
137138
[Parameter]
138139
public string accountname { get; set; }
139-
140140
private string Address { get; set; }
141-
142141
private decimal Amount { get; set; }
143-
144142
private decimal Fee { get; set; }
145-
146143
private string Password { get; set; }
147-
148144
uint256 SentTransactionHash { get; set; }
149-
150145
string TransactionHex { get; set; }
151-
152146
string Alert { get; set; }
153-
154147
string Success { get; set; }
155148
protected override void OnInitialized()
156149
{
@@ -280,9 +273,11 @@
280273
this.Alert = ex.Message;
281274
return;
282275
}
283-
276+
this.Password = "";
277+
this.Address = "";
278+
this.Amount = 0;
279+
this.Fee = 0;
284280
this.Success = "Coins sent. TransactionID: " + this.SentTransactionHash;
285-
286281
}
287282
private void NavigateToBroadcastTx(string walletName, string accountname)
288283
{
@@ -300,7 +295,6 @@
300295
{
301296
NavigationManager.NavigateTo("walletsend/" + walletName + "/" + accountname);
302297
}
303-
304298
private void OnSelected(string selection)
305299
{
306300
Console.WriteLine(selection);

0 commit comments

Comments
 (0)