Skip to content

Commit b8e0997

Browse files
authored
Merge pull request sebs#59 from superern/master
Add Page, Offset for tokentx
2 parents a5f1c12 + 18d7dec commit b8e0997

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
@@ -165,13 +165,15 @@ module.exports = function(getRequest, apiKey) {
165165
* @param {string} address - Account address
166166
* @param {string} startblock - start looking here
167167
* @param {string} endblock - end looking there
168-
* @param {string} sort - Sort asc/desc
168+
* @param {number} page - Page number
169+
* @param {number} offset - Max records to return
170+
* @param {string} sort - Sort asc/desc
169171
* @param {string} contractaddress - Address of ERC20 token contract (if not specified lists transfers for all tokens)
170172
* @example
171173
* var txlist = api.account.tokentx('0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae', '0x5F988D968cb76c34C87e6924Cc1Ef1dCd4dE75da', 1, 'latest', 'asc');
172174
* @returns {Promise.<object>}
173175
*/
174-
tokentx(address, contractaddress, startblock, endblock, sort) {
176+
tokentx(address, contractaddress, startblock, endblock, page, offset, sort) {
175177
const module = 'account';
176178
const action = 'tokentx';
177179

@@ -183,12 +185,20 @@ module.exports = function(getRequest, apiKey) {
183185
endblock = 'latest';
184186
}
185187

188+
if (!page) {
189+
page = 1;
190+
}
191+
192+
if (!offset) {
193+
offset = 100;
194+
}
195+
186196
if (!sort) {
187197
sort = 'asc';
188198
}
189199

190200
var queryObject = {
191-
module, action, startblock, endblock, sort, address, apiKey
201+
module, action, startblock, endblock, page, offset, sort, address, apiKey
192202
};
193203

194204
if (contractaddress) {

0 commit comments

Comments
 (0)