Layout changes - display receive address
This commit is contained in:
@@ -49,7 +49,8 @@ public:
|
|||||||
_SiaApiError Lock();
|
_SiaApiError Lock();
|
||||||
_SiaApiError Unlock(const String& password);
|
_SiaApiError Unlock(const String& password);
|
||||||
_SiaApiError GetConfirmedBalance(SiaCurrency& balance) const;
|
_SiaApiError GetConfirmedBalance(SiaCurrency& balance) const;
|
||||||
_SiaApiError GetUnonfirmedBalance(SiaCurrency& balance) const;
|
_SiaApiError GetUnonfirmedBalance(SiaCurrency& balance) const;
|
||||||
|
_SiaApiError GetAddress(String& address) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AFX_EXT_CLASS _CSiaRenter
|
class AFX_EXT_CLASS _CSiaRenter
|
||||||
|
@@ -157,5 +157,21 @@ SiaApiError CSiaApi::_CSiaWallet::GetUnonfirmedBalance(SiaCurrency& balance) con
|
|||||||
ret = SiaApiError::Success;
|
ret = SiaApiError::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
SiaApiError CSiaApi::_CSiaWallet::GetAddress(String& address) const
|
||||||
|
{
|
||||||
|
SiaApiError ret = SiaApiError::RequestError;
|
||||||
|
address = L"";
|
||||||
|
|
||||||
|
json result;
|
||||||
|
SiaCurlError cerror = _siaCurl.Get(L"/wallet/address", result);
|
||||||
|
if (API_SUCCESS(SiaCurlError, cerror))
|
||||||
|
{
|
||||||
|
address = CA2W(result["address"].get<std::string>().c_str());
|
||||||
|
ret = SiaApiError::Success;
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
@@ -1,91 +1,96 @@
|
|||||||
<HTML>
|
<HTML>
|
||||||
<HEAD>
|
<HEAD>
|
||||||
</HEAD>
|
</HEAD>
|
||||||
<BODY ID=CSiaDriveDlg BGCOLOR=LIGHTGREY style="font-family: MS Shell Dlg; font-size:14">
|
<BODY ID=CSiaDriveDlg BGCOLOR=LIGHTGREY style="font-family: MS Shell Dlg; font-size: 14">
|
||||||
<div style="float: right;">
|
<h3 style="margin-bottom: 5px">Sia Information</h3>
|
||||||
<table>
|
<div style="float: right;">
|
||||||
<tr>
|
<table>
|
||||||
<td style="text-align: right">Client Version:</td>
|
<tr>
|
||||||
<td id="ClientVersion"></td>
|
<td style="text-align: right">Client Version:</td>
|
||||||
</tr>
|
<td id="ClientVersion"></td>
|
||||||
<tr>
|
</tr>
|
||||||
<td style="text-align: right">Server Version:</td>
|
<tr>
|
||||||
<td id="ServerVersion"></td>
|
<td style="text-align: right">Server Version:</td>
|
||||||
</tr>
|
<td id="ServerVersion"></td>
|
||||||
</table>
|
</tr>
|
||||||
</div>
|
</table>
|
||||||
<div>
|
</div>
|
||||||
<table>
|
<div>
|
||||||
<tr>
|
<table>
|
||||||
<td style="text-align: right">Available:</td>
|
<tr>
|
||||||
<td id="WalletBalanceConfirmed"></td>
|
<td style="text-align: right">Available:</td>
|
||||||
</tr>
|
<td id="WalletBalanceConfirmed"></td>
|
||||||
<tr>
|
</tr>
|
||||||
<td style="text-align: right">Pending:</td>
|
<tr>
|
||||||
<td id="WalletBalanceUnconfirmed"></td>
|
<td style="text-align: right">Pending:</td>
|
||||||
</tr>
|
<td id="WalletBalanceUnconfirmed"></td>
|
||||||
<tr>
|
</tr>
|
||||||
<td style="text-align: right">Total:</td>
|
<tr>
|
||||||
<td id="WalletBalanceTotal"></td>
|
<td style="text-align: right">Total:</td>
|
||||||
</tr>
|
<td id="WalletBalanceTotal"></td>
|
||||||
</table>
|
</tr>
|
||||||
</div>
|
</table>
|
||||||
<div id="main_window" style="padding: 10">
|
</div>
|
||||||
|
|
||||||
</div>
|
|
||||||
<div style="position: absolute; bottom: 10; left: 10;width: 100%">
|
|
||||||
<table width="100%">
|
|
||||||
<TR width=100%">
|
|
||||||
<TD ALIGN=RIGHT VALIGN=BOTTOM>
|
|
||||||
<BUTTON STYLE="WIDTH: 100" ID="ButtonOK">OK</BUTTON> <BUTTON STYLE="WIDTH: 100" ID="ButtonCancel">Exit</BUTTON>
|
|
||||||
</TD>
|
|
||||||
</TR>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="exit_window" style="display: none" align="center">
|
<div id="main_window" style="padding: 0">
|
||||||
<BUTTON STYLE="WIDTH: 100" ID="ExitYes">Yes</BUTTON> <BUTTON STYLE="WIDTH: 100" ID="ExitNo">No</BUTTON>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="create_wallet" style="display: none">
|
</div>
|
||||||
<h3>Create New Wallet</h3>
|
|
||||||
<p>Click 'Create' to create a new Sia wallet or exit the application if this is not what you want to do.</p>
|
|
||||||
<button ID="CreateWalletButton">Create</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="unlock_wallet" style="display: none" width="100%">
|
<div style="position: absolute; bottom: 10; left: 10; width: 100%">
|
||||||
<h3>Unlock Wallet</h3>
|
<table width="100%">
|
||||||
<p>Enter wallet password and click 'Unlock' to continue.</p>
|
<TR width=100%">
|
||||||
<input type="password" id="WalletUnlockPwd" style="width: 100%"/><br /><br />
|
<TD ALIGN=RIGHT VALIGN=BOTTOM>
|
||||||
<button ID="UnlockWalletButton">Unlock</button>
|
<BUTTON STYLE="WIDTH: 100" ID="ButtonOK">OK</BUTTON> <BUTTON STYLE="WIDTH: 100" ID="ButtonCancel">Exit</BUTTON>
|
||||||
</div>
|
</TD>
|
||||||
|
</TR>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div width="100%" id="disp_wallet_seed" style="display: none">
|
<div id="exit_window" style="display: none" align="center">
|
||||||
<h3>Wallet Created</h3>
|
<BUTTON STYLE="WIDTH: 100" ID="ExitYes">Yes</BUTTON> <BUTTON STYLE="WIDTH: 100" ID="ExitNo">No</BUTTON>
|
||||||
<p>Please save the following seed. You will need this to unlock and/or restore your wallet. Click 'Done' once you've backed-up your seed.</p>
|
</div>
|
||||||
<textarea rows=4 cols=60 width="100%" id="WalletCreatedSeed"></textarea><br/><br/>
|
|
||||||
<button ID="ConfirmSeedButton">Done</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="tab_page" style="display: none">
|
<div id="create_wallet" style="display: none">
|
||||||
<TABLE WIDTH=100%>
|
<h3 style="margin-bottom: 5px">Create New Wallet</h3>
|
||||||
<TR WIDTH=100%>
|
<p style="margin-top: 0">Click 'Create' to create a new Sia wallet or exit the application if this is not what you want to do.</p>
|
||||||
<TD ALIGN=LEFT VALIGN=TOP>
|
<button ID="CreateWalletButton">Create</button>
|
||||||
<input id="wallet_btn" type="button" value="Wallet"/>
|
</div>
|
||||||
<input id="host_btn" type="button" value="Host"/>
|
|
||||||
<input id="mount_btn" type="button" value="Mount"/>
|
|
||||||
</TD>
|
|
||||||
</TR>
|
|
||||||
<tr width="100%" align="center" valign="top">
|
|
||||||
<div id="tab_page"></div>
|
|
||||||
</tr>
|
|
||||||
</TABLE>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="wallet_tab" style="display: none"></div>
|
<div id="unlock_wallet" style="display: none" width="100%">
|
||||||
|
<h3 style="margin-bottom: 5px">Unlock Wallet</h3>
|
||||||
|
<p style="margin-top: 0">Enter wallet password and click 'Unlock' to continue.</p>
|
||||||
|
<input type="password" id="WalletUnlockPwd" style="width: 100%"/><br/><br/>
|
||||||
|
<button ID="UnlockWalletButton">Unlock</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="host_tab" style="display: none"></div>
|
<div width="100%" id="disp_wallet_seed" style="display: none">
|
||||||
|
<h3 style="margin-bottom: 5px">Wallet Created</h3>
|
||||||
<div id="mount_tab" style="display: none"></div>
|
<p style="margin-top: 0">Please save the following seed. You will need this to unlock and/or restore your wallet. Click 'Done' once you've backed-up your seed.</p>
|
||||||
|
<textarea rows=4 cols=60 width="100%" id="WalletCreatedSeed"></textarea><br/><br/>
|
||||||
|
<button ID="ConfirmSeedButton">Done</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="tab_view" style="display: none">
|
||||||
|
<h3 style="margin-bottom: 5px">Receive Address</h3>
|
||||||
|
<label id="WalletAddress"></label><br/><br/>
|
||||||
|
<TABLE WIDTH=100%>
|
||||||
|
<TR WIDTH=100%>
|
||||||
|
<TD ALIGN=CENTER VALIGN=TOP>
|
||||||
|
<input id="wallet_btn" type="button" value="Wallet"/>
|
||||||
|
<input id="host_btn" type="button" value="Host"/>
|
||||||
|
<input id="mount_btn" type="button" value="Mount"/>
|
||||||
|
</TD>
|
||||||
|
</TR>
|
||||||
|
<tr width="100%" align="center" valign="top">
|
||||||
|
<div id="tab_page"></div>
|
||||||
|
</tr>
|
||||||
|
</TABLE>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="wallet_tab" style="display: none"></div>
|
||||||
|
|
||||||
|
<div id="host_tab" style="display: none"></div>
|
||||||
|
|
||||||
|
<div id="mount_tab" style="display: none"></div>
|
||||||
</BODY>
|
</BODY>
|
||||||
</HTML>
|
</HTML>
|
||||||
|
Binary file not shown.
@@ -79,6 +79,7 @@ void CSiaDriveDlg::DoDataExchange(CDataExchange* pDX)
|
|||||||
DDX_DHtml_ElementInnerText(pDX, _T("WalletBalanceTotal"), _walletBalanceTotal);
|
DDX_DHtml_ElementInnerText(pDX, _T("WalletBalanceTotal"), _walletBalanceTotal);
|
||||||
DDX_DHtml_ElementInnerText(pDX, _T("WalletBalanceConfirmed"), _walletBalanceConfirmed);
|
DDX_DHtml_ElementInnerText(pDX, _T("WalletBalanceConfirmed"), _walletBalanceConfirmed);
|
||||||
DDX_DHtml_ElementInnerText(pDX, _T("WalletBalanceUnconfirmed"), _walletBalanceUnconfirmed);
|
DDX_DHtml_ElementInnerText(pDX, _T("WalletBalanceUnconfirmed"), _walletBalanceUnconfirmed);
|
||||||
|
DDX_DHtml_ElementInnerText(pDX, _T("WalletAddress"), _walletAddress);
|
||||||
DDX_DHtml_ElementInnerText(pDX, _T("WalletCreatedSeed"), _walletCreatedSeed);
|
DDX_DHtml_ElementInnerText(pDX, _T("WalletCreatedSeed"), _walletCreatedSeed);
|
||||||
DDX_DHtml_ElementValue(pDX, _T("WalletUnlockPwd"), _unlockWalletPwd);
|
DDX_DHtml_ElementValue(pDX, _T("WalletUnlockPwd"), _unlockWalletPwd);
|
||||||
}
|
}
|
||||||
@@ -247,19 +248,13 @@ void CSiaDriveDlg::OnDocumentComplete(LPDISPATCH, LPCTSTR)
|
|||||||
_walletBalanceConfirmed = L"";
|
_walletBalanceConfirmed = L"";
|
||||||
_walletBalanceUnconfirmed = L"";
|
_walletBalanceUnconfirmed = L"";
|
||||||
_walletBalanceTotal = L"";
|
_walletBalanceTotal = L"";
|
||||||
|
_walletAddress = L"";
|
||||||
|
|
||||||
SetTimer(IDT_UPDATE, 2000, nullptr);
|
SetTimer(IDT_UPDATE, 2000, nullptr);
|
||||||
|
|
||||||
if ((_connected = UpdateUi(false)))
|
if ((_connected = UpdateUi(false)))
|
||||||
{
|
{
|
||||||
switch (_siaConfig.GetUI_Main_TabIndex())
|
ConfigureWallet();
|
||||||
{
|
|
||||||
case WALLET_TAB:
|
|
||||||
{
|
|
||||||
DisplayWalletTab();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -293,11 +288,17 @@ bool CSiaDriveDlg::UpdateSiaInfo()
|
|||||||
if (API_SUCCESS(SiaApiError, _siaApi.GetWallet()->GetUnonfirmedBalance(unconfirmed)))
|
if (API_SUCCESS(SiaApiError, _siaApi.GetWallet()->GetUnonfirmedBalance(unconfirmed)))
|
||||||
{
|
{
|
||||||
SiaCurrency total = confirmed + unconfirmed;
|
SiaCurrency total = confirmed + unconfirmed;
|
||||||
|
|
||||||
_walletBalanceConfirmed = SiaCurrencyToString(confirmed).c_str();
|
_walletBalanceConfirmed = SiaCurrencyToString(confirmed).c_str();
|
||||||
_walletBalanceUnconfirmed = SiaCurrencyToString(unconfirmed).c_str();
|
_walletBalanceUnconfirmed = SiaCurrencyToString(unconfirmed).c_str();
|
||||||
_walletBalanceTotal = SiaCurrencyToString(total).c_str();
|
_walletBalanceTotal = SiaCurrencyToString(total).c_str();
|
||||||
|
|
||||||
|
if (!_walletAddress.GetLength())
|
||||||
|
{
|
||||||
|
String address;
|
||||||
|
_siaApi.GetWallet()->GetAddress(address);
|
||||||
|
_walletAddress = address.c_str();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -305,7 +306,7 @@ bool CSiaDriveDlg::UpdateSiaInfo()
|
|||||||
}
|
}
|
||||||
|
|
||||||
_serverVersion = L"x.x.x";
|
_serverVersion = L"x.x.x";
|
||||||
_walletBalanceConfirmed = _walletBalanceUnconfirmed = _walletBalanceTotal = L"";
|
_walletAddress = _walletBalanceConfirmed = _walletBalanceUnconfirmed = _walletBalanceTotal = L"";
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -377,7 +378,7 @@ void CSiaDriveDlg::DisplayCreateWallet()
|
|||||||
SetMainWindow(L"create_wallet");
|
SetMainWindow(L"create_wallet");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSiaDriveDlg::DisplayWalletTab()
|
void CSiaDriveDlg::ConfigureWallet()
|
||||||
{
|
{
|
||||||
if (_siaApi.GetWallet()->GetCreated())
|
if (_siaApi.GetWallet()->GetCreated())
|
||||||
{
|
{
|
||||||
@@ -388,7 +389,16 @@ void CSiaDriveDlg::DisplayWalletTab()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
SetMainWindow(L"tab_view");
|
||||||
|
|
||||||
|
switch (_siaConfig.GetUI_Main_TabIndex())
|
||||||
|
{
|
||||||
|
case WALLET_TAB:
|
||||||
|
{
|
||||||
|
//DisplayWalletTab();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -50,7 +50,7 @@ private:
|
|||||||
void DisplaySeedCreated(const String& seed);
|
void DisplaySeedCreated(const String& seed);
|
||||||
bool UpdateSiaInfo();
|
bool UpdateSiaInfo();
|
||||||
void DisplayUnlockWallet();
|
void DisplayUnlockWallet();
|
||||||
void DisplayWalletTab();
|
void ConfigureWallet();
|
||||||
void RemoveCreateWalletItems();
|
void RemoveCreateWalletItems();
|
||||||
void RemoveDomNodeById(const String& id);
|
void RemoveDomNodeById(const String& id);
|
||||||
void SetMainWindow(const String& name);
|
void SetMainWindow(const String& name);
|
||||||
@@ -67,6 +67,7 @@ private:
|
|||||||
CString _walletBalanceTotal;
|
CString _walletBalanceTotal;
|
||||||
CString _walletBalanceUnconfirmed;
|
CString _walletBalanceUnconfirmed;
|
||||||
CString _walletCreatedSeed;
|
CString _walletCreatedSeed;
|
||||||
|
CString _walletAddress;
|
||||||
CString _unlockWalletPwd;
|
CString _unlockWalletPwd;
|
||||||
bool _connected = false;
|
bool _connected = false;
|
||||||
bool _seedCreation = false;
|
bool _seedCreation = false;
|
||||||
|
Reference in New Issue
Block a user