@metamask/transaction-controller 59.0.0 → 59.2.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 +28 -1
- package/dist/TransactionController.cjs +9 -4
- package/dist/TransactionController.cjs.map +1 -1
- package/dist/TransactionController.d.cts +7 -3
- package/dist/TransactionController.d.cts.map +1 -1
- package/dist/TransactionController.d.mts +7 -3
- package/dist/TransactionController.d.mts.map +1 -1
- package/dist/TransactionController.mjs +9 -4
- package/dist/TransactionController.mjs.map +1 -1
- package/dist/hooks/ExtraTransactionsPublishHook.cjs +7 -3
- package/dist/hooks/ExtraTransactionsPublishHook.cjs.map +1 -1
- package/dist/hooks/ExtraTransactionsPublishHook.d.cts +2 -2
- package/dist/hooks/ExtraTransactionsPublishHook.d.cts.map +1 -1
- package/dist/hooks/ExtraTransactionsPublishHook.d.mts +2 -2
- package/dist/hooks/ExtraTransactionsPublishHook.d.mts.map +1 -1
- package/dist/hooks/ExtraTransactionsPublishHook.mjs +7 -3
- package/dist/hooks/ExtraTransactionsPublishHook.mjs.map +1 -1
- package/dist/types.cjs +4 -0
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +24 -1
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +24 -1
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs +4 -0
- package/dist/types.mjs.map +1 -1
- package/dist/utils/batch.cjs +19 -6
- package/dist/utils/batch.cjs.map +1 -1
- package/dist/utils/batch.mjs +19 -6
- package/dist/utils/batch.mjs.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [59.2.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Add optional `updateType` property to disable `type` update in `updateEditableParams` method ([#6289](https://github.com/MetaMask/core/pull/6289))
|
|
15
|
+
- Add `perpsDeposit` to `TransactionType` ([#6282](https://github.com/MetaMask/core/pull/6282))
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Bump `@metamask/base-controller` from `^8.0.1` to `^8.1.0` ([#6284](https://github.com/MetaMask/core/pull/6284))
|
|
20
|
+
|
|
21
|
+
## [59.1.0]
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- Add `assetsFiatValues` property on `addTransaction` options ([#6178](https://github.com/MetaMask/core/pull/6178))
|
|
26
|
+
- `assetsFiatValues.sending` is total fiat value of sent assets
|
|
27
|
+
- `assetsFiatValues.receiving` is total fiat value of recieved assets
|
|
28
|
+
- Add and export `AddTransactionOptions` type ([#6178](https://github.com/MetaMask/core/pull/6178))
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
|
|
32
|
+
- Preserve provided `origin` in `transactions` when calling `addTransactionBatch` ([#6178](https://github.com/MetaMask/core/pull/6178))
|
|
33
|
+
|
|
10
34
|
## [59.0.0]
|
|
11
35
|
|
|
12
36
|
### Added
|
|
@@ -19,6 +43,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
19
43
|
|
|
20
44
|
### Fixed
|
|
21
45
|
|
|
46
|
+
- Preserve provided `type` in `transactions` when calling `addTransactionBatch` ([#6056](https://github.com/MetaMask/core/pull/6056))
|
|
22
47
|
- Normalize transaction `data` to ensure case-insensitive detection ([#6102](https://github.com/MetaMask/core/pull/6102))
|
|
23
48
|
|
|
24
49
|
## [58.1.1]
|
|
@@ -1731,7 +1756,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
1731
1756
|
|
|
1732
1757
|
All changes listed after this point were applied to this package following the monorepo conversion.
|
|
1733
1758
|
|
|
1734
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@59.
|
|
1759
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@59.2.0...HEAD
|
|
1760
|
+
[59.2.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@59.1.0...@metamask/transaction-controller@59.2.0
|
|
1761
|
+
[59.1.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@59.0.0...@metamask/transaction-controller@59.1.0
|
|
1735
1762
|
[59.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@58.1.1...@metamask/transaction-controller@59.0.0
|
|
1736
1763
|
[58.1.1]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@58.1.0...@metamask/transaction-controller@58.1.1
|
|
1737
1764
|
[58.1.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@58.0.0...@metamask/transaction-controller@58.1.0
|
|
@@ -360,6 +360,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
360
360
|
* @param txParams - Standard parameters for an Ethereum transaction.
|
|
361
361
|
* @param options - Additional options to control how the transaction is added.
|
|
362
362
|
* @param options.actionId - Unique ID to prevent duplicate requests.
|
|
363
|
+
* @param options.assetsFiatValues - The fiat values of the assets being sent and received.
|
|
363
364
|
* @param options.batchId - A custom ID for the batch this transaction belongs to.
|
|
364
365
|
* @param options.deviceConfirmedOn - An enum to indicate what device confirmed the transaction.
|
|
365
366
|
* @param options.disableGasBuffer - Whether to disable the gas estimation buffer.
|
|
@@ -380,7 +381,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
380
381
|
*/
|
|
381
382
|
async addTransaction(txParams, options) {
|
|
382
383
|
(0, logger_1.projectLogger)('Adding transaction', txParams, options);
|
|
383
|
-
const { actionId, batchId, deviceConfirmedOn, disableGasBuffer, method, nestedTransactions, networkClientId, origin, publishHook, requireApproval, securityAlertResponse, sendFlowHistory, swaps = {}, traceContext, type, } = options;
|
|
384
|
+
const { actionId, assetsFiatValues, batchId, deviceConfirmedOn, disableGasBuffer, method, nestedTransactions, networkClientId, origin, publishHook, requireApproval, securityAlertResponse, sendFlowHistory, swaps = {}, traceContext, type, } = options;
|
|
384
385
|
txParams = (0, utils_2.normalizeTransactionParams)(txParams);
|
|
385
386
|
if (!__classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").has(networkClientId)) {
|
|
386
387
|
throw new Error(`Network client not found - ${networkClientId}`);
|
|
@@ -424,6 +425,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
424
425
|
: {
|
|
425
426
|
// Add actionId to txMeta to check if same actionId is seen again
|
|
426
427
|
actionId,
|
|
428
|
+
assetsFiatValues,
|
|
427
429
|
batchId,
|
|
428
430
|
chainId,
|
|
429
431
|
dappSuggestedGasFees,
|
|
@@ -873,11 +875,12 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
873
875
|
* @param params.gasPrice - Price per gas for legacy transactions.
|
|
874
876
|
* @param params.maxFeePerGas - Maximum amount per gas to pay for the transaction, including the priority fee.
|
|
875
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`.
|
|
876
879
|
* @param params.to - Address to send the transaction to.
|
|
877
880
|
* @param params.value - Value associated with the transaction.
|
|
878
881
|
* @returns The updated transaction metadata.
|
|
879
882
|
*/
|
|
880
|
-
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, }) {
|
|
881
884
|
const transactionMeta = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getTransaction).call(this, txId);
|
|
882
885
|
if (!transactionMeta) {
|
|
883
886
|
throw new Error(`Cannot update editable params as no transaction metadata found`);
|
|
@@ -900,8 +903,10 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
900
903
|
const { networkClientId } = transactionMeta;
|
|
901
904
|
const provider = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getProvider).call(this, { networkClientId });
|
|
902
905
|
const ethQuery = new eth_query_1.default(provider);
|
|
903
|
-
|
|
904
|
-
|
|
906
|
+
if (updateType !== false) {
|
|
907
|
+
const { type } = await (0, transaction_type_1.determineTransactionType)(updatedTransaction.txParams, ethQuery);
|
|
908
|
+
updatedTransaction.type = type;
|
|
909
|
+
}
|
|
905
910
|
if (containerTypes) {
|
|
906
911
|
updatedTransaction.containerTypes = containerTypes;
|
|
907
912
|
}
|