mirror of
https://github.com/YGGverse/next.git
synced 2026-04-01 10:15:30 +00:00
fix connection init
This commit is contained in:
parent
beee1c7d0c
commit
2590873ca9
1 changed files with 14 additions and 3 deletions
|
|
@ -18,21 +18,32 @@ class Kevacoin
|
||||||
int $port,
|
int $port,
|
||||||
string $namespace
|
string $namespace
|
||||||
) {
|
) {
|
||||||
// Connect wallet
|
// Init wallet connection
|
||||||
$this->_client = new \Kevachat\Kevacoin\Client(
|
$this->_client = new \Kevachat\Kevacoin\Client(
|
||||||
$scheme,
|
$scheme,
|
||||||
$host,
|
$host,
|
||||||
$port,
|
$port,
|
||||||
$username,
|
$user,
|
||||||
$password
|
$password
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Check connection using balance request
|
||||||
|
if (!is_float($this->_client->getBalance()))
|
||||||
|
{
|
||||||
|
throw new \Exception(
|
||||||
|
_('could not connect kevacoin wallet!')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Check namespace given exists
|
// Check namespace given exists
|
||||||
if (!$this->_namespace = $this->_client->kevaFilter($namespace))
|
if (is_null($this->_client->kevaFilter($namespace, '', 0, 0, 1)))
|
||||||
{
|
{
|
||||||
throw new \Exception(
|
throw new \Exception(
|
||||||
_('could not find requested namespace!')
|
_('could not find requested namespace!')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Init namespace
|
||||||
|
$this->_namespace = $namespace;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue