@ethereansos/interfaces-core 0.4.125 → 0.4.128

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.esm.js CHANGED
@@ -23746,53 +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
+ }
23769
23768
 
23770
- if (!(method !== 'eth_chainId')) {
23771
- _context2.next = 7;
23769
+ return _context.abrupt("return");
23770
+
23771
+ case 2:
23772
+ entry = instrumentedProviders.filter(function (it) {
23773
+ return it.provider === provider;
23774
+ })[0];
23775
+
23776
+ if (!entry) {
23777
+ _context.next = 5;
23772
23778
  break;
23773
23779
  }
23774
23780
 
23775
- _context2.next = 4;
23781
+ return _context.abrupt("return", entry.instrumentedProvider);
23782
+
23783
+ case 5:
23784
+ _context.t0 = parseInt;
23785
+ _context.next = 8;
23776
23786
  return sendAsync(provider, 'eth_chainId');
23777
23787
 
23778
- case 4:
23779
- chainId = _context2.sent;
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
+ });
23780
23796
  _ref = sendAsync.context || {
23781
23797
  chainProvider: {}
23782
23798
  }, chainProvider = _ref.chainProvider;
23783
- 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);
23784
23800
 
23785
- case 7:
23786
- params = Array.prototype.slice.call(_args2).slice(2) || [];
23787
- _context2.next = 10;
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;
23788
23831
  return new Promise( /*#__PURE__*/function () {
23789
- var _ref2 = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee(ok, ko) {
23790
- 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) {
23791
23834
  while (1) {
23792
- switch (_context.prev = _context.next) {
23835
+ switch (_context2.prev = _context2.next) {
23793
23836
  case 0:
23794
- _context.prev = 0;
23795
- _context.next = 3;
23837
+ _context2.prev = 0;
23838
+ _context2.next = 3;
23796
23839
  return (provider.sendAsync || provider.send).call(provider, {
23797
23840
  jsonrpc: '2.0',
23798
23841
  method: method,
@@ -23803,36 +23846,36 @@ function _sendAsync() {
23803
23846
  });
23804
23847
 
23805
23848
  case 3:
23806
- _context.next = 8;
23849
+ _context2.next = 8;
23807
23850
  break;
23808
23851
 
23809
23852
  case 5:
23810
- _context.prev = 5;
23811
- _context.t0 = _context["catch"](0);
23812
- 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));
23813
23856
 
23814
23857
  case 8:
23815
23858
  case "end":
23816
- return _context.stop();
23859
+ return _context2.stop();
23817
23860
  }
23818
23861
  }
23819
- }, _callee, null, [[0, 5]]);
23862
+ }, _callee2, null, [[0, 5]]);
23820
23863
  }));
23821
23864
 
23822
- return function (_x3, _x4) {
23865
+ return function (_x5, _x6) {
23823
23866
  return _ref2.apply(this, arguments);
23824
23867
  };
23825
23868
  }());
23826
23869
 
23827
- case 10:
23828
- return _context2.abrupt("return", _context2.sent);
23870
+ case 6:
23871
+ return _context3.abrupt("return", _context3.sent);
23829
23872
 
23830
- case 11:
23873
+ case 7:
23831
23874
  case "end":
23832
- return _context2.stop();
23875
+ return _context3.stop();
23833
23876
  }
23834
23877
  }
23835
- }, _callee2);
23878
+ }, _callee3);
23836
23879
  }));
23837
23880
  return _sendAsync.apply(this, arguments);
23838
23881
  }