@metamask-previews/transaction-controller 52.2.0-preview-7d8354f → 52.2.0-preview-9f91d514

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 (108) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/dist/TransactionController.cjs +13 -2
  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 +13 -2
  7. package/dist/TransactionController.mjs.map +1 -1
  8. package/dist/gas-flows/DefaultGasFeeFlow.cjs +1 -3
  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 +1 -3
  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 +5 -1
  19. package/dist/gas-flows/LineaGasFeeFlow.d.cts.map +1 -1
  20. package/dist/gas-flows/LineaGasFeeFlow.d.mts +5 -1
  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 +5 -1
  27. package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.cts.map +1 -1
  28. package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.mts +5 -1
  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 +5 -1
  34. package/dist/gas-flows/OracleLayer1GasFeeFlow.d.cts.map +1 -1
  35. package/dist/gas-flows/OracleLayer1GasFeeFlow.d.mts +5 -1
  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/RandomisedEstimationsGasFeeFlow.cjs +123 -0
  39. package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.cjs.map +1 -0
  40. package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.d.cts +28 -0
  41. package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.d.cts.map +1 -0
  42. package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.d.mts +28 -0
  43. package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.d.mts.map +1 -0
  44. package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.mjs +118 -0
  45. package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.mjs.map +1 -0
  46. package/dist/gas-flows/ScrollLayer1GasFeeFlow.cjs +1 -1
  47. package/dist/gas-flows/ScrollLayer1GasFeeFlow.cjs.map +1 -1
  48. package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.cts +5 -1
  49. package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.cts.map +1 -1
  50. package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.mts +5 -1
  51. package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.mts.map +1 -1
  52. package/dist/gas-flows/ScrollLayer1GasFeeFlow.mjs +1 -1
  53. package/dist/gas-flows/ScrollLayer1GasFeeFlow.mjs.map +1 -1
  54. package/dist/gas-flows/TestGasFeeFlow.cjs +1 -1
  55. package/dist/gas-flows/TestGasFeeFlow.cjs.map +1 -1
  56. package/dist/gas-flows/TestGasFeeFlow.d.cts +2 -2
  57. package/dist/gas-flows/TestGasFeeFlow.d.cts.map +1 -1
  58. package/dist/gas-flows/TestGasFeeFlow.d.mts +2 -2
  59. package/dist/gas-flows/TestGasFeeFlow.d.mts.map +1 -1
  60. package/dist/gas-flows/TestGasFeeFlow.mjs +1 -1
  61. package/dist/gas-flows/TestGasFeeFlow.mjs.map +1 -1
  62. package/dist/helpers/GasFeePoller.cjs +9 -4
  63. package/dist/helpers/GasFeePoller.cjs.map +1 -1
  64. package/dist/helpers/GasFeePoller.d.cts +4 -1
  65. package/dist/helpers/GasFeePoller.d.cts.map +1 -1
  66. package/dist/helpers/GasFeePoller.d.mts +4 -1
  67. package/dist/helpers/GasFeePoller.d.mts.map +1 -1
  68. package/dist/helpers/GasFeePoller.mjs +9 -4
  69. package/dist/helpers/GasFeePoller.mjs.map +1 -1
  70. package/dist/types.cjs.map +1 -1
  71. package/dist/types.d.cts +18 -5
  72. package/dist/types.d.cts.map +1 -1
  73. package/dist/types.d.mts +18 -5
  74. package/dist/types.d.mts.map +1 -1
  75. package/dist/types.mjs.map +1 -1
  76. package/dist/utils/feature-flags.cjs +16 -1
  77. package/dist/utils/feature-flags.cjs.map +1 -1
  78. package/dist/utils/feature-flags.d.cts +16 -0
  79. package/dist/utils/feature-flags.d.cts.map +1 -1
  80. package/dist/utils/feature-flags.d.mts +16 -0
  81. package/dist/utils/feature-flags.d.mts.map +1 -1
  82. package/dist/utils/feature-flags.mjs +14 -0
  83. package/dist/utils/feature-flags.mjs.map +1 -1
  84. package/dist/utils/gas-fees.cjs +21 -3
  85. package/dist/utils/gas-fees.cjs.map +1 -1
  86. package/dist/utils/gas-fees.d.cts +14 -0
  87. package/dist/utils/gas-fees.d.cts.map +1 -1
  88. package/dist/utils/gas-fees.d.mts +14 -0
  89. package/dist/utils/gas-fees.d.mts.map +1 -1
  90. package/dist/utils/gas-fees.mjs +19 -2
  91. package/dist/utils/gas-fees.mjs.map +1 -1
  92. package/dist/utils/gas-flow.cjs +3 -2
  93. package/dist/utils/gas-flow.cjs.map +1 -1
  94. package/dist/utils/gas-flow.d.cts +3 -1
  95. package/dist/utils/gas-flow.d.cts.map +1 -1
  96. package/dist/utils/gas-flow.d.mts +3 -1
  97. package/dist/utils/gas-flow.d.mts.map +1 -1
  98. package/dist/utils/gas-flow.mjs +3 -2
  99. package/dist/utils/gas-flow.mjs.map +1 -1
  100. package/dist/utils/layer1-gas-fee-flow.cjs +9 -4
  101. package/dist/utils/layer1-gas-fee-flow.cjs.map +1 -1
  102. package/dist/utils/layer1-gas-fee-flow.d.cts +4 -1
  103. package/dist/utils/layer1-gas-fee-flow.d.cts.map +1 -1
  104. package/dist/utils/layer1-gas-fee-flow.d.mts +4 -1
  105. package/dist/utils/layer1-gas-fee-flow.d.mts.map +1 -1
  106. package/dist/utils/layer1-gas-fee-flow.mjs +9 -4
  107. package/dist/utils/layer1-gas-fee-flow.mjs.map +1 -1
  108. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,11 @@ 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
