From de9e6f905db88facec87dfb864227564f4e8c2cc Mon Sep 17 00:00:00 2001 From: ghost Date: Sun, 18 Feb 2024 01:22:58 +0200 Subject: [PATCH] implement sendFrom method --- src/Client.php | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/Client.php b/src/Client.php index 2531d3c..80f2bcd 100644 --- a/src/Client.php +++ b/src/Client.php @@ -600,6 +600,45 @@ class Client return null; } + public function sendFrom( + string $fromaccount, + string $toaddress, + float $amount, + ?int $minconf = null, + ?string $comment = null, + ?string $comment_to = null + ): ?string + { + $this->_id++; + + $this->_prepare( + '', + 'POST', + [ + 'method' => 'sendfrom', + 'params' => + [ + $fromaccount, + $toaddress, + $amount, + $minconf, + $comment, + $comment_to + ], + '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; + } + public function getAccount(string $address): ?string { $this->_id++;