@ethereansos/interfaces-core 0.4.124 → 0.4.127

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.esm.js CHANGED
@@ -23746,66 +23746,96 @@ var URL_REGEXP = new RegExp('(http://www.|https://www.|http://|https://)?[a-z0-9
23746
23746
  var solidityImportRule = new RegExp('import( )+"(\\d+)"( )*;', 'gs');
23747
23747
  var pragmaSolidityRule = new RegExp('pragma( )+solidity( )*(\\^|>)\\d+.\\d+.\\d+;', 'gs');
23748
23748
 
23749
- var instrumentedProviders = {};
23750
- var chainIds = {};
23749
+ var instrumentedProviders = [];
23750
+ var instrumentableMethods = ['eth_call', 'eth_getLogs'];
23751
23751
 
23752
- function sendAsync(_x, _x2) {
23753
- return _sendAsync.apply(this, arguments);
23752
+ function instrumentProvider(_x, _x2) {
23753
+ return _instrumentProvider.apply(this, arguments);
23754
23754
  }
23755
23755
 
23756
- function _sendAsync() {
23757
- _sendAsync = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(inputProvider, method) {
23758
- var provider,
23759
- chainId,
23760
- _ref,
23761
- chainProvider,
23762
- params,
23763
- _args2 = arguments;
23756
+ function _instrumentProvider() {
23757
+ _instrumentProvider = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee(provider, method) {
23758
+ var entry, chainId, _ref, chainProvider;
23764
23759
 
23765
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
23760
+ return regeneratorRuntime.wrap(function _callee$(_context) {
23766
23761
  while (1) {
23767
- switch (_context2.prev = _context2.next) {
23762
+ switch (_context.prev = _context.next) {
23768
23763
  case 0:
23769
- provider = inputProvider;
23770
-
23771
- if (!(method !== 'eth_chainId')) {
23772
- _context2.next = 12;
23764
+ if (!(instrumentableMethods.indexOf(method) === -1)) {
23765
+ _context.next = 2;
23773
23766
  break;
23774
23767
  }
23775
23768
 
23776
- _context2.t0 = parseInt;
23777
- _context2.t1 = chainIds[provider];
23769
+ return _context.abrupt("return");
23770
+
23771
+ case 2:
23772
+ entry = instrumentedProviders.filter(function (it) {
23773
+ return it.provider === provider;
23774
+ })[0];
23778
23775
 
23779
- if (_context2.t1) {
23780
- _context2.next = 8;
23776
+ if (!entry) {
23777
+ _context.next = 5;
23781
23778
  break;
23782
23779
  }
23783
23780
 
23784
- _context2.next = 7;
23785
- return sendAsync(provider, 'eth_chainId');
23781
+ return _context.abrupt("return", entry.instrumentedProvider);
23786
23782
 
23787
- case 7:
23788
- _context2.t1 = _context2.sent;
23783
+ case 5:
23784
+ _context.t0 = parseInt;
23785
+ _context.next = 8;
23786
+ return sendAsync(provider, 'eth_chainId');
23789
23787
 
23790
23788
  case 8:
23791
- _context2.t2 = _context2.t1;
23792
- chainId = chainIds[provider] = (0, _context2.t0)(_context2.t2);
23789
+ _context.t1 = _context.sent;
23790
+ chainId = (0, _context.t0)(_context.t1);
23791
+ instrumentedProviders.push(entry = {
23792
+ chainId: chainId,
23793
+ provider: provider,
23794
+ instrumentedProvider: provider
23795
+ });
23793
23796
  _ref = sendAsync.context || {
23794
23797
  chainProvider: {}
23795
23798
  }, chainProvider = _ref.chainProvider;
23796
- provider = chainId !== 1 && chainProvider[chainId] ? instrumentedProviders[chainId] = instrumentedProviders[chainId] || new Web3.providers.HttpProvider(chainProvider[chainId]) : provider;
23799
+ entry.instrumentedProvider = chainId !== 1 && chainProvider[chainId] ? new Web3.providers.HttpProvider(chainProvider[chainId]) : provider;
23797
23800
 
23798
- case 12:
23799
- params = Array.prototype.slice.call(_args2).slice(2) || [];
23800
- _context2.next = 15;
23801
+ case 13:
23802
+ case "end":
23803
+ return _context.stop();
23804
+ }
23805
+ }
23806
+ }, _callee);
23807
+ }));
23808
+ return _instrumentProvider.apply(this, arguments);
23809
+ }
23810
+
23811
+ function sendAsync(_x3, _x4) {
23812
+ return _sendAsync.apply(this, arguments);
23813
+ }
23814
+
23815
+ function _sendAsync() {
23816
+ _sendAsync = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(inputProvider, method) {
23817
+ var provider,
23818
+ params,
23819
+ _args3 = arguments;
23820
+ return regeneratorRuntime.wrap(function _callee3$(_context3) {
23821
+ while (1) {
23822
+ switch (_context3.prev = _context3.next) {
23823
+ case 0:
23824
+ _context3.next = 2;
23825
+ return instrumentProvider(inputProvider);
23826
+
23827
+ case 2:
23828
+ provider = _context3.sent;
23829
+ params = Array.prototype.slice.call(_args3).slice(2) || [];
23830
+ _context3.next = 6;
23801
23831
  return new Promise( /*#__PURE__*/function () {
23802
- var _ref2 = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee(ok, ko) {
23803
- return regeneratorRuntime.wrap(function _callee$(_context) {
23832
+ var _ref2 = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(ok, ko) {
23833
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
23804
23834
  while (1) {
23805
- switch (_context.prev = _context.next) {
23835
+ switch (_context2.prev = _context2.next) {
23806
23836
  case 0:
23807
- _context.prev = 0;
23808
- _context.next = 3;
23837
+ _context2.prev = 0;
23838
+ _context2.next = 3;
23809
23839
  return (provider.sendAsync || provider.send).call(provider, {
23810
23840
  jsonrpc: '2.0',
23811
23841
  method: method,
@@ -23816,36 +23846,36 @@ function _sendAsync() {
23816
23846
  });
23817
23847
 
23818
23848
  case 3:
23819
- _context.next = 8;
23849
+ _context2.next = 8;
23820
23850
  break;
23821
23851
 
23822
23852
  case 5:
23823
- _context.prev = 5;
23824
- _context.t0 = _context["catch"](0);
23825
- return _context.abrupt("return", ko(_context.t0));
23853
+ _context2.prev = 5;
23854
+ _context2.t0 = _context2["catch"](0);
23855
+ return _context2.abrupt("return", ko(_context2.t0));
23826
23856
 
23827
23857
  case 8:
23828
23858
  case "end":
23829
- return _context.stop();
23859
+ return _context2.stop();
23830
23860
  }
23831
23861
  }
23832
- }, _callee, null, [[0, 5]]);
23862
+ }, _callee2, null, [[0, 5]]);
23833
23863
  }));
23834
23864
 
23835
- return function (_x3, _x4) {
23865
+ return function (_x5, _x6) {
23836
23866
  return _ref2.apply(this, arguments);
23837
23867
  };
23838
23868
  }());
23839
23869
 
23840
- case 15:
23841
- return _context2.abrupt("return", _context2.sent);
23870
+ case 6:
23871
+ return _context3.abrupt("return", _context3.sent);
23842
23872
 
23843
- case 16:
23873
+ case 7:
23844
23874
  case "end":
23845
- return _context2.stop();
23875
+ return _context3.stop();
23846
23876
  }
23847
23877
  }
23848
- }, _callee2);
23878
+ }, _callee3);
23849
23879
  }));
23850
23880
  return _sendAsync.apply(this, arguments);
23851
23881
  }