@metamask-previews/transaction-controller 56.0.0-preview-c2a3c87 → 56.1.0-preview-eb5ae1b
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 +17 -1
- package/dist/TransactionController.cjs +47 -16
- package/dist/TransactionController.cjs.map +1 -1
- package/dist/TransactionController.d.cts +1 -1
- package/dist/TransactionController.d.cts.map +1 -1
- package/dist/TransactionController.d.mts +1 -1
- package/dist/TransactionController.d.mts.map +1 -1
- package/dist/TransactionController.mjs +49 -18
- package/dist/TransactionController.mjs.map +1 -1
- package/dist/helpers/GasFeePoller.cjs +76 -48
- package/dist/helpers/GasFeePoller.cjs.map +1 -1
- package/dist/helpers/GasFeePoller.d.cts +15 -3
- package/dist/helpers/GasFeePoller.d.cts.map +1 -1
- package/dist/helpers/GasFeePoller.d.mts +15 -3
- package/dist/helpers/GasFeePoller.d.mts.map +1 -1
- package/dist/helpers/GasFeePoller.mjs +73 -46
- package/dist/helpers/GasFeePoller.mjs.map +1 -1
- package/dist/utils/transaction-type.cjs +4 -1
- package/dist/utils/transaction-type.cjs.map +1 -1
- package/dist/utils/transaction-type.d.cts.map +1 -1
- package/dist/utils/transaction-type.d.mts.map +1 -1
- package/dist/utils/transaction-type.mjs +4 -1
- package/dist/utils/transaction-type.mjs.map +1 -1
- package/dist/utils/validation.cjs +1 -0
- package/dist/utils/validation.cjs.map +1 -1
- package/dist/utils/validation.d.cts +2 -1
- package/dist/utils/validation.d.cts.map +1 -1
- package/dist/utils/validation.d.mts +2 -1
- package/dist/utils/validation.d.mts.map +1 -1
- package/dist/utils/validation.mjs +1 -0
- package/dist/utils/validation.mjs.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -7,12 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- Fix `addTransaction` function to correctly identify a transaction as a `simpleSend` type when the recipient is a smart account ([#5800](https://github.com/MetaMask/core/pull/5800))
|
|
13
|
+
|
|
14
|
+
## [56.1.0]
|
|
15
|
+
|
|
10
16
|
### Added
|
|
11
17
|
|
|
18
|
+
- Automatically update gas fee properties in `txParams` when `updateTransactionGasFees` method is called with `userFeeLevel` ([#5800](https://github.com/MetaMask/core/pull/5800))
|
|
12
19
|
- Support additional debug of incoming transaction requests ([#5803](https://github.com/MetaMask/core/pull/5803))
|
|
13
20
|
- Add optional `incomingTransactions.client` constructor property.
|
|
14
21
|
- Add optional `tags` property to `updateIncomingTransactions` method.
|
|
15
22
|
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- Bump `@metamask/controller-utils` to `^11.9.0` ([#5812](https://github.com/MetaMask/core/pull/5812))
|
|
26
|
+
|
|
27
|
+
### Fixed
|
|
28
|
+
|
|
29
|
+
- Throw correct error code if upgrade rejected ([#5814](https://github.com/MetaMask/core/pull/5814))
|
|
30
|
+
|
|
16
31
|
## [56.0.0]
|
|
17
32
|
|
|
18
33
|
### Changed
|
|
@@ -1590,7 +1605,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
1590
1605
|
|
|
1591
1606
|
All changes listed after this point were applied to this package following the monorepo conversion.
|
|
1592
1607
|
|
|
1593
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@56.
|
|
1608
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@56.1.0...HEAD
|
|
1609
|
+
[56.1.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@56.0.0...@metamask/transaction-controller@56.1.0
|
|
1594
1610
|
[56.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@55.0.2...@metamask/transaction-controller@56.0.0
|
|
1595
1611
|
[55.0.2]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@55.0.1...@metamask/transaction-controller@55.0.2
|
|
1596
1612
|
[55.0.1]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@55.0.0...@metamask/transaction-controller@55.0.1
|
|
@@ -743,35 +743,66 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
743
743
|
* @param gasValues.userFeeLevel - Estimate level user selected.
|
|
744
744
|
* @returns The updated transactionMeta.
|
|
745
745
|
*/
|
|
746
|
-
updateTransactionGasFees(transactionId, { defaultGasEstimates, estimateUsed, estimateSuggested, gas, gasLimit, gasPrice, maxPriorityFeePerGas, maxFeePerGas, originalGasEstimate, userEditedGasLimit, userFeeLevel, }) {
|
|
746
|
+
updateTransactionGasFees(transactionId, { defaultGasEstimates, estimateUsed, estimateSuggested, gas, gasLimit, gasPrice, maxPriorityFeePerGas, maxFeePerGas, originalGasEstimate, userEditedGasLimit, userFeeLevel: userFeeLevelParam, }) {
|
|
747
747
|
const transactionMeta = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getTransaction).call(this, transactionId);
|
|
748
748
|
if (!transactionMeta) {
|
|
749
749
|
throw new Error(`Cannot update transaction as no transaction metadata found`);
|
|
750
750
|
}
|
|
751
751
|
(0, utils_2.validateIfTransactionUnapproved)(transactionMeta, 'updateTransactionGasFees');
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
752
|
+
const clonedTransactionMeta = (0, lodash_1.cloneDeep)(transactionMeta);
|
|
753
|
+
const isTransactionGasFeeEstimatesExists = transactionMeta.gasFeeEstimates;
|
|
754
|
+
const isAutomaticGasFeeUpdateEnabled = __classPrivateFieldGet(this, _TransactionController_isAutomaticGasFeeUpdateEnabled, "f").call(this, transactionMeta);
|
|
755
|
+
const userFeeLevel = userFeeLevelParam;
|
|
756
|
+
const isOneOfFeeLevelSelected = Object.values(types_1.GasFeeEstimateLevel).includes(userFeeLevel);
|
|
757
|
+
const shouldUpdateTxParamsGasFees = isTransactionGasFeeEstimatesExists &&
|
|
758
|
+
isAutomaticGasFeeUpdateEnabled &&
|
|
759
|
+
isOneOfFeeLevelSelected;
|
|
760
|
+
if (shouldUpdateTxParamsGasFees) {
|
|
761
|
+
(0, GasFeePoller_1.updateTransactionGasEstimates)({
|
|
762
|
+
txMeta: clonedTransactionMeta,
|
|
763
|
+
userFeeLevel,
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
const txParamsUpdate = {
|
|
767
|
+
gas,
|
|
768
|
+
gasLimit,
|
|
769
|
+
};
|
|
770
|
+
if (shouldUpdateTxParamsGasFees) {
|
|
771
|
+
// Get updated values from clonedTransactionMeta if we're using automated fee updates
|
|
772
|
+
Object.assign(txParamsUpdate, {
|
|
773
|
+
gasPrice: clonedTransactionMeta.txParams.gasPrice,
|
|
774
|
+
maxPriorityFeePerGas: clonedTransactionMeta.txParams.maxPriorityFeePerGas,
|
|
775
|
+
maxFeePerGas: clonedTransactionMeta.txParams.maxFeePerGas,
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
else {
|
|
779
|
+
Object.assign(txParamsUpdate, {
|
|
756
780
|
gasPrice,
|
|
757
781
|
maxPriorityFeePerGas,
|
|
758
782
|
maxFeePerGas,
|
|
759
|
-
}
|
|
783
|
+
});
|
|
784
|
+
}
|
|
785
|
+
const transactionGasFees = {
|
|
786
|
+
txParams: (0, lodash_1.pickBy)(txParamsUpdate),
|
|
760
787
|
defaultGasEstimates,
|
|
761
788
|
estimateUsed,
|
|
762
789
|
estimateSuggested,
|
|
763
790
|
originalGasEstimate,
|
|
764
791
|
userEditedGasLimit,
|
|
765
792
|
userFeeLevel,
|
|
766
|
-
// TODO: Replace `any` with type
|
|
767
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
768
793
|
};
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
794
|
+
const filteredTransactionGasFees = (0, lodash_1.pickBy)(transactionGasFees);
|
|
795
|
+
__classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_updateTransactionInternal).call(this, {
|
|
796
|
+
transactionId,
|
|
797
|
+
note: `${controllerName}:updateTransactionGasFees - gas values updated`,
|
|
798
|
+
skipResimulateCheck: true,
|
|
799
|
+
}, (draftTxMeta) => {
|
|
800
|
+
const { txParams, ...otherProps } = filteredTransactionGasFees;
|
|
801
|
+
Object.assign(draftTxMeta, otherProps);
|
|
802
|
+
if (txParams) {
|
|
803
|
+
Object.assign(draftTxMeta.txParams, txParams);
|
|
804
|
+
}
|
|
805
|
+
});
|
|
775
806
|
return __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getTransaction).call(this, transactionId);
|
|
776
807
|
}
|
|
777
808
|
/**
|
|
@@ -2049,7 +2080,7 @@ async function _TransactionController_approveTransaction(transactionId, traceCon
|
|
|
2049
2080
|
(0, logger_1.projectLogger)('Updated simulation data', transactionId, simulationData);
|
|
2050
2081
|
}, _TransactionController_onGasFeePollerTransactionUpdate = function _TransactionController_onGasFeePollerTransactionUpdate({ transactionId, gasFeeEstimates, gasFeeEstimatesLoaded, layer1GasFee, }) {
|
|
2051
2082
|
__classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_updateTransactionInternal).call(this, { transactionId, skipHistory: true }, (txMeta) => {
|
|
2052
|
-
(0, GasFeePoller_1.
|
|
2083
|
+
(0, GasFeePoller_1.updateTransactionGasProperties)({
|
|
2053
2084
|
txMeta,
|
|
2054
2085
|
gasFeeEstimates,
|
|
2055
2086
|
gasFeeEstimatesLoaded,
|
|
@@ -2112,7 +2143,7 @@ async function _TransactionController_approveTransaction(transactionId, traceCon
|
|
|
2112
2143
|
}, _TransactionController_isRejectError = function _TransactionController_isRejectError(error) {
|
|
2113
2144
|
return [
|
|
2114
2145
|
rpc_errors_1.errorCodes.provider.userRejectedRequest,
|
|
2115
|
-
|
|
2146
|
+
validation_1.ErrorCode.RejectedUpgrade,
|
|
2116
2147
|
].includes(error.code);
|
|
2117
2148
|
}, _TransactionController_rejectTransactionAndThrow = function _TransactionController_rejectTransactionAndThrow(transactionId, actionId, error) {
|
|
2118
2149
|
__classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_rejectTransaction).call(this, transactionId, actionId, error);
|