@metamask-previews/transaction-controller 52.0.0-preview-e648706 → 52.0.0-preview-49487623

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +0 -10
  2. package/dist/TransactionController.cjs +12 -24
  3. package/dist/TransactionController.cjs.map +1 -1
  4. package/dist/TransactionController.d.cts +0 -3
  5. package/dist/TransactionController.d.cts.map +1 -1
  6. package/dist/TransactionController.d.mts +0 -3
  7. package/dist/TransactionController.d.mts.map +1 -1
  8. package/dist/TransactionController.mjs +13 -25
  9. package/dist/TransactionController.mjs.map +1 -1
  10. package/dist/constants.cjs +1 -0
  11. package/dist/constants.cjs.map +1 -1
  12. package/dist/constants.d.cts +1 -0
  13. package/dist/constants.d.cts.map +1 -1
  14. package/dist/constants.d.mts +1 -0
  15. package/dist/constants.d.mts.map +1 -1
  16. package/dist/constants.mjs +1 -0
  17. package/dist/constants.mjs.map +1 -1
  18. package/dist/helpers/GasFeePoller.cjs +1 -73
  19. package/dist/helpers/GasFeePoller.cjs.map +1 -1
  20. package/dist/helpers/GasFeePoller.d.cts +2 -20
  21. package/dist/helpers/GasFeePoller.d.cts.map +1 -1
  22. package/dist/helpers/GasFeePoller.d.mts +2 -20
  23. package/dist/helpers/GasFeePoller.d.mts.map +1 -1
  24. package/dist/helpers/GasFeePoller.mjs +1 -72
  25. package/dist/helpers/GasFeePoller.mjs.map +1 -1
  26. package/dist/utils/feature-flags.cjs +2 -2
  27. package/dist/utils/feature-flags.cjs.map +1 -1
  28. package/dist/utils/feature-flags.d.cts +2 -2
  29. package/dist/utils/feature-flags.d.mts +2 -2
  30. package/dist/utils/feature-flags.mjs +2 -2
  31. package/dist/utils/feature-flags.mjs.map +1 -1
  32. package/dist/utils/gas.cjs +8 -108
  33. package/dist/utils/gas.cjs.map +1 -1
  34. package/dist/utils/gas.d.cts +5 -16
  35. package/dist/utils/gas.d.cts.map +1 -1
  36. package/dist/utils/gas.d.mts +5 -16
  37. package/dist/utils/gas.d.mts.map +1 -1
  38. package/dist/utils/gas.mjs +8 -108
  39. package/dist/utils/gas.mjs.map +1 -1
  40. package/dist/utils/simulation-api.cjs.map +1 -1
  41. package/dist/utils/simulation-api.d.cts +5 -9
  42. package/dist/utils/simulation-api.d.cts.map +1 -1
  43. package/dist/utils/simulation-api.d.mts +5 -9
  44. package/dist/utils/simulation-api.d.mts.map +1 -1
  45. package/dist/utils/simulation-api.mjs.map +1 -1
  46. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -7,16 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
