@metamask/transaction-controller 59.1.0 → 60.0.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.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [60.0.0]
11
+
12
+ ### Added
13
+
14
+ - Add `isGasFeeSponsored` property to `TransactionMeta` type ([#6244](https://github.com/MetaMask/core/pull/6244))
15
+
16
+ ### Changed
17
+
18
+ - **BREAKING:** Bump peer dependency `@metamask/accounts-controller` from `^32.0.0` to `^33.0.0` ([#6345](https://github.com/MetaMask/core/pull/6345))
19
+ - Bump `@metamask/controller-utils` from `^11.11.0` to `^11.12.0` ([#6303](https://github.com/MetaMask/core/pull/6303))
20
+
21
+ ## [59.2.0]
22
+
23
+ ### Added
24
+
25
+ - Add optional `updateType` property to disable `type` update in `updateEditableParams` method ([#6289](https://github.com/MetaMask/core/pull/6289))
26
+ - Add `perpsDeposit` to `TransactionType` ([#6282](https://github.com/MetaMask/core/pull/6282))
27
+
28
+ ### Changed
29
+
30
+ - Bump `@metamask/base-controller` from `^8.0.1` to `^8.1.0` ([#6284](https://github.com/MetaMask/core/pull/6284))
31
+
10
32
  ## [59.1.0]
11
33
 
12
34
  ### Added
@@ -1745,7 +1767,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1745
1767
 
1746
1768
  All changes listed after this point were applied to this package following the monorepo conversion.
1747
1769
 
1748
- [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@59.1.0...HEAD
1770
+ [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@60.0.0...HEAD
1771
+ [60.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@59.2.0...@metamask/transaction-controller@60.0.0
1772
+ [59.2.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@59.1.0...@metamask/transaction-controller@59.2.0
1749
1773
  [59.1.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@59.0.0...@metamask/transaction-controller@59.1.0
1750
1774
  [59.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@58.1.1...@metamask/transaction-controller@59.0.0
1751
1775
  [58.1.1]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@58.1.0...@metamask/transaction-controller@58.1.1
@@ -875,11 +875,12 @@ class TransactionController extends base_controller_1.BaseController {
875
875
  * @param params.gasPrice - Price per gas for legacy transactions.
876
876
  * @param params.maxFeePerGas - Maximum amount per gas to pay for the transaction, including the priority fee.
877
877
  * @param params.maxPriorityFeePerGas - Maximum amount per gas to give to validator as incentive.
878
+ * @param params.updateType - Whether to update the transaction type. Defaults to `true`.
878
879
  * @param params.to - Address to send the transaction to.
879
880
  * @param params.value - Value associated with the transaction.
880
881
  * @returns The updated transaction metadata.
881
882
  */
882
- async updateEditableParams(txId, { containerTypes, data, from, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, to, value, }) {
883
+ async updateEditableParams(txId, { containerTypes, data, from, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, to, updateType, value, }) {
883
884
  const transactionMeta = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getTransaction).call(this, txId);
884
885
  if (!transactionMeta) {
885
886
  throw new Error(`Cannot update editable params as no transaction metadata found`);
@@ -902,8 +903,10 @@ class TransactionController extends base_controller_1.BaseController {
902
903
  const { networkClientId } = transactionMeta;
903
904
  const provider = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getProvider).call(this, { networkClientId });
904
905
  const ethQuery = new eth_query_1.default(provider);
905
- const { type } = await (0, transaction_type_1.determineTransactionType)(updatedTransaction.txParams, ethQuery);
906
- updatedTransaction.type = type;
906
+ if (updateType !== false) {
907
+ const { type } = await (0, transaction_type_1.determineTransactionType)(updatedTransaction.txParams, ethQuery);
908
+ updatedTransaction.type = type;
909
+ }
907
910
  if (containerTypes) {
908
911
  updatedTransaction.containerTypes = containerTypes;
909
912
  }
@@ -2097,6 +2100,7 @@ async function _TransactionController_approveTransaction(transactionId, traceCon
2097
2100
  tokenBalanceChanges: [],
2098
2101
  };
2099
2102
  let gasFeeTokens = [];
2103
+ let isGasFeeSponsored = false;
2100
2104
  const isBalanceChangesSkipped = __classPrivateFieldGet(this, _TransactionController_skipSimulationTransactionIds, "f").has(transactionId);
2101
2105
  if (__classPrivateFieldGet(this, _TransactionController_isSimulationEnabled, "f").call(this) && !isBalanceChangesSkipped) {
2102
2106
  simulationData = await __classPrivateFieldGet(this, _TransactionController_trace, "f").call(this, { name: 'Simulate', parentContext: traceContext }, () => (0, balance_changes_1.getBalanceChanges)({
@@ -2114,13 +2118,15 @@ async function _TransactionController_approveTransaction(transactionId, traceCon
2114
2118
  isUpdatedAfterSecurityCheck: true,
2115
2119
  };
2116
2120
  }
2117
- gasFeeTokens = await (0, gas_fee_tokens_1.getGasFeeTokens)({
2121
+ const gasFeeTokensResponse = await (0, gas_fee_tokens_1.getGasFeeTokens)({
2118
2122
  chainId,
2119
2123
  isEIP7702GasFeeTokensEnabled: __classPrivateFieldGet(this, _TransactionController_isEIP7702GasFeeTokensEnabled, "f"),
2120
2124
  messenger: this.messagingSystem,
2121
2125
  publicKeyEIP7702: __classPrivateFieldGet(this, _TransactionController_publicKeyEIP7702, "f"),
2122
2126
  transactionMeta,
2123
2127
  });
2128
+ gasFeeTokens = gasFeeTokensResponse?.gasFeeTokens ?? [];
2129
+ isGasFeeSponsored = gasFeeTokensResponse?.isGasFeeSponsored ?? false;
2124
2130
  }
2125
2131
  const latestTransactionMeta = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getTransaction).call(this, transactionId);
2126
2132
  /* istanbul ignore if */
@@ -2134,6 +2140,7 @@ async function _TransactionController_approveTransaction(transactionId, traceCon
2134
2140
  skipResimulateCheck: Boolean(blockTime),
2135
2141
  }, (txMeta) => {
2136
2142
  txMeta.gasFeeTokens = gasFeeTokens;
2143
+ txMeta.isGasFeeSponsored = isGasFeeSponsored;
2137
2144
  if (!isBalanceChangesSkipped) {
2138
2145
  txMeta.simulationData = simulationData;
2139
2146
  }