@metamask-previews/transaction-controller 52.0.0-preview-5a3453d → 52.0.0-preview-e3c959f

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 (122) hide show
  1. package/CHANGELOG.md +2 -3
  2. package/dist/TransactionController.cjs +15 -15
  3. package/dist/TransactionController.cjs.map +1 -1
  4. package/dist/TransactionController.d.cts.map +1 -1
  5. package/dist/TransactionController.d.mts.map +1 -1
  6. package/dist/TransactionController.mjs +15 -15
  7. package/dist/TransactionController.mjs.map +1 -1
  8. package/dist/gas-flows/DefaultGasFeeFlow.cjs +3 -1
  9. package/dist/gas-flows/DefaultGasFeeFlow.cjs.map +1 -1
  10. package/dist/gas-flows/DefaultGasFeeFlow.d.cts +2 -2
  11. package/dist/gas-flows/DefaultGasFeeFlow.d.cts.map +1 -1
  12. package/dist/gas-flows/DefaultGasFeeFlow.d.mts +2 -2
  13. package/dist/gas-flows/DefaultGasFeeFlow.d.mts.map +1 -1
  14. package/dist/gas-flows/DefaultGasFeeFlow.mjs +3 -1
  15. package/dist/gas-flows/DefaultGasFeeFlow.mjs.map +1 -1
  16. package/dist/gas-flows/LineaGasFeeFlow.cjs +1 -1
  17. package/dist/gas-flows/LineaGasFeeFlow.cjs.map +1 -1
  18. package/dist/gas-flows/LineaGasFeeFlow.d.cts +1 -5
  19. package/dist/gas-flows/LineaGasFeeFlow.d.cts.map +1 -1
  20. package/dist/gas-flows/LineaGasFeeFlow.d.mts +1 -5
  21. package/dist/gas-flows/LineaGasFeeFlow.d.mts.map +1 -1
  22. package/dist/gas-flows/LineaGasFeeFlow.mjs +1 -1
  23. package/dist/gas-flows/LineaGasFeeFlow.mjs.map +1 -1
  24. package/dist/gas-flows/OptimismLayer1GasFeeFlow.cjs +1 -1
  25. package/dist/gas-flows/OptimismLayer1GasFeeFlow.cjs.map +1 -1
  26. package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.cts +1 -5
  27. package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.cts.map +1 -1
  28. package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.mts +1 -5
  29. package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.mts.map +1 -1
  30. package/dist/gas-flows/OptimismLayer1GasFeeFlow.mjs +1 -1
  31. package/dist/gas-flows/OptimismLayer1GasFeeFlow.mjs.map +1 -1
  32. package/dist/gas-flows/OracleLayer1GasFeeFlow.cjs.map +1 -1
  33. package/dist/gas-flows/OracleLayer1GasFeeFlow.d.cts +1 -5
  34. package/dist/gas-flows/OracleLayer1GasFeeFlow.d.cts.map +1 -1
  35. package/dist/gas-flows/OracleLayer1GasFeeFlow.d.mts +1 -5
  36. package/dist/gas-flows/OracleLayer1GasFeeFlow.d.mts.map +1 -1
  37. package/dist/gas-flows/OracleLayer1GasFeeFlow.mjs.map +1 -1
  38. package/dist/gas-flows/ScrollLayer1GasFeeFlow.cjs +1 -1
  39. package/dist/gas-flows/ScrollLayer1GasFeeFlow.cjs.map +1 -1
  40. package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.cts +1 -5
  41. package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.cts.map +1 -1
  42. package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.mts +1 -5
  43. package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.mts.map +1 -1
  44. package/dist/gas-flows/ScrollLayer1GasFeeFlow.mjs +1 -1
  45. package/dist/gas-flows/ScrollLayer1GasFeeFlow.mjs.map +1 -1
  46. package/dist/gas-flows/TestGasFeeFlow.cjs +1 -1
  47. package/dist/gas-flows/TestGasFeeFlow.cjs.map +1 -1
  48. package/dist/gas-flows/TestGasFeeFlow.d.cts +2 -2
  49. package/dist/gas-flows/TestGasFeeFlow.d.cts.map +1 -1
  50. package/dist/gas-flows/TestGasFeeFlow.d.mts +2 -2
  51. package/dist/gas-flows/TestGasFeeFlow.d.mts.map +1 -1
  52. package/dist/gas-flows/TestGasFeeFlow.mjs +1 -1
  53. package/dist/gas-flows/TestGasFeeFlow.mjs.map +1 -1
  54. package/dist/helpers/GasFeePoller.cjs +4 -9
  55. package/dist/helpers/GasFeePoller.cjs.map +1 -1
  56. package/dist/helpers/GasFeePoller.d.cts +1 -4
  57. package/dist/helpers/GasFeePoller.d.cts.map +1 -1
  58. package/dist/helpers/GasFeePoller.d.mts +1 -4
  59. package/dist/helpers/GasFeePoller.d.mts.map +1 -1
  60. package/dist/helpers/GasFeePoller.mjs +4 -9
  61. package/dist/helpers/GasFeePoller.mjs.map +1 -1
  62. package/dist/types.cjs.map +1 -1
  63. package/dist/types.d.cts +3 -15
  64. package/dist/types.d.cts.map +1 -1
  65. package/dist/types.d.mts +3 -15
  66. package/dist/types.d.mts.map +1 -1
  67. package/dist/types.mjs.map +1 -1
  68. package/dist/utils/feature-flags.cjs +3 -16
  69. package/dist/utils/feature-flags.cjs.map +1 -1
  70. package/dist/utils/feature-flags.d.cts +2 -12
  71. package/dist/utils/feature-flags.d.cts.map +1 -1
  72. package/dist/utils/feature-flags.d.mts +2 -12
  73. package/dist/utils/feature-flags.d.mts.map +1 -1
  74. package/dist/utils/feature-flags.mjs +2 -14
  75. package/dist/utils/feature-flags.mjs.map +1 -1
  76. package/dist/utils/gas-fees.cjs +3 -21
  77. package/dist/utils/gas-fees.cjs.map +1 -1
  78. package/dist/utils/gas-fees.d.cts +0 -14
  79. package/dist/utils/gas-fees.d.cts.map +1 -1
  80. package/dist/utils/gas-fees.d.mts +0 -14
  81. package/dist/utils/gas-fees.d.mts.map +1 -1
  82. package/dist/utils/gas-fees.mjs +2 -19
  83. package/dist/utils/gas-fees.mjs.map +1 -1
  84. package/dist/utils/gas-flow.cjs +2 -3
  85. package/dist/utils/gas-flow.cjs.map +1 -1
  86. package/dist/utils/gas-flow.d.cts +1 -3
  87. package/dist/utils/gas-flow.d.cts.map +1 -1
  88. package/dist/utils/gas-flow.d.mts +1 -3
  89. package/dist/utils/gas-flow.d.mts.map +1 -1
  90. package/dist/utils/gas-flow.mjs +2 -3
  91. package/dist/utils/gas-flow.mjs.map +1 -1
  92. package/dist/utils/gas.cjs +108 -8
  93. package/dist/utils/gas.cjs.map +1 -1
  94. package/dist/utils/gas.d.cts +16 -5
  95. package/dist/utils/gas.d.cts.map +1 -1
  96. package/dist/utils/gas.d.mts +16 -5
  97. package/dist/utils/gas.d.mts.map +1 -1
  98. package/dist/utils/gas.mjs +108 -8
  99. package/dist/utils/gas.mjs.map +1 -1
  100. package/dist/utils/layer1-gas-fee-flow.cjs +4 -9
  101. package/dist/utils/layer1-gas-fee-flow.cjs.map +1 -1
  102. package/dist/utils/layer1-gas-fee-flow.d.cts +1 -4
  103. package/dist/utils/layer1-gas-fee-flow.d.cts.map +1 -1
  104. package/dist/utils/layer1-gas-fee-flow.d.mts +1 -4
  105. package/dist/utils/layer1-gas-fee-flow.d.mts.map +1 -1
  106. package/dist/utils/layer1-gas-fee-flow.mjs +4 -9
  107. package/dist/utils/layer1-gas-fee-flow.mjs.map +1 -1
  108. package/dist/utils/simulation-api.cjs.map +1 -1
  109. package/dist/utils/simulation-api.d.cts +9 -5
  110. package/dist/utils/simulation-api.d.cts.map +1 -1
  111. package/dist/utils/simulation-api.d.mts +9 -5
  112. package/dist/utils/simulation-api.d.mts.map +1 -1
  113. package/dist/utils/simulation-api.mjs.map +1 -1
  114. package/package.json +1 -1
  115. package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.cjs +0 -145
  116. package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.cjs.map +0 -1
  117. package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.d.cts +0 -27
  118. package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.d.cts.map +0 -1
  119. package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.d.mts +0 -27
  120. package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.d.mts.map +0 -1
  121. package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.mjs +0 -140
  122. package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -7,10 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
