@metamask-previews/transaction-controller 57.3.0-preview-3636a128 → 58.0.0-preview-c6e5eb7
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 +29 -1
- package/dist/TransactionController.cjs +26 -18
- package/dist/TransactionController.cjs.map +1 -1
- package/dist/TransactionController.d.cts +5 -3
- package/dist/TransactionController.d.cts.map +1 -1
- package/dist/TransactionController.d.mts +5 -3
- package/dist/TransactionController.d.mts.map +1 -1
- package/dist/TransactionController.mjs +26 -18
- package/dist/TransactionController.mjs.map +1 -1
- package/dist/api/accounts-api.cjs.map +1 -1
- package/dist/api/accounts-api.d.cts +1 -1
- package/dist/api/accounts-api.d.cts.map +1 -1
- package/dist/api/accounts-api.d.mts +1 -1
- package/dist/api/accounts-api.d.mts.map +1 -1
- package/dist/api/accounts-api.mjs.map +1 -1
- package/dist/helpers/AccountsApiRemoteTransactionSource.cjs +39 -105
- package/dist/helpers/AccountsApiRemoteTransactionSource.cjs.map +1 -1
- package/dist/helpers/AccountsApiRemoteTransactionSource.d.cts.map +1 -1
- package/dist/helpers/AccountsApiRemoteTransactionSource.d.mts.map +1 -1
- package/dist/helpers/AccountsApiRemoteTransactionSource.mjs +39 -105
- package/dist/helpers/AccountsApiRemoteTransactionSource.mjs.map +1 -1
- package/dist/helpers/IncomingTransactionHelper.cjs +7 -18
- package/dist/helpers/IncomingTransactionHelper.cjs.map +1 -1
- package/dist/helpers/IncomingTransactionHelper.d.cts +6 -4
- package/dist/helpers/IncomingTransactionHelper.d.cts.map +1 -1
- package/dist/helpers/IncomingTransactionHelper.d.mts +6 -4
- package/dist/helpers/IncomingTransactionHelper.d.mts.map +1 -1
- package/dist/helpers/IncomingTransactionHelper.mjs +7 -18
- package/dist/helpers/IncomingTransactionHelper.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +2 -13
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +2 -13
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/utils/transaction-type.cjs +23 -27
- package/dist/utils/transaction-type.cjs.map +1 -1
- package/dist/utils/transaction-type.d.cts +1 -1
- package/dist/utils/transaction-type.d.cts.map +1 -1
- package/dist/utils/transaction-type.d.mts +1 -1
- package/dist/utils/transaction-type.d.mts.map +1 -1
- package/dist/utils/transaction-type.mjs +23 -27
- package/dist/utils/transaction-type.mjs.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
|
|
10
10
|
### Added
|
|
11
11
|
|
|
12
|
+
- Support `containerTypes` property in `updateEditableParams` method ([#6014](https://github.com/MetaMask/core/pull/6014))
|
|
13
|
+
- Add specific transaction types to outgoing transactions retrieved from accounts API ([#5987](https://github.com/MetaMask/core/pull/5987))
|
|
14
|
+
- Add optional `amount` property to `transferInformation` object in `TransactionMeta` type.
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- Query only latest page of transactions from accounts API ([#5983](https://github.com/MetaMask/core/pull/5983))
|
|
19
|
+
- Remove incoming transactions when calling `wipeTransactions` ([#5986](https://github.com/MetaMask/core/pull/5986))
|
|
20
|
+
- Poll immediately when calling `startIncomingTransactionPolling` ([#5986](https://github.com/MetaMask/core/pull/5986))
|
|
21
|
+
|
|
22
|
+
## [58.0.0]
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
- **BREAKING:** Bump peer dependency `@metamask/accounts-controller` to `^31.0.0` ([#5999](https://github.com/MetaMask/core/pull/5999))
|
|
27
|
+
- **BREAKING:** Bump peer dependency `@metamask/gas-fee-controller` to `^24.0.0` ([#5999](https://github.com/MetaMask/core/pull/5999))
|
|
28
|
+
- **BREAKING:** Bump peer dependency `@metamask/network-controller` to `^24.0.0` ([#5999](https://github.com/MetaMask/core/pull/5999))
|
|
29
|
+
|
|
30
|
+
## [57.4.0]
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
|
|
12
34
|
- Add optional `afterSimulate` and `beforeSign` hooks to constructor ([#5503](https://github.com/MetaMask/core/pull/5503))
|
|
13
35
|
- Add `AfterSimulateHook` type.
|
|
14
36
|
- Add `BeforeSignHook` type.
|
|
@@ -18,6 +40,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
18
40
|
- Add optional `ignoreDelegationSignatures` boolean to `estimateGas` method.
|
|
19
41
|
- Add `gasFeeEstimates` property to `TransactionBatchMeta`, populated using `DefaultGasFeeFlow` ([#5886](https://github.com/MetaMask/core/pull/5886))
|
|
20
42
|
|
|
43
|
+
### Fixed
|
|
44
|
+
|
|
45
|
+
- Handle unknown chain IDs on incoming transactions ([#5985](https://github.com/MetaMask/core/pull/5985))
|
|
46
|
+
|
|
21
47
|
## [57.3.0]
|
|
22
48
|
|
|
23
49
|
### Added
|
|
@@ -1679,7 +1705,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
1679
1705
|
|
|
1680
1706
|
All changes listed after this point were applied to this package following the monorepo conversion.
|
|
1681
1707
|
|
|
1682
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@
|
|
1708
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@58.0.0...HEAD
|
|
1709
|
+
[58.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@57.4.0...@metamask/transaction-controller@58.0.0
|
|
1710
|
+
[57.4.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@57.3.0...@metamask/transaction-controller@57.4.0
|
|
1683
1711
|
[57.3.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@57.2.0...@metamask/transaction-controller@57.3.0
|
|
1684
1712
|
[57.2.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@57.1.0...@metamask/transaction-controller@57.2.0
|
|
1685
1713
|
[57.1.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@57.0.0...@metamask/transaction-controller@57.1.0
|
|
@@ -263,23 +263,15 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
263
263
|
_state.methodData[fourBytePrefix] = methodData;
|
|
264
264
|
});
|
|
265
265
|
});
|
|
266
|
-
const updateCache = (fn) => {
|
|
267
|
-
this.update((_state) => {
|
|
268
|
-
fn(_state.lastFetchedBlockNumbers);
|
|
269
|
-
});
|
|
270
|
-
};
|
|
271
266
|
__classPrivateFieldSet(this, _TransactionController_incomingTransactionHelper, new IncomingTransactionHelper_1.IncomingTransactionHelper({
|
|
272
267
|
client: __classPrivateFieldGet(this, _TransactionController_incomingTransactionOptions, "f").client,
|
|
273
|
-
getCache: () => this.state.lastFetchedBlockNumbers,
|
|
274
268
|
getCurrentAccount: () => __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getSelectedAccount).call(this),
|
|
275
269
|
getLocalTransactions: () => this.state.transactions,
|
|
276
270
|
includeTokenTransfers: __classPrivateFieldGet(this, _TransactionController_incomingTransactionOptions, "f").includeTokenTransfers,
|
|
277
271
|
isEnabled: __classPrivateFieldGet(this, _TransactionController_incomingTransactionOptions, "f").isEnabled,
|
|
278
272
|
messenger: this.messagingSystem,
|
|
279
|
-
queryEntireHistory: __classPrivateFieldGet(this, _TransactionController_incomingTransactionOptions, "f").queryEntireHistory,
|
|
280
273
|
remoteTransactionSource: new AccountsApiRemoteTransactionSource_1.AccountsApiRemoteTransactionSource(),
|
|
281
274
|
trimTransactions: __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_trimTransactionsForState).bind(this),
|
|
282
|
-
updateCache,
|
|
283
275
|
updateTransactions: __classPrivateFieldGet(this, _TransactionController_incomingTransactionOptions, "f").updateTransactions,
|
|
284
276
|
}), "f");
|
|
285
277
|
__classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_addIncomingTransactionHelperListeners).call(this, __classPrivateFieldGet(this, _TransactionController_incomingTransactionHelper, "f"));
|
|
@@ -672,12 +664,15 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
672
664
|
});
|
|
673
665
|
return;
|
|
674
666
|
}
|
|
675
|
-
const newTransactions = this.state.transactions.filter(({ chainId: txChainId, txParams }) => {
|
|
667
|
+
const newTransactions = this.state.transactions.filter(({ chainId: txChainId, txParams, type }) => {
|
|
676
668
|
const isMatchingNetwork = !chainId || chainId === txChainId;
|
|
677
669
|
if (!isMatchingNetwork) {
|
|
678
670
|
return true;
|
|
679
671
|
}
|
|
680
|
-
const isMatchingAddress = !address ||
|
|
672
|
+
const isMatchingAddress = !address ||
|
|
673
|
+
txParams.from?.toLowerCase() === address.toLowerCase() ||
|
|
674
|
+
(type === types_1.TransactionType.incoming &&
|
|
675
|
+
txParams.to?.toLowerCase() === address.toLowerCase());
|
|
681
676
|
return !isMatchingAddress;
|
|
682
677
|
});
|
|
683
678
|
this.update((state) => {
|
|
@@ -869,6 +864,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
869
864
|
*
|
|
870
865
|
* @param txId - The ID of the transaction to update.
|
|
871
866
|
* @param params - The editable parameters to update.
|
|
867
|
+
* @param params.containerTypes - Container types applied to the parameters.
|
|
872
868
|
* @param params.data - Data to pass with the transaction.
|
|
873
869
|
* @param params.from - Address to send the transaction from.
|
|
874
870
|
* @param params.gas - Maximum number of units of gas to use for the transaction.
|
|
@@ -879,7 +875,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
879
875
|
* @param params.value - Value associated with the transaction.
|
|
880
876
|
* @returns The updated transaction metadata.
|
|
881
877
|
*/
|
|
882
|
-
async updateEditableParams(txId, { data, from, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, to, value, }) {
|
|
878
|
+
async updateEditableParams(txId, { containerTypes, data, from, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, to, value, }) {
|
|
883
879
|
const transactionMeta = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getTransaction).call(this, txId);
|
|
884
880
|
if (!transactionMeta) {
|
|
885
881
|
throw new Error(`Cannot update editable params as no transaction metadata found`);
|
|
@@ -904,6 +900,9 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
904
900
|
const ethQuery = new eth_query_1.default(provider);
|
|
905
901
|
const { type } = await (0, transaction_type_1.determineTransactionType)(updatedTransaction.txParams, ethQuery);
|
|
906
902
|
updatedTransaction.type = type;
|
|
903
|
+
if (containerTypes) {
|
|
904
|
+
updatedTransaction.containerTypes = containerTypes;
|
|
905
|
+
}
|
|
907
906
|
await (0, layer1_gas_fee_flow_1.updateTransactionLayer1GasFee)({
|
|
908
907
|
layer1GasFeeFlows: __classPrivateFieldGet(this, _TransactionController_layer1GasFeeFlows, "f"),
|
|
909
908
|
messenger: this.messagingSystem,
|
|
@@ -1704,14 +1703,23 @@ async function _TransactionController_approveTransaction(transactionId, traceCon
|
|
|
1704
1703
|
if (!transactions.length) {
|
|
1705
1704
|
return;
|
|
1706
1705
|
}
|
|
1707
|
-
const finalTransactions =
|
|
1706
|
+
const finalTransactions = [];
|
|
1707
|
+
for (const tx of transactions) {
|
|
1708
1708
|
const { chainId } = tx;
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1709
|
+
try {
|
|
1710
|
+
const networkClientId = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getNetworkClientId).call(this, { chainId });
|
|
1711
|
+
finalTransactions.push({
|
|
1712
|
+
...tx,
|
|
1713
|
+
networkClientId,
|
|
1714
|
+
});
|
|
1715
|
+
}
|
|
1716
|
+
catch (error) {
|
|
1717
|
+
(0, logger_1.projectLogger)('Failed to get network client ID for incoming transaction', {
|
|
1718
|
+
chainId,
|
|
1719
|
+
error,
|
|
1720
|
+
});
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1715
1723
|
this.update((state) => {
|
|
1716
1724
|
const { transactions: currentTransactions } = state;
|
|
1717
1725
|
state.transactions = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_trimTransactionsForState).call(this, [
|