Skip to content

Commit

Permalink
Merge branch 'develop' into caip-multichain
Browse files Browse the repository at this point in the history
  • Loading branch information
jiexi committed Oct 1, 2024
2 parents d165506 + facf905 commit 15f622a
Show file tree
Hide file tree
Showing 57 changed files with 1,319 additions and 402 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [12.3.1]
### Fixed
- Fix duplicate network validation ([#27463](https://github.com/MetaMask/metamask-extension/pull/27463))
- Fix notification metrics ([#27435](https://github.com/MetaMask/metamask-extension/pull/27435))
- Fix transaction metrics ([#27457](https://github.com/MetaMask/metamask-extension/pull/27457))

## [12.3.0]
### Added
- Added the ability to name accounts during the snap account creation flow ([#25191](https://github.com/MetaMask/metamask-extension/pull/25191))
Expand Down Expand Up @@ -5106,7 +5112,8 @@ Update styles and spacing on the critical error page ([#20350](https://github.c
- Added the ability to restore accounts from seed words.


[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v12.3.0...HEAD
[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v12.3.1...HEAD
[12.3.1]: https://github.com/MetaMask/metamask-extension/compare/v12.3.0...v12.3.1
[12.3.0]: https://github.com/MetaMask/metamask-extension/compare/v12.2.4...v12.3.0
[12.2.4]: https://github.com/MetaMask/metamask-extension/compare/v12.2.3...v12.2.4
[12.2.3]: https://github.com/MetaMask/metamask-extension/compare/v12.2.2...v12.2.3
Expand Down
27 changes: 27 additions & 0 deletions app/_locales/en/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions app/scripts/controllers/swaps/swaps.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const MOCK_FETCH_PARAMS: FetchTradesInfoParams = {
fromAddress: '0x7F18BB4Dd92CF2404C54CBa1A9BE4A1153bdb078',
exchangeList: 'zeroExV1',
balanceError: false,
enableGasIncludedQuotes: false,
};

const TEST_AGG_ID_1 = 'TEST_AGG_1';
Expand Down Expand Up @@ -1164,6 +1165,7 @@ describe('SwapsController', function () {
fromAddress: '',
exchangeList: 'zeroExV1',
balanceError: false,
enableGasIncludedQuotes: false,
metaData: {} as FetchTradesInfoParamsMetadata,
};
const swapsFeatureIsLive = false;
Expand Down
1 change: 1 addition & 0 deletions app/scripts/controllers/swaps/swaps.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ export type FetchTradesInfoParams = {
fromAddress: string;
exchangeList: string;
balanceError: boolean;
enableGasIncludedQuotes: boolean;
};

export type FetchTradesInfoParamsMetadata = {
Expand Down
2 changes: 0 additions & 2 deletions lavamoat/browserify/beta/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -2034,12 +2034,10 @@
"URL": true,
"URLSearchParams": true,
"addEventListener": true,
"clearInterval": true,
"console.error": true,
"dispatchEvent": true,
"fetch": true,
"removeEventListener": true,
"setInterval": true,
"setTimeout": true
},
"packages": {
Expand Down
2 changes: 0 additions & 2 deletions lavamoat/browserify/flask/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -2034,12 +2034,10 @@
"URL": true,
"URLSearchParams": true,
"addEventListener": true,
"clearInterval": true,
"console.error": true,
"dispatchEvent": true,
"fetch": true,
"removeEventListener": true,
"setInterval": true,
"setTimeout": true
},
"packages": {
Expand Down
2 changes: 0 additions & 2 deletions lavamoat/browserify/main/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -2034,12 +2034,10 @@
"URL": true,
"URLSearchParams": true,
"addEventListener": true,
"clearInterval": true,
"console.error": true,
"dispatchEvent": true,
"fetch": true,
"removeEventListener": true,
"setInterval": true,
"setTimeout": true
},
"packages": {
Expand Down
2 changes: 0 additions & 2 deletions lavamoat/browserify/mmi/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -2126,12 +2126,10 @@
"URL": true,
"URLSearchParams": true,
"addEventListener": true,
"clearInterval": true,
"console.error": true,
"dispatchEvent": true,
"fetch": true,
"removeEventListener": true,
"setInterval": true,
"setTimeout": true
},
"packages": {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "metamask-crx",
"version": "12.3.0",
"version": "12.3.1",
"private": true,
"repository": {
"type": "git",
Expand Down Expand Up @@ -351,7 +351,7 @@
"@metamask/post-message-stream": "^8.0.0",
"@metamask/ppom-validator": "0.34.0",
"@metamask/preinstalled-example-snap": "^0.1.0",
"@metamask/profile-sync-controller": "^0.9.3",
"@metamask/profile-sync-controller": "^0.9.4",
"@metamask/providers": "^14.0.2",
"@metamask/queued-request-controller": "^5.1.0",
"@metamask/rate-limit-controller": "^6.0.0",
Expand Down
2 changes: 2 additions & 0 deletions shared/lib/swaps-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ export async function fetchTradesInfo(
value,
fromAddress,
exchangeList,
enableGasIncludedQuotes,
},
{ chainId },
) {
Expand All @@ -275,6 +276,7 @@ export async function fetchTradesInfo(
slippage,
timeout: SECOND * 10,
walletAddress: fromAddress,
enableGasIncludedQuotes,
};

if (exchangeList) {
Expand Down
1 change: 1 addition & 0 deletions shared/lib/swaps-utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ describe('Swaps Utils', () => {
sourceDecimals: TOKENS[0].decimals,
sourceTokenInfo: { ...TOKENS[0] },
destinationTokenInfo: { ...TOKENS[1] },
enableGasIncludedQuotes: false,
},
{ chainId: CHAIN_IDS.MAINNET },
);
Expand Down
40 changes: 0 additions & 40 deletions test/data/confirmations/contract-interaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,43 +161,3 @@ export const genUnapprovedContractInteractionConfirmation = ({
userFeeLevel: 'medium',
verifiedOnBlockchain: false,
} as SignatureRequestType);

export const genUnapprovedApproveConfirmation = ({
address = CONTRACT_INTERACTION_SENDER_ADDRESS,
chainId = CHAIN_ID,
}: {
address?: Hex;
chainId?: string;
} = {}) => ({
...genUnapprovedContractInteractionConfirmation({ chainId }),
txParams: {
from: address,
data: '0x095ea7b30000000000000000000000002e0d7e8c45221fca00d74a3609a0f7097035d09b0000000000000000000000000000000000000000000000000000000000000001',
gas: '0x16a92',
to: '0x076146c765189d51be3160a2140cf80bfc73ad68',
value: '0x0',
maxFeePerGas: '0x5b06b0c0d',
maxPriorityFeePerGas: '0x59682f00',
},
type: TransactionType.tokenMethodApprove,
});

export const genUnapprovedSetApprovalForAllConfirmation = ({
address = CONTRACT_INTERACTION_SENDER_ADDRESS,
chainId = CHAIN_ID,
}: {
address?: Hex;
chainId?: string;
} = {}) => ({
...genUnapprovedContractInteractionConfirmation({ chainId }),
txParams: {
from: address,
data: '0x095ea7b30000000000000000000000002e0d7e8c45221fca00d74a3609a0f7097035d09b0000000000000000000000000000000000000000000000000000000000000001',
gas: '0x16a92',
to: '0x076146c765189d51be3160a2140cf80bfc73ad68',
value: '0x0',
maxFeePerGas: '0x5b06b0c0d',
maxPriorityFeePerGas: '0x59682f00',
},
type: TransactionType.tokenMethodSetApprovalForAll,
});
24 changes: 18 additions & 6 deletions test/data/confirmations/helper.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import { ApprovalType } from '@metamask/controller-utils';
import { merge } from 'lodash';

import { CHAIN_IDS } from '../../../shared/constants/network';
import {
Confirmation,
SignatureRequestType,
} from '../../../ui/pages/confirmations/types/confirm';
import mockState from '../mock-state.json';
import { CHAIN_IDS } from '../../../shared/constants/network';
import {
genUnapprovedApproveConfirmation,
genUnapprovedContractInteractionConfirmation,
genUnapprovedSetApprovalForAllConfirmation,
} from './contract-interaction';
import { genUnapprovedContractInteractionConfirmation } from './contract-interaction';
import { unapprovedPersonalSignMsg } from './personal_sign';
import { genUnapprovedSetApprovalForAllConfirmation } from './set-approval-for-all';
import { genUnapprovedApproveConfirmation } from './token-approve';
import { genUnapprovedTokenTransferConfirmation } from './token-transfer';
import { unapprovedTypedSignMsgV4 } from './typed_sign';

type RootState = { metamask: Record<string, unknown> } & Record<
Expand Down Expand Up @@ -183,3 +182,16 @@ export const getMockSetApprovalForAllConfirmState = () => {
genUnapprovedSetApprovalForAllConfirmation({ chainId: '0x5' }),
);
};

export const getMockTokenTransferConfirmState = ({
isWalletInitiatedConfirmation = false,
}: {
isWalletInitiatedConfirmation?: boolean;
}) => {
return getMockConfirmStateForTransaction(
genUnapprovedTokenTransferConfirmation({
chainId: '0x5',
isWalletInitiatedConfirmation,
}),
);
};
27 changes: 27 additions & 0 deletions test/data/confirmations/set-approval-for-all.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { TransactionType } from '@metamask/transaction-controller';
import { Hex } from '@metamask/utils';
import {
CHAIN_ID,
CONTRACT_INTERACTION_SENDER_ADDRESS,
genUnapprovedContractInteractionConfirmation,
} from './contract-interaction';

export const genUnapprovedSetApprovalForAllConfirmation = ({
address = CONTRACT_INTERACTION_SENDER_ADDRESS,
chainId = CHAIN_ID,
}: {
address?: Hex;
chainId?: string;
} = {}) => ({
...genUnapprovedContractInteractionConfirmation({ chainId }),
txParams: {
from: address,
data: '0x095ea7b30000000000000000000000002e0d7e8c45221fca00d74a3609a0f7097035d09b0000000000000000000000000000000000000000000000000000000000000001',
gas: '0x16a92',
to: '0x076146c765189d51be3160a2140cf80bfc73ad68',
value: '0x0',
maxFeePerGas: '0x5b06b0c0d',
maxPriorityFeePerGas: '0x59682f00',
},
type: TransactionType.tokenMethodSetApprovalForAll,
});
27 changes: 27 additions & 0 deletions test/data/confirmations/token-approve.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { TransactionType } from '@metamask/transaction-controller';
import { Hex } from '@metamask/utils';
import {
CHAIN_ID,
CONTRACT_INTERACTION_SENDER_ADDRESS,
genUnapprovedContractInteractionConfirmation,
} from './contract-interaction';

export const genUnapprovedApproveConfirmation = ({
address = CONTRACT_INTERACTION_SENDER_ADDRESS,
chainId = CHAIN_ID,
}: {
address?: Hex;
chainId?: string;
} = {}) => ({
...genUnapprovedContractInteractionConfirmation({ chainId }),
txParams: {
from: address,
data: '0x095ea7b30000000000000000000000002e0d7e8c45221fca00d74a3609a0f7097035d09b0000000000000000000000000000000000000000000000000000000000000001',
gas: '0x16a92',
to: '0x076146c765189d51be3160a2140cf80bfc73ad68',
value: '0x0',
maxFeePerGas: '0x5b06b0c0d',
maxPriorityFeePerGas: '0x59682f00',
},
type: TransactionType.tokenMethodApprove,
});
32 changes: 32 additions & 0 deletions test/data/confirmations/token-transfer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { TransactionType } from '@metamask/transaction-controller';
import { Hex } from '@metamask/utils';
import {
CHAIN_ID,
CONTRACT_INTERACTION_SENDER_ADDRESS,
genUnapprovedContractInteractionConfirmation,
} from './contract-interaction';

export const genUnapprovedTokenTransferConfirmation = ({
address = CONTRACT_INTERACTION_SENDER_ADDRESS,
chainId = CHAIN_ID,
isWalletInitiatedConfirmation = false,
}: {
address?: Hex;
chainId?: string;
isWalletInitiatedConfirmation?: boolean;
} = {}) => ({
...genUnapprovedContractInteractionConfirmation({ chainId }),
txParams: {
from: address,
data: '0x095ea7b30000000000000000000000002e0d7e8c45221fca00d74a3609a0f7097035d09b0000000000000000000000000000000000000000000000000000000000000001',
gas: '0x16a92',
to: '0x076146c765189d51be3160a2140cf80bfc73ad68',
value: '0x0',
maxFeePerGas: '0x5b06b0c0d',
maxPriorityFeePerGas: '0x59682f00',
},
type: TransactionType.tokenMethodTransfer,
origin: isWalletInitiatedConfirmation
? 'metamask'
: 'https://metamask.github.io',
});
Loading

0 comments on commit 15f622a

Please sign in to comment.