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..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); } /** @@ -289,6 +288,55 @@ 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, $network = null, $addressTag = null, $addressName = '', bool $transactionFeeFlag = false, $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, '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). *