diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 80ccc370ffe0..54c1250b648f 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -111,7 +111,9 @@ app/scripts/controllers/swaps @MetaMask/swaps-engineers **/snaps/** @MetaMask/snaps-devs shared/constants/permissions.ts @MetaMask/snaps-devs ui/helpers/utils/permission.js @MetaMask/snaps-devs -ui/hooks/useTransactionInsights.js @MetaMask/snaps-devs + +# Co-owned by Confirmations and Snaps +ui/components/app/metamask-template-renderer @MetaMask/confirmations @MetaMask/snaps-devs # Wallet UX ui/components/multichain @MetaMask/wallet-ux diff --git a/.yarnrc.yml b/.yarnrc.yml index 8eea0010a657..27deee790900 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -126,6 +126,12 @@ npmAuditIgnoreAdvisories: # New package name format for new versions: @ethereumjs/wallet. - 'ethereumjs-wallet (deprecation)' + # The new trezor version breaks the webpack build due to issues with ESM and CommonJS + # Leading to this error on start: `Uncaught ReferenceError: exports is not defined` + # We temporarily ignore the audit failure until we can safely upgrade to the new version without breaking the webpack build + # Check Trezor 9.5.X Changelog for more info: https://github.com/trezor/trezor-suite/blob/develop/packages/connect/CHANGELOG.md + - '@trezor/connect-web (deprecation)' + plugins: - path: .yarn/plugins/@yarnpkg/plugin-allow-scripts.cjs spec: 'https://raw.githubusercontent.com/LavaMoat/LavaMoat/main/packages/yarn-plugin-allow-scripts/bundles/@yarnpkg/plugin-allow-scripts.js' diff --git a/app/_locales/de/messages.json b/app/_locales/de/messages.json index 069f6a40f41d..7ebb41252ca7 100644 --- a/app/_locales/de/messages.json +++ b/app/_locales/de/messages.json @@ -73,9 +73,6 @@ "accountActivityText": { "message": "Wählen Sie die Konten aus, über die Sie benachrichtigt werden möchten:" }, - "accountBalance": { - "message": "Kontostand" - }, "accountDetails": { "message": "Kontodetails" }, @@ -5021,12 +5018,6 @@ "spendingCap": { "message": "Ausgabenobergrenze" }, - "spendingCapTooltipDesc": { - "message": "Dies ist die Menge an Tokens, auf die der Spender in Ihrem Namen zugreifen kann." - }, - "spendingCaps": { - "message": "Ausgabenobergrenzen" - }, "srpInputNumberOfWords": { "message": "Ich habe eine $1-Wort-Phrase.", "description": "This is the text for each option in the dropdown where a user selects how many words their secret recovery phrase has during import. The $1 is the number of words (either 12, 15, 18, 21, or 24)." diff --git a/app/_locales/el/messages.json b/app/_locales/el/messages.json index fc15990f1c05..35bab0c9104f 100644 --- a/app/_locales/el/messages.json +++ b/app/_locales/el/messages.json @@ -73,9 +73,6 @@ "accountActivityText": { "message": "Επιλέξτε τους λογαριασμούς για τους οποίους θέλετε να λαμβάνετε ειδοποιήσεις:" }, - "accountBalance": { - "message": "Υπόλοιπο λογαριασμού" - }, "accountDetails": { "message": "Στοιχεία λογαριασμού" }, @@ -5021,12 +5018,6 @@ "spendingCap": { "message": "Ανώτατο όριο δαπανών" }, - "spendingCapTooltipDesc": { - "message": "Αυτό είναι το ποσό των tokens που θα μπορεί να έχει πρόσβαση ο διαθέτης για λογαριασμό σας." - }, - "spendingCaps": { - "message": "Ανώτατα όριο δαπανών" - }, "srpInputNumberOfWords": { "message": "Έχω μια φράση $1 λέξεων", "description": "This is the text for each option in the dropdown where a user selects how many words their secret recovery phrase has during import. The $1 is the number of words (either 12, 15, 18, 21, or 24)." diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index abc1995052e6..e2b422ed9dbf 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -73,9 +73,6 @@ "accountActivityText": { "message": "Select the accounts you want to be notified about:" }, - "accountBalance": { - "message": "Account balance" - }, "accountDetails": { "message": "Account details" }, @@ -2268,7 +2265,6 @@ "honeypotTitle": { "message": "Honey Pot" }, - "howNetworkFeesWorkExplanation": { "message": "Estimated fee required to process the transaction. The max fee is $1." }, @@ -2438,7 +2434,6 @@ "insufficientLockedLiquidityTitle": { "message": "Insufficient Locked Liquidity" }, - "insufficientTokens": { "message": "Insufficient tokens." }, @@ -3700,6 +3695,10 @@ "pending": { "message": "Pending" }, + "pendingConfirmationAddNetworkAlertMessage": { + "message": "Updating network will cancel $1 pending transactions from this site.", + "description": "Number of transactions." + }, "pendingTransactionAlertMessage": { "message": "This transaction won't go through until a previous transaction is complete. $1", "description": "$1 represents the words 'how to cancel or speed up a transaction' in a hyperlink" @@ -4436,6 +4435,9 @@ "reviewAlerts": { "message": "Review alerts" }, + "reviewPendingTransactions": { + "message": "Review pending transactions" + }, "reviewPermissions": { "message": "Review permissions" }, @@ -5195,9 +5197,6 @@ "spendingCap": { "message": "Spending cap" }, - "spendingCapTooltipDesc": { - "message": "This is the amount of tokens the spender will be able to access on your behalf." - }, "spendingCaps": { "message": "Spending caps" }, @@ -6200,7 +6199,6 @@ "unstableTokenPriceTitle": { "message": "Unstable Token Price" }, - "upArrow": { "message": "up arrow" }, diff --git a/app/_locales/en_GB/messages.json b/app/_locales/en_GB/messages.json index ec6cbafb1eda..e2b422ed9dbf 100644 --- a/app/_locales/en_GB/messages.json +++ b/app/_locales/en_GB/messages.json @@ -73,9 +73,6 @@ "accountActivityText": { "message": "Select the accounts you want to be notified about:" }, - "accountBalance": { - "message": "Account balance" - }, "accountDetails": { "message": "Account details" }, @@ -3698,6 +3695,10 @@ "pending": { "message": "Pending" }, + "pendingConfirmationAddNetworkAlertMessage": { + "message": "Updating network will cancel $1 pending transactions from this site.", + "description": "Number of transactions." + }, "pendingTransactionAlertMessage": { "message": "This transaction won't go through until a previous transaction is complete. $1", "description": "$1 represents the words 'how to cancel or speed up a transaction' in a hyperlink" @@ -4434,6 +4435,9 @@ "reviewAlerts": { "message": "Review alerts" }, + "reviewPendingTransactions": { + "message": "Review pending transactions" + }, "reviewPermissions": { "message": "Review permissions" }, @@ -5193,9 +5197,6 @@ "spendingCap": { "message": "Spending cap" }, - "spendingCapTooltipDesc": { - "message": "This is the amount of tokens the spender will be able to access on your behalf." - }, "spendingCaps": { "message": "Spending caps" }, diff --git a/app/_locales/es/messages.json b/app/_locales/es/messages.json index 70118ab22c8e..996c25ec205f 100644 --- a/app/_locales/es/messages.json +++ b/app/_locales/es/messages.json @@ -73,9 +73,6 @@ "accountActivityText": { "message": "Seleccione las cuentas sobre las que desea recibir notificaciones:" }, - "accountBalance": { - "message": "Saldo de la cuenta" - }, "accountDetails": { "message": "Detalles de la cuenta" }, @@ -5021,12 +5018,6 @@ "spendingCap": { "message": "Límite de gasto" }, - "spendingCapTooltipDesc": { - "message": "Esta es la cantidad de tokens a la que el gastador podrá acceder en su nombre." - }, - "spendingCaps": { - "message": "Límites de gasto" - }, "srpInputNumberOfWords": { "message": "Tengo una frase de $1 palabras", "description": "This is the text for each option in the dropdown where a user selects how many words their secret recovery phrase has during import. The $1 is the number of words (either 12, 15, 18, 21, or 24)." diff --git a/app/_locales/fr/messages.json b/app/_locales/fr/messages.json index 4a4a3ea8f8da..26c5e5122fea 100644 --- a/app/_locales/fr/messages.json +++ b/app/_locales/fr/messages.json @@ -73,9 +73,6 @@ "accountActivityText": { "message": "Sélectionnez les comptes pour lesquels vous souhaitez recevoir des notifications :" }, - "accountBalance": { - "message": "Solde du compte" - }, "accountDetails": { "message": "Détails du compte" }, @@ -5021,12 +5018,6 @@ "spendingCap": { "message": "Plafond de dépenses" }, - "spendingCapTooltipDesc": { - "message": "Il s’agit du nombre de jetons auquel le dépenseur pourra accéder en votre nom." - }, - "spendingCaps": { - "message": "Plafonds de dépenses" - }, "srpInputNumberOfWords": { "message": "J’ai une phrase de $1 mots", "description": "This is the text for each option in the dropdown where a user selects how many words their secret recovery phrase has during import. The $1 is the number of words (either 12, 15, 18, 21, or 24)." diff --git a/app/_locales/hi/messages.json b/app/_locales/hi/messages.json index 44fbc362f141..28ed69030119 100644 --- a/app/_locales/hi/messages.json +++ b/app/_locales/hi/messages.json @@ -73,9 +73,6 @@ "accountActivityText": { "message": "वे अकाउंट चुनें जिनके बारे में आप सूचित होना चाहते हैं:" }, - "accountBalance": { - "message": "अकाउंट बैलेंस" - }, "accountDetails": { "message": "अकाउंट की जानकारी" }, @@ -5021,12 +5018,6 @@ "spendingCap": { "message": "खर्च करने की लिमिट" }, - "spendingCapTooltipDesc": { - "message": "यह टोकन की वह राशि है जिसे खर्च करने वाला आपकी ओर से प्राप्त कर सकेगा।" - }, - "spendingCaps": { - "message": "खर्च करने की लिमिट" - }, "srpInputNumberOfWords": { "message": "मेरे पास एक $1-शब्द का फ़्रेज़ है", "description": "This is the text for each option in the dropdown where a user selects how many words their secret recovery phrase has during import. The $1 is the number of words (either 12, 15, 18, 21, or 24)." diff --git a/app/_locales/id/messages.json b/app/_locales/id/messages.json index f72ecbd75842..28317b70ef29 100644 --- a/app/_locales/id/messages.json +++ b/app/_locales/id/messages.json @@ -73,9 +73,6 @@ "accountActivityText": { "message": "Pilih akun yang ingin mendapatkan notifikasi:" }, - "accountBalance": { - "message": "Saldo akun" - }, "accountDetails": { "message": "Detail akun" }, @@ -5021,12 +5018,6 @@ "spendingCap": { "message": "Batas penggunaan" }, - "spendingCapTooltipDesc": { - "message": "Ini adalah jumlah token yang dapat diakses oleh pembeli atas nama Anda." - }, - "spendingCaps": { - "message": "Batas penggunaan" - }, "srpInputNumberOfWords": { "message": "Frasa milik saya memiliki $1 kata", "description": "This is the text for each option in the dropdown where a user selects how many words their secret recovery phrase has during import. The $1 is the number of words (either 12, 15, 18, 21, or 24)." diff --git a/app/_locales/ja/messages.json b/app/_locales/ja/messages.json index f55f28b34ea4..a2e47f6694e9 100644 --- a/app/_locales/ja/messages.json +++ b/app/_locales/ja/messages.json @@ -73,9 +73,6 @@ "accountActivityText": { "message": "通知を受けたいアカウントを選択してください:" }, - "accountBalance": { - "message": "アカウント残高" - }, "accountDetails": { "message": "アカウントの詳細" }, @@ -5021,12 +5018,6 @@ "spendingCap": { "message": "使用上限" }, - "spendingCapTooltipDesc": { - "message": "これは、使用者が代理でアクセスできるようになるトークンの金額です。" - }, - "spendingCaps": { - "message": "使用上限" - }, "srpInputNumberOfWords": { "message": "$1語のフレーズがあります", "description": "This is the text for each option in the dropdown where a user selects how many words their secret recovery phrase has during import. The $1 is the number of words (either 12, 15, 18, 21, or 24)." diff --git a/app/_locales/ko/messages.json b/app/_locales/ko/messages.json index e97a9a6c05ab..e0ef09724622 100644 --- a/app/_locales/ko/messages.json +++ b/app/_locales/ko/messages.json @@ -73,9 +73,6 @@ "accountActivityText": { "message": "알림을 수신할 계정을 선택하세요." }, - "accountBalance": { - "message": "계정 잔액" - }, "accountDetails": { "message": "계정 세부 정보" }, @@ -5021,12 +5018,6 @@ "spendingCap": { "message": "지출 한도" }, - "spendingCapTooltipDesc": { - "message": "지출자가 회원님을 대신하여 접근할 수 있는 토큰의 양입니다." - }, - "spendingCaps": { - "message": "지출 한도" - }, "srpInputNumberOfWords": { "message": "제 구문은 $1개의 단어로 이루어져 있습니다", "description": "This is the text for each option in the dropdown where a user selects how many words their secret recovery phrase has during import. The $1 is the number of words (either 12, 15, 18, 21, or 24)." diff --git a/app/_locales/pt/messages.json b/app/_locales/pt/messages.json index 2e973683db37..a872dfc01263 100644 --- a/app/_locales/pt/messages.json +++ b/app/_locales/pt/messages.json @@ -73,9 +73,6 @@ "accountActivityText": { "message": "Selecione as contas das quais deseja receber notificações:" }, - "accountBalance": { - "message": "Saldo da conta" - }, "accountDetails": { "message": "Detalhes da conta" }, @@ -5021,12 +5018,6 @@ "spendingCap": { "message": "Limite de gastos" }, - "spendingCapTooltipDesc": { - "message": "Esta é a quantidade de tokens que o consumidor poderá acessar em seu nome." - }, - "spendingCaps": { - "message": "Limites de gastos" - }, "srpInputNumberOfWords": { "message": "Eu tenho uma frase com $1 palavras", "description": "This is the text for each option in the dropdown where a user selects how many words their secret recovery phrase has during import. The $1 is the number of words (either 12, 15, 18, 21, or 24)." diff --git a/app/_locales/ru/messages.json b/app/_locales/ru/messages.json index 50067dde0abb..3d1ef282efb1 100644 --- a/app/_locales/ru/messages.json +++ b/app/_locales/ru/messages.json @@ -73,9 +73,6 @@ "accountActivityText": { "message": "Выберите счета, о которых хотите получать уведомления:" }, - "accountBalance": { - "message": "Баланс счета" - }, "accountDetails": { "message": "Реквизиты счета" }, @@ -5021,12 +5018,6 @@ "spendingCap": { "message": "Лимит расходов" }, - "spendingCapTooltipDesc": { - "message": "Это количество токенов, к которым покупатель сможет получить доступ от вашего имени." - }, - "spendingCaps": { - "message": "Лимиты расходов" - }, "srpInputNumberOfWords": { "message": "У меня есть фраза из $1 слов(-а)", "description": "This is the text for each option in the dropdown where a user selects how many words their secret recovery phrase has during import. The $1 is the number of words (either 12, 15, 18, 21, or 24)." diff --git a/app/_locales/tl/messages.json b/app/_locales/tl/messages.json index 5a1963ea0354..35b160f7e6bf 100644 --- a/app/_locales/tl/messages.json +++ b/app/_locales/tl/messages.json @@ -73,9 +73,6 @@ "accountActivityText": { "message": "Piliin ang mga account na nais mong makakuha ng abiso:" }, - "accountBalance": { - "message": "Balanse ng account" - }, "accountDetails": { "message": "Mga detalye ng account" }, @@ -5021,12 +5018,6 @@ "spendingCap": { "message": "Limitasyon sa paggastos" }, - "spendingCapTooltipDesc": { - "message": "Ito ang halaga ng mga token na maa-access ng gumagastos sa ngalan mo." - }, - "spendingCaps": { - "message": "Mga limitasyon sa paggastos" - }, "srpInputNumberOfWords": { "message": "Mayroon akong word phrase ng $1", "description": "This is the text for each option in the dropdown where a user selects how many words their secret recovery phrase has during import. The $1 is the number of words (either 12, 15, 18, 21, or 24)." diff --git a/app/_locales/tr/messages.json b/app/_locales/tr/messages.json index f46db8f0fb69..e92d2c79dfb5 100644 --- a/app/_locales/tr/messages.json +++ b/app/_locales/tr/messages.json @@ -73,9 +73,6 @@ "accountActivityText": { "message": "Hakkında bildirim almak istediğiniz hesapları seçin:" }, - "accountBalance": { - "message": "Hesap bakiyesi" - }, "accountDetails": { "message": "Hesap bilgileri" }, @@ -5021,12 +5018,6 @@ "spendingCap": { "message": "Harcama üst limiti" }, - "spendingCapTooltipDesc": { - "message": "Bu, harcama yapan tarafın sizin adınıza erişim sağlayabileceği token miktarıdır." - }, - "spendingCaps": { - "message": "Harcama üst limitleri" - }, "srpInputNumberOfWords": { "message": "$1 sözcükten oluşan bir ifadem var", "description": "This is the text for each option in the dropdown where a user selects how many words their secret recovery phrase has during import. The $1 is the number of words (either 12, 15, 18, 21, or 24)." diff --git a/app/_locales/vi/messages.json b/app/_locales/vi/messages.json index e44cfa4ab78c..91a7e829ab41 100644 --- a/app/_locales/vi/messages.json +++ b/app/_locales/vi/messages.json @@ -73,9 +73,6 @@ "accountActivityText": { "message": "Chọn tài khoản mà bạn muốn nhận thông báo:" }, - "accountBalance": { - "message": "Số dư tài khoản" - }, "accountDetails": { "message": "Chi tiết tài khoản" }, @@ -5021,12 +5018,6 @@ "spendingCap": { "message": "Hạn mức chi tiêu" }, - "spendingCapTooltipDesc": { - "message": "Đây là số lượng token mà người chi tiêu có thể truy cập thay mặt cho bạn." - }, - "spendingCaps": { - "message": "Hạn mức chi tiêu" - }, "srpInputNumberOfWords": { "message": "Tôi có một cụm từ gồm $1 từ", "description": "This is the text for each option in the dropdown where a user selects how many words their secret recovery phrase has during import. The $1 is the number of words (either 12, 15, 18, 21, or 24)." diff --git a/app/_locales/zh_CN/messages.json b/app/_locales/zh_CN/messages.json index d2e54db91f8c..11ffc9f34051 100644 --- a/app/_locales/zh_CN/messages.json +++ b/app/_locales/zh_CN/messages.json @@ -73,9 +73,6 @@ "accountActivityText": { "message": "选择您想要接收通知的账户:" }, - "accountBalance": { - "message": "账户余额" - }, "accountDetails": { "message": "账户详情" }, @@ -5021,12 +5018,6 @@ "spendingCap": { "message": "支出上限" }, - "spendingCapTooltipDesc": { - "message": "他人可代表您访问该代币金额并进行消费。" - }, - "spendingCaps": { - "message": "支出上限" - }, "srpInputNumberOfWords": { "message": "我有一个包含$1个单词的私钥助记词", "description": "This is the text for each option in the dropdown where a user selects how many words their secret recovery phrase has during import. The $1 is the number of words (either 12, 15, 18, 21, or 24)." diff --git a/app/scripts/controller-init/confirmations/transaction-controller-init.test.ts b/app/scripts/controller-init/confirmations/transaction-controller-init.test.ts index ff46b277fac1..155f41e29ba9 100644 --- a/app/scripts/controller-init/confirmations/transaction-controller-init.test.ts +++ b/app/scripts/controller-init/confirmations/transaction-controller-init.test.ts @@ -39,7 +39,6 @@ function buildControllerMock( function buildInitRequestMock(): jest.Mocked< ControllerInitRequest< - // @ts-expect-error TODO: Resolve mismatch between base-controller versions. TransactionControllerMessenger, TransactionControllerInitMessenger > diff --git a/app/scripts/controller-init/confirmations/transaction-controller-init.ts b/app/scripts/controller-init/confirmations/transaction-controller-init.ts index ea252f2f6439..57103bc365bc 100644 --- a/app/scripts/controller-init/confirmations/transaction-controller-init.ts +++ b/app/scripts/controller-init/confirmations/transaction-controller-init.ts @@ -48,7 +48,6 @@ import { TransactionMetricsRequest } from '../../../../shared/types/metametrics' export const TransactionControllerInit: ControllerInitFunction< TransactionController, - // @ts-expect-error TODO: Resolve mismatch between base-controller versions. TransactionControllerMessenger, TransactionControllerInitMessenger > = (request) => { @@ -189,7 +188,6 @@ function getApi( function getControllers( request: ControllerInitRequest< - // @ts-expect-error TODO: Resolve mismatch between base-controller versions. TransactionControllerMessenger, TransactionControllerInitMessenger >, diff --git a/app/scripts/controller-init/controller-list.ts b/app/scripts/controller-init/controller-list.ts index 07983f876376..bd82ebd27b10 100644 --- a/app/scripts/controller-init/controller-list.ts +++ b/app/scripts/controller-init/controller-list.ts @@ -30,6 +30,8 @@ import { RateLimitController, RateLimitedApiMap, } from '@metamask/rate-limit-controller'; +import { Controller as AuthenticationController } from '@metamask/profile-sync-controller/auth'; +import { Controller as UserStorageController } from '@metamask/profile-sync-controller/user-storage'; import OnboardingController from '../controllers/onboarding'; import { PreferencesController } from '../controllers/preferences-controller'; import SwapsController from '../controllers/swaps'; @@ -38,6 +40,7 @@ import SwapsController from '../controllers/swaps'; * Union of all controllers supporting or required by modular initialization. */ export type Controller = + | AuthenticationController | CronjobController | ExecutionService | GasFeeController @@ -65,13 +68,15 @@ export type Controller = | (TransactionUpdateController & { name: 'TransactionUpdateController'; state: Record; - }); + }) + | UserStorageController; /** * Flat state object for all controllers supporting or required by modular initialization. * e.g. `{ transactions: [] }`. */ export type ControllerFlatState = AccountsController['state'] & + AuthenticationController['state'] & CronjobController['state'] & GasFeeController['state'] & JsonSnapsRegistry['state'] & @@ -94,4 +99,5 @@ export type ControllerFlatState = AccountsController['state'] & SnapInsightsController['state'] & SnapInterfaceController['state'] & TransactionController['state'] & - SwapsController['state']; + SwapsController['state'] & + UserStorageController['state']; diff --git a/app/scripts/controller-init/identity/authentication-controller-init.test.ts b/app/scripts/controller-init/identity/authentication-controller-init.test.ts new file mode 100644 index 000000000000..a94f19e828d7 --- /dev/null +++ b/app/scripts/controller-init/identity/authentication-controller-init.test.ts @@ -0,0 +1,56 @@ +import { Controller as AuthenticationController } from '@metamask/profile-sync-controller/auth'; +import { Messenger } from '@metamask/base-controller'; +import { buildControllerInitRequestMock } from '../test/utils'; +import { ControllerInitRequest } from '../types'; +import { + getAuthenticationControllerMessenger, + AuthenticationControllerMessenger, +} from '../messengers/identity'; +import { AuthenticationControllerInit } from './authentication-controller-init'; + +jest.mock('@metamask/profile-sync-controller/auth'); + +function buildInitRequestMock(): jest.Mocked< + ControllerInitRequest +> { + const baseControllerMessenger = new Messenger(); + + return { + ...buildControllerInitRequestMock(), + controllerMessenger: getAuthenticationControllerMessenger( + baseControllerMessenger, + ), + initMessenger: undefined, + }; +} + +describe('AuthenticationControllerInit', () => { + const AuthenticationControllerClassMock = jest.mocked( + AuthenticationController, + ); + + beforeEach(() => { + jest.resetAllMocks(); + }); + + it('returns controller instance', () => { + const requestMock = buildInitRequestMock(); + expect(AuthenticationControllerInit(requestMock).controller).toBeInstanceOf( + AuthenticationController, + ); + }); + + it('initializes with correct messenger and state', () => { + const requestMock = buildInitRequestMock(); + AuthenticationControllerInit(requestMock); + + expect(AuthenticationControllerClassMock).toHaveBeenCalledWith({ + messenger: requestMock.controllerMessenger, + state: requestMock.persistedState.AuthenticationController, + metametrics: { + getMetaMetricsId: requestMock.getMetaMetricsId, + agent: 'extension', + }, + }); + }); +}); diff --git a/app/scripts/controller-init/identity/authentication-controller-init.ts b/app/scripts/controller-init/identity/authentication-controller-init.ts new file mode 100644 index 000000000000..d09edd8dbb0c --- /dev/null +++ b/app/scripts/controller-init/identity/authentication-controller-init.ts @@ -0,0 +1,34 @@ +import { + AuthenticationControllerState, + Controller as AuthenticationController, +} from '@metamask/profile-sync-controller/auth'; +import { ControllerInitFunction } from '../types'; +import { AuthenticationControllerMessenger } from '../messengers/identity'; + +/** + * Initialize the Authentication controller. + * + * @param request - The request object. + * @param request.controllerMessenger - The messenger to use for the controller. + * @param request.persistedState - The persisted state of the extension. + * @param request.getMetaMetricsId + * @returns The initialized controller. + */ +export const AuthenticationControllerInit: ControllerInitFunction< + AuthenticationController, + AuthenticationControllerMessenger +> = ({ controllerMessenger, persistedState, getMetaMetricsId }) => { + const controller = new AuthenticationController({ + messenger: controllerMessenger, + state: + persistedState.AuthenticationController as AuthenticationControllerState, + metametrics: { + getMetaMetricsId, + agent: 'extension', + }, + }); + + return { + controller, + }; +}; diff --git a/app/scripts/controller-init/identity/user-storage-controller-init.test.ts b/app/scripts/controller-init/identity/user-storage-controller-init.test.ts new file mode 100644 index 000000000000..2abf4504502e --- /dev/null +++ b/app/scripts/controller-init/identity/user-storage-controller-init.test.ts @@ -0,0 +1,67 @@ +import { Controller as UserStorageController } from '@metamask/profile-sync-controller/user-storage'; +import { Messenger } from '@metamask/base-controller'; +import { buildControllerInitRequestMock } from '../test/utils'; +import { ControllerInitRequest } from '../types'; +import { + getUserStorageControllerMessenger, + UserStorageControllerMessenger, +} from '../messengers/identity'; +import { UserStorageControllerInit } from './user-storage-controller-init'; + +jest.mock('@metamask/profile-sync-controller/user-storage'); +jest.mock('../../../../shared/modules/mv3.utils', () => ({ + isManifestV3: true, +})); +jest.mock('../../../../shared/modules/environment', () => ({ + isProduction: () => false, +})); + +function buildInitRequestMock(): jest.Mocked< + ControllerInitRequest +> { + const baseControllerMessenger = new Messenger(); + + return { + ...buildControllerInitRequestMock(), + controllerMessenger: getUserStorageControllerMessenger( + baseControllerMessenger, + ), + initMessenger: undefined, + }; +} + +describe('UserStorageControllerInit', () => { + const UserStorageControllerClassMock = jest.mocked(UserStorageController); + + beforeEach(() => { + jest.resetAllMocks(); + }); + + it('returns controller instance', () => { + const requestMock = buildInitRequestMock(); + expect(UserStorageControllerInit(requestMock).controller).toBeInstanceOf( + UserStorageController, + ); + }); + + it('initializes with correct messenger and state', () => { + const requestMock = buildInitRequestMock(); + UserStorageControllerInit(requestMock); + + expect(UserStorageControllerClassMock).toHaveBeenCalledWith({ + messenger: requestMock.controllerMessenger, + state: requestMock.persistedState.UserStorageController, + config: { + accountSyncing: { + maxNumberOfAccountsToAdd: 100, + onAccountAdded: expect.any(Function), + onAccountNameUpdated: expect.any(Function), + onAccountSyncErroneousSituation: expect.any(Function), + }, + }, + env: { + isAccountSyncingEnabled: true, + }, + }); + }); +}); diff --git a/app/scripts/controller-init/identity/user-storage-controller-init.ts b/app/scripts/controller-init/identity/user-storage-controller-init.ts new file mode 100644 index 000000000000..cea7ce0653de --- /dev/null +++ b/app/scripts/controller-init/identity/user-storage-controller-init.ts @@ -0,0 +1,80 @@ +import { + UserStorageControllerMessenger, + UserStorageControllerState, + Controller as UserStorageController, +} from '@metamask/profile-sync-controller/user-storage'; +import { captureException } from '@sentry/browser'; +import { ControllerInitFunction } from '../types'; +import { isProduction } from '../../../../shared/modules/environment'; +import { + MetaMetricsEventCategory, + MetaMetricsEventName, +} from '../../../../shared/constants/metametrics'; +import { isManifestV3 } from '../../../../shared/modules/mv3.utils'; + +/** + * Initialize the UserStorage controller. + * + * @param request - The request object. + * @param request.controllerMessenger - The messenger to use for the controller. + * @param request.persistedState - The persisted state of the extension. + * @returns The initialized controller. + */ +export const UserStorageControllerInit: ControllerInitFunction< + UserStorageController, + UserStorageControllerMessenger +> = (request) => { + const { controllerMessenger, persistedState, trackEvent } = request; + const controller = new UserStorageController({ + messenger: controllerMessenger, + state: persistedState.UserStorageController as UserStorageControllerState, + config: { + accountSyncing: { + maxNumberOfAccountsToAdd: isProduction() ? undefined : 100, + onAccountAdded: (profileId) => { + trackEvent({ + category: MetaMetricsEventCategory.ProfileSyncing, + event: MetaMetricsEventName.AccountsSyncAdded, + properties: { + profile_id: profileId, + }, + }); + }, + onAccountNameUpdated: (profileId) => { + trackEvent({ + category: MetaMetricsEventCategory.ProfileSyncing, + event: MetaMetricsEventName.AccountsSyncNameUpdated, + properties: { + profile_id: profileId, + }, + }); + }, + onAccountSyncErroneousSituation: ( + profileId, + situationMessage, + sentryContext, + ) => { + captureException( + new Error(`Account sync - ${situationMessage}`), + sentryContext, + ); + trackEvent({ + category: MetaMetricsEventCategory.ProfileSyncing, + event: MetaMetricsEventName.AccountsSyncErroneousSituation, + properties: { + profile_id: profileId, + situation_message: situationMessage, + }, + }); + }, + }, + }, + env: { + isAccountSyncingEnabled: isManifestV3, + }, + }); + + return { + controller, + }; +}; diff --git a/app/scripts/controller-init/messengers/identity/authentication-controller-messenger.test.ts b/app/scripts/controller-init/messengers/identity/authentication-controller-messenger.test.ts new file mode 100644 index 000000000000..0ae9857d39f0 --- /dev/null +++ b/app/scripts/controller-init/messengers/identity/authentication-controller-messenger.test.ts @@ -0,0 +1,14 @@ +import { Messenger, RestrictedMessenger } from '@metamask/base-controller'; +import { getAuthenticationControllerMessenger } from './authentication-controller-messenger'; + +describe('getAuthenticationControllerMessenger', () => { + it('returns a restricted messenger', () => { + const messenger = new Messenger(); + const authenticationControllerMessenger = + getAuthenticationControllerMessenger(messenger); + + expect(authenticationControllerMessenger).toBeInstanceOf( + RestrictedMessenger, + ); + }); +}); diff --git a/app/scripts/controller-init/messengers/identity/authentication-controller-messenger.ts b/app/scripts/controller-init/messengers/identity/authentication-controller-messenger.ts new file mode 100644 index 000000000000..55d749070ad4 --- /dev/null +++ b/app/scripts/controller-init/messengers/identity/authentication-controller-messenger.ts @@ -0,0 +1,37 @@ +import { Messenger } from '@metamask/base-controller'; +import { + KeyringControllerGetStateAction, + KeyringControllerLockEvent, + KeyringControllerUnlockEvent, +} from '@metamask/keyring-controller'; +import { HandleSnapRequest } from '@metamask/snaps-controllers'; + +type MessengerActions = KeyringControllerGetStateAction | HandleSnapRequest; + +type MessengerEvents = + | KeyringControllerLockEvent + | KeyringControllerUnlockEvent; + +export type AuthenticationControllerMessenger = ReturnType< + typeof getAuthenticationControllerMessenger +>; + +/** + * Get a restricted messenger for the Authentication controller. This is scoped to the + * actions and events that the Authentication controller is allowed to handle. + * + * @param messenger - The messenger to restrict. + * @returns The restricted messenger. + */ +export function getAuthenticationControllerMessenger( + messenger: Messenger, +) { + return messenger.getRestricted({ + name: 'AuthenticationController', + allowedActions: [ + 'KeyringController:getState', + 'SnapController:handleRequest', + ], + allowedEvents: ['KeyringController:lock', 'KeyringController:unlock'], + }); +} diff --git a/app/scripts/controller-init/messengers/identity/index.ts b/app/scripts/controller-init/messengers/identity/index.ts new file mode 100644 index 000000000000..444363b3bb3e --- /dev/null +++ b/app/scripts/controller-init/messengers/identity/index.ts @@ -0,0 +1,5 @@ +export { getAuthenticationControllerMessenger } from './authentication-controller-messenger'; +export type { AuthenticationControllerMessenger } from './authentication-controller-messenger'; + +export { getUserStorageControllerMessenger } from './user-storage-controller-messenger'; +export type { UserStorageControllerMessenger } from './user-storage-controller-messenger'; diff --git a/app/scripts/controller-init/messengers/identity/user-storage-controller-messenger.test.ts b/app/scripts/controller-init/messengers/identity/user-storage-controller-messenger.test.ts new file mode 100644 index 000000000000..e8e1f3e1ffd0 --- /dev/null +++ b/app/scripts/controller-init/messengers/identity/user-storage-controller-messenger.test.ts @@ -0,0 +1,12 @@ +import { Messenger, RestrictedMessenger } from '@metamask/base-controller'; +import { getUserStorageControllerMessenger } from './user-storage-controller-messenger'; + +describe('getUserStorageControllerMessenger', () => { + it('returns a restricted messenger', () => { + const messenger = new Messenger(); + const userStorageControllerMessenger = + getUserStorageControllerMessenger(messenger); + + expect(userStorageControllerMessenger).toBeInstanceOf(RestrictedMessenger); + }); +}); diff --git a/app/scripts/controller-init/messengers/identity/user-storage-controller-messenger.ts b/app/scripts/controller-init/messengers/identity/user-storage-controller-messenger.ts new file mode 100644 index 000000000000..6eb82b061779 --- /dev/null +++ b/app/scripts/controller-init/messengers/identity/user-storage-controller-messenger.ts @@ -0,0 +1,107 @@ +import type { UserStorageControllerStateChangeEvent } from '@metamask/profile-sync-controller/user-storage'; +import { Messenger } from '@metamask/base-controller'; +import { + KeyringControllerGetStateAction, + KeyringControllerLockEvent, + KeyringControllerUnlockEvent, + KeyringControllerWithKeyringAction, +} from '@metamask/keyring-controller'; +import { HandleSnapRequest } from '@metamask/snaps-controllers'; +import { + AuthenticationControllerGetBearerToken, + AuthenticationControllerGetSessionProfile, + AuthenticationControllerIsSignedIn, + AuthenticationControllerPerformSignIn, +} from '@metamask/profile-sync-controller/auth'; +import { + AccountsControllerAccountAddedEvent, + AccountsControllerAccountRenamedEvent, + AccountsControllerListAccountsAction, + AccountsControllerUpdateAccountMetadataAction, +} from '@metamask/accounts-controller'; +import { + NetworkControllerAddNetworkAction, + NetworkControllerGetStateAction, + NetworkControllerNetworkRemovedEvent, + NetworkControllerRemoveNetworkAction, + NetworkControllerUpdateNetworkAction, +} from '@metamask/network-controller'; + +type MessengerActions = + // Keyring Requests + | KeyringControllerGetStateAction + // Snap Requests + | HandleSnapRequest + // Auth Requests + | AuthenticationControllerGetBearerToken + | AuthenticationControllerGetSessionProfile + | AuthenticationControllerPerformSignIn + | AuthenticationControllerIsSignedIn + // Account Syncing + | AccountsControllerListAccountsAction + | AccountsControllerUpdateAccountMetadataAction + | KeyringControllerWithKeyringAction + // Network Syncing + | NetworkControllerGetStateAction + | NetworkControllerAddNetworkAction + | NetworkControllerRemoveNetworkAction + | NetworkControllerUpdateNetworkAction; + +type MessengerEvents = + | UserStorageControllerStateChangeEvent + | KeyringControllerLockEvent + | KeyringControllerUnlockEvent + // Account Syncing Events + | AccountsControllerAccountAddedEvent + | AccountsControllerAccountRenamedEvent + // Network Syncing Events + | NetworkControllerNetworkRemovedEvent; + +export type UserStorageControllerMessenger = ReturnType< + typeof getUserStorageControllerMessenger +>; + +/** + * Get a restricted messenger for the User Storage controller. This is scoped to the + * actions and events that the User Storage controller is allowed to handle. + * + * @param messenger - The messenger to restrict. + * @returns The restricted messenger. + */ +export function getUserStorageControllerMessenger( + messenger: Messenger, +) { + return messenger.getRestricted({ + name: 'UserStorageController', + allowedActions: [ + // Keyring Controller Requests + 'KeyringController:getState', + 'KeyringController:withKeyring', + // Snap Controller Requests + 'SnapController:handleRequest', + // Auth Controller Requests + 'AuthenticationController:getBearerToken', + 'AuthenticationController:getSessionProfile', + 'AuthenticationController:isSignedIn', + 'AuthenticationController:performSignIn', + // Accounts Controller Requests + 'AccountsController:listAccounts', + 'AccountsController:updateAccountMetadata', + // Network Controller Requests + 'NetworkController:getState', + 'NetworkController:addNetwork', + 'NetworkController:removeNetwork', + 'NetworkController:updateNetwork', + ], + allowedEvents: [ + // Keyring Controller Events + 'KeyringController:lock', + 'KeyringController:unlock', + // Accounts Controller Events + 'AccountsController:accountAdded', + 'AccountsController:accountRenamed', + // Network Controller Events + 'NetworkController:networkRemoved', + ], + }); +} diff --git a/app/scripts/controller-init/messengers/index.ts b/app/scripts/controller-init/messengers/index.ts index 92eba17c9066..41e810cc4725 100644 --- a/app/scripts/controller-init/messengers/index.ts +++ b/app/scripts/controller-init/messengers/index.ts @@ -25,8 +25,16 @@ import { getMultichainNetworkControllerMessenger, getMultichainAssetsRatesControllerMessenger, } from './multichain'; +import { + getAuthenticationControllerMessenger, + getUserStorageControllerMessenger, +} from './identity'; export const CONTROLLER_MESSENGERS = { + AuthenticationController: { + getMessenger: getAuthenticationControllerMessenger, + getInitMessenger: noop, + }, CronjobController: { getMessenger: getCronjobControllerMessenger, getInitMessenger: noop, @@ -82,4 +90,8 @@ export const CONTROLLER_MESSENGERS = { getMessenger: getTransactionControllerMessenger, getInitMessenger: getTransactionControllerInitMessenger, }, + UserStorageController: { + getMessenger: getUserStorageControllerMessenger, + getInitMessenger: noop, + }, } as const; diff --git a/app/scripts/controller-init/messengers/transaction-controller-messenger.ts b/app/scripts/controller-init/messengers/transaction-controller-messenger.ts index ad6eecac45bb..e9cef872c80d 100644 --- a/app/scripts/controller-init/messengers/transaction-controller-messenger.ts +++ b/app/scripts/controller-init/messengers/transaction-controller-messenger.ts @@ -56,7 +56,6 @@ export type TransactionControllerInitMessenger = ReturnType< export function getTransactionControllerMessenger( messenger: Messenger, ): TransactionControllerMessenger { - // @ts-expect-error TODO: Resolve mismatch between base-controller versions. return messenger.getRestricted({ name: 'TransactionController', allowedActions: [ diff --git a/app/scripts/controller-init/test/utils.ts b/app/scripts/controller-init/test/utils.ts index e050a99579c7..93b105d3cc0d 100644 --- a/app/scripts/controller-init/test/utils.ts +++ b/app/scripts/controller-init/test/utils.ts @@ -26,5 +26,7 @@ export function buildControllerInitRequestMock(): jest.Mocked< removeAllConnections: jest.fn(), setupUntrustedCommunicationEip1193: jest.fn(), showNotification: jest.fn(), + trackEvent: jest.fn(), + getMetaMetricsId: jest.fn(), }; } diff --git a/app/scripts/controller-init/types.ts b/app/scripts/controller-init/types.ts index 9af50172feea..67f35d3da8e6 100644 --- a/app/scripts/controller-init/types.ts +++ b/app/scripts/controller-init/types.ts @@ -10,6 +10,10 @@ import { Duplex } from 'readable-stream'; import { SubjectType } from '@metamask/permission-controller'; import type { TransactionMetricsRequest } from '../../../shared/types/metametrics'; import { MessageSender } from '../../../types/global'; +import { + MetaMetricsEventOptions, + MetaMetricsEventPayload, +} from '../../../shared/constants/metametrics'; import { Controller, ControllerFlatState } from './controller-list'; /** The supported controller names. */ @@ -162,6 +166,22 @@ export type ControllerInitRequest< url?: string, ) => Promise; + /** + * Get the MetaMetrics ID. + */ + getMetaMetricsId: () => string; + + /** + * submits a metametrics event, not waiting for it to complete or allowing its error to bubble up + * + * @param payload - details of the event + * @param options - options for handling/routing the event + */ + trackEvent: ( + payload: MetaMetricsEventPayload, + options?: MetaMetricsEventOptions, + ) => void; + /** * Required initialization messenger instance. * Generated using the callback specified in `getInitMessengerCallback`. diff --git a/app/scripts/controller-init/utils.ts b/app/scripts/controller-init/utils.ts index a17de8e09aa5..6903d0197d53 100644 --- a/app/scripts/controller-init/utils.ts +++ b/app/scripts/controller-init/utils.ts @@ -37,6 +37,7 @@ type ControllerMessengerCallback = ( ) => BaseRestrictedControllerMessenger; export type ControllersToInitialize = + | 'AuthenticationController' | 'CronjobController' | 'ExecutionService' | 'MultichainAssetsController' @@ -49,7 +50,8 @@ export type ControllersToInitialize = | 'SnapInsightsController' | 'SnapInterfaceController' | 'PPOMController' - | 'TransactionController'; + | 'TransactionController' + | 'UserStorageController'; type InitFunction = ControllerInitFunction< diff --git a/app/scripts/controllers/mmi-controller.test.ts b/app/scripts/controllers/mmi-controller.test.ts index fa32e5681e99..b31810288819 100644 --- a/app/scripts/controllers/mmi-controller.test.ts +++ b/app/scripts/controllers/mmi-controller.test.ts @@ -313,10 +313,11 @@ describe('MMIController', function () { const type = 'mock-keyring-type'; mmiController.keyringController.getKeyringsByType = jest .fn() - .mockReturnValue([]); + .mockReturnValueOnce([]) + .mockReturnValueOnce(['new-keyring']); mmiController.keyringController.addNewKeyring = jest .fn() - .mockResolvedValue('new-keyring'); + .mockResolvedValue('new-keyring-metadata'); const result = await mmiController.addKeyringIfNotExists(type); diff --git a/app/scripts/controllers/mmi-controller.ts b/app/scripts/controllers/mmi-controller.ts index 7378585a7e8f..118a21367249 100644 --- a/app/scripts/controllers/mmi-controller.ts +++ b/app/scripts/controllers/mmi-controller.ts @@ -226,7 +226,8 @@ export class MMIController { async addKeyringIfNotExists(type: KeyringTypes) { let keyring = await this.keyringController.getKeyringsByType(type)[0]; if (!keyring) { - keyring = await this.keyringController.addNewKeyring(type); + await this.keyringController.addNewKeyring(type); + [keyring] = await this.keyringController.getKeyringsByType(type); } return keyring; } diff --git a/app/scripts/lib/approval/utils.test.ts b/app/scripts/lib/approval/utils.test.ts index 14c472df89ba..fc7840faea31 100644 --- a/app/scripts/lib/approval/utils.test.ts +++ b/app/scripts/lib/approval/utils.test.ts @@ -7,7 +7,7 @@ import { ApprovalType } from '@metamask/controller-utils'; import { providerErrors } from '@metamask/rpc-errors'; import { DIALOG_APPROVAL_TYPES } from '@metamask/snaps-rpc-methods'; import { SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES } from '../../../../shared/constants/app'; -import { rejectAllApprovals } from './utils'; +import { rejectAllApprovals, rejectOriginApprovals } from './utils'; const ID_MOCK = '123'; const ID_MOCK_2 = '456'; @@ -100,4 +100,30 @@ describe('Approval Utils', () => { expect(deleteInterface).toHaveBeenCalledWith(INTERFACE_ID_MOCK); }); }); + + describe('rejectOriginApprovals', () => { + it('rejects approval requests from given origin', () => { + const origin = 'https://example.com'; + const approvalController = createApprovalControllerMock([ + { id: ID_MOCK, origin, type: ApprovalType.Transaction }, + { + id: ID_MOCK_2, + origin: 'www.test.com', + type: ApprovalType.EthSignTypedData, + }, + ]); + + rejectOriginApprovals({ + approvalController, + deleteInterface: () => undefined, + origin, + }); + + expect(approvalController.reject).toHaveBeenCalledTimes(1); + expect(approvalController.reject).toHaveBeenCalledWith( + ID_MOCK, + providerErrors.userRejectedRequest(), + ); + }); + }); }); diff --git a/app/scripts/lib/approval/utils.ts b/app/scripts/lib/approval/utils.ts index 538478ea4652..b54f664e7cc6 100644 --- a/app/scripts/lib/approval/utils.ts +++ b/app/scripts/lib/approval/utils.ts @@ -1,8 +1,11 @@ -import { ApprovalController } from '@metamask/approval-controller'; +import { + ApprovalController, + ApprovalRequest, +} from '@metamask/approval-controller'; import { ApprovalType } from '@metamask/controller-utils'; import { DIALOG_APPROVAL_TYPES } from '@metamask/snaps-rpc-methods'; import { providerErrors } from '@metamask/rpc-errors'; -import { createProjectLogger } from '@metamask/utils'; +import { createProjectLogger, Json } from '@metamask/utils'; ///: BEGIN:ONLY_INCLUDE_IF(keyring-snaps) import { SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES } from '../../../../shared/constants/app'; ///: END:ONLY_INCLUDE_IF @@ -20,44 +23,78 @@ export function rejectAllApprovals({ const approvalRequests = Object.values(approvalRequestsById); for (const approvalRequest of approvalRequests) { - const { id, type } = approvalRequest; - const interfaceId = approvalRequest.requestData?.id as string; - - switch (type) { - case ApprovalType.SnapDialogAlert: - case ApprovalType.SnapDialogPrompt: - case DIALOG_APPROVAL_TYPES.default: - log('Rejecting snap dialog', { id, interfaceId }); - approvalController.accept(id, null); - deleteInterface?.(interfaceId); - break; - - case ApprovalType.SnapDialogConfirmation: - log('Rejecting snap confirmation', { id, interfaceId }); - approvalController.accept(id, false); - deleteInterface?.(interfaceId); - break; - - ///: BEGIN:ONLY_INCLUDE_IF(keyring-snaps) - case SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES.confirmAccountCreation: - case SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES.confirmAccountRemoval: - case SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES.showSnapAccountRedirect: - log('Rejecting snap account confirmation', { id }); - approvalController.accept(id, false); - break; - ///: END:ONLY_INCLUDE_IF - - default: - log('Rejecting pending approval', { id }); - approvalController.reject( - id, - providerErrors.userRejectedRequest({ - data: { - cause: 'rejectAllApprovals', - }, - }), - ); - break; - } + rejectApproval({ + approvalController, + approvalRequest, + deleteInterface, + }); + } +} + +export function rejectOriginApprovals({ + approvalController, + deleteInterface, + origin, +}: { + approvalController: ApprovalController; + deleteInterface?: (id: string) => void; + origin: string; +}) { + const approvalRequestsById = approvalController.state.pendingApprovals; + const approvalRequests = Object.values(approvalRequestsById); + + const originApprovalRequests = approvalRequests.filter( + (approvalRequest) => approvalRequest.origin === origin, + ); + + for (const approvalRequest of originApprovalRequests) { + rejectApproval({ + approvalController, + approvalRequest, + deleteInterface, + }); + } +} + +function rejectApproval({ + approvalController, + approvalRequest, + deleteInterface, +}: { + approvalController: ApprovalController; + approvalRequest: ApprovalRequest>; + deleteInterface?: (id: string) => void; +}) { + const { id, type, origin } = approvalRequest; + const interfaceId = approvalRequest.requestData?.id as string; + + switch (type) { + case ApprovalType.SnapDialogAlert: + case ApprovalType.SnapDialogPrompt: + case DIALOG_APPROVAL_TYPES.default: + log('Rejecting snap dialog', { id, interfaceId, origin, type }); + approvalController.accept(id, null); + deleteInterface?.(interfaceId); + break; + + case ApprovalType.SnapDialogConfirmation: + log('Rejecting snap confirmation', { id, interfaceId, origin, type }); + approvalController.accept(id, false); + deleteInterface?.(interfaceId); + break; + + ///: BEGIN:ONLY_INCLUDE_IF(keyring-snaps) + case SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES.confirmAccountCreation: + case SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES.confirmAccountRemoval: + case SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES.showSnapAccountRedirect: + log('Rejecting snap account confirmation', { id, origin, type }); + approvalController.accept(id, false); + break; + ///: END:ONLY_INCLUDE_IF + + default: + log('Rejecting pending approval', { id, origin, type }); + approvalController.reject(id, providerErrors.userRejectedRequest()); + break; } } diff --git a/app/scripts/lib/rpc-method-middleware/handlers/add-ethereum-chain.js b/app/scripts/lib/rpc-method-middleware/handlers/add-ethereum-chain.js index 486861d5e11d..aadf641c7a7e 100644 --- a/app/scripts/lib/rpc-method-middleware/handlers/add-ethereum-chain.js +++ b/app/scripts/lib/rpc-method-middleware/handlers/add-ethereum-chain.js @@ -21,6 +21,7 @@ const addEthereumChain = { getCurrentChainIdForDomain: true, getCaveat: true, requestPermittedChainsPermissionIncrementalForOrigin: true, + rejectApprovalRequestsForOrigin: true, }, }; @@ -40,6 +41,7 @@ async function addEthereumChainHandler( getCurrentChainIdForDomain, getCaveat, requestPermittedChainsPermissionIncrementalForOrigin, + rejectApprovalRequestsForOrigin, }, ) { let validParams; @@ -188,5 +190,6 @@ async function addEthereumChainHandler( setActiveNetwork, getCaveat, requestPermittedChainsPermissionIncrementalForOrigin, + rejectApprovalRequestsForOrigin, }); } diff --git a/app/scripts/lib/rpc-method-middleware/handlers/add-ethereum-chain.test.js b/app/scripts/lib/rpc-method-middleware/handlers/add-ethereum-chain.test.js index a75f2725789b..70da89c97b77 100644 --- a/app/scripts/lib/rpc-method-middleware/handlers/add-ethereum-chain.test.js +++ b/app/scripts/lib/rpc-method-middleware/handlers/add-ethereum-chain.test.js @@ -78,6 +78,7 @@ const createMockedHandler = () => { rpcEndpoints: [{ networkClientId: 123 }], }), requestPermittedChainsPermissionIncrementalForOrigin: jest.fn(), + rejectApprovalRequestsForOrigin: jest.fn(), }; const response = {}; const handler = (request) => @@ -188,6 +189,7 @@ describe('addEthereumChainHandler', () => { setActiveNetwork: mocks.setActiveNetwork, requestPermittedChainsPermissionIncrementalForOrigin: mocks.requestPermittedChainsPermissionIncrementalForOrigin, + rejectApprovalRequestsForOrigin: mocks.rejectApprovalRequestsForOrigin, }, ); }); @@ -253,6 +255,8 @@ describe('addEthereumChainHandler', () => { setActiveNetwork: mocks.setActiveNetwork, requestPermittedChainsPermissionIncrementalForOrigin: mocks.requestPermittedChainsPermissionIncrementalForOrigin, + rejectApprovalRequestsForOrigin: + mocks.rejectApprovalRequestsForOrigin, }, ); }); @@ -298,6 +302,8 @@ describe('addEthereumChainHandler', () => { setActiveNetwork: mocks.setActiveNetwork, requestPermittedChainsPermissionIncrementalForOrigin: mocks.requestPermittedChainsPermissionIncrementalForOrigin, + rejectApprovalRequestsForOrigin: + mocks.rejectApprovalRequestsForOrigin, }, ); }); diff --git a/app/scripts/lib/rpc-method-middleware/handlers/ethereum-chain-utils.js b/app/scripts/lib/rpc-method-middleware/handlers/ethereum-chain-utils.js index 5ba2211ce0b3..1f8d74f004be 100644 --- a/app/scripts/lib/rpc-method-middleware/handlers/ethereum-chain-utils.js +++ b/app/scripts/lib/rpc-method-middleware/handlers/ethereum-chain-utils.js @@ -170,6 +170,7 @@ export function validateAddEthereumChainParams(params) { * @param {Function} hooks.getCaveat - The callback to get the CAIP-25 caveat for the origin. * @param {Function} hooks.requestPermittedChainsPermissionIncrementalForOrigin - The callback to add a new chain to the permittedChains-equivalent CAIP-25 permission. * @param {Function} hooks.setTokenNetworkFilter - The callback to set the token network filter. + * @param {Function} hooks.rejectApprovalRequestsForOrigin - The callback to reject all pending approval requests for the origin. * @returns a null response on success or an error if user rejects an approval when autoApprove is false or on unexpected errors. */ export async function switchChain( @@ -183,6 +184,7 @@ export async function switchChain( getCaveat, requestPermittedChainsPermissionIncrementalForOrigin, setTokenNetworkFilter, + rejectApprovalRequestsForOrigin, }, ) { try { @@ -207,6 +209,8 @@ export async function switchChain( }); } + rejectApprovalRequestsForOrigin?.(); + await setActiveNetwork(networkClientId); setTokenNetworkFilter(chainId); response.result = null; diff --git a/app/scripts/lib/rpc-method-middleware/handlers/ethereum-chain-utils.test.ts b/app/scripts/lib/rpc-method-middleware/handlers/ethereum-chain-utils.test.ts index 7c159f5312ba..66a21c6facdb 100644 --- a/app/scripts/lib/rpc-method-middleware/handlers/ethereum-chain-utils.test.ts +++ b/app/scripts/lib/rpc-method-middleware/handlers/ethereum-chain-utils.test.ts @@ -15,6 +15,7 @@ describe('Ethereum Chain Utils', () => { getCaveat: jest.fn(), requestPermittedChainsPermissionIncrementalForOrigin: jest.fn(), setTokenNetworkFilter: jest.fn(), + rejectApprovalRequestsForOrigin: jest.fn(), }; const response: { result?: true } = {}; const switchChain = (chainId: Hex, networkClientId: string) => @@ -39,6 +40,13 @@ describe('Ethereum Chain Utils', () => { }); }); + it('calls rejectApprovalRequestsForOrigin if passed', async () => { + const { mocks, switchChain } = createMockedSwitchChain(); + await switchChain('0x1', 'mainnet'); + + expect(mocks.rejectApprovalRequestsForOrigin).toHaveBeenCalledTimes(1); + }); + describe('with no existing CAIP-25 permission', () => { it('requests a switch chain approval without autoApprove if autoApprove: false', async () => { const { mocks, switchChain } = createMockedSwitchChain(); diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 8ccc584c383e..3e0ab4969872 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -136,10 +136,7 @@ import { Interface } from '@ethersproject/abi'; import { abiERC1155, abiERC721 } from '@metamask/metamask-eth-abis'; import { isEvmAccountType } from '@metamask/keyring-api'; import { normalize } from '@metamask/eth-sig-util'; -import { - AuthenticationController, - UserStorageController, -} from '@metamask/profile-sync-controller'; + import { TRIGGER_TYPES, Controller as NotificationServicesController, @@ -198,9 +195,6 @@ import { LedgerTransportTypes, } from '../../shared/constants/hardware-wallets'; import { KeyringType } from '../../shared/constants/keyring'; -///: BEGIN:ONLY_INCLUDE_IF(multi-srp) -import { findKeyringId } from '../../shared/lib/keyring'; -///: END:ONLY_INCLUDE_IF import { RestrictedMethods, ExcludedSnapPermissions, @@ -218,7 +212,6 @@ import { import { MetaMetricsEventCategory, MetaMetricsEventName, - MetaMetricsUserTrait, } from '../../shared/constants/metametrics'; import { LOG_EVENT } from '../../shared/constants/logs'; @@ -256,7 +249,6 @@ import { BridgeUserAction, BridgeBackgroundAction, } from '../../shared/types/bridge'; -import { isProduction } from '../../shared/modules/environment'; import { ///: BEGIN:ONLY_INCLUDE_IF(build-mmi) handleMMITransactionUpdate, @@ -369,7 +361,10 @@ import { sanitizeUIState } from './lib/state-utils'; import { walletCreateSession } from './lib/rpc-method-middleware/handlers/wallet-createSession'; import BridgeStatusController from './controllers/bridge-status/bridge-status-controller'; import { BRIDGE_STATUS_CONTROLLER_NAME } from './controllers/bridge-status/constants'; -import { rejectAllApprovals } from './lib/approval/utils'; +import { + rejectAllApprovals, + rejectOriginApprovals, +} from './lib/approval/utils'; import { handleBridgeTransactionComplete, handleBridgeTransactionFailed, @@ -396,6 +391,8 @@ import { SnapInterfaceControllerInit, SnapsRegistryInit, } from './controller-init/snaps'; +import { AuthenticationControllerInit } from './controller-init/identity/authentication-controller-init'; +import { UserStorageControllerInit } from './controller-init/identity/user-storage-controller-init'; export const METAMASK_CONTROLLER_EVENTS = { // Fired after state changes that impact the extension badge (unapproved msg count) @@ -1293,95 +1290,6 @@ export default class MetamaskController extends EventEmitter { }); // Notification Controllers - this.authenticationController = new AuthenticationController.Controller({ - state: initState.AuthenticationController, - messenger: this.controllerMessenger.getRestricted({ - name: 'AuthenticationController', - allowedActions: [ - 'KeyringController:getState', - 'SnapController:handleRequest', - ], - allowedEvents: ['KeyringController:lock', 'KeyringController:unlock'], - }), - metametrics: { - getMetaMetricsId: () => this.metaMetricsController.getMetaMetricsId(), - agent: 'extension', - }, - }); - - this.userStorageController = new UserStorageController.Controller({ - state: initState.UserStorageController, - config: { - accountSyncing: { - maxNumberOfAccountsToAdd: isProduction() ? undefined : 100, - onAccountAdded: (profileId) => { - this.metaMetricsController.trackEvent({ - category: MetaMetricsEventCategory.ProfileSyncing, - event: MetaMetricsEventName.AccountsSyncAdded, - properties: { - profile_id: profileId, - }, - }); - }, - onAccountNameUpdated: (profileId) => { - this.metaMetricsController.trackEvent({ - category: MetaMetricsEventCategory.ProfileSyncing, - event: MetaMetricsEventName.AccountsSyncNameUpdated, - properties: { - profile_id: profileId, - }, - }); - }, - onAccountSyncErroneousSituation: ( - profileId, - situationMessage, - sentryContext, - ) => { - captureException( - new Error(`Account sync - ${situationMessage}`), - sentryContext, - ); - this.metaMetricsController.trackEvent({ - category: MetaMetricsEventCategory.ProfileSyncing, - event: MetaMetricsEventName.AccountsSyncErroneousSituation, - properties: { - profile_id: profileId, - situation_message: situationMessage, - }, - }); - }, - }, - }, - env: { - isAccountSyncingEnabled: isManifestV3, - }, - messenger: this.controllerMessenger.getRestricted({ - name: 'UserStorageController', - allowedActions: [ - 'KeyringController:getState', - 'KeyringController:withKeyring', - 'SnapController:handleRequest', - 'AuthenticationController:getBearerToken', - 'AuthenticationController:getSessionProfile', - 'AuthenticationController:isSignedIn', - 'AuthenticationController:performSignOut', - 'AuthenticationController:performSignIn', - 'AccountsController:listAccounts', - 'AccountsController:updateAccountMetadata', - 'NetworkController:getState', - 'NetworkController:addNetwork', - 'NetworkController:removeNetwork', - 'NetworkController:updateNetwork', - ], - allowedEvents: [ - 'KeyringController:lock', - 'KeyringController:unlock', - 'AccountsController:accountAdded', - 'AccountsController:accountRenamed', - 'NetworkController:networkRemoved', - ], - }), - }); /** @type {import('@metamask/notification-services-controller/push-services').NotificationServicesPushControllerMessenger} */ const notificationServicesPushControllerMessenger = @@ -2084,6 +1992,8 @@ export default class MetamaskController extends EventEmitter { MultichainTransactionsController: MultichainTransactionsControllerInit, ///: END:ONLY_INCLUDE_IF MultichainNetworkController: MultichainNetworkControllerInit, + AuthenticationController: AuthenticationControllerInit, + UserStorageController: UserStorageControllerInit, }; const { @@ -2123,6 +2033,8 @@ export default class MetamaskController extends EventEmitter { ///: END:ONLY_INCLUDE_IF this.multichainNetworkController = controllersByName.MultichainNetworkController; + this.authenticationController = controllersByName.AuthenticationController; + this.userStorageController = controllersByName.UserStorageController; this.controllerMessenger.subscribe( 'TransactionController:transactionStatusUpdated', @@ -2457,25 +2369,6 @@ export default class MetamaskController extends EventEmitter { if (usePhishDetect) { this.phishingController.maybeUpdateState(); } - - // post onboarding emit detectTokens event - const preferencesControllerState = this.preferencesController.state; - const { useTokenDetection, useNftDetection } = - preferencesControllerState ?? {}; - this.metaMetricsController.trackEvent({ - category: MetaMetricsEventCategory.Onboarding, - event: MetaMetricsUserTrait.TokenDetectionEnabled, - properties: { - [MetaMetricsUserTrait.TokenDetectionEnabled]: useTokenDetection, - }, - }); - this.metaMetricsController.trackEvent({ - category: MetaMetricsEventCategory.Onboarding, - event: MetaMetricsUserTrait.NftAutodetectionEnabled, - properties: { - [MetaMetricsUserTrait.NftAutodetectionEnabled]: useNftDetection, - }, - }); } triggerNetworkrequests() { @@ -2511,11 +2404,14 @@ export default class MetamaskController extends EventEmitter { * @returns {SnapKeyring} */ async getSnapKeyring() { + // TODO: Use `withKeyring` instead let [snapKeyring] = this.keyringController.getKeyringsByType( KeyringType.snap, ); if (!snapKeyring) { - snapKeyring = await this.keyringController.addNewKeyring( + await this.keyringController.addNewKeyring(KeyringType.snap); + // TODO: Use `withKeyring` instead + [snapKeyring] = this.keyringController.getKeyringsByType( KeyringType.snap, ); } @@ -2689,7 +2585,7 @@ export default class MetamaskController extends EventEmitter { { id: source, }, - async (keyring) => ({ + async ({ keyring }) => ({ type: keyring.type, mnemonic: keyring.mnemonic, }), @@ -4337,6 +4233,20 @@ export default class MetamaskController extends EventEmitter { }; } + rejectOriginPendingApprovals(origin) { + const deleteInterface = (id) => + this.controllerMessenger.call( + 'SnapInterfaceController:deleteInterface', + id, + ); + + rejectOriginApprovals({ + approvalController: this.approvalController, + deleteInterface, + origin, + }); + } + async exportAccount(address, password) { await this.verifyPassword(password); return this.keyringController.exportAccount(password, address); @@ -4500,7 +4410,7 @@ export default class MetamaskController extends EventEmitter { try { // TODO: `getKeyringsByType` is deprecated, this logic should probably be moved to the `KeyringController`. // FIXME: The `KeyringController` does not check yet for duplicated accounts with HD keyrings, see: https://github.com/MetaMask/core/issues/5411 - const alreadyImportedSrp = await this.keyringController + const alreadyImportedSrp = this.keyringController .getKeyringsByType(KeyringTypes.hd) .some((keyring) => { return ( @@ -4516,26 +4426,22 @@ export default class MetamaskController extends EventEmitter { ); } - const newKeyring = await this.keyringController.addNewKeyring( + const { id } = await this.keyringController.addNewKeyring( KeyringTypes.hd, { mnemonic, numberOfAccounts: 1, }, ); - const [newAccountAddress] = await newKeyring.getAccounts(); + const [newAccountAddress] = await this.keyringController.withKeyring( + { id }, + async ({ keyring }) => keyring.getAccounts(), + ); const account = this.accountsController.getAccountByAddress(newAccountAddress); this.accountsController.setSelectedAccount(account.id); - // TODO: Find a way to encapsulate this logic in the KeyringController itself. - const { keyrings, keyringsMetadata } = this.keyringController.state; - const keyringId = findKeyringId(keyrings, keyringsMetadata, { - address: newAccountAddress, - type: KeyringTypes.hd, - }); - - await this._addAccountsWithBalance(keyringId); + await this._addAccountsWithBalance(id); return newAccountAddress; } finally { @@ -4556,10 +4462,13 @@ export default class MetamaskController extends EventEmitter { const releaseLock = await this.createVaultMutex.acquire(); try { // addNewKeyring auto creates 1 account. - const newHdkeyring = await this.keyringController.addNewKeyring( + const { id } = await this.keyringController.addNewKeyring( KeyringTypes.hd, ); - const [newAccount] = await newHdkeyring.getAccounts(); + const [newAccount] = await this.keyringController.withKeyring( + { id }, + async ({ keyring }) => keyring.getAccounts(), + ); const account = this.accountsController.getAccountByAddress(newAccount); this.accountsController.setSelectedAccount(account.id); @@ -4635,7 +4544,7 @@ export default class MetamaskController extends EventEmitter { const accounts = await this.keyringController.withKeyring( keyringSelector, - async (keyring) => { + async ({ keyring }) => { return await keyring.getAccounts(); }, ); @@ -4671,7 +4580,7 @@ export default class MetamaskController extends EventEmitter { // This account has assets, so check the next one address = await this.keyringController.withKeyring( keyringSelector, - async (keyring) => { + async ({ keyring }) => { const [newAddress] = await keyring.addAccounts(1); return newAddress; }, @@ -4954,11 +4863,13 @@ export default class MetamaskController extends EventEmitter { // The `getKeyringForAccount` is now deprecated, so we just use `withKeyring` instead to access our keyring. return await this.keyringController.withKeyring( { address }, - ({ type: keyringType, bridge: keyringBridge }) => + ({ keyring }) => { + const { type: keyringType, bridge: keyringBridge } = keyring; // Specific case for OneKey devices, see `ONE_KEY_VIA_TREZOR_MINOR_VERSION` for further details. - keyringBridge?.minorVersion === ONE_KEY_VIA_TREZOR_MINOR_VERSION + return keyringBridge?.minorVersion === ONE_KEY_VIA_TREZOR_MINOR_VERSION ? HardwareKeyringType.oneKey - : HardwareKeyringType[keyringType], + : HardwareKeyringType[keyringType]; + }, ); } @@ -5016,23 +4927,26 @@ export default class MetamaskController extends EventEmitter { * @returns {'ledger' | 'lattice' | string | undefined} */ async getDeviceModel(address) { - return this.keyringController.withKeyring({ address }, async (keyring) => { - switch (keyring.type) { - case KeyringType.trezor: - case KeyringType.oneKey: - return keyring.getModel(); - case KeyringType.qr: - return keyring.getName(); - case KeyringType.ledger: - // TODO: get model after ledger keyring exposes method - return HardwareDeviceNames.ledger; - case KeyringType.lattice: - // TODO: get model after lattice keyring exposes method - return HardwareDeviceNames.lattice; - default: - return undefined; - } - }); + return this.keyringController.withKeyring( + { address }, + async ({ keyring }) => { + switch (keyring.type) { + case KeyringType.trezor: + case KeyringType.oneKey: + return keyring.getModel(); + case KeyringType.qr: + return keyring.getName(); + case KeyringType.ledger: + // TODO: get model after ledger keyring exposes method + return HardwareDeviceNames.ledger; + case KeyringType.lattice: + // TODO: get model after lattice keyring exposes method + return HardwareDeviceNames.lattice; + default: + return undefined; + } + }, + ); } /** @@ -5120,7 +5034,7 @@ export default class MetamaskController extends EventEmitter { const addedAccountAddress = await this.keyringController.withKeyring( keyringSelector, - async (keyring) => { + async ({ keyring }) => { if (keyring.type !== KeyringTypes.hd) { throw new Error('Cannot add account to non-HD keyring'); } @@ -6219,18 +6133,20 @@ export default class MetamaskController extends EventEmitter { engine.push(createSelectedNetworkMiddleware(this.controllerMessenger)); // Add a middleware that will switch chain on each request (as needed) - const requestQueueMiddleware = createQueuedRequestMiddleware({ - enqueueRequest: this.queuedRequestController.enqueueRequest.bind( - this.queuedRequestController, - ), - shouldEnqueueRequest: (request) => { - return methodsThatShouldBeEnqueued.includes(request.method); - }, - // This will be removed once we can actually remove useRequestQueue state - // i.e. unrevert https://github.com/MetaMask/core/pull/5065 - useRequestQueue: () => true, - }); - engine.push(requestQueueMiddleware); + if (process.env.EVM_MULTICHAIN_ENABLED !== true) { + const requestQueueMiddleware = createQueuedRequestMiddleware({ + enqueueRequest: this.queuedRequestController.enqueueRequest.bind( + this.queuedRequestController, + ), + shouldEnqueueRequest: (request) => { + return methodsThatShouldBeEnqueued.includes(request.method); + }, + // This will be removed once we can actually remove useRequestQueue state + // i.e. unrevert https://github.com/MetaMask/core/pull/5065 + useRequestQueue: () => true, + }); + engine.push(requestQueueMiddleware); + } // If the origin is not in the selectedNetworkController's `domains` state // when the provider engine is created, the selectedNetworkController will @@ -6474,6 +6390,8 @@ export default class MetamaskController extends EventEmitter { this.permissionController, origin, ), + rejectApprovalRequestsForOrigin: () => + this.rejectOriginPendingApprovals(origin), ///: BEGIN:ONLY_INCLUDE_IF(build-mmi) handleMmiAuthenticate: @@ -8058,7 +7976,7 @@ export default class MetamaskController extends EventEmitter { return this.keyringController.withKeyring( { type: keyringType }, - async (keyring) => { + async ({ keyring }) => { if (options.hdPath && keyring.setHdPath) { keyring.setHdPath(options.hdPath); } @@ -8146,6 +8064,12 @@ export default class MetamaskController extends EventEmitter { setupUntrustedCommunicationEip1193: this.setupUntrustedCommunicationEip1193.bind(this), showNotification: this.platform._showNotification, + getMetaMetricsId: this.metaMetricsController.getMetaMetricsId.bind( + this.metaMetricsController, + ), + trackEvent: this.metaMetricsController.trackEvent.bind( + this.metaMetricsController, + ), }; return initControllers({ diff --git a/app/scripts/metamask-controller.test.js b/app/scripts/metamask-controller.test.js index f6d670c5b8aa..5121682e9b85 100644 --- a/app/scripts/metamask-controller.test.js +++ b/app/scripts/metamask-controller.test.js @@ -195,6 +195,7 @@ const buildMockKeyringBridge = (publicKeyPayload) => jest.fn(() => ({ init: jest.fn(), dispose: jest.fn(), + destroy: jest.fn(), updateTransportMethod: jest.fn(), getPublicKey: jest.fn(async () => publicKeyPayload), })); @@ -214,6 +215,7 @@ jest.mock('@metamask/eth-ledger-bridge-keyring', () => ({ ...jest.requireActual('@metamask/eth-ledger-bridge-keyring'), LedgerIframeBridge: buildMockKeyringBridge({ publicKey: KNOWN_PUBLIC_KEY, + address: KNOWN_PUBLIC_KEY_ADDRESSES[0].address, chainCode: '0x1', }), })); @@ -1916,7 +1918,7 @@ describe('MetaMaskController', () => { async (type) => { jest .spyOn(metamaskController.keyringController, 'withKeyring') - .mockImplementation((_, fn) => fn({ type })); + .mockImplementation((_, fn) => fn({ keyring: { type } })); const result = await metamaskController.getHardwareTypeForMetric( '0x123', @@ -1934,7 +1936,7 @@ describe('MetaMaskController', () => { type: 'trezor', bridge: { minorVersion: ONE_KEY_VIA_TREZOR_MINOR_VERSION }, }; - return fn(keyring); + return fn({ keyring }); }); const result = await metamaskController.getHardwareTypeForMetric( diff --git a/builds.yml b/builds.yml index 12820171dd99..3c432cd74c64 100644 --- a/builds.yml +++ b/builds.yml @@ -29,6 +29,7 @@ buildTypes: - REJECT_INVALID_SNAPS_PLATFORM_VERSION: true - IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/7.0.0/index.html - ACCOUNT_SNAPS_DIRECTORY_URL: https://snaps.metamask.io/account-management + - EVM_MULTICHAIN_ENABLED: false # Main build uses the default browser manifest manifestOverrides: false # Build name used in multiple user-readable places @@ -56,6 +57,7 @@ buildTypes: - REJECT_INVALID_SNAPS_PLATFORM_VERSION: true - IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/7.0.0/index.html - ACCOUNT_SNAPS_DIRECTORY_URL: https://snaps.metamask.io/account-management + - EVM_MULTICHAIN_ENABLED: false # Modifies how the version is displayed. # eg. instead of 10.25.0 -> 10.25.0-beta.2 isPrerelease: true @@ -88,6 +90,7 @@ buildTypes: - SEGMENT_WRITE_KEY_REF: SEGMENT_FLASK_WRITE_KEY - ACCOUNT_SNAPS_DIRECTORY_URL: https://metamask.github.io/snaps-directory-staging/main/account-management - EIP_4337_ENTRYPOINT: '0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789' + - EVM_MULTICHAIN_ENABLED: false - MULTICHAIN_API: true isPrerelease: true manifestOverrides: ./app/build-types/flask/manifest/ @@ -111,6 +114,7 @@ buildTypes: - SUPPORT_LINK: https://support.metamask-institutional.io - SUPPORT_REQUEST_LINK: https://support.metamask-institutional.io - SENTRY_DSN: SENTRY_MMI_DSN + - EVM_MULTICHAIN_ENABLED: false # For some reason, MMI uses this type of versioning # Leaving it on for backwards compatibility isPrerelease: true diff --git a/lavamoat/browserify/beta/policy.json b/lavamoat/browserify/beta/policy.json index dd6e3267ec4e..2e3da47bf801 100644 --- a/lavamoat/browserify/beta/policy.json +++ b/lavamoat/browserify/beta/policy.json @@ -40,31 +40,47 @@ }, "@ethereumjs/tx>@ethereumjs/common": { "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "@ethereumjs/tx>@ethereumjs/common>@ethereumjs/util": true, + "webpack>events": true + } + }, + "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@ethereumjs/tx>@ethereumjs/common": { + "packages": { + "eth-lattice-keyring>@ethereumjs/util": true, "browserify>buffer": true, - "@ethereumjs/tx>@ethereumjs/common>crc-32": true, + "eth-lattice-keyring>gridplus-sdk>crc-32": true, "webpack>events": true } }, - "@metamask/smart-transactions-controller>@ethereumjs/tx>@ethereumjs/common": { + "@keystonehq/metamask-airgapped-keyring>@ethereumjs/tx>@ethereumjs/common": { "packages": { - "@metamask/smart-transactions-controller>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/util": true, + "browserify>buffer": true, + "eth-lattice-keyring>gridplus-sdk>crc-32": true, + "webpack>events": true + } + }, + "eth-lattice-keyring>@ethereumjs/tx>@ethereumjs/common": { + "packages": { + "eth-lattice-keyring>@ethereumjs/util": true, + "browserify>buffer": true, + "eth-lattice-keyring>gridplus-sdk>crc-32": true, "webpack>events": true } }, "eth-lattice-keyring>gridplus-sdk>@ethereumjs/tx>@ethereumjs/common": { "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/util": true, "browserify>buffer": true, - "@ethereumjs/tx>@ethereumjs/common>crc-32": true, + "eth-lattice-keyring>gridplus-sdk>crc-32": true, "webpack>events": true } }, "eth-lattice-keyring>gridplus-sdk>@ethereumjs/common": { "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/util": true, "browserify>buffer": true, - "@ethereumjs/tx>@ethereumjs/common>crc-32": true, + "eth-lattice-keyring>gridplus-sdk>crc-32": true, "webpack>events": true } }, @@ -73,7 +89,42 @@ "TextEncoder": true } }, - "@metamask/smart-transactions-controller>@ethereumjs/tx>@ethereumjs/rlp": { + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": { + "globals": { + "TextEncoder": true + } + }, + "@ethereumjs/tx>@ethereumjs/common>@ethereumjs/util>@ethereumjs/rlp": { + "globals": { + "TextEncoder": true + } + }, + "@metamask/controller-utils>@ethereumjs/util>@ethereumjs/rlp": { + "globals": { + "TextEncoder": true + } + }, + "@metamask/keyring-controller>@metamask/eth-hd-keyring>@ethereumjs/util>@ethereumjs/rlp": { + "globals": { + "TextEncoder": true + } + }, + "@metamask/keyring-controller>@metamask/eth-simple-keyring>@ethereumjs/util>@ethereumjs/rlp": { + "globals": { + "TextEncoder": true + } + }, + "@metamask/eth-trezor-keyring>@ethereumjs/util>@ethereumjs/rlp": { + "globals": { + "TextEncoder": true + } + }, + "@metamask/keyring-controller>@ethereumjs/util>@ethereumjs/rlp": { + "globals": { + "TextEncoder": true + } + }, + "@metamask/smart-transactions-controller>@ethereumjs/util>@ethereumjs/rlp": { "globals": { "TextEncoder": true } @@ -93,25 +144,35 @@ "@ethereumjs/tx>@ethereumjs/common": true, "@ethereumjs/tx>@ethereumjs/rlp": true, "@ethereumjs/tx>@ethereumjs/util": true, + "@ethereumjs/tx>ethereum-cryptography": true + } + }, + "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@ethereumjs/tx": { + "packages": { + "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@ethereumjs/tx>@ethereumjs/common": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "eth-lattice-keyring>@ethereumjs/util": true, "browserify>buffer": true, "@ethereumjs/tx>ethereum-cryptography": true, "browserify>insert-module-globals>is-buffer": true } }, - "@metamask/smart-transactions-controller>@ethereumjs/tx": { + "@keystonehq/metamask-airgapped-keyring>@ethereumjs/tx": { "packages": { - "@metamask/smart-transactions-controller>@ethereumjs/tx>@ethereumjs/common": true, - "@metamask/smart-transactions-controller>@ethereumjs/tx>@ethereumjs/rlp": true, - "@metamask/smart-transactions-controller>@ethereumjs/util": true, - "@ethereumjs/tx>ethereum-cryptography": true + "@keystonehq/metamask-airgapped-keyring>@ethereumjs/tx>@ethereumjs/common": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "eth-lattice-keyring>@ethereumjs/util": true, + "browserify>buffer": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "browserify>insert-module-globals>is-buffer": true } }, "eth-lattice-keyring>@ethereumjs/tx": { "packages": { "eth-lattice-keyring>@ethereumjs/tx>@chainsafe/ssz": true, - "@ethereumjs/tx>@ethereumjs/common": true, - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/tx>@ethereumjs/common": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@ethersproject/providers": true, "browserify>buffer": true, "eth-lattice-keyring>@ethereumjs/tx>ethereum-cryptography": true, @@ -122,25 +183,165 @@ "packages": { "eth-lattice-keyring>@ethereumjs/tx>@chainsafe/ssz": true, "eth-lattice-keyring>gridplus-sdk>@ethereumjs/tx>@ethereumjs/common": true, - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@ethersproject/providers": true, "browserify>buffer": true, "eth-lattice-keyring>gridplus-sdk>@ethereumjs/tx>ethereum-cryptography": true, "browserify>insert-module-globals>is-buffer": true } }, + "@ethereumjs/tx>@ethereumjs/common>@ethereumjs/util": { + "globals": { + "console.warn": true, + "fetch": true + }, + "packages": { + "@ethereumjs/tx>@ethereumjs/common>@ethereumjs/util>@ethereumjs/rlp": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true + } + }, "@ethereumjs/tx>@ethereumjs/util": { "globals": { - "console.warn": true + "console.warn": true, + "fetch": true }, "packages": { "@ethereumjs/tx>@ethereumjs/rlp": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true + } + }, + "@metamask/controller-utils>@ethereumjs/util": { + "globals": { + "console.warn": true, + "fetch": true + }, + "packages": { + "@metamask/controller-utils>@ethereumjs/util>@ethereumjs/rlp": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true + } + }, + "@metamask/keyring-controller>@metamask/eth-hd-keyring>@ethereumjs/util": { + "globals": { + "console.warn": true, + "fetch": true + }, + "packages": { + "@metamask/keyring-controller>@metamask/eth-hd-keyring>@ethereumjs/util>@ethereumjs/rlp": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true + } + }, + "@metamask/eth-ledger-bridge-keyring>@ethereumjs/util": { + "globals": { + "console.warn": true, + "fetch": true + }, + "packages": { + "@metamask/eth-ledger-bridge-keyring>@ethereumjs/rlp": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true + } + }, + "@metamask/keyring-controller>@metamask/eth-hd-keyring>@metamask/eth-sig-util>@ethereumjs/util": { + "globals": { + "console.warn": true + }, + "packages": { + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "browserify>buffer": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true, + "browserify>insert-module-globals>is-buffer": true, + "eth-lattice-keyring>@ethereumjs/util>micro-ftch": true + } + }, + "@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@ethereumjs/util": { + "globals": { + "console.warn": true + }, + "packages": { + "@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@ethereumjs/rlp": true, "browserify>buffer": true, "@ethereumjs/tx>ethereum-cryptography": true, "webpack>events": true, "browserify>insert-module-globals>is-buffer": true, - "@ethereumjs/tx>@ethereumjs/util>micro-ftch": true + "eth-lattice-keyring>@ethereumjs/util>micro-ftch": true + } + }, + "@metamask/keyring-controller>@metamask/eth-simple-keyring>@metamask/eth-sig-util>@ethereumjs/util": { + "globals": { + "console.warn": true + }, + "packages": { + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "browserify>buffer": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true, + "browserify>insert-module-globals>is-buffer": true, + "eth-lattice-keyring>@ethereumjs/util>micro-ftch": true + } + }, + "@metamask/eth-trezor-keyring>@metamask/eth-sig-util>@ethereumjs/util": { + "globals": { + "console.warn": true + }, + "packages": { + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "browserify>buffer": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true, + "browserify>insert-module-globals>is-buffer": true, + "eth-lattice-keyring>@ethereumjs/util>micro-ftch": true + } + }, + "@metamask/keyring-controller>@metamask/eth-sig-util>@ethereumjs/util": { + "globals": { + "console.warn": true + }, + "packages": { + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "browserify>buffer": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true, + "browserify>insert-module-globals>is-buffer": true, + "eth-lattice-keyring>@ethereumjs/util>micro-ftch": true + } + }, + "@metamask/keyring-controller>@metamask/eth-simple-keyring>@ethereumjs/util": { + "globals": { + "console.warn": true, + "fetch": true + }, + "packages": { + "@metamask/keyring-controller>@metamask/eth-simple-keyring>@ethereumjs/util>@ethereumjs/rlp": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true + } + }, + "@metamask/eth-trezor-keyring>@ethereumjs/util": { + "globals": { + "console.warn": true, + "fetch": true + }, + "packages": { + "@metamask/eth-trezor-keyring>@ethereumjs/util>@ethereumjs/rlp": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true + } + }, + "@metamask/keyring-controller>@ethereumjs/util": { + "globals": { + "console.warn": true, + "fetch": true + }, + "packages": { + "@metamask/keyring-controller>@ethereumjs/util>@ethereumjs/rlp": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true } }, "@metamask/smart-transactions-controller>@ethereumjs/util": { @@ -149,11 +350,24 @@ "fetch": true }, "packages": { - "@metamask/smart-transactions-controller>@ethereumjs/tx>@ethereumjs/rlp": true, + "@metamask/smart-transactions-controller>@ethereumjs/util>@ethereumjs/rlp": true, "@ethereumjs/tx>ethereum-cryptography": true, "webpack>events": true } }, + "eth-lattice-keyring>@ethereumjs/util": { + "globals": { + "console.warn": true + }, + "packages": { + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "browserify>buffer": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true, + "browserify>insert-module-globals>is-buffer": true, + "eth-lattice-keyring>@ethereumjs/util>micro-ftch": true + } + }, "@ethersproject/abi": { "globals": { "console.log": true @@ -622,8 +836,8 @@ }, "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring": { "packages": { - "@ethereumjs/tx": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@ethereumjs/tx": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@keystonehq/bc-ur-registry-eth": true, "browserify>buffer": true, "@metamask/eth-trezor-keyring>hdkey": true, @@ -633,7 +847,7 @@ }, "@keystonehq/bc-ur-registry-eth": { "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry": true, "browserify>buffer": true, "@metamask/eth-trezor-keyring>hdkey": true, @@ -654,7 +868,7 @@ }, "@keystonehq/metamask-airgapped-keyring": { "packages": { - "@ethereumjs/tx": true, + "@keystonehq/metamask-airgapped-keyring>@ethereumjs/tx": true, "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring": true, "@keystonehq/bc-ur-registry-eth": true, "@metamask/obs-store": true, @@ -875,12 +1089,11 @@ }, "@metamask/accounts-controller": { "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, "@metamask/base-controller": true, "@metamask/eth-snap-keyring": true, "@metamask/keyring-api": true, "@metamask/keyring-controller": true, - "@metamask/keyring-api>@metamask/keyring-utils": true, + "@metamask/accounts-controller>@metamask/keyring-utils": true, "@metamask/utils": true, "@ethereumjs/tx>ethereum-cryptography": true, "uuid": true @@ -921,7 +1134,7 @@ "setTimeout": true }, "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/util": true, "ethers>@ethersproject/address": true, "@ethersproject/bignumber": true, "@ethersproject/contracts": true, @@ -1002,14 +1215,6 @@ "immer": true } }, - "@metamask/transaction-controller>@metamask/base-controller": { - "globals": { - "setTimeout": true - }, - "packages": { - "immer": true - } - }, "@metamask/browser-passworder": { "globals": { "CryptoKey": true, @@ -1039,7 +1244,7 @@ "setTimeout": true }, "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/controller-utils>@ethereumjs/util": true, "@metamask/controller-utils>@metamask/ethjs-unit": true, "@metamask/utils": true, "@metamask/controller-utils>@spruceid/siwe-parser": true, @@ -1076,7 +1281,7 @@ "TextEncoder": true }, "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/keyring-controller>@metamask/eth-hd-keyring>@ethereumjs/util": true, "@metamask/keyring-controller>@metamask/eth-hd-keyring>@metamask/eth-sig-util": true, "@metamask/snaps-sdk>@metamask/key-tree": true, "@metamask/scure-bip39": true, @@ -1144,11 +1349,11 @@ "packages": { "@metamask/eth-ledger-bridge-keyring>@ethereumjs/rlp": true, "@ethereumjs/tx": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/eth-ledger-bridge-keyring>@ethereumjs/util": true, "@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth": true, "@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util": true, + "@metamask/utils": true, "browserify>buffer": true, - "webpack>events": true, "@metamask/eth-trezor-keyring>hdkey": true } }, @@ -1160,7 +1365,7 @@ }, "@metamask/eth-sig-util": { "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@metamask/abi-utils": true, "@metamask/eth-sig-util>@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1171,8 +1376,8 @@ }, "@metamask/keyring-controller>@metamask/eth-hd-keyring>@metamask/eth-sig-util": { "packages": { - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "@metamask/keyring-controller>@metamask/eth-hd-keyring>@metamask/eth-sig-util>@ethereumjs/util": true, "@metamask/keyring-controller>@metamask/eth-hd-keyring>@metamask/eth-sig-util>@metamask/abi-utils": true, "@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1183,8 +1388,8 @@ }, "@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util": { "packages": { - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@metamask/abi-utils": true, "@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1196,7 +1401,7 @@ "@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util": { "packages": { "@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@ethereumjs/util": true, "@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@metamask/abi-utils": true, "@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1207,8 +1412,8 @@ }, "@metamask/keyring-controller>@metamask/eth-simple-keyring>@metamask/eth-sig-util": { "packages": { - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "@metamask/keyring-controller>@metamask/eth-simple-keyring>@metamask/eth-sig-util>@ethereumjs/util": true, "@metamask/keyring-controller>@metamask/eth-simple-keyring>@metamask/eth-sig-util>@metamask/abi-utils": true, "@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1219,8 +1424,8 @@ }, "@metamask/eth-snap-keyring>@metamask/eth-sig-util": { "packages": { - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@metamask/eth-snap-keyring>@metamask/eth-sig-util>@metamask/abi-utils": true, "@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1231,8 +1436,8 @@ }, "@metamask/eth-trezor-keyring>@metamask/eth-sig-util": { "packages": { - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "@metamask/eth-trezor-keyring>@metamask/eth-sig-util>@ethereumjs/util": true, "@metamask/eth-trezor-keyring>@metamask/eth-sig-util>@metamask/abi-utils": true, "@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1243,8 +1448,8 @@ }, "@metamask/keyring-controller>@metamask/eth-sig-util": { "packages": { - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "@metamask/keyring-controller>@metamask/eth-sig-util>@ethereumjs/util": true, "@metamask/keyring-controller>@metamask/eth-sig-util>@metamask/abi-utils": true, "@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1255,8 +1460,8 @@ }, "@metamask/signature-controller>@metamask/eth-sig-util": { "packages": { - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@metamask/signature-controller>@metamask/eth-sig-util>@metamask/abi-utils": true, "@metamask/signature-controller>@metamask/eth-sig-util>@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1267,7 +1472,7 @@ }, "@metamask/keyring-controller>@metamask/eth-simple-keyring": { "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/keyring-controller>@metamask/eth-simple-keyring>@ethereumjs/util": true, "@metamask/keyring-controller>@metamask/eth-simple-keyring>@metamask/eth-sig-util": true, "@metamask/utils": true, "browserify>buffer": true, @@ -1286,7 +1491,7 @@ "@metamask/eth-snap-keyring>@metamask/eth-sig-util": true, "@metamask/keyring-api": true, "@metamask/eth-snap-keyring>@metamask/keyring-internal-snap-client": true, - "@metamask/keyring-api>@metamask/keyring-utils": true, + "@metamask/eth-snap-keyring>@metamask/keyring-utils": true, "@metamask/utils>@metamask/superstruct": true, "@metamask/utils": true, "webpack>events": true, @@ -1315,12 +1520,12 @@ }, "packages": { "@ethereumjs/tx": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/eth-trezor-keyring>@ethereumjs/util": true, "@metamask/eth-trezor-keyring>@metamask/eth-sig-util": true, + "@metamask/utils": true, "@metamask/eth-trezor-keyring>@trezor/connect-plugin-ethereum": true, "@trezor/connect-web": true, "browserify>buffer": true, - "webpack>events": true, "@metamask/eth-trezor-keyring>hdkey": true } }, @@ -1448,7 +1653,7 @@ "console.log": true }, "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/keyring-controller>@ethereumjs/util": true, "@metamask/base-controller": true, "@metamask/browser-passworder": true, "@metamask/keyring-controller>@metamask/eth-hd-keyring": true, @@ -1473,6 +1678,26 @@ "@metamask/keyring-snap-client>uuid": true } }, + "@metamask/accounts-controller>@metamask/keyring-utils": { + "globals": { + "URL": true + }, + "packages": { + "@metamask/utils>@metamask/superstruct": true, + "@metamask/utils": true, + "bitcoin-address-validation": true + } + }, + "@metamask/eth-snap-keyring>@metamask/keyring-utils": { + "globals": { + "URL": true + }, + "packages": { + "@metamask/utils>@metamask/superstruct": true, + "@metamask/utils": true, + "bitcoin-address-validation": true + } + }, "@metamask/keyring-api>@metamask/keyring-utils": { "globals": { "URL": true @@ -1860,7 +2085,7 @@ "setInterval": true }, "packages": { - "@metamask/smart-transactions-controller>@ethereumjs/tx": true, + "@ethereumjs/tx": true, "@metamask/smart-transactions-controller>@ethereumjs/util": true, "@ethersproject/bytes": true, "@metamask/controller-utils": true, @@ -2067,11 +2292,10 @@ "packages": { "@ethereumjs/tx>@ethereumjs/common": true, "@ethereumjs/tx": true, - "@ethereumjs/tx>@ethereumjs/util": true, "@ethersproject/abi": true, "@ethersproject/contracts": true, "@ethersproject/providers": true, - "@metamask/transaction-controller>@metamask/base-controller": true, + "@metamask/base-controller": true, "@metamask/controller-utils": true, "@metamask/controller-utils>@metamask/eth-query": true, "@metamask/gas-fee-controller": true, @@ -3392,7 +3616,7 @@ "copy-to-clipboard>toggle-selection": true } }, - "@ethereumjs/tx>@ethereumjs/common>crc-32": { + "eth-lattice-keyring>gridplus-sdk>crc-32": { "globals": { "DO_NOT_EXPORT_CRC": true, "define": true @@ -3644,7 +3868,7 @@ }, "packages": { "eth-lattice-keyring>@ethereumjs/tx": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/util": true, "bn.js": true, "browserify>buffer": true, "crypto-browserify": true, @@ -3915,7 +4139,7 @@ "eth-lattice-keyring>gridplus-sdk>borc": true, "ethereumjs-util>ethereum-cryptography>bs58check": true, "browserify>buffer": true, - "@ethereumjs/tx>@ethereumjs/common>crc-32": true, + "eth-lattice-keyring>gridplus-sdk>crc-32": true, "@metamask/ppom-validator>elliptic": true, "eth-lattice-keyring>gridplus-sdk>eth-eip712-util-browser": true, "ethers>@ethersproject/sha2>hash.js": true, @@ -4343,7 +4567,7 @@ "react-markdown>unist-util-visit": true } }, - "@ethereumjs/tx>@ethereumjs/util>micro-ftch": { + "eth-lattice-keyring>@ethereumjs/util>micro-ftch": { "globals": { "Headers": true, "TextDecoder": true, diff --git a/lavamoat/browserify/flask/policy.json b/lavamoat/browserify/flask/policy.json index dd6e3267ec4e..2e3da47bf801 100644 --- a/lavamoat/browserify/flask/policy.json +++ b/lavamoat/browserify/flask/policy.json @@ -40,31 +40,47 @@ }, "@ethereumjs/tx>@ethereumjs/common": { "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "@ethereumjs/tx>@ethereumjs/common>@ethereumjs/util": true, + "webpack>events": true + } + }, + "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@ethereumjs/tx>@ethereumjs/common": { + "packages": { + "eth-lattice-keyring>@ethereumjs/util": true, "browserify>buffer": true, - "@ethereumjs/tx>@ethereumjs/common>crc-32": true, + "eth-lattice-keyring>gridplus-sdk>crc-32": true, "webpack>events": true } }, - "@metamask/smart-transactions-controller>@ethereumjs/tx>@ethereumjs/common": { + "@keystonehq/metamask-airgapped-keyring>@ethereumjs/tx>@ethereumjs/common": { "packages": { - "@metamask/smart-transactions-controller>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/util": true, + "browserify>buffer": true, + "eth-lattice-keyring>gridplus-sdk>crc-32": true, + "webpack>events": true + } + }, + "eth-lattice-keyring>@ethereumjs/tx>@ethereumjs/common": { + "packages": { + "eth-lattice-keyring>@ethereumjs/util": true, + "browserify>buffer": true, + "eth-lattice-keyring>gridplus-sdk>crc-32": true, "webpack>events": true } }, "eth-lattice-keyring>gridplus-sdk>@ethereumjs/tx>@ethereumjs/common": { "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/util": true, "browserify>buffer": true, - "@ethereumjs/tx>@ethereumjs/common>crc-32": true, + "eth-lattice-keyring>gridplus-sdk>crc-32": true, "webpack>events": true } }, "eth-lattice-keyring>gridplus-sdk>@ethereumjs/common": { "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/util": true, "browserify>buffer": true, - "@ethereumjs/tx>@ethereumjs/common>crc-32": true, + "eth-lattice-keyring>gridplus-sdk>crc-32": true, "webpack>events": true } }, @@ -73,7 +89,42 @@ "TextEncoder": true } }, - "@metamask/smart-transactions-controller>@ethereumjs/tx>@ethereumjs/rlp": { + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": { + "globals": { + "TextEncoder": true + } + }, + "@ethereumjs/tx>@ethereumjs/common>@ethereumjs/util>@ethereumjs/rlp": { + "globals": { + "TextEncoder": true + } + }, + "@metamask/controller-utils>@ethereumjs/util>@ethereumjs/rlp": { + "globals": { + "TextEncoder": true + } + }, + "@metamask/keyring-controller>@metamask/eth-hd-keyring>@ethereumjs/util>@ethereumjs/rlp": { + "globals": { + "TextEncoder": true + } + }, + "@metamask/keyring-controller>@metamask/eth-simple-keyring>@ethereumjs/util>@ethereumjs/rlp": { + "globals": { + "TextEncoder": true + } + }, + "@metamask/eth-trezor-keyring>@ethereumjs/util>@ethereumjs/rlp": { + "globals": { + "TextEncoder": true + } + }, + "@metamask/keyring-controller>@ethereumjs/util>@ethereumjs/rlp": { + "globals": { + "TextEncoder": true + } + }, + "@metamask/smart-transactions-controller>@ethereumjs/util>@ethereumjs/rlp": { "globals": { "TextEncoder": true } @@ -93,25 +144,35 @@ "@ethereumjs/tx>@ethereumjs/common": true, "@ethereumjs/tx>@ethereumjs/rlp": true, "@ethereumjs/tx>@ethereumjs/util": true, + "@ethereumjs/tx>ethereum-cryptography": true + } + }, + "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@ethereumjs/tx": { + "packages": { + "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@ethereumjs/tx>@ethereumjs/common": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "eth-lattice-keyring>@ethereumjs/util": true, "browserify>buffer": true, "@ethereumjs/tx>ethereum-cryptography": true, "browserify>insert-module-globals>is-buffer": true } }, - "@metamask/smart-transactions-controller>@ethereumjs/tx": { + "@keystonehq/metamask-airgapped-keyring>@ethereumjs/tx": { "packages": { - "@metamask/smart-transactions-controller>@ethereumjs/tx>@ethereumjs/common": true, - "@metamask/smart-transactions-controller>@ethereumjs/tx>@ethereumjs/rlp": true, - "@metamask/smart-transactions-controller>@ethereumjs/util": true, - "@ethereumjs/tx>ethereum-cryptography": true + "@keystonehq/metamask-airgapped-keyring>@ethereumjs/tx>@ethereumjs/common": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "eth-lattice-keyring>@ethereumjs/util": true, + "browserify>buffer": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "browserify>insert-module-globals>is-buffer": true } }, "eth-lattice-keyring>@ethereumjs/tx": { "packages": { "eth-lattice-keyring>@ethereumjs/tx>@chainsafe/ssz": true, - "@ethereumjs/tx>@ethereumjs/common": true, - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/tx>@ethereumjs/common": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@ethersproject/providers": true, "browserify>buffer": true, "eth-lattice-keyring>@ethereumjs/tx>ethereum-cryptography": true, @@ -122,25 +183,165 @@ "packages": { "eth-lattice-keyring>@ethereumjs/tx>@chainsafe/ssz": true, "eth-lattice-keyring>gridplus-sdk>@ethereumjs/tx>@ethereumjs/common": true, - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@ethersproject/providers": true, "browserify>buffer": true, "eth-lattice-keyring>gridplus-sdk>@ethereumjs/tx>ethereum-cryptography": true, "browserify>insert-module-globals>is-buffer": true } }, + "@ethereumjs/tx>@ethereumjs/common>@ethereumjs/util": { + "globals": { + "console.warn": true, + "fetch": true + }, + "packages": { + "@ethereumjs/tx>@ethereumjs/common>@ethereumjs/util>@ethereumjs/rlp": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true + } + }, "@ethereumjs/tx>@ethereumjs/util": { "globals": { - "console.warn": true + "console.warn": true, + "fetch": true }, "packages": { "@ethereumjs/tx>@ethereumjs/rlp": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true + } + }, + "@metamask/controller-utils>@ethereumjs/util": { + "globals": { + "console.warn": true, + "fetch": true + }, + "packages": { + "@metamask/controller-utils>@ethereumjs/util>@ethereumjs/rlp": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true + } + }, + "@metamask/keyring-controller>@metamask/eth-hd-keyring>@ethereumjs/util": { + "globals": { + "console.warn": true, + "fetch": true + }, + "packages": { + "@metamask/keyring-controller>@metamask/eth-hd-keyring>@ethereumjs/util>@ethereumjs/rlp": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true + } + }, + "@metamask/eth-ledger-bridge-keyring>@ethereumjs/util": { + "globals": { + "console.warn": true, + "fetch": true + }, + "packages": { + "@metamask/eth-ledger-bridge-keyring>@ethereumjs/rlp": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true + } + }, + "@metamask/keyring-controller>@metamask/eth-hd-keyring>@metamask/eth-sig-util>@ethereumjs/util": { + "globals": { + "console.warn": true + }, + "packages": { + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "browserify>buffer": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true, + "browserify>insert-module-globals>is-buffer": true, + "eth-lattice-keyring>@ethereumjs/util>micro-ftch": true + } + }, + "@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@ethereumjs/util": { + "globals": { + "console.warn": true + }, + "packages": { + "@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@ethereumjs/rlp": true, "browserify>buffer": true, "@ethereumjs/tx>ethereum-cryptography": true, "webpack>events": true, "browserify>insert-module-globals>is-buffer": true, - "@ethereumjs/tx>@ethereumjs/util>micro-ftch": true + "eth-lattice-keyring>@ethereumjs/util>micro-ftch": true + } + }, + "@metamask/keyring-controller>@metamask/eth-simple-keyring>@metamask/eth-sig-util>@ethereumjs/util": { + "globals": { + "console.warn": true + }, + "packages": { + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "browserify>buffer": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true, + "browserify>insert-module-globals>is-buffer": true, + "eth-lattice-keyring>@ethereumjs/util>micro-ftch": true + } + }, + "@metamask/eth-trezor-keyring>@metamask/eth-sig-util>@ethereumjs/util": { + "globals": { + "console.warn": true + }, + "packages": { + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "browserify>buffer": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true, + "browserify>insert-module-globals>is-buffer": true, + "eth-lattice-keyring>@ethereumjs/util>micro-ftch": true + } + }, + "@metamask/keyring-controller>@metamask/eth-sig-util>@ethereumjs/util": { + "globals": { + "console.warn": true + }, + "packages": { + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "browserify>buffer": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true, + "browserify>insert-module-globals>is-buffer": true, + "eth-lattice-keyring>@ethereumjs/util>micro-ftch": true + } + }, + "@metamask/keyring-controller>@metamask/eth-simple-keyring>@ethereumjs/util": { + "globals": { + "console.warn": true, + "fetch": true + }, + "packages": { + "@metamask/keyring-controller>@metamask/eth-simple-keyring>@ethereumjs/util>@ethereumjs/rlp": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true + } + }, + "@metamask/eth-trezor-keyring>@ethereumjs/util": { + "globals": { + "console.warn": true, + "fetch": true + }, + "packages": { + "@metamask/eth-trezor-keyring>@ethereumjs/util>@ethereumjs/rlp": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true + } + }, + "@metamask/keyring-controller>@ethereumjs/util": { + "globals": { + "console.warn": true, + "fetch": true + }, + "packages": { + "@metamask/keyring-controller>@ethereumjs/util>@ethereumjs/rlp": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true } }, "@metamask/smart-transactions-controller>@ethereumjs/util": { @@ -149,11 +350,24 @@ "fetch": true }, "packages": { - "@metamask/smart-transactions-controller>@ethereumjs/tx>@ethereumjs/rlp": true, + "@metamask/smart-transactions-controller>@ethereumjs/util>@ethereumjs/rlp": true, "@ethereumjs/tx>ethereum-cryptography": true, "webpack>events": true } }, + "eth-lattice-keyring>@ethereumjs/util": { + "globals": { + "console.warn": true + }, + "packages": { + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "browserify>buffer": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true, + "browserify>insert-module-globals>is-buffer": true, + "eth-lattice-keyring>@ethereumjs/util>micro-ftch": true + } + }, "@ethersproject/abi": { "globals": { "console.log": true @@ -622,8 +836,8 @@ }, "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring": { "packages": { - "@ethereumjs/tx": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@ethereumjs/tx": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@keystonehq/bc-ur-registry-eth": true, "browserify>buffer": true, "@metamask/eth-trezor-keyring>hdkey": true, @@ -633,7 +847,7 @@ }, "@keystonehq/bc-ur-registry-eth": { "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry": true, "browserify>buffer": true, "@metamask/eth-trezor-keyring>hdkey": true, @@ -654,7 +868,7 @@ }, "@keystonehq/metamask-airgapped-keyring": { "packages": { - "@ethereumjs/tx": true, + "@keystonehq/metamask-airgapped-keyring>@ethereumjs/tx": true, "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring": true, "@keystonehq/bc-ur-registry-eth": true, "@metamask/obs-store": true, @@ -875,12 +1089,11 @@ }, "@metamask/accounts-controller": { "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, "@metamask/base-controller": true, "@metamask/eth-snap-keyring": true, "@metamask/keyring-api": true, "@metamask/keyring-controller": true, - "@metamask/keyring-api>@metamask/keyring-utils": true, + "@metamask/accounts-controller>@metamask/keyring-utils": true, "@metamask/utils": true, "@ethereumjs/tx>ethereum-cryptography": true, "uuid": true @@ -921,7 +1134,7 @@ "setTimeout": true }, "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/util": true, "ethers>@ethersproject/address": true, "@ethersproject/bignumber": true, "@ethersproject/contracts": true, @@ -1002,14 +1215,6 @@ "immer": true } }, - "@metamask/transaction-controller>@metamask/base-controller": { - "globals": { - "setTimeout": true - }, - "packages": { - "immer": true - } - }, "@metamask/browser-passworder": { "globals": { "CryptoKey": true, @@ -1039,7 +1244,7 @@ "setTimeout": true }, "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/controller-utils>@ethereumjs/util": true, "@metamask/controller-utils>@metamask/ethjs-unit": true, "@metamask/utils": true, "@metamask/controller-utils>@spruceid/siwe-parser": true, @@ -1076,7 +1281,7 @@ "TextEncoder": true }, "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/keyring-controller>@metamask/eth-hd-keyring>@ethereumjs/util": true, "@metamask/keyring-controller>@metamask/eth-hd-keyring>@metamask/eth-sig-util": true, "@metamask/snaps-sdk>@metamask/key-tree": true, "@metamask/scure-bip39": true, @@ -1144,11 +1349,11 @@ "packages": { "@metamask/eth-ledger-bridge-keyring>@ethereumjs/rlp": true, "@ethereumjs/tx": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/eth-ledger-bridge-keyring>@ethereumjs/util": true, "@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth": true, "@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util": true, + "@metamask/utils": true, "browserify>buffer": true, - "webpack>events": true, "@metamask/eth-trezor-keyring>hdkey": true } }, @@ -1160,7 +1365,7 @@ }, "@metamask/eth-sig-util": { "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@metamask/abi-utils": true, "@metamask/eth-sig-util>@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1171,8 +1376,8 @@ }, "@metamask/keyring-controller>@metamask/eth-hd-keyring>@metamask/eth-sig-util": { "packages": { - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "@metamask/keyring-controller>@metamask/eth-hd-keyring>@metamask/eth-sig-util>@ethereumjs/util": true, "@metamask/keyring-controller>@metamask/eth-hd-keyring>@metamask/eth-sig-util>@metamask/abi-utils": true, "@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1183,8 +1388,8 @@ }, "@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util": { "packages": { - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@metamask/abi-utils": true, "@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1196,7 +1401,7 @@ "@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util": { "packages": { "@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@ethereumjs/util": true, "@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@metamask/abi-utils": true, "@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1207,8 +1412,8 @@ }, "@metamask/keyring-controller>@metamask/eth-simple-keyring>@metamask/eth-sig-util": { "packages": { - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "@metamask/keyring-controller>@metamask/eth-simple-keyring>@metamask/eth-sig-util>@ethereumjs/util": true, "@metamask/keyring-controller>@metamask/eth-simple-keyring>@metamask/eth-sig-util>@metamask/abi-utils": true, "@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1219,8 +1424,8 @@ }, "@metamask/eth-snap-keyring>@metamask/eth-sig-util": { "packages": { - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@metamask/eth-snap-keyring>@metamask/eth-sig-util>@metamask/abi-utils": true, "@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1231,8 +1436,8 @@ }, "@metamask/eth-trezor-keyring>@metamask/eth-sig-util": { "packages": { - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "@metamask/eth-trezor-keyring>@metamask/eth-sig-util>@ethereumjs/util": true, "@metamask/eth-trezor-keyring>@metamask/eth-sig-util>@metamask/abi-utils": true, "@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1243,8 +1448,8 @@ }, "@metamask/keyring-controller>@metamask/eth-sig-util": { "packages": { - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "@metamask/keyring-controller>@metamask/eth-sig-util>@ethereumjs/util": true, "@metamask/keyring-controller>@metamask/eth-sig-util>@metamask/abi-utils": true, "@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1255,8 +1460,8 @@ }, "@metamask/signature-controller>@metamask/eth-sig-util": { "packages": { - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@metamask/signature-controller>@metamask/eth-sig-util>@metamask/abi-utils": true, "@metamask/signature-controller>@metamask/eth-sig-util>@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1267,7 +1472,7 @@ }, "@metamask/keyring-controller>@metamask/eth-simple-keyring": { "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/keyring-controller>@metamask/eth-simple-keyring>@ethereumjs/util": true, "@metamask/keyring-controller>@metamask/eth-simple-keyring>@metamask/eth-sig-util": true, "@metamask/utils": true, "browserify>buffer": true, @@ -1286,7 +1491,7 @@ "@metamask/eth-snap-keyring>@metamask/eth-sig-util": true, "@metamask/keyring-api": true, "@metamask/eth-snap-keyring>@metamask/keyring-internal-snap-client": true, - "@metamask/keyring-api>@metamask/keyring-utils": true, + "@metamask/eth-snap-keyring>@metamask/keyring-utils": true, "@metamask/utils>@metamask/superstruct": true, "@metamask/utils": true, "webpack>events": true, @@ -1315,12 +1520,12 @@ }, "packages": { "@ethereumjs/tx": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/eth-trezor-keyring>@ethereumjs/util": true, "@metamask/eth-trezor-keyring>@metamask/eth-sig-util": true, + "@metamask/utils": true, "@metamask/eth-trezor-keyring>@trezor/connect-plugin-ethereum": true, "@trezor/connect-web": true, "browserify>buffer": true, - "webpack>events": true, "@metamask/eth-trezor-keyring>hdkey": true } }, @@ -1448,7 +1653,7 @@ "console.log": true }, "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/keyring-controller>@ethereumjs/util": true, "@metamask/base-controller": true, "@metamask/browser-passworder": true, "@metamask/keyring-controller>@metamask/eth-hd-keyring": true, @@ -1473,6 +1678,26 @@ "@metamask/keyring-snap-client>uuid": true } }, + "@metamask/accounts-controller>@metamask/keyring-utils": { + "globals": { + "URL": true + }, + "packages": { + "@metamask/utils>@metamask/superstruct": true, + "@metamask/utils": true, + "bitcoin-address-validation": true + } + }, + "@metamask/eth-snap-keyring>@metamask/keyring-utils": { + "globals": { + "URL": true + }, + "packages": { + "@metamask/utils>@metamask/superstruct": true, + "@metamask/utils": true, + "bitcoin-address-validation": true + } + }, "@metamask/keyring-api>@metamask/keyring-utils": { "globals": { "URL": true @@ -1860,7 +2085,7 @@ "setInterval": true }, "packages": { - "@metamask/smart-transactions-controller>@ethereumjs/tx": true, + "@ethereumjs/tx": true, "@metamask/smart-transactions-controller>@ethereumjs/util": true, "@ethersproject/bytes": true, "@metamask/controller-utils": true, @@ -2067,11 +2292,10 @@ "packages": { "@ethereumjs/tx>@ethereumjs/common": true, "@ethereumjs/tx": true, - "@ethereumjs/tx>@ethereumjs/util": true, "@ethersproject/abi": true, "@ethersproject/contracts": true, "@ethersproject/providers": true, - "@metamask/transaction-controller>@metamask/base-controller": true, + "@metamask/base-controller": true, "@metamask/controller-utils": true, "@metamask/controller-utils>@metamask/eth-query": true, "@metamask/gas-fee-controller": true, @@ -3392,7 +3616,7 @@ "copy-to-clipboard>toggle-selection": true } }, - "@ethereumjs/tx>@ethereumjs/common>crc-32": { + "eth-lattice-keyring>gridplus-sdk>crc-32": { "globals": { "DO_NOT_EXPORT_CRC": true, "define": true @@ -3644,7 +3868,7 @@ }, "packages": { "eth-lattice-keyring>@ethereumjs/tx": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/util": true, "bn.js": true, "browserify>buffer": true, "crypto-browserify": true, @@ -3915,7 +4139,7 @@ "eth-lattice-keyring>gridplus-sdk>borc": true, "ethereumjs-util>ethereum-cryptography>bs58check": true, "browserify>buffer": true, - "@ethereumjs/tx>@ethereumjs/common>crc-32": true, + "eth-lattice-keyring>gridplus-sdk>crc-32": true, "@metamask/ppom-validator>elliptic": true, "eth-lattice-keyring>gridplus-sdk>eth-eip712-util-browser": true, "ethers>@ethersproject/sha2>hash.js": true, @@ -4343,7 +4567,7 @@ "react-markdown>unist-util-visit": true } }, - "@ethereumjs/tx>@ethereumjs/util>micro-ftch": { + "eth-lattice-keyring>@ethereumjs/util>micro-ftch": { "globals": { "Headers": true, "TextDecoder": true, diff --git a/lavamoat/browserify/main/policy.json b/lavamoat/browserify/main/policy.json index dd6e3267ec4e..2e3da47bf801 100644 --- a/lavamoat/browserify/main/policy.json +++ b/lavamoat/browserify/main/policy.json @@ -40,31 +40,47 @@ }, "@ethereumjs/tx>@ethereumjs/common": { "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "@ethereumjs/tx>@ethereumjs/common>@ethereumjs/util": true, + "webpack>events": true + } + }, + "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@ethereumjs/tx>@ethereumjs/common": { + "packages": { + "eth-lattice-keyring>@ethereumjs/util": true, "browserify>buffer": true, - "@ethereumjs/tx>@ethereumjs/common>crc-32": true, + "eth-lattice-keyring>gridplus-sdk>crc-32": true, "webpack>events": true } }, - "@metamask/smart-transactions-controller>@ethereumjs/tx>@ethereumjs/common": { + "@keystonehq/metamask-airgapped-keyring>@ethereumjs/tx>@ethereumjs/common": { "packages": { - "@metamask/smart-transactions-controller>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/util": true, + "browserify>buffer": true, + "eth-lattice-keyring>gridplus-sdk>crc-32": true, + "webpack>events": true + } + }, + "eth-lattice-keyring>@ethereumjs/tx>@ethereumjs/common": { + "packages": { + "eth-lattice-keyring>@ethereumjs/util": true, + "browserify>buffer": true, + "eth-lattice-keyring>gridplus-sdk>crc-32": true, "webpack>events": true } }, "eth-lattice-keyring>gridplus-sdk>@ethereumjs/tx>@ethereumjs/common": { "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/util": true, "browserify>buffer": true, - "@ethereumjs/tx>@ethereumjs/common>crc-32": true, + "eth-lattice-keyring>gridplus-sdk>crc-32": true, "webpack>events": true } }, "eth-lattice-keyring>gridplus-sdk>@ethereumjs/common": { "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/util": true, "browserify>buffer": true, - "@ethereumjs/tx>@ethereumjs/common>crc-32": true, + "eth-lattice-keyring>gridplus-sdk>crc-32": true, "webpack>events": true } }, @@ -73,7 +89,42 @@ "TextEncoder": true } }, - "@metamask/smart-transactions-controller>@ethereumjs/tx>@ethereumjs/rlp": { + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": { + "globals": { + "TextEncoder": true + } + }, + "@ethereumjs/tx>@ethereumjs/common>@ethereumjs/util>@ethereumjs/rlp": { + "globals": { + "TextEncoder": true + } + }, + "@metamask/controller-utils>@ethereumjs/util>@ethereumjs/rlp": { + "globals": { + "TextEncoder": true + } + }, + "@metamask/keyring-controller>@metamask/eth-hd-keyring>@ethereumjs/util>@ethereumjs/rlp": { + "globals": { + "TextEncoder": true + } + }, + "@metamask/keyring-controller>@metamask/eth-simple-keyring>@ethereumjs/util>@ethereumjs/rlp": { + "globals": { + "TextEncoder": true + } + }, + "@metamask/eth-trezor-keyring>@ethereumjs/util>@ethereumjs/rlp": { + "globals": { + "TextEncoder": true + } + }, + "@metamask/keyring-controller>@ethereumjs/util>@ethereumjs/rlp": { + "globals": { + "TextEncoder": true + } + }, + "@metamask/smart-transactions-controller>@ethereumjs/util>@ethereumjs/rlp": { "globals": { "TextEncoder": true } @@ -93,25 +144,35 @@ "@ethereumjs/tx>@ethereumjs/common": true, "@ethereumjs/tx>@ethereumjs/rlp": true, "@ethereumjs/tx>@ethereumjs/util": true, + "@ethereumjs/tx>ethereum-cryptography": true + } + }, + "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@ethereumjs/tx": { + "packages": { + "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@ethereumjs/tx>@ethereumjs/common": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "eth-lattice-keyring>@ethereumjs/util": true, "browserify>buffer": true, "@ethereumjs/tx>ethereum-cryptography": true, "browserify>insert-module-globals>is-buffer": true } }, - "@metamask/smart-transactions-controller>@ethereumjs/tx": { + "@keystonehq/metamask-airgapped-keyring>@ethereumjs/tx": { "packages": { - "@metamask/smart-transactions-controller>@ethereumjs/tx>@ethereumjs/common": true, - "@metamask/smart-transactions-controller>@ethereumjs/tx>@ethereumjs/rlp": true, - "@metamask/smart-transactions-controller>@ethereumjs/util": true, - "@ethereumjs/tx>ethereum-cryptography": true + "@keystonehq/metamask-airgapped-keyring>@ethereumjs/tx>@ethereumjs/common": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "eth-lattice-keyring>@ethereumjs/util": true, + "browserify>buffer": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "browserify>insert-module-globals>is-buffer": true } }, "eth-lattice-keyring>@ethereumjs/tx": { "packages": { "eth-lattice-keyring>@ethereumjs/tx>@chainsafe/ssz": true, - "@ethereumjs/tx>@ethereumjs/common": true, - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/tx>@ethereumjs/common": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@ethersproject/providers": true, "browserify>buffer": true, "eth-lattice-keyring>@ethereumjs/tx>ethereum-cryptography": true, @@ -122,25 +183,165 @@ "packages": { "eth-lattice-keyring>@ethereumjs/tx>@chainsafe/ssz": true, "eth-lattice-keyring>gridplus-sdk>@ethereumjs/tx>@ethereumjs/common": true, - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@ethersproject/providers": true, "browserify>buffer": true, "eth-lattice-keyring>gridplus-sdk>@ethereumjs/tx>ethereum-cryptography": true, "browserify>insert-module-globals>is-buffer": true } }, + "@ethereumjs/tx>@ethereumjs/common>@ethereumjs/util": { + "globals": { + "console.warn": true, + "fetch": true + }, + "packages": { + "@ethereumjs/tx>@ethereumjs/common>@ethereumjs/util>@ethereumjs/rlp": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true + } + }, "@ethereumjs/tx>@ethereumjs/util": { "globals": { - "console.warn": true + "console.warn": true, + "fetch": true }, "packages": { "@ethereumjs/tx>@ethereumjs/rlp": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true + } + }, + "@metamask/controller-utils>@ethereumjs/util": { + "globals": { + "console.warn": true, + "fetch": true + }, + "packages": { + "@metamask/controller-utils>@ethereumjs/util>@ethereumjs/rlp": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true + } + }, + "@metamask/keyring-controller>@metamask/eth-hd-keyring>@ethereumjs/util": { + "globals": { + "console.warn": true, + "fetch": true + }, + "packages": { + "@metamask/keyring-controller>@metamask/eth-hd-keyring>@ethereumjs/util>@ethereumjs/rlp": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true + } + }, + "@metamask/eth-ledger-bridge-keyring>@ethereumjs/util": { + "globals": { + "console.warn": true, + "fetch": true + }, + "packages": { + "@metamask/eth-ledger-bridge-keyring>@ethereumjs/rlp": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true + } + }, + "@metamask/keyring-controller>@metamask/eth-hd-keyring>@metamask/eth-sig-util>@ethereumjs/util": { + "globals": { + "console.warn": true + }, + "packages": { + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "browserify>buffer": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true, + "browserify>insert-module-globals>is-buffer": true, + "eth-lattice-keyring>@ethereumjs/util>micro-ftch": true + } + }, + "@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@ethereumjs/util": { + "globals": { + "console.warn": true + }, + "packages": { + "@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@ethereumjs/rlp": true, "browserify>buffer": true, "@ethereumjs/tx>ethereum-cryptography": true, "webpack>events": true, "browserify>insert-module-globals>is-buffer": true, - "@ethereumjs/tx>@ethereumjs/util>micro-ftch": true + "eth-lattice-keyring>@ethereumjs/util>micro-ftch": true + } + }, + "@metamask/keyring-controller>@metamask/eth-simple-keyring>@metamask/eth-sig-util>@ethereumjs/util": { + "globals": { + "console.warn": true + }, + "packages": { + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "browserify>buffer": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true, + "browserify>insert-module-globals>is-buffer": true, + "eth-lattice-keyring>@ethereumjs/util>micro-ftch": true + } + }, + "@metamask/eth-trezor-keyring>@metamask/eth-sig-util>@ethereumjs/util": { + "globals": { + "console.warn": true + }, + "packages": { + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "browserify>buffer": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true, + "browserify>insert-module-globals>is-buffer": true, + "eth-lattice-keyring>@ethereumjs/util>micro-ftch": true + } + }, + "@metamask/keyring-controller>@metamask/eth-sig-util>@ethereumjs/util": { + "globals": { + "console.warn": true + }, + "packages": { + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "browserify>buffer": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true, + "browserify>insert-module-globals>is-buffer": true, + "eth-lattice-keyring>@ethereumjs/util>micro-ftch": true + } + }, + "@metamask/keyring-controller>@metamask/eth-simple-keyring>@ethereumjs/util": { + "globals": { + "console.warn": true, + "fetch": true + }, + "packages": { + "@metamask/keyring-controller>@metamask/eth-simple-keyring>@ethereumjs/util>@ethereumjs/rlp": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true + } + }, + "@metamask/eth-trezor-keyring>@ethereumjs/util": { + "globals": { + "console.warn": true, + "fetch": true + }, + "packages": { + "@metamask/eth-trezor-keyring>@ethereumjs/util>@ethereumjs/rlp": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true + } + }, + "@metamask/keyring-controller>@ethereumjs/util": { + "globals": { + "console.warn": true, + "fetch": true + }, + "packages": { + "@metamask/keyring-controller>@ethereumjs/util>@ethereumjs/rlp": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true } }, "@metamask/smart-transactions-controller>@ethereumjs/util": { @@ -149,11 +350,24 @@ "fetch": true }, "packages": { - "@metamask/smart-transactions-controller>@ethereumjs/tx>@ethereumjs/rlp": true, + "@metamask/smart-transactions-controller>@ethereumjs/util>@ethereumjs/rlp": true, "@ethereumjs/tx>ethereum-cryptography": true, "webpack>events": true } }, + "eth-lattice-keyring>@ethereumjs/util": { + "globals": { + "console.warn": true + }, + "packages": { + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "browserify>buffer": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true, + "browserify>insert-module-globals>is-buffer": true, + "eth-lattice-keyring>@ethereumjs/util>micro-ftch": true + } + }, "@ethersproject/abi": { "globals": { "console.log": true @@ -622,8 +836,8 @@ }, "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring": { "packages": { - "@ethereumjs/tx": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@ethereumjs/tx": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@keystonehq/bc-ur-registry-eth": true, "browserify>buffer": true, "@metamask/eth-trezor-keyring>hdkey": true, @@ -633,7 +847,7 @@ }, "@keystonehq/bc-ur-registry-eth": { "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry": true, "browserify>buffer": true, "@metamask/eth-trezor-keyring>hdkey": true, @@ -654,7 +868,7 @@ }, "@keystonehq/metamask-airgapped-keyring": { "packages": { - "@ethereumjs/tx": true, + "@keystonehq/metamask-airgapped-keyring>@ethereumjs/tx": true, "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring": true, "@keystonehq/bc-ur-registry-eth": true, "@metamask/obs-store": true, @@ -875,12 +1089,11 @@ }, "@metamask/accounts-controller": { "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, "@metamask/base-controller": true, "@metamask/eth-snap-keyring": true, "@metamask/keyring-api": true, "@metamask/keyring-controller": true, - "@metamask/keyring-api>@metamask/keyring-utils": true, + "@metamask/accounts-controller>@metamask/keyring-utils": true, "@metamask/utils": true, "@ethereumjs/tx>ethereum-cryptography": true, "uuid": true @@ -921,7 +1134,7 @@ "setTimeout": true }, "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/util": true, "ethers>@ethersproject/address": true, "@ethersproject/bignumber": true, "@ethersproject/contracts": true, @@ -1002,14 +1215,6 @@ "immer": true } }, - "@metamask/transaction-controller>@metamask/base-controller": { - "globals": { - "setTimeout": true - }, - "packages": { - "immer": true - } - }, "@metamask/browser-passworder": { "globals": { "CryptoKey": true, @@ -1039,7 +1244,7 @@ "setTimeout": true }, "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/controller-utils>@ethereumjs/util": true, "@metamask/controller-utils>@metamask/ethjs-unit": true, "@metamask/utils": true, "@metamask/controller-utils>@spruceid/siwe-parser": true, @@ -1076,7 +1281,7 @@ "TextEncoder": true }, "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/keyring-controller>@metamask/eth-hd-keyring>@ethereumjs/util": true, "@metamask/keyring-controller>@metamask/eth-hd-keyring>@metamask/eth-sig-util": true, "@metamask/snaps-sdk>@metamask/key-tree": true, "@metamask/scure-bip39": true, @@ -1144,11 +1349,11 @@ "packages": { "@metamask/eth-ledger-bridge-keyring>@ethereumjs/rlp": true, "@ethereumjs/tx": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/eth-ledger-bridge-keyring>@ethereumjs/util": true, "@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth": true, "@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util": true, + "@metamask/utils": true, "browserify>buffer": true, - "webpack>events": true, "@metamask/eth-trezor-keyring>hdkey": true } }, @@ -1160,7 +1365,7 @@ }, "@metamask/eth-sig-util": { "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@metamask/abi-utils": true, "@metamask/eth-sig-util>@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1171,8 +1376,8 @@ }, "@metamask/keyring-controller>@metamask/eth-hd-keyring>@metamask/eth-sig-util": { "packages": { - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "@metamask/keyring-controller>@metamask/eth-hd-keyring>@metamask/eth-sig-util>@ethereumjs/util": true, "@metamask/keyring-controller>@metamask/eth-hd-keyring>@metamask/eth-sig-util>@metamask/abi-utils": true, "@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1183,8 +1388,8 @@ }, "@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util": { "packages": { - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@metamask/abi-utils": true, "@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1196,7 +1401,7 @@ "@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util": { "packages": { "@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@ethereumjs/util": true, "@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@metamask/abi-utils": true, "@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1207,8 +1412,8 @@ }, "@metamask/keyring-controller>@metamask/eth-simple-keyring>@metamask/eth-sig-util": { "packages": { - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "@metamask/keyring-controller>@metamask/eth-simple-keyring>@metamask/eth-sig-util>@ethereumjs/util": true, "@metamask/keyring-controller>@metamask/eth-simple-keyring>@metamask/eth-sig-util>@metamask/abi-utils": true, "@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1219,8 +1424,8 @@ }, "@metamask/eth-snap-keyring>@metamask/eth-sig-util": { "packages": { - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@metamask/eth-snap-keyring>@metamask/eth-sig-util>@metamask/abi-utils": true, "@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1231,8 +1436,8 @@ }, "@metamask/eth-trezor-keyring>@metamask/eth-sig-util": { "packages": { - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "@metamask/eth-trezor-keyring>@metamask/eth-sig-util>@ethereumjs/util": true, "@metamask/eth-trezor-keyring>@metamask/eth-sig-util>@metamask/abi-utils": true, "@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1243,8 +1448,8 @@ }, "@metamask/keyring-controller>@metamask/eth-sig-util": { "packages": { - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "@metamask/keyring-controller>@metamask/eth-sig-util>@ethereumjs/util": true, "@metamask/keyring-controller>@metamask/eth-sig-util>@metamask/abi-utils": true, "@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1255,8 +1460,8 @@ }, "@metamask/signature-controller>@metamask/eth-sig-util": { "packages": { - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@metamask/signature-controller>@metamask/eth-sig-util>@metamask/abi-utils": true, "@metamask/signature-controller>@metamask/eth-sig-util>@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1267,7 +1472,7 @@ }, "@metamask/keyring-controller>@metamask/eth-simple-keyring": { "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/keyring-controller>@metamask/eth-simple-keyring>@ethereumjs/util": true, "@metamask/keyring-controller>@metamask/eth-simple-keyring>@metamask/eth-sig-util": true, "@metamask/utils": true, "browserify>buffer": true, @@ -1286,7 +1491,7 @@ "@metamask/eth-snap-keyring>@metamask/eth-sig-util": true, "@metamask/keyring-api": true, "@metamask/eth-snap-keyring>@metamask/keyring-internal-snap-client": true, - "@metamask/keyring-api>@metamask/keyring-utils": true, + "@metamask/eth-snap-keyring>@metamask/keyring-utils": true, "@metamask/utils>@metamask/superstruct": true, "@metamask/utils": true, "webpack>events": true, @@ -1315,12 +1520,12 @@ }, "packages": { "@ethereumjs/tx": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/eth-trezor-keyring>@ethereumjs/util": true, "@metamask/eth-trezor-keyring>@metamask/eth-sig-util": true, + "@metamask/utils": true, "@metamask/eth-trezor-keyring>@trezor/connect-plugin-ethereum": true, "@trezor/connect-web": true, "browserify>buffer": true, - "webpack>events": true, "@metamask/eth-trezor-keyring>hdkey": true } }, @@ -1448,7 +1653,7 @@ "console.log": true }, "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/keyring-controller>@ethereumjs/util": true, "@metamask/base-controller": true, "@metamask/browser-passworder": true, "@metamask/keyring-controller>@metamask/eth-hd-keyring": true, @@ -1473,6 +1678,26 @@ "@metamask/keyring-snap-client>uuid": true } }, + "@metamask/accounts-controller>@metamask/keyring-utils": { + "globals": { + "URL": true + }, + "packages": { + "@metamask/utils>@metamask/superstruct": true, + "@metamask/utils": true, + "bitcoin-address-validation": true + } + }, + "@metamask/eth-snap-keyring>@metamask/keyring-utils": { + "globals": { + "URL": true + }, + "packages": { + "@metamask/utils>@metamask/superstruct": true, + "@metamask/utils": true, + "bitcoin-address-validation": true + } + }, "@metamask/keyring-api>@metamask/keyring-utils": { "globals": { "URL": true @@ -1860,7 +2085,7 @@ "setInterval": true }, "packages": { - "@metamask/smart-transactions-controller>@ethereumjs/tx": true, + "@ethereumjs/tx": true, "@metamask/smart-transactions-controller>@ethereumjs/util": true, "@ethersproject/bytes": true, "@metamask/controller-utils": true, @@ -2067,11 +2292,10 @@ "packages": { "@ethereumjs/tx>@ethereumjs/common": true, "@ethereumjs/tx": true, - "@ethereumjs/tx>@ethereumjs/util": true, "@ethersproject/abi": true, "@ethersproject/contracts": true, "@ethersproject/providers": true, - "@metamask/transaction-controller>@metamask/base-controller": true, + "@metamask/base-controller": true, "@metamask/controller-utils": true, "@metamask/controller-utils>@metamask/eth-query": true, "@metamask/gas-fee-controller": true, @@ -3392,7 +3616,7 @@ "copy-to-clipboard>toggle-selection": true } }, - "@ethereumjs/tx>@ethereumjs/common>crc-32": { + "eth-lattice-keyring>gridplus-sdk>crc-32": { "globals": { "DO_NOT_EXPORT_CRC": true, "define": true @@ -3644,7 +3868,7 @@ }, "packages": { "eth-lattice-keyring>@ethereumjs/tx": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/util": true, "bn.js": true, "browserify>buffer": true, "crypto-browserify": true, @@ -3915,7 +4139,7 @@ "eth-lattice-keyring>gridplus-sdk>borc": true, "ethereumjs-util>ethereum-cryptography>bs58check": true, "browserify>buffer": true, - "@ethereumjs/tx>@ethereumjs/common>crc-32": true, + "eth-lattice-keyring>gridplus-sdk>crc-32": true, "@metamask/ppom-validator>elliptic": true, "eth-lattice-keyring>gridplus-sdk>eth-eip712-util-browser": true, "ethers>@ethersproject/sha2>hash.js": true, @@ -4343,7 +4567,7 @@ "react-markdown>unist-util-visit": true } }, - "@ethereumjs/tx>@ethereumjs/util>micro-ftch": { + "eth-lattice-keyring>@ethereumjs/util>micro-ftch": { "globals": { "Headers": true, "TextDecoder": true, diff --git a/lavamoat/browserify/mmi/policy.json b/lavamoat/browserify/mmi/policy.json index 301984fedaba..a2071e6d0ea6 100644 --- a/lavamoat/browserify/mmi/policy.json +++ b/lavamoat/browserify/mmi/policy.json @@ -40,31 +40,47 @@ }, "@ethereumjs/tx>@ethereumjs/common": { "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "@ethereumjs/tx>@ethereumjs/common>@ethereumjs/util": true, + "webpack>events": true + } + }, + "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@ethereumjs/tx>@ethereumjs/common": { + "packages": { + "eth-lattice-keyring>@ethereumjs/util": true, "browserify>buffer": true, - "@ethereumjs/tx>@ethereumjs/common>crc-32": true, + "eth-lattice-keyring>gridplus-sdk>crc-32": true, "webpack>events": true } }, - "@metamask/smart-transactions-controller>@ethereumjs/tx>@ethereumjs/common": { + "@keystonehq/metamask-airgapped-keyring>@ethereumjs/tx>@ethereumjs/common": { "packages": { - "@metamask/smart-transactions-controller>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/util": true, + "browserify>buffer": true, + "eth-lattice-keyring>gridplus-sdk>crc-32": true, + "webpack>events": true + } + }, + "eth-lattice-keyring>@ethereumjs/tx>@ethereumjs/common": { + "packages": { + "eth-lattice-keyring>@ethereumjs/util": true, + "browserify>buffer": true, + "eth-lattice-keyring>gridplus-sdk>crc-32": true, "webpack>events": true } }, "eth-lattice-keyring>gridplus-sdk>@ethereumjs/tx>@ethereumjs/common": { "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/util": true, "browserify>buffer": true, - "@ethereumjs/tx>@ethereumjs/common>crc-32": true, + "eth-lattice-keyring>gridplus-sdk>crc-32": true, "webpack>events": true } }, "eth-lattice-keyring>gridplus-sdk>@ethereumjs/common": { "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/util": true, "browserify>buffer": true, - "@ethereumjs/tx>@ethereumjs/common>crc-32": true, + "eth-lattice-keyring>gridplus-sdk>crc-32": true, "webpack>events": true } }, @@ -73,7 +89,42 @@ "TextEncoder": true } }, - "@metamask/smart-transactions-controller>@ethereumjs/tx>@ethereumjs/rlp": { + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": { + "globals": { + "TextEncoder": true + } + }, + "@ethereumjs/tx>@ethereumjs/common>@ethereumjs/util>@ethereumjs/rlp": { + "globals": { + "TextEncoder": true + } + }, + "@metamask/controller-utils>@ethereumjs/util>@ethereumjs/rlp": { + "globals": { + "TextEncoder": true + } + }, + "@metamask/keyring-controller>@metamask/eth-hd-keyring>@ethereumjs/util>@ethereumjs/rlp": { + "globals": { + "TextEncoder": true + } + }, + "@metamask/keyring-controller>@metamask/eth-simple-keyring>@ethereumjs/util>@ethereumjs/rlp": { + "globals": { + "TextEncoder": true + } + }, + "@metamask/eth-trezor-keyring>@ethereumjs/util>@ethereumjs/rlp": { + "globals": { + "TextEncoder": true + } + }, + "@metamask/keyring-controller>@ethereumjs/util>@ethereumjs/rlp": { + "globals": { + "TextEncoder": true + } + }, + "@metamask/smart-transactions-controller>@ethereumjs/util>@ethereumjs/rlp": { "globals": { "TextEncoder": true } @@ -93,25 +144,35 @@ "@ethereumjs/tx>@ethereumjs/common": true, "@ethereumjs/tx>@ethereumjs/rlp": true, "@ethereumjs/tx>@ethereumjs/util": true, + "@ethereumjs/tx>ethereum-cryptography": true + } + }, + "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@ethereumjs/tx": { + "packages": { + "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@ethereumjs/tx>@ethereumjs/common": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "eth-lattice-keyring>@ethereumjs/util": true, "browserify>buffer": true, "@ethereumjs/tx>ethereum-cryptography": true, "browserify>insert-module-globals>is-buffer": true } }, - "@metamask/smart-transactions-controller>@ethereumjs/tx": { + "@keystonehq/metamask-airgapped-keyring>@ethereumjs/tx": { "packages": { - "@metamask/smart-transactions-controller>@ethereumjs/tx>@ethereumjs/common": true, - "@metamask/smart-transactions-controller>@ethereumjs/tx>@ethereumjs/rlp": true, - "@metamask/smart-transactions-controller>@ethereumjs/util": true, - "@ethereumjs/tx>ethereum-cryptography": true + "@keystonehq/metamask-airgapped-keyring>@ethereumjs/tx>@ethereumjs/common": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "eth-lattice-keyring>@ethereumjs/util": true, + "browserify>buffer": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "browserify>insert-module-globals>is-buffer": true } }, "eth-lattice-keyring>@ethereumjs/tx": { "packages": { "eth-lattice-keyring>@ethereumjs/tx>@chainsafe/ssz": true, - "@ethereumjs/tx>@ethereumjs/common": true, - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/tx>@ethereumjs/common": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@ethersproject/providers": true, "browserify>buffer": true, "eth-lattice-keyring>@ethereumjs/tx>ethereum-cryptography": true, @@ -122,25 +183,165 @@ "packages": { "eth-lattice-keyring>@ethereumjs/tx>@chainsafe/ssz": true, "eth-lattice-keyring>gridplus-sdk>@ethereumjs/tx>@ethereumjs/common": true, - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@ethersproject/providers": true, "browserify>buffer": true, "eth-lattice-keyring>gridplus-sdk>@ethereumjs/tx>ethereum-cryptography": true, "browserify>insert-module-globals>is-buffer": true } }, + "@ethereumjs/tx>@ethereumjs/common>@ethereumjs/util": { + "globals": { + "console.warn": true, + "fetch": true + }, + "packages": { + "@ethereumjs/tx>@ethereumjs/common>@ethereumjs/util>@ethereumjs/rlp": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true + } + }, "@ethereumjs/tx>@ethereumjs/util": { "globals": { - "console.warn": true + "console.warn": true, + "fetch": true }, "packages": { "@ethereumjs/tx>@ethereumjs/rlp": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true + } + }, + "@metamask/controller-utils>@ethereumjs/util": { + "globals": { + "console.warn": true, + "fetch": true + }, + "packages": { + "@metamask/controller-utils>@ethereumjs/util>@ethereumjs/rlp": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true + } + }, + "@metamask/keyring-controller>@metamask/eth-hd-keyring>@ethereumjs/util": { + "globals": { + "console.warn": true, + "fetch": true + }, + "packages": { + "@metamask/keyring-controller>@metamask/eth-hd-keyring>@ethereumjs/util>@ethereumjs/rlp": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true + } + }, + "@metamask/eth-ledger-bridge-keyring>@ethereumjs/util": { + "globals": { + "console.warn": true, + "fetch": true + }, + "packages": { + "@metamask/eth-ledger-bridge-keyring>@ethereumjs/rlp": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true + } + }, + "@metamask/keyring-controller>@metamask/eth-hd-keyring>@metamask/eth-sig-util>@ethereumjs/util": { + "globals": { + "console.warn": true + }, + "packages": { + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "browserify>buffer": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true, + "browserify>insert-module-globals>is-buffer": true, + "eth-lattice-keyring>@ethereumjs/util>micro-ftch": true + } + }, + "@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@ethereumjs/util": { + "globals": { + "console.warn": true + }, + "packages": { + "@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@ethereumjs/rlp": true, + "browserify>buffer": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true, + "browserify>insert-module-globals>is-buffer": true, + "eth-lattice-keyring>@ethereumjs/util>micro-ftch": true + } + }, + "@metamask/keyring-controller>@metamask/eth-simple-keyring>@metamask/eth-sig-util>@ethereumjs/util": { + "globals": { + "console.warn": true + }, + "packages": { + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "browserify>buffer": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true, + "browserify>insert-module-globals>is-buffer": true, + "eth-lattice-keyring>@ethereumjs/util>micro-ftch": true + } + }, + "@metamask/eth-trezor-keyring>@metamask/eth-sig-util>@ethereumjs/util": { + "globals": { + "console.warn": true + }, + "packages": { + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, "browserify>buffer": true, "@ethereumjs/tx>ethereum-cryptography": true, "webpack>events": true, "browserify>insert-module-globals>is-buffer": true, - "@ethereumjs/tx>@ethereumjs/util>micro-ftch": true + "eth-lattice-keyring>@ethereumjs/util>micro-ftch": true + } + }, + "@metamask/keyring-controller>@metamask/eth-sig-util>@ethereumjs/util": { + "globals": { + "console.warn": true + }, + "packages": { + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "browserify>buffer": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true, + "browserify>insert-module-globals>is-buffer": true, + "eth-lattice-keyring>@ethereumjs/util>micro-ftch": true + } + }, + "@metamask/keyring-controller>@metamask/eth-simple-keyring>@ethereumjs/util": { + "globals": { + "console.warn": true, + "fetch": true + }, + "packages": { + "@metamask/keyring-controller>@metamask/eth-simple-keyring>@ethereumjs/util>@ethereumjs/rlp": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true + } + }, + "@metamask/eth-trezor-keyring>@ethereumjs/util": { + "globals": { + "console.warn": true, + "fetch": true + }, + "packages": { + "@metamask/eth-trezor-keyring>@ethereumjs/util>@ethereumjs/rlp": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true + } + }, + "@metamask/keyring-controller>@ethereumjs/util": { + "globals": { + "console.warn": true, + "fetch": true + }, + "packages": { + "@metamask/keyring-controller>@ethereumjs/util>@ethereumjs/rlp": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true } }, "@metamask/smart-transactions-controller>@ethereumjs/util": { @@ -149,11 +350,24 @@ "fetch": true }, "packages": { - "@metamask/smart-transactions-controller>@ethereumjs/tx>@ethereumjs/rlp": true, + "@metamask/smart-transactions-controller>@ethereumjs/util>@ethereumjs/rlp": true, "@ethereumjs/tx>ethereum-cryptography": true, "webpack>events": true } }, + "eth-lattice-keyring>@ethereumjs/util": { + "globals": { + "console.warn": true + }, + "packages": { + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "browserify>buffer": true, + "@ethereumjs/tx>ethereum-cryptography": true, + "webpack>events": true, + "browserify>insert-module-globals>is-buffer": true, + "eth-lattice-keyring>@ethereumjs/util>micro-ftch": true + } + }, "@ethersproject/abi": { "globals": { "console.log": true @@ -622,8 +836,8 @@ }, "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring": { "packages": { - "@ethereumjs/tx": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@ethereumjs/tx": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@keystonehq/bc-ur-registry-eth": true, "browserify>buffer": true, "@metamask/eth-trezor-keyring>hdkey": true, @@ -633,7 +847,7 @@ }, "@keystonehq/bc-ur-registry-eth": { "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry": true, "browserify>buffer": true, "@metamask/eth-trezor-keyring>hdkey": true, @@ -654,7 +868,7 @@ }, "@keystonehq/metamask-airgapped-keyring": { "packages": { - "@ethereumjs/tx": true, + "@keystonehq/metamask-airgapped-keyring>@ethereumjs/tx": true, "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring": true, "@keystonehq/bc-ur-registry-eth": true, "@metamask/obs-store": true, @@ -827,7 +1041,7 @@ }, "@metamask-institutional/custody-controller": { "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@metamask-institutional/custody-keyring": true, "@metamask/obs-store": true } @@ -839,7 +1053,7 @@ "console.warn": true }, "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@metamask-institutional/custody-keyring>@metamask-institutional/configuration-client": true, "@metamask-institutional/sdk": true, "@metamask-institutional/types": true, @@ -893,7 +1107,7 @@ "setInterval": true }, "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@metamask-institutional/sdk": true, "@metamask-institutional/transaction-update>@metamask-institutional/websocket-client": true, "@metamask/obs-store": true, @@ -967,12 +1181,11 @@ }, "@metamask/accounts-controller": { "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, "@metamask/base-controller": true, "@metamask/eth-snap-keyring": true, "@metamask/keyring-api": true, "@metamask/keyring-controller": true, - "@metamask/keyring-api>@metamask/keyring-utils": true, + "@metamask/accounts-controller>@metamask/keyring-utils": true, "@metamask/utils": true, "@ethereumjs/tx>ethereum-cryptography": true, "uuid": true @@ -1013,7 +1226,7 @@ "setTimeout": true }, "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/util": true, "ethers>@ethersproject/address": true, "@ethersproject/bignumber": true, "@ethersproject/contracts": true, @@ -1094,14 +1307,6 @@ "immer": true } }, - "@metamask/transaction-controller>@metamask/base-controller": { - "globals": { - "setTimeout": true - }, - "packages": { - "immer": true - } - }, "@metamask/browser-passworder": { "globals": { "CryptoKey": true, @@ -1131,7 +1336,7 @@ "setTimeout": true }, "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/controller-utils>@ethereumjs/util": true, "@metamask/controller-utils>@metamask/ethjs-unit": true, "@metamask/utils": true, "@metamask/controller-utils>@spruceid/siwe-parser": true, @@ -1168,7 +1373,7 @@ "TextEncoder": true }, "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/keyring-controller>@metamask/eth-hd-keyring>@ethereumjs/util": true, "@metamask/keyring-controller>@metamask/eth-hd-keyring>@metamask/eth-sig-util": true, "@metamask/snaps-sdk>@metamask/key-tree": true, "@metamask/scure-bip39": true, @@ -1236,11 +1441,11 @@ "packages": { "@metamask/eth-ledger-bridge-keyring>@ethereumjs/rlp": true, "@ethereumjs/tx": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/eth-ledger-bridge-keyring>@ethereumjs/util": true, "@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth": true, "@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util": true, + "@metamask/utils": true, "browserify>buffer": true, - "webpack>events": true, "@metamask/eth-trezor-keyring>hdkey": true } }, @@ -1252,7 +1457,7 @@ }, "@metamask/eth-sig-util": { "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@metamask/abi-utils": true, "@metamask/eth-sig-util>@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1263,8 +1468,8 @@ }, "@metamask/keyring-controller>@metamask/eth-hd-keyring>@metamask/eth-sig-util": { "packages": { - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "@metamask/keyring-controller>@metamask/eth-hd-keyring>@metamask/eth-sig-util>@ethereumjs/util": true, "@metamask/keyring-controller>@metamask/eth-hd-keyring>@metamask/eth-sig-util>@metamask/abi-utils": true, "@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1275,8 +1480,8 @@ }, "@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util": { "packages": { - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@metamask/abi-utils": true, "@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1288,7 +1493,7 @@ "@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util": { "packages": { "@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@ethereumjs/util": true, "@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@metamask/abi-utils": true, "@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1299,8 +1504,8 @@ }, "@metamask/keyring-controller>@metamask/eth-simple-keyring>@metamask/eth-sig-util": { "packages": { - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "@metamask/keyring-controller>@metamask/eth-simple-keyring>@metamask/eth-sig-util>@ethereumjs/util": true, "@metamask/keyring-controller>@metamask/eth-simple-keyring>@metamask/eth-sig-util>@metamask/abi-utils": true, "@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1311,8 +1516,8 @@ }, "@metamask/eth-snap-keyring>@metamask/eth-sig-util": { "packages": { - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@metamask/eth-snap-keyring>@metamask/eth-sig-util>@metamask/abi-utils": true, "@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1323,8 +1528,8 @@ }, "@metamask/eth-trezor-keyring>@metamask/eth-sig-util": { "packages": { - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "@metamask/eth-trezor-keyring>@metamask/eth-sig-util>@ethereumjs/util": true, "@metamask/eth-trezor-keyring>@metamask/eth-sig-util>@metamask/abi-utils": true, "@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1335,8 +1540,8 @@ }, "@metamask/keyring-controller>@metamask/eth-sig-util": { "packages": { - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "@metamask/keyring-controller>@metamask/eth-sig-util>@ethereumjs/util": true, "@metamask/keyring-controller>@metamask/eth-sig-util>@metamask/abi-utils": true, "@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1347,8 +1552,8 @@ }, "@metamask/signature-controller>@metamask/eth-sig-util": { "packages": { - "@ethereumjs/tx>@ethereumjs/rlp": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/utils>@ethereumjs/tx>@ethereumjs/rlp": true, + "eth-lattice-keyring>@ethereumjs/util": true, "@metamask/signature-controller>@metamask/eth-sig-util>@metamask/abi-utils": true, "@metamask/signature-controller>@metamask/eth-sig-util>@metamask/utils": true, "@metamask/utils>@scure/base": true, @@ -1359,7 +1564,7 @@ }, "@metamask/keyring-controller>@metamask/eth-simple-keyring": { "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/keyring-controller>@metamask/eth-simple-keyring>@ethereumjs/util": true, "@metamask/keyring-controller>@metamask/eth-simple-keyring>@metamask/eth-sig-util": true, "@metamask/utils": true, "browserify>buffer": true, @@ -1378,7 +1583,7 @@ "@metamask/eth-snap-keyring>@metamask/eth-sig-util": true, "@metamask/keyring-api": true, "@metamask/eth-snap-keyring>@metamask/keyring-internal-snap-client": true, - "@metamask/keyring-api>@metamask/keyring-utils": true, + "@metamask/eth-snap-keyring>@metamask/keyring-utils": true, "@metamask/utils>@metamask/superstruct": true, "@metamask/utils": true, "webpack>events": true, @@ -1407,12 +1612,12 @@ }, "packages": { "@ethereumjs/tx": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/eth-trezor-keyring>@ethereumjs/util": true, "@metamask/eth-trezor-keyring>@metamask/eth-sig-util": true, + "@metamask/utils": true, "@metamask/eth-trezor-keyring>@trezor/connect-plugin-ethereum": true, "@trezor/connect-web": true, "browserify>buffer": true, - "webpack>events": true, "@metamask/eth-trezor-keyring>hdkey": true } }, @@ -1540,7 +1745,7 @@ "console.log": true }, "packages": { - "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/keyring-controller>@ethereumjs/util": true, "@metamask/base-controller": true, "@metamask/browser-passworder": true, "@metamask/keyring-controller>@metamask/eth-hd-keyring": true, @@ -1565,6 +1770,26 @@ "@metamask/keyring-snap-client>uuid": true } }, + "@metamask/accounts-controller>@metamask/keyring-utils": { + "globals": { + "URL": true + }, + "packages": { + "@metamask/utils>@metamask/superstruct": true, + "@metamask/utils": true, + "bitcoin-address-validation": true + } + }, + "@metamask/eth-snap-keyring>@metamask/keyring-utils": { + "globals": { + "URL": true + }, + "packages": { + "@metamask/utils>@metamask/superstruct": true, + "@metamask/utils": true, + "bitcoin-address-validation": true + } + }, "@metamask/keyring-api>@metamask/keyring-utils": { "globals": { "URL": true @@ -1952,7 +2177,7 @@ "setInterval": true }, "packages": { - "@metamask/smart-transactions-controller>@ethereumjs/tx": true, + "@ethereumjs/tx": true, "@metamask/smart-transactions-controller>@ethereumjs/util": true, "@ethersproject/bytes": true, "@metamask/controller-utils": true, @@ -2159,11 +2384,10 @@ "packages": { "@ethereumjs/tx>@ethereumjs/common": true, "@ethereumjs/tx": true, - "@ethereumjs/tx>@ethereumjs/util": true, "@ethersproject/abi": true, "@ethersproject/contracts": true, "@ethersproject/providers": true, - "@metamask/transaction-controller>@metamask/base-controller": true, + "@metamask/base-controller": true, "@metamask/controller-utils": true, "@metamask/controller-utils>@metamask/eth-query": true, "@metamask/gas-fee-controller": true, @@ -3484,7 +3708,7 @@ "copy-to-clipboard>toggle-selection": true } }, - "@ethereumjs/tx>@ethereumjs/common>crc-32": { + "eth-lattice-keyring>gridplus-sdk>crc-32": { "globals": { "DO_NOT_EXPORT_CRC": true, "define": true @@ -3736,7 +3960,7 @@ }, "packages": { "eth-lattice-keyring>@ethereumjs/tx": true, - "@ethereumjs/tx>@ethereumjs/util": true, + "eth-lattice-keyring>@ethereumjs/util": true, "bn.js": true, "browserify>buffer": true, "crypto-browserify": true, @@ -4007,7 +4231,7 @@ "eth-lattice-keyring>gridplus-sdk>borc": true, "ethereumjs-util>ethereum-cryptography>bs58check": true, "browserify>buffer": true, - "@ethereumjs/tx>@ethereumjs/common>crc-32": true, + "eth-lattice-keyring>gridplus-sdk>crc-32": true, "@metamask/ppom-validator>elliptic": true, "eth-lattice-keyring>gridplus-sdk>eth-eip712-util-browser": true, "ethers>@ethersproject/sha2>hash.js": true, @@ -4435,7 +4659,7 @@ "react-markdown>unist-util-visit": true } }, - "@ethereumjs/tx>@ethereumjs/util>micro-ftch": { + "eth-lattice-keyring>@ethereumjs/util>micro-ftch": { "globals": { "Headers": true, "TextDecoder": true, diff --git a/package.json b/package.json index 8cb428f605c5..da5c7259ce8f 100644 --- a/package.json +++ b/package.json @@ -233,7 +233,7 @@ "@babel/runtime": "patch:@babel/runtime@npm%3A7.25.9#~/.yarn/patches/@babel-runtime-npm-7.25.9-fe8c62510a.patch", "@blockaid/ppom_release": "^1.5.3", "@ensdomains/content-hash": "^2.5.7", - "@ethereumjs/tx": "^4.1.1", + "@ethereumjs/tx": "^5.4.0", "@ethersproject/abi": "^5.6.4", "@ethersproject/bignumber": "^5.7.0", "@ethersproject/bytes": "^5.7.0", @@ -259,7 +259,7 @@ "@metamask-institutional/types": "^1.2.0", "@metamask/abi-utils": "^2.0.2", "@metamask/account-watcher": "^4.1.2", - "@metamask/accounts-controller": "^24.1.0", + "@metamask/accounts-controller": "^26.0.0", "@metamask/address-book-controller": "^6.0.3", "@metamask/announcement-controller": "^7.0.3", "@metamask/approval-controller": "^7.0.0", @@ -274,19 +274,19 @@ "@metamask/ens-resolver-snap": "^0.1.2", "@metamask/eth-json-rpc-filters": "^9.0.0", "@metamask/eth-json-rpc-middleware": "^15.1.2", - "@metamask/eth-ledger-bridge-keyring": "^8.0.3", + "@metamask/eth-ledger-bridge-keyring": "^10.0.0", "@metamask/eth-sig-util": "^7.0.1", - "@metamask/eth-snap-keyring": "^11.1.0", + "@metamask/eth-snap-keyring": "^12.0.0", "@metamask/eth-token-tracker": "^10.0.2", - "@metamask/eth-trezor-keyring": "^6.0.0", + "@metamask/eth-trezor-keyring": "^8.0.0", "@metamask/etherscan-link": "^3.0.0", "@metamask/gas-fee-controller": "^22.0.3", "@metamask/jazzicon": "^2.0.0", "@metamask/json-rpc-engine": "^10.0.0", "@metamask/json-rpc-middleware-stream": "^8.0.4", "@metamask/keyring-api": "^17.2.1", - "@metamask/keyring-controller": "^19.2.0", - "@metamask/keyring-internal-api": "^4.0.3", + "@metamask/keyring-controller": "^21.0.0", + "@metamask/keyring-internal-api": "^6.0.0", "@metamask/keyring-snap-client": "^4.0.1", "@metamask/logging-controller": "^6.0.4", "@metamask/logo": "^4.0.0", @@ -308,7 +308,7 @@ "@metamask/post-message-stream": "^9.0.0", "@metamask/ppom-validator": "0.36.0", "@metamask/preinstalled-example-snap": "^0.3.0", - "@metamask/profile-sync-controller": "^8.1.1", + "@metamask/profile-sync-controller": "^9.0.0", "@metamask/providers": "^20.0.0", "@metamask/queued-request-controller": "^7.0.1", "@metamask/rate-limit-controller": "^6.0.3", @@ -324,8 +324,8 @@ "@metamask/snaps-rpc-methods": "^11.13.1", "@metamask/snaps-sdk": "^6.19.0", "@metamask/snaps-utils": "^9.0.1", - "@metamask/solana-wallet-snap": "^1.10.0", - "@metamask/transaction-controller": "patch:@metamask/transaction-controller@npm%3A45.0.0#~/.yarn/patches/@metamask-transaction-controller-npm-45.0.0-010fef9da6.patch", + "@metamask/solana-wallet-snap": "^1.11.0", + "@metamask/transaction-controller": "^46.0.0", "@metamask/user-operation-controller": "^24.0.1", "@metamask/utils": "^11.1.0", "@ngraveio/bc-ur": "^1.1.12", diff --git a/shared/lib/keyring.test.ts b/shared/lib/keyring.test.ts deleted file mode 100644 index 23c53c39f37b..000000000000 --- a/shared/lib/keyring.test.ts +++ /dev/null @@ -1,95 +0,0 @@ -import { - KeyringObject, - KeyringMetadata, - KeyringTypes, -} from '@metamask/keyring-controller'; -import { findKeyringId, findKeyringIdByAddress } from './keyring'; - -const mockAddress1 = '0xb1baf6a2f4a808937bb97a2f12ccf08f1233e3d9'; -const mockAddress2 = '0xe9d2ba741180799e497a687c11ef9e99054ef2fa'; -const mockAddress3 = '0x67b2faf7959fb61eb9746571041476bbd0672569'; - -const mockHdKeyring: KeyringObject = { - type: KeyringTypes.hd, - accounts: [mockAddress1, mockAddress2], -}; -const mockSimpleKeyring: KeyringObject = { - type: KeyringTypes.simple, - accounts: [mockAddress3], -}; -const mockHdKeyringMetadata: KeyringMetadata = { id: 'keyring-1', name: '' }; -const mockSimpleKeyringMetadata: KeyringMetadata = { - id: 'keyring-2', - name: '', -}; - -const mockKeyrings: KeyringObject[] = [mockHdKeyring, mockSimpleKeyring]; - -const mockMetadata: KeyringMetadata[] = [ - mockHdKeyringMetadata, - mockSimpleKeyringMetadata, -]; - -describe('Keyring utils', () => { - describe('findKeyringId', () => { - it('finds keyring by address', () => { - expect( - findKeyringId(mockKeyrings, mockMetadata, { address: mockAddress1 }), - ).toBe(mockHdKeyringMetadata.id); - }); - - it('finds keyring by type', () => { - expect( - findKeyringId(mockKeyrings, mockMetadata, { - type: KeyringTypes.simple, - }), - ).toBe(mockSimpleKeyringMetadata.id); - }); - - it('finds keyring by both address and type', () => { - expect( - findKeyringId(mockKeyrings, mockMetadata, { - address: mockAddress3, - type: KeyringTypes.simple, - }), - ).toBe(mockSimpleKeyringMetadata.id); - }); - - it('throws error when no selector is provided', () => { - expect(() => findKeyringId(mockKeyrings, mockMetadata, {})).toThrow( - 'Must provide either address or type selector', - ); - }); - - it('throws error when keyring is not found', () => { - expect(() => - findKeyringId(mockKeyrings, mockMetadata, { - address: 'invalid-address', - }), - ).toThrow('Could not find keyring with specified criteria'); - }); - - it('throws error if not every selectors are matching', () => { - expect(() => - findKeyringId(mockKeyrings, mockMetadata, { - type: KeyringTypes.hd, - address: mockAddress3, - }), - ).toThrow('Could not find keyring with specified criteria'); - }); - }); - - describe('findKeyringIdByAddress', () => { - it('finds keyring by address', () => { - expect( - findKeyringIdByAddress(mockKeyrings, mockMetadata, mockAddress2), - ).toBe(mockHdKeyringMetadata.id); - }); - - it('throws error when address not found', () => { - expect(() => - findKeyringIdByAddress(mockKeyrings, mockMetadata, 'invalid-address'), - ).toThrow('Could not find keyring with specified criteria'); - }); - }); -}); diff --git a/shared/lib/keyring.ts b/shared/lib/keyring.ts deleted file mode 100644 index 4d7c923f236a..000000000000 --- a/shared/lib/keyring.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { - KeyringObject, - KeyringMetadata, - KeyringTypes, -} from '@metamask/keyring-controller'; - -// TODO: This kind of logic should be inside the `KeyringController` (using `KeyringSelector` query, or make `addNewKeyring` returns it keyring ID alongside - -export function findKeyringId( - keyrings: KeyringObject[], - keyringsMetadata: KeyringMetadata[], - selector: { address?: string; type?: KeyringTypes }, -): string { - const keyringIndex = keyrings.findIndex((keyring) => { - if (selector.address && selector.type) { - return ( - keyring.accounts.includes(selector.address.toLowerCase()) && - keyring.type === selector.type - ); - } - if (selector.address) { - return keyring.accounts.includes(selector.address.toLowerCase()); - } - if (selector.type) { - return keyring.type === selector.type; - } - - throw new Error('Must provide either address or type selector'); - }); - if (keyringIndex === -1) { - throw new Error('Could not find keyring with specified criteria'); - } - - return keyringsMetadata[keyringIndex].id; -} - -export function findKeyringIdByAddress( - keyrings: KeyringObject[], - keyringsMetadata: KeyringMetadata[], - address: string, -): string { - return findKeyringId(keyrings, keyringsMetadata, { address }); -} diff --git a/test/data/confirmations/helper.ts b/test/data/confirmations/helper.ts index 026ad4a3adce..334034262760 100644 --- a/test/data/confirmations/helper.ts +++ b/test/data/confirmations/helper.ts @@ -81,6 +81,7 @@ export const getMockPersonalSignConfirmState = ( [unapprovedPersonalSignMsg.id]: { id: unapprovedPersonalSignMsg.id, type: ApprovalType.PersonalSign, + origin: 'https://metamask.github.io', }, }, unapprovedPersonalMsgs: { diff --git a/test/data/mock-accounts.ts b/test/data/mock-accounts.ts index 932ed9b736f0..8241621c9f11 100644 --- a/test/data/mock-accounts.ts +++ b/test/data/mock-accounts.ts @@ -78,7 +78,7 @@ export const MOCK_ACCOUNT_BIP122_P2WPKH_TESTNET: InternalAccount = { export const MOCK_ACCOUNT_SOLANA_MAINNET: InternalAccount = { id: 'a3f9c2d4-6b8e-4d3a-9b2e-7f4b8e1a9c3d', - address: '3yZe7d5m8V9x2Q1w4u6t8b9n7k5j3h2g1f4d6s8a9p7q2r5t8v', + address: '8A4AptCThfbuknsbteHgGKXczfJpfjuVA9SLTSGaaLGC', options: {}, methods: [SolMethod.SendAndConfirmTransaction], scopes: [SolScope.Mainnet], @@ -96,4 +96,5 @@ export const MOCK_ACCOUNTS = { [MOCK_ACCOUNT_ERC4337.id]: MOCK_ACCOUNT_ERC4337, [MOCK_ACCOUNT_BIP122_P2WPKH.id]: MOCK_ACCOUNT_BIP122_P2WPKH, [MOCK_ACCOUNT_BIP122_P2WPKH_TESTNET.id]: MOCK_ACCOUNT_BIP122_P2WPKH_TESTNET, + [MOCK_ACCOUNT_SOLANA_MAINNET.id]: MOCK_ACCOUNT_SOLANA_MAINNET, }; diff --git a/test/e2e/flask/solana/common-solana.ts b/test/e2e/flask/solana/common-solana.ts index 062a5ee0645c..a6442e17f043 100644 --- a/test/e2e/flask/solana/common-solana.ts +++ b/test/e2e/flask/solana/common-solana.ts @@ -1611,9 +1611,6 @@ export async function withSolanaAccountSnap( mockList.push(await mockGetSuccessSignaturesForAddress(mockServer)); mockList.push(await mockGetSuccessTransaction(mockServer)); } - if (mockZeroBalance) { - mockList.push(await mockSolanaBalanceQuote(mockServer, true)); - } if (mockCalls) { mockList.push([ await mockSolanaBalanceQuote(mockServer), @@ -1631,6 +1628,9 @@ export async function withSolanaAccountSnap( await mockGetAccountInfo(mockServer), ]); } + if (mockZeroBalance) { + mockList.push(await mockSolanaBalanceQuote(mockServer, true)); + } if (mockSendTransaction) { mockList.push(await mockSendSolanaTransaction(mockServer)); } diff --git a/test/e2e/helpers.js b/test/e2e/helpers.js index 6ca93206654f..a1a6e8418bf6 100644 --- a/test/e2e/helpers.js +++ b/test/e2e/helpers.js @@ -533,17 +533,7 @@ const PRIVATE_KEY_TWO = const ACCOUNT_1 = '0x5cfe73b6021e818b776b421b1c4db2474086a7e1'; const ACCOUNT_2 = '0x09781764c08de8ca82e156bbf156a3ca217c7950'; -const defaultGanacheOptions = { - accounts: [ - { - secretKey: PRIVATE_KEY, - balance: convertETHToHexGwei(DEFAULT_GANACHE_ETH_BALANCE_DEC), - }, - ], -}; - const defaultGanacheOptionsForType2Transactions = { - ...defaultGanacheOptions, // EVM version that supports type 2 transactions (EIP1559) hardfork: 'london', }; @@ -567,24 +557,6 @@ const multipleGanacheOptionsForType2Transactions = { hardfork: 'london', }; -const generateGanacheOptions = ({ - secretKey = PRIVATE_KEY, - balance = convertETHToHexGwei(DEFAULT_GANACHE_ETH_BALANCE_DEC), - ...otherProps -}) => { - const accounts = [ - { - secretKey, - balance, - }, - ]; - - return { - accounts, - ...otherProps, // eg: hardfork - }; -}; - // Edit priority gas fee form const editGasFeeForm = async (driver, gasLimit, gasPrice) => { const inputs = await driver.findElements('input[type="number"]'); @@ -958,7 +930,6 @@ module.exports = { switchToOrOpenDapp, connectToDapp, multipleGanacheOptions, - defaultGanacheOptions, defaultGanacheOptionsForType2Transactions, multipleGanacheOptionsForType2Transactions, sendTransaction, @@ -966,7 +937,6 @@ module.exports = { unlockWallet, logInWithBalanceValidation, locateAccountBalanceDOM, - generateGanacheOptions, WALLET_PASSWORD, WINDOW_TITLES, convertETHToHexGwei, diff --git a/test/e2e/json-rpc/eth_newBlockFilter.spec.ts b/test/e2e/json-rpc/eth_newBlockFilter.spec.ts index d208e22c23d0..5766c1e0cb6e 100644 --- a/test/e2e/json-rpc/eth_newBlockFilter.spec.ts +++ b/test/e2e/json-rpc/eth_newBlockFilter.spec.ts @@ -1,13 +1,12 @@ import { strict as assert } from 'assert'; -import { defaultGanacheOptions, withFixtures } from '../helpers'; +import { withFixtures } from '../helpers'; import { loginWithBalanceValidation } from '../page-objects/flows/login.flow'; import FixtureBuilder from '../fixture-builder'; import { Driver } from '../webdriver/driver'; describe('eth_newBlockFilter', function () { - const ganacheOptions: typeof defaultGanacheOptions & { blockTime: number } = { + const ganacheOptions: { blockTime: number } = { blockTime: 0.1, - ...defaultGanacheOptions, }; it('executes a new block filter call', async function () { await withFixtures( diff --git a/test/e2e/json-rpc/eth_sendTransaction.spec.js b/test/e2e/json-rpc/eth_sendTransaction.spec.js index 2a3981ab7cfc..41caabc2155e 100644 --- a/test/e2e/json-rpc/eth_sendTransaction.spec.js +++ b/test/e2e/json-rpc/eth_sendTransaction.spec.js @@ -1,10 +1,5 @@ const { strict: assert } = require('assert'); -const { - withFixtures, - unlockWallet, - WINDOW_TITLES, - generateGanacheOptions, -} = require('../helpers'); +const { withFixtures, unlockWallet, WINDOW_TITLES } = require('../helpers'); const FixtureBuilder = require('../fixture-builder'); describe('eth_sendTransaction', function () { @@ -18,11 +13,7 @@ describe('eth_sendTransaction', function () { fixtures: new FixtureBuilder() .withPermissionControllerConnectedToTestDapp() .build(), - localNodeOptions: generateGanacheOptions({ - hardfork: 'london', - mnemonic: - 'phrase upgrade clock rough situate wedding elder clever doctor stamp excess tent', - }), + localNodeOptions: { hardfork: 'london' }, title: this.test.fullTitle(), }, async ({ driver }) => { @@ -68,11 +59,7 @@ describe('eth_sendTransaction', function () { fixtures: new FixtureBuilder() .withPermissionControllerConnectedToTestDapp() .build(), - localNodeOptions: generateGanacheOptions({ - hardfork: 'london', - mnemonic: - 'phrase upgrade clock rough situate wedding elder clever doctor stamp excess tent', - }), + localNodeOptions: { hardfork: 'london' }, title: this.test.fullTitle(), }, async ({ driver }) => { diff --git a/test/e2e/json-rpc/wallet_addEthereumChain.spec.ts b/test/e2e/json-rpc/wallet_addEthereumChain.spec.ts index aa747e5b1d89..6a0b64e1388b 100644 --- a/test/e2e/json-rpc/wallet_addEthereumChain.spec.ts +++ b/test/e2e/json-rpc/wallet_addEthereumChain.spec.ts @@ -7,7 +7,6 @@ import FixtureBuilder from '../fixture-builder'; import { Driver } from '../webdriver/driver'; import { withFixtures, - defaultGanacheOptions, openDapp, unlockWallet, WINDOW_TITLES, @@ -479,7 +478,6 @@ describe('Add Ethereum Chain', function () { fixtures: new FixtureBuilder() .withPermissionControllerConnectedToTestDappWithChains(['0x539']) .build(), - localNodeOptions: defaultGanacheOptions, title: this.test?.fullTitle(), }, async ({ driver }: { driver: Driver }) => { diff --git a/test/e2e/seeder/network-states/with50Dai.json b/test/e2e/seeder/network-states/with50Dai.json new file mode 100644 index 000000000000..4721d5232d5f --- /dev/null +++ b/test/e2e/seeder/network-states/with50Dai.json @@ -0,0 +1,14 @@ +{ + "accounts": { + "0x6b175474e89094c44da98b954eedeac495271d0f": { + "nonce": 0, + "balance": "0x", + "code": "0x608060405234801561001057600080fd5b50600436106101425760003560e01c80637ecebe00116100b8578063a9059cbb1161007c578063a9059cbb146106b4578063b753a98c1461071a578063bb35783b14610768578063bf353dbb146107d6578063dd62ed3e1461082e578063f2d5d56b146108a657610142565b80637ecebe00146104a15780638fcbaf0c146104f957806395d89b411461059f5780639c52a7f1146106225780639dc29fac1461066657610142565b8063313ce5671161010a578063313ce567146102f25780633644e5151461031657806340c10f191461033457806354fd4d501461038257806365fae35e1461040557806370a082311461044957610142565b806306fdde0314610147578063095ea7b3146101ca57806318160ddd1461023057806323b872dd1461024e57806330adf81f146102d4575b600080fd5b61014f6108f4565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561018f578082015181840152602081019050610174565b50505050905090810190601f1680156101bc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610216600480360360408110156101e057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061092d565b604051808215151515815260200191505060405180910390f35b610238610a1f565b6040518082815260200191505060405180910390f35b6102ba6004803603606081101561026457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a25565b604051808215151515815260200191505060405180910390f35b6102dc610f3a565b6040518082815260200191505060405180910390f35b6102fa610f61565b604051808260ff1660ff16815260200191505060405180910390f35b61031e610f66565b6040518082815260200191505060405180910390f35b6103806004803603604081101561034a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f6c565b005b61038a611128565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103ca5780820151818401526020810190506103af565b50505050905090810190601f1680156103f75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104476004803603602081101561041b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611161565b005b61048b6004803603602081101561045f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061128f565b6040518082815260200191505060405180910390f35b6104e3600480360360208110156104b757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112a7565b6040518082815260200191505060405180910390f35b61059d600480360361010081101561051057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803515159060200190929190803560ff16906020019092919080359060200190929190803590602001909291905050506112bf565b005b6105a76117fa565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105e75780820151818401526020810190506105cc565b50505050905090810190601f1680156106145780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6106646004803603602081101561063857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611833565b005b6106b26004803603604081101561067c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611961565b005b610700600480360360408110156106ca57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611df4565b604051808215151515815260200191505060405180910390f35b6107666004803603604081101561073057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611e09565b005b6107d46004803603606081101561077e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611e19565b005b610818600480360360208110156107ec57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611e2a565b6040518082815260200191505060405180910390f35b6108906004803603604081101561084457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611e42565b6040518082815260200191505060405180910390f35b6108f2600480360360408110156108bc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611e67565b005b6040518060400160405280600e81526020017f44616920537461626c65636f696e00000000000000000000000000000000000081525081565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60015481565b600081600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610adc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f4461692f696e73756666696369656e742d62616c616e6365000000000000000081525060200191505060405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015610bb457507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414155b15610db25781600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610cab576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f4461692f696e73756666696369656e742d616c6c6f77616e636500000000000081525060200191505060405180910390fd5b610d31600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611e77565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b610dfb600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611e77565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e87600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611e91565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b7fea2aa0a1be11a07ed86d755c93467f4f82362b452371d1ba94d1715123511acb60001b81565b601281565b60055481565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611020576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f4461692f6e6f742d617574686f72697a6564000000000000000000000000000081525060200191505060405180910390fd5b611069600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482611e91565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506110b860015482611e91565b6001819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b6040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525081565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611215576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f4461692f6e6f742d617574686f72697a6564000000000000000000000000000081525060200191505060405180910390fd5b60016000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505961012081016040526020815260e0602082015260e0600060408301376024356004353360003560e01c60e01b61012085a45050565b60026020528060005260406000206000915090505481565b60046020528060005260406000206000915090505481565b60006005547fea2aa0a1be11a07ed86d755c93467f4f82362b452371d1ba94d1715123511acb60001b8a8a8a8a8a604051602001808781526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018381526020018215151515815260200196505050505050506040516020818303038152906040528051906020012060405160200180807f190100000000000000000000000000000000000000000000000000000000000081525060020183815260200182815260200192505050604051602081830303815290604052805190602001209050600073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff16141561148c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4461692f696e76616c69642d616464726573732d30000000000000000000000081525060200191505060405180910390fd5b60018185858560405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa1580156114e9573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614611593576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f4461692f696e76616c69642d7065726d6974000000000000000000000000000081525060200191505060405180910390fd5b60008614806115a25750854211155b611614576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f4461692f7065726d69742d65787069726564000000000000000000000000000081525060200191505060405180910390fd5b600460008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008154809291906001019190505587146116d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4461692f696e76616c69642d6e6f6e636500000000000000000000000000000081525060200191505060405180910390fd5b6000856116e4576000611706565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5b905080600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508873ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a350505050505050505050565b6040518060400160405280600381526020017f444149000000000000000000000000000000000000000000000000000000000081525081565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146118e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f4461692f6e6f742d617574686f72697a6564000000000000000000000000000081525060200191505060405180910390fd5b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505961012081016040526020815260e0602082015260e0600060408301376024356004353360003560e01c60e01b61012085a45050565b80600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015611a16576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f4461692f696e73756666696369656e742d62616c616e6365000000000000000081525060200191505060405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614158015611aee57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414155b15611cec5780600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015611be5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f4461692f696e73756666696369656e742d616c6c6f77616e636500000000000081525060200191505060405180910390fd5b611c6b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482611e77565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b611d35600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482611e77565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d8460015482611e77565b600181905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b6000611e01338484610a25565b905092915050565b611e14338383610a25565b505050565b611e24838383610a25565b50505050565b60006020528060005260406000206000915090505481565b6003602052816000526040600020602052806000526040600020600091509150505481565b611e72823383610a25565b505050565b6000828284039150811115611e8b57600080fd5b92915050565b6000828284019150811015611ea557600080fd5b9291505056fea265627a7a72315820c0ae2c29860c0a59d5586a579abbcddfe4bcef0524a87301425cbc58c3e94e3164736f6c634300050c0032", + "storage": { + "0xffee91b17be552e72300cc0c61358eeed4d30ec88b85fc5c2f792d0c45209d31": "0x000000000000000000000000000000000000000000000002B5E3AF16B1880000" + } + } + }, + "blocks": [], + "transactions": [] +} diff --git a/test/e2e/tests/bridge/bridge-test-utils.ts b/test/e2e/tests/bridge/bridge-test-utils.ts index 57c9bbfb6565..1af3103dd6e0 100644 --- a/test/e2e/tests/bridge/bridge-test-utils.ts +++ b/test/e2e/tests/bridge/bridge-test-utils.ts @@ -1,6 +1,5 @@ import { Mockttp } from 'mockttp'; import FixtureBuilder from '../../fixture-builder'; -import { generateGanacheOptions } from '../../helpers'; import { BRIDGE_CLIENT_ID, BRIDGE_DEV_API_BASE_URL, @@ -139,10 +138,10 @@ export const getBridgeFixtures = ( testSpecificMock: mockServer(featureFlags), smartContract: SMART_CONTRACTS.HST, ethConversionInUsd: ETH_CONVERSION_RATE_USD, - localNodeOptions: generateGanacheOptions({ + localNodeOptions: { hardfork: 'london', chain: { chainId: CHAIN_IDS.MAINNET }, - }), + }, title, }; }; diff --git a/test/e2e/tests/confirmations/helpers.ts b/test/e2e/tests/confirmations/helpers.ts index c8a75119ccaf..49b7ee297f15 100644 --- a/test/e2e/tests/confirmations/helpers.ts +++ b/test/e2e/tests/confirmations/helpers.ts @@ -1,7 +1,6 @@ import { TransactionEnvelopeType } from '@metamask/transaction-controller'; import FixtureBuilder from '../../fixture-builder'; import { - defaultGanacheOptions, defaultGanacheOptionsForType2Transactions, withFixtures, } from '../../helpers'; @@ -44,7 +43,7 @@ export function withTransactionEnvelopeTypeFixtures( .build(), localNodeOptions: transactionEnvelopeType === TransactionEnvelopeType.legacy - ? defaultGanacheOptions + ? {} : defaultGanacheOptionsForType2Transactions, ...(smartContract && { smartContract }), ...(mocks && { testSpecificMock: mocks }), diff --git a/test/e2e/tests/confirmations/transactions/erc20-approve-redesign.spec.ts b/test/e2e/tests/confirmations/transactions/erc20-approve-redesign.spec.ts index ba4249466e96..fd61d4878558 100644 --- a/test/e2e/tests/confirmations/transactions/erc20-approve-redesign.spec.ts +++ b/test/e2e/tests/confirmations/transactions/erc20-approve-redesign.spec.ts @@ -167,11 +167,6 @@ async function assertApproveDetails(driver: Driver) { text: 'Method', }); - await driver.waitForSelector({ - css: 'p', - text: 'Account balance', - }); - await driver.waitForSelector({ css: 'p', text: 'Spending cap', diff --git a/test/e2e/tests/metrics/metametrics-persistence.spec.js b/test/e2e/tests/metrics/metametrics-persistence.spec.js index 3c0a395dab81..1330c49b4e25 100644 --- a/test/e2e/tests/metrics/metametrics-persistence.spec.js +++ b/test/e2e/tests/metrics/metametrics-persistence.spec.js @@ -2,17 +2,12 @@ const { strict: assert } = require('assert'); const FixtureBuilder = require('../../fixture-builder'); const { withFixtures, - generateGanacheOptions, - defaultGanacheOptions, unlockWallet, - genRandInitBal, getCleanAppState, } = require('../../helpers'); describe('MetaMetrics ID persistence', function () { it('MetaMetrics ID should persist when the user opts-out and then opts-in again of MetaMetrics collection', async function () { - const { initialBalanceInHex } = genRandInitBal(); - const initialMetaMetricsId = 'test-metrics-id'; await withFixtures( @@ -23,14 +18,6 @@ describe('MetaMetrics ID persistence', function () { participateInMetaMetrics: true, }) .build(), - localNodeOptions: generateGanacheOptions({ - accounts: [ - { - secretKey: defaultGanacheOptions.accounts[0].secretKey, - balance: initialBalanceInHex, - }, - ], - }), title: this.test.fullTitle(), }, async ({ driver }) => { diff --git a/test/e2e/tests/metrics/nft-detection-metrics.spec.ts b/test/e2e/tests/metrics/nft-detection-metrics.spec.ts index b20226e25c6d..cc7876690017 100644 --- a/test/e2e/tests/metrics/nft-detection-metrics.spec.ts +++ b/test/e2e/tests/metrics/nft-detection-metrics.spec.ts @@ -73,7 +73,7 @@ describe('Nft detection event', function () { participateInMetaMetrics: true, }); const events = await getEventPayloads(driver, mockedEndpoints); - assert.equal(events.length, 3); + assert.equal(events.length, 2); assert.deepStrictEqual(events[0].properties, { account_type: 'metamask', category: 'Onboarding', @@ -89,13 +89,6 @@ describe('Nft detection event', function () { environment_type: 'fullscreen', is_profile_syncing_enabled: true, }); - assert.deepStrictEqual(events[2].properties, { - nft_autodetection_enabled: true, - category: 'Onboarding', - locale: 'en', - chain_id: '0x539', - environment_type: 'background', - }); }, ); }); diff --git a/test/e2e/tests/metrics/swaps.spec.js b/test/e2e/tests/metrics/swaps.spec.js index 0023eda78de6..93eac6d2f846 100644 --- a/test/e2e/tests/metrics/swaps.spec.js +++ b/test/e2e/tests/metrics/swaps.spec.js @@ -3,11 +3,9 @@ const { toHex } = require('@metamask/controller-utils'); const FixtureBuilder = require('../../fixture-builder'); const { withFixtures, - generateGanacheOptions, unlockWallet, getEventPayloads, assertInAnyOrder, - genRandInitBal, } = require('../../helpers'); const { buildQuote, @@ -94,8 +92,6 @@ async function mockSegmentAndMetaswapRequests(mockServer) { // TODO: (MM-PENDING) These tests are planned for deprecation as part of swaps testing revamp describe('Swap Eth for another Token', function () { it('Completes a Swap between ETH and DAI after changing initial rate', async function () { - const { initialBalanceInHex } = genRandInitBal(); - await withFixtures( { fixtures: new FixtureBuilder() @@ -104,9 +100,6 @@ describe('Swap Eth for another Token', function () { participateInMetaMetrics: true, }) .build(), - localNodeOptions: generateGanacheOptions({ - balance: initialBalanceInHex, - }), title: this.test.fullTitle(), testSpecificMock: mockSegmentAndMetaswapRequests, }, diff --git a/test/e2e/tests/metrics/token-detection-metrics.spec.ts b/test/e2e/tests/metrics/token-detection-metrics.spec.ts index c50e74cc6c07..de87667784b9 100644 --- a/test/e2e/tests/metrics/token-detection-metrics.spec.ts +++ b/test/e2e/tests/metrics/token-detection-metrics.spec.ts @@ -71,7 +71,7 @@ describe('Token detection event', function () { }); const events = await getEventPayloads(driver, mockedEndpoints); - assert.equal(events.length, 3); + assert.equal(events.length, 2); assert.deepStrictEqual(events[0].properties, { account_type: 'metamask', category: 'Onboarding', @@ -87,13 +87,6 @@ describe('Token detection event', function () { environment_type: 'fullscreen', is_profile_syncing_enabled: true, }); - assert.deepStrictEqual(events[2].properties, { - token_detection_enabled: true, - category: 'Onboarding', - locale: 'en', - chain_id: '0x539', - environment_type: 'background', - }); }, ); }); diff --git a/test/e2e/tests/multichain/asset-picker-send.spec.ts b/test/e2e/tests/multichain/asset-picker-send.spec.ts index 77d210959c77..66f651588e44 100644 --- a/test/e2e/tests/multichain/asset-picker-send.spec.ts +++ b/test/e2e/tests/multichain/asset-picker-send.spec.ts @@ -3,7 +3,6 @@ import { Context } from 'mocha'; import { CHAIN_IDS } from '../../../../shared/constants/network'; import FixtureBuilder from '../../fixture-builder'; import { - defaultGanacheOptions, openActionMenuAndStartSendFlow, unlockWallet, withFixtures, @@ -17,7 +16,6 @@ describe('AssetPickerSendFlow', function () { const fixtures = { fixtures: new FixtureBuilder({ inputChainId: chainId }).build(), localNodeOptions: { - ...defaultGanacheOptions, chainId: parseInt(chainId, 16), }, }; diff --git a/test/e2e/tests/request-queuing/sendTx-revokePermissions.spec.ts b/test/e2e/tests/request-queuing/sendTx-revokePermissions.spec.ts index 733c0eb10426..b88d999dda9e 100644 --- a/test/e2e/tests/request-queuing/sendTx-revokePermissions.spec.ts +++ b/test/e2e/tests/request-queuing/sendTx-revokePermissions.spec.ts @@ -4,11 +4,7 @@ import TransactionConfirmation from '../../page-objects/pages/confirmations/rede import { Driver } from '../../webdriver/driver'; import { DEFAULT_FIXTURE_ACCOUNT } from '../../constants'; import FixtureBuilder from '../../fixture-builder'; -import { - withFixtures, - defaultGanacheOptions, - WINDOW_TITLES, -} from '../../helpers'; +import { withFixtures, WINDOW_TITLES } from '../../helpers'; describe('Request Queuing', function () { // TODO: add a new spec which checks that after revoking and connecting again @@ -22,9 +18,6 @@ describe('Request Queuing', function () { .withPermissionControllerConnectedToTestDapp() .withSelectedNetworkControllerPerDomain() .build(), - localNodeOptions: { - ...defaultGanacheOptions, - }, title: this.test?.fullTitle(), }, async ({ driver }: { driver: Driver }) => { diff --git a/test/e2e/tests/swap-send/swap-send-test-utils.ts b/test/e2e/tests/swap-send/swap-send-test-utils.ts index b3617237715d..46ca47de9c4d 100644 --- a/test/e2e/tests/swap-send/swap-send-test-utils.ts +++ b/test/e2e/tests/swap-send/swap-send-test-utils.ts @@ -2,7 +2,6 @@ import { strict as assert } from 'assert'; import { Mockttp } from 'mockttp'; import FixtureBuilder from '../../fixture-builder'; import { SWAPS_API_V2_BASE_URL } from '../../../../shared/constants/swaps'; -import { generateGanacheOptions } from '../../helpers'; import { SMART_CONTRACTS } from '../../seeder/smart-contracts'; import { SWAP_SEND_QUOTES_RESPONSE_ETH_TST } from './mocks/eth-data'; @@ -296,7 +295,7 @@ export const getSwapSendFixtures = ( smartContract: SMART_CONTRACTS.HST, ethConversionInUsd: ETH_CONVERSION_RATE_USD, testSpecificMock: mockSwapsApi(swapsQuotes, swapsQuery), - localNodeOptions: generateGanacheOptions({ hardfork: 'london' }), + localNodeOptions: { hardfork: 'london' }, title, }; }; diff --git a/test/e2e/tests/tokens/add-token-using-search.spec.ts b/test/e2e/tests/tokens/add-token-using-search.spec.ts index b9b57d29b8b5..450ab541cdbe 100644 --- a/test/e2e/tests/tokens/add-token-using-search.spec.ts +++ b/test/e2e/tests/tokens/add-token-using-search.spec.ts @@ -1,5 +1,5 @@ import { MockedEndpoint, Mockttp } from 'mockttp'; -import { defaultGanacheOptions, withFixtures } from '../../helpers'; +import { withFixtures } from '../../helpers'; import FixtureBuilder from '../../fixture-builder'; import { CHAIN_IDS } from '../../../../shared/constants/network'; import AssetListPage from '../../page-objects/pages/home/asset-list'; @@ -48,7 +48,6 @@ describe('Add existing token using search', function () { }) .build(), localNodeOptions: { - ...defaultGanacheOptions, chainId: parseInt(CHAIN_IDS.BSC, 16), }, title: this.test?.fullTitle(), diff --git a/test/e2e/tests/tokens/send-erc20-with-loaded-state.spec.ts b/test/e2e/tests/tokens/send-erc20-with-loaded-state.spec.ts new file mode 100644 index 000000000000..9f3b21bbf268 --- /dev/null +++ b/test/e2e/tests/tokens/send-erc20-with-loaded-state.spec.ts @@ -0,0 +1,80 @@ +import { withFixtures } from '../../helpers'; +import FixtureBuilder from '../../fixture-builder'; +import ActivityListPage from '../../page-objects/pages/home/activity-list'; +import AssetListPage from '../../page-objects/pages/home/asset-list'; +import HomePage from '../../page-objects/pages/home/homepage'; +import SendTokenPage from '../../page-objects/pages/send/send-token-page'; +import TokenOverviewPage from '../../page-objects/pages/token-overview-page'; +import TokenTransferTransactionConfirmation from '../../page-objects/pages/confirmations/redesign/token-transfer-confirmation'; +import { loginWithBalanceValidation } from '../../page-objects/flows/login.flow'; + +describe('Send ERC20', function () { + it('should send DAI', async function () { + await withFixtures( + { + fixtures: new FixtureBuilder() + .withNetworkControllerOnMainnet() + .withTokensController({ + allTokens: { + '0x1': { + '0x5cfe73b6021e818b776b421b1c4db2474086a7e1': [ + { + address: '0x6b175474e89094c44da98b954eedeac495271d0f', + symbol: 'DAI', + decimals: 18, + isERC721: false, + aggregators: [], + }, + ], + }, + }, + }) + .build(), + title: this.test?.fullTitle(), + localNodeOptions: [ + { + type: 'anvil', + options: { + chainId: 1, + loadState: './test/e2e/seeder/network-states/with50Dai.json', + }, + }, + ], + }, + async ({ driver, localNodes }) => { + await loginWithBalanceValidation(driver, localNodes[0]); + + const homePage = new HomePage(driver); + const assetListPage = new AssetListPage(driver); + await homePage.check_pageIsLoaded(); + await assetListPage.clickOnAsset('DAI'); + + // Send DAI + const tokenOverviewPage = new TokenOverviewPage(driver); + await tokenOverviewPage.check_pageIsLoaded(); + await tokenOverviewPage.clickSend(); + + const sendTokenPage = new SendTokenPage(driver); + await sendTokenPage.check_pageIsLoaded(); + await sendTokenPage.fillRecipient( + '0x5cfe73b6021e818b776b421b1c4db2474086a7e1', + ); + await sendTokenPage.fillAmount('10'); + await sendTokenPage.goToNextScreen(); + + // Check transaction in the Activity list + const tokenTransferTransactionConfirmation = + new TokenTransferTransactionConfirmation(driver); + await tokenTransferTransactionConfirmation.check_walletInitiatedHeadingTitle(); + await tokenTransferTransactionConfirmation.check_networkParagraph(); + await tokenTransferTransactionConfirmation.check_networkFeeParagraph(); + + await tokenTransferTransactionConfirmation.clickFooterConfirmButton(); + await homePage.check_pageIsLoaded(); + const activityList = new ActivityListPage(driver); + await activityList.check_confirmedTxNumberDisplayedInActivity(); + await activityList.check_txAmountInActivity('-10 DAI'); + }, + ); + }); +}); diff --git a/test/e2e/tests/tokens/token-details.spec.ts b/test/e2e/tests/tokens/token-details.spec.ts index 9488de3b433d..8a07aecf709b 100644 --- a/test/e2e/tests/tokens/token-details.spec.ts +++ b/test/e2e/tests/tokens/token-details.spec.ts @@ -3,11 +3,7 @@ import { Context } from 'mocha'; import { CHAIN_IDS } from '../../../../shared/constants/network'; import { formatCurrency } from '../../../../ui/helpers/utils/confirm-tx.util'; import FixtureBuilder from '../../fixture-builder'; -import { - defaultGanacheOptions, - unlockWallet, - withFixtures, -} from '../../helpers'; +import { unlockWallet, withFixtures } from '../../helpers'; import { Driver } from '../../webdriver/driver'; import HomePage from '../../page-objects/pages/home/homepage'; import AssetListPage from '../../page-objects/pages/home/asset-list'; @@ -26,7 +22,6 @@ describe('Token Details', function () { const fixtures = { fixtures: new FixtureBuilder({ inputChainId: chainId }).build(), localNodeOptions: { - ...defaultGanacheOptions, chainId: parseInt(chainId, 16), }, }; diff --git a/test/e2e/tests/tokens/token-list.spec.ts b/test/e2e/tests/tokens/token-list.spec.ts index d8ebb02e5fa3..de7c62b58e19 100644 --- a/test/e2e/tests/tokens/token-list.spec.ts +++ b/test/e2e/tests/tokens/token-list.spec.ts @@ -4,11 +4,7 @@ import { zeroAddress } from 'ethereumjs-util'; import { Browser } from 'selenium-webdriver'; import { CHAIN_IDS } from '../../../../shared/constants/network'; import FixtureBuilder from '../../fixture-builder'; -import { - defaultGanacheOptions, - unlockWallet, - withFixtures, -} from '../../helpers'; +import { unlockWallet, withFixtures } from '../../helpers'; import { Driver } from '../../webdriver/driver'; import HomePage from '../../page-objects/pages/home/homepage'; import AssetListPage from '../../page-objects/pages/home/asset-list'; @@ -30,7 +26,6 @@ describe('Token List', function () { const fixtures = { fixtures: new FixtureBuilder({ inputChainId: chainId }).build(), localNodeOptions: { - ...defaultGanacheOptions, chainId: parseInt(chainId, 16), }, }; diff --git a/test/e2e/tests/tokens/token-sort.spec.ts b/test/e2e/tests/tokens/token-sort.spec.ts index b84f371a0d34..1682ef1210f8 100644 --- a/test/e2e/tests/tokens/token-sort.spec.ts +++ b/test/e2e/tests/tokens/token-sort.spec.ts @@ -1,12 +1,7 @@ import { Context } from 'mocha'; import { CHAIN_IDS } from '../../../../shared/constants/network'; import FixtureBuilder from '../../fixture-builder'; -import { - defaultGanacheOptions, - unlockWallet, - withFixtures, - largeDelayMs, -} from '../../helpers'; +import { unlockWallet, withFixtures, largeDelayMs } from '../../helpers'; import { Driver } from '../../webdriver/driver'; import HomePage from '../../page-objects/pages/home/homepage'; import AssetListPage from '../../page-objects/pages/home/asset-list'; @@ -19,7 +14,6 @@ describe('Token List Sorting', function () { const testFixtures = { fixtures: new FixtureBuilder({ inputChainId: mainnetChainId }).build(), localNodeOptions: { - ...defaultGanacheOptions, chainId: parseInt(mainnetChainId, 16), }, }; diff --git a/test/e2e/tests/transaction/edit-gas-fee.spec.js b/test/e2e/tests/transaction/edit-gas-fee.spec.js index bd2cf598d90b..c389f56f45b2 100644 --- a/test/e2e/tests/transaction/edit-gas-fee.spec.js +++ b/test/e2e/tests/transaction/edit-gas-fee.spec.js @@ -4,12 +4,7 @@ const { createDappTransaction, } = require('../../page-objects/flows/transaction'); -const { - withFixtures, - unlockWallet, - generateGanacheOptions, - WINDOW_TITLES, -} = require('../../helpers'); +const { withFixtures, unlockWallet, WINDOW_TITLES } = require('../../helpers'); const FixtureBuilder = require('../../fixture-builder'); describe('Editing Confirm Transaction', function () { @@ -17,7 +12,7 @@ describe('Editing Confirm Transaction', function () { await withFixtures( { fixtures: new FixtureBuilder().build(), - localNodeOptions: generateGanacheOptions({ hardfork: 'london' }), + localNodeOptions: { hardfork: 'london' }, title: this.test.fullTitle(), }, async ({ driver }) => { @@ -97,7 +92,7 @@ describe('Editing Confirm Transaction', function () { }, }) .build(), - localNodeOptions: generateGanacheOptions({ hardfork: 'london' }), + localNodeOptions: { hardfork: 'london' }, title: this.test.fullTitle(), }, async ({ driver }) => { @@ -178,7 +173,7 @@ describe('Editing Confirm Transaction', function () { }, }) .build(), - localNodeOptions: generateGanacheOptions({ hardfork: 'london' }), + localNodeOptions: { hardfork: 'london' }, title: this.test.fullTitle(), dapp: true, }, diff --git a/test/e2e/tests/transaction/gas-estimates.spec.js b/test/e2e/tests/transaction/gas-estimates.spec.js index 043b8d852da0..ba76ed305c8d 100644 --- a/test/e2e/tests/transaction/gas-estimates.spec.js +++ b/test/e2e/tests/transaction/gas-estimates.spec.js @@ -2,19 +2,14 @@ const { withFixtures, logInWithBalanceValidation, openActionMenuAndStartSendFlow, - generateGanacheOptions, } = require('../../helpers'); const FixtureBuilder = require('../../fixture-builder'); const { CHAIN_IDS } = require('../../../../shared/constants/network'); const { GAS_API_BASE_URL } = require('../../../../shared/constants/swaps'); describe('Gas estimates generated by MetaMask', function () { - const preLondonGanacheOptions = generateGanacheOptions({ - hardfork: 'berlin', - }); - const postLondonGanacheOptions = generateGanacheOptions({ - hardfork: 'london', - }); + const preLondonGanacheOptions = { hardfork: 'berlin' }; + const postLondonGanacheOptions = { hardfork: 'london' }; describe('Send on a network that is EIP-1559 compatible', function () { it('show expected gas defaults', async function () { diff --git a/test/e2e/tests/transaction/multiple-transactions.spec.js b/test/e2e/tests/transaction/multiple-transactions.spec.js index 1053a413c808..c7404c653db0 100644 --- a/test/e2e/tests/transaction/multiple-transactions.spec.js +++ b/test/e2e/tests/transaction/multiple-transactions.spec.js @@ -4,7 +4,6 @@ const { openDapp, regularDelayMs, unlockWallet, - generateGanacheOptions, WINDOW_TITLES, } = require('../../helpers'); const FixtureBuilder = require('../../fixture-builder'); @@ -17,7 +16,7 @@ describe('Multiple transactions', function () { fixtures: new FixtureBuilder() .withPermissionControllerConnectedToTestDapp() .build(), - localNodeOptions: generateGanacheOptions({ hardfork: 'london' }), + localNodeOptions: { hardfork: 'london' }, title: this.test.fullTitle(), }, async ({ driver }) => { @@ -79,7 +78,7 @@ describe('Multiple transactions', function () { fixtures: new FixtureBuilder() .withPermissionControllerConnectedToTestDapp() .build(), - localNodeOptions: generateGanacheOptions({ hardfork: 'london' }), + localNodeOptions: { hardfork: 'london' }, title: this.test.fullTitle(), }, async ({ driver }) => { diff --git a/test/e2e/tests/transaction/navigate-transactions.spec.js b/test/e2e/tests/transaction/navigate-transactions.spec.js index 6bcd74ec477e..ad8496eadea4 100644 --- a/test/e2e/tests/transaction/navigate-transactions.spec.js +++ b/test/e2e/tests/transaction/navigate-transactions.spec.js @@ -10,7 +10,6 @@ const { openDapp, locateAccountBalanceDOM, unlockWallet, - generateGanacheOptions, WINDOW_TITLES, } = require('../../helpers'); const FixtureBuilder = require('../../fixture-builder'); @@ -25,7 +24,7 @@ describe('Navigate transactions', function () { .withPreferencesControllerTxSimulationsDisabled() .withPermissionControllerConnectedToTestDapp() .build(), - localNodeOptions: generateGanacheOptions({ hardfork: 'london' }), + localNodeOptions: { hardfork: 'london' }, title: this.test.fullTitle(), dapp: true, }, @@ -65,7 +64,7 @@ describe('Navigate transactions', function () { .withPermissionControllerConnectedToTestDapp() .withPreferencesControllerTxSimulationsDisabled() .build(), - localNodeOptions: generateGanacheOptions({ hardfork: 'london' }), + localNodeOptions: { hardfork: 'london' }, title: this.test.fullTitle(), }, async ({ driver }) => { @@ -99,7 +98,7 @@ describe('Navigate transactions', function () { .withPreferencesControllerTxSimulationsDisabled() .withPermissionControllerConnectedToTestDapp() .build(), - localNodeOptions: generateGanacheOptions({ hardfork: 'london' }), + localNodeOptions: { hardfork: 'london' }, title: this.test.fullTitle(), dapp: true, }, @@ -124,7 +123,7 @@ describe('Navigate transactions', function () { .withPreferencesControllerTxSimulationsDisabled() .withPermissionControllerConnectedToTestDapp() .build(), - localNodeOptions: generateGanacheOptions({ hardfork: 'london' }), + localNodeOptions: { hardfork: 'london' }, title: this.test.fullTitle(), dapp: true, }, @@ -149,7 +148,7 @@ describe('Navigate transactions', function () { .withPreferencesControllerTxSimulationsDisabled() .withPermissionControllerConnectedToTestDapp() .build(), - localNodeOptions: generateGanacheOptions({ hardfork: 'london' }), + localNodeOptions: { hardfork: 'london' }, title: this.test.fullTitle(), dapp: true, }, diff --git a/test/e2e/tests/transaction/send-edit.spec.js b/test/e2e/tests/transaction/send-edit.spec.js index d90cad998f27..a99cf4af1921 100644 --- a/test/e2e/tests/transaction/send-edit.spec.js +++ b/test/e2e/tests/transaction/send-edit.spec.js @@ -3,11 +3,7 @@ const { createInternalTransaction, } = require('../../page-objects/flows/transaction'); -const { - withFixtures, - unlockWallet, - generateGanacheOptions, -} = require('../../helpers'); +const { withFixtures, unlockWallet } = require('../../helpers'); const FixtureBuilder = require('../../fixture-builder'); describe('Editing Confirm Transaction', function () { @@ -110,7 +106,7 @@ describe('Editing Confirm Transaction', function () { }, }) .build(), - localNodeOptions: generateGanacheOptions({ hardfork: 'london' }), + localNodeOptions: { hardfork: 'london' }, title: this.test.fullTitle(), }, async ({ driver }) => { diff --git a/test/e2e/tests/transaction/send-max.spec.js b/test/e2e/tests/transaction/send-max.spec.js index 41d2e44891f0..9454cd572ac0 100644 --- a/test/e2e/tests/transaction/send-max.spec.js +++ b/test/e2e/tests/transaction/send-max.spec.js @@ -1,4 +1,4 @@ -const { withFixtures, generateGanacheOptions } = require('../../helpers'); +const { withFixtures } = require('../../helpers'); const { createInternalTransactionWithMaxAmount, reviewTransaction, @@ -25,7 +25,7 @@ describe('Sending with max amount', function () { }, }) .build(), - localNodeOptions: generateGanacheOptions({ hardfork: 'london' }), + localNodeOptions: { hardfork: 'london' }, driverOptions: { timeOut: 15000 }, title: this.test.fullTitle(), }, @@ -55,7 +55,7 @@ describe('Sending with max amount', function () { }, }) .build(), - localNodeOptions: generateGanacheOptions({ hardfork: 'london' }), + localNodeOptions: { hardfork: 'london' }, title: this.test.fullTitle(), }, async ({ driver }) => { @@ -122,7 +122,7 @@ describe('Sending with max amount', function () { }, }) .build(), - localNodeOptions: generateGanacheOptions({ hardfork: 'london' }), + localNodeOptions: { hardfork: 'london' }, title: this.test.fullTitle(), }, async ({ driver }) => { @@ -177,7 +177,7 @@ describe('Sending with max amount', function () { }, }) .build(), - localNodeOptions: generateGanacheOptions({ hardfork: 'london' }), + localNodeOptions: { hardfork: 'london' }, driverOptions: { timeOut: 15000 }, title: this.test.fullTitle(), }, @@ -252,7 +252,7 @@ describe('Sending with max amount', function () { }, }) .build(), - localNodeOptions: generateGanacheOptions({ hardfork: 'london' }), + localNodeOptions: { hardfork: 'london' }, title: this.test.fullTitle(), }, async ({ driver }) => { diff --git a/test/e2e/tests/transaction/stuck-approved-transaction.spec.ts b/test/e2e/tests/transaction/stuck-approved-transaction.spec.ts index 5d0d12fcb21f..54df27530167 100644 --- a/test/e2e/tests/transaction/stuck-approved-transaction.spec.ts +++ b/test/e2e/tests/transaction/stuck-approved-transaction.spec.ts @@ -1,5 +1,5 @@ import { Suite } from 'mocha'; -import { withFixtures, generateGanacheOptions } from '../../helpers'; +import { withFixtures } from '../../helpers'; import FixtureBuilder from '../../fixture-builder'; import { Driver } from '../../webdriver/driver'; import { loginWithBalanceValidation } from '../../page-objects/flows/login.flow'; @@ -13,7 +13,7 @@ describe('Editing Confirm Transaction', function (this: Suite) { fixtures: new FixtureBuilder() .withTransactionControllerApprovedTransaction() .build(), - localNodeOptions: generateGanacheOptions({ hardfork: 'london' }), + localNodeOptions: { hardfork: 'london' }, title: this.test?.fullTitle(), }, async ({ driver }: { driver: Driver }) => { diff --git a/test/integration/confirmations/transactions/erc20-approve.test.tsx b/test/integration/confirmations/transactions/erc20-approve.test.tsx index 4362254c2674..539be39d9844 100644 --- a/test/integration/confirmations/transactions/erc20-approve.test.tsx +++ b/test/integration/confirmations/transactions/erc20-approve.test.tsx @@ -272,46 +272,6 @@ describe('ERC20 Approve Confirmation', () => { expect(requestFromTooltipContent).toBeInTheDocument(); }); - it('displays spending cap section with correct data', async () => { - const testUser = userEvent.setup(); - - const mockedMetaMaskState = - getMetaMaskStateWithUnapprovedApproveTransaction(); - - await act(async () => { - await integrationTestRender({ - preloadedState: mockedMetaMaskState, - backgroundConnection: backgroundConnectionMocked, - }); - }); - - const spendingCapSection = await screen.findByTestId( - 'confirmation__approve-spending-cap-section', - ); - expect(spendingCapSection).toBeInTheDocument(); - - expect(spendingCapSection).toHaveTextContent( - tEn('accountBalance') as string, - ); - expect(spendingCapSection).toHaveTextContent('0'); - const spendingCapGroup = await screen.findByTestId( - 'confirmation__approve-spending-cap-group', - ); - expect(spendingCapSection).toContainElement(spendingCapGroup); - expect(spendingCapGroup).toHaveTextContent(tEn('spendingCap') as string); - expect(spendingCapGroup).toHaveTextContent('1'); - - const spendingCapGroupTooltip = await screen.findByTestId( - 'confirmation__approve-spending-cap-group-tooltip', - ); - expect(spendingCapGroup).toContainElement(spendingCapGroupTooltip); - await testUser.hover(spendingCapGroupTooltip); - const requestFromTooltipContent = await screen.findByText( - tEn('spendingCapTooltipDesc') as string, - ); - expect(requestFromTooltipContent).toBeInTheDocument(); - }); - it('displays the advanced transaction details section', async () => { const testUser = userEvent.setup(); diff --git a/test/integration/confirmations/transactions/increase-allowance.test.tsx b/test/integration/confirmations/transactions/increase-allowance.test.tsx index 4d6f552dca8a..317c2c782bb2 100644 --- a/test/integration/confirmations/transactions/increase-allowance.test.tsx +++ b/test/integration/confirmations/transactions/increase-allowance.test.tsx @@ -273,46 +273,6 @@ describe('ERC20 increaseAllowance Confirmation', () => { expect(requestFromTooltipContent).toBeInTheDocument(); }); - it('displays spending cap section with correct data', async () => { - const testUser = userEvent.setup(); - - const mockedMetaMaskState = - getMetaMaskStateWithUnapprovedIncreaseAllowanceTransaction(); - - await act(async () => { - await integrationTestRender({ - preloadedState: mockedMetaMaskState, - backgroundConnection: backgroundConnectionMocked, - }); - }); - - const spendingCapSection = await screen.findByTestId( - 'confirmation__approve-spending-cap-section', - ); - expect(spendingCapSection).toBeInTheDocument(); - - expect(spendingCapSection).toHaveTextContent( - tEn('accountBalance') as string, - ); - expect(spendingCapSection).toHaveTextContent('0'); - const spendingCapGroup = await screen.findByTestId( - 'confirmation__approve-spending-cap-group', - ); - expect(spendingCapSection).toContainElement(spendingCapGroup); - expect(spendingCapGroup).toHaveTextContent(tEn('spendingCap') as string); - expect(spendingCapGroup).toHaveTextContent('3'); - - const spendingCapGroupTooltip = await screen.findByTestId( - 'confirmation__approve-spending-cap-group-tooltip', - ); - expect(spendingCapGroup).toContainElement(spendingCapGroupTooltip); - await testUser.hover(spendingCapGroupTooltip); - const requestFromTooltipContent = await screen.findByText( - tEn('spendingCapTooltipDesc') as string, - ); - expect(requestFromTooltipContent).toBeInTheDocument(); - }); - it('displays the advanced transaction details section', async () => { const testUser = userEvent.setup(); diff --git a/test/stub/keyring-bridge.js b/test/stub/keyring-bridge.js index 3d4b4824ed82..13ddb7d9be2c 100644 --- a/test/stub/keyring-bridge.js +++ b/test/stub/keyring-bridge.js @@ -1,7 +1,7 @@ -import { Transaction } from '@ethereumjs/tx'; +import { TransactionFactory } from '@ethereumjs/tx'; import { signTypedData, SignTypedDataVersion } from '@metamask/eth-sig-util'; -import { bufferToHex } from 'ethereumjs-util'; -import { addHexPrefix, Common } from './keyring-utils'; +import { bigIntToHex, bytesToHex } from '@metamask/utils'; +import { Common } from './keyring-utils'; // BIP32 Public Key: xpub6ELgkkwgfoky9h9fFu4Auvx6oHvJ6XfwiS1NE616fe9Uf4H3JHtLGjCePVkb6RFcyDCqVvjXhNXbDNDqs6Kjoxw7pTAeP1GSEiLHmA5wYa9 // BIP32 Private Key: xprvA1MLMFQnqSCfwD5C9sXAYo1NFG5oh4x6MD5mRhbV7JcVnFwtkka5ivtAYDYJsr9GS242p3QZMbsMZC1GZ2uskNeTj9VhYxrCqRG6U5UPXp5 @@ -92,7 +92,7 @@ export class FakeTrezorBridge extends FakeKeyringBridge { hardfork: 'istanbul', }); - const signedTransaction = Transaction.fromTxData(transaction, { + const signedTransaction = TransactionFactory.fromTxData(transaction, { common, }).sign(Buffer.from(KNOWN_PRIVATE_KEYS[0], 'hex')); @@ -100,10 +100,10 @@ export class FakeTrezorBridge extends FakeKeyringBridge { id: 1, success: true, payload: { - v: signedTransaction.v, - r: signedTransaction.r, - s: signedTransaction.s, - serializedTx: addHexPrefix(bufferToHex(signedTransaction.serialize())), + v: bigIntToHex(signedTransaction.v), + r: bigIntToHex(signedTransaction.r), + s: bigIntToHex(signedTransaction.s), + serializedTx: bytesToHex(signedTransaction.serialize()), }, }; } diff --git a/test/stub/keyring-utils.js b/test/stub/keyring-utils.js index 2990e63dc26d..603f973c485b 100644 --- a/test/stub/keyring-utils.js +++ b/test/stub/keyring-utils.js @@ -15,6 +15,7 @@ export class Common { constructor({ chain, hardfork }) { this.chain = chain; this.hardfork = hardfork; + this.customCrypto = {}; } /** diff --git a/ui/components/app/alert-system/multiple-alert-modal/multiple-alert-modal.test.tsx b/ui/components/app/alert-system/multiple-alert-modal/multiple-alert-modal.test.tsx index 3d176e57ccd0..3e96334c4e3e 100644 --- a/ui/components/app/alert-system/multiple-alert-modal/multiple-alert-modal.test.tsx +++ b/ui/components/app/alert-system/multiple-alert-modal/multiple-alert-modal.test.tsx @@ -199,6 +199,61 @@ describe('MultipleAlertModal', () => { expect(getByText(alertsMock[0].message)).toBeInTheDocument(); }); + describe('FieldAlerts not present', () => { + const alertsMockWithoutField = [ + { + key: FROM_ALERT_KEY_MOCK, + severity: Severity.Warning, + message: 'Alert 1', + reason: 'Reason 1', + alertDetails: ['Detail 1', 'Detail 2'], + }, + { + key: DATA_ALERT_KEY_MOCK, + severity: Severity.Danger, + message: 'Alert 2', + }, + { + key: CONTRACT_ALERT_KEY_MOCK, + severity: Severity.Info, + message: 'Alert 3', + }, + ]; + + const mockStoreWithAlertsWithoutField = configureMockStore([])({ + ...STATE_MOCK, + confirmAlerts: { + alerts: { [OWNER_ID_MOCK]: alertsMockWithoutField }, + confirmed: {}, + }, + }); + + it('does not render if displayAllAlerts is false', () => { + const { queryByText } = renderWithProvider( + , + mockStoreWithAlertsWithoutField, + ); + + expect(queryByText('alert-modal-button')).toBeNull(); + }); + + it('renders alerts if displayAllAlerts is true', () => { + const { getByTestId } = renderWithProvider( + , + mockStoreWithAlertsWithoutField, + ); + + expect(getByTestId('alert-modal-button')).toBeInTheDocument(); + }); + }); + describe('Navigation', () => { it('calls next alert when the next button is clicked', () => { const { getByTestId, getByText } = renderWithProvider( diff --git a/ui/components/app/alert-system/multiple-alert-modal/multiple-alert-modal.tsx b/ui/components/app/alert-system/multiple-alert-modal/multiple-alert-modal.tsx index 62875bffcfe0..30307f9d1dca 100644 --- a/ui/components/app/alert-system/multiple-alert-modal/multiple-alert-modal.tsx +++ b/ui/components/app/alert-system/multiple-alert-modal/multiple-alert-modal.tsx @@ -24,6 +24,8 @@ import { Alert } from '../../../../ducks/confirm-alerts/confirm-alerts'; export type MultipleAlertModalProps = { /** The key of the initial alert to display. */ alertKey?: string; + /** If true the modal will display non-field alerts also. */ + displayAllAlerts?: boolean; /** The function to be executed when the button in the alert modal is clicked. */ onFinalAcknowledgeClick: () => void; /** The function to be executed when the modal needs to be closed. */ @@ -146,15 +148,17 @@ function PageNavigation({ export function MultipleAlertModal({ alertKey, + displayAllAlerts = false, onClose, onFinalAcknowledgeClick, ownerId, showCloseIcon = true, skipAlertNavigation = false, }: MultipleAlertModalProps) { - const { isAlertConfirmed, fieldAlerts: alerts } = useAlerts(ownerId); + const { isAlertConfirmed, fieldAlerts, alerts } = useAlerts(ownerId); + const alertsToDisplay = displayAllAlerts ? alerts : fieldAlerts; - const initialAlertIndex = alerts.findIndex( + const initialAlertIndex = alertsToDisplay.findIndex( (alert: Alert) => alert.key === alertKey, ); @@ -163,7 +167,7 @@ export function MultipleAlertModal({ ); // If the selected alert is not found, default to the first alert - const selectedAlert = alerts[selectedIndex] ?? alerts[0]; + const selectedAlert = alertsToDisplay[selectedIndex] ?? alertsToDisplay[0]; const hasUnconfirmedAlerts = alerts.some( (alert: Alert) => @@ -186,7 +190,7 @@ export function MultipleAlertModal({ return; } - if (selectedIndex + 1 === alerts.length) { + if (selectedIndex + 1 === alertsToDisplay.length) { if (!hasUnconfirmedAlerts) { onFinalAcknowledgeClick(); return; @@ -200,7 +204,7 @@ export function MultipleAlertModal({ onFinalAcknowledgeClick, handleNextButtonClick, selectedIndex, - alerts.length, + alertsToDisplay.length, hasUnconfirmedAlerts, skipAlertNavigation, ]); @@ -213,7 +217,7 @@ export function MultipleAlertModal({ onClose={onClose} headerStartAccessory={ true, - rpcPrefs: { - blockExplorerUrl: 'https://explorer.bitcoin.com', - }, - }, - }, + userAddress: MOCK_ACCOUNT_SOLANA_MAINNET.address, }; describe('MultichainTransactionDetailsModal', () => { @@ -92,7 +126,13 @@ describe('MultichainTransactionDetailsModal', () => { jest.clearAllMocks(); }); - const renderComponent = (props = mockProps) => { + const renderComponent = ( + props: { + transaction: Transaction; + onClose: jest.Mock; + userAddress: string; + } = mockProps, + ) => { return renderWithProvider( @@ -125,7 +165,14 @@ describe('MultichainTransactionDetailsModal', () => { it('displays network fee when present', () => { renderComponent(); - expect(screen.getByText('1.0001 BTC')).toBeInTheDocument(); + + const feeElement = + screen.queryByTestId('transaction-network-fee') || + screen.queryByTestId('transaction-base-fee'); + + expect(feeElement).not.toBeNull(); + expect(feeElement?.textContent).toContain('1.0001'); + expect(feeElement?.textContent).toContain('BTC'); }); it('calls onClose when close button is clicked', () => { @@ -236,4 +283,35 @@ describe('MultichainTransactionDetailsModal', () => { `https://blockstream.info/testnet/address/${address}`, ); }); + + it('renders Solana swap transaction details correctly', () => { + const userAddress = MOCK_ACCOUNT_SOLANA_MAINNET.address; + const swapProps = { + transaction: mockSwapTransaction, + onClose: jest.fn(), + userAddress, + }; + + renderComponent(swapProps); + + expect(screen.getByText('Swap')).toBeInTheDocument(); + expect(screen.getByTestId('transaction-amount')).toHaveTextContent( + '2.5 SOL', + ); + + const addressStart = userAddress.substring(0, 6); + const addressElements = screen.getAllByText((_content, element) => { + return element?.textContent?.includes(addressStart) || false; + }); + + expect(addressElements.length).toBeGreaterThan(0); + + const feeElement = + screen.queryByTestId('transaction-network-fee') || + screen.queryByTestId('transaction-base-fee'); + + expect(feeElement).not.toBeNull(); + expect(feeElement?.textContent).toContain('0.000005'); + expect(feeElement?.textContent).toContain('SOL'); + }); }); diff --git a/ui/components/app/multichain-transaction-details-modal/multichain-transaction-details-modal.tsx b/ui/components/app/multichain-transaction-details-modal/multichain-transaction-details-modal.tsx index 27d13f33222d..54bf8b8f50ad 100644 --- a/ui/components/app/multichain-transaction-details-modal/multichain-transaction-details-modal.tsx +++ b/ui/components/app/multichain-transaction-details-modal/multichain-transaction-details-modal.tsx @@ -1,6 +1,11 @@ import React, { useContext } from 'react'; import { capitalize } from 'lodash'; -import { Transaction, TransactionStatus } from '@metamask/keyring-api'; +import { + Transaction, + TransactionStatus, + Asset, + TransactionType, +} from '@metamask/keyring-api'; import { Display, FlexDirection, @@ -48,11 +53,13 @@ import { export type MultichainTransactionDetailsModalProps = { transaction: Transaction; onClose: () => void; + userAddress: string; }; export function MultichainTransactionDetailsModal({ transaction, onClose, + userAddress, }: MultichainTransactionDetailsModalProps) { const t = useI18nContext(); const trackEvent = useContext(MetaMetricsContext); @@ -70,7 +77,7 @@ export function MultichainTransactionDetailsModal({ } }; - const getAssetDisplay = (asset: typeof fromAsset) => { + const getAssetDisplay = (asset: Asset | null) => { if (!asset) { return null; } @@ -83,22 +90,42 @@ export function MultichainTransactionDetailsModal({ return null; }; - if (!transaction?.from?.[0] || !transaction?.to?.[0]) { - return null; + const { id: txId, fees, timestamp, status, chain, type } = transaction; + + let fromAddress, toAddress, asset; + + const txFromEntry = transaction.from?.find( + (entry) => entry?.address === userAddress, + ); + const txToEntry = transaction.to?.find( + (entry) => entry?.address === userAddress, + ); + + switch (type) { + case TransactionType.Swap: + fromAddress = txFromEntry?.address || ''; + toAddress = txToEntry?.address || ''; + asset = txFromEntry?.asset || null; + break; + case TransactionType.Send: + fromAddress = + txFromEntry?.address || transaction.from?.[0]?.address || ''; + toAddress = transaction.to?.[0]?.address || ''; + asset = txFromEntry?.asset || transaction.from?.[0]?.asset || null; + break; + case TransactionType.Receive: + fromAddress = transaction.from?.[0]?.address || ''; + toAddress = txToEntry?.address || transaction.to?.[0]?.address || ''; + asset = txToEntry?.asset || transaction.to?.[0]?.asset || null; + break; + default: + fromAddress = transaction.from?.[0]?.address || ''; + toAddress = transaction.to?.[0]?.address || ''; + asset = transaction.to?.[0]?.asset || null; } - // We only support 1 recipient for "from" and "to" for now: - const { - id: txId, - from: [{ address: fromAddress, asset: fromAsset }], - to: [{ address: toAddress }], - fees: [{ asset: feeAsset }], - fees, - timestamp, - status, - chain, - type, - } = transaction; + const baseFee = fees?.find((fee) => fee.type === 'base')?.asset; + const priorityFee = fees?.find((fee) => fee.type === 'priority')?.asset; return ( {/* Status */} {/* From */} - {getAssetDisplay(fromAsset)} + {getAssetDisplay(asset)} - {/* Network Fee */} + {/* Network Fees */} {fees?.length > 0 && ( - - - {t('networkFee')} - - - - {getAssetDisplay(feeAsset)} - - - + <> + {baseFee && ( + + + {t('networkFee')} + + + + {getAssetDisplay(baseFee)} + + + + )} + + {priorityFee && ( + + + {t('priorityFee')} + + + + {getAssetDisplay(priorityFee)} + + + + )} + )} diff --git a/ui/components/app/transaction-list/transaction-list.component.js b/ui/components/app/transaction-list/transaction-list.component.js index 6417990b8689..dcaa91fc955c 100644 --- a/ui/components/app/transaction-list/transaction-list.component.js +++ b/ui/components/app/transaction-list/transaction-list.component.js @@ -334,6 +334,35 @@ export default function TransactionList({ setSelectedTransaction(transaction); }, []); + const getTransactionDisplayAmount = (transaction, userAddress) => { + const userFromEntry = transaction.from?.find( + (entry) => entry.address === userAddress, + ); + + const userToEntry = transaction.to?.find( + (entry) => entry.address === userAddress, + ); + + // Amount of the token sent + if (userFromEntry?.asset?.amount) { + return `-${userFromEntry.asset.amount} ${userFromEntry.asset.unit || ''}`; + } + + // Amount of the token received + if (userToEntry?.asset?.amount) { + return `${userToEntry.asset.amount} ${userToEntry.asset.unit || ''}`; + } + + // Fallback: Amount of the token received + if (transaction.from?.[0]?.asset?.amount) { + return `${transaction.from?.[0]?.asset?.amount} ${ + transaction.from?.[0]?.asset?.unit || '' + }`; + } + + return ''; + }; + const multichainNetwork = useMultichainSelector( getMultichainNetwork, selectedAccount, @@ -341,6 +370,28 @@ export default function TransactionList({ const trackEvent = useContext(MetaMetricsContext); + const formatTransactionTitle = (transaction, userAddress) => { + switch (transaction.type) { + case TransactionType.swap: { + const userToEntry = transaction.to?.find( + (entry) => entry.address === userAddress, + ); + const userFromEntry = transaction.from?.find( + (entry) => entry.address === userAddress, + ); + + if (userFromEntry && userToEntry) { + return `${t('swap')} ${userFromEntry.asset.unit} ${'to'} ${ + userToEntry.asset.unit + }`; + } + return capitalize(transaction.type); + } + default: + return capitalize(transaction.type); + } + }; + if (!isEvmAccountType(selectedAccount.type)) { const addressLink = getMultichainAccountUrl( selectedAccount.address, @@ -354,6 +405,7 @@ export default function TransactionList({ toggleShowDetails(null)} + userAddress={selectedAccount.address} /> )} @@ -427,17 +479,20 @@ export default function TransactionList({ title="Primary Currency" variant="body-lg-medium" > - {transaction.from?.[0]?.asset?.amount && - transaction.from[0]?.asset?.unit - ? `${transaction.from[0].asset.amount} ${transaction.from[0].asset.unit}` - : ''} + {getTransactionDisplayAmount( + transaction, + selectedAccount.address, + )} } title={ transaction.isBridgeTx ? t('bridge') - : capitalize(transaction.type) + : formatTransactionTitle( + transaction, + selectedAccount.address, + ) } // eslint-disable-next-line react/jsx-no-duplicate-props subtitle={ diff --git a/ui/components/app/transaction-list/transaction-list.test.js b/ui/components/app/transaction-list/transaction-list.test.js index 48e42fb2c309..9fa56b4494ce 100644 --- a/ui/components/app/transaction-list/transaction-list.test.js +++ b/ui/components/app/transaction-list/transaction-list.test.js @@ -3,7 +3,10 @@ import { fireEvent } from '@testing-library/react'; import { renderWithProvider } from '../../../../test/jest'; import configureStore from '../../../store/store'; import mockState from '../../../../test/data/mock-state.json'; -import { MOCK_ACCOUNT_BIP122_P2WPKH } from '../../../../test/data/mock-accounts'; +import { + MOCK_ACCOUNT_BIP122_P2WPKH, + MOCK_ACCOUNT_SOLANA_MAINNET, +} from '../../../../test/data/mock-accounts'; import { MetaMetricsContext } from '../../../contexts/metametrics'; import { MetaMetricsEventCategory, @@ -60,6 +63,135 @@ const btcState = { }, }; +const solanaSwapState = { + metamask: { + ...mockState.metamask, + nonEvmTransactions: { + [MOCK_ACCOUNT_SOLANA_MAINNET.id]: { + transactions: [ + { + id: '2pfnv4drhnitfzCFKxiRoJMzFQpG7wZ9mpRQVk7xm5TQ27g6FZH95HVF6KgwQBS872yGtyhuq57jXXS1y29ub11', + timestamp: 1740480781, + chain: MultichainNetworks.SOLANA, + status: 'confirmed', + type: 'swap', + from: [ + { + address: '8kR2HTHzPtTJuzpFZ8jtGCQ9TpahPaWbZfTNRs2GJdxq', + asset: { + fungible: true, + type: '', + unit: 'SOL', + amount: '0.000073111', + }, + }, + { + address: MOCK_ACCOUNT_SOLANA_MAINNET.address, + asset: { + fungible: true, + type: '', + unit: 'SOL', + amount: '0.01', + }, + }, + { + address: 'HUCjBnmd4FoUjCCMYQ9xFz1ce1r8vWAd8uMhUQakE2FR', + asset: { + fungible: true, + type: '', + unit: 'BONK', + amount: '2583.728601', + }, + }, + { + address: '3msVd34R5KxonDzyNSV5nT19UtUeJ2RF1NaQhvVPNLxL', + asset: { + fungible: true, + type: '', + unit: 'SOL', + amount: '0.000073111', + }, + }, + ], + to: [ + { + address: 'CebN5WGQ4jvEPvsVU4EoHEpgzq1VV7AbicfhtW4xC9iM', + asset: { + fungible: true, + type: '', + unit: 'SOL', + amount: '0.000000723', + }, + }, + { + address: 'HUCjBnmd4FoUjCCMYQ9xFz1ce1r8vWAd8uMhUQakE2FR', + asset: { + fungible: true, + type: '', + unit: 'SOL', + amount: '0.00007238', + }, + }, + { + address: MOCK_ACCOUNT_SOLANA_MAINNET.address, + asset: { + fungible: true, + type: '', + unit: 'BONK', + amount: '2583.72', + }, + }, + { + address: '3msVd34R5KxonDzyNSV5nT19UtUeJ2RF1NaQhvVPNLxL', + asset: { + fungible: true, + type: '', + unit: 'SOL', + amount: '0.01', + }, + }, + ], + fees: [ + { + type: 'base', + asset: { + fungible: true, + type: '', + unit: 'SOL', + amount: '0.000005', + }, + }, + { + type: 'priority', + asset: { + fungible: true, + type: '', + unit: 'SOL', + amount: '0.000069798', + }, + }, + ], + events: [{ status: 'confirmed', timestamp: 1740480781 }], + }, + ], + next: null, + lastUpdated: expect.any(Number), + }, + }, + internalAccounts: { + ...mockState.metamask.internalAccounts, + accounts: { + ...mockState.metamask.internalAccounts.accounts, + [MOCK_ACCOUNT_SOLANA_MAINNET.id]: MOCK_ACCOUNT_SOLANA_MAINNET, + }, + selectedAccount: MOCK_ACCOUNT_SOLANA_MAINNET.id, + }, + selectedAddress: MOCK_ACCOUNT_SOLANA_MAINNET.address, + completedOnboarding: true, + transactions: [], + }, +}; + const mockTrackEvent = jest.fn(); const render = (state = defaultState) => { @@ -182,4 +314,20 @@ describe('TransactionList', () => { ), ).toBeNull(); }); + + it('renders TransactionList component and shows a Solana Swap Tx in the activity list', () => { + const { getByText, getByRole, getByTestId } = render(solanaSwapState); + + expect(getByText('Confirmed')).toBeInTheDocument(); + expect(getByText('Swap SOL to BONK')).toBeInTheDocument(); + + expect(getByTestId('activity-list-item')).toBeInTheDocument(); + + expect(getByText('-0.01 SOL')).toBeInTheDocument(); + + const viewOnExplorerBtn = getByRole('button', { + name: 'View on block explorer', + }); + expect(viewOnExplorerBtn).toBeInTheDocument(); + }); }); diff --git a/ui/components/multichain/activity-list-item/__snapshots__/activity-list-item.test.js.snap b/ui/components/multichain/activity-list-item/__snapshots__/activity-list-item.test.js.snap index 8f0c24760246..90ddf48ba4f3 100644 --- a/ui/components/multichain/activity-list-item/__snapshots__/activity-list-item.test.js.snap +++ b/ui/components/multichain/activity-list-item/__snapshots__/activity-list-item.test.js.snap @@ -13,7 +13,7 @@ exports[`ActivityListItem should match snapshot with no props 1`] = ` class="mm-box activity-list-item__content-container mm-box--display-inline-flex mm-box--justify-content-space-between mm-box--width-full" >

