Browse Source

implement sendToAddress method

main
ghost 9 months ago
parent
commit
f5ab4835db
  1. 45
      src/Client.php

45
src/Client.php

@ -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…
Cancel
Save