+ - 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.
14
+
10
15
  ### Fixed
11
16
 
12
17
  - Fix simulation of type-4 transactions ([#5552](https://github.com/MetaMask/core/pull/5552))
@@ -32,6 +32,7 @@ const accounts_api_1 = require("./api/accounts-api.cjs");
32
32
  const DefaultGasFeeFlow_1 = require("./gas-flows/DefaultGasFeeFlow.cjs");
33
33
  const LineaGasFeeFlow_1 = require("./gas-flows/LineaGasFeeFlow.cjs");
34
34
  const OptimismLayer1GasFeeFlow_1 = require("./gas-flows/OptimismLayer1GasFeeFlow.cjs");
35
+ const RandomisedEstimationsGasFeeFlow_1 = require("./gas-flows/RandomisedEstimationsGasFeeFlow.cjs");
35
36
  const ScrollLayer1GasFeeFlow_1 = require("./gas-flows/ScrollLayer1GasFeeFlow.cjs");
36
37
  const TestGasFeeFlow_1 = require("./gas-flows/TestGasFeeFlow.cjs");
37
38
  const AccountsApiRemoteTransactionSource_1 = require("./helpers/AccountsApiRemoteTransactionSource.cjs");
@@ -248,6 +249,7 @@ class TransactionController extends base_controller_1.BaseController {
248
249
  getProvider: (networkClientId) => __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getProvider).call(this, { networkClientId }),
249
250
  getTransactions: () => this.state.transactions,
250
251
  layer1GasFeeFlows: this.layer1GasFeeFlows,
252
+ messenger: this.messagingSystem,
251
253
  onStateChange: (listener) => {
252
254
  this.messagingSystem.subscribe('TransactionController:stateChange', listener);
253
255
  },
@@ -842,6 +844,7 @@ class TransactionController extends base_controller_1.BaseController {
842
844
  updatedTransaction.type = type;
843
845
  await (0, layer1_gas_fee_flow_1.updateTransactionLayer1GasFee)({
844
846
  layer1GasFeeFlows: this.layer1GasFeeFlows,
847
+ messenger: this.messagingSystem,
845
848
  provider,
846
849
  transactionMeta: updatedTransaction,
847
850
  });
@@ -1054,7 +1057,7 @@ class TransactionController extends base_controller_1.BaseController {
1054
1057
  networkClientId,
1055
1058
  };
1056
1059
  // Guaranteed as the default gas fee flow matches all transactions.
1057
- const gasFeeFlow = (0, gas_flow_1.getGasFeeFlow)(transactionMeta, this.gasFeeFlows);
1060
+ const gasFeeFlow = (0, gas_flow_1.getGasFeeFlow)(transactionMeta, this.gasFeeFlows, this.messagingSystem);
1058
1061
  const ethQuery = new eth_query_1.default(provider);
1059
1062
  const gasFeeControllerData = await this.getGasFeeEstimates({
1060
1063
  networkClientId,
@@ -1062,6 +1065,7 @@ class TransactionController extends base_controller_1.BaseController {
1062
1065
  return gasFeeFlow.getGasFees({
1063
1066
  ethQuery,
1064
1067
  gasFeeControllerData,
1068
+ messenger: this.messagingSystem,
1065
1069
  transactionMeta,
1066
1070
  });
1067
1071
  }
@@ -1081,6 +1085,7 @@ class TransactionController extends base_controller_1.BaseController {
1081
1085
  });
1082
1086
  return await (0, layer1_gas_fee_flow_1.getTransactionLayer1GasFee)({
1083
1087
  layer1GasFeeFlows: this.layer1GasFeeFlows,
1088
+ messenger: this.messagingSystem,
1084
1089
  provider,
1085
1090
  transactionMeta: {
1086
1091
  txParams: transactionParams,
@@ -1239,10 +1244,12 @@ class TransactionController extends base_controller_1.BaseController {
1239
1244
  gasFeeFlows: this.gasFeeFlows,
1240
1245
  getGasFeeEstimates: this.getGasFeeEstimates,
1241
1246
  getSavedGasFees: this.getSavedGasFees.bind(this),
1247
+ messenger: this.messagingSystem,
1242
1248
  txMeta: transactionMeta,
1243
1249
  }));
1244
1250
  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)({
1245
1251
  layer1GasFeeFlows: this.layer1GasFeeFlows,
1252
+ messenger: this.messagingSystem,
1246
1253
  provider,
1247
1254
  transactionMeta,
1248
1255
  }));
@@ -1990,7 +1997,11 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_me
1990
1997
  if (__classPrivateFieldGet(this, _TransactionController_testGasFeeFlows, "f")) {
1991
1998
  return [new TestGasFeeFlow_1.TestGasFeeFlow()];
1992
1999
  }
1993
- return [new LineaGasFeeFlow_1.LineaGasFeeFlow(), new DefaultGasFeeFlow_1.DefaultGasFeeFlow()];
2000
+ return [
2001
+ new RandomisedEstimationsGasFeeFlow_1.RandomisedEstimationsGasFeeFlow(),
2002
+ new LineaGasFeeFlow_1.LineaGasFeeFlow(),
2003
+ new DefaultGasFeeFlow_1.DefaultGasFeeFlow(),
2004
+ ];
1994
2005
  }, _TransactionController_getLayer1GasFeeFlows = function _TransactionController_getLayer1GasFeeFlows() {
1995
2006
  return [new OptimismLayer1GasFeeFlow_1.OptimismLayer1GasFeeFlow(), new ScrollLayer1GasFeeFlow_1.ScrollLayer1GasFeeFlow()];
1996
2007
  }, _TransactionController_updateTransactionInternal = function _TransactionController_updateTransactionInternal({ transactionId, note, skipHistory, skipValidation, skipResimulateCheck, }, callback) {