mirror of
https://github.com/kevachat/kevacoin-php.git
synced 2025-02-08 12:54:29 +00:00
add getNewAddress, getReceivedByAddress methods, update getBalance attributes
This commit is contained in:
parent
88152f8b8e
commit
06c584739e
@ -129,7 +129,7 @@ class Client
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBalance(): ?float
|
public function getBalance(?string $address = null, ?int $minconf = null): ?float
|
||||||
{
|
{
|
||||||
$this->_id++;
|
$this->_id++;
|
||||||
|
|
||||||
@ -138,7 +138,11 @@ class Client
|
|||||||
'POST',
|
'POST',
|
||||||
[
|
[
|
||||||
'method' => 'getbalance',
|
'method' => 'getbalance',
|
||||||
'params' => [],
|
'params' =>
|
||||||
|
[
|
||||||
|
$address,
|
||||||
|
$minconf
|
||||||
|
],
|
||||||
'id' => $this->_id
|
'id' => $this->_id
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
@ -468,4 +472,56 @@ class Client
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNewAddress(): ?string
|
||||||
|
{
|
||||||
|
$this->_id++;
|
||||||
|
|
||||||
|
$this->_prepare(
|
||||||
|
'',
|
||||||
|
'POST',
|
||||||
|
[
|
||||||
|
'method' => 'getnewaddress',
|
||||||
|
'params' => [],
|
||||||
|
'id' => $this->_id
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$response = $this->_execute();
|
||||||
|
|
||||||
|
if (!empty($response['result']))
|
||||||
|
{
|
||||||
|
return $response['result'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getReceivedByAddress(string $address, int $minconf = 0): ?float
|
||||||
|
{
|
||||||
|
$this->_id++;
|
||||||
|
|
||||||
|
$this->_prepare(
|
||||||
|
'',
|
||||||
|
'POST',
|
||||||
|
[
|
||||||
|
'method' => 'getreceivedbyaddress',
|
||||||
|
'params' =>
|
||||||
|
[
|
||||||
|
$address,
|
||||||
|
$minconf
|
||||||
|
],
|
||||||
|
'id' => $this->_id
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$response = $this->_execute();
|
||||||
|
|
||||||
|
if (isset($response['result']) && is_float($response['result']))
|
||||||
|
{
|
||||||
|
return $response['result'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user