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 * 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 * @param string $address Wallet Address
* @return float Wallet Balance * @return array $wallet_balance Wallet Balance
*
*/ */
public function wallet_balance() public function wallet_balance()
{ {
try { try { // Convert JSON string to an object
$result = $this->request('account_balance'); $result = $this->request('wallet_balance');
return $result->result->available; return $result;
$wallet_balance = $result;
} catch (LBRYDaemonException $e) { } catch (LBRYDaemonException $e) {
$this->logger->log('account_balance error', $e->getMessage() . ' | Code: ' . $e->getCode()); $this->logger->log('account_balance error', $e->getMessage() . ' | Code: ' . $e->getCode());
LBRY()->notice->set_notice('error', 'Issue getting account balance.'); LBRY()->notice->set_notice('error', 'Issue getting account balance.');

View file

@ -1,13 +1,14 @@
<?php <?php
$LBRY = LBRY(); $LBRY = LBRY();
$wallet_balance = $LBRY->daemon->wallet_balance(); $wallet_balance = $LBRY->daemon->wallet_balance();
$available_balance = $wallet_balance->result->available;
$channel_list = $LBRY->daemon->channel_list(); $channel_list = $LBRY->daemon->channel_list();
// TODO: Make this page look cleaner // TODO: Make this page look cleaner
?> ?>
<div class="wrap"> <div class="wrap">
<h1><?= esc_html(get_admin_page_title()); ?></h1> <h1><?= esc_html(get_admin_page_title()); ?></h1>
<h2>Your wallet amount:</h2> <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"> <form action="options.php" method="post">
<?php <?php
settings_fields(LBRY_SETTINGS_GROUP); settings_fields(LBRY_SETTINGS_GROUP);