Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
4aa15c5
Split create & recover wallet
thecrypt0hunter May 12, 2020
642f84b
Rename peer nodes to add nodes
thecrypt0hunter May 12, 2020
bb1a938
Improve error messages, fix some typos
thecrypt0hunter May 12, 2020
724694b
Remove breadcrumbs & fix tx address bug
thecrypt0hunter May 12, 2020
b28d5ce
Even up the labels
thecrypt0hunter May 13, 2020
3b44649
Merge master
dangershony May 14, 2020
7029182
Merge branch 'master' of https://github.com/thecrypt0hunter/blockcore…
dangershony May 14, 2020
dc9d98a
Merge pull request #1 from block-core/master
thecrypt0hunter May 15, 2020
e196441
Update to latest
thecrypt0hunter May 24, 2020
9662386
Update favicon
thecrypt0hunter May 24, 2020
cdc0870
Update staking UI
thecrypt0hunter May 24, 2020
2fd15c3
Merge index & peers, update UI
thecrypt0hunter May 24, 2020
bd0cbcf
Update Wallet UI
thecrypt0hunter May 24, 2020
4e721a7
Update Coldstake UI, Add CS History & CD Delegate
thecrypt0hunter May 24, 2020
645b149
Update favicon
thecrypt0hunter May 24, 2020
ec6d454
Update staking UI
thecrypt0hunter May 24, 2020
79ad189
Merge index & peers, update UI
thecrypt0hunter May 24, 2020
2d8dc00
Update Wallet UI
thecrypt0hunter May 24, 2020
458f88c
Update Coldstake UI, Add CS History & CD Delegate
thecrypt0hunter May 24, 2020
44f7628
Merge branch 'master-blockcore' into pr/131-ui-updates
dangershony May 24, 2020
c5a0810
Merge branch 'master' into uiupdates
thecrypt0hunter May 25, 2020
29752fe
Add timestamp to tx history + button spaces
thecrypt0hunter May 25, 2020
a4465e2
Add button spacing
thecrypt0hunter May 25, 2020
9f1fdb4
Merge branch 'uiupdates' of https://github.com/thecrypt0hunter/blockc…
dangershony May 25, 2020
ed6ecc6
Fixed timestamp format
thecrypt0hunter May 25, 2020
3aff23a
Merge branch 'uiupdates' of https://github.com/thecrypt0hunter/blockc…
dangershony May 25, 2020
b427f9b
Hide wallets not enable & show enable button
thecrypt0hunter May 26, 2020
689e8da
Add check for empty nodeip & add error
thecrypt0hunter May 26, 2020
2f5cf79
Fix double spaced table
thecrypt0hunter May 26, 2020
0094690
Only show account not enabled
thecrypt0hunter May 26, 2020
d355bd5
fix display issue on table
thecrypt0hunter May 26, 2020
d9475eb
enable copy to clipboard for receiving addresses
thecrypt0hunter May 26, 2020
aa69ef3
Only CS enabled accounts available as hot wallet
thecrypt0hunter May 26, 2020
815cad4
Merge branch 'uiupdates' of https://github.com/thecrypt0hunter/blockc…
dangershony May 26, 2020
4435302
fix enable cold stake page by removing dropdown
thecrypt0hunter May 26, 2020
4c8b147
Merge branch 'uiupdates' of https://github.com/thecrypt0hunter/blockc…
dangershony May 26, 2020
dba6bb8
Add alrert to coldstaking enable page
dangershony May 26, 2020
1d5893f
Merge branch 'master' of github.com:block-core/blockcore
thecrypt0hunter May 27, 2020
f7b2356
Merge branch 'master' into uiupdates
thecrypt0hunter May 27, 2020
6148771
Attempt to disable fee checks to test xds
dangershony May 28, 2020
132a745
Merge branch 'uiupdates' of github.com:thecrypt0hunter/blockcore into…
thecrypt0hunter May 28, 2020
8765ebe
Improve IBD message
thecrypt0hunter May 28, 2020
55fc5df
Update src/Features/Blockcore.Features.NodeHost/UI/Pages/Index.razor
thecrypt0hunter May 28, 2020
20d904d
Merge branch 'master' of github.com:block-core/blockcore
thecrypt0hunter May 28, 2020
bf6ec35
Merge branch 'master' into uiupdates
thecrypt0hunter May 28, 2020
be8dac3
Fix issue with IBD message
thecrypt0hunter May 28, 2020
5693508
Stop dupe buttons appearing to enable cold staking
thecrypt0hunter May 28, 2020
23695ab
Enable drop down on cold stake enable wallet page
thecrypt0hunter May 28, 2020
31323b3
fix for a single unenabled wallet
thecrypt0hunter May 28, 2020
8500053
Revert fee check
dangershony May 28, 2020
4adacf2
Merge branch 'uiupdates' of https://github.com/thecrypt0hunter/blockc…
dangershony May 28, 2020
91168f8
Merge branch 'master' of github.com:block-core/blockcore
thecrypt0hunter May 29, 2020
bcf9c82
Merge branch 'master' into uiupdates
thecrypt0hunter May 29, 2020
98b47d1
Add total node balance
thecrypt0hunter May 31, 2020
9a9bd2a
Merge branch 'uiupdates' of github.com:thecrypt0hunter/blockcore into…
thecrypt0hunter May 31, 2020
2040c92
Merge branch 'master' of github.com:block-core/blockcore
thecrypt0hunter May 31, 2020
468688b
Merge branch 'master' into uiupdates
thecrypt0hunter May 31, 2020
ee58de1
add dynamic menu icon
thecrypt0hunter May 31, 2020
ac2eea6
Rework UI as dark mode
thecrypt0hunter May 31, 2020
2b694bd
Add redirection after tx broadcast
thecrypt0hunter Jun 1, 2020
4265286
Remove tx hex & add redirection
thecrypt0hunter Jun 1, 2020
f2510c8
UI tweaks
thecrypt0hunter Jun 1, 2020
4f6f37a
Add referenc for menu icons
thecrypt0hunter Jun 1, 2020
f74457e
ensure menu not broken with long wallet names
thecrypt0hunter Jun 1, 2020
6cc443c
change icon for cold staking
thecrypt0hunter Jun 1, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -265,3 +265,6 @@ src/.idea/.idea.Stratis.Bitcoin.FullNode/.idea/
*.iml
/src/.idea
/src/Blockcore.Benchmark/BenchmarkDotNet.Artifacts/results
.vscode/launch.json
.vscode/tasks.json
.gitignore
2 changes: 1 addition & 1 deletion src/Blockcore/Interfaces/UI/INavigationItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Blockcore.Interfaces.UI
public interface INavigationItem
{
public string Name { get; }

public string Navigation { get; }
public string Icon { get; }
}
}
2 changes: 1 addition & 1 deletion src/Features/Blockcore.Features.ColdStaking/UI/NavItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Blockcore.Features.Wallet.UI
public class ColdStakingNavigationItem : INavigationItem
{
public string Name => "Cold Staking";

public string Navigation => "ColdStaking";
public string Icon => "oi-pulse";
}
}
278 changes: 157 additions & 121 deletions src/Features/Blockcore.Features.ColdStaking/UI/Pages/ColdStake.razor
Original file line number Diff line number Diff line change
Expand Up @@ -8,154 +8,182 @@
@inject IWalletManager WalletManager
@inject NavigationManager NavigationManager
@inject NodeDeployments NodeDeployments
@inject Network Network

