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

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 +9 -1
  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 +145 -0
  39. package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.cjs.map +1 -0
  40. package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.d.cts +27 -0
  41. package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.d.cts.map +1 -0
  42. package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.d.mts +27 -0
  43. package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.d.mts.map +1 -0
  44. package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.mjs +140 -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 +15 -3
  72. package/dist/types.d.cts.map +1 -1
  73. package/dist/types.d.mts +15 -3
  74. package/dist/types.d.mts.map +1 -1
  75. package/dist/types.mjs.map +1 -1
  76. package/dist/utils/feature-flags.cjs +14 -1
  77. package/dist/utils/feature-flags.cjs.map +1 -1
  78. package/dist/utils/feature-flags.d.cts +10 -0
  79. package/dist/utils/feature-flags.d.cts.map +1 -1
  80. package/dist/utils/feature-flags.d.mts +10 -0
  81. package/dist/utils/feature-flags.d.mts.map +1 -1
  82. package/dist/utils/feature-flags.mjs +12 -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,13 @@ 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
+
15
+ ## [52.0.0]
16
+
10
17
  ### Changed
11
18
 
12
19
  - **BREAKING:** Remove `chainIds` argument from incoming transaction methods ([#5436](https://github.com/MetaMask/core/pull/5436))
@@ -1395,7 +1402,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1395
1402
 
1396
1403
  All changes listed after this point were applied to this package following the monorepo conversion.
1397
1404
 
1398
- [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@51.0.0...HEAD
1405
+ [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@52.0.0...HEAD
1406
+ [52.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@51.0.0...@metamask/transaction-controller@52.0.0
1399
1407
  [51.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@50.0.0...@metamask/transaction-controller@51.0.0
1400
1408
  [50.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@49.0.0...@metamask/transaction-controller@50.0.0
1401
1409
  [49.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@48.2.0...@metamask/transaction-controller@49.0.0
@@ -33,6 +33,7 @@ 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");
36
37
  const ScrollLayer1GasFeeFlow_1 = require("./gas-flows/ScrollLayer1GasFeeFlow.cjs");
37
38
  const TestGasFeeFlow_1 = require("./gas-flows/TestGasFeeFlow.cjs");
38
39
  const AccountsApiRemoteTransactionSource_1 = require("./helpers/AccountsApiRemoteTransactionSource.cjs");
@@ -246,6 +247,7 @@ class TransactionController extends base_controller_1.BaseController {
246
247
  getProvider: (networkClientId) => __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getProvider).call(this, { networkClientId }),
247
248
  getTransactions: () => this.state.transactions,
248
249
  layer1GasFeeFlows: this.layer1GasFeeFlows,
250
+ messenger: this.messagingSystem,
249
251
  onStateChange: (listener) => {
250
252
  this.messagingSystem.subscribe('TransactionController:stateChange', listener);
251
253
  },
@@ -815,6 +817,7 @@ class TransactionController extends base_controller_1.BaseController {
815
817
  updatedTransaction.type = type;
816
818
  await (0, layer1_gas_fee_flow_1.updateTransactionLayer1GasFee)({
817
819
  layer1GasFeeFlows: this.layer1GasFeeFlows,
820
+ messenger: this.messagingSystem,
818
821
  provider,
819
822
  transactionMeta: updatedTransaction,
820
823
  });
@@ -1027,7 +1030,7 @@ class TransactionController extends base_controller_1.BaseController {
1027
1030
  networkClientId,
1028
1031
  };
1029
1032
  // Guaranteed as the default gas fee flow matches all transactions.
1030
- const gasFeeFlow = (0, gas_flow_1.getGasFeeFlow)(transactionMeta, this.gasFeeFlows);
1033
+ const gasFeeFlow = (0, gas_flow_1.getGasFeeFlow)(transactionMeta, this.gasFeeFlows, this.messagingSystem);
1031
1034
  const ethQuery = new eth_query_1.default(provider);
1032
1035
  const gasFeeControllerData = await this.getGasFeeEstimates({
1033
1036
  networkClientId,
@@ -1035,6 +1038,7 @@ class TransactionController extends base_controller_1.BaseController {
1035
1038
  return gasFeeFlow.getGasFees({
1036
1039
  ethQuery,
1037
1040
  gasFeeControllerData,
1041
+ messenger: this.messagingSystem,
1038
1042
  transactionMeta,
1039
1043
  });
1040
1044
  }
@@ -1054,6 +1058,7 @@ class TransactionController extends base_controller_1.BaseController {
1054
1058
  });
1055
1059
  return await (0, layer1_gas_fee_flow_1.getTransactionLayer1GasFee)({
1056
1060
  layer1GasFeeFlows: this.layer1GasFeeFlows,
1061
+ messenger: this.messagingSystem,
1057
1062
  provider,
1058
1063
  transactionMeta: {
1059
1064
  txParams: transactionParams,
@@ -1180,10 +1185,12 @@ class TransactionController extends base_controller_1.BaseController {
1180
1185
  gasFeeFlows: this.gasFeeFlows,
1181
1186
  getGasFeeEstimates: this.getGasFeeEstimates,
1182
1187
  getSavedGasFees: this.getSavedGasFees.bind(this),
1188
+ messenger: this.messagingSystem,
1183
1189
  txMeta: transactionMeta,
1184
1190
  }));
1185
1191
  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)({
1186
1192
  layer1GasFeeFlows: this.layer1GasFeeFlows,
1193
+ messenger: this.messagingSystem,
1187
1194
  provider,
1188
1195
  transactionMeta,
1189
1196
  }));
@@ -1913,7 +1920,11 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_me
1913
1920
  if (__classPrivateFieldGet(this, _TransactionController_testGasFeeFlows, "f")) {
1914
1921
  return [new TestGasFeeFlow_1.TestGasFeeFlow()];
1915
1922
  }
1916
- return [new LineaGasFeeFlow_1.LineaGasFeeFlow(), new DefaultGasFeeFlow_1.DefaultGasFeeFlow()];
1923
+ return [
1924
+ new RandomisedEstimationsGasFeeFlow_1.RandomisedEstimationsGasFeeFlow(),
1925
+ new LineaGasFeeFlow_1.LineaGasFeeFlow(),
1926
+ new DefaultGasFeeFlow_1.DefaultGasFeeFlow(),
1927
+ ];
1917
1928
  }, _TransactionController_getLayer1GasFeeFlows = function _TransactionController_getLayer1GasFeeFlows() {
1918
1929
  return [new OptimismLayer1GasFeeFlow_1.OptimismLayer1GasFeeFlow(), new ScrollLayer1GasFeeFlow_1.ScrollLayer1GasFeeFlow()];
1919
1930
  }, _TransactionController_updateTransactionInternal = function _TransactionController_updateTransactionInternal({ transactionId, note, skipHistory, skipValidation, skipResimulateCheck, }, callback) {