binance-exchange/node-binance-api

Fix for Withdraw function

lht147 opened this issue · 2 comments

Hi,

I used your library since year without any problem, lately binance changed something that made Withdraw function not working anymore.
After some research, i found out that for POST request, signature function should sign for empty query, unlike GET request, POST request has only signature, not others data on url.

Here is my quick fix (line 206, function signedRequest):
let query = Object.keys(data).reduce(function (a, k) { a.push(k + '=' + encodeURIComponent(data[k])); return a; }, []).join('&');

change to:
let query = method === 'POST' ? '' : Object.keys(data).reduce(function (a, k) { a.push(k + '=' + encodeURIComponent(data[k])); return a; }, []).join('&');

Thank you very much! Is there any way you could submit this as a pull request please?

Yes sure, i will do.