add lbc image, fix wallet balance

This commit is contained in:
Lem Smyth 2022-01-25 14:27:12 -06:00
parent 1858cae047
commit cb2239e403
3 changed files with 10 additions and 7 deletions

BIN
admin/images/lbc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View file

@ -69,15 +69,17 @@ class LBRY_Daemon
/**
* Returns the available balance of a current LBRY account
* https://lbry.tech/api/sdk#account_balance
* https://lbry.tech/api/sdk#wallet_balance
* @param string $address Wallet Address
* @return float Wallet Balance
* @return array $wallet_balance Wallet Balance
*
*/
public function wallet_balance()
{
try {
$result = $this->request('account_balance');
return $result->result->available;
try { // Convert JSON string to an object
$result = $this->request('wallet_balance');
return $result;
$wallet_balance = $result;
} catch (LBRYDaemonException $e) {
$this->logger->log('account_balance error', $e->getMessage() . ' | Code: ' . $e->getCode());
LBRY()->notice->set_notice('error', 'Issue getting account balance.');

View file

@ -1,13 +1,14 @@
<?php
$LBRY = LBRY();
$wallet_balance = $LBRY->daemon->wallet_balance();
$available_balance = $wallet_balance->result->available;
$channel_list = $LBRY->daemon->channel_list();
// TODO: Make this page look cleaner
?>
<div class="wrap">
<h1><?= esc_html(get_admin_page_title()); ?></h1>
<h2>Your wallet amount:</h2>
<code><?= number_format($wallet_balance, 2, '.', ','); ?></code>
<img src="<?php echo esc_url( plugin_dir_url(LBRY_PLUGIN_FILE) . 'admin/images/lbc.png') ?>" class="icon icon-lbc wallet-icon-lbc" style="height: 1.8em; margin-right: .5em; margin-bottom: -.5em;"><code><?= number_format($available_balance, 2, '.', ','); ?></code>
<form action="options.php" method="post">
<?php
settings_fields(LBRY_SETTINGS_GROUP);