From 16856008fedd4d63a4ac2a55012f2c1b9de9cd5d Mon Sep 17 00:00:00 2001 From: Paul Kirby Date: Mon, 27 Jan 2020 16:42:20 -0600 Subject: [PATCH 1/8] Updated 'address_list' to accomadate pagination --- classes/LBRY_Admin.php | 2 +- classes/LBRY_Daemon.php | 11 ++++++++--- templates/options_page.php | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/classes/LBRY_Admin.php b/classes/LBRY_Admin.php index 18cdac2..f9ae10d 100644 --- a/classes/LBRY_Admin.php +++ b/classes/LBRY_Admin.php @@ -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( '', diff --git a/classes/LBRY_Daemon.php b/classes/LBRY_Daemon.php index dde6c21..1d523a8 100644 --- a/classes/LBRY_Daemon.php +++ b/classes/LBRY_Daemon.php @@ -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()); diff --git a/templates/options_page.php b/templates/options_page.php index 320f2ea..85e9dd2 100644 --- a/templates/options_page.php +++ b/templates/options_page.php @@ -17,6 +17,7 @@ $channel_list = $LBRY->daemon->channel_list();

Your Publishable Channels

+