From 44608e688f69ff1545f2a3103c4504bfb3294831 Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 9 Dec 2023 20:55:04 +0200 Subject: [PATCH] add decodeRawTransaction, kevaNamespace methods --- src/Client.php | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/src/Client.php b/src/Client.php index 19742b5..2084871 100644 --- a/src/Client.php +++ b/src/Client.php @@ -242,6 +242,35 @@ class Client return null; } + public function decodeRawTransaction( + string $txid + ): mixed + { + $this->_id++; + + $this->_prepare( + '', + 'POST', + [ + 'method' => 'decoderawtransaction', + 'params' => + [ + $txid + ], + 'id' => $this->_id + ] + ); + + $response = $this->_execute(); + + if (!empty($response['result'])) + { + return $response['result']; + } + + return null; + } + public function kevaFilter( string $namespace, ?string $regexp = '', @@ -374,4 +403,32 @@ class Client return null; } + + public function kevaNamespace( + string $name + ): ?array + { + $this->_id++; + + $this->_prepare( + '', + 'POST', + [ + 'method' => 'keva_namespace', + 'params' => [ + $name + ], + 'id' => $this->_id + ] + ); + + $response = $this->_execute(); + + if (!empty($response['result']) && !empty($response['result']['txid']) && !empty($response['result']['namespaceId'])) + { + return $response['result']; + } + + return null; + } }