Skip to content

Commit

Permalink
Merge branch 'develop' into feat/portfolio-view-feature-flag-removal
Browse files Browse the repository at this point in the history
  • Loading branch information
salimtb authored Nov 27, 2024
2 parents a01df8c + f711459 commit b40ca8e
Show file tree
Hide file tree
Showing 29 changed files with 847 additions and 799 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ version: 2.1
executors:
node-browsers-small:
docker:
- image: cimg/node:20.17-browsers
- image: cimg/node:20.18-browsers
resource_class: small
environment:
NODE_OPTIONS: --max_old_space_size=2048
node-browsers-medium:
docker:
- image: cimg/node:20.17-browsers
- image: cimg/node:20.18-browsers
resource_class: medium
environment:
NODE_OPTIONS: --max_old_space_size=3072
Expand All @@ -21,7 +21,7 @@ executors:
NODE_OPTIONS: --max_old_space_size=6144
node-browsers-medium-plus:
docker:
- image: cimg/node:20.17-browsers
- image: cimg/node:20.18-browsers
resource_class: medium+
environment:
NODE_OPTIONS: --max_old_space_size=4096
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v20.17
v20.18
11 changes: 6 additions & 5 deletions app/scripts/controllers/metametrics-controller.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1453,7 +1453,7 @@ describe('MetaMetricsController', function () {
participateInMetaMetrics: true,
currentCurrency: 'usd',
dataCollectionForMarketing: false,
preferences: { privacyMode: true },
preferences: { privacyMode: true, tokenNetworkFilter: [] },
///: BEGIN:ONLY_INCLUDE_IF(build-mmi)
custodyAccountDetails: {},
///: END:ONLY_INCLUDE_IF
Expand Down Expand Up @@ -1494,6 +1494,7 @@ describe('MetaMetricsController', function () {
///: END:ONLY_INCLUDE_IF
[MetaMetricsUserTrait.TokenSortPreference]: 'token-sort-key',
[MetaMetricsUserTrait.PrivacyModeEnabled]: true,
[MetaMetricsUserTrait.NetworkFilterPreference]: [],
});
});
});
Expand Down Expand Up @@ -1543,7 +1544,7 @@ describe('MetaMetricsController', function () {
allNfts: {},
participateInMetaMetrics: true,
dataCollectionForMarketing: false,
preferences: { privacyMode: true },
preferences: { privacyMode: true, tokenNetworkFilter: [] },
securityAlertsEnabled: true,
names: {
ethereumAddress: {},
Expand Down Expand Up @@ -1607,7 +1608,7 @@ describe('MetaMetricsController', function () {
allNfts: {},
participateInMetaMetrics: true,
dataCollectionForMarketing: false,
preferences: { privacyMode: true },
preferences: { privacyMode: true, tokenNetworkFilter: [] },
securityAlertsEnabled: true,
///: BEGIN:ONLY_INCLUDE_IF(build-mmi)
custodyAccountDetails: {},
Expand Down Expand Up @@ -1672,7 +1673,7 @@ describe('MetaMetricsController', function () {
},
participateInMetaMetrics: true,
dataCollectionForMarketing: false,
preferences: { privacyMode: true },
preferences: { privacyMode: true, tokenNetworkFilter: [] },
securityAlertsEnabled: true,
security_providers: ['blockaid'],
currentCurrency: 'usd',
Expand Down Expand Up @@ -1718,7 +1719,7 @@ describe('MetaMetricsController', function () {
allNfts: {},
participateInMetaMetrics: true,
dataCollectionForMarketing: false,
preferences: { privacyMode: true },
preferences: { privacyMode: true, tokenNetworkFilter: [] },
names: {
ethereumAddress: {},
},
Expand Down
4 changes: 4 additions & 0 deletions app/scripts/controllers/metametrics-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ export type MetaMaskState = {
currentCurrency: string;
preferences: {
privacyMode: PreferencesControllerState['preferences']['privacyMode'];
tokenNetworkFilter: string[];
};
///: BEGIN:ONLY_INCLUDE_IF(build-mmi)
custodyAccountDetails: {
Expand Down Expand Up @@ -1233,6 +1234,9 @@ export default class MetaMetricsController extends BaseController<
metamaskState.tokenSortConfig?.key || '',
[MetaMetricsUserTrait.PrivacyModeEnabled]:
metamaskState.preferences.privacyMode,
[MetaMetricsUserTrait.NetworkFilterPreference]: Object.keys(
metamaskState.preferences.tokenNetworkFilter || {},
),
};

if (!previousUserTraits) {
Expand Down
12 changes: 6 additions & 6 deletions app/scripts/controllers/permissions/caveat-mutators.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ function removeAccount(targetAccount, existingAccounts) {
);

if (newAccounts.length === existingAccounts.length) {
return { operation: CaveatMutatorOperation.noop };
return { operation: CaveatMutatorOperation.Noop };
} else if (newAccounts.length > 0) {
return {
operation: CaveatMutatorOperation.updateValue,
operation: CaveatMutatorOperation.UpdateValue,
value: newAccounts,
};
}
return { operation: CaveatMutatorOperation.revokePermission };
return { operation: CaveatMutatorOperation.RevokePermission };
}

/**
Expand All @@ -60,12 +60,12 @@ function removeChainId(targetChainId, existingChainIds) {
);

if (newChainIds.length === existingChainIds.length) {
return { operation: CaveatMutatorOperation.noop };
return { operation: CaveatMutatorOperation.Noop };
} else if (newChainIds.length > 0) {
return {
operation: CaveatMutatorOperation.updateValue,
operation: CaveatMutatorOperation.UpdateValue,
value: newChainIds,
};
}
return { operation: CaveatMutatorOperation.revokePermission };
return { operation: CaveatMutatorOperation.RevokePermission };
}
14 changes: 7 additions & 7 deletions app/scripts/controllers/permissions/caveat-mutators.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ describe('caveat mutators', () => {
describe('removeAccount', () => {
it('returns the no-op operation if the target account is not permitted', () => {
expect(removeAccount(address2, [address1])).toStrictEqual({
operation: CaveatMutatorOperation.noop,
operation: CaveatMutatorOperation.Noop,
});
});

it('returns the update operation and a new value if the target account is permitted', () => {
expect(removeAccount(address2, [address1, address2])).toStrictEqual({
operation: CaveatMutatorOperation.updateValue,
operation: CaveatMutatorOperation.UpdateValue,
value: [address1],
});
});

it('returns the revoke permission operation the target account is the only permitted account', () => {
expect(removeAccount(address1, [address1])).toStrictEqual({
operation: CaveatMutatorOperation.revokePermission,
operation: CaveatMutatorOperation.RevokePermission,
});
});

Expand All @@ -36,28 +36,28 @@ describe('caveat mutators', () => {
const checksummedAddress3 =
'0x95222290dd7278AA3DDd389cc1E1d165Cc4BaeE5';
expect(removeAccount(checksummedAddress3, [address3])).toStrictEqual({
operation: CaveatMutatorOperation.revokePermission,
operation: CaveatMutatorOperation.RevokePermission,
});
});

describe('Multichain behaviour', () => {
it('returns the no-op operation if the target account is not permitted', () => {
expect(removeAccount(address2, [nonEvmAddress])).toStrictEqual({
operation: CaveatMutatorOperation.noop,
operation: CaveatMutatorOperation.Noop,
});
});

it('can revoke permission for non-EVM addresses', () => {
expect(removeAccount(nonEvmAddress, [nonEvmAddress])).toStrictEqual({
operation: CaveatMutatorOperation.revokePermission,
operation: CaveatMutatorOperation.RevokePermission,
});
});

it('returns the update operation and a new value if the target non-EVM account is permitted', () => {
expect(
removeAccount(nonEvmAddress, [address1, nonEvmAddress]),
).toStrictEqual({
operation: CaveatMutatorOperation.updateValue,
operation: CaveatMutatorOperation.UpdateValue,
value: [address1],
});
});
Expand Down
3 changes: 1 addition & 2 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -4146,8 +4146,7 @@ export default class MetamaskController extends EventEmitter {
),

// GasFeeController
gasFeeStartPollingByNetworkClientId:
gasFeeController.startPollingByNetworkClientId.bind(gasFeeController),
gasFeeStartPolling: gasFeeController.startPolling.bind(gasFeeController),
gasFeeStopPollingByPollingToken:
gasFeeController.stopPollingByPollingToken.bind(gasFeeController),

Expand Down
Loading

0 comments on commit b40ca8e

Please sign in to comment.