Skip to content

Commit

Permalink
[UPDATE] showing accounts with balance and address
Browse files Browse the repository at this point in the history
  • Loading branch information
iAmShorty committed Feb 13, 2014
1 parent 81b8b97 commit 224af2c
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 68 deletions.
15 changes: 13 additions & 2 deletions public/include/pages/admin/wallet.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,16 @@
$debug->append('No cached version available, fetching from backend', 3);
if ($bitcoin->can_connect() === true){
$dBalance = $bitcoin->getbalance();
$dAddresses = $bitcoin->getaddressesbyaccount('');

$dWalletAccounts = $bitcoin->listaccounts();
$dAddressCount = count($dWalletAccounts);

$dAccountAddresses = array();
foreach($dWalletAccounts as $key => $value)
{
$dAccountAddresses[$key] = $bitcoin->getaddressesbyaccount($key);
}

$aGetInfo = $bitcoin->getinfo();
if (is_array($aGetInfo) && array_key_exists('newmint', $aGetInfo)) {
$dNewmint = $aGetInfo['newmint'];
Expand All @@ -38,7 +47,9 @@
if (! $dColdCoins = $setting->getValue('wallet_cold_coins')) $dColdCoins = 0;
$smarty->assign("UNCONFIRMED", $dBlocksUnconfirmedBalance);
$smarty->assign("BALANCE", $dBalance);
$smarty->assign("ADDRESSES", $dAddresses);
$smarty->assign("ADDRESSCOUNT", $dAddressCount);
$smarty->assign("ACCOUNTADDRESSES", $dAccountAddresses);
$smarty->assign("ACCOUNTS", $dWalletAccounts);
$smarty->assign("COLDCOINS", $dColdCoins);
$smarty->assign("LOCKED", $dLockedBalance);
$smarty->assign("NEWMINT", $dNewmint);
Expand Down
145 changes: 79 additions & 66 deletions public/templates/mpos/admin/wallet/default.tpl
Original file line number Diff line number Diff line change
@@ -1,76 +1,89 @@
<article class="module width_quarter">
<header><h3>Balance Summary</h3></header>
<table width="25%" class="tablesorter" cellspacing="0">
<tr>
<td align="left">Wallet Balance</td>
<td align="left">{$BALANCE|number_format:"8"}</td>
</tr>
<tr>
<td align="left">Locked for users</td>
<td align="left">{$LOCKED|number_format:"8"}</td>
</tr>
<tr>
<td align="left">Unconfirmed</td>
<td align="left">{$UNCONFIRMED|number_format:"8"}</td>
</tr>
<tr>
<td align="left">Liquid Assets</td>
<td align="left">{($BALANCE - $LOCKED)|number_format:"8"}</td>
</tr>
<article class="module width_full">
<header><h3>Wallet Information - Number of Accounts in Wallet: {$ADDRESSCOUNT|default:"0"}</h3></header>

<article class="module width_quarter">
<header><h3>Balance Summary</h3></header>
<table width="25%" class="tablesorter" cellspacing="0">
<tr>
<td align="left">Wallet Balance</td>
<td align="left">{$BALANCE|number_format:"8"}</td>
</tr>
<tr>
<td align="left">Locked for users</td>
<td align="left">{$LOCKED|number_format:"8"}</td>
</tr>
<tr>
<td align="left">Unconfirmed</td>
<td align="left">{$UNCONFIRMED|number_format:"8"}</td>
</tr>
<tr>
<td align="left">Liquid Assets</td>
<td align="left">{($BALANCE - $LOCKED)|number_format:"8"}</td>
</tr>
{if $NEWMINT >= 0}
<tr>
<td align="left">PoS New Mint</td>
<td align="left">{$NEWMINT|number_format:"8"}</td>
</tr>
<tr>
<td align="left">PoS New Mint</td>
<td align="left">{$NEWMINT|number_format:"8"}</td>
</tr>
{/if}
</table>
</table>
</article>

<article class="module width_3_quarter">
<header><h3>Network Information</h3></header>
<table class="tablesorter" cellspacing="0">
<thead>
<th align="center">Version</th>
<th align="center">Protocol Version</th>
<th align="center">Wallet Version</th>
<th align="center">Connections</th>
<th align="center">Errors</th>
</thead>
<tbody>
<tr>
<td align="center">{$COININFO.version|default:""}</td>
<td align="center">{$COININFO.protocolversion|default:""}</td>
<td align="center">{$COININFO.walletversion|default:""}</td>
<td align="center">{$COININFO.connections|default:""}</td>
<td align="center"><font color="{if $COININFO.errors}red{else}green{/if}">{$COININFO.errors|default:"OK"}</font></td>
</tr>
</tbody>
</table>
</article>
</article>

<article class="module width_3_quarter">
<header><h3>Wallet Information</h3></header>
<table class="tablesorter" cellspacing="0">
<thead>
<th align="center">Version</th>
<th align="center">Protocol Version</th>
<th align="center">Wallet Version</th>
<th align="center">Connections</th>
<th align="center">Errors</th>
</thead>
<tbody>
{foreach key=NAME item=VALUE from=$ACCOUNTS}
<article class="module width_half">
<header><h3>Account: {$NAME|default:"Default"}</h3></header>
<article class="module width_half">
<header><h3>Balance Info</h3></header>
<table width="40%" class="tablesorter" cellspacing="0">
<tr>
<td align="center">{$COININFO.version|default:""}</td>
<td align="center">{$COININFO.protocolversion|default:""}</td>
<td align="center">{$COININFO.walletversion|default:""}</td>
<td align="center">{$COININFO.connections|default:""}</td>
<td align="center"><font color="{if $COININFO.errors}red{else}green{/if}">{$COININFO.errors|default:"OK"}</font></td>
<td align="left">Balance</td>
<td align="left">{$VALUE|number_format:"8"}</td>
</tr>
</tbody>
</table>
</table>
</article>

{foreach key=ACCOUNT item=ADDRESS from=$ACCOUNTADDRESSES}
{if $ACCOUNT == $NAME}
<article class="module width_3_quarter">
<header><h3>Addresses assigned to Account {$ACCOUNT|default:"Default"}</h3></header>
<table class="tablesorter" cellspacing="0">
<tbody>
{foreach from=$ACCOUNTADDRESSES[$ACCOUNT] key=ACCOUNT1 item=ADDRESS1}
<tr>
<td align="left" style="padding-right: 25px;">{$ADDRESS1}</td>
</tr>
{/foreach}
</tbody>
</table>
</article>
{/if}
{/foreach}

</article>
{/foreach}


<article class="width_half">
<!--
needed for showing below balance summary, because those modules are pretty dumb and auto-align
-->
<br /><br /><br /><br /><br /><br />
</article>

<article class="module width_quarter">
<header><h3>Addresses assigned to Default Wallet</h3></header>
<table class="tablesorter" cellspacing="0">
<thead>
<th align="center">#</th>
<th align="left">Address</th>
</thead>
<tbody>
{assign var=rank value=1}
{section address $ADDRESSES}
<tr>
<td align="center">{$rank++}</td>
<td align="left" style="padding-right: 25px;">{$ADDRESSES[address]}</td>
</tr>
{/section}
</tbody>
</table>
</article>

0 comments on commit 224af2c

Please sign in to comment.