Merged in wallet-functionality (pull request #1)

Fixed wallet balance call
This commit is contained in:
Paul Kirby 2018-10-04 23:48:36 +00:00
commit 6cc2bf8800
3 changed files with 4 additions and 11 deletions

View file

@ -33,17 +33,9 @@ class LBRY_Daemon
* @param string $address Wallet Address * @param string $address Wallet Address
* @return float Wallet Balance * @return float Wallet Balance
*/ */
public function wallet_balance($address = '') public function wallet_balance()
{ {
$address = $address ?: get_option(LBRY_SETTINGS)[LBRY_WALLET]; $result = $this->request('wallet_balance');
error_log('Address: ' . $address);
$result = $this->request('wallet_balance', array(
'address' => $address,
'include_unconfirmed' => true
));
error_log($result);
return json_decode($result)->result; return json_decode($result)->result;
} }

View file

@ -152,6 +152,7 @@ class LBRYPress
// Add options to the options table we need // Add options to the options table we need
if (! get_option(LBRY_SETTINGS)) { if (! get_option(LBRY_SETTINGS)) {
// Get a wallet address // Get a wallet address
// TODO: May have to rethink this based on how wallet address are linked to daemon
$wallet_address = $this->daemon->wallet_unused_address(); $wallet_address = $this->daemon->wallet_unused_address();
// Default options // Default options

View file

@ -8,7 +8,7 @@ $channel_list = $LBRY->daemon->channel_list();
<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, 6, '.', ','); ?></code> <code><?= number_format($wallet_balance, 2, '.', ','); ?></code>
<form action="options.php" method="post"> <form action="options.php" method="post">
<?php <?php