@ethereansos/interfaces-core 0.4.126 → 0.4.129

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