Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/.idea
/vendor
/composer.lock
54 changes: 51 additions & 3 deletions src/BinanceAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand All @@ -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).
*
Expand Down