decred: 0.8.0 rpc changes in stake, getbalance

This commit is contained in:
Tanguy Pruvot 2017-02-14 14:05:49 +01:00
parent 0bed2e0465
commit 9f3d194fd7
2 changed files with 22 additions and 4 deletions

View file

@ -179,7 +179,13 @@ if (!empty($info)) {
if ($DCR) {
// Decred Tickets
$stake = $remote->getbalance('*',0,'locked');
$stake = 0;
$balances = $remote->getbalance('*',0);
if (isset($balances["balances"])) {
foreach ($balances["balances"] as $accb) {
$stake += arraySafeVal($accb, 'lockedbytickets', 0);
}
}
$stakeinfo = $remote->getstakeinfo();
$ticketprice = arraySafeVal($stakeinfo,'difficulty');
$tickets = arraySafeVal($stakeinfo, 'live', 0);

View file

@ -15,7 +15,14 @@ $maxrows = arraySafeVal($_GET,'rows', 2500);
$remote = new WalletRPC($coin);
$info = $remote->getinfo();
$stakeinfo = $remote->getstakeinfo();
$locked = $remote->getbalance('*',0,'locked');
$balances = $remote->getbalance('*',0);
$locked = 0; $balance = 0;
if (isset($balances["balances"])) {
foreach ($balances["balances"] as $accb) {
$locked += arraySafeVal($accb, 'lockedbytickets', 0);
$balance += arraySafeVal($accb, 'spendable', 0);
}
}
echo getAdminSideBarLinks().'<br/><br/>';
echo getAdminWalletLinks($coin, $info, 'tickets').'<br/><br/>';
@ -37,7 +44,7 @@ div.form { text-align: right; height: 30px; width: 350px; float: right; margin-t
<div class="balance" style="display: block;">
Stake: </b>{$locked} {$coin->symbol}<br/>
Balance: </b>{$remote->getbalance()} {$coin->symbol}<br/>
Spendable: </b>{$balance} {$coin->symbol}<br/>
</div>
<div class="form">
@ -263,8 +270,13 @@ echo '<b>Tickets: </b>'.$stakeinfo['live'];
if ($stakeinfo['immature']) echo ' + '.$stakeinfo['immature'].' immature';
if ($stakeinfo['ownmempooltix']) echo ' + '.$stakeinfo['ownmempooltix'].' purchased';
echo '<br/>';
if (arraySafeVal($stakeinfo,'missed',false)) {
echo '<b>Missed: </b>'.arraySafeVal($stakeinfo,'missed', -1);
echo ' ('.arraySafeVal($stakeinfo,'revoked',0).' revoked';
echo ', '.arraySafeVal($stakeinfo,'expired',0).' expired';
echo ')<br/>';
}
echo '<b>Total won: </b>'.$stakeinfo['totalsubsidy'].' '.$coin->symbol.' ('.$stakeinfo['voted'].')<br/>';
if ($stakeinfo['missed']) echo '<b>Missed: </b>'.$stakeinfo['missed'].' '.$stakeinfo['revoked'].' revoked<br/>';
$staking = $remote->getgenerate() > 0 ? 'enabled' : 'disabled';
echo '<br/>';