From eba3a8f6a0dddd216b6ea019ee8d2d8d51b4e229 Mon Sep 17 00:00:00 2001 From: omer_dogan Date: Thu, 9 Jun 2022 23:21:32 +0300 Subject: [PATCH 1/5] add withdraw request --- .gitignore | 3 +++ src/BinanceAPI.php | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..87d072d --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/.idea +/vendor +/composer.lock \ No newline at end of file diff --git a/src/BinanceAPI.php b/src/BinanceAPI.php index ebcf2e2..1f29326 100644 --- a/src/BinanceAPI.php +++ b/src/BinanceAPI.php @@ -289,6 +289,47 @@ public function getWithdrawHistory() return $this->privateRequest('v1/capital/withdraw/history'); } + /** + * @param string $asset + * @param string $address + * @param $amount + * @param $addressTag + * @param $addressName + * @param bool $transactionFeeFlag + * @param $network + * @param $orderId + * @return array|mixed + */ + public function withdraw(string $asset, string $address, $amount, $addressTag = null, $addressName = "", bool $transactionFeeFlag = false, $network = null, $orderId = null) + { + $options = [ + "coin" => $asset, + "address" => $address, + "amount" => $amount, + "sapi" => true, + ]; + + if (empty($addressName) === false) { + $options['name'] = str_replace(' ', '%20', $addressName); + } + if (empty($addressTag) === false) { + $options['addressTag'] = $addressTag; + } + if ($transactionFeeFlag) { + $options['transactionFeeFlag'] = true; + } + if (empty($network) === false) { + $options['network'] = $network; + } + if (empty($orderId) === false) { + $options['withdrawOrderId'] = $orderId; + } + + $this->api_url = config('binance-api.urls.sapi'); + + return $this->privateRequest('v1/capital/withdraw/apply', $options); + } + /** * Make public requests (Security Type: NONE). * From 83939083260964b5b528845469c99f4dd1035d41 Mon Sep 17 00:00:00 2001 From: omer_dogan Date: Thu, 9 Jun 2022 23:33:44 +0300 Subject: [PATCH 2/5] add withdraw request --- src/BinanceAPI.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/BinanceAPI.php b/src/BinanceAPI.php index 1f29326..ee9ff6a 100644 --- a/src/BinanceAPI.php +++ b/src/BinanceAPI.php @@ -300,13 +300,13 @@ public function getWithdrawHistory() * @param $orderId * @return array|mixed */ - public function withdraw(string $asset, string $address, $amount, $addressTag = null, $addressName = "", bool $transactionFeeFlag = false, $network = null, $orderId = null) + public function withdraw(string $asset, string $address, $amount, $addressTag = null, $addressName = '', bool $transactionFeeFlag = false, $network = null, $orderId = null) { $options = [ - "coin" => $asset, - "address" => $address, - "amount" => $amount, - "sapi" => true, + 'coin' => $asset, + 'address' => $address, + 'amount' => $amount, + 'sapi' => true, ]; if (empty($addressName) === false) { From 71f21f71c79e8c7f859266f191c8220156706023 Mon Sep 17 00:00:00 2001 From: omer_dogan Date: Mon, 13 Jun 2022 23:27:27 +0300 Subject: [PATCH 3/5] add withdraw request fixed --- src/BinanceAPI.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/BinanceAPI.php b/src/BinanceAPI.php index ee9ff6a..135f1e2 100644 --- a/src/BinanceAPI.php +++ b/src/BinanceAPI.php @@ -298,6 +298,7 @@ public function getWithdrawHistory() * @param bool $transactionFeeFlag * @param $network * @param $orderId + * * @return array|mixed */ public function withdraw(string $asset, string $address, $amount, $addressTag = null, $addressName = '', bool $transactionFeeFlag = false, $network = null, $orderId = null) From 8d69b1897dcafea4b78ac23df468af13e5464b2d Mon Sep 17 00:00:00 2001 From: omer_dogan Date: Thu, 28 Jul 2022 23:19:51 +0300 Subject: [PATCH 4/5] method and network fixed --- src/BinanceAPI.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BinanceAPI.php b/src/BinanceAPI.php index 135f1e2..224e8d3 100644 --- a/src/BinanceAPI.php +++ b/src/BinanceAPI.php @@ -301,7 +301,7 @@ public function getWithdrawHistory() * * @return array|mixed */ - public function withdraw(string $asset, string $address, $amount, $addressTag = null, $addressName = '', bool $transactionFeeFlag = false, $network = null, $orderId = null) + public function withdraw(string $asset, string $address, $amount, $network = null, $addressTag = null, $addressName = '', bool $transactionFeeFlag = false, $orderId = null) { $options = [ 'coin' => $asset, @@ -328,7 +328,7 @@ public function withdraw(string $asset, string $address, $amount, $addressTag = $this->api_url = config('binance-api.urls.sapi'); - return $this->privateRequest('v1/capital/withdraw/apply', $options); + return $this->privateRequest('v1/capital/withdraw/apply', $options, 'POST'); } /** From bd124e10075090a8b4a73e5eee48a32f0f1abf7d Mon Sep 17 00:00:00 2001 From: omer_dogan Date: Fri, 29 Jul 2022 00:15:10 +0300 Subject: [PATCH 5/5] method and network fixed --- src/BinanceAPI.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/BinanceAPI.php b/src/BinanceAPI.php index 224e8d3..8c459f1 100644 --- a/src/BinanceAPI.php +++ b/src/BinanceAPI.php @@ -269,11 +269,10 @@ public function getUserCoinsInfo() * * @return mixed */ - public function getDepositHistory() + public function getDepositHistory($options = []) { $this->api_url = config('binance-api.urls.sapi'); - - return $this->privateRequest('v1/capital/deposit/hisrec'); + return $this->privateRequest('v1/capital/deposit/hisrec', $options); } /** @@ -331,6 +330,13 @@ public function withdraw(string $asset, string $address, $amount, $network = nul return $this->privateRequest('v1/capital/withdraw/apply', $options, 'POST'); } + public function getDepositAddress($options = []) + { + $this->api_url = config('binance-api.urls.sapi'); + + return $this->privateRequest('v1/capital/deposit/address', $options); + } + /** * Make public requests (Security Type: NONE). *