mirror of
https://github.com/kevachat/kevacoin-php.git
synced 2025-01-22 12:34:15 +00:00
implement sendToAddress method
This commit is contained in:
parent
06c584739e
commit
f5ab4835db
@ -497,7 +497,7 @@ class Client
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getReceivedByAddress(string $address, int $minconf = 0): ?float
|
public function getReceivedByAddress(string $address, ?int $minconf = 0): ?float
|
||||||
{
|
{
|
||||||
$this->_id++;
|
$this->_id++;
|
||||||
|
|
||||||
@ -524,4 +524,47 @@ class Client
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function sendToAddress(
|
||||||
|
string $address,
|
||||||
|
float $amount = 0,
|
||||||
|
?string $comment = null,
|
||||||
|
?string $comment_to = null,
|
||||||
|
?bool $subtractfeefromamount = false,
|
||||||
|
$replaceable = null,
|
||||||
|
$conf_target = null,
|
||||||
|
$estimate_mode = null
|
||||||
|
): ?string
|
||||||
|
{
|
||||||
|
$this->_id++;
|
||||||
|
|
||||||
|
$this->_prepare(
|
||||||
|
'',
|
||||||
|
'POST',
|
||||||
|
[
|
||||||
|
'method' => 'sendtoaddress',
|
||||||
|
'params' =>
|
||||||
|
[
|
||||||
|
$address,
|
||||||
|
$amount,
|
||||||
|
$comment,
|
||||||
|
$comment_to,
|
||||||
|
$subtractfeefromamount,
|
||||||
|
$replaceable,
|
||||||
|
$conf_target,
|
||||||
|
$estimate_mode
|
||||||
|
],
|
||||||
|
'id' => $this->_id
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$response = $this->_execute();
|
||||||
|
|
||||||
|
if (!empty($response['result']) && !empty($response['result']['txid']) && is_string($response['result']['txid']))
|
||||||
|
{
|
||||||
|
return $response['result']['txid'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user