Skip to content

Commit

Permalink
add decodeRawTransaction, kevaNamespace methods
Browse files Browse the repository at this point in the history
  • Loading branch information
ghost committed Dec 9, 2023
1 parent fdb0290 commit 44608e6
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,35 @@ public function getRawTransaction(
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 = '',
Expand Down Expand Up @@ -374,4 +403,32 @@ public function kevaPending(): ?array

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;
}
}

0 comments on commit 44608e6

Please sign in to comment.