npm-kraken-api icon indicating copy to clipboard operation
npm-kraken-api copied to clipboard

Export calls missing

Open molecular opened this issue 3 years ago • 1 comments

adding 'AddExport', 'ExportStatus', 'RetrieveExport', 'RemoveExport' to function list was easy.

But RetrieveExport response is binary data, not json, so I used this ugly hack to make it work and return a Buffer:

8c8
<       private : [ 'Balance', 'TradeBalance', 'OpenOrders', 'ClosedOrders', 'QueryOrders', 'TradesHistory', 'QueryTrades', 'OpenPositions', 'Ledgers', 'QueryLedgers', 'TradeVolume', 'AddOrder', 'CancelOrder', 'DepositMethods', 'DepositAddresses', 'DepositStatus', 'WithdrawInfo', 'Withdraw', 'WithdrawStatus', 'WithdrawCancel', 'GetWebSocketsToken', 'AddExport', 'ExportStatus', 'RetrieveExport', 'RemoveExport' ],
---
>       private : [ 'Balance', 'TradeBalance', 'OpenOrders', 'ClosedOrders', 'QueryOrders', 'TradesHistory', 'QueryTrades', 'OpenPositions', 'Ledgers', 'QueryLedgers', 'TradeVolume', 'AddOrder', 'CancelOrder', 'DepositMethods', 'DepositAddresses', 'DepositStatus', 'WithdrawInfo', 'Withdraw', 'WithdrawStatus', 'WithdrawCancel', 'GetWebSocketsToken' ],
42,46d41
<       // hackjob molec
<       if ( url.endsWith('RetrieveExport')) {
<               options.responseType = 'buffer'
<               return await got(url, options).buffer()
<       } else {
61,62d55
<               return response;
<       }
63a57
>       return response;

molecular avatar Mar 06 '21 09:03 molecular

Edit: sorry, I obviously did that patch the wrong way (reverse)

molecular avatar Mar 31 '22 07:03 molecular