@toruslabs/ethereum-controllers 5.8.0 → 5.9.0

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.
@@ -1067,16 +1067,15 @@ const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
1067
1067
  * Network state changes also retrigger accounts update.
1068
1068
  */
1069
1069
  class AccountTrackerController extends base_controllers_namespaceObject.BaseController {
1070
- constructor(_ref) {
1071
- let {
1072
- config,
1073
- state,
1074
- provider,
1075
- blockTracker,
1076
- getIdentities,
1077
- onPreferencesStateChange,
1078
- getCurrentChainId
1079
- } = _ref;
1070
+ constructor({
1071
+ config,
1072
+ state,
1073
+ provider,
1074
+ blockTracker,
1075
+ getIdentities,
1076
+ onPreferencesStateChange,
1077
+ getCurrentChainId
1078
+ }) {
1080
1079
  super({
1081
1080
  config,
1082
1081
  state
@@ -1229,14 +1228,8 @@ const erc1155Interface = new external_ethers_namespaceObject.Interface(erc1155Ab
1229
1228
  // functions that handle normalizing of that key in txParams
1230
1229
 
1231
1230
  const normalizers = {
1232
- from: function (from) {
1233
- let LowerCase = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1234
- return LowerCase ? (0,util_namespaceObject.addHexPrefix)(from).toLowerCase() : (0,util_namespaceObject.addHexPrefix)(from);
1235
- },
1236
- to: function (to) {
1237
- let LowerCase = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1238
- return LowerCase ? (0,util_namespaceObject.addHexPrefix)(to).toLowerCase() : (0,util_namespaceObject.addHexPrefix)(to);
1239
- },
1231
+ from: (from, LowerCase = true) => LowerCase ? (0,util_namespaceObject.addHexPrefix)(from).toLowerCase() : (0,util_namespaceObject.addHexPrefix)(from),
1232
+ to: (to, LowerCase = true) => LowerCase ? (0,util_namespaceObject.addHexPrefix)(to).toLowerCase() : (0,util_namespaceObject.addHexPrefix)(to),
1240
1233
  nonce: nonce => (0,util_namespaceObject.addHexPrefix)(nonce),
1241
1234
  customNonceValue: nonce => (0,util_namespaceObject.addHexPrefix)(nonce),
1242
1235
  value: value => (0,util_namespaceObject.addHexPrefix)(value),
@@ -1251,8 +1244,7 @@ const normalizers = {
1251
1244
  /**
1252
1245
  * normalizes txParams
1253
1246
  */
1254
- function normalizeTxParameters(txParameters) {
1255
- let lowerCase = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1247
+ function normalizeTxParameters(txParameters, lowerCase = true) {
1256
1248
  // apply only keys in the normalizers
1257
1249
  const normalizedTxParameters = {
1258
1250
  id: txParameters.id || (0,base_controllers_namespaceObject.randomId)(),
@@ -1370,8 +1362,7 @@ function validateRecipient(txParameters) {
1370
1362
  * Validates the given tx parameters
1371
1363
  * @throws if the tx params contains invalid fields
1372
1364
  */
1373
- function validateTxParameters(txParams) {
1374
- let eip1559Compatibility = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1365
+ function validateTxParameters(txParams, eip1559Compatibility = true) {
1375
1366
  if (!txParams || typeof txParams !== "object" || Array.isArray(txParams)) {
1376
1367
  throw rpc_errors_namespaceObject.rpcErrors.invalidParams("Invalid transaction params: must be an object.");
1377
1368
  }
@@ -1383,8 +1374,7 @@ function validateTxParameters(txParams) {
1383
1374
  }) && !eip1559Compatibility) {
1384
1375
  throw rpc_errors_namespaceObject.rpcErrors.invalidParams("Invalid transaction params: params specify an EIP-1559 transaction but the current network does not support EIP-1559");
1385
1376
  }
1386
- Object.entries(txParams).forEach(_ref => {
1387
- let [key, value] = _ref;
1377
+ Object.entries(txParams).forEach(([key, value]) => {
1388
1378
  // validate types
1389
1379
  switch (key) {
1390
1380
  case "from":
@@ -1428,8 +1418,7 @@ function validateTxParameters(txParams) {
1428
1418
  }
1429
1419
  });
1430
1420
  }
1431
- function normalizeAndValidateTxParams(txParams) {
1432
- let lowerCase = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1421
+ function normalizeAndValidateTxParams(txParams, lowerCase = true) {
1433
1422
  const normalizedTxParams = normalizeTxParameters(txParams, lowerCase);
1434
1423
  validateTxParameters(normalizedTxParams);
1435
1424
  return normalizedTxParams;
@@ -1775,11 +1764,10 @@ const DEFAULT_POLLING_INTERVAL = 20;
1775
1764
  const DEFAULT_RETRY_TIMEOUT = 2;
1776
1765
  const SEC = 1000;
1777
1766
  class PollingBlockTracker extends base_controllers_namespaceObject.BaseBlockTracker {
1778
- constructor(_ref) {
1779
- let {
1780
- config,
1781
- state = {}
1782
- } = _ref;
1767
+ constructor({
1768
+ config,
1769
+ state = {}
1770
+ }) {
1783
1771
  if (!config.provider) {
1784
1772
  throw new Error("PollingBlockTracker - no provider specified.");
1785
1773
  }
@@ -1860,12 +1848,11 @@ const http_helpers_namespaceObject = require("@toruslabs/http-helpers");
1860
1848
 
1861
1849
 
1862
1850
  class CurrencyController extends base_controllers_namespaceObject.BaseCurrencyController {
1863
- constructor(_ref) {
1864
- let {
1865
- config,
1866
- state,
1867
- onNetworkChanged
1868
- } = _ref;
1851
+ constructor({
1852
+ config,
1853
+ state,
1854
+ onNetworkChanged
1855
+ }) {
1869
1856
  super({
1870
1857
  config,
1871
1858
  state
@@ -2039,20 +2026,19 @@ const isValidBase = base => Number.isInteger(base) && base > 1;
2039
2026
  /**
2040
2027
  * Utility method to convert a value between denominations, formats and currencies.
2041
2028
  */
2042
- const converter = _ref => {
2043
- let {
2044
- value,
2045
- fromNumericBase,
2046
- fromDenomination,
2047
- fromCurrency,
2048
- toNumericBase,
2049
- toDenomination,
2050
- toCurrency,
2051
- numberOfDecimals,
2052
- conversionRate,
2053
- invertConversionRate,
2054
- roundDown
2055
- } = _ref;
2029
+ const converter = ({
2030
+ value,
2031
+ fromNumericBase,
2032
+ fromDenomination,
2033
+ fromCurrency,
2034
+ toNumericBase,
2035
+ toDenomination,
2036
+ toCurrency,
2037
+ numberOfDecimals,
2038
+ conversionRate,
2039
+ invertConversionRate,
2040
+ roundDown
2041
+ }) => {
2056
2042
  let convertedValue = fromNumericBase ? toBigNumber[fromNumericBase](value) : value;
2057
2043
  if (fromDenomination) {
2058
2044
  convertedValue = toNormalizedDenomination[fromDenomination](convertedValue);
@@ -2081,18 +2067,17 @@ const converter = _ref => {
2081
2067
  }
2082
2068
  return convertedValue;
2083
2069
  };
2084
- const conversionUtil = (value, _ref2) => {
2085
- let {
2086
- fromCurrency = null,
2087
- toCurrency = fromCurrency,
2088
- fromNumericBase,
2089
- toNumericBase,
2090
- fromDenomination,
2091
- toDenomination,
2092
- numberOfDecimals,
2093
- conversionRate,
2094
- invertConversionRate
2095
- } = _ref2;
2070
+ const conversionUtil = (value, {
2071
+ fromCurrency = null,
2072
+ toCurrency = fromCurrency,
2073
+ fromNumericBase,
2074
+ toNumericBase,
2075
+ fromDenomination,
2076
+ toDenomination,
2077
+ numberOfDecimals,
2078
+ conversionRate,
2079
+ invertConversionRate
2080
+ }) => {
2096
2081
  if (fromCurrency !== toCurrency && !conversionRate) {
2097
2082
  return 0;
2098
2083
  }
@@ -2121,8 +2106,7 @@ const getBigNumber = (value, base) => {
2121
2106
  }
2122
2107
  return new (external_bignumber_js_default())(String(value), base);
2123
2108
  };
2124
- const addCurrencies = function (a, b) {
2125
- let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2109
+ const addCurrencies = (a, b, options = {}) => {
2126
2110
  const {
2127
2111
  aBase,
2128
2112
  bBase
@@ -2136,8 +2120,7 @@ const addCurrencies = function (a, b) {
2136
2120
  value
2137
2121
  }, conversionOptions));
2138
2122
  };
2139
- const subtractCurrencies = function (a, b) {
2140
- let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2123
+ const subtractCurrencies = (a, b, options = {}) => {
2141
2124
  const {
2142
2125
  aBase,
2143
2126
  bBase
@@ -2151,8 +2134,7 @@ const subtractCurrencies = function (a, b) {
2151
2134
  value
2152
2135
  }, conversionOptions));
2153
2136
  };
2154
- const multiplyCurrencies = function (a, b) {
2155
- let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2137
+ const multiplyCurrencies = (a, b, options = {}) => {
2156
2138
  const {
2157
2139
  multiplicandBase,
2158
2140
  multiplierBase
@@ -2166,44 +2148,41 @@ const multiplyCurrencies = function (a, b) {
2166
2148
  value
2167
2149
  }, conversionOptions));
2168
2150
  };
2169
- const conversionGreaterThan = (_ref3, _ref4) => {
2170
- let secondProps = Object.assign({}, (objectDestructuringEmpty_default()(_ref4), _ref4));
2171
- let firstProps = Object.assign({}, (objectDestructuringEmpty_default()(_ref3), _ref3));
2151
+ const conversionGreaterThan = (_ref, _ref2) => {
2152
+ let secondProps = Object.assign({}, (objectDestructuringEmpty_default()(_ref2), _ref2));
2153
+ let firstProps = Object.assign({}, (objectDestructuringEmpty_default()(_ref), _ref));
2172
2154
  const firstValue = converter(objectSpread2_default()({}, firstProps));
2173
2155
  const secondValue = converter(objectSpread2_default()({}, secondProps));
2174
2156
  return firstValue.gt(secondValue);
2175
2157
  };
2176
- const conversionLessThan = (_ref5, _ref6) => {
2177
- let secondProps = Object.assign({}, (objectDestructuringEmpty_default()(_ref6), _ref6));
2178
- let firstProps = Object.assign({}, (objectDestructuringEmpty_default()(_ref5), _ref5));
2158
+ const conversionLessThan = (_ref3, _ref4) => {
2159
+ let secondProps = Object.assign({}, (objectDestructuringEmpty_default()(_ref4), _ref4));
2160
+ let firstProps = Object.assign({}, (objectDestructuringEmpty_default()(_ref3), _ref3));
2179
2161
  const firstValue = converter(objectSpread2_default()({}, firstProps));
2180
2162
  const secondValue = converter(objectSpread2_default()({}, secondProps));
2181
2163
  return firstValue.lt(secondValue);
2182
2164
  };
2183
- const conversionMax = (_ref7, _ref8) => {
2184
- let secondProps = Object.assign({}, (objectDestructuringEmpty_default()(_ref8), _ref8));
2185
- let firstProps = Object.assign({}, (objectDestructuringEmpty_default()(_ref7), _ref7));
2165
+ const conversionMax = (_ref5, _ref6) => {
2166
+ let secondProps = Object.assign({}, (objectDestructuringEmpty_default()(_ref6), _ref6));
2167
+ let firstProps = Object.assign({}, (objectDestructuringEmpty_default()(_ref5), _ref5));
2186
2168
  const firstIsGreater = conversionGreaterThan(objectSpread2_default()({}, firstProps), objectSpread2_default()({}, secondProps));
2187
2169
  return firstIsGreater ? firstProps.value : secondProps.value;
2188
2170
  };
2189
- const conversionGTE = (_ref9, _ref10) => {
2190
- let secondProps = Object.assign({}, (objectDestructuringEmpty_default()(_ref10), _ref10));
2191
- let firstProps = Object.assign({}, (objectDestructuringEmpty_default()(_ref9), _ref9));
2171
+ const conversionGTE = (_ref7, _ref8) => {
2172
+ let secondProps = Object.assign({}, (objectDestructuringEmpty_default()(_ref8), _ref8));
2173
+ let firstProps = Object.assign({}, (objectDestructuringEmpty_default()(_ref7), _ref7));
2192
2174
  const firstValue = converter(objectSpread2_default()({}, firstProps));
2193
2175
  const secondValue = converter(objectSpread2_default()({}, secondProps));
2194
2176
  return firstValue.isGreaterThanOrEqualTo(secondValue);
2195
2177
  };
2196
- const conversionLTE = (_ref11, _ref12) => {
2197
- let secondProps = Object.assign({}, (objectDestructuringEmpty_default()(_ref12), _ref12));
2198
- let firstProps = Object.assign({}, (objectDestructuringEmpty_default()(_ref11), _ref11));
2178
+ const conversionLTE = (_ref9, _ref10) => {
2179
+ let secondProps = Object.assign({}, (objectDestructuringEmpty_default()(_ref10), _ref10));
2180
+ let firstProps = Object.assign({}, (objectDestructuringEmpty_default()(_ref9), _ref9));
2199
2181
  const firstValue = converter(objectSpread2_default()({}, firstProps));
2200
2182
  const secondValue = converter(objectSpread2_default()({}, secondProps));
2201
2183
  return firstValue.isLessThanOrEqualTo(secondValue);
2202
2184
  };
2203
- const toNegative = function (n) {
2204
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2205
- return multiplyCurrencies(n, -1, options);
2206
- };
2185
+ const toNegative = (n, options = {}) => multiplyCurrencies(n, -1, options);
2207
2186
  const decGWEIToHexWEI = decGWEI => {
2208
2187
  return conversionUtil(decGWEI, {
2209
2188
  fromNumericBase: "dec",
@@ -2374,21 +2353,20 @@ const LEGACY_GAS_PRICES_API_URL = "https://api.metaswap.codefi.network/gasPrices
2374
2353
  * Returns gas prices in dec gwei
2375
2354
  */
2376
2355
  class GasFeeController extends base_controllers_namespaceObject.BaseController {
2377
- constructor(_ref) {
2378
- let {
2379
- config,
2380
- state,
2381
- getNetworkIdentifier,
2382
- getProvider,
2383
- fetchGasEstimates = gasUtil_fetchGasEstimates,
2384
- fetchEthGasPriceEstimate = gasUtil_fetchEthGasPriceEstimate,
2385
- fetchLegacyGasPriceEstimates = gasUtil_fetchLegacyGasPriceEstimates,
2386
- fetchGasEstimatesViaEthFeeHistory = gasUtil_fetchGasEstimatesViaEthFeeHistory,
2387
- getCurrentNetworkLegacyGasAPICompatibility,
2388
- getCurrentNetworkEIP1559Compatibility,
2389
- getCurrentAccountEIP1559Compatibility,
2390
- onNetworkStateChange
2391
- } = _ref;
2356
+ constructor({
2357
+ config,
2358
+ state,
2359
+ getNetworkIdentifier,
2360
+ getProvider,
2361
+ fetchGasEstimates = gasUtil_fetchGasEstimates,
2362
+ fetchEthGasPriceEstimate = gasUtil_fetchEthGasPriceEstimate,
2363
+ fetchLegacyGasPriceEstimates = gasUtil_fetchLegacyGasPriceEstimates,
2364
+ fetchGasEstimatesViaEthFeeHistory = gasUtil_fetchGasEstimatesViaEthFeeHistory,
2365
+ getCurrentNetworkLegacyGasAPICompatibility,
2366
+ getCurrentNetworkEIP1559Compatibility,
2367
+ getCurrentAccountEIP1559Compatibility,
2368
+ onNetworkStateChange
2369
+ }) {
2392
2370
  super({
2393
2371
  config,
2394
2372
  state
@@ -2578,11 +2556,10 @@ const eth_sig_util_namespaceObject = require("@metamask/eth-sig-util");
2578
2556
 
2579
2557
 
2580
2558
  class KeyringController extends base_controllers_namespaceObject.BaseKeyringController {
2581
- constructor(_ref) {
2582
- let {
2583
- config,
2584
- state
2585
- } = _ref;
2559
+ constructor({
2560
+ config,
2561
+ state
2562
+ }) {
2586
2563
  super({
2587
2564
  config,
2588
2565
  state
@@ -2692,12 +2669,11 @@ class AbstractMessageController extends base_controllers_namespaceObject.BaseCon
2692
2669
  * Controller in charge of managing - storing, adding, removing, updating - Messages.
2693
2670
  *
2694
2671
  */
2695
- constructor(_ref) {
2696
- let {
2697
- config,
2698
- state,
2699
- getNetworkIdentifier
2700
- } = _ref;
2672
+ constructor({
2673
+ config,
2674
+ state,
2675
+ getNetworkIdentifier
2676
+ }) {
2701
2677
  super({
2702
2678
  config,
2703
2679
  state
@@ -2935,13 +2911,12 @@ function validateSwitchChainData(data) {
2935
2911
 
2936
2912
 
2937
2913
  class AddChainController extends AbstractMessageController {
2938
- constructor(_ref) {
2939
- let {
2940
- config,
2941
- state,
2942
- getNetworkIdentifier,
2943
- addChain
2944
- } = _ref;
2914
+ constructor({
2915
+ config,
2916
+ state,
2917
+ getNetworkIdentifier,
2918
+ addChain
2919
+ }) {
2945
2920
  super({
2946
2921
  config,
2947
2922
  state,
@@ -3006,13 +2981,12 @@ class AddChainController extends AbstractMessageController {
3006
2981
 
3007
2982
 
3008
2983
  class DecryptMessageController extends AbstractMessageController {
3009
- constructor(_ref) {
3010
- let {
3011
- config,
3012
- state,
3013
- decryptMessage,
3014
- getNetworkIdentifier
3015
- } = _ref;
2984
+ constructor({
2985
+ config,
2986
+ state,
2987
+ decryptMessage,
2988
+ getNetworkIdentifier
2989
+ }) {
3016
2990
  super({
3017
2991
  config,
3018
2992
  state,
@@ -3079,13 +3053,12 @@ class DecryptMessageController extends AbstractMessageController {
3079
3053
 
3080
3054
 
3081
3055
  class EncryptionPublicKeyController extends AbstractMessageController {
3082
- constructor(_ref) {
3083
- let {
3084
- config,
3085
- state,
3086
- signEncryptionPublicKey,
3087
- getNetworkIdentifier
3088
- } = _ref;
3056
+ constructor({
3057
+ config,
3058
+ state,
3059
+ signEncryptionPublicKey,
3060
+ getNetworkIdentifier
3061
+ }) {
3089
3062
  super({
3090
3063
  config,
3091
3064
  state,
@@ -3152,13 +3125,12 @@ class EncryptionPublicKeyController extends AbstractMessageController {
3152
3125
 
3153
3126
 
3154
3127
  class MessageController extends AbstractMessageController {
3155
- constructor(_ref) {
3156
- let {
3157
- config,
3158
- state,
3159
- signMessage,
3160
- getNetworkIdentifier
3161
- } = _ref;
3128
+ constructor({
3129
+ config,
3130
+ state,
3131
+ signMessage,
3132
+ getNetworkIdentifier
3133
+ }) {
3162
3134
  super({
3163
3135
  config,
3164
3136
  state,
@@ -3223,13 +3195,12 @@ class MessageController extends AbstractMessageController {
3223
3195
 
3224
3196
 
3225
3197
  class PersonalMessageController extends AbstractMessageController {
3226
- constructor(_ref) {
3227
- let {
3228
- config,
3229
- state,
3230
- signPersonalMessage,
3231
- getNetworkIdentifier
3232
- } = _ref;
3198
+ constructor({
3199
+ config,
3200
+ state,
3201
+ signPersonalMessage,
3202
+ getNetworkIdentifier
3203
+ }) {
3233
3204
  super({
3234
3205
  config,
3235
3206
  state,
@@ -3294,13 +3265,12 @@ class PersonalMessageController extends AbstractMessageController {
3294
3265
 
3295
3266
 
3296
3267
  class SwitchChainController extends AbstractMessageController {
3297
- constructor(_ref) {
3298
- let {
3299
- config,
3300
- state,
3301
- getNetworkIdentifier,
3302
- switchChain
3303
- } = _ref;
3268
+ constructor({
3269
+ config,
3270
+ state,
3271
+ getNetworkIdentifier,
3272
+ switchChain
3273
+ }) {
3304
3274
  super({
3305
3275
  config,
3306
3276
  state,
@@ -3379,13 +3349,12 @@ function getMessageType(version) {
3379
3349
  }
3380
3350
  }
3381
3351
  class TypedMessageController extends AbstractMessageController {
3382
- constructor(_ref) {
3383
- let {
3384
- config,
3385
- state,
3386
- signTypedData,
3387
- getNetworkIdentifier
3388
- } = _ref;
3352
+ constructor({
3353
+ config,
3354
+ state,
3355
+ signTypedData,
3356
+ getNetworkIdentifier
3357
+ }) {
3389
3358
  super({
3390
3359
  config,
3391
3360
  state,
@@ -3458,10 +3427,9 @@ const openlogin_jrpc_namespaceObject = require("@toruslabs/openlogin-jrpc");
3458
3427
 
3459
3428
 
3460
3429
 
3461
- function createGetAccountsMiddleware(_ref) {
3462
- let {
3463
- getAccounts
3464
- } = _ref;
3430
+ function createGetAccountsMiddleware({
3431
+ getAccounts
3432
+ }) {
3465
3433
  return (0,openlogin_jrpc_namespaceObject.createAsyncMiddleware)(async (request, response, next) => {
3466
3434
  const {
3467
3435
  method
@@ -3472,10 +3440,9 @@ function createGetAccountsMiddleware(_ref) {
3472
3440
  response.result = accounts;
3473
3441
  });
3474
3442
  }
3475
- function createProcessTransactionMiddleware(_ref2) {
3476
- let {
3477
- processTransaction
3478
- } = _ref2;
3443
+ function createProcessTransactionMiddleware({
3444
+ processTransaction
3445
+ }) {
3479
3446
  return (0,openlogin_jrpc_namespaceObject.createAsyncMiddleware)(async (request, response, next) => {
3480
3447
  const {
3481
3448
  method
@@ -3485,10 +3452,9 @@ function createProcessTransactionMiddleware(_ref2) {
3485
3452
  response.result = await processTransaction(request.params, request);
3486
3453
  });
3487
3454
  }
3488
- function createProcessEthSignMessage(_ref3) {
3489
- let {
3490
- processEthSignMessage
3491
- } = _ref3;
3455
+ function createProcessEthSignMessage({
3456
+ processEthSignMessage
3457
+ }) {
3492
3458
  return (0,openlogin_jrpc_namespaceObject.createAsyncMiddleware)(async (request, response, next) => {
3493
3459
  const {
3494
3460
  method
@@ -3510,10 +3476,9 @@ function createProcessEthSignMessage(_ref3) {
3510
3476
  response.result = await processEthSignMessage(msgParams, request);
3511
3477
  });
3512
3478
  }
3513
- function createProcessTypedMessage(_ref4) {
3514
- let {
3515
- processTypedMessage
3516
- } = _ref4;
3479
+ function createProcessTypedMessage({
3480
+ processTypedMessage
3481
+ }) {
3517
3482
  return (0,openlogin_jrpc_namespaceObject.createAsyncMiddleware)(async (request, response, next) => {
3518
3483
  const {
3519
3484
  method
@@ -3536,10 +3501,9 @@ function createProcessTypedMessage(_ref4) {
3536
3501
  response.result = await processTypedMessage(msgParams, request);
3537
3502
  });
3538
3503
  }
3539
- function createProcessTypedMessageV3(_ref5) {
3540
- let {
3541
- processTypedMessageV3
3542
- } = _ref5;
3504
+ function createProcessTypedMessageV3({
3505
+ processTypedMessageV3
3506
+ }) {
3543
3507
  return (0,openlogin_jrpc_namespaceObject.createAsyncMiddleware)(async (request, response, next) => {
3544
3508
  const {
3545
3509
  method
@@ -3562,10 +3526,9 @@ function createProcessTypedMessageV3(_ref5) {
3562
3526
  response.result = await processTypedMessageV3(msgParams, request);
3563
3527
  });
3564
3528
  }
3565
- function createProcessTypedMessageV4(_ref6) {
3566
- let {
3567
- processTypedMessageV4
3568
- } = _ref6;
3529
+ function createProcessTypedMessageV4({
3530
+ processTypedMessageV4
3531
+ }) {
3569
3532
  return (0,openlogin_jrpc_namespaceObject.createAsyncMiddleware)(async (request, response, next) => {
3570
3533
  const {
3571
3534
  method
@@ -3588,10 +3551,9 @@ function createProcessTypedMessageV4(_ref6) {
3588
3551
  response.result = await processTypedMessageV4(msgParams, request);
3589
3552
  });
3590
3553
  }
3591
- function createProcessPersonalMessage(_ref7) {
3592
- let {
3593
- processPersonalMessage
3594
- } = _ref7;
3554
+ function createProcessPersonalMessage({
3555
+ processPersonalMessage
3556
+ }) {
3595
3557
  return (0,openlogin_jrpc_namespaceObject.createAsyncMiddleware)(async (request, response, next) => {
3596
3558
  const {
3597
3559
  method
@@ -3624,10 +3586,9 @@ function createProcessPersonalMessage(_ref7) {
3624
3586
  response.result = await processPersonalMessage(msgParams, request);
3625
3587
  });
3626
3588
  }
3627
- function createPendingNonceMiddleware(_ref8) {
3628
- let {
3629
- getPendingNonce
3630
- } = _ref8;
3589
+ function createPendingNonceMiddleware({
3590
+ getPendingNonce
3591
+ }) {
3631
3592
  return (0,openlogin_jrpc_namespaceObject.createAsyncMiddleware)(async (request, response, next) => {
3632
3593
  const {
3633
3594
  params,
@@ -3689,10 +3650,9 @@ function formatTxMetaForRpcResult(txMeta) {
3689
3650
  }
3690
3651
  return formattedTxMeta;
3691
3652
  }
3692
- function createPendingTxMiddleware(_ref9) {
3693
- let {
3694
- getPendingTransactionByHash
3695
- } = _ref9;
3653
+ function createPendingTxMiddleware({
3654
+ getPendingTransactionByHash
3655
+ }) {
3696
3656
  return (0,openlogin_jrpc_namespaceObject.createAsyncMiddleware)(async (request, response, next) => {
3697
3657
  const {
3698
3658
  params,
@@ -3708,10 +3668,9 @@ function createPendingTxMiddleware(_ref9) {
3708
3668
  return undefined;
3709
3669
  });
3710
3670
  }
3711
- function createProcessEncryptionPublicKeyMiddleware(_ref10) {
3712
- let {
3713
- processEncryptionPublicKey
3714
- } = _ref10;
3671
+ function createProcessEncryptionPublicKeyMiddleware({
3672
+ processEncryptionPublicKey
3673
+ }) {
3715
3674
  return (0,openlogin_jrpc_namespaceObject.createAsyncMiddleware)(async (request, response, next) => {
3716
3675
  const {
3717
3676
  method
@@ -3731,10 +3690,9 @@ function createProcessEncryptionPublicKeyMiddleware(_ref10) {
3731
3690
  response.result = await processEncryptionPublicKey(msgParams, request);
3732
3691
  });
3733
3692
  }
3734
- function createProcessDecryptMessageMiddleware(_ref11) {
3735
- let {
3736
- processDecryptMessage
3737
- } = _ref11;
3693
+ function createProcessDecryptMessageMiddleware({
3694
+ processDecryptMessage
3695
+ }) {
3738
3696
  return (0,openlogin_jrpc_namespaceObject.createAsyncMiddleware)(async (request, response, next) => {
3739
3697
  const {
3740
3698
  method
@@ -3754,10 +3712,9 @@ function createProcessDecryptMessageMiddleware(_ref11) {
3754
3712
  response.result = await processDecryptMessage(msgParams, request);
3755
3713
  });
3756
3714
  }
3757
- function createProcessSwitchEthereumChain(_ref12) {
3758
- let {
3759
- processSwitchEthereumChain
3760
- } = _ref12;
3715
+ function createProcessSwitchEthereumChain({
3716
+ processSwitchEthereumChain
3717
+ }) {
3761
3718
  return (0,openlogin_jrpc_namespaceObject.createAsyncMiddleware)(async (request, response, next) => {
3762
3719
  const {
3763
3720
  method
@@ -3774,10 +3731,9 @@ function createProcessSwitchEthereumChain(_ref12) {
3774
3731
  response.result = await processSwitchEthereumChain(msgParams, request);
3775
3732
  });
3776
3733
  }
3777
- function createProcessAddEthereumChain(_ref13) {
3778
- let {
3779
- processAddEthereumChain
3780
- } = _ref13;
3734
+ function createProcessAddEthereumChain({
3735
+ processAddEthereumChain
3736
+ }) {
3781
3737
  return (0,openlogin_jrpc_namespaceObject.createAsyncMiddleware)(async (request, response, next) => {
3782
3738
  const {
3783
3739
  method
@@ -3794,10 +3750,9 @@ function createProcessAddEthereumChain(_ref13) {
3794
3750
  response.result = await processAddEthereumChain(msgParams, request);
3795
3751
  });
3796
3752
  }
3797
- function createRequestAccountsMiddleware(_ref14) {
3798
- let {
3799
- requestAccounts
3800
- } = _ref14;
3753
+ function createRequestAccountsMiddleware({
3754
+ requestAccounts
3755
+ }) {
3801
3756
  return (0,openlogin_jrpc_namespaceObject.createAsyncMiddleware)(async (request, response, next) => {
3802
3757
  const {
3803
3758
  method
@@ -4041,11 +3996,10 @@ const NetworkController_excluded = ["chainId", "rpcTarget"];
4041
3996
 
4042
3997
 
4043
3998
  class NetworkController extends base_controllers_namespaceObject.BaseController {
4044
- constructor(_ref) {
4045
- let {
4046
- config,
4047
- state
4048
- } = _ref;
3999
+ constructor({
4000
+ config,
4001
+ state
4002
+ }) {
4049
4003
  super({
4050
4004
  config,
4051
4005
  state
@@ -4172,11 +4126,10 @@ class NetworkController extends base_controllers_namespaceObject.BaseController
4172
4126
  rpcTarget
4173
4127
  }, rest));
4174
4128
  }
4175
- setNetworkClient(_ref2) {
4176
- let {
4177
- networkMiddleware,
4178
- blockTracker
4179
- } = _ref2;
4129
+ setNetworkClient({
4130
+ networkMiddleware,
4131
+ blockTracker
4132
+ }) {
4180
4133
  const ethereumMiddleware = createEthereumMiddleware(this.baseProviderHandlers);
4181
4134
  const engine = new openlogin_jrpc_namespaceObject.JRPCEngine();
4182
4135
  engine.push(ethereumMiddleware);
@@ -4187,11 +4140,10 @@ class NetworkController extends base_controllers_namespaceObject.BaseController
4187
4140
  blockTracker
4188
4141
  });
4189
4142
  }
4190
- setProvider(_ref3) {
4191
- let {
4192
- provider,
4193
- blockTracker
4194
- } = _ref3;
4143
+ setProvider({
4144
+ provider,
4145
+ blockTracker
4146
+ }) {
4195
4147
  if (this.providerProxy) {
4196
4148
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4197
4149
  // @ts-ignore
@@ -4238,19 +4190,18 @@ class NetworkController extends base_controllers_namespaceObject.BaseController
4238
4190
 
4239
4191
 
4240
4192
  class NftHandler {
4241
- constructor(_ref) {
4242
- let {
4243
- chainId,
4244
- contractAddress,
4245
- contractImage,
4246
- contractName,
4247
- contractSymbol,
4248
- nftStandard,
4249
- provider,
4250
- contractDescription,
4251
- contractFallbackLogo,
4252
- contractSupply
4253
- } = _ref;
4193
+ constructor({
4194
+ chainId,
4195
+ contractAddress,
4196
+ contractImage,
4197
+ contractName,
4198
+ contractSymbol,
4199
+ nftStandard,
4200
+ provider,
4201
+ contractDescription,
4202
+ contractFallbackLogo,
4203
+ contractSupply
4204
+ }) {
4254
4205
  defineProperty_default()(this, "contractAddress", void 0);
4255
4206
  defineProperty_default()(this, "contractName", void 0);
4256
4207
  defineProperty_default()(this, "contractSymbol", void 0);
@@ -4398,8 +4349,7 @@ class NftHandler {
4398
4349
  const contract = new external_ethers_namespaceObject.Contract(this.contractAddress, abi, this.provider);
4399
4350
  return contract.supportsInterface(interfaceId);
4400
4351
  }
4401
- async getCollectibleTokenURI(tokenId) {
4402
- let standard = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : CONTRACT_TYPE_ERC721;
4352
+ async getCollectibleTokenURI(tokenId, standard = CONTRACT_TYPE_ERC721) {
4403
4353
  const method = standard === CONTRACT_TYPE_ERC721 ? "tokenURI" : "uri";
4404
4354
  const abi = standard === CONTRACT_TYPE_ERC721 ? erc721Abi : erc1155Abi;
4405
4355
  const contract = new external_ethers_namespaceObject.Contract(this.contractAddress, abi, this.provider);
@@ -4418,16 +4368,15 @@ class NftHandler {
4418
4368
 
4419
4369
  const DEFAULT_INTERVAL = 180 * 1000;
4420
4370
  class NftsController extends base_controllers_namespaceObject.BaseController {
4421
- constructor(_ref) {
4422
- let {
4423
- config,
4424
- state,
4425
- provider,
4426
- getCustomNfts,
4427
- getSimpleHashNfts,
4428
- onPreferencesStateChange,
4429
- onNetworkStateChange
4430
- } = _ref;
4371
+ constructor({
4372
+ config,
4373
+ state,
4374
+ provider,
4375
+ getCustomNfts,
4376
+ getSimpleHashNfts,
4377
+ onPreferencesStateChange,
4378
+ onNetworkStateChange
4379
+ }) {
4431
4380
  super({
4432
4381
  config,
4433
4382
  state
@@ -4624,18 +4573,16 @@ class NftsController extends base_controllers_namespaceObject.BaseController {
4624
4573
 
4625
4574
 
4626
4575
 
4627
-
4628
4576
  class PreferencesController extends base_controllers_namespaceObject.BasePreferencesController {
4629
- constructor(_ref) {
4630
- let {
4631
- config,
4632
- state,
4633
- provider,
4634
- signAuthMessage,
4635
- getProviderConfig,
4636
- setProviderConfig,
4637
- validateSignMessage
4638
- } = _ref;
4577
+ constructor({
4578
+ config,
4579
+ state,
4580
+ provider,
4581
+ signAuthMessage,
4582
+ getProviderConfig,
4583
+ setProviderConfig,
4584
+ validateSignMessage
4585
+ }) {
4639
4586
  super({
4640
4587
  config,
4641
4588
  state,
@@ -4770,13 +4717,13 @@ class PreferencesController extends base_controllers_namespaceObject.BasePrefere
4770
4717
  }
4771
4718
  return false;
4772
4719
  } catch (error) {
4720
+ if (base_controllers_namespaceObject.isUnauthorizedError) {
4721
+ throw error;
4722
+ }
4773
4723
  external_loglevel_default().error(error);
4774
4724
  return false;
4775
4725
  } finally {
4776
- Promise.all([this.getWalletOrders(address).catch(error => {
4777
- external_loglevel_default().error("unable to fetch wallet orders", error);
4778
- })]).then(data => {
4779
- const [walletTx] = data;
4726
+ this.getWalletOrders(address).then(walletTx => {
4780
4727
  // eslint-disable-next-line promise/always-return
4781
4728
  if (walletTx && walletTx.length > 0) {
4782
4729
  this.updateState({
@@ -4855,9 +4802,7 @@ class PreferencesController extends base_controllers_namespaceObject.BasePrefere
4855
4802
  }
4856
4803
  async fetchEtherscanTx(parameters) {
4857
4804
  try {
4858
- const url = new URL(`${this.config.api}/etherscan`);
4859
- url.searchParams.append("chainId", parameters.chainId);
4860
- const response = await (0,http_helpers_namespaceObject.get)(url.href, this.headers(parameters.selectedAddress));
4805
+ const response = await this.wsApiClient.authGet(`etherscan?chainId=${parameters.chainId}`, this.authCredentials(parameters.selectedAddress));
4861
4806
  external_loglevel_default().info("Etherscan Response API", response);
4862
4807
  return response.success ? response.data : [];
4863
4808
  } catch (error) {
@@ -4867,20 +4812,12 @@ class PreferencesController extends base_controllers_namespaceObject.BasePrefere
4867
4812
  }
4868
4813
  async getEtherScanTokens(address, chainId) {
4869
4814
  const selectedAddress = address;
4870
- const apiUrl = new URL(this.config.api);
4871
- apiUrl.pathname = `/tokens`;
4872
- apiUrl.searchParams.append("chainId", chainId);
4873
- apiUrl.searchParams.append("address", selectedAddress);
4874
- const result = await (0,http_helpers_namespaceObject.get)(apiUrl.href, this.headers(this.state.selectedAddress));
4815
+ const result = await this.wsApiClient.authGet(`tokens?chainId=${chainId}&address=${selectedAddress}`, this.authCredentials());
4875
4816
  return result.data;
4876
4817
  }
4877
4818
  async getSimpleHashNfts(address, chainId) {
4878
4819
  const selectedAddress = address;
4879
- const apiUrl = new URL(this.config.api);
4880
- apiUrl.pathname = `/nfts`;
4881
- apiUrl.searchParams.append("chainId", chainId);
4882
- apiUrl.searchParams.append("address", selectedAddress);
4883
- const result = await (0,http_helpers_namespaceObject.get)(apiUrl.href, this.headers(this.state.selectedAddress));
4820
+ const result = await this.wsApiClient.authGet(`nfts?chainId=${chainId}&address=${selectedAddress}`, this.authCredentials());
4884
4821
  return result.data;
4885
4822
  }
4886
4823
  getCustomTokens(address) {
@@ -4899,9 +4836,7 @@ class PreferencesController extends base_controllers_namespaceObject.BasePrefere
4899
4836
  async addChain(network) {
4900
4837
  const approveChainOptions = this.getChainOptions();
4901
4838
  const providerConfig = approveChainOptions.find(x => x.chainId === network.chainId);
4902
- if (providerConfig) {
4903
- throw new Error(`chainId ${network.chainId} already exists`);
4904
- }
4839
+ if (providerConfig) return;
4905
4840
  const newNetwork = {
4906
4841
  displayName: network.chainName,
4907
4842
  rpcTarget: network.rpcUrls[0],
@@ -4927,13 +4862,10 @@ class PreferencesController extends base_controllers_namespaceObject.BasePrefere
4927
4862
  }
4928
4863
 
4929
4864
  // Custom Network methods
4930
- async addCustomNetwork(_ref2) {
4931
- let {
4932
- network
4933
- } = _ref2;
4865
+ async addCustomNetwork({
4866
+ network
4867
+ }) {
4934
4868
  try {
4935
- const apiUrl = new URL(this.config.api);
4936
- apiUrl.pathname = `/customnetwork`;
4937
4869
  const {
4938
4870
  selectedAddress
4939
4871
  } = this.state;
@@ -4947,7 +4879,7 @@ class PreferencesController extends base_controllers_namespaceObject.BasePrefere
4947
4879
  logo: network.logo,
4948
4880
  symbol_name: network.tickerName
4949
4881
  };
4950
- const res = await (0,http_helpers_namespaceObject.post)(apiUrl.href, payload, this.headers(selectedAddress), {
4882
+ const res = await this.wsApiClient.authPost("customnetwork", payload, this.authCredentials(selectedAddress), {
4951
4883
  useAPIKey: true
4952
4884
  });
4953
4885
  await this.sync(selectedAddress);
@@ -4962,9 +4894,7 @@ class PreferencesController extends base_controllers_namespaceObject.BasePrefere
4962
4894
  const {
4963
4895
  selectedAddress
4964
4896
  } = this.state;
4965
- const apiUrl = new URL(this.config.api);
4966
- apiUrl.pathname = `/customnetwork/${id}`;
4967
- await (0,http_helpers_namespaceObject.remove)(apiUrl.href, {}, this.headers(selectedAddress), {
4897
+ await this.wsApiClient.authRemove(`customnetwork/${id}`, {}, this.authCredentials(selectedAddress), {
4968
4898
  useAPIKey: true
4969
4899
  });
4970
4900
  await this.sync(selectedAddress);
@@ -4974,17 +4904,14 @@ class PreferencesController extends base_controllers_namespaceObject.BasePrefere
4974
4904
  return false;
4975
4905
  }
4976
4906
  }
4977
- async editCustomNetwork(_ref3) {
4978
- let {
4979
- network,
4980
- id
4981
- } = _ref3;
4907
+ async editCustomNetwork({
4908
+ network,
4909
+ id
4910
+ }) {
4982
4911
  try {
4983
4912
  const {
4984
4913
  selectedAddress
4985
4914
  } = this.state;
4986
- const apiUrl = new URL(this.config.api);
4987
- apiUrl.pathname = `/customnetwork/${id}`;
4988
4915
  const payload = {
4989
4916
  network_name: network.displayName,
4990
4917
  rpc_url: network.rpcTarget,
@@ -4993,7 +4920,7 @@ class PreferencesController extends base_controllers_namespaceObject.BasePrefere
4993
4920
  block_explorer_url: network.blockExplorerUrl || undefined,
4994
4921
  is_testnet: network.isTestnet || false
4995
4922
  };
4996
- await (0,http_helpers_namespaceObject.patch)(apiUrl.href, payload, this.headers(selectedAddress), {
4923
+ await this.wsApiClient.authPatch(`customnetwork/${id}`, payload, this.authCredentials(selectedAddress), {
4997
4924
  useAPIKey: true
4998
4925
  });
4999
4926
  await this.sync(selectedAddress);
@@ -5003,9 +4930,8 @@ class PreferencesController extends base_controllers_namespaceObject.BasePrefere
5003
4930
  return false;
5004
4931
  }
5005
4932
  }
5006
- getChainOptions() {
4933
+ getChainOptions(address = this.state.selectedAddress) {
5007
4934
  var _identities$address$c, _identities$address;
5008
- let address = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.state.selectedAddress;
5009
4935
  const {
5010
4936
  identities
5011
4937
  } = this.state;
@@ -5117,14 +5043,13 @@ class PreferencesController extends base_controllers_namespaceObject.BasePrefere
5117
5043
 
5118
5044
 
5119
5045
  class TokenHandler {
5120
- constructor(_ref) {
5121
- let {
5122
- address,
5123
- symbol,
5124
- decimals,
5125
- name,
5126
- provider
5127
- } = _ref;
5046
+ constructor({
5047
+ address,
5048
+ symbol,
5049
+ decimals,
5050
+ name,
5051
+ provider
5052
+ }) {
5128
5053
  defineProperty_default()(this, "address", void 0);
5129
5054
  defineProperty_default()(this, "symbol", void 0);
5130
5055
  defineProperty_default()(this, "decimals", void 0);
@@ -5169,14 +5094,13 @@ class TokenHandler {
5169
5094
 
5170
5095
  const DEFAULT_CURRENCY = "eth";
5171
5096
  class TokenRatesController extends base_controllers_namespaceObject.BaseController {
5172
- constructor(_ref) {
5173
- let {
5174
- config,
5175
- state,
5176
- onPreferencesStateChange,
5177
- onNetworkStateChange,
5178
- onTokensStateChange
5179
- } = _ref;
5097
+ constructor({
5098
+ config,
5099
+ state,
5100
+ onPreferencesStateChange,
5101
+ onNetworkStateChange,
5102
+ onTokensStateChange
5103
+ }) {
5180
5104
  super({
5181
5105
  config,
5182
5106
  state
@@ -5297,17 +5221,16 @@ const mergeTokenArrays = (oldArray, newArray) => {
5297
5221
  };
5298
5222
  const TokensController_DEFAULT_INTERVAL = 180 * 1000;
5299
5223
  class TokensController extends base_controllers_namespaceObject.BaseController {
5300
- constructor(_ref) {
5301
- let {
5302
- config,
5303
- state,
5304
- provider,
5305
- getCustomTokens,
5306
- getEtherScanTokens,
5307
- getProviderConfig,
5308
- onPreferencesStateChange,
5309
- onNetworkStateChange
5310
- } = _ref;
5224
+ constructor({
5225
+ config,
5226
+ state,
5227
+ provider,
5228
+ getCustomTokens,
5229
+ getEtherScanTokens,
5230
+ getProviderConfig,
5231
+ onPreferencesStateChange,
5232
+ onNetworkStateChange
5233
+ }) {
5311
5234
  super({
5312
5235
  config,
5313
5236
  state
@@ -5530,13 +5453,12 @@ class TokensController extends base_controllers_namespaceObject.BaseController {
5530
5453
 
5531
5454
 
5532
5455
  class NonceTracker {
5533
- constructor(_ref) {
5534
- let {
5535
- provider,
5536
- blockTracker,
5537
- getPendingTransactions,
5538
- getConfirmedTransactions
5539
- } = _ref;
5456
+ constructor({
5457
+ provider,
5458
+ blockTracker,
5459
+ getPendingTransactions,
5460
+ getConfirmedTransactions
5461
+ }) {
5540
5462
  defineProperty_default()(this, "provider", void 0);
5541
5463
  defineProperty_default()(this, "blockTracker", void 0);
5542
5464
  defineProperty_default()(this, "getPendingTransactions", void 0);
@@ -5680,15 +5602,14 @@ class NonceTracker {
5680
5602
 
5681
5603
 
5682
5604
  class PendingTransactionTracker extends openlogin_jrpc_namespaceObject.SafeEventEmitter {
5683
- constructor(_ref) {
5684
- let {
5685
- provider,
5686
- nonceTracker,
5687
- approveTransaction,
5688
- publishTransaction,
5689
- getPendingTransactions,
5690
- getConfirmedTransactions
5691
- } = _ref;
5605
+ constructor({
5606
+ provider,
5607
+ nonceTracker,
5608
+ approveTransaction,
5609
+ publishTransaction,
5610
+ getPendingTransactions,
5611
+ getConfirmedTransactions
5612
+ }) {
5692
5613
  super();
5693
5614
  defineProperty_default()(this, "DROPPED_BUFFER_COUNT", 3);
5694
5615
  defineProperty_default()(this, "nonceTracker", void 0);
@@ -5939,8 +5860,7 @@ class TransactionGasUtil {
5939
5860
  /**
5940
5861
  Adds a gas buffer with out exceeding the block gas limit
5941
5862
  */
5942
- addGasBuffer(initialGasLimitHex, blockGasLimitHex) {
5943
- let multiplier = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1.5;
5863
+ addGasBuffer(initialGasLimitHex, blockGasLimitHex, multiplier = 1.5) {
5944
5864
  const initialGasLimitBn = new external_bn_js_namespaceObject.BN((0,util_namespaceObject.stripHexPrefix)(initialGasLimitHex), 16);
5945
5865
  const blockGasLimitBn = new external_bn_js_namespaceObject.BN((0,util_namespaceObject.stripHexPrefix)(blockGasLimitHex), 16);
5946
5866
  const upperGasLimitBn = blockGasLimitBn.muln(0.9);
@@ -6021,20 +5941,18 @@ function snapshotFromTxMeta(txMeta) {
6021
5941
 
6022
5942
 
6023
5943
  class TransactionStateManager extends base_controllers_namespaceObject.BaseTransactionStateManager {
6024
- constructor(_ref) {
6025
- let {
6026
- config,
6027
- state,
6028
- getCurrentChainId
6029
- } = _ref;
5944
+ constructor({
5945
+ config,
5946
+ state,
5947
+ getCurrentChainId
5948
+ }) {
6030
5949
  super({
6031
5950
  config,
6032
5951
  state,
6033
5952
  getCurrentChainId
6034
5953
  });
6035
5954
  }
6036
- generateTxMeta() {
6037
- let opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
5955
+ generateTxMeta(opts = {}) {
6038
5956
  const chainId = this.getCurrentChainId();
6039
5957
  if (chainId === "loading") throw new Error("Torus is having trouble connecting to the network");
6040
5958
  let dappSuggestedGasFees = null;
@@ -6144,13 +6062,12 @@ class TransactionStateManager extends base_controllers_namespaceObject.BaseTrans
6144
6062
  })
6145
6063
  });
6146
6064
  }
6147
- getTransactions() {
6148
- let {
6149
- searchCriteria = {},
6150
- initialList = undefined,
6151
- filterToCurrentNetwork = true,
6152
- limit = undefined
6153
- } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6065
+ getTransactions({
6066
+ searchCriteria = {},
6067
+ initialList = undefined,
6068
+ filterToCurrentNetwork = true,
6069
+ limit = undefined
6070
+ } = {}) {
6154
6071
  const chainId = this.getCurrentChainId();
6155
6072
  // searchCriteria is an object that might have values that aren't predicate
6156
6073
  // methods. When providing any other value type (string, number, etc), we
@@ -6328,20 +6245,19 @@ class TransactionStateManager extends base_controllers_namespaceObject.BaseTrans
6328
6245
 
6329
6246
 
6330
6247
  class TransactionController extends TransactionStateManager {
6331
- constructor(_ref) {
6332
- let {
6333
- config,
6334
- state,
6335
- provider,
6336
- blockTracker,
6337
- signEthTx,
6338
- getCurrentChainId,
6339
- getCurrentNetworkEIP1559Compatibility,
6340
- getProviderConfig,
6341
- getCurrentAccountEIP1559Compatibility,
6342
- getSelectedAddress,
6343
- getEIP1559GasFeeEstimates
6344
- } = _ref;
6248
+ constructor({
6249
+ config,
6250
+ state,
6251
+ provider,
6252
+ blockTracker,
6253
+ signEthTx,
6254
+ getCurrentChainId,
6255
+ getCurrentNetworkEIP1559Compatibility,
6256
+ getProviderConfig,
6257
+ getCurrentAccountEIP1559Compatibility,
6258
+ getSelectedAddress,
6259
+ getEIP1559GasFeeEstimates
6260
+ }) {
6345
6261
  super({
6346
6262
  config,
6347
6263
  state,
@@ -6733,11 +6649,10 @@ class TransactionController extends TransactionStateManager {
6733
6649
  this.updateTransactionInState(data.txMeta);
6734
6650
  });
6735
6651
  this.pendingTxTracker.on(base_controllers_namespaceObject.TX_EVENTS.TX_DROPPED, data => this.setTxStatusDropped(data.txId));
6736
- this.pendingTxTracker.on(base_controllers_namespaceObject.TX_EVENTS.TX_BLOCK_UPDATE, _ref2 => {
6737
- let {
6738
- txMeta,
6739
- latestBlockNumber
6740
- } = _ref2;
6652
+ this.pendingTxTracker.on(base_controllers_namespaceObject.TX_EVENTS.TX_BLOCK_UPDATE, ({
6653
+ txMeta,
6654
+ latestBlockNumber
6655
+ }) => {
6741
6656
  if (!txMeta.firstRetryBlockNumber) {
6742
6657
  txMeta.firstRetryBlockNumber = latestBlockNumber;
6743
6658
  this.updateTransactionInState(txMeta);