From a3d2c2c6a50d51f64b1118cee9835091bbfdcd26 Mon Sep 17 00:00:00 2001 From: Justin Nothling Date: Thu, 24 Aug 2017 11:51:16 +0200 Subject: [PATCH 1/6] added getPendingTransactions --- README.md | 11 +++++++++++ lib/BitX.js | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/README.md b/README.md index 2a7fdbe..e0a1b06 100644 --- a/README.md +++ b/README.md @@ -217,6 +217,17 @@ Example: bitx.getTransactions('XBT', {offset: 5, limit: 20}, function(err, transactions) {}); ``` +### getPendingTransactions(account_id, callback) +GET https://api.mybitx.com/api/1/accounts/:id/pending + +You can find your account_id by calling the Balances API. + +Example: + +```javascript +bitx.getPendingTransactions('319232323', function(err, pendingTransactions) {}); +``` + ### getWithdrawals(callback) GET https://api.mybitx.com/api/1/withdrawals diff --git a/lib/BitX.js b/lib/BitX.js index bdb5645..ba95c44 100644 --- a/lib/BitX.js +++ b/lib/BitX.js @@ -231,6 +231,10 @@ BitX.prototype.getTransactions = function (asset, options, callback) { this._request('GET', 'transactions', extend(defaults, options), callback) } +BitX.prototype.getPendingTransactions = function (account_id, callback) { + this._request('GET', 'accounts/' + account_id + '/pending', null, callback) +} + BitX.prototype.getWithdrawals = function (callback) { this._request('GET', 'withdrawals/', null, callback) } From c976f94a3414aa7648343981a1bef2c78932b5e3 Mon Sep 17 00:00:00 2001 From: Justin Nothling Date: Thu, 24 Aug 2017 12:04:36 +0200 Subject: [PATCH 2/6] updated getTransactions for new luno API --- README.md | 12 +++++++----- lib/BitX.js | 9 ++++----- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index e0a1b06..0bde9ff 100644 --- a/README.md +++ b/README.md @@ -200,21 +200,23 @@ Example: bitx.getOrder('BXHW6PFRRXKFSB4', function(err, result) {}); ``` -### getTransactions(asset, [options, ]callback) -GET https://api.mybitx.com/api/1/transactions +### getTransactions(account_id, [options, ]callback) +GET https://api.mybitx.com/api/1/accounts/:id/transactions + +You can find your account_id by calling the Balances API. Default options: ```javascript { - offset: 0, - limit: 10 + min_row: 0, + max_row: 100 } ``` Example: ```javascript -bitx.getTransactions('XBT', {offset: 5, limit: 20}, function(err, transactions) {}); +bitx.getTransactions('319232323', {min_row: 5, max_row: 20}, function(err, transactions) {}); ``` ### getPendingTransactions(account_id, callback) diff --git a/lib/BitX.js b/lib/BitX.js index ba95c44..eec75b6 100644 --- a/lib/BitX.js +++ b/lib/BitX.js @@ -218,17 +218,16 @@ BitX.prototype.createFundingAddress = function (asset, callback) { this._request('POST', 'funding_address', {asset: asset}, callback) } -BitX.prototype.getTransactions = function (asset, options, callback) { +BitX.prototype.getTransactions = function (account_id, options, callback) { if (typeof options === 'function') { callback = options options = null } var defaults = { - asset: asset, - offset: 0, - limit: 10 + min_row: 0, + max_row: 100 } - this._request('GET', 'transactions', extend(defaults, options), callback) + this._request('GET', 'accounts/' + account_id + '/transactions', extend(defaults, options), callback) } BitX.prototype.getPendingTransactions = function (account_id, callback) { From fc704a6c361f5da1629905da209b52eb2907caef Mon Sep 17 00:00:00 2001 From: Justin Nothling Date: Thu, 24 Aug 2017 12:16:50 +0200 Subject: [PATCH 3/6] changed defaulats for getTransactions --- README.md | 2 +- lib/BitX.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0bde9ff..9a5cd98 100644 --- a/README.md +++ b/README.md @@ -208,7 +208,7 @@ You can find your account_id by calling the Balances API. Default options: ```javascript { - min_row: 0, + min_row: 1, max_row: 100 } ``` diff --git a/lib/BitX.js b/lib/BitX.js index eec75b6..d93bdde 100644 --- a/lib/BitX.js +++ b/lib/BitX.js @@ -224,7 +224,7 @@ BitX.prototype.getTransactions = function (account_id, options, callback) { options = null } var defaults = { - min_row: 0, + min_row: 1, max_row: 100 } this._request('GET', 'accounts/' + account_id + '/transactions', extend(defaults, options), callback) From f4251681abf74004043ebeaa76c5f17ed70dd057 Mon Sep 17 00:00:00 2001 From: Justin Nothling Date: Fri, 25 Aug 2017 13:29:49 +0200 Subject: [PATCH 4/6] updated getTransactions tests --- test/IntegrationTests.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/IntegrationTests.js b/test/IntegrationTests.js index dd96303..c790e2f 100644 --- a/test/IntegrationTests.js +++ b/test/IntegrationTests.js @@ -587,11 +587,11 @@ tap.test('getTransactions should return the transactions', function (t) { server.on('request', function (req, res) { t.equal(req.method, 'GET') - t.equal(req.url, '/api/1/transactions?asset=XBT&offset=0&limit=10') + t.equal(req.url, '/api/1/accounts/1224342323/transactions?min_row=1&max_row=10') res.end(JSON.stringify(expectedTransactions)) }) - bitx.getTransactions('XBT', function (err, transactions) { + bitx.getTransactions('1224342323', function (err, transactions) { t.ifErr(err) t.deepEqual(transactions, expectedTransactions) t.end() @@ -625,15 +625,15 @@ tap.test('getTransactions should send options and return the transactions', func server.on('request', function (req, res) { t.equal(req.method, 'GET') - t.equal(req.url, '/api/1/transactions?asset=XBT&offset=5&limit=5') + t.equal(req.url, '/api/1/accounts/1224342323/transactions?min_row=5&max_row=5') res.end(JSON.stringify(expectedTransactions)) }) var options = { - offset: 5, - limit: 5 + min_row: 5, + max_row: 5 } - bitx.getTransactions('XBT', options, function (err, transactions) { + bitx.getTransactions('1224342323', options, function (err, transactions) { t.ifErr(err) t.deepEqual(transactions, expectedTransactions) t.end() From 8646a783fd3c5f4e662b4bc14a8c80ad3a89fdd5 Mon Sep 17 00:00:00 2001 From: Justin Nothling Date: Sat, 26 Aug 2017 13:01:26 +0200 Subject: [PATCH 5/6] corrected max_row --- test/IntegrationTests.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/IntegrationTests.js b/test/IntegrationTests.js index c790e2f..7cbac47 100644 --- a/test/IntegrationTests.js +++ b/test/IntegrationTests.js @@ -587,7 +587,7 @@ tap.test('getTransactions should return the transactions', function (t) { server.on('request', function (req, res) { t.equal(req.method, 'GET') - t.equal(req.url, '/api/1/accounts/1224342323/transactions?min_row=1&max_row=10') + t.equal(req.url, '/api/1/accounts/1224342323/transactions?min_row=1&max_row=100') res.end(JSON.stringify(expectedTransactions)) }) From f683022231fdc04e4c71f9571fc4b8f55067e033 Mon Sep 17 00:00:00 2001 From: Justin Nothling Date: Thu, 31 Aug 2017 00:43:31 +0200 Subject: [PATCH 6/6] minor fix --- README.md | 12 ++++++------ lib/BitX.js | 8 ++++---- test/IntegrationTests.js | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 9a5cd98..dc6016e 100644 --- a/README.md +++ b/README.md @@ -200,10 +200,10 @@ Example: bitx.getOrder('BXHW6PFRRXKFSB4', function(err, result) {}); ``` -### getTransactions(account_id, [options, ]callback) -GET https://api.mybitx.com/api/1/accounts/:id/transactions +### getTransactions(accountId, [options, ]callback) +GET https://api.mybitx.com/api/1/accounts/{accountId}/transactions -You can find your account_id by calling the Balances API. +You can find your accountId by calling the Balances API. Default options: ```javascript @@ -219,10 +219,10 @@ Example: bitx.getTransactions('319232323', {min_row: 5, max_row: 20}, function(err, transactions) {}); ``` -### getPendingTransactions(account_id, callback) -GET https://api.mybitx.com/api/1/accounts/:id/pending +### getPendingTransactions(accountId, callback) +GET https://api.mybitx.com/api/1/accounts/{accountId}/pending -You can find your account_id by calling the Balances API. +You can find your accountId by calling the Balances API. Example: diff --git a/lib/BitX.js b/lib/BitX.js index d93bdde..e1c1e56 100644 --- a/lib/BitX.js +++ b/lib/BitX.js @@ -218,7 +218,7 @@ BitX.prototype.createFundingAddress = function (asset, callback) { this._request('POST', 'funding_address', {asset: asset}, callback) } -BitX.prototype.getTransactions = function (account_id, options, callback) { +BitX.prototype.getTransactions = function (accountId, options, callback) { if (typeof options === 'function') { callback = options options = null @@ -227,11 +227,11 @@ BitX.prototype.getTransactions = function (account_id, options, callback) { min_row: 1, max_row: 100 } - this._request('GET', 'accounts/' + account_id + '/transactions', extend(defaults, options), callback) + this._request('GET', 'accounts/' + accountId + '/transactions', extend(defaults, options), callback) } -BitX.prototype.getPendingTransactions = function (account_id, callback) { - this._request('GET', 'accounts/' + account_id + '/pending', null, callback) +BitX.prototype.getPendingTransactions = function (accountId, callback) { + this._request('GET', 'accounts/' + accountId + '/pending', null, callback) } BitX.prototype.getWithdrawals = function (callback) { diff --git a/test/IntegrationTests.js b/test/IntegrationTests.js index 7cbac47..9df7845 100644 --- a/test/IntegrationTests.js +++ b/test/IntegrationTests.js @@ -625,13 +625,13 @@ tap.test('getTransactions should send options and return the transactions', func server.on('request', function (req, res) { t.equal(req.method, 'GET') - t.equal(req.url, '/api/1/accounts/1224342323/transactions?min_row=5&max_row=5') + t.equal(req.url, '/api/1/accounts/1224342323/transactions?min_row=1&max_row=3') res.end(JSON.stringify(expectedTransactions)) }) var options = { - min_row: 5, - max_row: 5 + min_row: 1, + max_row: 3 } bitx.getTransactions('1224342323', options, function (err, transactions) { t.ifErr(err)