From 4cbcde5e7b6fb21e9e9721c3205c76a2ed97dd2f Mon Sep 17 00:00:00 2001 From: cryptochangements34 Date: Fri, 8 Jun 2018 23:16:53 -0500 Subject: [PATCH] add zero_conf option to get_outputs --- monero/library.php | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/monero/library.php b/monero/library.php index 3fa9f17..8a75108 100644 --- a/monero/library.php +++ b/monero/library.php @@ -366,14 +366,27 @@ class NodeTools return $array['data']['txs']; } - public function get_outputs($address, $viewkey) + public function get_outputs($address, $viewkey, $zero_conf = false) { $curl = curl_init(); - curl_setopt_array($curl, array( - CURLOPT_RETURNTRANSFER => 1, - CURLOPT_URL => $this->url . '/api/outputsblocks?address=' . $address . '&viewkey=' . $viewkey . '&limit=5&mempool=0', - )); + if(!$zero_conf) + { + curl_setopt_array($curl, array( + CURLOPT_RETURNTRANSFER => 1, + CURLOPT_URL => $this->url . '/api/outputsblocks?address=' . $address . '&viewkey=' . $viewkey . '&limit=5&mempool=0', + )); + } + + // also look in mempool if accepting zero confirmation transactions + if($zero_conf) + { + curl_setopt_array($curl, array( + CURLOPT_RETURNTRANSFER => 1, + CURLOPT_URL => $this->url . '/api/outputsblocks?address=' . $address . '&viewkey=' . $viewkey . '&limit=5&mempool=1', + )); + } + $resp = curl_exec($curl); curl_close($curl);