diff --git a/js/okcoinusd.js b/js/okcoinusd.js index 070a61eb901c..5e53df66965c 100644 --- a/js/okcoinusd.js +++ b/js/okcoinusd.js @@ -527,6 +527,43 @@ module.exports = class okcoinusd extends Exchange { }, params)); } + async withdraw (currency, amount, address, params = {}) { + await this.loadMarkets (); + let lowercase = currency.toLowerCase () + '_usd'; + // if (amount < 0.01) + // throw new ExchangeError (this.id + ' withdraw() requires amount > 0.01'); + let request = { + 'symbol': lowercase, + 'withdraw_address': address, + 'withdraw_amount': amount, + 'target': 'address', // or okcn, okcom, okex + }; + let query = params; + if ('chargefee' in query) { + request['chargefee'] = query['chargefee']; + query = this.omit (query, 'chargefee'); + } else { + throw new ExchangeError (this.id + ' withdraw() requires a `chargefee` parameter'); + } + let password = undefined; + if (this.password) { + password = this.password; + } else if ('password' in query) { + request['trade_pwd'] = query['password']; + query = this.omit (query, 'password'); + } else if ('trade_pwd' in query) { + request['trade_pwd'] = query['trade_pwd']; + query = this.omit (query, 'trade_pwd'); + } + if (!password) + throw new ExchangeError (this.id + ' withdraw() requires this.password set on the exchange instance or a password / trade_pwd parameter'); + let response = await this.privatePostWithdraw (this.extend (request, query)); + return { + 'info': response, + 'id': this.safeString (response, 'withdraw_id'), + }; + } + sign (path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) { let url = '/'; if (api != 'web')