add lbc image, fix wallet balance #43
3 changed files with 11 additions and 9 deletions
BIN
admin/images/lbc.png
Normal file
BIN
admin/images/lbc.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
|
@ -69,18 +69,19 @@ class LBRY_Daemon
|
|||
|
||||
/**
|
||||
* Returns the available balance of a current LBRY account
|
||||
* https://lbry.tech/api/sdk#account_balance
|
||||
* @param string $address Wallet Address
|
||||
* @return float Wallet Balance
|
||||
* https://lbry.tech/api/sdk#wallet_balance
|
||||
* @param string $address Wallet Address
|
||||
* @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;
|
||||
} catch (LBRYDaemonException $e) {
|
||||
$this->logger->log('account_balance error', $e->getMessage() . ' | Code: ' . $e->getCode());
|
||||
LBRY()->notice->set_notice('error', 'Issue getting account balance.');
|
||||
$this->logger->log('wallet_balance error', $e->getMessage() . ' | Code: ' . $e->getCode());
|
||||
LBRY()->notice->set_notice('error', 'Issue getting wallet balance.');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue