diff --git a/accounts/transactions-rest-api.js b/accounts/transactions-rest-api.js index 5277e1b..6d96778 100644 --- a/accounts/transactions-rest-api.js +++ b/accounts/transactions-rest-api.js @@ -83,8 +83,15 @@ class TransactionsRestApi { const active = apiHelper.parseEntities(req.query.active) const page = req.query.page != null ? parseInt(req.query.page) : 0 const count = req.query.count != null ? parseInt(req.query.count) : keys.multiaddr.transactions + const excludeNullXfer = req.query.excludeNullXfer != null const result = await walletService.getWalletTransactions(active, page, count) + if (excludeNullXfer) { + result.txs = result.txs.filter(tx => { + return tx['result'] != 0 + }) + } + const ret = JSON.stringify(result, null, 2) HttpServer.sendRawData(res, ret) @@ -141,7 +148,11 @@ class TransactionsRestApi { !req.query.count || validator.isInt(req.query.count) - if (!(isValidPage && isValidCount)) { + const isValidExcludeNull = + !req.query.excludeNullXfer + || validator.isAlphanumeric(req.query.excludeNullXfer) + + if (!(isValidPage && isValidCount && isValidExcludeNull)) { HttpServer.sendError(res, errors.body.INVDATA) Logger.error( req.query, diff --git a/doc/GET_txs.md b/doc/GET_txs.md index 8d1337b..adeabee 100644 --- a/doc/GET_txs.md +++ b/doc/GET_txs.md @@ -12,6 +12,7 @@ GET /txs?active=... * **active** - `string` - A pipe-separated list of extended public keys and/or loose addresses and/or pubkeys (`xpub1|address1|address2|pubkey1|...`) * **page** - `integer` - Index of the requested page (first page is index 0) * **count** - `integer` - Number of transactions returned per page +* **excludeNullXfer** - `boolean` - Boolean flag indicating if transactions that don't change the balance should be excluded from the result (default = false) * **at** - `string` (optional) - Access Token (json web token). Required if authentication is activated. Alternatively, the access token can be passed through the `Authorization` HTTP header (with the `Bearer` scheme). ### Examples