@if (!NodeDeployments.GetFlags().ScriptFlags.HasFlag(ScriptVerify.CheckColdStakeVerify))
{
<h2>Cold staking is not activated</h2>
return;
}

<h2>Cold staking wallets</h2>

<p>Enable cold staking on an existing wallet.</p>

<hr />
<div class="input-group mb-3">
<div class="input-group-prepend">
<span style="min-width: 10em" class="input-group-text" id="basic-addon1">Wallet Name:</span>
</div>
<input @bind="WalletName" type="text" class="form-control" placeholder="wallet name" />
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pb-2 mb-3 border-bottom">
<h1 class="h2"><strong>Cold Staking</strong></h1>
<div class="btn-toolbar mb-2 mb-md-0">
@foreach (var walletName in this.WalletManager.GetWalletsNames()) {
var coldStakingWalletEnabled = ColdStakingManager.GetColdStakingAccount(this.WalletManager.GetWallet(walletName), true);
if (coldStakingWalletEnabled != null) {} else {
<button class="btn btn-sm btn-primary" @onclick="() => { NavigateToEnableWallet(); }">Enable Cold Staking</button>
break;
}
}
</div>

<div class="input-group mb-3">
<div class="input-group-prepend">
<span style="min-width: 10em" class="input-group-text">Password:</span>
</div>
@{
<div class="row mb-3">
<div class="col-xl-6 col-sm-6 grid-margin stretch-card">
<div class="card">
<div class="card-body">
<h5>Main Balance</h5>
<div class="row">
<div class="col-12">
<div class="d-flex align-items-center align-self-start">
<h3 class="text-left">@totalBalance().balance </h3>
<p class="text-success ml-2 mb-0 font-weight-medium">@this.Network.CoinTicker.ToUpper()</p>
</div>
</div>
</div>
<h6 class="text-left text-muted font-weight-normal">@totalUnconfirmedBalance().balance (unconfirmed)</h6>
</div>
</div>
<input @bind="Password" type="password" class="form-control" placeholder="password" />
</div>

<div class="input-group mb-3">
<button class="btn btn-info" @onclick="CreateColdStakeAccount">Create account</button>
<div class="col-xl-6 col-sm-6 grid-margin stretch-card">
<div class="card">
<div class="card-body">
<h5>Cold Balance</h5>
<div class="row">
<div class="col-12">
<div class="d-flex align-items-center align-self-start">
<h3 class="text-left">@totalBalance().coldBalance </h3>
<p class="text-success ml-2 mb-0 font-weight-medium">@this.Network.CoinTicker.ToUpper()</p>
</div>
</div>
</div>
<h6 class="text-left text-muted font-weight-normal">@totalUnconfirmedBalance().coldBalance (unconfirmed)</h6>
</div>
</div>
</div>
<hr />

<p>Information about the deployed wallets.</p>

@{
<table class="table">
<thead>
<tr>
<th>Wallet / Account</th>
<th>Confirmed balance</th>
<th>Unconfirmed balance</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@{
foreach (var walletName in this.WalletManager.GetWalletsNames())
{
var coldStakingAccount = ColdStakingManager.GetColdStakingAccount(this.WalletManager.GetWallet(walletName), true);
if (coldStakingAccount != null)
{
var coldAccountBalance = ColdStakingManager.GetBalances(walletName, coldStakingAccount.Name).Single();

<tr title="Withdraw">
<td> @walletName <strong>/</strong> @coldStakingAccount.Name</td>
<td>@coldAccountBalance.AmountConfirmed</td>
<td>@coldAccountBalance.AmountUnconfirmed</td>
<td>
@if (coldAccountBalance.AmountConfirmed + coldAccountBalance.AmountUnconfirmed > 0)
{
<button class="btn btn-link btn-sm" @onclick="() => { NavigateToWithdraw(walletName); }">Withdraw</button>
</div>

<div class="row ">
<div class="col-12 grid-margin">
<div class="card">
<div class="card-body">
<h4 class="card-title">Balances</h4>
<div class="table-responsive">
<table class="table table-border-bottom table-striped table-sm table-hover">
<thead class="thead">
<tr>
<th>Wallet</th>
<th>Account balance</th>
<th>Cold balance</th>
<th>Hot balance</th>
</tr>
</thead>
<tbody>
@foreach (var walletName in this.WalletManager.GetWalletsNames()) {

var coldStakingWalletEnabled = ColdStakingManager.GetColdStakingAccount(this.WalletManager.GetWallet(walletName), true);
if (coldStakingWalletEnabled != null) {
<tr @onclick="() => { NavigateToColdStakeView(walletName); }" >
<td>@walletName</td>
@foreach (var account in this.WalletManager.GetAccounts(walletName)) {

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

@if (@accountBalance.AmountUnconfirmed >0) {
<td>@accountBalance.AmountConfirmed (@accountBalance.AmountUnconfirmed )</td>
} else {
<td>@accountBalance.AmountConfirmed</td>
}

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

if (coldStakingAccount != null) {
var coldAccountBalance = ColdStakingManager.GetBalances(walletName, coldStakingAccount.Name).Single();
@if (@coldAccountBalance.AmountUnconfirmed >0) {
<td>@coldAccountBalance.AmountConfirmed (@coldAccountBalance.AmountUnconfirmed )</td>
} else {
<td>@coldAccountBalance.AmountConfirmed</td>
}
}

var hotStakingAccount = ColdStakingManager.GetColdStakingAccount(this.WalletManager.GetWallet(walletName), false);

if (hotStakingAccount != null) {
var hotAccountBalance = ColdStakingManager.GetBalances(walletName, hotStakingAccount.Name).Single();
@if (@hotAccountBalance.AmountUnconfirmed >0) {
<td>@hotAccountBalance.AmountConfirmed (@hotAccountBalance.AmountUnconfirmed )</td>
} else {
<td>@hotAccountBalance.AmountConfirmed</td>
}
}
}
</td>
</tr>
}
else
{
<tr>
<td>@walletName</td>
<td>-</td>
<td>-</td>
<td>-</td>
</tr>
}

var hotStakingAccount = ColdStakingManager.GetColdStakingAccount(this.WalletManager.GetWallet(walletName), false);
if (hotStakingAccount != null)
{
var hotAccountBalance = ColdStakingManager.GetBalances(walletName, hotStakingAccount.Name).Single();

<tr>
<td> @walletName <strong>/</strong> @hotStakingAccount.Name</td>
<td>@hotAccountBalance.AmountConfirmed</td>
<td>@hotAccountBalance.AmountUnconfirmed</td>
<td>
</td>
</tr>
}
else
{
<tr>
<td>@walletName</td>
<td>-</td>
<td>-</td>
<td>-</td>
</tr>
}

foreach (var account in this.WalletManager.GetAccounts(walletName))
{
var accountBalance = this.WalletManager.GetBalances(walletName, account.Name).Single();

<tr>
<td> @walletName <strong>/</strong> @account.Name</td>
<td>@accountBalance.AmountConfirmed</td>
<td>@accountBalance.AmountUnconfirmed</td>
<td>
@if (accountBalance.AmountConfirmed + accountBalance.AmountUnconfirmed > 0)
{
<button class="btn btn-link btn-sm" @onclick="() => { NavigateToSetup(walletName); }">Delegate</button>
}
</td>
</tr>
}
}
}
</tbody>
</table>
</tr>
}
}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
}

@code
{
ColdStakingManager ColdStakingManager;

string Alert { get; set; }

private string WalletName { get; set; }

private string Password { get; set; }

public bool IsColdWalletAccount { get; set; }

protected override Task OnInitializedAsync()
{
ColdStakingManager = this.WalletManager as ColdStakingManager;

return Task.CompletedTask;
}

private void CreateColdStakeAccount()
private (dynamic balance, dynamic coldBalance) totalBalance()
{
if (string.IsNullOrEmpty(this.Password)) { this.Alert = "Please enter a password"; return; }
if (string.IsNullOrEmpty(this.WalletName)) { this.Alert = "Please enter a wallet name"; return; }
this.Alert = string.Empty;
dynamic balance = 0;
dynamic coldBalance = 0;
foreach (var walletName in this.WalletManager.GetWalletsNames())
{
foreach (var account in this.WalletManager.GetAccounts(walletName))
{
var accountBalance = this.WalletManager.GetBalances(walletName, account.Name).Single();
balance = balance + accountBalance.AmountConfirmed;

this.ColdStakingManager.GetOrCreateColdStakingAccount(this.WalletName, true, this.Password);
this.ColdStakingManager.GetOrCreateColdStakingAccount(this.WalletName, false, this.Password);
var coldStakingAccount = ColdStakingManager.GetColdStakingAccount(this.WalletManager.GetWallet(walletName), true);
if (coldStakingAccount != null) {
var coldAccountBalance = ColdStakingManager.GetBalances(walletName, coldStakingAccount.Name).Single();
coldBalance = coldBalance + coldAccountBalance.AmountConfirmed;
}
}
}
return (balance,coldBalance);
}

private (dynamic balance, dynamic coldBalance) totalUnconfirmedBalance()
{
dynamic balance = 0;
dynamic coldBalance = 0;
foreach (var walletName in this.WalletManager.GetWalletsNames())
{
foreach (var account in this.WalletManager.GetAccounts(walletName))
{
var accountBalance = this.WalletManager.GetBalances(walletName, account.Name).Single();
balance = balance + accountBalance.AmountUnconfirmed;

var coldStakingAccount = ColdStakingManager.GetColdStakingAccount(this.WalletManager.GetWallet(walletName), true);
if (coldStakingAccount != null) {
var coldAccountBalance = ColdStakingManager.GetBalances(walletName, coldStakingAccount.Name).Single();
coldBalance = coldBalance + coldAccountBalance.AmountUnconfirmed;
}
}
}
return (balance,coldBalance);
}
private void NavigateToEnableWallet()
{
NavigationManager.NavigateTo("coldstaking-enablewallet");
}
private void NavigateToWithdraw(string walletName)
{
NavigationManager.NavigateTo("coldstaking-withdraw/" + walletName);
Expand All @@ -165,4 +193,12 @@
{
NavigationManager.NavigateTo("coldstaking-setup/" + walletName);
}
private void NavigateToDelegate(string walletName)
{
NavigationManager.NavigateTo("coldstaking-delegate/" + walletName);
}
private void NavigateToColdStakeView(string walletName)
{
NavigationManager.NavigateTo("coldstakeview/" + walletName + "/coldStakingColdAddresses");
}
}
Loading