- ### Added
10
+ ### Fixed
11
11
 
12
- - Adds `RandomisedEstimationsGasFeeFlow` to gas fee flows in `TransactionController` ([#5511](https://github.com/MetaMask/core/pull/5511))
13
- - Added flow only will be activated if chainId is defined in feature flags.
12
+ - Fix gas estimation for type 4 transactions ([#5519](https://github.com/MetaMask/core/pull/5519))
14
13
 
15
14
  ## [52.0.0]
16
15
 
@@ -33,7 +33,6 @@ const accounts_api_1 = require("./api/accounts-api.cjs");
33
33
  const DefaultGasFeeFlow_1 = require("./gas-flows/DefaultGasFeeFlow.cjs");
34
34
  const LineaGasFeeFlow_1 = require("./gas-flows/LineaGasFeeFlow.cjs");
35
35
  const OptimismLayer1GasFeeFlow_1 = require("./gas-flows/OptimismLayer1GasFeeFlow.cjs");
36
- const RandomisedEstimationsGasFeeFlow_1 = require("./gas-flows/RandomisedEstimationsGasFeeFlow.cjs");
37
36
  const ScrollLayer1GasFeeFlow_1 = require("./gas-flows/ScrollLayer1GasFeeFlow.cjs");
38
37
  const TestGasFeeFlow_1 = require("./gas-flows/TestGasFeeFlow.cjs");
39
38
  const AccountsApiRemoteTransactionSource_1 = require("./helpers/AccountsApiRemoteTransactionSource.cjs");
@@ -247,7 +246,6 @@ class TransactionController extends base_controller_1.BaseController {
247
246
  getProvider: (networkClientId) => __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getProvider).call(this, { networkClientId }),
248
247
  getTransactions: () => this.state.transactions,
249
248
  layer1GasFeeFlows: this.layer1GasFeeFlows,
250
- messenger: this.messagingSystem,
251
249
  onStateChange: (listener) => {
252
250
  this.messagingSystem.subscribe('TransactionController:stateChange', listener);
253
251
  },
@@ -551,7 +549,12 @@ class TransactionController extends base_controller_1.BaseController {
551
549
  const ethQuery = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getEthQuery).call(this, {
552
550
  networkClientId,
553
551
  });
554
- const { estimatedGas, simulationFails } = await (0, gas_1.estimateGas)(transaction, ethQuery);
552
+ const { estimatedGas, simulationFails } = await (0, gas_1.estimateGas)({
553
+ chainId: __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getChainId).call(this, networkClientId),
554
+ ethQuery,
555
+ isSimulationEnabled: __classPrivateFieldGet(this, _TransactionController_isSimulationEnabled, "f").call(this),
556
+ txParams: transaction,
557
+ });
555
558
  return { gas: estimatedGas, simulationFails };
556
559
  }
557
560
  /**
@@ -566,7 +569,12 @@ class TransactionController extends base_controller_1.BaseController {
566
569
  const ethQuery = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getEthQuery).call(this, {
567
570
  networkClientId,
568
571
  });
569
- const { blockGasLimit, estimatedGas, simulationFails } = await (0, gas_1.estimateGas)(transaction, ethQuery);
572
+ const { blockGasLimit, estimatedGas, simulationFails } = await (0, gas_1.estimateGas)({
573
+ chainId: __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getChainId).call(this, networkClientId),
574
+ ethQuery,
575
+ isSimulationEnabled: __classPrivateFieldGet(this, _TransactionController_isSimulationEnabled, "f").call(this),
576
+ txParams: transaction,
577
+ });
570
578
  const gas = (0, gas_1.addGasBuffer)(estimatedGas, blockGasLimit, multiplier);
571
579
  return {
572
580
  gas,
@@ -817,7 +825,6 @@ class TransactionController extends base_controller_1.BaseController {
817
825
  updatedTransaction.type = type;
818
826
  await (0, layer1_gas_fee_flow_1.updateTransactionLayer1GasFee)({
819
827
  layer1GasFeeFlows: this.layer1GasFeeFlows,
820
- messenger: this.messagingSystem,
821
828
  provider,
822
829
  transactionMeta: updatedTransaction,
823
830
  });
@@ -1030,7 +1037,7 @@ class TransactionController extends base_controller_1.BaseController {
1030
1037
  networkClientId,
1031
1038
  };
1032
1039
  // Guaranteed as the default gas fee flow matches all transactions.
1033
- const gasFeeFlow = (0, gas_flow_1.getGasFeeFlow)(transactionMeta, this.gasFeeFlows, this.messagingSystem);
1040
+ const gasFeeFlow = (0, gas_flow_1.getGasFeeFlow)(transactionMeta, this.gasFeeFlows);
1034
1041
  const ethQuery = new eth_query_1.default(provider);
1035
1042
  const gasFeeControllerData = await this.getGasFeeEstimates({
1036
1043
  networkClientId,
@@ -1038,7 +1045,6 @@ class TransactionController extends base_controller_1.BaseController {
1038
1045
  return gasFeeFlow.getGasFees({
1039
1046
  ethQuery,
1040
1047
  gasFeeControllerData,
1041
- messenger: this.messagingSystem,
1042
1048
  transactionMeta,
1043
1049
  });
1044
1050
  }
@@ -1058,7 +1064,6 @@ class TransactionController extends base_controller_1.BaseController {
1058
1064
  });
1059
1065
  return await (0, layer1_gas_fee_flow_1.getTransactionLayer1GasFee)({
1060
1066
  layer1GasFeeFlows: this.layer1GasFeeFlows,
1061
- messenger: this.messagingSystem,
1062
1067
  provider,
1063
1068
  transactionMeta: {
1064
1069
  txParams: transactionParams,
@@ -1185,12 +1190,10 @@ class TransactionController extends base_controller_1.BaseController {
1185
1190
  gasFeeFlows: this.gasFeeFlows,
1186
1191
  getGasFeeEstimates: this.getGasFeeEstimates,
1187
1192
  getSavedGasFees: this.getSavedGasFees.bind(this),
1188
- messenger: this.messagingSystem,
1189
1193
  txMeta: transactionMeta,
1190
1194
  }));
1191
1195
  await __classPrivateFieldGet(this, _TransactionController_trace, "f").call(this, { name: 'Update Layer 1 Gas Fees', parentContext: traceContext }, async () => await (0, layer1_gas_fee_flow_1.updateTransactionLayer1GasFee)({
1192
1196
  layer1GasFeeFlows: this.layer1GasFeeFlows,
1193
- messenger: this.messagingSystem,
1194
1197
  provider,
1195
1198
  transactionMeta,
1196
1199
  }));
@@ -1920,11 +1923,7 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_me
1920
1923
  if (__classPrivateFieldGet(this, _TransactionController_testGasFeeFlows, "f")) {
1921
1924
  return [new TestGasFeeFlow_1.TestGasFeeFlow()];
1922
1925
  }
1923
- return [
1924
- new RandomisedEstimationsGasFeeFlow_1.RandomisedEstimationsGasFeeFlow(),
1925
- new LineaGasFeeFlow_1.LineaGasFeeFlow(),
1926
- new DefaultGasFeeFlow_1.DefaultGasFeeFlow(),
1927
- ];
1926
+ return [new LineaGasFeeFlow_1.LineaGasFeeFlow(), new DefaultGasFeeFlow_1.DefaultGasFeeFlow()];
1928
1927
  }, _TransactionController_getLayer1GasFeeFlows = function _TransactionController_getLayer1GasFeeFlows() {
1929
1928
  return [new OptimismLayer1GasFeeFlow_1.OptimismLayer1GasFeeFlow(), new ScrollLayer1GasFeeFlow_1.ScrollLayer1GasFeeFlow()];
1930
1929
  }, _TransactionController_updateTransactionInternal = function _TransactionController_updateTransactionInternal({ transactionId, note, skipHistory, skipValidation, skipResimulateCheck, }, callback) {
@@ -2098,6 +2097,7 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_me
2098
2097
  chainId,
2099
2098
  ethQuery,
2100
2099
  isCustomNetwork,
2100
+ isSimulationEnabled: __classPrivateFieldGet(this, _TransactionController_isSimulationEnabled, "f").call(this),
2101
2101
  txMeta: transactionMeta,
2102
2102
  });
2103
2103
  }, _TransactionController_deleteTransaction = function _TransactionController_deleteTransaction(transactionId) {