Skip to content
This repository was archived by the owner on Dec 26, 2024. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions lib/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,14 @@ module.exports = function(getRequest, apiKey) {
* @param {string} address - Transaction address
* @param {string} startblock - start looking here
* @param {string} endblock - end looking there
* @param {number} page - Page number
* @param {number} offset - Max records to return
* @param {string} sort - Sort asc/desc
* @example
* var txlist = api.account.txlist('0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae', 1, 'latest', 'asc');
* var txlist = api.account.txlist('0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae', 1, 'latest', 1, 100, 'asc');
* @returns {Promise.<object>}
*/
txlist(address, startblock, endblock, sort) {
txlist(address, startblock, endblock, page, offset, sort) {
const module = 'account';
const action = 'txlist';

Expand All @@ -126,12 +128,20 @@ module.exports = function(getRequest, apiKey) {
endblock = 'latest';
}

if (!page) {
page = 1;
}

if (!offset) {
offset = 100;
}

if (!sort) {
sort = 'asc';
}

var query = querystring.stringify({
module, action, startblock, endblock, sort, address, apiKey
module, action, startblock, endblock, page, offset, sort, address, apiKey
});

return getRequest(query);
Expand Down