Skip to content

Commit d645dcf

Browse files
authored
Merge branch 'main' into feat/jwt-auth-accounts-api-integration
2 parents 500a696 + 216b0a6 commit d645dcf

File tree

15 files changed

+163
-35
lines changed

15 files changed

+163
-35
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metamask/core-monorepo",
3-
"version": "688.0.0",
3+
"version": "689.0.0",
44
"private": true,
55
"description": "Monorepo for packages shared between MetaMask clients",
66
"repository": {

packages/assets-controllers/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
"@metamask/multichain-account-service": "^4.0.0",
9595
"@metamask/network-controller": "^26.0.0",
9696
"@metamask/permission-controller": "^12.1.1",
97-
"@metamask/phishing-controller": "^16.0.0",
97+
"@metamask/phishing-controller": "^16.1.0",
9898
"@metamask/preferences-controller": "^22.0.0",
9999
"@metamask/profile-sync-controller": "^27.0.0",
100100
"@metamask/providers": "^22.1.0",

packages/phishing-controller/CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [16.1.0]
11+
12+
### Added
13+
14+
- Export `TokenScanCacheData` and `TokenScanResultType` to allow consumers to have a type to reference if grabbing values directly from the controller's state ([#7208](https://github.com/MetaMask/core/pull/7208))
15+
1016
## [16.0.0]
1117

1218
### Added
@@ -487,7 +493,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
487493

488494
All changes listed after this point were applied to this package following the monorepo conversion.
489495

490-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/[email protected]
496+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/[email protected]
497+
[16.1.0]: https://github.com/MetaMask/core/compare/@metamask/[email protected]...@metamask/[email protected]
491498
[16.0.0]: https://github.com/MetaMask/core/compare/@metamask/[email protected]...@metamask/[email protected]
492499
[15.0.1]: https://github.com/MetaMask/core/compare/@metamask/[email protected]...@metamask/[email protected]
493500
[15.0.0]: https://github.com/MetaMask/core/compare/@metamask/[email protected]...@metamask/[email protected]

packages/phishing-controller/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metamask/phishing-controller",
3-
"version": "16.0.0",
3+
"version": "16.1.0",
44
"description": "Maintains a periodically updated list of approved and unapproved website origins",
55
"keywords": [
66
"MetaMask",

packages/phishing-controller/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export type {
88
} from './PhishingDetector';
99
export { PhishingDetector } from './PhishingDetector';
1010
export type { PhishingDetectionScanResult, AddressScanResult } from './types';
11+
export type { TokenScanCacheData, TokenScanResultType } from './types';
1112
export {
1213
PhishingDetectorResultType,
1314
RecommendedAction,

packages/transaction-controller/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Changed
11+
12+
- Performance optimisations in `addTransaction` and `addTransactionBatch` methods ([#7205](https://github.com/MetaMask/core/pull/7205))
13+
- Add `skipInitialGasEstimate` option to `addTransaction` and `addTransactionBatch` methods.
14+
- Add `disableUpgrade` option to `addTransactionBatch` method.
15+
1016
## [62.0.0]
1117

1218
### Added

packages/transaction-controller/jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module.exports = merge(baseConfig, {
1818
coverageThreshold: {
1919
global: {
2020
branches: 91.76,
21-
functions: 92.76,
21+
functions: 92.46,
2222
lines: 96.83,
2323
statements: 96.82,
2424
},

packages/transaction-controller/src/TransactionController.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1686,7 +1686,6 @@ describe('TransactionController', () => {
16861686
batchId: undefined,
16871687
chainId: expect.any(String),
16881688
dappSuggestedGasFees: undefined,
1689-
delegationAddress: undefined,
16901689
deviceConfirmedOn: undefined,
16911690
disableGasBuffer: undefined,
16921691
id: expect.any(String),

packages/transaction-controller/src/TransactionController.ts

Lines changed: 54 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ import { add0x } from '@metamask/utils';
5656
// This package purposefully relies on Node's EventEmitter module.
5757
// eslint-disable-next-line import-x/no-nodejs-modules
5858
import { EventEmitter } from 'events';
59-
import { cloneDeep, mapValues, merge, pickBy, sortBy } from 'lodash';
59+
import { cloneDeep, mapValues, merge, noop, pickBy, sortBy } from 'lodash';
6060
import { v1 as random } from 'uuid';
6161

6262
import { DefaultGasFeeFlow } from './gas-flows/DefaultGasFeeFlow';
@@ -1239,6 +1239,7 @@ export class TransactionController extends BaseController<
12391239
requireApproval,
12401240
securityAlertResponse,
12411241
sendFlowHistory,
1242+
skipInitialGasEstimate,
12421243
swaps = {},
12431244
traceContext,
12441245
type,
@@ -1311,8 +1312,6 @@ export class TransactionController extends BaseController<
13111312
const transactionType =
13121313
type ?? (await determineTransactionType(txParams, ethQuery)).type;
13131314

1314-
const delegationAddress = await delegationAddressPromise;
1315-
13161315
const existingTransactionMeta = this.#getTransactionWithActionId(actionId);
13171316

13181317
// If a request to add a transaction with the same actionId is submitted again, a new transaction will not be created for it.
@@ -1325,7 +1324,6 @@ export class TransactionController extends BaseController<
13251324
batchId,
13261325
chainId,
13271326
dappSuggestedGasFees,
1328-
delegationAddress,
13291327
deviceConfirmedOn,
13301328
disableGasBuffer,
13311329
id: random(),
@@ -1360,13 +1358,40 @@ export class TransactionController extends BaseController<
13601358
updateTransaction(addedTransactionMeta);
13611359
}
13621360

1363-
await this.#trace(
1364-
{ name: 'Estimate Gas Properties', parentContext: traceContext },
1365-
(context) =>
1366-
this.#updateGasProperties(addedTransactionMeta, {
1367-
traceContext: context,
1368-
}),
1369-
);
1361+
if (!skipInitialGasEstimate) {
1362+
await this.#trace(
1363+
{ name: 'Estimate Gas Properties', parentContext: traceContext },
1364+
(context) =>
1365+
this.#updateGasProperties(addedTransactionMeta, {
1366+
traceContext: context,
1367+
}),
1368+
);
1369+
} else {
1370+
const newTransactionMeta = cloneDeep(addedTransactionMeta);
1371+
1372+
this.#updateGasProperties(newTransactionMeta)
1373+
.then(() => {
1374+
this.#updateTransactionInternal(
1375+
{
1376+
transactionId: newTransactionMeta.id,
1377+
skipHistory: true,
1378+
skipResimulateCheck: true,
1379+
skipValidation: true,
1380+
},
1381+
(tx) => {
1382+
tx.txParams.gas = newTransactionMeta.txParams.gas;
1383+
tx.txParams.gasPrice = newTransactionMeta.txParams.gasPrice;
1384+
tx.txParams.maxFeePerGas =
1385+
newTransactionMeta.txParams.maxFeePerGas;
1386+
tx.txParams.maxPriorityFeePerGas =
1387+
newTransactionMeta.txParams.maxPriorityFeePerGas;
1388+
},
1389+
);
1390+
1391+
return undefined;
1392+
})
1393+
.catch(noop);
1394+
}
13701395

13711396
// Checks if a transaction already exists with a given actionId
13721397
if (!existingTransactionMeta) {
@@ -1401,6 +1426,24 @@ export class TransactionController extends BaseController<
14011426

14021427
this.#addMetadata(addedTransactionMeta);
14031428

1429+
delegationAddressPromise
1430+
.then((delegationAddress) => {
1431+
this.#updateTransactionInternal(
1432+
{
1433+
transactionId: addedTransactionMeta.id,
1434+
skipHistory: true,
1435+
skipResimulateCheck: true,
1436+
skipValidation: true,
1437+
},
1438+
(tx) => {
1439+
tx.delegationAddress = delegationAddress;
1440+
},
1441+
);
1442+
1443+
return undefined;
1444+
})
1445+
.catch(noop);
1446+
14041447
if (requireApproval !== false) {
14051448
this.#updateSimulationData(addedTransactionMeta, {
14061449
traceContext,

packages/transaction-controller/src/types.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1723,6 +1723,9 @@ export type TransactionBatchRequest = {
17231723
/** Whether to disable batch transaction via sequential transactions. */
17241724
disableSequential?: boolean;
17251725

1726+
/** Whether to disable upgrading the account to an EIP-7702. */
1727+
disableUpgrade?: boolean;
1728+
17261729
/** Address of the account to submit the transaction batch. */
17271730
from: Hex;
17281731

@@ -1747,6 +1750,9 @@ export type TransactionBatchRequest = {
17471750
/** Security alert ID to persist on the transaction. */
17481751
securityAlertId?: string;
17491752

1753+
/** Whether to skip the initial gas calculation and rely only on the polling. */
1754+
skipInitialGasEstimate?: boolean;
1755+
17501756
/** Transactions to be submitted as part of the batch. */
17511757
transactions: TransactionBatchSingleRequest[];
17521758

@@ -2100,6 +2106,9 @@ export type AddTransactionOptions = {
21002106
/** Entries to add to the `sendFlowHistory`. */
21012107
sendFlowHistory?: SendFlowHistoryEntry[];
21022108

2109+
/** Whether to skip the initial gas calculation and rely only on the polling. */
2110+
skipInitialGasEstimate?: boolean;
2111+
21032112
/** Options for swaps transactions. */
21042113
swaps?: {
21052114
/** Whether the transaction has an approval transaction. */

0 commit comments

Comments
 (0)