- ### Added
11
-
12
- - Add `enableTxParamsGasFeeUpdates` constructor option ([5394](https://github.com/MetaMask/core/pull/5394))
13
- - If not set it will default to `false`.
14
- - Automatically update gas fee properties in `txParams` when the `gasFeeEstimates` are updated via polling.
15
-
16
- ### Fixed
17
-
18
- - Fix gas estimation for type 4 transactions ([#5519](https://github.com/MetaMask/core/pull/5519))
19
-
20
10
  ## [52.0.0]
21
11
 
22
12
  ### Changed
@@ -156,7 +156,7 @@ class TransactionController extends base_controller_1.BaseController {
156
156
  * @param options - The controller options.
157
157
  */
158
158
  constructor(options) {
159
- const { disableHistory, disableSendFlowHistory, disableSwaps, enableTxParamsGasFeeUpdates, getCurrentAccountEIP1559Compatibility, getCurrentNetworkEIP1559Compatibility, getExternalPendingTransactions, getGasFeeEstimates, getNetworkClientRegistry, getNetworkState, getPermittedAccounts, getSavedGasFees, incomingTransactions = {}, isFirstTimeInteractionEnabled, isSimulationEnabled, messenger, pendingTransactions = {}, publicKeyEIP7702, securityProviderRequest, sign, state, testGasFeeFlows, trace, transactionHistoryLimit = 40, hooks, } = options;
159
+ const { disableHistory, disableSendFlowHistory, disableSwaps, getCurrentAccountEIP1559Compatibility, getCurrentNetworkEIP1559Compatibility, getExternalPendingTransactions, getGasFeeEstimates, getNetworkClientRegistry, getNetworkState, getPermittedAccounts, getSavedGasFees, incomingTransactions = {}, isFirstTimeInteractionEnabled, isSimulationEnabled, messenger, pendingTransactions = {}, publicKeyEIP7702, securityProviderRequest, sign, state, testGasFeeFlows, trace, transactionHistoryLimit = 40, hooks, } = options;
160
160
  super({
161
161
  name: controllerName,
162
162
  metadata,
@@ -186,7 +186,6 @@ class TransactionController extends base_controller_1.BaseController {
186
186
  __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").checkForPendingTransactionAndStartPolling();
187
187
  });
188
188
  this.messagingSystem = messenger;
189
- this.isTxParamsGasFeeUpdatesEnabled = enableTxParamsGasFeeUpdates ?? false;
190
189
  this.getNetworkState = getNetworkState;
191
190
  this.isSendFlowHistoryDisabled = disableSendFlowHistory ?? false;
192
191
  this.isHistoryDisabled = disableHistory ?? false;
@@ -550,12 +549,7 @@ class TransactionController extends base_controller_1.BaseController {
550
549
  const ethQuery = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getEthQuery).call(this, {
551
550
  networkClientId,
552
551
  });
553
- const { estimatedGas, simulationFails } = await (0, gas_1.estimateGas)({
554
- chainId: __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getChainId).call(this, networkClientId),
555
- ethQuery,
556
- isSimulationEnabled: __classPrivateFieldGet(this, _TransactionController_isSimulationEnabled, "f").call(this),
557
- txParams: transaction,
558
- });
552
+ const { estimatedGas, simulationFails } = await (0, gas_1.estimateGas)(transaction, ethQuery);
559
553
  return { gas: estimatedGas, simulationFails };
560
554
  }
561
555
  /**
@@ -570,12 +564,7 @@ class TransactionController extends base_controller_1.BaseController {
570
564
  const ethQuery = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getEthQuery).call(this, {
571
565
  networkClientId,
572
566
  });
573
- const { blockGasLimit, estimatedGas, simulationFails } = await (0, gas_1.estimateGas)({
574
- chainId: __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getChainId).call(this, networkClientId),
575
- ethQuery,
576
- isSimulationEnabled: __classPrivateFieldGet(this, _TransactionController_isSimulationEnabled, "f").call(this),
577
- txParams: transaction,
578
- });
567
+ const { blockGasLimit, estimatedGas, simulationFails } = await (0, gas_1.estimateGas)(transaction, ethQuery);
579
568
  const gas = (0, gas_1.addGasBuffer)(estimatedGas, blockGasLimit, multiplier);
580
569
  return {
581
570
  gas,
@@ -2047,15 +2036,15 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_me
2047
2036
  (0, logger_1.projectLogger)('Updated simulation data', transactionId, simulationData);
2048
2037
  }, _TransactionController_onGasFeePollerTransactionUpdate = function _TransactionController_onGasFeePollerTransactionUpdate({ transactionId, gasFeeEstimates, gasFeeEstimatesLoaded, layer1GasFee, }) {
2049
2038
  __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_updateTransactionInternal).call(this, { transactionId, skipHistory: true }, (txMeta) => {
2050
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
2051
- (0, GasFeePoller_1.updateTransactionGasFees)({
2052
- txMeta,
2053
- gasFeeEstimates,
2054
- gasFeeEstimatesLoaded,
2055
- getEIP1559Compatibility: this.getEIP1559Compatibility.bind(this),
2056
- isTxParamsGasFeeUpdatesEnabled: this.isTxParamsGasFeeUpdatesEnabled,
2057
- layer1GasFee,
2058
- });
2039
+ if (gasFeeEstimates) {
2040
+ txMeta.gasFeeEstimates = gasFeeEstimates;
2041
+ }
2042
+ if (gasFeeEstimatesLoaded !== undefined) {
2043
+ txMeta.gasFeeEstimatesLoaded = gasFeeEstimatesLoaded;
2044
+ }
2045
+ if (layer1GasFee) {
2046
+ txMeta.layer1GasFee = layer1GasFee;
2047
+ }
2059
2048
  });
2060
2049
  }, _TransactionController_getSelectedAccount = function _TransactionController_getSelectedAccount() {
2061
2050
  return this.messagingSystem.call('AccountsController:getSelectedAccount');
@@ -2098,7 +2087,6 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_me
2098
2087
  chainId,
2099
2088
  ethQuery,
2100
2089
  isCustomNetwork,
2101
- isSimulationEnabled: __classPrivateFieldGet(this, _TransactionController_isSimulationEnabled, "f").call(this),
2102
2090
  txMeta: transactionMeta,
2103
2091
  });
2104
2092
  }, _TransactionController_deleteTransaction = function _TransactionController_deleteTransaction(transactionId) {