From 623ff37c6e550ab44217466aa75e0c472c27d989 Mon Sep 17 00:00:00 2001 From: Lemuel Smyth <36257395+lemsmyth@users.noreply.github.com> Date: Wed, 16 Feb 2022 14:42:48 -0600 Subject: [PATCH] Claim search method (#64) creates a method for a claim search using claim_id. Can add other params to search for i.e. name, claim_type, and multiple claims at once using claim_ids. --- classes/LBRY_Daemon.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/classes/LBRY_Daemon.php b/classes/LBRY_Daemon.php index 08a1a23..92e6966 100644 --- a/classes/LBRY_Daemon.php +++ b/classes/LBRY_Daemon.php @@ -66,6 +66,30 @@ class LBRY_Daemon } } + /** + * Returns the info about a claim can get supports and initial bid amount when claim created among other information about a claim. + * TODO Can be build out later to accept more params + * @param string $claim_id + * @return object $result + */ + public function claim_search( $claim_id ) + { + $params = array( + 'claim_id' => $claim_id, + // 'name' => $norm_name, + // 'claim_type' => $claim_type, + ); + try { + $result = $this->request( 'claim_search', $params ); + $this->logger->log( 'Claim Search Results: ' . print_r( $result->result, true ) ); + return $result->result; + } catch ( LBRYDaemonException $e ) { + $this->logger->log( 'claim_search error', $e->getMessage() . ' | Code: ' . $e->getCode() ); + LBRY()->notice->set_notice( 'error', 'Issue getting claim search info' ); + return; + } + } + /** * Returns the available balance of a current LBRY account * https://lbry.tech/api/sdk#wallet_balance