Updated 'address_list' to accomadate pagination

This commit is contained in:
Paul Kirby 2020-01-27 16:42:20 -06:00
parent 3e4409e39e
commit 16856008fe
3 changed files with 10 additions and 4 deletions

View file

@ -149,7 +149,7 @@ class LBRY_Admin
public function wallet_callback()
{
// Get first available address from Daemon
$address = LBRY()->daemon->address_list();
$address = LBRY()->daemon->address_list()->items;
$address = is_array($address) && !empty($address) ? $address[0] : '';
printf(
'<input type="text" id="%1$s" name="%2$s[%1$s]" value="%3$s" readonly />',

View file

@ -45,14 +45,19 @@ class LBRY_Daemon
}
/**
* Returns an array of Address lists
* Returns an paginated array of Address lists
* https://lbry.tech/api/sdk#address_list
* @return array Array of address lists linked to this account
*/
public function address_list()
public function address_list($page = 1)
{
// Get 20 per page
$params = array(
'page' => $page,
'page_size' => 20
);
try {
$result = $this->request('address_list');
$result = $this->request('address_list', $params);
return $result->result;
} catch (LBRYDaemonException $e) {
$this->logger->log('address_list error', $e->getMessage() . ' | Code: ' . $e->getCode());

View file

@ -17,6 +17,7 @@ $channel_list = $LBRY->daemon->channel_list();
</form>
<h2>Your Publishable Channels</h2>
<?php if ($channel_list): ?>
<?php error_log(print_r($channel_list, true)); ?>
<ul class="lbry-channel-list">
<?php foreach ($channel_list as $channel): ?>
<li><?= $channel->name ?></li>