@ethereansos/interfaces-core 0.4.129 → 0.4.132

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.cjs.js CHANGED
@@ -23759,7 +23759,7 @@ var solidityImportRule = new RegExp('import( )+"(\\d+)"( )*;', 'gs');
23759
23759
  var pragmaSolidityRule = new RegExp('pragma( )+solidity( )*(\\^|>)\\d+.\\d+.\\d+;', 'gs');
23760
23760
 
23761
23761
  var instrumentedProviders = [];
23762
- var instrumentableMethods = ['eth_call', 'eth_getLogs'];
23762
+ var defaultInstrumentableMethods = ['eth_call', 'eth_getLogs', 'eth_estimateGas'];
23763
23763
 
23764
23764
  function instrumentProvider(_x, _x2) {
23765
23765
  return _instrumentProvider.apply(this, arguments);
@@ -23767,37 +23767,53 @@ function instrumentProvider(_x, _x2) {
23767
23767
 
23768
23768
  function _instrumentProvider() {
23769
23769
  _instrumentProvider = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee(provider, method) {
23770
- var entry, chainId, _ref, chainProvider;
23770
+ var _instrumentableMethod;
23771
+
23772
+ var instrumentableMethods, entry, chainId, _ref, chainProvider;
23771
23773
 
23772
23774
  return regeneratorRuntime.wrap(function _callee$(_context) {
23773
23775
  while (1) {
23774
23776
  switch (_context.prev = _context.next) {
23775
23777
  case 0:
23776
- if (!(instrumentableMethods.indexOf(method) === -1)) {
23777
- _context.next = 2;
23778
+ instrumentableMethods = [];
23779
+
23780
+ try {
23781
+ instrumentableMethods = _toConsumableArray(sendAsync.context.providerInstrumentableMethods || []);
23782
+ } catch (e) {}
23783
+
23784
+ (_instrumentableMethod = instrumentableMethods).push.apply(_instrumentableMethod, defaultInstrumentableMethods);
23785
+
23786
+ instrumentableMethods = instrumentableMethods.map(function (it) {
23787
+ return it.toLowerCase();
23788
+ }).filter(function (it, i, arr) {
23789
+ return arr.indexOf(it) === i;
23790
+ });
23791
+
23792
+ if (!(instrumentableMethods.indexOf(method.toLowerCase()) === -1)) {
23793
+ _context.next = 6;
23778
23794
  break;
23779
23795
  }
23780
23796
 
23781
23797
  return _context.abrupt("return", provider);
23782
23798
 
23783
- case 2:
23799
+ case 6:
23784
23800
  entry = instrumentedProviders.filter(function (it) {
23785
23801
  return it.provider === provider;
23786
23802
  })[0];
23787
23803
 
23788
23804
  if (!entry) {
23789
- _context.next = 5;
23805
+ _context.next = 9;
23790
23806
  break;
23791
23807
  }
23792
23808
 
23793
23809
  return _context.abrupt("return", entry.instrumentedProvider);
23794
23810
 
23795
- case 5:
23811
+ case 9:
23796
23812
  _context.t0 = parseInt;
23797
- _context.next = 8;
23813
+ _context.next = 12;
23798
23814
  return sendAsync(provider, 'eth_chainId');
23799
23815
 
23800
- case 8:
23816
+ case 12:
23801
23817
  _context.t1 = _context.sent;
23802
23818
  chainId = (0, _context.t0)(_context.t1);
23803
23819
  instrumentedProviders.push(entry = {
@@ -23810,7 +23826,7 @@ function _instrumentProvider() {
23810
23826
  }, chainProvider = _ref.chainProvider;
23811
23827
  return _context.abrupt("return", entry.instrumentedProvider = chainId !== 1 && chainProvider[chainId] ? new Web3__default["default"].providers.HttpProvider(chainProvider[chainId]) : provider);
23812
23828
 
23813
- case 13:
23829
+ case 17:
23814
23830
  case "end":
23815
23831
  return _context.stop();
23816
23832
  }
@@ -23834,7 +23850,7 @@ function _sendAsync() {
23834
23850
  switch (_context3.prev = _context3.next) {
23835
23851
  case 0:
23836
23852
  _context3.next = 2;
23837
- return instrumentProvider(inputProvider);
23853
+ return instrumentProvider(inputProvider, method);
23838
23854
 
23839
23855
  case 2:
23840
23856
  provider = _context3.sent;