From 17c9a9ded34101080abf862c73b3aa6cd15b7909 Mon Sep 17 00:00:00 2001 From: Daniel-Rafique Date: Tue, 17 May 2022 12:18:01 +0100 Subject: [PATCH] Update withdraw endpoints to SAPI --- node-binance-api.d.ts | 8 +++++--- node-binance-api.js | 12 +++++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/node-binance-api.d.ts b/node-binance-api.d.ts index 8aeb610f..4d25dcd6 100644 --- a/node-binance-api.d.ts +++ b/node-binance-api.d.ts @@ -637,15 +637,17 @@ declare module "node-binance-api" { /** * Withdraws asset to given wallet id - * @param {string} asset - the asset symbol + * @param {string} coin - the coin symbol + * @param {string} network - the coin network * @param {string} address - the wallet to transfer it to * @param {number} amount - the amount to transfer - * @param {string} addressTag - and addtional address tag + * @param {long} timestamp - the timestamp + * @param {string} addressTag - and additional address tag * @param {function} callback - the callback function * @param {string} name - the name to save the address as. Set falsy to prevent Binance saving to address book * @return {promise or undefined} - omitting the callback returns a promise */ - withdraw(asset: string, address: string, amount: number, addressTag?: string, callback?: _callback, name?: string): Promise; + withdraw(coin: string, network: string, address: string, amount: number, timestamp: long, addressTag?: string, callback?: _callback, name?: string): Promise; withdraw(...args: any): any; /** diff --git a/node-binance-api.js b/node-binance-api.js index 615485fc..a3aea7e4 100644 --- a/node-binance-api.js +++ b/node-binance-api.js @@ -3401,16 +3401,18 @@ let api = function Binance( options = {} ) { /** * Withdraws asset to given wallet id - * @param {string} asset - the asset symbol + * @param {string} coin - the coin symbol + * @param {string} network - the coin network * @param {string} address - the wallet to transfer it to * @param {number} amount - the amount to transfer + * @param {long} timestamp - the timestamp * @param {string} addressTag - and addtional address tag * @param {function} callback - the callback function * @param {string} name - the name to save the address as. Set falsy to prevent Binance saving to address book * @return {promise or undefined} - omitting the callback returns a promise */ - withdraw: function ( asset, address, amount, addressTag = false, callback = false, name = false ) { - let params = { asset, address, amount }; + withdraw: function ( coin, network, address, amount, timestamp, addressTag = false, callback = false, name = false ) { + let params = { coin, network, address, amount, timestamp }; if ( name ) params.name = name; if ( addressTag ) params.addressTag = addressTag; if ( !callback ) { @@ -3422,10 +3424,10 @@ let api = function Binance( options = {} ) { resolve( response ); } } - signedRequest( wapi + 'v3/withdraw.html', params, callback, 'POST' ); + signedRequest( sapi + 'v1/capital/withdraw/apply', params, callback, 'POST' ); } ) } else { - signedRequest( wapi + 'v3/withdraw.html', params, callback, 'POST' ); + signedRequest( sapi + 'v1/capital/withdraw/apply', params, callback, 'POST' ); } },