@ethereansos/interfaces-core 0.4.124 → 0.4.127

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,66 +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 = {};
23762
- var chainIds = {};
23761
+ var instrumentedProviders = [];
23762
+ var instrumentableMethods = ['eth_call', 'eth_getLogs'];
23763
23763
 
23764
- function sendAsync(_x, _x2) {
23765
- return _sendAsync.apply(this, arguments);
23764
+ function instrumentProvider(_x, _x2) {
23765
+ return _instrumentProvider.apply(this, arguments);
23766
23766
  }
23767
23767
 
23768
- function _sendAsync() {
23769
- _sendAsync = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(inputProvider, method) {
23770
- var provider,
23771
- chainId,
23772
- _ref,
23773
- chainProvider,
23774
- params,
23775
- _args2 = arguments;
23768
+ function _instrumentProvider() {
23769
+ _instrumentProvider = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee(provider, method) {
23770
+ var entry, chainId, _ref, chainProvider;
23776
23771
 
23777
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
23772
+ return regeneratorRuntime.wrap(function _callee$(_context) {
23778
23773
  while (1) {
23779
- switch (_context2.prev = _context2.next) {
23774
+ switch (_context.prev = _context.next) {
23780
23775
  case 0:
23781
- provider = inputProvider;
23782
-
23783
- if (!(method !== 'eth_chainId')) {
23784
- _context2.next = 12;
23776
+ if (!(instrumentableMethods.indexOf(method) === -1)) {
23777
+ _context.next = 2;
23785
23778
  break;
23786
23779
  }
23787
23780
 
23788
- _context2.t0 = parseInt;
23789
- _context2.t1 = chainIds[provider];
23781
+ return _context.abrupt("return");
23782
+
23783
+ case 2:
23784
+ entry = instrumentedProviders.filter(function (it) {
23785
+ return it.provider === provider;
23786
+ })[0];
23790
23787
 
23791
- if (_context2.t1) {
23792
- _context2.next = 8;
23788
+ if (!entry) {
23789
+ _context.next = 5;
23793
23790
  break;
23794
23791
  }
23795
23792
 
23796
- _context2.next = 7;
23797
- return sendAsync(provider, 'eth_chainId');
23793
+ return _context.abrupt("return", entry.instrumentedProvider);
23798
23794
 
23799
- case 7:
23800
- _context2.t1 = _context2.sent;
23795
+ case 5:
23796
+ _context.t0 = parseInt;
23797
+ _context.next = 8;
23798
+ return sendAsync(provider, 'eth_chainId');
23801
23799
 
23802
23800
  case 8:
23803
- _context2.t2 = _context2.t1;
23804
- chainId = chainIds[provider] = (0, _context2.t0)(_context2.t2);
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
+ });
23805
23808
  _ref = sendAsync.context || {
23806
23809
  chainProvider: {}
23807
23810
  }, chainProvider = _ref.chainProvider;
23808
- provider = chainId !== 1 && chainProvider[chainId] ? instrumentedProviders[chainId] = instrumentedProviders[chainId] || new Web3__default["default"].providers.HttpProvider(chainProvider[chainId]) : provider;
23811
+ entry.instrumentedProvider = chainId !== 1 && chainProvider[chainId] ? new Web3__default["default"].providers.HttpProvider(chainProvider[chainId]) : provider;
23809
23812
 
23810
- case 12:
23811
- params = Array.prototype.slice.call(_args2).slice(2) || [];
23812
- _context2.next = 15;
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;
23813
23843
  return new Promise( /*#__PURE__*/function () {
23814
- var _ref2 = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee(ok, ko) {
23815
- 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) {
23816
23846
  while (1) {
23817
- switch (_context.prev = _context.next) {
23847
+ switch (_context2.prev = _context2.next) {
23818
23848
  case 0:
23819
- _context.prev = 0;
23820
- _context.next = 3;
23849
+ _context2.prev = 0;
23850
+ _context2.next = 3;
23821
23851
  return (provider.sendAsync || provider.send).call(provider, {
23822
23852
  jsonrpc: '2.0',
23823
23853
  method: method,
@@ -23828,36 +23858,36 @@ function _sendAsync() {
23828
23858
  });
23829
23859
 
23830
23860
  case 3:
23831
- _context.next = 8;
23861
+ _context2.next = 8;
23832
23862
  break;
23833
23863
 
23834
23864
  case 5:
23835
- _context.prev = 5;
23836
- _context.t0 = _context["catch"](0);
23837
- 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));
23838
23868
 
23839
23869
  case 8:
23840
23870
  case "end":
23841
- return _context.stop();
23871
+ return _context2.stop();
23842
23872
  }
23843
23873
  }
23844
- }, _callee, null, [[0, 5]]);
23874
+ }, _callee2, null, [[0, 5]]);
23845
23875
  }));
23846
23876
 
23847
- return function (_x3, _x4) {
23877
+ return function (_x5, _x6) {
23848
23878
  return _ref2.apply(this, arguments);
23849
23879
  };
23850
23880
  }());
23851
23881
 
23852
- case 15:
23853
- return _context2.abrupt("return", _context2.sent);
23882
+ case 6:
23883
+ return _context3.abrupt("return", _context3.sent);
23854
23884
 
23855
- case 16:
23885
+ case 7:
23856
23886
  case "end":
23857
- return _context2.stop();
23887
+ return _context3.stop();
23858
23888
  }
23859
23889
  }
23860
- }, _callee2);
23890
+ }, _callee3);
23861
23891
  }));
23862
23892
  return _sendAsync.apply(this, arguments);
23863
23893
  }