ethjs-filter
Advanced tools
Comparing version 0.1.3 to 0.1.4
@@ -182,3 +182,3 @@ /* eslint-disable */ | ||
if (filterName === 'Filter') { | ||
filterInputs.push(Object.assign(self.options.defaultFilterObject, {} || args[args.length - 1])); | ||
filterInputs.push(Object.assign(self.options.defaultFilterObject, args[args.length - 1] || {})); | ||
} | ||
@@ -185,0 +185,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("EthFilter",[],e):"object"==typeof exports?exports.EthFilter=e():t.EthFilter=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,e,n){Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e){"use strict";function n(t,e){function n(t){var n=this;n.filterId=null,n.options=Object.assign({delay:300,decoder:function(t){return t},defaultFilterObject:{}},t||{}),n.watchers={},n.interval=setInterval(function(){null!==n.filterId&&Object.keys(n.watchers).length>0&&e.getFilterChanges(n.filterId,function(t,e){var r=[],i=null;if(!t)try{e.forEach(function(t,i){r[i]=e[i],r[i].data=n.options.decoder(r[i].data)})}catch(o){i=Error("[ethjs-filter] while decoding filter change event data from RPC '"+JSON.stringify(r)+"': "+o)}Object.keys(n.watchers).forEach(function(o){var c=n.watchers[o];return c.stop===!0?void delete n.watchers[o]:void(i?(c.reject(i),c.callback(i,null)):(t?c.reject(t):Array.isArray(r)&&e.length>0&&c.resolve(r),c.callback(t,r)))})})},n.options.delay)}return n.prototype.at=function(t){var e=this;e.filterId=t},n.prototype.watch=function(t){var e=t||function(){},n=this,r=Math.random().toString(36).substring(7),i=new Promise(function(t,i){n.watchers[r]={resolve:t,reject:i,callback:e,stop:!1}});return i.stopWatching=function(){n.watchers[r].stop=!0},i},n.prototype.uninstall=function(t){var n=this,r=t||function(){};return n.watchers=Object.assign({}),clearInterval(n.interval),new Promise(function(t,i){e.uninstallFilter(n.filterId,function(e,n){e?i(e):t(n),r(e,n)})})},n.prototype["new"]=function(){var n=function(){},r=this,i=[],o=[].slice.call(arguments);return"function"==typeof o[o.length-1]&&(n=o.pop()),"Filter"===t&&i.push(Object.assign(r.options.defaultFilterObject,{}||o[o.length-1])),new Promise(function(o,c){i.push(function(t,e){t?c(t):(r.filterId=e,o(e)),n(t,e)}),e["new"+t].apply(e,i)})},n}function r(t){var e=this;if(!(e instanceof r))throw Error("the EthFilter object must be instantiated with `new` flag.. (e.g. `const filters = new EthFilter(query);`)");if("object"!=typeof t)throw Error("the EthFilter object must be instantiated with an EthQuery instance (e.g. `const filters = new EthFilter(new EthQuery(provider));`). See github.com/ethjs/ethjs-query for more details..");e.Filter=n("Filter",t),e.BlockFilter=n("BlockFilter",t),e.PendingTransactionFilter=n("PendingTransactionFilter",t)}t.exports=r}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("EthFilter",[],e):"object"==typeof exports?exports.EthFilter=e():t.EthFilter=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,e,n){Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e){"use strict";function n(t,e){function n(t){var n=this;n.filterId=null,n.options=Object.assign({delay:300,decoder:function(t){return t},defaultFilterObject:{}},t||{}),n.watchers={},n.interval=setInterval(function(){null!==n.filterId&&Object.keys(n.watchers).length>0&&e.getFilterChanges(n.filterId,function(t,e){var r=[],i=null;if(!t)try{e.forEach(function(t,i){r[i]=e[i],r[i].data=n.options.decoder(r[i].data)})}catch(o){i=Error("[ethjs-filter] while decoding filter change event data from RPC '"+JSON.stringify(r)+"': "+o)}Object.keys(n.watchers).forEach(function(o){var c=n.watchers[o];return c.stop===!0?void delete n.watchers[o]:void(i?(c.reject(i),c.callback(i,null)):(t?c.reject(t):Array.isArray(r)&&e.length>0&&c.resolve(r),c.callback(t,r)))})})},n.options.delay)}return n.prototype.at=function(t){var e=this;e.filterId=t},n.prototype.watch=function(t){var e=t||function(){},n=this,r=Math.random().toString(36).substring(7),i=new Promise(function(t,i){n.watchers[r]={resolve:t,reject:i,callback:e,stop:!1}});return i.stopWatching=function(){n.watchers[r].stop=!0},i},n.prototype.uninstall=function(t){var n=this,r=t||function(){};return n.watchers=Object.assign({}),clearInterval(n.interval),new Promise(function(t,i){e.uninstallFilter(n.filterId,function(e,n){e?i(e):t(n),r(e,n)})})},n.prototype["new"]=function(){var n=function(){},r=this,i=[],o=[].slice.call(arguments);return"function"==typeof o[o.length-1]&&(n=o.pop()),"Filter"===t&&i.push(Object.assign(r.options.defaultFilterObject,o[o.length-1]||{})),new Promise(function(o,c){i.push(function(t,e){t?c(t):(r.filterId=e,o(e)),n(t,e)}),e["new"+t].apply(e,i)})},n}function r(t){var e=this;if(!(e instanceof r))throw Error("the EthFilter object must be instantiated with `new` flag.. (e.g. `const filters = new EthFilter(query);`)");if("object"!=typeof t)throw Error("the EthFilter object must be instantiated with an EthQuery instance (e.g. `const filters = new EthFilter(new EthQuery(provider));`). See github.com/ethjs/ethjs-query for more details..");e.Filter=n("Filter",t),e.BlockFilter=n("BlockFilter",t),e.PendingTransactionFilter=n("PendingTransactionFilter",t)}t.exports=r}])}); |
@@ -109,3 +109,3 @@ 'use strict'; | ||
if (filterName === 'Filter') { | ||
filterInputs.push(Object.assign(self.options.defaultFilterObject, {} || args[args.length - 1])); | ||
filterInputs.push(Object.assign(self.options.defaultFilterObject, args[args.length - 1] || {})); | ||
} | ||
@@ -112,0 +112,0 @@ |
{ | ||
"name": "ethjs-filter", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "A simple filter handler for the Ethereum RPC layer.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -1,3 +0,1 @@ | ||
function constructFilter(filterName, query) { | ||
@@ -108,3 +106,3 @@ function Filter(options) { | ||
filterInputs.push(Object.assign(self.options.defaultFilterObject, | ||
({} || args[args.length - 1]))); | ||
(args[args.length - 1] || {}))); | ||
} | ||
@@ -111,0 +109,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
80192