Updated 'address_list' to accomadate pagination
This commit is contained in:
parent
3e4409e39e
commit
16856008fe
3 changed files with 10 additions and 4 deletions
|
@ -149,7 +149,7 @@ class LBRY_Admin
|
||||||
public function wallet_callback()
|
public function wallet_callback()
|
||||||
{
|
{
|
||||||
// Get first available address from Daemon
|
// 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] : '';
|
$address = is_array($address) && !empty($address) ? $address[0] : '';
|
||||||
printf(
|
printf(
|
||||||
'<input type="text" id="%1$s" name="%2$s[%1$s]" value="%3$s" readonly />',
|
'<input type="text" id="%1$s" name="%2$s[%1$s]" value="%3$s" readonly />',
|
||||||
|
|
|
@ -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
|
* https://lbry.tech/api/sdk#address_list
|
||||||
* @return array Array of address lists linked to this account
|
* @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 {
|
try {
|
||||||
$result = $this->request('address_list');
|
$result = $this->request('address_list', $params);
|
||||||
return $result->result;
|
return $result->result;
|
||||||
} catch (LBRYDaemonException $e) {
|
} catch (LBRYDaemonException $e) {
|
||||||
$this->logger->log('address_list error', $e->getMessage() . ' | Code: ' . $e->getCode());
|
$this->logger->log('address_list error', $e->getMessage() . ' | Code: ' . $e->getCode());
|
||||||
|
|
|
@ -17,6 +17,7 @@ $channel_list = $LBRY->daemon->channel_list();
|
||||||
</form>
|
</form>
|
||||||
<h2>Your Publishable Channels</h2>
|
<h2>Your Publishable Channels</h2>
|
||||||
<?php if ($channel_list): ?>
|
<?php if ($channel_list): ?>
|
||||||
|
<?php error_log(print_r($channel_list, true)); ?>
|
||||||
<ul class="lbry-channel-list">
|
<ul class="lbry-channel-list">
|
||||||
<?php foreach ($channel_list as $channel): ?>
|
<?php foreach ($channel_list as $channel): ?>
|
||||||
<li><?= $channel->name ?></li>
|
<li><?= $channel->name ?></li>
|
||||||
|
|
Loading…
Reference in a new issue