Skip to content

Commit a1ae462

Browse files
authored
Merge pull request sebs#39 from nnqq/page-offset-parameters-txlist-method
Page and Offset parameters to account.txlist method
2 parents ccba372 + 7dcdeee commit a1ae462

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

lib/account.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,14 @@ module.exports = function(getRequest, apiKey) {
109109
* @param {string} address - Transaction address
110110
* @param {string} startblock - start looking here
111111
* @param {string} endblock - end looking there
112+
* @param {number} page - Page number
113+
* @param {number} offset - Max records to return
112114
* @param {string} sort - Sort asc/desc
113115
* @example
114-
* var txlist = api.account.txlist('0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae', 1, 'latest', 'asc');
116+
* var txlist = api.account.txlist('0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae', 1, 'latest', 1, 100, 'asc');
115117
* @returns {Promise.<object>}
116118
*/
117-
txlist(address, startblock, endblock, sort) {
119+
txlist(address, startblock, endblock, page, offset, sort) {
118120
const module = 'account';
119121
const action = 'txlist';
120122

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

131+
if (!page) {
132+
page = 1;
133+
}
134+
135+
if (!offset) {
136+
offset = 100;
137+
}
138+
129139
if (!sort) {
130140
sort = 'asc';
131141
}
132142

133143
var query = querystring.stringify({
134-
module, action, startblock, endblock, sort, address, apiKey
144+
module, action, startblock, endblock, page, offset, sort, address, apiKey
135145
});
136146

137147
return getRequest(query);

0 commit comments

Comments
 (0)