-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated getTransactions and added getPendingTransactions #17
base: master
Are you sure you want to change the base?
Changes from 5 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -218,17 +218,20 @@ 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) { | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please could you name the account id parameter using camel case so that it's consistent with the rest of the code like: Line 19 in 54fd76a
And please update the docs to match. |
||||
if (typeof options === 'function') { | ||||
callback = options | ||||
options = null | ||||
} | ||||
var defaults = { | ||||
asset: asset, | ||||
offset: 0, | ||||
limit: 10 | ||||
min_row: 1, | ||||
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) { | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as above applies here. |
||||
this._request('GET', 'accounts/' + account_id + '/pending', null, callback) | ||||
} | ||||
|
||||
BitX.prototype.getWithdrawals = function (callback) { | ||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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=100') | ||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use different values for the min and max so that this test will fail if the logic gets accidentaly inverted at some point. |
||
} | ||
bitx.getTransactions('XBT', options, function (err, transactions) { | ||
bitx.getTransactions('1224342323', options, function (err, transactions) { | ||
t.ifErr(err) | ||
t.deepEqual(transactions, expectedTransactions) | ||
t.end() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the same style of placeholder for variables as the rest of the docs i.e.
{accountId}
.