renders component for approve request 1`] = `

+
@@ -342,98 +352,6 @@ exports[` renders component for approve request 1`] = `
-
-
-
-
-

- Account balance -

-
-
-
-

- 0 -

-
-
-
-
-
-
-

- Spending cap -

-
-
- -
-
-
-
-
- -

- 1000 -

-
-
-
renders component for approve request 1`] = `

renders component for approve request 1`] = `

renders component for approve request 1`] = `

renders component for approve request 1`] = `

renders component for approve request 1`] = `

renders component 1`] = ` +exports[` renders component when token is an NFT 1`] = `
renders component 1`] = `

renders component 1`] = `
`; + +exports[` renders component when token is not an NFT 1`] = ` +
+
+
+
+
+

+ Estimated changes +

+
+
+ +
+
+
+
+
+

+ You're giving someone else permission to spend this amount from your account. +

+
+
+
+
+
+

+ Spending cap +

+
+
+
+
+ +
+

+ 1000 +

+
+
+
+ +

+ 0x07614...3ad68 +

+
+
+
+
+
+
+
+`; diff --git a/ui/pages/confirmations/components/confirm/info/approve/approve-static-simulation/approve-static-simulation.test.tsx b/ui/pages/confirmations/components/confirm/info/approve/approve-static-simulation/approve-static-simulation.test.tsx index cda99373021d..636a63bc9df2 100644 --- a/ui/pages/confirmations/components/confirm/info/approve/approve-static-simulation/approve-static-simulation.test.tsx +++ b/ui/pages/confirmations/components/confirm/info/approve/approve-static-simulation/approve-static-simulation.test.tsx @@ -1,8 +1,10 @@ +import { fireEvent } from '@testing-library/react'; import React from 'react'; import configureMockStore from 'redux-mock-store'; import thunk from 'redux-thunk'; import { getMockApproveConfirmState } from '../../../../../../../../test/data/confirmations/helper'; import { renderWithConfirmContextProvider } from '../../../../../../../../test/lib/confirmations/render-helpers'; +import { useIsNFT } from '../hooks/use-is-nft'; import { ApproveStaticSimulation } from './approve-static-simulation'; jest.mock('../hooks/use-approve-token-simulation', () => ({ @@ -10,6 +12,14 @@ jest.mock('../hooks/use-approve-token-simulation', () => ({ spendingCap: '1000', formattedSpendingCap: '1000', value: '1000', + isUnlimitedSpendingCap: false, + pending: false, + })), +})); + +jest.mock('../hooks/use-is-nft', () => ({ + useIsNFT: jest.fn(() => ({ + isNFT: false, })), })); @@ -22,15 +32,51 @@ jest.mock('../../../../../hooks/useAssetDetails', () => ({ describe('', () => { const middleware = [thunk]; - it('renders component', () => { + it('renders component when token is not an NFT', () => { + (useIsNFT as jest.Mock).mockReturnValue({ isNFT: false }); + const state = getMockApproveConfirmState(); const mockStore = configureMockStore(middleware)(state); const { container } = renderWithConfirmContextProvider( - , + , mockStore, ); expect(container).toMatchSnapshot(); }); + + it('renders component when token is an NFT', () => { + (useIsNFT as jest.Mock).mockReturnValue({ isNFT: true }); + + const state = getMockApproveConfirmState(); + + const mockStore = configureMockStore(middleware)(state); + const { container } = renderWithConfirmContextProvider( + , + mockStore, + ); + + expect(container).toMatchSnapshot(); + }); + + it('calls setIsOpenEditSpendingCapModal when edit button is clicked', () => { + (useIsNFT as jest.Mock).mockReturnValue({ isNFT: false }); + + const state = getMockApproveConfirmState(); + const mockStore = configureMockStore(middleware)(state); + const setIsOpenEditSpendingCapModal = jest.fn(); + + const { getByTestId } = renderWithConfirmContextProvider( + , + mockStore, + ); + + const editButton = getByTestId('edit-spending-cap-icon'); + fireEvent.click(editButton); + + expect(setIsOpenEditSpendingCapModal).toHaveBeenCalledWith(true); + }); }); diff --git a/ui/pages/confirmations/components/confirm/info/approve/approve-static-simulation/approve-static-simulation.tsx b/ui/pages/confirmations/components/confirm/info/approve/approve-static-simulation/approve-static-simulation.tsx index 67ff183784c9..8b32501e1368 100644 --- a/ui/pages/confirmations/components/confirm/info/approve/approve-static-simulation/approve-static-simulation.tsx +++ b/ui/pages/confirmations/components/confirm/info/approve/approve-static-simulation/approve-static-simulation.tsx @@ -3,7 +3,13 @@ import { TransactionMeta } from '@metamask/transaction-controller'; import React from 'react'; import { ConfirmInfoRow } from '../../../../../../../components/app/confirm/info/row'; import Name from '../../../../../../../components/app/name'; -import { Box, Text } from '../../../../../../../components/component-library'; +import { + Box, + ButtonIcon, + ButtonIconSize, + IconName, + Text, +} from '../../../../../../../components/component-library'; import Tooltip from '../../../../../../../components/ui/tooltip'; import { AlignItems, @@ -11,6 +17,7 @@ import { BlockSize, BorderRadius, Display, + IconColor, TextAlign, } from '../../../../../../../helpers/constants/design-system'; import { useI18nContext } from '../../../../../../../hooks/useI18nContext'; @@ -21,7 +28,11 @@ import { Container } from '../../shared/transaction-data/transaction-data'; import { useApproveTokenSimulation } from '../hooks/use-approve-token-simulation'; import { useIsNFT } from '../hooks/use-is-nft'; -export const ApproveStaticSimulation = () => { +export const ApproveStaticSimulation = ({ + setIsOpenEditSpendingCapModal, +}: { + setIsOpenEditSpendingCapModal: (newValue: boolean) => void; +}) => { const t = useI18nContext(); const { currentConfirmation: transactionMeta } = @@ -73,6 +84,16 @@ export const ApproveStaticSimulation = () => { > + {!isNFT && ( + setIsOpenEditSpendingCapModal(true)} + size={ButtonIconSize.Sm} + data-testid="edit-spending-cap-icon" + /> + )} { const { currentConfirmation: transactionMeta } = @@ -55,14 +54,11 @@ const ApproveInfo = () => { {showRevokeVariant ? ( ) : ( - - )} - {showRevokeVariant ? : } - {!isNFT && !showRevokeVariant && ( - )} + {showRevokeVariant ? : } renders component 1`] = ` -
-
-
-
-
-

- Account balance -

-
-
-
-

- 0 -

-
-
-
-
-
-
-

- Spending cap -

-
-
- -
-
-
-
-
- -

- 1000 -

-
-
-
-
-`; diff --git a/ui/pages/confirmations/components/confirm/info/approve/spending-cap/spending-cap.test.tsx b/ui/pages/confirmations/components/confirm/info/approve/spending-cap/spending-cap.test.tsx deleted file mode 100644 index 194747c77b4d..000000000000 --- a/ui/pages/confirmations/components/confirm/info/approve/spending-cap/spending-cap.test.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import React from 'react'; -import configureMockStore from 'redux-mock-store'; -import thunk from 'redux-thunk'; -import { getMockApproveConfirmState } from '../../../../../../../../test/data/confirmations/helper'; -import { renderWithConfirmContextProvider } from '../../../../../../../../test/lib/confirmations/render-helpers'; -import { SpendingCap } from './spending-cap'; - -jest.mock('../hooks/use-approve-token-simulation', () => ({ - useApproveTokenSimulation: jest.fn(() => ({ - spendingCap: '1000', - formattedSpendingCap: '1000', - value: '1000', - })), -})); - -jest.mock('../hooks/use-approve-token-simulation', () => ({ - useApproveTokenSimulation: jest.fn(() => ({ - spendingCap: '1000', - formattedSpendingCap: '1000', - value: '1000', - })), -})); - -describe('', () => { - const middleware = [thunk]; - - it('renders component', () => { - const state = getMockApproveConfirmState(); - - const mockStore = configureMockStore(middleware)(state); - - const setIsOpenEditSpendingCapModal = () => - console.log('setIsOpenEditSpendingCapModal'); - - const { container } = renderWithConfirmContextProvider( - , - - mockStore, - ); - - expect(container).toMatchSnapshot(); - }); -}); diff --git a/ui/pages/confirmations/components/confirm/info/approve/spending-cap/spending-cap.tsx b/ui/pages/confirmations/components/confirm/info/approve/spending-cap/spending-cap.tsx deleted file mode 100644 index 3a8c6a5a26ec..000000000000 --- a/ui/pages/confirmations/components/confirm/info/approve/spending-cap/spending-cap.tsx +++ /dev/null @@ -1,112 +0,0 @@ -import { TransactionMeta } from '@metamask/transaction-controller'; -import React from 'react'; -import { calcTokenAmount } from '../../../../../../../../shared/lib/transactions-controller-utils'; -import { - ConfirmInfoRow, - ConfirmInfoRowDivider, - ConfirmInfoRowText, -} from '../../../../../../../components/app/confirm/info/row'; -import { ConfirmInfoSection } from '../../../../../../../components/app/confirm/info/row/section'; -import Tooltip from '../../../../../../../components/ui/tooltip'; -import { useI18nContext } from '../../../../../../../hooks/useI18nContext'; -import { useConfirmContext } from '../../../../../context/confirm'; -import { useAssetDetails } from '../../../../../hooks/useAssetDetails'; -import { Container } from '../../shared/transaction-data/transaction-data'; -import { useApproveTokenSimulation } from '../hooks/use-approve-token-simulation'; - -const SpendingCapGroup = ({ - tokenSymbol, - decimals, - setIsOpenEditSpendingCapModal, -}: { - tokenSymbol: string; - decimals: string; - setIsOpenEditSpendingCapModal: (newValue: boolean) => void; -}) => { - const t = useI18nContext(); - - const { currentConfirmation: transactionMeta } = - useConfirmContext(); - - const { spendingCap, isUnlimitedSpendingCap, formattedSpendingCap, value } = - useApproveTokenSimulation(transactionMeta, decimals); - - const SpendingCapElement = ( - setIsOpenEditSpendingCapModal(true)} - editIconClassName="edit-spending-cap-btn" - editIconDataTestId="edit-spending-cap-icon" - /> - ); - - if (!value) { - return null; - } - - return ( - <> - - - - {Boolean(isUnlimitedSpendingCap) || - spendingCap !== formattedSpendingCap ? ( - {SpendingCapElement} - ) : ( - SpendingCapElement - )} - - - ); -}; - -export const SpendingCap = ({ - setIsOpenEditSpendingCapModal, -}: { - setIsOpenEditSpendingCapModal: (newValue: boolean) => void; -}) => { - const t = useI18nContext(); - - const { currentConfirmation: transactionMeta } = - useConfirmContext(); - - const { userBalance, tokenSymbol, decimals } = useAssetDetails( - transactionMeta.txParams.to, - transactionMeta.txParams.from, - transactionMeta.txParams.data, - transactionMeta.chainId, - ); - - const accountBalance = calcTokenAmount( - userBalance ?? '0', - Number(decimals ?? '0'), - ).toFixed(); - - const { pending } = useApproveTokenSimulation(transactionMeta, decimals); - - if (pending) { - return ; - } - - return ( - - - - - - - - ); -}; diff --git a/ui/pages/confirmations/components/confirm/title/title.tsx b/ui/pages/confirmations/components/confirm/title/title.tsx index 3a2c1769a689..82eff3ec7e5b 100644 --- a/ui/pages/confirmations/components/confirm/title/title.tsx +++ b/ui/pages/confirmations/components/confirm/title/title.tsx @@ -268,7 +268,7 @@ const ConfirmTitle: React.FC = memo(() => { {title} diff --git a/ui/pages/confirmations/confirm/__snapshots__/confirm.test.tsx.snap b/ui/pages/confirmations/confirm/__snapshots__/confirm.test.tsx.snap index 50f28d53d26e..2a3147b014a5 100644 --- a/ui/pages/confirmations/confirm/__snapshots__/confirm.test.tsx.snap +++ b/ui/pages/confirmations/confirm/__snapshots__/confirm.test.tsx.snap @@ -125,7 +125,7 @@ exports[`Confirm matches snapshot for signature - personal sign type 1`] = ` style="overflow: auto;" >

Signature request

@@ -1265,7 +1265,7 @@ exports[`Confirm should match snapshot for signature - typed sign - V4 1`] = ` style="overflow: auto;" >

Signature request

@@ -2282,7 +2282,7 @@ exports[`Confirm should match snapshot for signature - typed sign - permit 1`] = style="overflow: auto;" >

Spending cap request

@@ -2808,7 +2808,7 @@ exports[`Confirm should match snapshot signature - typed sign - order 1`] = ` style="overflow: auto;" >

Signature request

diff --git a/ui/pages/confirmations/confirmation/alerts/TemplateAlertContext.tsx b/ui/pages/confirmations/confirmation/alerts/TemplateAlertContext.tsx index 4a58db7a15a4..268b03e2dc40 100644 --- a/ui/pages/confirmations/confirmation/alerts/TemplateAlertContext.tsx +++ b/ui/pages/confirmations/confirmation/alerts/TemplateAlertContext.tsx @@ -10,8 +10,9 @@ import React, { import useAlerts from '../../../../hooks/useAlerts'; import { AlertActionHandlerProvider } from '../../../../components/app/alert-system/contexts/alertActionHandler'; import { AlertMetricsProvider } from '../../../../components/app/alert-system/contexts/alertMetricsContext'; -import { ConfirmAlertModal } from '../../../../components/app/alert-system/confirm-alert-modal'; +import { MultipleAlertModal } from '../../../../components/app/alert-system/multiple-alert-modal'; import { useTemplateConfirmationAlerts } from './useTemplateConfirmationAlerts'; +import { useAlertsActions } from './useAlertsActions'; type TemplateAlertContextType = { hasAlerts: boolean; @@ -27,22 +28,27 @@ export const TemplateAlertContext = createContext< export const TemplateAlertContextProvider: React.FC<{ children: ReactElement; pendingConfirmation: ApprovalRequest<{ id: string }>; - onCancel: () => void; onSubmit: () => void; -}> = ({ children, pendingConfirmation, onCancel, onSubmit }) => { +}> = ({ children, pendingConfirmation, onSubmit }) => { const [isAlertsModalVisible, setAlertsModalVisible] = useState(false); const alertOwnerId = pendingConfirmation?.id; - useTemplateConfirmationAlerts(alertOwnerId); + useTemplateConfirmationAlerts(pendingConfirmation); const { hasAlerts } = useAlerts(alertOwnerId); - // todo: action implementations to come here as alerts are implemented - const processAction = useCallback((actionKey: string) => { - switch (actionKey) { - default: - console.error('Unknown alert action key:', actionKey); - break; - } - }, []); + const showAlertsModal = useCallback(() => { + setAlertsModalVisible(true); + }, [setAlertsModalVisible]); + + const hideAlertModal = useCallback(() => { + setAlertsModalVisible(false); + }, [setAlertsModalVisible]); + + const onFinalSubmit = useCallback(() => { + hideAlertModal(); + onSubmit(); + }, [hideAlertModal, onSubmit]); + + const processAction = useAlertsActions(hideAlertModal, pendingConfirmation); return ( // AlertMetricsProvider is added as it is required for alert modals to work @@ -58,16 +64,17 @@ export const TemplateAlertContextProvider: React.FC<{ setAlertsModalVisible(true), + showAlertsModal, }} > <> {isAlertsModalVisible && ( - setAlertsModalVisible(false)} - onCancel={onCancel} - onSubmit={onSubmit} + onFinalAcknowledgeClick={onFinalSubmit} + onClose={hideAlertModal} + showCloseIcon={false} + displayAllAlerts /> )} {children} diff --git a/ui/pages/confirmations/confirmation/alerts/useAddEthereumChainAlerts.test.ts b/ui/pages/confirmations/confirmation/alerts/useAddEthereumChainAlerts.test.ts new file mode 100644 index 000000000000..b3e7551567da --- /dev/null +++ b/ui/pages/confirmations/confirmation/alerts/useAddEthereumChainAlerts.test.ts @@ -0,0 +1,64 @@ +import { ApprovalRequest } from '@metamask/approval-controller'; +import { ApprovalType } from '@metamask/controller-utils'; + +import mockState from '../../../../../test/data/mock-state.json'; +import { getMockPersonalSignConfirmState } from '../../../../../test/data/confirmations/helper'; +import { renderHookWithProvider } from '../../../../../test/lib/render-helpers'; +import * as AlertActions from '../../../../ducks/confirm-alerts/confirm-alerts'; + +import { useAddEthereumChainAlerts } from './useAddEthereumChainAlerts'; + +jest.mock('react-redux', () => ({ + ...jest.requireActual('react-redux'), + useDispatch: jest.fn(), +})); + +const PENDING_APPROVAL_MOCK = { + id: 'testApprovalId', + requestData: { testProperty: 'testValue' }, + type: ApprovalType.AddEthereumChain, + origin: 'https://metamask.github.io', + // TODO: Replace `any` with type + // eslint-disable-next-line @typescript-eslint/no-explicit-any +} as ApprovalRequest; + +const ADD_ETH_CHAIN_ALERT = [ + { + actions: [ + { key: 'showPendingConfirmation', label: 'Review pending transactions' }, + ], + key: 'pendingConfirmationFromSameOrigin', + message: + 'Updating network will cancel 1 pending transactions from this site.', + reason: 'Are you sure?', + severity: 'warning', + }, +] as AlertActions.Alert[]; + +describe('useAddEthereumChainAlerts', () => { + it('returns alert if there are pending confirmations', () => { + const state = getMockPersonalSignConfirmState(); + const { result } = renderHookWithProvider( + () => useAddEthereumChainAlerts(PENDING_APPROVAL_MOCK), + { + ...state, + metamask: { + ...state.metamask, + pendingApprovals: { + ...state.metamask.pendingApprovals, + [PENDING_APPROVAL_MOCK.id]: PENDING_APPROVAL_MOCK, + }, + }, + }, + ); + expect(result.current).toStrictEqual(ADD_ETH_CHAIN_ALERT); + }); + + it('does not returns alert if there are no pending confirmations', () => { + const { result } = renderHookWithProvider( + () => useAddEthereumChainAlerts(PENDING_APPROVAL_MOCK), + mockState, + ); + expect(result.current).toStrictEqual([]); + }); +}); diff --git a/ui/pages/confirmations/confirmation/alerts/useAddEthereumChainAlerts.ts b/ui/pages/confirmations/confirmation/alerts/useAddEthereumChainAlerts.ts new file mode 100644 index 000000000000..65b2cb0de08a --- /dev/null +++ b/ui/pages/confirmations/confirmation/alerts/useAddEthereumChainAlerts.ts @@ -0,0 +1,52 @@ +import { ApprovalRequest } from '@metamask/approval-controller'; +import { ApprovalType } from '@metamask/controller-utils'; +import { useMemo } from 'react'; +import { useSelector } from 'react-redux'; + +import { Alert } from '../../../../ducks/confirm-alerts/confirm-alerts'; +import { AlertActionKey } from '../../../../components/app/confirm/info/row/constants'; +import { Severity } from '../../../../helpers/constants/design-system'; +import { getApprovalsByOrigin } from '../../../../selectors'; +import { useI18nContext } from '../../../../hooks/useI18nContext'; + +const VALIDATED_APPROVAL_TYPES = [ + ApprovalType.AddEthereumChain, + ApprovalType.SwitchEthereumChain, +]; + +export function useAddEthereumChainAlerts( + pendingConfirmation: ApprovalRequest<{ id: string }>, +): Alert[] { + const pendingConfirmationsFromOrigin = useSelector((state) => + getApprovalsByOrigin(state, pendingConfirmation?.origin), + ); + + const t = useI18nContext(); + return useMemo(() => { + if ( + pendingConfirmationsFromOrigin?.length <= 1 || + !VALIDATED_APPROVAL_TYPES.includes( + pendingConfirmation?.type as ApprovalType, + ) + ) { + return []; + } + + return [ + { + actions: [ + { + key: AlertActionKey.ShowPendingConfirmation, + label: t('reviewPendingTransactions'), + }, + ], + key: 'pendingConfirmationFromSameOrigin', + message: t('pendingConfirmationAddNetworkAlertMessage', [ + pendingConfirmationsFromOrigin.length - 1, + ]), + reason: t('areYouSure'), + severity: Severity.Warning, + }, + ]; + }, [pendingConfirmation?.type, pendingConfirmationsFromOrigin?.length, t]); +} diff --git a/ui/pages/confirmations/confirmation/alerts/useAlertActions.test.ts b/ui/pages/confirmations/confirmation/alerts/useAlertActions.test.ts new file mode 100644 index 000000000000..b2be85b61914 --- /dev/null +++ b/ui/pages/confirmations/confirmation/alerts/useAlertActions.test.ts @@ -0,0 +1,50 @@ +import { ApprovalRequest } from '@metamask/approval-controller'; + +import mockState from '../../../../../test/data/mock-state.json'; +import { getMockPersonalSignConfirmState } from '../../../../../test/data/confirmations/helper'; +import { renderHookWithProvider } from '../../../../../test/lib/render-helpers'; +import { AlertActionKey } from '../../../../components/app/confirm/info/row/constants'; +import * as ConfirmationNavigation from '../../hooks/useConfirmationNavigation'; +import { useAlertsActions } from './useAlertsActions'; + +jest.mock('react-redux', () => ({ + ...jest.requireActual('react-redux'), + useDispatch: jest.fn(), +})); + +const PENDING_APPROVAL_MOCK = { + id: 'testApprovalId', + origin: 'https://metamask.github.io', + requestData: { testProperty: 'testValue' }, + // TODO: Replace `any` with type + // eslint-disable-next-line @typescript-eslint/no-explicit-any +} as ApprovalRequest; + +describe('useAlertActions', () => { + it('returns method processAction to process alert actions', () => { + const { result } = renderHookWithProvider( + () => useAlertsActions(() => undefined, PENDING_APPROVAL_MOCK), + mockState, + ); + expect(typeof result.current).toBe('function'); + }); + + it('handles action "ShowPendingConfirmation"', () => { + const mockNavigateToIndex = jest.fn(); + const mockHideAlertModal = jest.fn(); + jest + .spyOn(ConfirmationNavigation, 'useConfirmationNavigation') + .mockReturnValue({ + getIndex: jest.fn(), + navigateToIndex: mockNavigateToIndex, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + } as any); + const { result } = renderHookWithProvider( + () => useAlertsActions(mockHideAlertModal, PENDING_APPROVAL_MOCK), + getMockPersonalSignConfirmState(), + ); + result.current(AlertActionKey.ShowPendingConfirmation); + expect(mockNavigateToIndex).toHaveBeenCalledTimes(1); + expect(mockHideAlertModal).toHaveBeenCalledTimes(1); + }); +}); diff --git a/ui/pages/confirmations/confirmation/alerts/useAlertsActions.tsx b/ui/pages/confirmations/confirmation/alerts/useAlertsActions.tsx new file mode 100644 index 000000000000..122676277594 --- /dev/null +++ b/ui/pages/confirmations/confirmation/alerts/useAlertsActions.tsx @@ -0,0 +1,50 @@ +import { ApprovalRequest } from '@metamask/approval-controller'; +import { useCallback } from 'react'; +import { useSelector } from 'react-redux'; + +import { AlertActionKey } from '../../../../components/app/confirm/info/row/constants'; +import { getApprovalsByOrigin } from '../../../../selectors'; +import { useConfirmationNavigation } from '../../hooks/useConfirmationNavigation'; + +export const useAlertsActions = ( + hideAlertModal: () => void, + pendingConfirmation: ApprovalRequest<{ id: string }>, +) => { + const pendingConfirmationsFromOrigin = useSelector((state) => + getApprovalsByOrigin(state, pendingConfirmation?.origin), + ); + + const { getIndex, navigateToIndex } = useConfirmationNavigation(); + + const navigateToPendingConfirmation = useCallback(() => { + const { id } = pendingConfirmation; + const pendingConfirmations = pendingConfirmationsFromOrigin?.filter( + (confirmation) => confirmation.id !== id, + ); + const nextIndex = getIndex(pendingConfirmations[0]?.id); + navigateToIndex(nextIndex); + hideAlertModal(); + }, [ + getIndex, + pendingConfirmation, + pendingConfirmationsFromOrigin, + hideAlertModal, + navigateToIndex, + ]); + + const processAction = useCallback( + (actionKey: string) => { + switch (actionKey) { + case AlertActionKey.ShowPendingConfirmation: + navigateToPendingConfirmation(); + break; + default: + console.error('Unknown alert action key:', actionKey); + break; + } + }, + [navigateToPendingConfirmation], + ); + + return processAction; +}; diff --git a/ui/pages/confirmations/confirmation/alerts/useTemplateConfirmationAlerts.test.ts b/ui/pages/confirmations/confirmation/alerts/useTemplateConfirmationAlerts.test.ts index f8fc844ae289..10e79f6e0354 100644 --- a/ui/pages/confirmations/confirmation/alerts/useTemplateConfirmationAlerts.test.ts +++ b/ui/pages/confirmations/confirmation/alerts/useTemplateConfirmationAlerts.test.ts @@ -1,8 +1,11 @@ +import { ApprovalRequest } from '@metamask/approval-controller'; import { useDispatch } from 'react-redux'; -import { renderHookWithProvider } from '../../../../../test/lib/render-helpers'; import mockState from '../../../../../test/data/mock-state.json'; +import { renderHookWithProvider } from '../../../../../test/lib/render-helpers'; import * as AlertActions from '../../../../ducks/confirm-alerts/confirm-alerts'; +import * as AddEthereumChainAlerts from './useAddEthereumChainAlerts'; + import { useTemplateConfirmationAlerts } from './useTemplateConfirmationAlerts'; jest.mock('react-redux', () => ({ @@ -10,24 +13,46 @@ jest.mock('react-redux', () => ({ useDispatch: jest.fn(), })); -describe('setAlerts', () => { +const PENDING_APPROVAL_MOCK = { + id: 'testApprovalId', + requestData: { testProperty: 'testValue' }, + // TODO: Replace `any` with type + // eslint-disable-next-line @typescript-eslint/no-explicit-any +} as ApprovalRequest; + +const MOCK_ADD_ETH_CHAIN_ALERT = [ + { + key: 'pendingConfirmationFromSameOrigin', + message: 'dummy_message', + reason: 'dummy_reason', + severity: 'warning', + }, +] as AlertActions.Alert[]; + +describe('updateConfirmationAlerts', () => { it('calls updateAlerts to update alerts in state', () => { const mockDispatch = jest.fn(); (useDispatch as jest.Mock).mockReturnValue(mockDispatch); + jest + .spyOn(AddEthereumChainAlerts, 'useAddEthereumChainAlerts') + .mockReturnValue(MOCK_ADD_ETH_CHAIN_ALERT); const mockUpdateAlerts = jest.spyOn(AlertActions, 'updateAlerts'); renderHookWithProvider( - () => useTemplateConfirmationAlerts('123'), + () => useTemplateConfirmationAlerts(PENDING_APPROVAL_MOCK), mockState, ); expect(mockDispatch).toHaveBeenCalledTimes(1); expect(mockUpdateAlerts).toHaveBeenCalledTimes(1); expect(mockDispatch).toHaveBeenCalledWith({ - alerts: [], - ownerId: '123', + alerts: MOCK_ADD_ETH_CHAIN_ALERT, + ownerId: PENDING_APPROVAL_MOCK.id, type: 'UPDATE_ALERTS', }); - expect(mockUpdateAlerts).toHaveBeenCalledWith('123', []); + expect(mockUpdateAlerts).toHaveBeenCalledWith( + PENDING_APPROVAL_MOCK.id, + MOCK_ADD_ETH_CHAIN_ALERT, + ); }); }); diff --git a/ui/pages/confirmations/confirmation/alerts/useTemplateConfirmationAlerts.ts b/ui/pages/confirmations/confirmation/alerts/useTemplateConfirmationAlerts.ts index cb369e844815..c8ca2891df1f 100644 --- a/ui/pages/confirmations/confirmation/alerts/useTemplateConfirmationAlerts.ts +++ b/ui/pages/confirmations/confirmation/alerts/useTemplateConfirmationAlerts.ts @@ -1,24 +1,32 @@ -import { useEffect, useMemo } from 'react'; +import { ApprovalRequest } from '@metamask/approval-controller'; import { useDispatch } from 'react-redux'; +import { useEffect, useMemo } from 'react'; + import { Alert, clearAlerts, updateAlerts, } from '../../../../ducks/confirm-alerts/confirm-alerts'; -// import { useI18nContext } from '../../../../hooks/useI18nContext'; +import { useAddEthereumChainAlerts } from './useAddEthereumChainAlerts'; -export const useTemplateConfirmationAlerts = (alertOwnerId: string) => { +export const useTemplateConfirmationAlerts = ( + pendingConfirmation: ApprovalRequest<{ id: string }>, +) => { const dispatch = useDispatch(); - // const t = useI18nContext(); - const alerts: Alert[] = useMemo(() => [], []); + const addEthereumChainAlerts = useAddEthereumChainAlerts(pendingConfirmation); + const alerts: Alert[] = useMemo( + () => addEthereumChainAlerts, + [addEthereumChainAlerts], + ); + const alertOwnerId = pendingConfirmation?.id; useEffect(() => { dispatch(updateAlerts(alertOwnerId, alerts)); - }, [alerts, alertOwnerId]); + }, [alerts, alertOwnerId, dispatch]); useEffect(() => { return () => { dispatch(clearAlerts(alertOwnerId)); }; - }, []); + }, [alertOwnerId, dispatch]); }; diff --git a/ui/pages/confirmations/confirmation/confirmation.js b/ui/pages/confirmations/confirmation/confirmation.js index 54c985206f48..3a21d88694af 100644 --- a/ui/pages/confirmations/confirmation/confirmation.js +++ b/ui/pages/confirmations/confirmation/confirmation.js @@ -498,7 +498,6 @@ export default function ConfirmationPage({
{ - await dispatch( + const resetOrigin = useCallback(() => { + dispatch( updateThrottledOriginState(origin, { rejections: 0, lastRejection: 0, diff --git a/ui/pages/confirmations/send/send-content/add-recipient/domain-input.component.js b/ui/pages/confirmations/send/send-content/add-recipient/domain-input.component.js index f9d529fb18f3..87b4c72b8be5 100644 --- a/ui/pages/confirmations/send/send-content/add-recipient/domain-input.component.js +++ b/ui/pages/confirmations/send/send-content/add-recipient/domain-input.component.js @@ -80,8 +80,8 @@ export default class DomainInput extends Component { } = this.props; const input = value.trim(); - onChange(input); if (internalSearch) { + onChange(input); return null; } @@ -92,9 +92,14 @@ export default class DomainInput extends Component { !isBurnAddress(input) && isValidHexAddress(input, { mixedCaseUseChecksum: true }) ) { - onValidAddressTyped(addHexPrefix(input)); + const hexInput = addHexPrefix(input); + onChange(hexInput); + onValidAddressTyped(hexInput); + } else { + onChange(input); } } else { + onChange(input); lookupDomainName(input); } diff --git a/ui/pages/home/home.component.js b/ui/pages/home/home.component.js index e78708618356..1ccabf28c376 100644 --- a/ui/pages/home/home.component.js +++ b/ui/pages/home/home.component.js @@ -387,256 +387,263 @@ export default class Home extends PureComponent { t('outdatedBrowserNotification') ); - return ( - - {newNftAddedMessage === 'success' ? ( - - - - {t('newNftAddedMessage')} - - - - } - /> - ) : null} - {removeNftMessage === 'success' ? ( - - - - {t('removeNftMessage')} - - - - } - /> - ) : null} - {removeNftMessage === 'error' ? ( - - - - {t('removeNftErrorMessage')} - - - - } - /> - ) : null} - {newNetworkAddedName ? ( - - - - {t('newNetworkAdded', [newNetworkAddedName])} + const items = [ + newNftAddedMessage === 'success' ? ( + + + + {t('newNftAddedMessage')} + + + + } + /> + ) : null, + removeNftMessage === 'success' ? ( + + + + {t('removeNftMessage')} + + + + } + /> + ) : null, + removeNftMessage === 'error' ? ( + + + + {t('removeNftErrorMessage')} + + + + } + /> + ) : null, + newNetworkAddedName ? ( + + + + {t('newNetworkAdded', [newNetworkAddedName])} + + clearNewNetworkAdded()} + className="home__new-network-notification-close" + /> + + } + /> + ) : null, + editedNetwork?.editCompleted ? ( + + + + {editedNetwork.newNetwork + ? t('newNetworkAdded', [editedNetwork.nickname]) + : t('newNetworkEdited', [editedNetwork.nickname])} + + clearEditedNetwork()} + className="home__new-network-notification-close" + /> + + } + /> + ) : null, + newTokensImported ? ( + + + + + {t('newTokensImportedTitle')} - clearNewNetworkAdded()} - className="home__new-network-notification-close" - /> - - } - /> - ) : null} - {editedNetwork?.editCompleted ? ( - - - - {editedNetwork.newNetwork - ? t('newNetworkAdded', [editedNetwork.nickname]) - : t('newNetworkEdited', [editedNetwork.nickname])} + + {t('newTokensImportedMessage', [newTokensImported])} - clearEditedNetwork()} - className="home__new-network-notification-close" - /> - - } - /> - ) : null} - {newTokensImported ? ( - - - - - {t('newTokensImportedTitle')} - - - {t('newTokensImportedMessage', [newTokensImported])} - - - - setNewTokensImported('')} - className="home__new-tokens-imported-notification-close" - /> + + setNewTokensImported('')} + className="home__new-tokens-imported-notification-close" + /> + + } + /> + ) : null, + newTokensImportedError ? ( + + + + {t('importTokensError')} + + + + } + /> + ) : null, + shouldShowWeb3ShimUsageNotification ? ( + + global.platform.openTab({ url: ZENDESK_URLS.LEGACY_WEB3 }) + } + > + {t('here')} + , + ])} + ignoreText={t('dismiss')} + onIgnore={(disable) => { + setWeb3ShimUsageAlertDismissed(originOfCurrentTab); + if (disable) { + disableWeb3ShimUsageAlert(); } - /> - ) : null} - {newTokensImportedError ? ( - - - - {t('importTokensError')} - - - + }} + checkboxText={t('dontShowThisAgain')} + checkboxTooltipText={t('canToggleInSettings')} + /> + ) : null, + ///: BEGIN:ONLY_INCLUDE_IF(build-main,build-beta,build-flask) + shouldShowSeedPhraseReminder ? ( + { + const backUpSRPRoute = `${ONBOARDING_SECURE_YOUR_WALLET_ROUTE}/?isFromReminder=true`; + if (isPopup) { + global.platform.openExtensionInBrowser(backUpSRPRoute); + } else { + history.push(backUpSRPRoute); } - /> - ) : null} - {shouldShowWeb3ShimUsageNotification ? ( - - global.platform.openTab({ url: ZENDESK_URLS.LEGACY_WEB3 }) - } - > - {t('here')} - , - ])} - ignoreText={t('dismiss')} - onIgnore={(disable) => { - setWeb3ShimUsageAlertDismissed(originOfCurrentTab); - if (disable) { - disableWeb3ShimUsageAlert(); + }} + infoText={t('backupApprovalInfo')} + /> + ) : null, + ///: END:ONLY_INCLUDE_IF + infuraBlocked && this.state.canShowBlockageNotification ? ( + + global.platform.openTab({ url: ZENDESK_URLS.INFURA_BLOCKAGE }) } - }} - checkboxText={t('dontShowThisAgain')} - checkboxTooltipText={t('canToggleInSettings')} - key="home-web3ShimUsageNotification" - /> - ) : null} - { - ///: BEGIN:ONLY_INCLUDE_IF(build-main,build-beta,build-flask) - shouldShowSeedPhraseReminder ? ( - { - const backUpSRPRoute = `${ONBOARDING_SECURE_YOUR_WALLET_ROUTE}/?isFromReminder=true`; - if (isPopup) { - global.platform.openExtensionInBrowser(backUpSRPRoute); - } else { - history.push(backUpSRPRoute); - } - }} - infoText={t('backupApprovalInfo')} - key="home-backupApprovalNotice" - /> - ) : null - ///: END:ONLY_INCLUDE_IF - } - {infuraBlocked && this.state.canShowBlockageNotification ? ( - - global.platform.openTab({ url: ZENDESK_URLS.INFURA_BLOCKAGE }) - } - > - {t('here')} - , - ])} - ignoreText={t('dismiss')} - onIgnore={() => { - this.setState({ - canShowBlockageNotification: false, - }); - }} - key="home-infuraBlockedNotification" - /> - ) : null} - {showOutdatedBrowserWarning ? ( - - ) : null} - - ); + > + {t('here')} + , + ])} + ignoreText={t('dismiss')} + onIgnore={() => { + this.setState({ + canShowBlockageNotification: false, + }); + }} + /> + ) : null, + showOutdatedBrowserWarning ? ( + + ) : null, + ].filter(Boolean); + + return items.length ? ( + {items} + ) : null; } renderOnboardingPopover = () => { diff --git a/ui/selectors/selectors.js b/ui/selectors/selectors.js index e39328bca086..a46fdf5fbff1 100644 --- a/ui/selectors/selectors.js +++ b/ui/selectors/selectors.js @@ -1502,6 +1502,21 @@ export const getMemoizedUnapprovedConfirmations = createDeepEqualSelector( (confirmations) => confirmations, ); +/** + * Get pending confirmation from specified origin. + * + * @param state - Redux state object. + * @param origin - Origin to ger approvals from. + * @returns array of approvals from an origin + */ +export const getApprovalsByOrigin = (state, origin) => { + const pendingApprovals = getMemoizedUnapprovedConfirmations(state); + + return pendingApprovals?.filter( + (confirmation) => confirmation.origin === origin, + ); +}; + /** * Get a memoized version of the unapproved templated confirmations. */ diff --git a/ui/store/actions.ts b/ui/store/actions.ts index bd8f634770e2..5702e11b5249 100644 --- a/ui/store/actions.ts +++ b/ui/store/actions.ts @@ -4181,14 +4181,16 @@ export function rejectAllMessages( }; } -export async function updateThrottledOriginState( +export function updateThrottledOriginState( origin: string, throttledOriginState: ThrottledOrigin, ): ThunkAction { - await submitRequestToBackground('updateThrottledOriginState', [ - origin, - throttledOriginState, - ]); + return async () => { + await submitRequestToBackground('updateThrottledOriginState', [ + origin, + throttledOriginState, + ]); + }; } export function setFirstTimeFlowType( diff --git a/yarn.lock b/yarn.lock index 18bcac179a60..e1f906f4d685 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4829,16 +4829,16 @@ __metadata: languageName: node linkType: hard -"@metamask/accounts-controller@npm:^24.1.0": - version: 24.1.0 - resolution: "@metamask/accounts-controller@npm:24.1.0" +"@metamask/accounts-controller@npm:^26.0.0": + version: 26.0.0 + resolution: "@metamask/accounts-controller@npm:26.0.0" dependencies: - "@ethereumjs/util": "npm:^8.1.0" + "@ethereumjs/util": "npm:^9.1.0" "@metamask/base-controller": "npm:^8.0.0" - "@metamask/eth-snap-keyring": "npm:^11.1.0" + "@metamask/eth-snap-keyring": "npm:^12.0.0" "@metamask/keyring-api": "npm:^17.2.0" - "@metamask/keyring-internal-api": "npm:^4.0.3" - "@metamask/keyring-utils": "npm:^2.3.1" + "@metamask/keyring-internal-api": "npm:^6.0.0" + "@metamask/keyring-utils": "npm:^3.0.0" "@metamask/network-controller": "npm:^22.2.1" "@metamask/snaps-sdk": "npm:^6.17.1" "@metamask/snaps-utils": "npm:^8.10.0" @@ -4848,12 +4848,12 @@ __metadata: immer: "npm:^9.0.6" uuid: "npm:^8.3.2" peerDependencies: - "@metamask/keyring-controller": ^19.0.0 + "@metamask/keyring-controller": ^21.0.0 "@metamask/network-controller": ^22.0.0 "@metamask/providers": ^18.1.0 "@metamask/snaps-controllers": ^9.19.0 webextension-polyfill: ^0.10.0 || ^0.11.0 || ^0.12.0 - checksum: 10/71b512c23168c1b19e54a0cc55f8c7cb8179eca38756e9be58956a4b17603e08be55034506fd04cf29222c47f6e8d52b6553bbe40d7aa1ee12d3babbf5545fc0 + checksum: 10/6b2c7d638cc335b0de62042ff62d65fec7c317b3a5dda2e8e8bb5db61c6ec428df322d2f214fa94863186ffcba0291542cb5930a0ee0b240a6aca4d785ba29d1 languageName: node linkType: hard @@ -5061,13 +5061,13 @@ __metadata: linkType: hard "@metamask/controller-utils@npm:^11.0.0, @metamask/controller-utils@npm:^11.3.0, @metamask/controller-utils@npm:^11.4.0, @metamask/controller-utils@npm:^11.4.2, @metamask/controller-utils@npm:^11.4.4, @metamask/controller-utils@npm:^11.5.0": - version: 11.5.0 - resolution: "@metamask/controller-utils@npm:11.5.0" + version: 11.6.0 + resolution: "@metamask/controller-utils@npm:11.6.0" dependencies: - "@ethereumjs/util": "npm:^8.1.0" + "@ethereumjs/util": "npm:^9.1.0" "@metamask/eth-query": "npm:^4.0.0" "@metamask/ethjs-unit": "npm:^0.3.0" - "@metamask/utils": "npm:^11.1.0" + "@metamask/utils": "npm:^11.2.0" "@spruceid/siwe-parser": "npm:2.1.0" "@types/bn.js": "npm:^5.1.5" bignumber.js: "npm:^9.1.2" @@ -5077,7 +5077,7 @@ __metadata: fast-deep-equal: "npm:^3.1.3" peerDependencies: "@babel/runtime": ^7.0.0 - checksum: 10/ef3ca4c36fdd4658233467d639154321015be7985008d90c5e870ef69f92024143fe81908e398e6e79e10f9b40d5c33e8742beae0ed5690db0fbce3731fbfd0b + checksum: 10/0bbb36cb2a8107362ecc13ad4227922f9eba5a5cfb7f7742c6b7a6a1023bd1c4d93a0e6cdfd0cef49228a719950753c26d0ee77598cbafd69944b0f89f6e6452 languageName: node linkType: hard @@ -5200,9 +5200,9 @@ __metadata: languageName: node linkType: hard -"@metamask/eth-hd-keyring@npm:^10.0.0": - version: 10.0.0 - resolution: "@metamask/eth-hd-keyring@npm:10.0.0" +"@metamask/eth-hd-keyring@npm:^11.0.0": + version: 11.0.0 + resolution: "@metamask/eth-hd-keyring@npm:11.0.0" dependencies: "@ethereumjs/util": "npm:^8.1.0" "@metamask/eth-sig-util": "npm:^8.2.0" @@ -5210,7 +5210,21 @@ __metadata: "@metamask/scure-bip39": "npm:^2.1.1" "@metamask/utils": "npm:^11.1.0" ethereum-cryptography: "npm:^2.1.2" - checksum: 10/d80611745171042f6ae7e0545e51563ebd705eb74e2bf131454766872d7ca57a54766af2ab398520a8fe0f58e8733a92c1df71664a2ea0e92c462661ea8a12f1 + checksum: 10/34e79c06740273518b653bfbef75371f2934ac1d73698f2a0f5f3e124300d5b43c86351f6989dc5aae5026ad2410171e75caabb7a14e9eacaea868f83be1b36d + languageName: node + linkType: hard + +"@metamask/eth-hd-keyring@npm:^12.0.0": + version: 12.0.0 + resolution: "@metamask/eth-hd-keyring@npm:12.0.0" + dependencies: + "@ethereumjs/util": "npm:^9.1.0" + "@metamask/eth-sig-util": "npm:^8.2.0" + "@metamask/key-tree": "npm:^10.0.2" + "@metamask/scure-bip39": "npm:^2.1.1" + "@metamask/utils": "npm:^11.1.0" + ethereum-cryptography: "npm:^2.1.2" + checksum: 10/9567238a11c0e3a331a477fbe6ad5ee42b10bb943efdff9696bf178127b9d5aac2ce02295221fa19d18981231251ee25053034b7780495e2c2fc7427c5c02516 languageName: node linkType: hard @@ -5271,17 +5285,17 @@ __metadata: languageName: node linkType: hard -"@metamask/eth-ledger-bridge-keyring@npm:^8.0.3": - version: 8.0.3 - resolution: "@metamask/eth-ledger-bridge-keyring@npm:8.0.3" +"@metamask/eth-ledger-bridge-keyring@npm:^10.0.0": + version: 10.0.0 + resolution: "@metamask/eth-ledger-bridge-keyring@npm:10.0.0" dependencies: "@ethereumjs/rlp": "npm:^5.0.2" - "@ethereumjs/tx": "npm:^4.2.0" - "@ethereumjs/util": "npm:^8.1.0" + "@ethereumjs/tx": "npm:^5.4.0" + "@ethereumjs/util": "npm:^9.1.0" "@ledgerhq/hw-app-eth": "npm:^6.42.0" - "@metamask/eth-sig-util": "npm:^8.1.2" + "@metamask/eth-sig-util": "npm:^8.2.0" hdkey: "npm:^2.1.0" - checksum: 10/5b5c9f72eec882638985b11198350ace3647fa0ec92facbac3a9c1a67543a8270017c583d2d1464e2ec96cb93ff8b64509c0c8ebc395f8ce7de5ffd8f483ca63 + checksum: 10/a1e4e410aa051fa85abdff044eab4ae3fd594442186b53d1c21d12817d2ece51e510f86ecd9e69658fc2c3cbbf53d5941eb4ea93928f74c11e0ff5e399781a2e languageName: node linkType: hard @@ -5324,37 +5338,50 @@ __metadata: languageName: node linkType: hard -"@metamask/eth-simple-keyring@npm:^8.1.0": - version: 8.1.1 - resolution: "@metamask/eth-simple-keyring@npm:8.1.1" +"@metamask/eth-simple-keyring@npm:^10.0.0": + version: 10.0.0 + resolution: "@metamask/eth-simple-keyring@npm:10.0.0" + dependencies: + "@ethereumjs/util": "npm:^9.1.0" + "@metamask/eth-sig-util": "npm:^8.2.0" + "@metamask/utils": "npm:^11.1.0" + ethereum-cryptography: "npm:^2.1.2" + randombytes: "npm:^2.1.0" + checksum: 10/e749e16cbbd3b542cda3e727ee1efb16f597c8583a0ca0bbb457b500397c0b492ecdf07965a67cec3b4bfb25fc56caa01810b23b918939dd104eea759caa339a + languageName: node + linkType: hard + +"@metamask/eth-simple-keyring@npm:^9.0.0": + version: 9.0.0 + resolution: "@metamask/eth-simple-keyring@npm:9.0.0" dependencies: "@ethereumjs/util": "npm:^8.1.0" "@metamask/eth-sig-util": "npm:^8.2.0" "@metamask/utils": "npm:^11.1.0" ethereum-cryptography: "npm:^2.1.2" randombytes: "npm:^2.1.0" - checksum: 10/8fa7193625bedb58dffefac5120a72cd5864c18f94fae76fbe13f999f2d7bf063e95818702615942d8c9c56ecd460353fb34102a149503bdf7fdeaabcaca7d68 + checksum: 10/2f7062546288afcc986a7baf703fc518b1a26587d3675dddd97a0ea940b54020e8878b3aa94fc562bf96196e67aa5ff854b428de68eb8da65101868f4487d034 languageName: node linkType: hard -"@metamask/eth-snap-keyring@npm:^11.1.0": - version: 11.1.0 - resolution: "@metamask/eth-snap-keyring@npm:11.1.0" +"@metamask/eth-snap-keyring@npm:^12.0.0": + version: 12.0.0 + resolution: "@metamask/eth-snap-keyring@npm:12.0.0" dependencies: - "@ethereumjs/tx": "npm:^4.2.0" + "@ethereumjs/tx": "npm:^5.4.0" "@metamask/base-controller": "npm:^7.1.1" "@metamask/eth-sig-util": "npm:^8.2.0" - "@metamask/keyring-api": "npm:^17.2.0" - "@metamask/keyring-internal-api": "npm:^4.0.3" + "@metamask/keyring-api": "npm:^17.2.1" + "@metamask/keyring-internal-api": "npm:^5.0.0" "@metamask/keyring-internal-snap-client": "npm:^4.0.1" - "@metamask/keyring-utils": "npm:^2.3.0" + "@metamask/keyring-utils": "npm:^3.0.0" "@metamask/superstruct": "npm:^3.1.0" "@metamask/utils": "npm:^11.1.0" "@types/uuid": "npm:^9.0.8" uuid: "npm:^9.0.1" peerDependencies: - "@metamask/keyring-api": ^17.2.0 - checksum: 10/b01abdcb2bd44c6fdf8fef3b897cdb78f99b5cf0a01d8c00d4fbad28b071c9073c9fdbfca974b452db6dddd44c6c0918b7bdb8705af0bc4393d1f9efa73ae33b + "@metamask/keyring-api": ^17.2.1 + checksum: 10/9c57c618f4401b7a983daea3578090d763fcacdaf30431aaa3301360cda6537443534b37c191a3640891a9eee105e33b41a966187e5fb172f5022e1b40412222 languageName: node linkType: hard @@ -5376,18 +5403,19 @@ __metadata: languageName: node linkType: hard -"@metamask/eth-trezor-keyring@npm:^6.0.0": - version: 6.0.0 - resolution: "@metamask/eth-trezor-keyring@npm:6.0.0" +"@metamask/eth-trezor-keyring@npm:^8.0.0": + version: 8.0.0 + resolution: "@metamask/eth-trezor-keyring@npm:8.0.0" dependencies: - "@ethereumjs/tx": "npm:^4.2.0" - "@ethereumjs/util": "npm:^8.1.0" - "@metamask/eth-sig-util": "npm:^8.0.0" + "@ethereumjs/tx": "npm:^5.4.0" + "@ethereumjs/util": "npm:^9.1.0" + "@metamask/eth-sig-util": "npm:^8.2.0" + "@metamask/utils": "npm:^11.1.0" "@trezor/connect-plugin-ethereum": "npm:^9.0.3" "@trezor/connect-web": "npm:^9.1.11" hdkey: "npm:^2.1.0" tslib: "npm:^2.6.2" - checksum: 10/d5d799c60eeab963ef3e5533de472044b08b6f72652ecefbf26cec99784829bbcd706df57f6450ddb019c7dff7c41b0e0dad244aad62b7d03b51fc97755e2c4c + checksum: 10/6b4713887211db1c99997969c10f21502e49779746021cb6023d2d2b34a5e489976275befe94825fbac9c569e8b59d1e33cd69fc6f3989b13236c545aa04ed0c languageName: node linkType: hard @@ -5572,25 +5600,47 @@ __metadata: languageName: node linkType: hard -"@metamask/keyring-controller@npm:^19.2.0, @metamask/keyring-controller@npm:^19.2.1": - version: 19.2.1 - resolution: "@metamask/keyring-controller@npm:19.2.1" +"@metamask/keyring-controller@npm:^20.0.0": + version: 20.0.0 + resolution: "@metamask/keyring-controller@npm:20.0.0" dependencies: "@ethereumjs/util": "npm:^8.1.0" "@keystonehq/metamask-airgapped-keyring": "npm:^0.14.1" "@metamask/base-controller": "npm:^8.0.0" "@metamask/browser-passworder": "npm:^4.3.0" - "@metamask/eth-hd-keyring": "npm:^10.0.0" + "@metamask/eth-hd-keyring": "npm:^11.0.0" "@metamask/eth-sig-util": "npm:^8.2.0" - "@metamask/eth-simple-keyring": "npm:^8.1.0" + "@metamask/eth-simple-keyring": "npm:^9.0.0" "@metamask/keyring-api": "npm:^17.2.0" - "@metamask/keyring-internal-api": "npm:^4.0.3" + "@metamask/keyring-internal-api": "npm:^5.0.0" "@metamask/utils": "npm:^11.2.0" async-mutex: "npm:^0.5.0" ethereumjs-wallet: "npm:^1.0.1" immer: "npm:^9.0.6" ulid: "npm:^2.3.0" - checksum: 10/e9715a0743689c54843fd68f58ba1a577fd2f1a3ff104bd2e3d592c9246c56098f90288fab6c0d511e4a7115d2e9b835862885f37c3495aa2dd12db7df673326 + checksum: 10/cfddaed8d1548086ef7f4fb8fe6788a799378efdc8c99cf8277600ce491229d8a64614981273d2d2dbaa7e3803302d474db4ae76af75605027ca1962dbb9c709 + languageName: node + linkType: hard + +"@metamask/keyring-controller@npm:^21.0.0": + version: 21.0.0 + resolution: "@metamask/keyring-controller@npm:21.0.0" + dependencies: + "@ethereumjs/util": "npm:^9.1.0" + "@keystonehq/metamask-airgapped-keyring": "npm:^0.14.1" + "@metamask/base-controller": "npm:^8.0.0" + "@metamask/browser-passworder": "npm:^4.3.0" + "@metamask/eth-hd-keyring": "npm:^12.0.0" + "@metamask/eth-sig-util": "npm:^8.2.0" + "@metamask/eth-simple-keyring": "npm:^10.0.0" + "@metamask/keyring-api": "npm:^17.2.0" + "@metamask/keyring-internal-api": "npm:^6.0.0" + "@metamask/utils": "npm:^11.2.0" + async-mutex: "npm:^0.5.0" + ethereumjs-wallet: "npm:^1.0.1" + immer: "npm:^9.0.6" + ulid: "npm:^2.3.0" + checksum: 10/aee572da64d757417397fee74a44be1c3f0ea3168c6880cb211d99d71b5e1b457d1684760b9d347820c0d90f0052783105e60697e9315ae257d3ae12c852190a languageName: node linkType: hard @@ -5606,6 +5656,28 @@ __metadata: languageName: node linkType: hard +"@metamask/keyring-internal-api@npm:^5.0.0": + version: 5.0.0 + resolution: "@metamask/keyring-internal-api@npm:5.0.0" + dependencies: + "@metamask/keyring-api": "npm:^17.2.1" + "@metamask/keyring-utils": "npm:^2.3.1" + "@metamask/superstruct": "npm:^3.1.0" + checksum: 10/1c691c6343691ef19c1cea6a353cbb325dbad7b10462d17139365151dc23a7f0aa74eecb9e8787a4472cc5d73424c1e050d0efb5a3b68c59c766adede40b9ea2 + languageName: node + linkType: hard + +"@metamask/keyring-internal-api@npm:^6.0.0": + version: 6.0.0 + resolution: "@metamask/keyring-internal-api@npm:6.0.0" + dependencies: + "@metamask/keyring-api": "npm:^17.2.1" + "@metamask/keyring-utils": "npm:^3.0.0" + "@metamask/superstruct": "npm:^3.1.0" + checksum: 10/069945b3423e7b6bd0b8735d65e17c968e494bc3f8c06e585d6e27f09ced0027541440c9e90ffbcd59b1daf91d7848c09be010a8ceb547ed3c4f6465e810b7a8 + languageName: node + linkType: hard + "@metamask/keyring-internal-snap-client@npm:^4.0.1": version: 4.0.1 resolution: "@metamask/keyring-internal-snap-client@npm:4.0.1" @@ -5646,6 +5718,18 @@ __metadata: languageName: node linkType: hard +"@metamask/keyring-utils@npm:^3.0.0": + version: 3.0.0 + resolution: "@metamask/keyring-utils@npm:3.0.0" + dependencies: + "@ethereumjs/tx": "npm:^5.4.0" + "@metamask/superstruct": "npm:^3.1.0" + "@metamask/utils": "npm:^11.1.0" + bitcoin-address-validation: "npm:^2.2.3" + checksum: 10/eff3c0b9a86d6a25c5dd443946ba3ff56cb94fcb915a4eb061089819805e1e78eba2ea5cfb12a47ec4606542870c417de422f755947389ab9f3a4f08e96742db + languageName: node + linkType: hard + "@metamask/logging-controller@npm:^6.0.4": version: 6.0.4 resolution: "@metamask/logging-controller@npm:6.0.4" @@ -6040,13 +6124,13 @@ __metadata: languageName: node linkType: hard -"@metamask/profile-sync-controller@npm:^8.1.1": - version: 8.1.1 - resolution: "@metamask/profile-sync-controller@npm:8.1.1" +"@metamask/profile-sync-controller@npm:^9.0.0": + version: 9.0.0 + resolution: "@metamask/profile-sync-controller@npm:9.0.0" dependencies: "@metamask/base-controller": "npm:^8.0.0" "@metamask/keyring-api": "npm:^17.2.0" - "@metamask/keyring-controller": "npm:^19.2.1" + "@metamask/keyring-controller": "npm:^20.0.0" "@metamask/network-controller": "npm:^22.2.1" "@metamask/snaps-sdk": "npm:^6.17.1" "@metamask/snaps-utils": "npm:^8.10.0" @@ -6056,13 +6140,13 @@ __metadata: loglevel: "npm:^1.8.1" siwe: "npm:^2.3.2" peerDependencies: - "@metamask/accounts-controller": ^24.0.0 - "@metamask/keyring-controller": ^19.0.0 + "@metamask/accounts-controller": ^25.0.0 + "@metamask/keyring-controller": ^20.0.0 "@metamask/network-controller": ^22.0.0 "@metamask/providers": ^18.1.0 "@metamask/snaps-controllers": ^9.19.0 webextension-polyfill: ^0.10.0 || ^0.11.0 || ^0.12.0 - checksum: 10/4b18a546c0d78f010fbf1cf16644001ba0139c60941ceb70b83c7850e2fafcd5d17b8148f8020dcfe0e8c3f897259480077fa6b4402f4d270ed68e248d628369 + checksum: 10/bcfb112b5352ccb6d6534320084ce12a1e738e97ad683bb3fb9bc4672bfd570e76ff61dd714cb31482b77b9990eea688192db54c568ab83c1a909e1d2b07383c languageName: node linkType: hard @@ -6429,10 +6513,10 @@ __metadata: languageName: node linkType: hard -"@metamask/solana-wallet-snap@npm:^1.10.0": - version: 1.10.0 - resolution: "@metamask/solana-wallet-snap@npm:1.10.0" - checksum: 10/d7a1538fad9adf92f78334b5422aba81182bb70d06ddc3319b10df563f742d9df53ac2b7d501191fc2cb3ced8b405fe39e764c2d33e81fdc1596ff027e0e40f6 +"@metamask/solana-wallet-snap@npm:^1.11.0": + version: 1.11.0 + resolution: "@metamask/solana-wallet-snap@npm:1.11.0" + checksum: 10/2d6e9a0ed37805a48cedbf3f7ff039223270e1e54abf0a942696356bdfb6c5623df56fe52cee8763a0cf35eacda23aab9810dcf61e5bb5ce64f2144c3075f63d languageName: node linkType: hard @@ -6487,51 +6571,17 @@ __metadata: languageName: node linkType: hard -"@metamask/transaction-controller@npm:45.0.0": - version: 45.0.0 - resolution: "@metamask/transaction-controller@npm:45.0.0" - dependencies: - "@ethereumjs/common": "npm:^3.2.0" - "@ethereumjs/tx": "npm:^4.2.0" - "@ethereumjs/util": "npm:^8.1.0" - "@ethersproject/abi": "npm:^5.7.0" - "@ethersproject/contracts": "npm:^5.7.0" - "@ethersproject/providers": "npm:^5.7.0" - "@metamask/base-controller": "npm:^7.1.1" - "@metamask/controller-utils": "npm:^11.5.0" - "@metamask/eth-query": "npm:^4.0.0" - "@metamask/metamask-eth-abis": "npm:^3.1.1" - "@metamask/nonce-tracker": "npm:^6.0.0" - "@metamask/rpc-errors": "npm:^7.0.2" - "@metamask/utils": "npm:^11.1.0" - async-mutex: "npm:^0.5.0" - bn.js: "npm:^5.2.1" - eth-method-registry: "npm:^4.0.0" - fast-json-patch: "npm:^3.1.1" - lodash: "npm:^4.17.21" - uuid: "npm:^8.3.2" - peerDependencies: - "@babel/runtime": ^7.0.0 - "@metamask/accounts-controller": ^23.0.0 - "@metamask/approval-controller": ^7.0.0 - "@metamask/eth-block-tracker": ">=9" - "@metamask/gas-fee-controller": ^22.0.0 - "@metamask/network-controller": ^22.0.0 - checksum: 10/42fc91e4ebb0ad83f8230c2060c392d0ba5fd555a2d3f407862c4574f195f1cb2b57ea025ea332e55a1196605602209219a828c565bd6a13d3135557d7427e24 - languageName: node - linkType: hard - -"@metamask/transaction-controller@patch:@metamask/transaction-controller@npm%3A45.0.0#~/.yarn/patches/@metamask-transaction-controller-npm-45.0.0-010fef9da6.patch": - version: 45.0.0 - resolution: "@metamask/transaction-controller@patch:@metamask/transaction-controller@npm%3A45.0.0#~/.yarn/patches/@metamask-transaction-controller-npm-45.0.0-010fef9da6.patch::version=45.0.0&hash=e00dfe" +"@metamask/transaction-controller@npm:^46.0.0": + version: 46.0.0 + resolution: "@metamask/transaction-controller@npm:46.0.0" dependencies: - "@ethereumjs/common": "npm:^3.2.0" - "@ethereumjs/tx": "npm:^4.2.0" + "@ethereumjs/common": "npm:^4.4.0" + "@ethereumjs/tx": "npm:^5.4.0" "@ethereumjs/util": "npm:^8.1.0" "@ethersproject/abi": "npm:^5.7.0" "@ethersproject/contracts": "npm:^5.7.0" "@ethersproject/providers": "npm:^5.7.0" - "@metamask/base-controller": "npm:^7.1.1" + "@metamask/base-controller": "npm:^8.0.0" "@metamask/controller-utils": "npm:^11.5.0" "@metamask/eth-query": "npm:^4.0.0" "@metamask/metamask-eth-abis": "npm:^3.1.1" @@ -6546,12 +6596,12 @@ __metadata: uuid: "npm:^8.3.2" peerDependencies: "@babel/runtime": ^7.0.0 - "@metamask/accounts-controller": ^23.0.0 + "@metamask/accounts-controller": ^24.0.0 "@metamask/approval-controller": ^7.0.0 "@metamask/eth-block-tracker": ">=9" "@metamask/gas-fee-controller": ^22.0.0 "@metamask/network-controller": ^22.0.0 - checksum: 10/b65d8d04031c3bbba2f95dcf66d22bcd0ef83c66fb3b341943ff6d81befbf370f826e9b9f0d73fccf3686a6550c2c0d3e80ad394618273964cc5efc1cb1d31fe + checksum: 10/d74a6ab0c08527f56741d89b6e0b7b0ceca9b5d8cc6ebbb36ea4f084b1cabbd146608015adbf69412ecbd378aec4028105938a91415b57b872f580669cb977a6 languageName: node linkType: hard @@ -27222,7 +27272,7 @@ __metadata: "@babel/runtime": "patch:@babel/runtime@npm%3A7.25.9#~/.yarn/patches/@babel-runtime-npm-7.25.9-fe8c62510a.patch" "@blockaid/ppom_release": "npm:^1.5.3" "@ensdomains/content-hash": "npm:^2.5.7" - "@ethereumjs/tx": "npm:^4.1.1" + "@ethereumjs/tx": "npm:^5.4.0" "@ethersproject/abi": "npm:^5.6.4" "@ethersproject/bignumber": "npm:^5.7.0" "@ethersproject/bytes": "npm:^5.7.0" @@ -27253,7 +27303,7 @@ __metadata: "@metamask-institutional/types": "npm:^1.2.0" "@metamask/abi-utils": "npm:^2.0.2" "@metamask/account-watcher": "npm:^4.1.2" - "@metamask/accounts-controller": "npm:^24.1.0" + "@metamask/accounts-controller": "npm:^26.0.0" "@metamask/address-book-controller": "npm:^6.0.3" "@metamask/announcement-controller": "npm:^7.0.3" "@metamask/api-specs": "npm:^0.11.0" @@ -27278,11 +27328,11 @@ __metadata: "@metamask/eth-json-rpc-filters": "npm:^9.0.0" "@metamask/eth-json-rpc-middleware": "npm:^15.1.2" "@metamask/eth-json-rpc-provider": "npm:^4.1.6" - "@metamask/eth-ledger-bridge-keyring": "npm:^8.0.3" + "@metamask/eth-ledger-bridge-keyring": "npm:^10.0.0" "@metamask/eth-sig-util": "npm:^7.0.1" - "@metamask/eth-snap-keyring": "npm:^11.1.0" + "@metamask/eth-snap-keyring": "npm:^12.0.0" "@metamask/eth-token-tracker": "npm:^10.0.2" - "@metamask/eth-trezor-keyring": "npm:^6.0.0" + "@metamask/eth-trezor-keyring": "npm:^8.0.0" "@metamask/etherscan-link": "npm:^3.0.0" "@metamask/forwarder": "npm:^1.1.0" "@metamask/gas-fee-controller": "npm:^22.0.3" @@ -27290,8 +27340,8 @@ __metadata: "@metamask/json-rpc-engine": "npm:^10.0.0" "@metamask/json-rpc-middleware-stream": "npm:^8.0.4" "@metamask/keyring-api": "npm:^17.2.1" - "@metamask/keyring-controller": "npm:^19.2.0" - "@metamask/keyring-internal-api": "npm:^4.0.3" + "@metamask/keyring-controller": "npm:^21.0.0" + "@metamask/keyring-internal-api": "npm:^6.0.0" "@metamask/keyring-snap-client": "npm:^4.0.1" "@metamask/logging-controller": "npm:^6.0.4" "@metamask/logo": "npm:^4.0.0" @@ -27315,7 +27365,7 @@ __metadata: "@metamask/ppom-validator": "npm:0.36.0" "@metamask/preferences-controller": "npm:^15.0.2" "@metamask/preinstalled-example-snap": "npm:^0.3.0" - "@metamask/profile-sync-controller": "npm:^8.1.1" + "@metamask/profile-sync-controller": "npm:^9.0.0" "@metamask/providers": "npm:^20.0.0" "@metamask/queued-request-controller": "npm:^7.0.1" "@metamask/rate-limit-controller": "npm:^6.0.3" @@ -27331,11 +27381,11 @@ __metadata: "@metamask/snaps-rpc-methods": "npm:^11.13.1" "@metamask/snaps-sdk": "npm:^6.19.0" "@metamask/snaps-utils": "npm:^9.0.1" - "@metamask/solana-wallet-snap": "npm:^1.10.0" + "@metamask/solana-wallet-snap": "npm:^1.11.0" "@metamask/test-bundler": "npm:^1.0.0" "@metamask/test-dapp": "npm:9.0.0" "@metamask/test-dapp-multichain": "npm:^0.6.0" - "@metamask/transaction-controller": "patch:@metamask/transaction-controller@npm%3A45.0.0#~/.yarn/patches/@metamask-transaction-controller-npm-45.0.0-010fef9da6.patch" + "@metamask/transaction-controller": "npm:^46.0.0" "@metamask/user-operation-controller": "npm:^24.0.1" "@metamask/utils": "npm:^11.1.0" "@ngraveio/bc-ur": "npm:^1.1.12"