@ethereansos/interfaces-core 0.4.126 → 0.4.129

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -23758,55 +23758,96 @@ var URL_REGEXP = new RegExp('(http://www.|https://www.|http://|https://)?[a-z0-9
23758
23758
  var solidityImportRule = new RegExp('import( )+"(\\d+)"( )*;', 'gs');
23759
23759
  var pragmaSolidityRule = new RegExp('pragma( )+solidity( )*(\\^|>)\\d+.\\d+.\\d+;', 'gs');
23760
23760
 
23761
- var instrumentedProviders = {};
23761
+ var instrumentedProviders = [];
23762
+ var instrumentableMethods = ['eth_call', 'eth_getLogs'];
23762
23763
 
23763
- function sendAsync(_x, _x2) {
23764
- return _sendAsync.apply(this, arguments);
23764
+ function instrumentProvider(_x, _x2) {
23765
+ return _instrumentProvider.apply(this, arguments);
23765
23766
  }
23766
23767
 
23767
- function _sendAsync() {
23768
- _sendAsync = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(inputProvider, method) {
23769
- var provider,
23770
- chainId,
23771
- _ref,
23772
- chainProvider,
23773
- params,
23774
- _args2 = arguments;
23768
+ function _instrumentProvider() {
23769
+ _instrumentProvider = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee(provider, method) {
23770
+ var entry, chainId, _ref, chainProvider;
23775
23771
 
23776
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
23772
+ return regeneratorRuntime.wrap(function _callee$(_context) {
23777
23773
  while (1) {
23778
- switch (_context2.prev = _context2.next) {
23774
+ switch (_context.prev = _context.next) {
23779
23775
  case 0:
23780
- provider = inputProvider;
23776
+ if (!(instrumentableMethods.indexOf(method) === -1)) {
23777
+ _context.next = 2;
23778
+ break;
23779
+ }
23780
+
23781
+ return _context.abrupt("return", provider);
23782
+
23783
+ case 2:
23784
+ entry = instrumentedProviders.filter(function (it) {
23785
+ return it.provider === provider;
23786
+ })[0];
23781
23787
 
23782
- if (!(method !== 'eth_chainId')) {
23783
- _context2.next = 9;
23788
+ if (!entry) {
23789
+ _context.next = 5;
23784
23790
  break;
23785
23791
  }
23786
23792
 
23787
- _context2.t0 = parseInt;
23788
- _context2.next = 5;
23789
- return sendAsync(provider, 'eth_chainId');
23793
+ return _context.abrupt("return", entry.instrumentedProvider);
23790
23794
 
23791
23795
  case 5:
23792
- _context2.t1 = _context2.sent;
23793
- chainId = (0, _context2.t0)(_context2.t1);
23796
+ _context.t0 = parseInt;
23797
+ _context.next = 8;
23798
+ return sendAsync(provider, 'eth_chainId');
23799
+
23800
+ case 8:
23801
+ _context.t1 = _context.sent;
23802
+ chainId = (0, _context.t0)(_context.t1);
23803
+ instrumentedProviders.push(entry = {
23804
+ chainId: chainId,
23805
+ provider: provider,
23806
+ instrumentedProvider: provider
23807
+ });
23794
23808
  _ref = sendAsync.context || {
23795
23809
  chainProvider: {}
23796
23810
  }, chainProvider = _ref.chainProvider;
23797
- provider = chainId !== 1 && chainProvider[chainId] ? instrumentedProviders[chainId] = instrumentedProviders[chainId] || new Web3__default["default"].providers.HttpProvider(chainProvider[chainId]) : provider;
23811
+ return _context.abrupt("return", entry.instrumentedProvider = chainId !== 1 && chainProvider[chainId] ? new Web3__default["default"].providers.HttpProvider(chainProvider[chainId]) : provider);
23798
23812
 
23799
- case 9:
23800
- params = Array.prototype.slice.call(_args2).slice(2) || [];
23801
- _context2.next = 12;
23813
+ case 13:
23814
+ case "end":
23815
+ return _context.stop();
23816
+ }
23817
+ }
23818
+ }, _callee);
23819
+ }));
23820
+ return _instrumentProvider.apply(this, arguments);
23821
+ }
23822
+
23823
+ function sendAsync(_x3, _x4) {
23824
+ return _sendAsync.apply(this, arguments);
23825
+ }
23826
+
23827
+ function _sendAsync() {
23828
+ _sendAsync = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(inputProvider, method) {
23829
+ var provider,
23830
+ params,
23831
+ _args3 = arguments;
23832
+ return regeneratorRuntime.wrap(function _callee3$(_context3) {
23833
+ while (1) {
23834
+ switch (_context3.prev = _context3.next) {
23835
+ case 0:
23836
+ _context3.next = 2;
23837
+ return instrumentProvider(inputProvider);
23838
+
23839
+ case 2:
23840
+ provider = _context3.sent;
23841
+ params = Array.prototype.slice.call(_args3).slice(2) || [];
23842
+ _context3.next = 6;
23802
23843
  return new Promise( /*#__PURE__*/function () {
23803
- var _ref2 = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee(ok, ko) {
23804
- return regeneratorRuntime.wrap(function _callee$(_context) {
23844
+ var _ref2 = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(ok, ko) {
23845
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
23805
23846
  while (1) {
23806
- switch (_context.prev = _context.next) {
23847
+ switch (_context2.prev = _context2.next) {
23807
23848
  case 0:
23808
- _context.prev = 0;
23809
- _context.next = 3;
23849
+ _context2.prev = 0;
23850
+ _context2.next = 3;
23810
23851
  return (provider.sendAsync || provider.send).call(provider, {
23811
23852
  jsonrpc: '2.0',
23812
23853
  method: method,
@@ -23817,36 +23858,36 @@ function _sendAsync() {
23817
23858
  });
23818
23859
 
23819
23860
  case 3:
23820
- _context.next = 8;
23861
+ _context2.next = 8;
23821
23862
  break;
23822
23863
 
23823
23864
  case 5:
23824
- _context.prev = 5;
23825
- _context.t0 = _context["catch"](0);
23826
- return _context.abrupt("return", ko(_context.t0));
23865
+ _context2.prev = 5;
23866
+ _context2.t0 = _context2["catch"](0);
23867
+ return _context2.abrupt("return", ko(_context2.t0));
23827
23868
 
23828
23869
  case 8:
23829
23870
  case "end":
23830
- return _context.stop();
23871
+ return _context2.stop();
23831
23872
  }
23832
23873
  }
23833
- }, _callee, null, [[0, 5]]);
23874
+ }, _callee2, null, [[0, 5]]);
23834
23875
  }));
23835
23876
 
23836
- return function (_x3, _x4) {
23877
+ return function (_x5, _x6) {
23837
23878
  return _ref2.apply(this, arguments);
23838
23879
  };
23839
23880
  }());
23840
23881
 
23841
- case 12:
23842
- return _context2.abrupt("return", _context2.sent);
23882
+ case 6:
23883
+ return _context3.abrupt("return", _context3.sent);
23843
23884
 
23844
- case 13:
23885
+ case 7:
23845
23886
  case "end":
23846
- return _context2.stop();
23887
+ return _context3.stop();
23847
23888
  }
23848
23889
  }
23849
- }, _callee2);
23890
+ }, _callee3);
23850
23891
  }));
23851
23892
  return _sendAsync.apply(this, arguments);
23852
23893
  }