Skip to content

Commit

Permalink
Create AccountNamespace.php
Browse files Browse the repository at this point in the history
  • Loading branch information
zgrguric committed Jan 21, 2024
1 parent 9825e72 commit 16c9c54
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/Api/Methods/AccountNamespace.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php declare(strict_types=1);

namespace XRPLWin\XRPL\Api\Methods;

use XRPLWin\XRPL\Api\AbstractMethod;
use XRPLWin\XRPL\Exceptions\NotSentException;
use XRPLWin\XRPL\Exceptions\XRPL\NotSuccessException;

class AccountNamespace extends AbstractMethod
{
protected string $method = 'account_namespace';
protected string $endpoint_config_key = 'endpoint_reporting_uri';

/**
* Returns channels.
* @return array
* @throws NotExecutedException
*/
public function finalResult(): array
{
if(!$this->executed)
throw new NotSentException('Please send request first');

if(!$this->isSuccess())
throw new NotSuccessException('Request did not return success result: '.\json_encode($this->result));

return $this->result()->result->namespace_entries;
}
}

0 comments on commit 16c9c54

Please sign in to comment.