From 631dbe95a320db1dc090a1072cf74e2428a4e754 Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Fri, 13 Sep 2024 10:05:57 +0200 Subject: [PATCH 01/49] feat(NOTIFY-1096): add account syncing --- app/actions/notification/helpers/index.ts | 8 ++ app/components/Views/Wallet/index.tsx | 18 ++-- app/core/Engine.ts | 13 ++- .../hooks/useProfileSyncing.test.tsx | 79 +++++++++++++- .../notifications/hooks/useProfileSyncing.ts | 45 +++++++- ios/Podfile.lock | 6 +- package.json | 6 +- yarn.lock | 102 +++++++++++++++++- 8 files changed, 256 insertions(+), 21 deletions(-) diff --git a/app/actions/notification/helpers/index.ts b/app/actions/notification/helpers/index.ts index b613ca97691..3065cb45181 100644 --- a/app/actions/notification/helpers/index.ts +++ b/app/actions/notification/helpers/index.ts @@ -150,3 +150,11 @@ export const markMetamaskNotificationsAsRead = async ( return getErrorMessage(error); } }; + +export const syncInternalAccountsWithUserStorage = async () => { + try { + await Engine.context.UserStorageController.syncInternalAccountsWithUserStorage(); + } catch (error) { + return getErrorMessage(error); + } +}; diff --git a/app/components/Views/Wallet/index.tsx b/app/components/Views/Wallet/index.tsx index 4ec2cd9ea77..596573943cf 100644 --- a/app/components/Views/Wallet/index.tsx +++ b/app/components/Views/Wallet/index.tsx @@ -85,6 +85,7 @@ import { } from '../../../selectors/notifications'; import { ButtonVariants } from '../../../component-library/components/Buttons/Button'; import { useListNotifications } from '../../../util/notifications/hooks/useNotifications'; +import { useAccountSyncingEffect } from 'app/util/notifications/hooks/useProfileSyncing'; const createStyles = ({ colors, typography }: Theme) => StyleSheet.create({ @@ -396,13 +397,16 @@ const Wallet = ({ [navigation, providerConfig.chainId], ); - // Effect - fetch notifications when component/view is visible. - useEffect(() => { - async function updateNotifications() { - await listNotifications(); - } - updateNotifications(); - }, [listNotifications]); + // Effect - fetch notifications when component/view is visible. + useEffect(() => { + async function updateNotifications() { + await listNotifications(); + } + updateNotifications(); + }, [listNotifications]); + + // Effect - dispatch account syncing + useAccountSyncingEffect(); useEffect(() => { navigation.setOptions( diff --git a/app/core/Engine.ts b/app/core/Engine.ts index 8c116076e82..ec423aaeb58 100644 --- a/app/core/Engine.ts +++ b/app/core/Engine.ts @@ -1076,6 +1076,9 @@ class Engine { const userStorageController = new UserStorageController.Controller({ getMetaMetricsState: () => MetaMetrics.getInstance().isEnabled(), + env: { + isAccountSyncingEnabled: true, + }, state: initialState.UserStorageController, // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore TODO: Resolve/patch mismatch between messenger types @@ -1084,6 +1087,7 @@ class Engine { allowedActions: [ 'SnapController:handleRequest', 'KeyringController:getState', + 'KeyringController:addNewAccount', 'AuthenticationController:getBearerToken', 'AuthenticationController:getSessionProfile', 'AuthenticationController:isSignedIn', @@ -1091,8 +1095,15 @@ class Engine { 'AuthenticationController:performSignIn', 'NotificationServicesController:disableNotificationServices', 'NotificationServicesController:selectIsNotificationServicesEnabled', + 'AccountsController:listAccounts', + 'AccountsController:updateAccountMetadata', + ], + allowedEvents: [ + 'KeyringController:unlock', + 'KeyringController:lock', + 'AccountsController:accountAdded', + 'AccountsController:accountRenamed', ], - allowedEvents: ['KeyringController:unlock', 'KeyringController:lock'], }), }); diff --git a/app/util/notifications/hooks/useProfileSyncing.test.tsx b/app/util/notifications/hooks/useProfileSyncing.test.tsx index 3e9885dd8ef..06fcc98bc5b 100644 --- a/app/util/notifications/hooks/useProfileSyncing.test.tsx +++ b/app/util/notifications/hooks/useProfileSyncing.test.tsx @@ -9,7 +9,7 @@ import { Provider } from 'react-redux'; import createMockStore from 'redux-mock-store'; import * as Actions from '../../../actions/notification/helpers'; import initialRootState from '../../../util/test/initial-root-state'; -import { useProfileSyncing } from './useProfileSyncing'; +import { useAccountSyncing, useProfileSyncing } from './useProfileSyncing'; function arrangeStore() { const store = createMockStore()(initialRootState); @@ -172,3 +172,80 @@ describe('useDisableProfileSyncing', () => { ); }); }); + +describe('useAccountSyncing', () => { + beforeEach(() => { + jest.clearAllMocks(); + }); + + function arrangeHook() { + const store = arrangeStore(); + const hook = renderHook(() => useAccountSyncing(), { + wrapper: ({ children }) => {children}, + }); + + return hook; + } + + function arrangeActions() { + const syncInternalAccountsWithUserStorageAction = jest + .spyOn(Actions, 'syncInternalAccountsWithUserStorage') + .mockResolvedValue(undefined); + + return { + syncInternalAccountsWithUserStorageAction, + }; + } + + it('dispatches account syncing and return loading as false and error as undefined', async () => { + const mockActions = arrangeActions(); + + const { result } = arrangeHook(); + await act(async () => { + await result.current.dispatchAccountSyncing(); + }); + + expect( + mockActions.syncInternalAccountsWithUserStorageAction, + ).toHaveBeenCalledTimes(1); + expect(result.current.error).toBeUndefined(); + }); + + it('sets error message when syncInternalAccountsWithUserStorageAction returns an error', async () => { + const mockActions = arrangeActions(); + mockActions.syncInternalAccountsWithUserStorageAction.mockRejectedValueOnce( + new Error('MOCK - failed to sync internal account with user storage'), + ); + + const { result } = arrangeHook(); + await act(async () => { + await result.current.dispatchAccountSyncing(); + }); + + expect( + mockActions.syncInternalAccountsWithUserStorageAction, + ).toHaveBeenCalledTimes(1); + expect(result.current.error).toBeDefined(); + expect(result.current.isLoading).toBe(false); + expect(result.current.error).toEqual( + 'MOCK - failed to sync internal account with user storage', + ); + }); + + it('sets error message when an error occurs during dispatchAccountSyncing', async () => { + const mockActions = arrangeActions(); + mockActions.syncInternalAccountsWithUserStorageAction.mockRejectedValueOnce( + new Error('MOCK - failed to sync internal account with user storage'), + ); + + const { result } = arrangeHook(); + await act(async () => { + await result.current.dispatchAccountSyncing(); + }); + + expect(result.current.error).toBeDefined(); + expect(result.current.error).toEqual( + 'MOCK - failed to sync internal account with user storage', + ); + }); +}); diff --git a/app/util/notifications/hooks/useProfileSyncing.ts b/app/util/notifications/hooks/useProfileSyncing.ts index 33255b0b590..16d8f6f1e8c 100644 --- a/app/util/notifications/hooks/useProfileSyncing.ts +++ b/app/util/notifications/hooks/useProfileSyncing.ts @@ -1,10 +1,11 @@ /* eslint-disable import/prefer-default-export */ -import { useState, useCallback } from 'react'; +import { useState, useCallback, useEffect } from 'react'; import { ProfileSyncingReturn } from './types'; import { getErrorMessage } from '../../../util/errorHandling'; import { disableProfileSyncing as disableProfileSyncingAction, enableProfileSyncing as enableProfileSyncingAction, + syncInternalAccountsWithUserStorage as syncInternalAccountsWithUserStorageAction, } from '../../../actions/notification/helpers'; /** @@ -56,3 +57,45 @@ export function useProfileSyncing(): ProfileSyncingReturn { return { enableProfileSyncing, disableProfileSyncing, loading, error }; } + +/** + * Custom hook to dispatch account syncing. + * + * @returns An object containing the `dispatchAccountSyncing` function, loading state, and error state. + */ +export const useAccountSyncing = () => { + const [isLoading, setLoading] = useState(false); + const [error, setError] = useState(); + + const dispatchAccountSyncing = useCallback(async () => { + setLoading(true); + setError(undefined); + try { + const errorMessage = await syncInternalAccountsWithUserStorageAction(); + if (errorMessage) { + setError(getErrorMessage(errorMessage)); + return errorMessage; + } + } catch (e) { + const errorMessage = getErrorMessage(e); + setError(errorMessage); + return errorMessage; + } finally { + setLoading(false); + } + }, []); + + return { + dispatchAccountSyncing, + error, + isLoading, + }; +}; + +export const useAccountSyncingEffect = () => { + const { dispatchAccountSyncing } = useAccountSyncing(); + + useEffect(() => { + dispatchAccountSyncing(); + }, [dispatchAccountSyncing]); +}; diff --git a/ios/Podfile.lock b/ios/Podfile.lock index a2be080944f..95c7fb1ed4e 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -576,7 +576,7 @@ PODS: - React-Core - react-native-view-shot (3.1.2): - React - - react-native-webview-mm (14.0.2): + - react-native-webview-mm (14.0.3): - React-Core - React-NativeModulesApple (0.72.15): - React-callinvoker @@ -1249,7 +1249,7 @@ SPEC CHECKSUMS: react-native-splash-screen: 49a7160705f32169d27ab8dff9dda53331592412 react-native-video: c26780b224543c62d5e1b2a7244a5cd1b50e8253 react-native-view-shot: 4475fde003fe8a210053d1f98fb9e06c1d834e1c - react-native-webview-mm: c7df943491b1c6d2c48238778c09a4d05cd2b322 + react-native-webview-mm: 37644cf11406a7135d030555a82186976feb5621 React-NativeModulesApple: 7bab439cb5de9a76299210ed1127698170777a7f React-perflogger: 6acc671f527e69c0cd93b8e62821d33d3ddf25ca React-RCTActionSheet: 569bb9db46d85565d14697e15ecf2166e035eb07 @@ -1302,6 +1302,6 @@ SPEC CHECKSUMS: Yoga: 6f5ab94cd8b1ecd04b6e973d0bc583ede2a598cc YogaKit: f782866e155069a2cca2517aafea43200b01fd5a -PODFILE CHECKSUM: e4050300fc9c8d091b9c00e1486ad6e205c250c7 +PODFILE CHECKSUM: 3514934ac1830af4ca844ba018f38720a48d006b COCOAPODS: 1.15.2 diff --git a/package.json b/package.json index 9b8266fe77d..d280b98e017 100644 --- a/package.json +++ b/package.json @@ -149,7 +149,7 @@ "@keystonehq/metamask-airgapped-keyring": "^0.13.1", "@keystonehq/ur-decoder": "^0.12.2", "@ledgerhq/react-native-hw-transport-ble": "^6.33.2", - "@metamask/accounts-controller": "^18.1.0", + "@metamask/accounts-controller": "^18.2.0", "@metamask/address-book-controller": "^4.0.1", "@metamask/approval-controller": "^7.0.1", "@metamask/assets-controllers": "^30.0.0", @@ -165,7 +165,7 @@ "@metamask/gas-fee-controller": "^18.0.0", "@metamask/key-tree": "^9.0.0", "@metamask/keyring-api": "^8.1.0", - "@metamask/keyring-controller": "^16.0.0", + "@metamask/keyring-controller": "^17.2.0", "@metamask/logging-controller": "^3.0.0", "@metamask/message-signing-snap": "^0.3.3", "@metamask/network-controller": "^19.0.0", @@ -175,7 +175,7 @@ "@metamask/post-message-stream": "^8.0.0", "@metamask/ppom-validator": "0.32.0", "@metamask/preferences-controller": "^11.0.0", - "@metamask/profile-sync-controller": "^0.2.1", + "@metamask/profile-sync-controller": "npm:@metamask-previews/profile-sync-controller@0.5.0-preview-c1e764d", "@metamask/react-native-actionsheet": "2.4.2", "@metamask/react-native-button": "^3.0.0", "@metamask/react-native-payments": "^2.0.0", diff --git a/yarn.lock b/yarn.lock index e9a9ee1f964..c90b354496f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3801,6 +3801,18 @@ rlp "^2.2.6" uuid "^8.3.2" +"@keystonehq/metamask-airgapped-keyring@^0.14.1": + version "0.14.1" + resolved "https://registry.yarnpkg.com/@keystonehq/metamask-airgapped-keyring/-/metamask-airgapped-keyring-0.14.1.tgz#1b797f7ad40fc908e411f201694fb31ebaa564d6" + integrity sha512-ffBa+LMkZUMj0KKW/YYoncxuUqsnBPn9xss1kHEgvva5GviylMcosbVyV2AAbtnRii1VK6wTSWzAzUdR8giq3A== + dependencies: + "@ethereumjs/tx" "^4.0.2" + "@keystonehq/base-eth-keyring" "^0.14.1" + "@keystonehq/bc-ur-registry-eth" "^0.19.1" + "@metamask/obs-store" "^9.0.0" + rlp "^2.2.6" + uuid "^8.3.2" + "@keystonehq/ur-decoder@^0.12.2": version "0.12.2" resolved "https://registry.yarnpkg.com/@keystonehq/ur-decoder/-/ur-decoder-0.12.2.tgz#78707d95012bc6d31c947c76c27e076d4a1c071c" @@ -3950,6 +3962,23 @@ immer "^9.0.6" uuid "^8.3.2" +"@metamask/accounts-controller@^18.2.0": + version "18.2.0" + resolved "https://registry.yarnpkg.com/@metamask/accounts-controller/-/accounts-controller-18.2.0.tgz#b3131b9231f30ffc29eb010a5b964409aa0942f5" + integrity sha512-rIyFIBNrTwdyMVawXORdFON6poP2TRB5BAKgRdIJvtw4DsPtusEb8iZT3o6O4J48vmFsRgDTpDiTG29UvGHnHg== + dependencies: + "@ethereumjs/util" "^8.1.0" + "@metamask/base-controller" "^7.0.0" + "@metamask/eth-snap-keyring" "^4.3.1" + "@metamask/keyring-api" "^8.1.0" + "@metamask/snaps-sdk" "^6.1.1" + "@metamask/snaps-utils" "^7.8.1" + "@metamask/utils" "^9.1.0" + deepmerge "^4.2.2" + ethereum-cryptography "^2.1.2" + immer "^9.0.6" + uuid "^8.3.2" + "@metamask/address-book-controller@^4.0.1": version "4.0.1" resolved "https://registry.yarnpkg.com/@metamask/address-book-controller/-/address-book-controller-4.0.1.tgz#78a841e97b7db0058e6796590eb07444c750d13f" @@ -4045,6 +4074,14 @@ "@metamask/utils" "^9.1.0" immer "^9.0.6" +"@metamask/base-controller@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@metamask/base-controller/-/base-controller-7.0.0.tgz#c6eedac9692d65222d7715e048b1b6f74af07b12" + integrity sha512-/wFqfXe/caAWvsHcSNJOTQdUPL7HJeM15d/7IzTI/Jpd1aaO4u/CVY5dPxnBXjhSVtQGQZC6jIGlWim5GluoUw== + dependencies: + "@metamask/utils" "^9.1.0" + immer "^9.0.6" + "@metamask/browser-passworder@^4.3.0": version "4.3.0" resolved "https://registry.yarnpkg.com/@metamask/browser-passworder/-/browser-passworder-4.3.0.tgz#62c200750efcea864bd31d685120331859e1ab1e" @@ -4109,6 +4146,21 @@ eth-ens-namehash "^2.0.8" fast-deep-equal "^3.1.3" +"@metamask/controller-utils@^11.2.0": + version "11.2.0" + resolved "https://registry.yarnpkg.com/@metamask/controller-utils/-/controller-utils-11.2.0.tgz#d0acb37e3b8a50d19a460e268845ee074df252d7" + integrity sha512-37ITJ87Jm/G+0FBztA3dow9yKlCpCgRz8oiJ2fMpJTaotPsDCveRNKMgmk2uVa/J90bgYF4bUvi265f+rlZkGQ== + dependencies: + "@ethereumjs/util" "^8.1.0" + "@metamask/eth-query" "^4.0.0" + "@metamask/ethjs-unit" "^0.3.0" + "@metamask/utils" "^9.1.0" + "@spruceid/siwe-parser" "2.1.0" + "@types/bn.js" "^5.1.5" + bn.js "^5.2.1" + eth-ens-namehash "^2.0.8" + fast-deep-equal "^3.1.3" + "@metamask/controller-utils@^8.0.1", "@metamask/controller-utils@^8.0.2", "@metamask/controller-utils@^8.0.4": version "8.0.4" resolved "https://registry.yarnpkg.com/@metamask/controller-utils/-/controller-utils-8.0.4.tgz#78a952301ff4b2a501b31865ab0de434c6ea3cd2" @@ -4521,6 +4573,25 @@ ethereumjs-wallet "^1.0.1" immer "^9.0.6" +"@metamask/keyring-controller@^17.2.0": + version "17.2.0" + resolved "https://registry.yarnpkg.com/@metamask/keyring-controller/-/keyring-controller-17.2.0.tgz#19125e50ad969fad253d4ed0f52d724a2c10ac43" + integrity sha512-tVnsLG4FbwqeAXCQj04CFcQ5hWfPDcxzU9kI1X/O5M0zwzjf9dFTOH/v09Fg9L/lnB40aTFoNHLdcW4Cxc9tMQ== + dependencies: + "@ethereumjs/util" "^8.1.0" + "@keystonehq/metamask-airgapped-keyring" "^0.14.1" + "@metamask/base-controller" "^7.0.0" + "@metamask/browser-passworder" "^4.3.0" + "@metamask/eth-hd-keyring" "^7.0.1" + "@metamask/eth-sig-util" "^7.0.1" + "@metamask/eth-simple-keyring" "^6.0.1" + "@metamask/keyring-api" "^8.1.0" + "@metamask/message-manager" "^10.0.3" + "@metamask/utils" "^9.1.0" + async-mutex "^0.5.0" + ethereumjs-wallet "^1.0.1" + immer "^9.0.6" + "@metamask/logging-controller@^3.0.0", "@metamask/logging-controller@^3.0.1": version "3.0.1" resolved "https://registry.yarnpkg.com/@metamask/logging-controller/-/logging-controller-3.0.1.tgz#11c2b127bc2d7d4b753e2d757b0c09bf2742bf0a" @@ -4530,6 +4601,19 @@ "@metamask/controller-utils" "^9.0.1" uuid "^8.3.2" +"@metamask/message-manager@^10.0.3": + version "10.1.0" + resolved "https://registry.yarnpkg.com/@metamask/message-manager/-/message-manager-10.1.0.tgz#ff38f3795f7612f14254cea4eb3c799c01545164" + integrity sha512-NuVOvPrQTH7i8248m/zY2eN8jVEFyXQDmEmCOytpQKdkifWqk9i4cvyE9ecKJSHuJDmPz4fj85VXu1uJYOQVKw== + dependencies: + "@metamask/base-controller" "^7.0.0" + "@metamask/controller-utils" "^11.2.0" + "@metamask/eth-sig-util" "^7.0.1" + "@metamask/utils" "^9.1.0" + "@types/uuid" "^8.3.0" + jsonschema "^1.2.4" + uuid "^8.3.2" + "@metamask/message-manager@^8.0.2": version "8.0.2" resolved "https://registry.yarnpkg.com/@metamask/message-manager/-/message-manager-8.0.2.tgz#84720f0fe9e0c02cc97b76f0bc8f3d5b0a25f731" @@ -4702,6 +4786,14 @@ "@metamask/safe-event-emitter" "^2.0.0" through2 "^2.0.3" +"@metamask/obs-store@^9.0.0": + version "9.0.0" + resolved "https://registry.yarnpkg.com/@metamask/obs-store/-/obs-store-9.0.0.tgz#fa50c988b4635817ff0454bc9763b1cf6b37d9e9" + integrity sha512-GDsEh2DTHgmISzJt8erf9T4Ph38iwD2yDJ6J1YFq/IcWRGnT1bkgSEVqZMv9c9JloX02T5bFIUK6+9m9EycI6A== + dependencies: + "@metamask/safe-event-emitter" "^3.0.0" + readable-stream "^3.6.2" + "@metamask/permission-controller@^10.0.0": version "10.0.0" resolved "https://registry.yarnpkg.com/@metamask/permission-controller/-/permission-controller-10.0.0.tgz#821280763cc37e9597fe7d207b5da00a881ad32a" @@ -4853,12 +4945,12 @@ "@metamask/base-controller" "^5.0.2" "@metamask/controller-utils" "^9.1.0" -"@metamask/profile-sync-controller@^0.2.1": - version "0.2.1" - resolved "https://registry.yarnpkg.com/@metamask/profile-sync-controller/-/profile-sync-controller-0.2.1.tgz#b9e4d951ba357c7b26dd4ad68049635f1b6947e1" - integrity sha512-F4domapXsNmN2LmEUzOGTWPoTmlorlebCnh8LW6JxbIQuqgyi+sKpfE0zb2M60Z8AYR6v+qnjw7X47CS9HHupQ== +"@metamask/profile-sync-controller@npm:@metamask-previews/profile-sync-controller@0.5.0-preview-c1e764d": + version "0.5.0-preview-c1e764d" + resolved "https://registry.yarnpkg.com/@metamask-previews/profile-sync-controller/-/profile-sync-controller-0.5.0-preview-c1e764d.tgz#8517426846ce23600a9f68ea968f03bfb428c6e7" + integrity sha512-YXe3F8/FbPBGNXflrezgiBSqszIsQzJtLIX1PmBlL4lMbDp06PXzWkf7C558oMu5fykepVSkELlwzw10djWzhg== dependencies: - "@metamask/base-controller" "^6.0.2" + "@metamask/base-controller" "^7.0.0" "@metamask/snaps-sdk" "^6.1.1" "@metamask/snaps-utils" "^7.8.1" "@noble/ciphers" "^0.5.2" From 04780e07a587ce127de3c81a961b8574e54177f4 Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Fri, 13 Sep 2024 10:28:19 +0200 Subject: [PATCH 02/49] fix: import path --- app/components/Views/Wallet/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/Views/Wallet/index.tsx b/app/components/Views/Wallet/index.tsx index 596573943cf..3c86e97f138 100644 --- a/app/components/Views/Wallet/index.tsx +++ b/app/components/Views/Wallet/index.tsx @@ -85,7 +85,7 @@ import { } from '../../../selectors/notifications'; import { ButtonVariants } from '../../../component-library/components/Buttons/Button'; import { useListNotifications } from '../../../util/notifications/hooks/useNotifications'; -import { useAccountSyncingEffect } from 'app/util/notifications/hooks/useProfileSyncing'; +import { useAccountSyncingEffect } from '../../../util/notifications/hooks/useProfileSyncing'; const createStyles = ({ colors, typography }: Theme) => StyleSheet.create({ From 771ad50bdcda3eba4eb550eac74057da9df7765a Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Fri, 13 Sep 2024 11:58:41 +0200 Subject: [PATCH 03/49] fix: useEffect --- app/components/Views/Wallet/index.tsx | 10 ++++++++-- .../hooks/useProfileSyncing.test.tsx | 3 +-- app/util/notifications/hooks/useProfileSyncing.ts | 15 +-------------- ios/Gemfile.lock | 12 ++++++++++++ 4 files changed, 22 insertions(+), 18 deletions(-) create mode 100644 ios/Gemfile.lock diff --git a/app/components/Views/Wallet/index.tsx b/app/components/Views/Wallet/index.tsx index 3c86e97f138..619fd546c0a 100644 --- a/app/components/Views/Wallet/index.tsx +++ b/app/components/Views/Wallet/index.tsx @@ -85,7 +85,7 @@ import { } from '../../../selectors/notifications'; import { ButtonVariants } from '../../../component-library/components/Buttons/Button'; import { useListNotifications } from '../../../util/notifications/hooks/useNotifications'; -import { useAccountSyncingEffect } from '../../../util/notifications/hooks/useProfileSyncing'; +import { useAccountSyncing } from '../../../util/notifications/hooks/useProfileSyncing'; const createStyles = ({ colors, typography }: Theme) => StyleSheet.create({ @@ -150,6 +150,7 @@ const Wallet = ({ }: WalletProps) => { const { navigate } = useNavigation(); const { listNotifications } = useListNotifications(); + const { dispatchAccountSyncing } = useAccountSyncing(); const walletRef = useRef(null); const theme = useTheme(); const { toastRef } = useContext(ToastContext); @@ -406,7 +407,12 @@ const Wallet = ({ }, [listNotifications]); // Effect - dispatch account syncing - useAccountSyncingEffect(); + useEffect(() => { + if (currentRouteName !== 'Wallet') { + return; + } + dispatchAccountSyncing(); + }, [dispatchAccountSyncing, currentRouteName]); useEffect(() => { navigation.setOptions( diff --git a/app/util/notifications/hooks/useProfileSyncing.test.tsx b/app/util/notifications/hooks/useProfileSyncing.test.tsx index 06fcc98bc5b..0215f955430 100644 --- a/app/util/notifications/hooks/useProfileSyncing.test.tsx +++ b/app/util/notifications/hooks/useProfileSyncing.test.tsx @@ -197,7 +197,7 @@ describe('useAccountSyncing', () => { }; } - it('dispatches account syncing and return loading as false and error as undefined', async () => { + it('dispatches account syncing and error as undefined', async () => { const mockActions = arrangeActions(); const { result } = arrangeHook(); @@ -226,7 +226,6 @@ describe('useAccountSyncing', () => { mockActions.syncInternalAccountsWithUserStorageAction, ).toHaveBeenCalledTimes(1); expect(result.current.error).toBeDefined(); - expect(result.current.isLoading).toBe(false); expect(result.current.error).toEqual( 'MOCK - failed to sync internal account with user storage', ); diff --git a/app/util/notifications/hooks/useProfileSyncing.ts b/app/util/notifications/hooks/useProfileSyncing.ts index 16d8f6f1e8c..332ade6e3a8 100644 --- a/app/util/notifications/hooks/useProfileSyncing.ts +++ b/app/util/notifications/hooks/useProfileSyncing.ts @@ -61,14 +61,12 @@ export function useProfileSyncing(): ProfileSyncingReturn { /** * Custom hook to dispatch account syncing. * - * @returns An object containing the `dispatchAccountSyncing` function, loading state, and error state. + * @returns An object containing the `dispatchAccountSyncing` function, and error state. */ export const useAccountSyncing = () => { - const [isLoading, setLoading] = useState(false); const [error, setError] = useState(); const dispatchAccountSyncing = useCallback(async () => { - setLoading(true); setError(undefined); try { const errorMessage = await syncInternalAccountsWithUserStorageAction(); @@ -80,22 +78,11 @@ export const useAccountSyncing = () => { const errorMessage = getErrorMessage(e); setError(errorMessage); return errorMessage; - } finally { - setLoading(false); } }, []); return { dispatchAccountSyncing, error, - isLoading, }; }; - -export const useAccountSyncingEffect = () => { - const { dispatchAccountSyncing } = useAccountSyncing(); - - useEffect(() => { - dispatchAccountSyncing(); - }, [dispatchAccountSyncing]); -}; diff --git a/ios/Gemfile.lock b/ios/Gemfile.lock new file mode 100644 index 00000000000..0db5d06c5d0 --- /dev/null +++ b/ios/Gemfile.lock @@ -0,0 +1,12 @@ +GEM + remote: https://rubygems.org/ + specs: + +PLATFORMS + arm64-darwin-23 + ruby + +DEPENDENCIES + +BUNDLED WITH + 2.5.8 From 2f20cdb87b116e8aed726c943503a696ef01bc95 Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Fri, 13 Sep 2024 12:24:58 +0200 Subject: [PATCH 04/49] fix: temporarily remove keyring-controller patch --- .../@metamask+keyring-controller+16.0.0.patch | 134 ------------------ 1 file changed, 134 deletions(-) delete mode 100644 patches/@metamask+keyring-controller+16.0.0.patch diff --git a/patches/@metamask+keyring-controller+16.0.0.patch b/patches/@metamask+keyring-controller+16.0.0.patch deleted file mode 100644 index 30d86b784e6..00000000000 --- a/patches/@metamask+keyring-controller+16.0.0.patch +++ /dev/null @@ -1,134 +0,0 @@ -diff --git a/node_modules/@metamask/keyring-controller/.PATCH.txt b/node_modules/@metamask/keyring-controller/.PATCH.txt -new file mode 100644 -index 0000000..d4ec678 ---- /dev/null -+++ b/node_modules/@metamask/keyring-controller/.PATCH.txt -@@ -0,0 +1,8 @@ -+Patch for @metamask/keyring-controller v16.0.0 -+ -+The method `#addQRKeyring` has been updated to fix the extension issue 23804, The intial code added -+a empty accounts as argument when creating a new QR keyring. cause the new Keystone MetamaskKeyring -+default properties all are undefined during deserialise() process. Please refer to PR 23903 for -+detail. -+ -+This patch can be found on the core branch `keyring-controller-v16-patch` -diff --git a/node_modules/@metamask/keyring-controller/dist/KeyringController.js b/node_modules/@metamask/keyring-controller/dist/KeyringController.js -index 5b557f5..ff65f14 100644 ---- a/node_modules/@metamask/keyring-controller/dist/KeyringController.js -+++ b/node_modules/@metamask/keyring-controller/dist/KeyringController.js -@@ -7,7 +7,7 @@ - - - --var _chunk2GJQ6KDWjs = require('./chunk-2GJQ6KDW.js'); -+var _chunkEGSSQX6Ljs = require('./chunk-EGSSQX6L.js'); - require('./chunk-ZGV2QNCG.js'); - - -@@ -18,5 +18,5 @@ require('./chunk-ZGV2QNCG.js'); - - - --exports.AccountImportStrategy = _chunk2GJQ6KDWjs.AccountImportStrategy; exports.KeyringController = _chunk2GJQ6KDWjs.KeyringController; exports.KeyringTypes = _chunk2GJQ6KDWjs.KeyringTypes; exports.SignTypedDataVersion = _chunk2GJQ6KDWjs.SignTypedDataVersion; exports.default = _chunk2GJQ6KDWjs.KeyringController_default; exports.getDefaultKeyringState = _chunk2GJQ6KDWjs.getDefaultKeyringState; exports.isCustodyKeyring = _chunk2GJQ6KDWjs.isCustodyKeyring; exports.keyringBuilderFactory = _chunk2GJQ6KDWjs.keyringBuilderFactory; -+exports.AccountImportStrategy = _chunkEGSSQX6Ljs.AccountImportStrategy; exports.KeyringController = _chunkEGSSQX6Ljs.KeyringController; exports.KeyringTypes = _chunkEGSSQX6Ljs.KeyringTypes; exports.SignTypedDataVersion = _chunkEGSSQX6Ljs.SignTypedDataVersion; exports.default = _chunkEGSSQX6Ljs.KeyringController_default; exports.getDefaultKeyringState = _chunkEGSSQX6Ljs.getDefaultKeyringState; exports.isCustodyKeyring = _chunkEGSSQX6Ljs.isCustodyKeyring; exports.keyringBuilderFactory = _chunkEGSSQX6Ljs.keyringBuilderFactory; - //# sourceMappingURL=KeyringController.js.map -\ No newline at end of file -diff --git a/node_modules/@metamask/keyring-controller/dist/KeyringController.mjs b/node_modules/@metamask/keyring-controller/dist/KeyringController.mjs -index 6d75e83..f45940f 100644 ---- a/node_modules/@metamask/keyring-controller/dist/KeyringController.mjs -+++ b/node_modules/@metamask/keyring-controller/dist/KeyringController.mjs -@@ -7,7 +7,7 @@ import { - getDefaultKeyringState, - isCustodyKeyring, - keyringBuilderFactory --} from "./chunk-USAGXPFN.mjs"; -+} from "./chunk-MQVFNKTH.mjs"; - import "./chunk-4OE2G6WW.mjs"; - export { - AccountImportStrategy, -diff --git a/node_modules/@metamask/keyring-controller/dist/chunk-2GJQ6KDW.js b/node_modules/@metamask/keyring-controller/dist/chunk-EGSSQX6L.js -similarity index 99% -rename from node_modules/@metamask/keyring-controller/dist/chunk-2GJQ6KDW.js -rename to node_modules/@metamask/keyring-controller/dist/chunk-EGSSQX6L.js -index 81fdecf..3844651 100644 ---- a/node_modules/@metamask/keyring-controller/dist/chunk-2GJQ6KDW.js -+++ b/node_modules/@metamask/keyring-controller/dist/chunk-EGSSQX6L.js -@@ -1113,9 +1113,7 @@ getKeyringBuilderForType_fn = function(type) { - _addQRKeyring = new WeakSet(); - addQRKeyring_fn = async function() { - _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this); -- return await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _newKeyring, newKeyring_fn).call(this, "QR Hardware Wallet Device" /* qr */, { -- accounts: [] -- }); -+ return await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _newKeyring, newKeyring_fn).call(this, "QR Hardware Wallet Device" /* qr */); - }; - _subscribeToQRKeyringEvents = new WeakSet(); - subscribeToQRKeyringEvents_fn = function(qrKeyring) { -@@ -1465,4 +1463,4 @@ var KeyringController_default = KeyringController; - - - exports.KeyringTypes = KeyringTypes; exports.isCustodyKeyring = isCustodyKeyring; exports.AccountImportStrategy = AccountImportStrategy; exports.SignTypedDataVersion = SignTypedDataVersion; exports.keyringBuilderFactory = keyringBuilderFactory; exports.getDefaultKeyringState = getDefaultKeyringState; exports.KeyringController = KeyringController; exports.KeyringController_default = KeyringController_default; --//# sourceMappingURL=chunk-2GJQ6KDW.js.map -\ No newline at end of file -+//# sourceMappingURL=chunk-EGSSQX6L.js.map -\ No newline at end of file -diff --git a/node_modules/@metamask/keyring-controller/dist/chunk-USAGXPFN.mjs b/node_modules/@metamask/keyring-controller/dist/chunk-MQVFNKTH.mjs -similarity index 99% -rename from node_modules/@metamask/keyring-controller/dist/chunk-USAGXPFN.mjs -rename to node_modules/@metamask/keyring-controller/dist/chunk-MQVFNKTH.mjs -index 0cf6255..6b769d8 100644 ---- a/node_modules/@metamask/keyring-controller/dist/chunk-USAGXPFN.mjs -+++ b/node_modules/@metamask/keyring-controller/dist/chunk-MQVFNKTH.mjs -@@ -1113,9 +1113,7 @@ getKeyringBuilderForType_fn = function(type) { - _addQRKeyring = new WeakSet(); - addQRKeyring_fn = async function() { - __privateMethod(this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this); -- return await __privateMethod(this, _newKeyring, newKeyring_fn).call(this, "QR Hardware Wallet Device" /* qr */, { -- accounts: [] -- }); -+ return await __privateMethod(this, _newKeyring, newKeyring_fn).call(this, "QR Hardware Wallet Device" /* qr */); - }; - _subscribeToQRKeyringEvents = new WeakSet(); - subscribeToQRKeyringEvents_fn = function(qrKeyring) { -@@ -1465,4 +1463,4 @@ export { - KeyringController, - KeyringController_default - }; --//# sourceMappingURL=chunk-USAGXPFN.mjs.map -\ No newline at end of file -+//# sourceMappingURL=chunk-MQVFNKTH.mjs.map -\ No newline at end of file -diff --git a/node_modules/@metamask/keyring-controller/dist/index.js b/node_modules/@metamask/keyring-controller/dist/index.js -index 35b2a0f..655541f 100644 ---- a/node_modules/@metamask/keyring-controller/dist/index.js -+++ b/node_modules/@metamask/keyring-controller/dist/index.js -@@ -6,7 +6,7 @@ - - - --var _chunk2GJQ6KDWjs = require('./chunk-2GJQ6KDW.js'); -+var _chunkEGSSQX6Ljs = require('./chunk-EGSSQX6L.js'); - require('./chunk-ZGV2QNCG.js'); - - -@@ -16,5 +16,5 @@ require('./chunk-ZGV2QNCG.js'); - - - --exports.AccountImportStrategy = _chunk2GJQ6KDWjs.AccountImportStrategy; exports.KeyringController = _chunk2GJQ6KDWjs.KeyringController; exports.KeyringTypes = _chunk2GJQ6KDWjs.KeyringTypes; exports.SignTypedDataVersion = _chunk2GJQ6KDWjs.SignTypedDataVersion; exports.getDefaultKeyringState = _chunk2GJQ6KDWjs.getDefaultKeyringState; exports.isCustodyKeyring = _chunk2GJQ6KDWjs.isCustodyKeyring; exports.keyringBuilderFactory = _chunk2GJQ6KDWjs.keyringBuilderFactory; -+exports.AccountImportStrategy = _chunkEGSSQX6Ljs.AccountImportStrategy; exports.KeyringController = _chunkEGSSQX6Ljs.KeyringController; exports.KeyringTypes = _chunkEGSSQX6Ljs.KeyringTypes; exports.SignTypedDataVersion = _chunkEGSSQX6Ljs.SignTypedDataVersion; exports.getDefaultKeyringState = _chunkEGSSQX6Ljs.getDefaultKeyringState; exports.isCustodyKeyring = _chunkEGSSQX6Ljs.isCustodyKeyring; exports.keyringBuilderFactory = _chunkEGSSQX6Ljs.keyringBuilderFactory; - //# sourceMappingURL=index.js.map -\ No newline at end of file -diff --git a/node_modules/@metamask/keyring-controller/dist/index.mjs b/node_modules/@metamask/keyring-controller/dist/index.mjs -index ba28e4a..443b073 100644 ---- a/node_modules/@metamask/keyring-controller/dist/index.mjs -+++ b/node_modules/@metamask/keyring-controller/dist/index.mjs -@@ -6,7 +6,7 @@ import { - getDefaultKeyringState, - isCustodyKeyring, - keyringBuilderFactory --} from "./chunk-USAGXPFN.mjs"; -+} from "./chunk-MQVFNKTH.mjs"; - import "./chunk-4OE2G6WW.mjs"; - export { - AccountImportStrategy, From 249a1ba1e1fbda53956e3933afb56f1542c2616d Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Fri, 13 Sep 2024 12:35:26 +0200 Subject: [PATCH 05/49] fix: yarn.lock --- yarn.lock | 38 +++----------------------------------- 1 file changed, 3 insertions(+), 35 deletions(-) diff --git a/yarn.lock b/yarn.lock index c90b354496f..f7e393994aa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3945,24 +3945,7 @@ "@metamask/utils" "^8.0.0" superstruct "^1.0.3" -"@metamask/accounts-controller@^14.0.0", "@metamask/accounts-controller@^17.2.0", "@metamask/accounts-controller@^18.1.0": - version "18.1.0" - resolved "https://registry.yarnpkg.com/@metamask/accounts-controller/-/accounts-controller-18.1.0.tgz#a832f331065f888cab53645bdadc86449b38ce1a" - integrity sha512-vZPa8kyo8ThEme/67HO6XzHHhvc4pGOLexNrtsS9EK+QBww1EgrwM42mAkKYZmlgbLCoCKCvzQI/CK1URqw5zg== - dependencies: - "@ethereumjs/util" "^8.1.0" - "@metamask/base-controller" "^6.0.3" - "@metamask/eth-snap-keyring" "^4.3.1" - "@metamask/keyring-api" "^8.1.0" - "@metamask/snaps-sdk" "^6.1.1" - "@metamask/snaps-utils" "^7.8.1" - "@metamask/utils" "^9.1.0" - deepmerge "^4.2.2" - ethereum-cryptography "^2.1.2" - immer "^9.0.6" - uuid "^8.3.2" - -"@metamask/accounts-controller@^18.2.0": +"@metamask/accounts-controller@^14.0.0", "@metamask/accounts-controller@^17.2.0", "@metamask/accounts-controller@^18.1.0", "@metamask/accounts-controller@^18.2.0": version "18.2.0" resolved "https://registry.yarnpkg.com/@metamask/accounts-controller/-/accounts-controller-18.2.0.tgz#b3131b9231f30ffc29eb010a5b964409aa0942f5" integrity sha512-rIyFIBNrTwdyMVawXORdFON6poP2TRB5BAKgRdIJvtw4DsPtusEb8iZT3o6O4J48vmFsRgDTpDiTG29UvGHnHg== @@ -4066,7 +4049,7 @@ "@metamask/utils" "^8.3.0" immer "^9.0.6" -"@metamask/base-controller@^6.0.0", "@metamask/base-controller@^6.0.2", "@metamask/base-controller@^6.0.3": +"@metamask/base-controller@^6.0.0", "@metamask/base-controller@^6.0.2": version "6.0.3" resolved "https://registry.yarnpkg.com/@metamask/base-controller/-/base-controller-6.0.3.tgz#9bb4e74234c1de5f99842c343ffa053c08055db1" integrity sha512-neUqsCXRT6QYcZO51y6Y5u9NPTHuxgNsW5Z4h///o1gDdV8lBeIG/b1ne+QPK422DZMAm4ChnkG1DDNf4PkErw== @@ -4131,22 +4114,7 @@ eth-ens-namehash "^2.0.8" fast-deep-equal "^3.1.3" -"@metamask/controller-utils@^11.0.0", "@metamask/controller-utils@^11.0.2": - version "11.0.2" - resolved "https://registry.yarnpkg.com/@metamask/controller-utils/-/controller-utils-11.0.2.tgz#4da5ef150c8bb2d2ccec2f422afa839749aeb5f0" - integrity sha512-d9iqDwEIWhlDFJ1So70MfQEG95cWKSQ1MP0NZqo/ho5++/MI+/5k3yyxMY9uVMKBNBxvqlcYX1cvjyUhPDIx/w== - dependencies: - "@ethereumjs/util" "^8.1.0" - "@metamask/eth-query" "^4.0.0" - "@metamask/ethjs-unit" "^0.3.0" - "@metamask/utils" "^9.1.0" - "@spruceid/siwe-parser" "2.1.0" - "@types/bn.js" "^5.1.5" - bn.js "^5.2.1" - eth-ens-namehash "^2.0.8" - fast-deep-equal "^3.1.3" - -"@metamask/controller-utils@^11.2.0": +"@metamask/controller-utils@^11.0.0", "@metamask/controller-utils@^11.0.2", "@metamask/controller-utils@^11.2.0": version "11.2.0" resolved "https://registry.yarnpkg.com/@metamask/controller-utils/-/controller-utils-11.2.0.tgz#d0acb37e3b8a50d19a460e268845ee074df252d7" integrity sha512-37ITJ87Jm/G+0FBztA3dow9yKlCpCgRz8oiJ2fMpJTaotPsDCveRNKMgmk2uVa/J90bgYF4bUvi265f+rlZkGQ== From 6e2b5b59a8677ca9e9a65bcc8bac68d2fd53c80d Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Fri, 13 Sep 2024 12:35:47 +0200 Subject: [PATCH 06/49] fix: remove Gemfile.lock --- ios/Gemfile.lock | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 ios/Gemfile.lock diff --git a/ios/Gemfile.lock b/ios/Gemfile.lock deleted file mode 100644 index 0db5d06c5d0..00000000000 --- a/ios/Gemfile.lock +++ /dev/null @@ -1,12 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - -PLATFORMS - arm64-darwin-23 - ruby - -DEPENDENCIES - -BUNDLED WITH - 2.5.8 From 888f01d4fa5c48e94f27c72254f2307d4a1610e8 Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Fri, 13 Sep 2024 12:51:10 +0200 Subject: [PATCH 07/49] fix: add @ts-expect-error for controller version mismatch --- app/core/Engine.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/core/Engine.ts b/app/core/Engine.ts index ec423aaeb58..806b0109e70 100644 --- a/app/core/Engine.ts +++ b/app/core/Engine.ts @@ -581,6 +581,8 @@ class Engine { }), state: initialState.LoggingController, }); + + // @ts-expect-error TODO: Resolve mismatch between base-controller versions. const accountsControllerMessenger: AccountsControllerMessenger = this.controllerMessenger.getRestricted({ name: 'AccountsController', From b9bb37af2eb70f526a91ab72537ffa33ae4eaadc Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Fri, 13 Sep 2024 13:16:46 +0200 Subject: [PATCH 08/49] fix: remove unused import --- app/util/notifications/hooks/useProfileSyncing.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/util/notifications/hooks/useProfileSyncing.ts b/app/util/notifications/hooks/useProfileSyncing.ts index 332ade6e3a8..f75678b6893 100644 --- a/app/util/notifications/hooks/useProfileSyncing.ts +++ b/app/util/notifications/hooks/useProfileSyncing.ts @@ -1,5 +1,5 @@ /* eslint-disable import/prefer-default-export */ -import { useState, useCallback, useEffect } from 'react'; +import { useState, useCallback } from 'react'; import { ProfileSyncingReturn } from './types'; import { getErrorMessage } from '../../../util/errorHandling'; import { From 6c9b2cef4d034f3a4f8e49596f2f7509f5a0e8e3 Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Fri, 13 Sep 2024 14:25:57 +0200 Subject: [PATCH 09/49] feat: group profile-sync effects under a layout effect + AppState change event --- app/components/Views/Wallet/index.tsx | 45 ++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/app/components/Views/Wallet/index.tsx b/app/components/Views/Wallet/index.tsx index 619fd546c0a..e5620a5022a 100644 --- a/app/components/Views/Wallet/index.tsx +++ b/app/components/Views/Wallet/index.tsx @@ -1,4 +1,10 @@ -import React, { useEffect, useRef, useCallback, useContext } from 'react'; +import React, { + useEffect, + useRef, + useCallback, + useContext, + useLayoutEffect, +} from 'react'; import { ActivityIndicator, StyleSheet, @@ -6,6 +12,8 @@ import { TextStyle, InteractionManager, Linking, + AppState, + AppStateStatus, } from 'react-native'; import type { Theme } from '@metamask/design-tokens'; import { connect, useDispatch, useSelector } from 'react-redux'; @@ -148,6 +156,7 @@ const Wallet = ({ showNftFetchingLoadingIndicator, hideNftFetchingLoadingIndicator, }: WalletProps) => { + const appState = useRef(AppState.currentState); const { navigate } = useNavigation(); const { listNotifications } = useListNotifications(); const { dispatchAccountSyncing } = useAccountSyncing(); @@ -406,13 +415,35 @@ const Wallet = ({ updateNotifications(); }, [listNotifications]); - // Effect - dispatch account syncing - useEffect(() => { - if (currentRouteName !== 'Wallet') { - return; - } + // Layout effect when component/view is visible + // - fetches notifications + // - dispatches account syncing + useLayoutEffect(() => { + const handleAppStateChange = (nextAppState: AppStateStatus) => { + if ( + appState.current.match(/inactive|background/) && + nextAppState === 'active' + ) { + listNotifications(); + dispatchAccountSyncing(); + } + + appState.current = nextAppState; + }; + + const subscription = AppState.addEventListener( + 'change', + handleAppStateChange, + ); + + listNotifications(); dispatchAccountSyncing(); - }, [dispatchAccountSyncing, currentRouteName]); + + return () => { + subscription.remove(); + }; + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); useEffect(() => { navigation.setOptions( From 80af81c523bcc1af55f1edfa87ab5f8b2c0f2fb0 Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Fri, 13 Sep 2024 17:18:53 +0200 Subject: [PATCH 10/49] add layouteffect deps --- app/components/Views/Wallet/index.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/components/Views/Wallet/index.tsx b/app/components/Views/Wallet/index.tsx index e5620a5022a..e7d0d01f6a7 100644 --- a/app/components/Views/Wallet/index.tsx +++ b/app/components/Views/Wallet/index.tsx @@ -442,8 +442,7 @@ const Wallet = ({ return () => { subscription.remove(); }; - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); + }, [listNotifications, dispatchAccountSyncing]); useEffect(() => { navigation.setOptions( From c8e8e91bd2a3371c0238b7ebd23093301d6252d2 Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Mon, 16 Sep 2024 16:40:38 +0200 Subject: [PATCH 11/49] chore: remove preview packages and use latest deps --- package.json | 7 +- yarn.lock | 285 +++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 255 insertions(+), 37 deletions(-) diff --git a/package.json b/package.json index e3da56a2e2c..3ee59bfc27c 100644 --- a/package.json +++ b/package.json @@ -118,7 +118,6 @@ "**/xml2js": ">=0.5.0", "react-native-level-fs/**/bl": "^1.2.3", "react-native-level-fs/levelup/semver": "^5.7.2", - "@metamask/accounts-controller": "^18.1.0", "@metamask/contract-metadata": "^2.1.0", "@metamask/react-native-payments/validator": "^13.7.0", "**/minimist": "1.2.6", @@ -149,7 +148,7 @@ "@keystonehq/metamask-airgapped-keyring": "^0.13.1", "@keystonehq/ur-decoder": "^0.12.2", "@ledgerhq/react-native-hw-transport-ble": "^6.33.2", - "@metamask/accounts-controller": "^18.2.0", + "@metamask/accounts-controller": "^18.2.1", "@metamask/address-book-controller": "^4.0.1", "@metamask/approval-controller": "^7.0.1", "@metamask/assets-controllers": "^30.0.0", @@ -165,7 +164,7 @@ "@metamask/gas-fee-controller": "^18.0.0", "@metamask/key-tree": "^9.0.0", "@metamask/keyring-api": "^8.1.0", - "@metamask/keyring-controller": "^17.2.0", + "@metamask/keyring-controller": "^17.2.1", "@metamask/logging-controller": "^3.0.0", "@metamask/message-signing-snap": "^0.3.3", "@metamask/network-controller": "^19.0.0", @@ -175,7 +174,7 @@ "@metamask/post-message-stream": "^8.0.0", "@metamask/ppom-validator": "0.32.0", "@metamask/preferences-controller": "^11.0.0", - "@metamask/profile-sync-controller": "npm:@metamask-previews/profile-sync-controller@0.5.0-preview-c1e764d", + "@metamask/profile-sync-controller": "^0.6.0", "@metamask/react-native-actionsheet": "2.4.2", "@metamask/react-native-button": "^3.0.0", "@metamask/react-native-payments": "^2.0.0", diff --git a/yarn.lock b/yarn.lock index 85930bc0fc0..e034a29f691 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3945,17 +3945,60 @@ "@metamask/utils" "^8.0.0" superstruct "^1.0.3" -"@metamask/accounts-controller@^14.0.0", "@metamask/accounts-controller@^17.2.0", "@metamask/accounts-controller@^18.1.0", "@metamask/accounts-controller@^18.2.0": - version "18.2.0" - resolved "https://registry.yarnpkg.com/@metamask/accounts-controller/-/accounts-controller-18.2.0.tgz#b3131b9231f30ffc29eb010a5b964409aa0942f5" - integrity sha512-rIyFIBNrTwdyMVawXORdFON6poP2TRB5BAKgRdIJvtw4DsPtusEb8iZT3o6O4J48vmFsRgDTpDiTG29UvGHnHg== +"@metamask/abi-utils@^2.0.4": + version "2.0.4" + resolved "https://registry.yarnpkg.com/@metamask/abi-utils/-/abi-utils-2.0.4.tgz#20908c1d910f7a17a89fdf5778a5c59d5cb8b8be" + integrity sha512-StnIgUB75x7a7AgUhiaUZDpCsqGp7VkNnZh2XivXkJ6mPkE83U8ARGQj5MbRis7VJY8BC5V1AbB1fjdh0hupPQ== + dependencies: + "@metamask/superstruct" "^3.1.0" + "@metamask/utils" "^9.0.0" + +"@metamask/accounts-controller@^14.0.0": + version "14.0.0" + resolved "https://registry.yarnpkg.com/@metamask/accounts-controller/-/accounts-controller-14.0.0.tgz#aea6004b66ff02f30eea2d1ed77a9820c1f0a6d2" + integrity sha512-vI79c/Va8ziso7LQnF2du411AQUXAfO2JwhNxGVBo3EHSKPAX0v0WTz+GF/1sTUIIuCuDaOsemH1kBj5nA+rwg== + dependencies: + "@ethereumjs/util" "^8.1.0" + "@metamask/base-controller" "^5.0.2" + "@metamask/eth-snap-keyring" "^4.0.0" + "@metamask/keyring-api" "^6.0.0" + "@metamask/snaps-sdk" "^4.0.1" + "@metamask/snaps-utils" "^7.1.0" + "@metamask/utils" "^8.3.0" + deepmerge "^4.2.2" + ethereum-cryptography "^2.1.2" + immer "^9.0.6" + uuid "^8.3.2" + +"@metamask/accounts-controller@^17.2.0": + version "17.2.0" + resolved "https://registry.yarnpkg.com/@metamask/accounts-controller/-/accounts-controller-17.2.0.tgz#b74918444a9d8e6e69b9b761dc58e64aac6b466c" + integrity sha512-hfdfRV7mxxnyG1tri3CatV63WWtwPkUSl0zTz7Mq3psSXqOFr+08f1Elw4sX7pP1V/rCxZKeotoluIjUeu1Q9Q== dependencies: "@ethereumjs/util" "^8.1.0" - "@metamask/base-controller" "^7.0.0" + "@metamask/base-controller" "^6.0.0" "@metamask/eth-snap-keyring" "^4.3.1" + "@metamask/keyring-api" "^8.0.0" + "@metamask/keyring-controller" "^17.1.0" + "@metamask/snaps-sdk" "^4.2.0" + "@metamask/snaps-utils" "^7.4.0" + "@metamask/utils" "^8.3.0" + deepmerge "^4.2.2" + ethereum-cryptography "^2.1.2" + immer "^9.0.6" + uuid "^8.3.2" + +"@metamask/accounts-controller@^18.2.1": + version "18.2.1" + resolved "https://registry.yarnpkg.com/@metamask/accounts-controller/-/accounts-controller-18.2.1.tgz#8e4a842316e9b7bbd0409b36129f7123ba4a4c79" + integrity sha512-BEvux+ZFpTOQa6HbRl7i7Tq24ztqrZIsX+H0ePh47lU+N8RWq1q0JCItV+zbsgdcYnwhtcMZTsp4jJPQwPe2og== + dependencies: + "@ethereumjs/util" "^8.1.0" + "@metamask/base-controller" "^7.0.1" + "@metamask/eth-snap-keyring" "^4.3.3" "@metamask/keyring-api" "^8.1.0" - "@metamask/snaps-sdk" "^6.1.1" - "@metamask/snaps-utils" "^7.8.1" + "@metamask/snaps-sdk" "^6.5.0" + "@metamask/snaps-utils" "^8.1.1" "@metamask/utils" "^9.1.0" deepmerge "^4.2.2" ethereum-cryptography "^2.1.2" @@ -4057,10 +4100,10 @@ "@metamask/utils" "^9.1.0" immer "^9.0.6" -"@metamask/base-controller@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@metamask/base-controller/-/base-controller-7.0.0.tgz#c6eedac9692d65222d7715e048b1b6f74af07b12" - integrity sha512-/wFqfXe/caAWvsHcSNJOTQdUPL7HJeM15d/7IzTI/Jpd1aaO4u/CVY5dPxnBXjhSVtQGQZC6jIGlWim5GluoUw== +"@metamask/base-controller@^7.0.1": + version "7.0.1" + resolved "https://registry.yarnpkg.com/@metamask/base-controller/-/base-controller-7.0.1.tgz#78eef77c2cd980e1f86bd5077c229bbaa5fd2b9d" + integrity sha512-U1strOKT4v/kSJ2h4tgn9iUVVuv5Ja64J+OR145ITHd4574FaUYVJR80/imn6WmCbo8B6AYwHwEovdZ5qLGSKw== dependencies: "@metamask/utils" "^9.1.0" immer "^9.0.6" @@ -4114,7 +4157,7 @@ eth-ens-namehash "^2.0.8" fast-deep-equal "^3.1.3" -"@metamask/controller-utils@^11.0.0", "@metamask/controller-utils@^11.0.2", "@metamask/controller-utils@^11.2.0": +"@metamask/controller-utils@^11.0.0", "@metamask/controller-utils@^11.0.2": version "11.2.0" resolved "https://registry.yarnpkg.com/@metamask/controller-utils/-/controller-utils-11.2.0.tgz#d0acb37e3b8a50d19a460e268845ee074df252d7" integrity sha512-37ITJ87Jm/G+0FBztA3dow9yKlCpCgRz8oiJ2fMpJTaotPsDCveRNKMgmk2uVa/J90bgYF4bUvi265f+rlZkGQ== @@ -4129,6 +4172,21 @@ eth-ens-namehash "^2.0.8" fast-deep-equal "^3.1.3" +"@metamask/controller-utils@^11.3.0": + version "11.3.0" + resolved "https://registry.yarnpkg.com/@metamask/controller-utils/-/controller-utils-11.3.0.tgz#530fd22289f717b752b4a7b6e504e1f2911b30a4" + integrity sha512-5b+Jg9sKKESzvQcuipHC1D7KSh98MVIi7hXQUk7iX+YVMl4KoKDv94Bl+li8g+jCBshMOV9bRMRh25/hdEvTZQ== + dependencies: + "@ethereumjs/util" "^8.1.0" + "@metamask/eth-query" "^4.0.0" + "@metamask/ethjs-unit" "^0.3.0" + "@metamask/utils" "^9.1.0" + "@spruceid/siwe-parser" "2.1.0" + "@types/bn.js" "^5.1.5" + bn.js "^5.2.1" + eth-ens-namehash "^2.0.8" + fast-deep-equal "^3.1.3" + "@metamask/controller-utils@^8.0.1", "@metamask/controller-utils@^8.0.2", "@metamask/controller-utils@^8.0.4": version "8.0.4" resolved "https://registry.yarnpkg.com/@metamask/controller-utils/-/controller-utils-8.0.4.tgz#78a952301ff4b2a501b31865ab0de434c6ea3cd2" @@ -4290,6 +4348,18 @@ ethereum-cryptography "^2.1.2" tweetnacl "^1.0.3" +"@metamask/eth-sig-util@^7.0.3": + version "7.0.3" + resolved "https://registry.yarnpkg.com/@metamask/eth-sig-util/-/eth-sig-util-7.0.3.tgz#be9e444fe0b8474c04e2ff42fd983173767f6ac0" + integrity sha512-PAtGnOkYvh90k2lEZldq/FK7GTLF6WxE+2bV85PoA3pqlJnmJCAY62tuvxHSwnVngSKlc4mcNvjnUg2eYO6JGg== + dependencies: + "@ethereumjs/util" "^8.1.0" + "@metamask/abi-utils" "^2.0.4" + "@metamask/utils" "^9.0.0" + "@scure/base" "~1.1.3" + ethereum-cryptography "^2.1.2" + tweetnacl "^1.0.3" + "@metamask/eth-simple-keyring@^6.0.1": version "6.0.1" resolved "https://registry.yarnpkg.com/@metamask/eth-simple-keyring/-/eth-simple-keyring-6.0.1.tgz#2c914c51746aba3588530a256842ce0436481ab5" @@ -4301,6 +4371,22 @@ ethereum-cryptography "^2.1.2" randombytes "^2.1.0" +"@metamask/eth-snap-keyring@^4.0.0", "@metamask/eth-snap-keyring@^4.3.3": + version "4.3.3" + resolved "https://registry.yarnpkg.com/@metamask/eth-snap-keyring/-/eth-snap-keyring-4.3.3.tgz#98004e45fd876748ed71edd0b299f9f5105e45af" + integrity sha512-+u4qyuuYFqCn7Qs+mA1CwCdQm/3vKlG/FKMMgN2G1u3Dv5Y257pUlZ588OEpCuqHhqGzLUv/a7qv1KtjFrjW8w== + dependencies: + "@ethereumjs/tx" "^4.2.0" + "@metamask/eth-sig-util" "^7.0.3" + "@metamask/keyring-api" "^8.1.0" + "@metamask/snaps-controllers" "^9.6.0" + "@metamask/snaps-sdk" "^6.4.0" + "@metamask/snaps-utils" "^7.8.0" + "@metamask/superstruct" "^3.1.0" + "@metamask/utils" "^9.2.1" + "@types/uuid" "^9.0.1" + uuid "^9.0.0" + "@metamask/eth-snap-keyring@^4.3.1": version "4.3.1" resolved "https://registry.yarnpkg.com/@metamask/eth-snap-keyring/-/eth-snap-keyring-4.3.1.tgz#f597c7059f499b3cb72ef73b89949231c567d432" @@ -4541,20 +4627,20 @@ ethereumjs-wallet "^1.0.1" immer "^9.0.6" -"@metamask/keyring-controller@^17.2.0": - version "17.2.0" - resolved "https://registry.yarnpkg.com/@metamask/keyring-controller/-/keyring-controller-17.2.0.tgz#19125e50ad969fad253d4ed0f52d724a2c10ac43" - integrity sha512-tVnsLG4FbwqeAXCQj04CFcQ5hWfPDcxzU9kI1X/O5M0zwzjf9dFTOH/v09Fg9L/lnB40aTFoNHLdcW4Cxc9tMQ== +"@metamask/keyring-controller@^17.1.0", "@metamask/keyring-controller@^17.2.1": + version "17.2.1" + resolved "https://registry.yarnpkg.com/@metamask/keyring-controller/-/keyring-controller-17.2.1.tgz#3625650e18b80af3f9a1227fc7ca106adf77f5f3" + integrity sha512-9GDrP3jK5uM5e1mX/qHkvjuByAtkf7ZiJoeYRE5OIo0OAYFwMAeFw2JlIdWB+BR6CT8C0KEXo+Ne/5ZTn+HCqA== dependencies: "@ethereumjs/util" "^8.1.0" "@keystonehq/metamask-airgapped-keyring" "^0.14.1" - "@metamask/base-controller" "^7.0.0" + "@metamask/base-controller" "^7.0.1" "@metamask/browser-passworder" "^4.3.0" "@metamask/eth-hd-keyring" "^7.0.1" "@metamask/eth-sig-util" "^7.0.1" "@metamask/eth-simple-keyring" "^6.0.1" "@metamask/keyring-api" "^8.1.0" - "@metamask/message-manager" "^10.0.3" + "@metamask/message-manager" "^10.1.1" "@metamask/utils" "^9.1.0" async-mutex "^0.5.0" ethereumjs-wallet "^1.0.1" @@ -4569,13 +4655,13 @@ "@metamask/controller-utils" "^9.0.1" uuid "^8.3.2" -"@metamask/message-manager@^10.0.3": - version "10.1.0" - resolved "https://registry.yarnpkg.com/@metamask/message-manager/-/message-manager-10.1.0.tgz#ff38f3795f7612f14254cea4eb3c799c01545164" - integrity sha512-NuVOvPrQTH7i8248m/zY2eN8jVEFyXQDmEmCOytpQKdkifWqk9i4cvyE9ecKJSHuJDmPz4fj85VXu1uJYOQVKw== +"@metamask/message-manager@^10.1.1": + version "10.1.1" + resolved "https://registry.yarnpkg.com/@metamask/message-manager/-/message-manager-10.1.1.tgz#390acc4dff9f7c72aaf5c183397c872e53ae7f12" + integrity sha512-VFFqEPKOyo59P79CP/vlPDpMng1a1mMHIaXuvEJYTOf/UOqeVpw77G5IHVfjuG+tZNlAQIHYp7sEmPkob+rzcA== dependencies: - "@metamask/base-controller" "^7.0.0" - "@metamask/controller-utils" "^11.2.0" + "@metamask/base-controller" "^7.0.1" + "@metamask/controller-utils" "^11.3.0" "@metamask/eth-sig-util" "^7.0.1" "@metamask/utils" "^9.1.0" "@types/uuid" "^8.3.0" @@ -4819,6 +4905,20 @@ fastest-levenshtein "^1.0.16" punycode "^2.1.1" +"@metamask/phishing-controller@^12.0.2": + version "12.0.3" + resolved "https://registry.yarnpkg.com/@metamask/phishing-controller/-/phishing-controller-12.0.3.tgz#f1a5a2046e4c7a04613b4c41bc19771cf8235db7" + integrity sha512-CR1qN2FkMJp+MyNSXVTvrZY7MjCdkvsofW/kyv6oshPtLV6BGBWFyueS2UgjMNsmQDW/vMXUJMZfcMS6rs3S4w== + dependencies: + "@metamask/base-controller" "^7.0.1" + "@metamask/controller-utils" "^11.3.0" + "@noble/hashes" "^1.4.0" + "@types/punycode" "^2.1.0" + eth-phishing-detect "^1.2.0" + ethereum-cryptography "^2.1.2" + fastest-levenshtein "^1.0.16" + punycode "^2.1.1" + "@metamask/phishing-controller@^9.0.0", "@metamask/phishing-controller@^9.0.1": version "9.0.2" resolved "https://registry.yarnpkg.com/@metamask/phishing-controller/-/phishing-controller-9.0.2.tgz#d140b6a8a05947c59b04bf161a0d9055e6b711b2" @@ -4890,6 +4990,14 @@ "@metamask/utils" "^8.1.0" readable-stream "3.6.2" +"@metamask/post-message-stream@^8.1.1": + version "8.1.1" + resolved "https://registry.yarnpkg.com/@metamask/post-message-stream/-/post-message-stream-8.1.1.tgz#fd8f4c2363921aaf15c0fa56d087fa9f2d93f047" + integrity sha512-Z5LHqE8MI0g9xKT7dOr4G11Qjf2bWg9rFonpFnUJwxJvfIl6KuGVnfOTo7PVXH3zdlWotlhhC2F65QW9WxVSPQ== + dependencies: + "@metamask/utils" "^9.0.0" + readable-stream "3.6.2" + "@metamask/ppom-validator@0.32.0": version "0.32.0" resolved "https://registry.yarnpkg.com/@metamask/ppom-validator/-/ppom-validator-0.32.0.tgz#e732cd946605c3abb0e11f175013dab879166004" @@ -4913,14 +5021,14 @@ "@metamask/base-controller" "^5.0.2" "@metamask/controller-utils" "^9.1.0" -"@metamask/profile-sync-controller@npm:@metamask-previews/profile-sync-controller@0.5.0-preview-c1e764d": - version "0.5.0-preview-c1e764d" - resolved "https://registry.yarnpkg.com/@metamask-previews/profile-sync-controller/-/profile-sync-controller-0.5.0-preview-c1e764d.tgz#8517426846ce23600a9f68ea968f03bfb428c6e7" - integrity sha512-YXe3F8/FbPBGNXflrezgiBSqszIsQzJtLIX1PmBlL4lMbDp06PXzWkf7C558oMu5fykepVSkELlwzw10djWzhg== +"@metamask/profile-sync-controller@^0.6.0": + version "0.6.0" + resolved "https://registry.yarnpkg.com/@metamask/profile-sync-controller/-/profile-sync-controller-0.6.0.tgz#47cf71d3fdf9b0eca7712ab231e0174658787835" + integrity sha512-L1dIvghOQKRbZLY99NQ4+pYR71o3514AdJaBKP9iybySYZ36qAbg2hohz7+6k62nzLSPFHbflX/bDMbg9lkKPQ== dependencies: - "@metamask/base-controller" "^7.0.0" - "@metamask/snaps-sdk" "^6.1.1" - "@metamask/snaps-utils" "^7.8.1" + "@metamask/base-controller" "^7.0.1" + "@metamask/snaps-sdk" "^6.5.0" + "@metamask/snaps-utils" "^8.1.1" "@noble/ciphers" "^0.5.2" "@noble/hashes" "^1.4.0" immer "^9.0.6" @@ -5173,6 +5281,36 @@ readable-web-to-node-stream "^3.0.2" tar-stream "^3.1.7" +"@metamask/snaps-controllers@^9.6.0": + version "9.7.0" + resolved "https://registry.yarnpkg.com/@metamask/snaps-controllers/-/snaps-controllers-9.7.0.tgz#3c1ef4fd88e63df893710e4788b5290c231c2919" + integrity sha512-/hvun7vPWERYTTi48TSVxZ3W0rjg/+XAC9+2RBEx7HvMteoKUpP3tmYEq2W+x5bkdALQ15iDAE1Hi8OF1usCrg== + dependencies: + "@metamask/approval-controller" "^7.0.2" + "@metamask/base-controller" "^6.0.2" + "@metamask/json-rpc-engine" "^9.0.2" + "@metamask/json-rpc-middleware-stream" "^8.0.2" + "@metamask/object-multiplex" "^2.0.0" + "@metamask/permission-controller" "^11.0.0" + "@metamask/phishing-controller" "^12.0.2" + "@metamask/post-message-stream" "^8.1.1" + "@metamask/rpc-errors" "^6.3.1" + "@metamask/snaps-registry" "^3.2.1" + "@metamask/snaps-rpc-methods" "^11.1.1" + "@metamask/snaps-sdk" "^6.5.0" + "@metamask/snaps-utils" "^8.1.1" + "@metamask/utils" "^9.2.1" + "@xstate/fsm" "^2.0.0" + browserify-zlib "^0.2.0" + concat-stream "^2.0.0" + fast-deep-equal "^3.1.3" + get-npm-tarball-url "^2.0.3" + immer "^9.0.6" + nanoid "^3.1.31" + readable-stream "^3.6.2" + readable-web-to-node-stream "^3.0.2" + tar-stream "^3.1.7" + "@metamask/snaps-execution-environments@^6.6.2": version "6.6.2" resolved "https://registry.yarnpkg.com/@metamask/snaps-execution-environments/-/snaps-execution-environments-6.6.2.tgz#bfc50fbcc861d6f73ec09956b6e2cee90e25b5e3" @@ -5214,6 +5352,20 @@ "@metamask/utils" "^9.1.0" "@noble/hashes" "^1.3.1" +"@metamask/snaps-rpc-methods@^11.1.1": + version "11.1.1" + resolved "https://registry.yarnpkg.com/@metamask/snaps-rpc-methods/-/snaps-rpc-methods-11.1.1.tgz#d01a82cb1d8af60ade5f3d3da3adf8a275beda48" + integrity sha512-j4oJyMSBLTLg0RA28wgsCjdbC/YZUyRB/U6/tLCsaGXDKIPnOR17yjyeOx/IKLQR91ZC2+y4dMkgFbyOVSDI3Q== + dependencies: + "@metamask/key-tree" "^9.1.2" + "@metamask/permission-controller" "^11.0.0" + "@metamask/rpc-errors" "^6.3.1" + "@metamask/snaps-sdk" "^6.5.0" + "@metamask/snaps-utils" "^8.1.1" + "@metamask/superstruct" "^3.1.0" + "@metamask/utils" "^9.2.1" + "@noble/hashes" "^1.3.1" + "@metamask/snaps-rpc-methods@^9.1.2", "@metamask/snaps-rpc-methods@^9.1.4": version "9.1.4" resolved "https://registry.yarnpkg.com/@metamask/snaps-rpc-methods/-/snaps-rpc-methods-9.1.4.tgz#d0aa695b89326eece7b23d188d8dce7d35a78d9c" @@ -5240,6 +5392,18 @@ fast-xml-parser "^4.3.4" superstruct "^1.0.3" +"@metamask/snaps-sdk@^4.0.1": + version "4.4.2" + resolved "https://registry.yarnpkg.com/@metamask/snaps-sdk/-/snaps-sdk-4.4.2.tgz#6d7654ca3ecbcda5cd8689f49721c084241a4495" + integrity sha512-V6d1kQdkCTYQ7Z3+ZVnMWjwsS2TRaKNnSRtSHgjATdSacW5d/1td2KbTs+1x1/cSe58ULKW1SBwRNy0i0c95hA== + dependencies: + "@metamask/key-tree" "^9.1.1" + "@metamask/providers" "^17.0.0" + "@metamask/rpc-errors" "^6.2.1" + "@metamask/utils" "^8.3.0" + fast-xml-parser "^4.3.4" + superstruct "^1.0.3" + "@metamask/snaps-sdk@^4.2.0", "@metamask/snaps-sdk@^4.4.1": version "4.4.1" resolved "https://registry.yarnpkg.com/@metamask/snaps-sdk/-/snaps-sdk-4.4.1.tgz#90603a6c83eeb27334e7192a77e7abd6a01d1f53" @@ -5252,7 +5416,7 @@ fast-xml-parser "^4.3.4" superstruct "^1.0.3" -"@metamask/snaps-sdk@^6.0.0", "@metamask/snaps-sdk@^6.1.0", "@metamask/snaps-sdk@^6.1.1", "@metamask/snaps-sdk@^6.2.0", "@metamask/snaps-sdk@^6.2.1": +"@metamask/snaps-sdk@^6.0.0", "@metamask/snaps-sdk@^6.1.0", "@metamask/snaps-sdk@^6.2.0", "@metamask/snaps-sdk@^6.2.1": version "6.2.1" resolved "https://registry.yarnpkg.com/@metamask/snaps-sdk/-/snaps-sdk-6.2.1.tgz#6bb59133326d36786d5ca14de136da577fae1c83" integrity sha512-apjtC9o+XLjShKntIbiHD+XIuQIGAa/+uIRkzKa2Lm3ADNi04VtkPl8VBfDiY4MSIArjQgj9EIk+rK6aW8H5oA== @@ -5263,7 +5427,18 @@ "@metamask/superstruct" "^3.1.0" "@metamask/utils" "^9.1.0" -"@metamask/snaps-utils@^7.4.0", "@metamask/snaps-utils@^7.4.1", "@metamask/snaps-utils@^7.7.0", "@metamask/snaps-utils@^7.8.1": +"@metamask/snaps-sdk@^6.4.0", "@metamask/snaps-sdk@^6.5.0": + version "6.5.0" + resolved "https://registry.yarnpkg.com/@metamask/snaps-sdk/-/snaps-sdk-6.5.0.tgz#e3c5f2c4723d0730e472ae6e65d9c98e7f320fde" + integrity sha512-MHNbCQ/4+HwIyWAHlrLbokoO3CGNTod696FGi3WjYHlKC/1fLE06q8jE/NzuixY11Q6wkShBBk2u7MBGLyLp0w== + dependencies: + "@metamask/key-tree" "^9.1.2" + "@metamask/providers" "^17.1.2" + "@metamask/rpc-errors" "^6.3.1" + "@metamask/superstruct" "^3.1.0" + "@metamask/utils" "^9.2.1" + +"@metamask/snaps-utils@^7.1.0", "@metamask/snaps-utils@^7.4.0", "@metamask/snaps-utils@^7.4.1", "@metamask/snaps-utils@^7.7.0", "@metamask/snaps-utils@^7.8.0", "@metamask/snaps-utils@^7.8.1": version "7.8.1" resolved "https://registry.yarnpkg.com/@metamask/snaps-utils/-/snaps-utils-7.8.1.tgz#d18f56ece8a1d4e9ff2e8e7645c3349cf08937bc" integrity sha512-v0xNoiWeJGHvtJqP0aU5dj+phqpV6vKCJoV5tNBXl8/AvMTaV2YL4SLO/z+PTo0RWZFplgAuuDsY254kAXi9Fw== @@ -5321,6 +5496,35 @@ ses "^1.1.0" validate-npm-package-name "^5.0.0" +"@metamask/snaps-utils@^8.1.1": + version "8.1.1" + resolved "https://registry.yarnpkg.com/@metamask/snaps-utils/-/snaps-utils-8.1.1.tgz#b32c403c0b5419dae3a22e4c6119099e9b3466ba" + integrity sha512-oKwm+0r2WIFinMo07RYAQVb2Khr/T+c8+V0m4iT9WfJHVNG8mHUMonH3ae2jksZ0/327na0mYVj804PLQ88SNA== + dependencies: + "@babel/core" "^7.23.2" + "@babel/types" "^7.23.0" + "@metamask/base-controller" "^6.0.2" + "@metamask/key-tree" "^9.1.2" + "@metamask/permission-controller" "^11.0.0" + "@metamask/rpc-errors" "^6.3.1" + "@metamask/slip44" "^4.0.0" + "@metamask/snaps-registry" "^3.2.1" + "@metamask/snaps-sdk" "^6.5.0" + "@metamask/superstruct" "^3.1.0" + "@metamask/utils" "^9.2.1" + "@noble/hashes" "^1.3.1" + "@scure/base" "^1.1.1" + chalk "^4.1.2" + cron-parser "^4.5.0" + fast-deep-equal "^3.1.3" + fast-json-stable-stringify "^2.1.0" + fast-xml-parser "^4.4.1" + marked "^12.0.1" + rfdc "^1.3.0" + semver "^7.5.4" + ses "^1.1.0" + validate-npm-package-name "^5.0.0" + "@metamask/superstruct@^3.1.0": version "3.1.0" resolved "https://registry.yarnpkg.com/@metamask/superstruct/-/superstruct-3.1.0.tgz#148f786a674fba3ac885c1093ab718515bf7f648" @@ -5453,6 +5657,21 @@ semver "^7.5.4" uuid "^9.0.1" +"@metamask/utils@^9.2.1": + version "9.2.1" + resolved "https://registry.yarnpkg.com/@metamask/utils/-/utils-9.2.1.tgz#d9f84706ff97e0c8d1bde5778549365b14269e81" + integrity sha512-/u663aUaB6+Xe75i3Mt/1cCljm41HDYIsna5oBrwGvgkY2zH7/9k9Zjd706cxoAbxN7QgLSVAReUiGnuxCuXrQ== + dependencies: + "@ethereumjs/tx" "^4.2.0" + "@metamask/superstruct" "^3.1.0" + "@noble/hashes" "^1.3.1" + "@scure/base" "^1.1.3" + "@types/debug" "^4.1.7" + debug "^4.3.4" + pony-cause "^2.1.10" + semver "^7.5.4" + uuid "^9.0.1" + "@native-html/css-processor@1.11.0": version "1.11.0" resolved "https://registry.yarnpkg.com/@native-html/css-processor/-/css-processor-1.11.0.tgz#27d02e5123b0849f4986d44060ba3f235a15f552" From c3a3cb62b2b40a8f80d671243af3753b9f3da844 Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Mon, 16 Sep 2024 19:29:34 +0200 Subject: [PATCH 12/49] fix: yarn.lock --- yarn.lock | 257 ++++-------------------------------------------------- 1 file changed, 15 insertions(+), 242 deletions(-) diff --git a/yarn.lock b/yarn.lock index e034a29f691..26a9891d84c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3937,15 +3937,7 @@ resolved "https://registry.yarnpkg.com/@mantine/hooks/-/hooks-7.8.0.tgz#fc32e07746689459c4b049dc581d1dbda5545686" integrity sha512-+70fkgjhVJeJ+nJqnburIM3UAsfvxat1Low9HMPobLbv64FIdB4Nzu5ct3qojNQ58r5sK01tg5UoFIJYslaVrg== -"@metamask/abi-utils@^2.0.2": - version "2.0.2" - resolved "https://registry.yarnpkg.com/@metamask/abi-utils/-/abi-utils-2.0.2.tgz#ad394e9cb8a95ac177cad942daadd88a246c0de8" - integrity sha512-B/A1dY/w4F/t6cDHUscklO6ovb/ztFsrsTXFd8QlqSByk/vyy+QbPE3VVpmmyI/7RX+PA1AJcvBdzCIz+r9dVQ== - dependencies: - "@metamask/utils" "^8.0.0" - superstruct "^1.0.3" - -"@metamask/abi-utils@^2.0.4": +"@metamask/abi-utils@^2.0.2", "@metamask/abi-utils@^2.0.4": version "2.0.4" resolved "https://registry.yarnpkg.com/@metamask/abi-utils/-/abi-utils-2.0.4.tgz#20908c1d910f7a17a89fdf5778a5c59d5cb8b8be" integrity sha512-StnIgUB75x7a7AgUhiaUZDpCsqGp7VkNnZh2XivXkJ6mPkE83U8ARGQj5MbRis7VJY8BC5V1AbB1fjdh0hupPQ== @@ -4157,22 +4149,7 @@ eth-ens-namehash "^2.0.8" fast-deep-equal "^3.1.3" -"@metamask/controller-utils@^11.0.0", "@metamask/controller-utils@^11.0.2": - version "11.2.0" - resolved "https://registry.yarnpkg.com/@metamask/controller-utils/-/controller-utils-11.2.0.tgz#d0acb37e3b8a50d19a460e268845ee074df252d7" - integrity sha512-37ITJ87Jm/G+0FBztA3dow9yKlCpCgRz8oiJ2fMpJTaotPsDCveRNKMgmk2uVa/J90bgYF4bUvi265f+rlZkGQ== - dependencies: - "@ethereumjs/util" "^8.1.0" - "@metamask/eth-query" "^4.0.0" - "@metamask/ethjs-unit" "^0.3.0" - "@metamask/utils" "^9.1.0" - "@spruceid/siwe-parser" "2.1.0" - "@types/bn.js" "^5.1.5" - bn.js "^5.2.1" - eth-ens-namehash "^2.0.8" - fast-deep-equal "^3.1.3" - -"@metamask/controller-utils@^11.3.0": +"@metamask/controller-utils@^11.0.0", "@metamask/controller-utils@^11.0.2", "@metamask/controller-utils@^11.3.0": version "11.3.0" resolved "https://registry.yarnpkg.com/@metamask/controller-utils/-/controller-utils-11.3.0.tgz#530fd22289f717b752b4a7b6e504e1f2911b30a4" integrity sha512-5b+Jg9sKKESzvQcuipHC1D7KSh98MVIi7hXQUk7iX+YVMl4KoKDv94Bl+li8g+jCBshMOV9bRMRh25/hdEvTZQ== @@ -4336,19 +4313,7 @@ json-rpc-random-id "^1.0.0" xtend "^4.0.1" -"@metamask/eth-sig-util@^7.0.0", "@metamask/eth-sig-util@^7.0.1", "@metamask/eth-sig-util@^7.0.2": - version "7.0.2" - resolved "https://registry.yarnpkg.com/@metamask/eth-sig-util/-/eth-sig-util-7.0.2.tgz#741de634b0d6ca96ce1ee3d064ac6a27756d8d21" - integrity sha512-DhTDMNEtED0ihIc4Tysm6qUJTvArCdgSTeeJWdo526W/cAk5mrSAvEYYgv8idAiBumDtcPWGimMTaB7MvY64bg== - dependencies: - "@ethereumjs/util" "^8.1.0" - "@metamask/abi-utils" "^2.0.2" - "@metamask/utils" "^8.1.0" - "@scure/base" "~1.1.3" - ethereum-cryptography "^2.1.2" - tweetnacl "^1.0.3" - -"@metamask/eth-sig-util@^7.0.3": +"@metamask/eth-sig-util@^7.0.0", "@metamask/eth-sig-util@^7.0.1", "@metamask/eth-sig-util@^7.0.2", "@metamask/eth-sig-util@^7.0.3": version "7.0.3" resolved "https://registry.yarnpkg.com/@metamask/eth-sig-util/-/eth-sig-util-7.0.3.tgz#be9e444fe0b8474c04e2ff42fd983173767f6ac0" integrity sha512-PAtGnOkYvh90k2lEZldq/FK7GTLF6WxE+2bV85PoA3pqlJnmJCAY62tuvxHSwnVngSKlc4mcNvjnUg2eYO6JGg== @@ -4371,7 +4336,7 @@ ethereum-cryptography "^2.1.2" randombytes "^2.1.0" -"@metamask/eth-snap-keyring@^4.0.0", "@metamask/eth-snap-keyring@^4.3.3": +"@metamask/eth-snap-keyring@^4.0.0", "@metamask/eth-snap-keyring@^4.3.1", "@metamask/eth-snap-keyring@^4.3.3": version "4.3.3" resolved "https://registry.yarnpkg.com/@metamask/eth-snap-keyring/-/eth-snap-keyring-4.3.3.tgz#98004e45fd876748ed71edd0b299f9f5105e45af" integrity sha512-+u4qyuuYFqCn7Qs+mA1CwCdQm/3vKlG/FKMMgN2G1u3Dv5Y257pUlZ588OEpCuqHhqGzLUv/a7qv1KtjFrjW8w== @@ -4387,22 +4352,6 @@ "@types/uuid" "^9.0.1" uuid "^9.0.0" -"@metamask/eth-snap-keyring@^4.3.1": - version "4.3.1" - resolved "https://registry.yarnpkg.com/@metamask/eth-snap-keyring/-/eth-snap-keyring-4.3.1.tgz#f597c7059f499b3cb72ef73b89949231c567d432" - integrity sha512-led5tGBeJUj4DdkMtbbjrbrFGQKKOWfWe7VZ1w99DYKqMv0v/RiJOoxPs8dT6ez7NS9J6SBaWO9i/ly3KMhECg== - dependencies: - "@ethereumjs/tx" "^4.2.0" - "@metamask/eth-sig-util" "^7.0.1" - "@metamask/keyring-api" "^8.0.0" - "@metamask/snaps-controllers" "^8.1.1" - "@metamask/snaps-sdk" "^4.2.0" - "@metamask/snaps-utils" "^7.4.0" - "@metamask/utils" "^8.4.0" - "@types/uuid" "^9.0.1" - superstruct "^1.0.3" - uuid "^9.0.0" - "@metamask/etherscan-link@^2.0.0": version "2.1.0" resolved "https://registry.yarnpkg.com/@metamask/etherscan-link/-/etherscan-link-2.1.0.tgz#c0be8e68445b7b83cf85bcc03a56cdf8e256c973" @@ -4878,33 +4827,6 @@ immer "^9.0.6" nanoid "^3.1.31" -"@metamask/permission-controller@^9.0.2": - version "9.1.1" - resolved "https://registry.yarnpkg.com/@metamask/permission-controller/-/permission-controller-9.1.1.tgz#de8c15438afa4ef65e419c20f358799924fc3f2c" - integrity sha512-h4EakReO5JFDZBIAjXXOiwaMGqrQvNp6/6kQfDYREvT+tIpjGD5JUaqgwBblLkPCLeip57hIqxeobPlgmCfATA== - dependencies: - "@metamask/base-controller" "^5.0.2" - "@metamask/controller-utils" "^10.0.0" - "@metamask/json-rpc-engine" "^8.0.2" - "@metamask/rpc-errors" "^6.2.1" - "@metamask/utils" "^8.3.0" - "@types/deep-freeze-strict" "^1.1.0" - deep-freeze-strict "^1.1.1" - immer "^9.0.6" - nanoid "^3.1.31" - -"@metamask/phishing-controller@^10.1.1": - version "10.1.1" - resolved "https://registry.yarnpkg.com/@metamask/phishing-controller/-/phishing-controller-10.1.1.tgz#3db238f2babd34e1b206122a12a8a09fa62c71a4" - integrity sha512-MDLzeCui5uhsY0nkJpdOtSyxq5zIyFfD2QsZG95QXHGyF1/xr3T6zljGQqdg7dCD2qZ4OWohLG5GbZK5K0nr8Q== - dependencies: - "@metamask/base-controller" "^6.0.2" - "@metamask/controller-utils" "^11.0.2" - "@types/punycode" "^2.1.0" - eth-phishing-detect "^1.2.0" - fastest-levenshtein "^1.0.16" - punycode "^2.1.1" - "@metamask/phishing-controller@^12.0.2": version "12.0.3" resolved "https://registry.yarnpkg.com/@metamask/phishing-controller/-/phishing-controller-12.0.3.tgz#f1a5a2046e4c7a04613b4c41bc19771cf8235db7" @@ -4919,7 +4841,7 @@ fastest-levenshtein "^1.0.16" punycode "^2.1.1" -"@metamask/phishing-controller@^9.0.0", "@metamask/phishing-controller@^9.0.1": +"@metamask/phishing-controller@^9.0.0": version "9.0.2" resolved "https://registry.yarnpkg.com/@metamask/phishing-controller/-/phishing-controller-9.0.2.tgz#d140b6a8a05947c59b04bf161a0d9055e6b711b2" integrity sha512-eZRbym8o7isHbu741GVztxD2rzKvNQvB+XbmAq6qJD6eMKSSYKC9r/nDaxzaVz9qO93XCE8WnvSUmJx4m8RtaA== @@ -4982,15 +4904,7 @@ fast-json-stable-stringify "^2.1.0" uuid "^8.3.2" -"@metamask/post-message-stream@^8.0.0", "@metamask/post-message-stream@^8.1.0": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@metamask/post-message-stream/-/post-message-stream-8.1.0.tgz#1139c6411b127b14a7fda43a95d1d33f4affef02" - integrity sha512-3qnep25SRFLg51wZCez1AqwL/ahJdjyOkAs8Wk0zZHUuTHZ4h0ZtehidX904cHx4QM3STWA1pTRI7ygtkzkN0Q== - dependencies: - "@metamask/utils" "^8.1.0" - readable-stream "3.6.2" - -"@metamask/post-message-stream@^8.1.1": +"@metamask/post-message-stream@^8.0.0", "@metamask/post-message-stream@^8.1.0", "@metamask/post-message-stream@^8.1.1": version "8.1.1" resolved "https://registry.yarnpkg.com/@metamask/post-message-stream/-/post-message-stream-8.1.1.tgz#fd8f4c2363921aaf15c0fa56d087fa9f2d93f047" integrity sha512-Z5LHqE8MI0g9xKT7dOr4G11Qjf2bWg9rFonpFnUJwxJvfIl6KuGVnfOTo7PVXH3zdlWotlhhC2F65QW9WxVSPQ== @@ -5221,67 +5135,7 @@ fast-json-patch "^3.1.0" lodash "^4.17.21" -"@metamask/snaps-controllers@^8.1.1": - version "8.3.1" - resolved "https://registry.yarnpkg.com/@metamask/snaps-controllers/-/snaps-controllers-8.3.1.tgz#a509a020aa4a2eac88ecc6ec84c6bc488282f143" - integrity sha512-kGyywksj7VyEuQXRKdFZBSAcTYPjr22J21FLhIBiiSlBI3lbHEqb/hr/q8b+m27iA1JGtTrvJL1JMpRFGQAOEA== - dependencies: - "@metamask/approval-controller" "^6.0.2" - "@metamask/base-controller" "^5.0.2" - "@metamask/json-rpc-engine" "^8.0.1" - "@metamask/json-rpc-middleware-stream" "^7.0.1" - "@metamask/object-multiplex" "^2.0.0" - "@metamask/permission-controller" "^9.0.2" - "@metamask/phishing-controller" "^9.0.1" - "@metamask/post-message-stream" "^8.1.0" - "@metamask/rpc-errors" "^6.2.1" - "@metamask/snaps-registry" "^3.1.0" - "@metamask/snaps-rpc-methods" "^9.1.2" - "@metamask/snaps-sdk" "^4.4.1" - "@metamask/snaps-utils" "^7.4.1" - "@metamask/utils" "^8.3.0" - "@xstate/fsm" "^2.0.0" - browserify-zlib "^0.2.0" - concat-stream "^2.0.0" - fast-deep-equal "^3.1.3" - get-npm-tarball-url "^2.0.3" - immer "^9.0.6" - nanoid "^3.1.31" - readable-stream "^3.6.2" - readable-web-to-node-stream "^3.0.2" - tar-stream "^3.1.7" - -"@metamask/snaps-controllers@^9.4.0": - version "9.4.0" - resolved "https://registry.yarnpkg.com/@metamask/snaps-controllers/-/snaps-controllers-9.4.0.tgz#5038d34b0ca1d90b91c784ee260aa4cd176d2b07" - integrity sha512-Lqwxu5ag5mh6clgPn+5CEo6zRnFTcy0qn8j8IBYgyNFv1jx5vvw1eLvNrUySDkUconV3q80Qsi9QhZqFnXRBRg== - dependencies: - "@metamask/approval-controller" "^7.0.2" - "@metamask/base-controller" "^6.0.2" - "@metamask/json-rpc-engine" "^9.0.2" - "@metamask/json-rpc-middleware-stream" "^8.0.2" - "@metamask/object-multiplex" "^2.0.0" - "@metamask/permission-controller" "^11.0.0" - "@metamask/phishing-controller" "^10.1.1" - "@metamask/post-message-stream" "^8.1.0" - "@metamask/rpc-errors" "^6.3.1" - "@metamask/snaps-registry" "^3.2.1" - "@metamask/snaps-rpc-methods" "^11.0.0" - "@metamask/snaps-sdk" "^6.2.0" - "@metamask/snaps-utils" "^8.0.0" - "@metamask/utils" "^9.1.0" - "@xstate/fsm" "^2.0.0" - browserify-zlib "^0.2.0" - concat-stream "^2.0.0" - fast-deep-equal "^3.1.3" - get-npm-tarball-url "^2.0.3" - immer "^9.0.6" - nanoid "^3.1.31" - readable-stream "^3.6.2" - readable-web-to-node-stream "^3.0.2" - tar-stream "^3.1.7" - -"@metamask/snaps-controllers@^9.6.0": +"@metamask/snaps-controllers@^9.4.0", "@metamask/snaps-controllers@^9.6.0": version "9.7.0" resolved "https://registry.yarnpkg.com/@metamask/snaps-controllers/-/snaps-controllers-9.7.0.tgz#3c1ef4fd88e63df893710e4788b5290c231c2919" integrity sha512-/hvun7vPWERYTTi48TSVxZ3W0rjg/+XAC9+2RBEx7HvMteoKUpP3tmYEq2W+x5bkdALQ15iDAE1Hi8OF1usCrg== @@ -5328,7 +5182,7 @@ nanoid "^3.1.31" readable-stream "^3.6.2" -"@metamask/snaps-registry@^3.1.0", "@metamask/snaps-registry@^3.2.1": +"@metamask/snaps-registry@^3.2.1": version "3.2.1" resolved "https://registry.yarnpkg.com/@metamask/snaps-registry/-/snaps-registry-3.2.1.tgz#ff97329b97e8dc9a512f0c5f0f41b3554a592ad3" integrity sha512-MnG1BBJk4UK9iJArK+h/iz8wlt+xjsvgnj0k39p5658hWZu6cuumHoV1EIupCwsCv7XXOBLc8iAgjvITXKC1FQ== @@ -5338,20 +5192,6 @@ "@noble/curves" "^1.2.0" "@noble/hashes" "^1.3.2" -"@metamask/snaps-rpc-methods@^11.0.0": - version "11.0.0" - resolved "https://registry.yarnpkg.com/@metamask/snaps-rpc-methods/-/snaps-rpc-methods-11.0.0.tgz#eefabb1de50c0cdb2a8ed35b106298c8d4b064d4" - integrity sha512-M2T+BHGdEunCXZESX3x6aYl4A4BjTtXn2cW3Z5UVhJORpqgGqvBxCgvohbol0y2oCoqaOe/elDy9N8xap8pJpQ== - dependencies: - "@metamask/key-tree" "^9.1.2" - "@metamask/permission-controller" "^11.0.0" - "@metamask/rpc-errors" "^6.3.1" - "@metamask/snaps-sdk" "^6.2.0" - "@metamask/snaps-utils" "^8.0.0" - "@metamask/superstruct" "^3.1.0" - "@metamask/utils" "^9.1.0" - "@noble/hashes" "^1.3.1" - "@metamask/snaps-rpc-methods@^11.1.1": version "11.1.1" resolved "https://registry.yarnpkg.com/@metamask/snaps-rpc-methods/-/snaps-rpc-methods-11.1.1.tgz#d01a82cb1d8af60ade5f3d3da3adf8a275beda48" @@ -5366,7 +5206,7 @@ "@metamask/utils" "^9.2.1" "@noble/hashes" "^1.3.1" -"@metamask/snaps-rpc-methods@^9.1.2", "@metamask/snaps-rpc-methods@^9.1.4": +"@metamask/snaps-rpc-methods@^9.1.4": version "9.1.4" resolved "https://registry.yarnpkg.com/@metamask/snaps-rpc-methods/-/snaps-rpc-methods-9.1.4.tgz#d0aa695b89326eece7b23d188d8dce7d35a78d9c" integrity sha512-eYcfJDYlXE4RqtRTyp8n7SsJ0aAQlz5H335/5jch3L3CwQwC3z8KlKm258iXPiyT7fa9VVxdZqGs/rBaivx0Iw== @@ -5392,7 +5232,7 @@ fast-xml-parser "^4.3.4" superstruct "^1.0.3" -"@metamask/snaps-sdk@^4.0.1": +"@metamask/snaps-sdk@^4.0.1", "@metamask/snaps-sdk@^4.2.0": version "4.4.2" resolved "https://registry.yarnpkg.com/@metamask/snaps-sdk/-/snaps-sdk-4.4.2.tgz#6d7654ca3ecbcda5cd8689f49721c084241a4495" integrity sha512-V6d1kQdkCTYQ7Z3+ZVnMWjwsS2TRaKNnSRtSHgjATdSacW5d/1td2KbTs+1x1/cSe58ULKW1SBwRNy0i0c95hA== @@ -5404,30 +5244,7 @@ fast-xml-parser "^4.3.4" superstruct "^1.0.3" -"@metamask/snaps-sdk@^4.2.0", "@metamask/snaps-sdk@^4.4.1": - version "4.4.1" - resolved "https://registry.yarnpkg.com/@metamask/snaps-sdk/-/snaps-sdk-4.4.1.tgz#90603a6c83eeb27334e7192a77e7abd6a01d1f53" - integrity sha512-SNtkyIOYdaadFKPSpnGfNu7dXHiTXogHusQdmIHkqidWQaFTIEnKuViePTPgBCdx17/nwu/ZBEhq0AlugRsZ6w== - dependencies: - "@metamask/key-tree" "^9.1.1" - "@metamask/providers" "^17.0.0" - "@metamask/rpc-errors" "^6.2.1" - "@metamask/utils" "^8.3.0" - fast-xml-parser "^4.3.4" - superstruct "^1.0.3" - -"@metamask/snaps-sdk@^6.0.0", "@metamask/snaps-sdk@^6.1.0", "@metamask/snaps-sdk@^6.2.0", "@metamask/snaps-sdk@^6.2.1": - version "6.2.1" - resolved "https://registry.yarnpkg.com/@metamask/snaps-sdk/-/snaps-sdk-6.2.1.tgz#6bb59133326d36786d5ca14de136da577fae1c83" - integrity sha512-apjtC9o+XLjShKntIbiHD+XIuQIGAa/+uIRkzKa2Lm3ADNi04VtkPl8VBfDiY4MSIArjQgj9EIk+rK6aW8H5oA== - dependencies: - "@metamask/key-tree" "^9.1.2" - "@metamask/providers" "^17.1.2" - "@metamask/rpc-errors" "^6.3.1" - "@metamask/superstruct" "^3.1.0" - "@metamask/utils" "^9.1.0" - -"@metamask/snaps-sdk@^6.4.0", "@metamask/snaps-sdk@^6.5.0": +"@metamask/snaps-sdk@^6.0.0", "@metamask/snaps-sdk@^6.1.0", "@metamask/snaps-sdk@^6.2.1", "@metamask/snaps-sdk@^6.4.0", "@metamask/snaps-sdk@^6.5.0": version "6.5.0" resolved "https://registry.yarnpkg.com/@metamask/snaps-sdk/-/snaps-sdk-6.5.0.tgz#e3c5f2c4723d0730e472ae6e65d9c98e7f320fde" integrity sha512-MHNbCQ/4+HwIyWAHlrLbokoO3CGNTod696FGi3WjYHlKC/1fLE06q8jE/NzuixY11Q6wkShBBk2u7MBGLyLp0w== @@ -5438,7 +5255,7 @@ "@metamask/superstruct" "^3.1.0" "@metamask/utils" "^9.2.1" -"@metamask/snaps-utils@^7.1.0", "@metamask/snaps-utils@^7.4.0", "@metamask/snaps-utils@^7.4.1", "@metamask/snaps-utils@^7.7.0", "@metamask/snaps-utils@^7.8.0", "@metamask/snaps-utils@^7.8.1": +"@metamask/snaps-utils@^7.1.0", "@metamask/snaps-utils@^7.4.0", "@metamask/snaps-utils@^7.7.0", "@metamask/snaps-utils@^7.8.0", "@metamask/snaps-utils@^7.8.1": version "7.8.1" resolved "https://registry.yarnpkg.com/@metamask/snaps-utils/-/snaps-utils-7.8.1.tgz#d18f56ece8a1d4e9ff2e8e7645c3349cf08937bc" integrity sha512-v0xNoiWeJGHvtJqP0aU5dj+phqpV6vKCJoV5tNBXl8/AvMTaV2YL4SLO/z+PTo0RWZFplgAuuDsY254kAXi9Fw== @@ -5467,36 +5284,7 @@ ses "^1.1.0" validate-npm-package-name "^5.0.0" -"@metamask/snaps-utils@^8.0.0", "@metamask/snaps-utils@^8.0.1": - version "8.0.1" - resolved "https://registry.yarnpkg.com/@metamask/snaps-utils/-/snaps-utils-8.0.1.tgz#4a86d1ba54ce47295913658a64a2ea81516f8521" - integrity sha512-yS2bPi0Tlsj/uUbIKhb/SVhtF9jmCbiCe5uX42GCnkYK4klNHmDkVGwMit+gqEuNzeTmKO4PwbhxnoL4QZZU/A== - dependencies: - "@babel/core" "^7.23.2" - "@babel/types" "^7.23.0" - "@metamask/base-controller" "^6.0.2" - "@metamask/key-tree" "^9.1.2" - "@metamask/permission-controller" "^11.0.0" - "@metamask/rpc-errors" "^6.3.1" - "@metamask/slip44" "^4.0.0" - "@metamask/snaps-registry" "^3.2.1" - "@metamask/snaps-sdk" "^6.2.1" - "@metamask/superstruct" "^3.1.0" - "@metamask/utils" "^9.1.0" - "@noble/hashes" "^1.3.1" - "@scure/base" "^1.1.1" - chalk "^4.1.2" - cron-parser "^4.5.0" - fast-deep-equal "^3.1.3" - fast-json-stable-stringify "^2.1.0" - fast-xml-parser "^4.4.1" - marked "^12.0.1" - rfdc "^1.3.0" - semver "^7.5.4" - ses "^1.1.0" - validate-npm-package-name "^5.0.0" - -"@metamask/snaps-utils@^8.1.1": +"@metamask/snaps-utils@^8.0.1", "@metamask/snaps-utils@^8.1.1": version "8.1.1" resolved "https://registry.yarnpkg.com/@metamask/snaps-utils/-/snaps-utils-8.1.1.tgz#b32c403c0b5419dae3a22e4c6119099e9b3466ba" integrity sha512-oKwm+0r2WIFinMo07RYAQVb2Khr/T+c8+V0m4iT9WfJHVNG8mHUMonH3ae2jksZ0/327na0mYVj804PLQ88SNA== @@ -5627,7 +5415,7 @@ semver "^7.3.8" superstruct "^1.0.3" -"@metamask/utils@^8.0.0", "@metamask/utils@^8.1.0", "@metamask/utils@^8.2.0", "@metamask/utils@^8.3.0", "@metamask/utils@^8.4.0": +"@metamask/utils@^8.1.0", "@metamask/utils@^8.2.0", "@metamask/utils@^8.3.0", "@metamask/utils@^8.4.0": version "8.4.0" resolved "https://registry.yarnpkg.com/@metamask/utils/-/utils-8.4.0.tgz#f44812c96467a4e1b70b2edff6ee89a9caa4e354" integrity sha512-dbIc3C7alOe0agCuBHM1h71UaEaEqOk2W8rAtEn8QGz4haH2Qq7MoK6i7v2guzvkJVVh79c+QCzIqphC3KvrJg== @@ -5642,22 +5430,7 @@ superstruct "^1.0.3" uuid "^9.0.1" -"@metamask/utils@^9.0.0", "@metamask/utils@^9.1.0": - version "9.1.0" - resolved "https://registry.yarnpkg.com/@metamask/utils/-/utils-9.1.0.tgz#54e5afcec07e6032d4dd4171e862b36daa52d77e" - integrity sha512-g2REf+xSt0OZfMoNNdC4+/Yy8eP3KUqvIArel54XRFKPoXbHI6+YjFfrLtfykWBjffOp7DTfIc3Kvk5TLfuiyg== - dependencies: - "@ethereumjs/tx" "^4.2.0" - "@metamask/superstruct" "^3.1.0" - "@noble/hashes" "^1.3.1" - "@scure/base" "^1.1.3" - "@types/debug" "^4.1.7" - debug "^4.3.4" - pony-cause "^2.1.10" - semver "^7.5.4" - uuid "^9.0.1" - -"@metamask/utils@^9.2.1": +"@metamask/utils@^9.0.0", "@metamask/utils@^9.1.0", "@metamask/utils@^9.2.1": version "9.2.1" resolved "https://registry.yarnpkg.com/@metamask/utils/-/utils-9.2.1.tgz#d9f84706ff97e0c8d1bde5778549365b14269e81" integrity sha512-/u663aUaB6+Xe75i3Mt/1cCljm41HDYIsna5oBrwGvgkY2zH7/9k9Zjd706cxoAbxN7QgLSVAReUiGnuxCuXrQ== From 8efc079499cbc7bef5368645c321259a4af10e81 Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Tue, 17 Sep 2024 14:14:06 +0200 Subject: [PATCH 13/49] fix: update package.json & yarn.lock --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 3ee59bfc27c..ab5885f53a2 100644 --- a/package.json +++ b/package.json @@ -174,7 +174,7 @@ "@metamask/post-message-stream": "^8.0.0", "@metamask/ppom-validator": "0.32.0", "@metamask/preferences-controller": "^11.0.0", - "@metamask/profile-sync-controller": "^0.6.0", + "@metamask/profile-sync-controller": "^0.7.0", "@metamask/react-native-actionsheet": "2.4.2", "@metamask/react-native-button": "^3.0.0", "@metamask/react-native-payments": "^2.0.0", diff --git a/yarn.lock b/yarn.lock index 26a9891d84c..1e7f3256964 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4935,10 +4935,10 @@ "@metamask/base-controller" "^5.0.2" "@metamask/controller-utils" "^9.1.0" -"@metamask/profile-sync-controller@^0.6.0": - version "0.6.0" - resolved "https://registry.yarnpkg.com/@metamask/profile-sync-controller/-/profile-sync-controller-0.6.0.tgz#47cf71d3fdf9b0eca7712ab231e0174658787835" - integrity sha512-L1dIvghOQKRbZLY99NQ4+pYR71o3514AdJaBKP9iybySYZ36qAbg2hohz7+6k62nzLSPFHbflX/bDMbg9lkKPQ== +"@metamask/profile-sync-controller@^0.7.0": + version "0.7.0" + resolved "https://registry.yarnpkg.com/@metamask/profile-sync-controller/-/profile-sync-controller-0.7.0.tgz#31a8e0ebb8025b71776725e2383b2ee0c51749ac" + integrity sha512-ZuOwneWE403Imq1aoTrtxvH13oqlkfl/fAYsnRdlASw0Wr2FrlySHv5aRonziFQJdYQHSxTuSvz4SZKk+AeR6g== dependencies: "@metamask/base-controller" "^7.0.1" "@metamask/snaps-sdk" "^6.5.0" From 970f65e48e02583b518a85df357fa06529915d34 Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Wed, 18 Sep 2024 12:30:20 +0200 Subject: [PATCH 14/49] fix: update yarn.lock --- package.json | 4 ++-- yarn.lock | 23 +++++++++++------------ 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 2997971da8b..3ade22f19b9 100644 --- a/package.json +++ b/package.json @@ -168,13 +168,13 @@ "@metamask/logging-controller": "^3.0.0", "@metamask/message-signing-snap": "^0.3.3", "@metamask/network-controller": "^19.0.0", - "@metamask/notification-services-controller": "^0.2.1", + "@metamask/notification-services-controller": "^0.7.0", "@metamask/permission-controller": "^11.0.0", "@metamask/phishing-controller": "^9.0.0", "@metamask/post-message-stream": "^8.0.0", "@metamask/ppom-validator": "0.32.0", "@metamask/preferences-controller": "^11.0.0", - "@metamask/profile-sync-controller": "^0.7.0", + "@metamask/profile-sync-controller": "^0.8.0", "@metamask/react-native-actionsheet": "2.4.2", "@metamask/react-native-button": "^3.0.0", "@metamask/react-native-payments": "^2.0.0", diff --git a/yarn.lock b/yarn.lock index 1e7f3256964..1176b37e771 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4742,16 +4742,15 @@ "@ethersproject/providers" "^5.7.2" async-mutex "^0.3.1" -"@metamask/notification-services-controller@^0.2.1": - version "0.2.1" - resolved "https://registry.yarnpkg.com/@metamask/notification-services-controller/-/notification-services-controller-0.2.1.tgz#aa36275d20f71297d73c33055e88bf55b33ac4d9" - integrity sha512-TvQAiA38a8j0r7amNQivi4itFFfuNAGrCWJUGbKqyu/rZiS2itTFLXchhazGu1H8TK3lxOx9r7C/RfRYwkuDpA== +"@metamask/notification-services-controller@^0.7.0": + version "0.7.0" + resolved "https://registry.yarnpkg.com/@metamask/notification-services-controller/-/notification-services-controller-0.7.0.tgz#1a487e3f4d6c6ca92ca277f0511525ffceffa3c8" + integrity sha512-04oC+uLG9F9b2vJkRt0Q8tQJg8p8ivRBYp6OpGhtkQZSJKtxJ56gHqAUMyRaYkXK83YU2aNvk4nNLUdjypgdlw== dependencies: "@contentful/rich-text-html-renderer" "^16.5.2" - "@metamask/base-controller" "^6.0.2" - "@metamask/controller-utils" "^11.0.2" + "@metamask/base-controller" "^7.0.1" + "@metamask/controller-utils" "^11.3.0" bignumber.js "^4.1.0" - contentful "^10.3.6" firebase "^10.11.0" loglevel "^1.8.1" uuid "^8.3.2" @@ -4935,10 +4934,10 @@ "@metamask/base-controller" "^5.0.2" "@metamask/controller-utils" "^9.1.0" -"@metamask/profile-sync-controller@^0.7.0": - version "0.7.0" - resolved "https://registry.yarnpkg.com/@metamask/profile-sync-controller/-/profile-sync-controller-0.7.0.tgz#31a8e0ebb8025b71776725e2383b2ee0c51749ac" - integrity sha512-ZuOwneWE403Imq1aoTrtxvH13oqlkfl/fAYsnRdlASw0Wr2FrlySHv5aRonziFQJdYQHSxTuSvz4SZKk+AeR6g== +"@metamask/profile-sync-controller@^0.8.0": + version "0.8.0" + resolved "https://registry.yarnpkg.com/@metamask/profile-sync-controller/-/profile-sync-controller-0.8.0.tgz#3892ab9c6e0884ce4945f06ab809f7bb3fddd824" + integrity sha512-M0cqlTcqVDk5P3uTyp4FutbWu86mhLArjnrTx7GTrnZbAG+Gsw2kFH2zlZIXlYzKYyfmV09DbkWUxiZpNdHsjQ== dependencies: "@metamask/base-controller" "^7.0.1" "@metamask/snaps-sdk" "^6.5.0" @@ -14513,7 +14512,7 @@ contentful-sdk-core@^8.1.0: p-throttle "^4.1.1" qs "^6.11.2" -contentful@^10.3.6, contentful@^10.8.7: +contentful@^10.8.7: version "10.12.10" resolved "https://registry.yarnpkg.com/contentful/-/contentful-10.12.10.tgz#b9c47e64febcc87975f2486d77c7d014402a437c" integrity sha512-YVc+aCvehjsJI8K/IglbLjEAl/fiyUzorCFrgR60R4v44VMa4wmFJTrY48x+YQ7DPKZw5MzFk1wgeG74fxCN2g== From 63708ef91605ea59d6ad5c401659788b72b2f02e Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Wed, 18 Sep 2024 12:38:52 +0200 Subject: [PATCH 15/49] feat: add analytics --- app/core/Analytics/MetaMetrics.events.ts | 12 ++++++++++++ app/core/Engine.ts | 20 ++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/app/core/Analytics/MetaMetrics.events.ts b/app/core/Analytics/MetaMetrics.events.ts index c7980234be3..84e943de5f5 100644 --- a/app/core/Analytics/MetaMetrics.events.ts +++ b/app/core/Analytics/MetaMetrics.events.ts @@ -381,6 +381,10 @@ enum EVENT_NAME { NFT_AUTO_DETECTION_ENABLED = 'nft_autodetection_enabled', PRIMARY_CURRENCY_TOGGLE = 'primary_currency_toggle', LOGIN_DOWNLOAD_LOGS = 'Download State Logs Button Clicked', + + // Profile Syncing + ACCOUNTS_SYNC_ACCOUNT_ADDED = 'Accounts Sync Account Added', + ACCOUNTS_SYNC_ACCOUNT_NAME_UPDATED = 'Accounts Sync Account Name Updated', } enum ACTIONS { @@ -905,6 +909,14 @@ const events = { ), PRIMARY_CURRENCY_TOGGLE: generateOpt(EVENT_NAME.PRIMARY_CURRENCY_TOGGLE), LOGIN_DOWNLOAD_LOGS: generateOpt(EVENT_NAME.LOGIN_DOWNLOAD_LOGS), + + // Profile Syncing + ACCOUNTS_SYNC_ACCOUNT_ADDED: generateOpt( + EVENT_NAME.ACCOUNTS_SYNC_ACCOUNT_ADDED, + ), + ACCOUNTS_SYNC_ACCOUNT_NAME_UPDATED: generateOpt( + EVENT_NAME.ACCOUNTS_SYNC_ACCOUNT_NAME_UPDATED, + ), }; /** diff --git a/app/core/Engine.ts b/app/core/Engine.ts index 9d3fc1fbc44..7981c76f37e 100644 --- a/app/core/Engine.ts +++ b/app/core/Engine.ts @@ -1116,6 +1116,26 @@ class Engine { env: { isAccountSyncingEnabled: true, }, + config: { + accountSyncing: { + onAccountAdded: (profileId) => { + MetaMetrics.getInstance().trackEvent( + MetaMetricsEvents.ACCOUNTS_SYNC_ACCOUNT_ADDED, + { + profile_id: profileId, + }, + ); + }, + onAccountNameUpdated: (profileId) => { + MetaMetrics.getInstance().trackEvent( + MetaMetricsEvents.ACCOUNTS_SYNC_ACCOUNT_NAME_UPDATED, + { + profile_id: profileId, + }, + ); + }, + }, + }, state: initialState.UserStorageController, // @ts-expect-error TODO: Resolve mismatch between base-controller versions. messenger: this.controllerMessenger.getRestricted({ From 5d17b5d12928149bc3c8380bd736b48335b24a6a Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Thu, 19 Sep 2024 12:12:11 +0200 Subject: [PATCH 16/49] fix: yarn.lock --- yarn.lock | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/yarn.lock b/yarn.lock index 800548ffde9..382efd30cdc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4597,7 +4597,7 @@ "@noble/hashes" "^1.3.2" "@scure/base" "^1.0.0" -"@metamask/keyring-api@^6.1.1": +"@metamask/keyring-api@^6.0.0", "@metamask/keyring-api@^6.1.1": version "6.4.0" resolved "https://registry.yarnpkg.com/@metamask/keyring-api/-/keyring-api-6.4.0.tgz#8d8f0adfdddeac84ac55993c3ba424e2171d4bfe" integrity sha512-JGkW7WCQ+M9lQXl5nAe49AaNmbK8HE6x/RupFL8Z5o8E4IVIeQbqEv+lW/Y5RBq0ekToHrxehlR/jDvL1iT8pg== @@ -4640,6 +4640,25 @@ ethereumjs-wallet "^1.0.1" immer "^9.0.6" +"@metamask/keyring-controller@^17.1.0", "@metamask/keyring-controller@^17.2.1": + version "17.2.1" + resolved "https://registry.yarnpkg.com/@metamask/keyring-controller/-/keyring-controller-17.2.1.tgz#3625650e18b80af3f9a1227fc7ca106adf77f5f3" + integrity sha512-9GDrP3jK5uM5e1mX/qHkvjuByAtkf7ZiJoeYRE5OIo0OAYFwMAeFw2JlIdWB+BR6CT8C0KEXo+Ne/5ZTn+HCqA== + dependencies: + "@ethereumjs/util" "^8.1.0" + "@keystonehq/metamask-airgapped-keyring" "^0.14.1" + "@metamask/base-controller" "^7.0.1" + "@metamask/browser-passworder" "^4.3.0" + "@metamask/eth-hd-keyring" "^7.0.1" + "@metamask/eth-sig-util" "^7.0.1" + "@metamask/eth-simple-keyring" "^6.0.1" + "@metamask/keyring-api" "^8.1.0" + "@metamask/message-manager" "^10.1.1" + "@metamask/utils" "^9.1.0" + async-mutex "^0.5.0" + ethereumjs-wallet "^1.0.1" + immer "^9.0.6" + "@metamask/logging-controller@^3.0.0": version "3.0.1" resolved "https://registry.yarnpkg.com/@metamask/logging-controller/-/logging-controller-3.0.1.tgz#11c2b127bc2d7d4b753e2d757b0c09bf2742bf0a" @@ -4658,6 +4677,19 @@ "@metamask/controller-utils" "^10.0.0" uuid "^8.3.2" +"@metamask/message-manager@^10.1.1": + version "10.1.1" + resolved "https://registry.yarnpkg.com/@metamask/message-manager/-/message-manager-10.1.1.tgz#390acc4dff9f7c72aaf5c183397c872e53ae7f12" + integrity sha512-VFFqEPKOyo59P79CP/vlPDpMng1a1mMHIaXuvEJYTOf/UOqeVpw77G5IHVfjuG+tZNlAQIHYp7sEmPkob+rzcA== + dependencies: + "@metamask/base-controller" "^7.0.1" + "@metamask/controller-utils" "^11.3.0" + "@metamask/eth-sig-util" "^7.0.1" + "@metamask/utils" "^9.1.0" + "@types/uuid" "^8.3.0" + jsonschema "^1.2.4" + uuid "^8.3.2" + "@metamask/message-manager@^9.0.0": version "9.0.0" resolved "https://registry.yarnpkg.com/@metamask/message-manager/-/message-manager-9.0.0.tgz#b6138321089e08e7df1c7d2c71b7531cfcc6623c" From b7af2536902a6885132667728356d1860ebdd0d4 Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Thu, 19 Sep 2024 15:00:23 +0200 Subject: [PATCH 17/49] fix: bump snaps packages --- .../Details/Fields/NetworkFeeField.test.tsx | 3 +- package.json | 10 ++-- yarn.lock | 46 +++++++------------ 3 files changed, 22 insertions(+), 37 deletions(-) diff --git a/app/components/Views/Notifications/Details/Fields/NetworkFeeField.test.tsx b/app/components/Views/Notifications/Details/Fields/NetworkFeeField.test.tsx index 710f0c1a592..7243465db57 100644 --- a/app/components/Views/Notifications/Details/Fields/NetworkFeeField.test.tsx +++ b/app/components/Views/Notifications/Details/Fields/NetworkFeeField.test.tsx @@ -1,7 +1,6 @@ import React from 'react'; import { render } from '@testing-library/react-native'; import NetworkFeeField from './NetworkFeeField'; -import { OnChainRawNotificationsWithNetworkFields } from '@metamask/notification-services-controller/dist/types/NotificationServicesController/types'; import { ModalFieldType } from '../../../../../util/notifications'; import { NotificationServicesController } from '@metamask/notification-services-controller'; @@ -25,7 +24,7 @@ jest.mock('../../../../../util/notifications/methods/common', () => ({ const MOCK_NOTIFICATION = processNotification( Mocks.createMockNotificationEthReceived(), -) as OnChainRawNotificationsWithNetworkFields; +) as NotificationServicesController.OnChainRawNotificationsWithNetworkFields; describe('NetworkFeeField', () => { const setIsCollapsed = jest.fn(); diff --git a/package.json b/package.json index dcf2a9d2375..ff3e0a37450 100644 --- a/package.json +++ b/package.json @@ -188,11 +188,11 @@ "@metamask/signature-controller": "^17.0.0", "@metamask/slip44": "3.1.0", "@metamask/smart-transactions-controller": "11.0.0", - "@metamask/snaps-controllers": "^9.4.0", - "@metamask/snaps-execution-environments": "^6.6.2", - "@metamask/snaps-rpc-methods": "^9.1.4", - "@metamask/snaps-sdk": "^6.2.1", - "@metamask/snaps-utils": "^8.0.1", + "@metamask/snaps-controllers": "^9.7.0", + "@metamask/snaps-execution-environments": "^6.7.2", + "@metamask/snaps-rpc-methods": "^11.1.1", + "@metamask/snaps-sdk": "^6.5.1", + "@metamask/snaps-utils": "^8.1.1", "@metamask/swappable-obj-proxy": "^2.1.0", "@metamask/swaps-controller": "^9.0.12", "@metamask/transaction-controller": "^35.0.0", diff --git a/yarn.lock b/yarn.lock index 382efd30cdc..e08afd5225d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4976,7 +4976,7 @@ fast-json-stable-stringify "^2.1.0" uuid "^8.3.2" -"@metamask/post-message-stream@^8.0.0", "@metamask/post-message-stream@^8.1.0", "@metamask/post-message-stream@^8.1.1": +"@metamask/post-message-stream@^8.0.0", "@metamask/post-message-stream@^8.1.1": version "8.1.1" resolved "https://registry.yarnpkg.com/@metamask/post-message-stream/-/post-message-stream-8.1.1.tgz#fd8f4c2363921aaf15c0fa56d087fa9f2d93f047" integrity sha512-Z5LHqE8MI0g9xKT7dOr4G11Qjf2bWg9rFonpFnUJwxJvfIl6KuGVnfOTo7PVXH3zdlWotlhhC2F65QW9WxVSPQ== @@ -5207,7 +5207,7 @@ fast-json-patch "^3.1.0" lodash "^4.17.21" -"@metamask/snaps-controllers@^9.4.0", "@metamask/snaps-controllers@^9.6.0": +"@metamask/snaps-controllers@^9.6.0", "@metamask/snaps-controllers@^9.7.0": version "9.7.0" resolved "https://registry.yarnpkg.com/@metamask/snaps-controllers/-/snaps-controllers-9.7.0.tgz#3c1ef4fd88e63df893710e4788b5290c231c2919" integrity sha512-/hvun7vPWERYTTi48TSVxZ3W0rjg/+XAC9+2RBEx7HvMteoKUpP3tmYEq2W+x5bkdALQ15iDAE1Hi8OF1usCrg== @@ -5237,20 +5237,20 @@ readable-web-to-node-stream "^3.0.2" tar-stream "^3.1.7" -"@metamask/snaps-execution-environments@^6.6.2": - version "6.6.2" - resolved "https://registry.yarnpkg.com/@metamask/snaps-execution-environments/-/snaps-execution-environments-6.6.2.tgz#bfc50fbcc861d6f73ec09956b6e2cee90e25b5e3" - integrity sha512-NThhlP/kw2C3gM5y9vxVqekPos9Nfy3Rv9RyDO3jDTYBRZJrWEW+DIlgKbsa0dz9nAJ3uzDLsg/AdLcKuQgkUQ== +"@metamask/snaps-execution-environments@^6.7.2": + version "6.7.2" + resolved "https://registry.yarnpkg.com/@metamask/snaps-execution-environments/-/snaps-execution-environments-6.7.2.tgz#d541006ce5a7acfc954a24acfed7d052ffef0f1d" + integrity sha512-MY2GVXAc6X1hZdnTtrHvLgHrCr/zdUv1FGO5JuJi04n7gQUMX0gx5r/g4BoCbgYZFJGYBXCLFByIhhLTawRgGA== dependencies: "@metamask/json-rpc-engine" "^9.0.2" "@metamask/object-multiplex" "^2.0.0" - "@metamask/post-message-stream" "^8.1.0" + "@metamask/post-message-stream" "^8.1.1" "@metamask/providers" "^17.1.2" "@metamask/rpc-errors" "^6.3.1" - "@metamask/snaps-sdk" "^6.1.0" - "@metamask/snaps-utils" "^7.8.1" + "@metamask/snaps-sdk" "^6.5.0" + "@metamask/snaps-utils" "^8.1.1" "@metamask/superstruct" "^3.1.0" - "@metamask/utils" "^9.1.0" + "@metamask/utils" "^9.2.1" nanoid "^3.1.31" readable-stream "^3.6.2" @@ -5278,20 +5278,6 @@ "@metamask/utils" "^9.2.1" "@noble/hashes" "^1.3.1" -"@metamask/snaps-rpc-methods@^9.1.4": - version "9.1.4" - resolved "https://registry.yarnpkg.com/@metamask/snaps-rpc-methods/-/snaps-rpc-methods-9.1.4.tgz#d0aa695b89326eece7b23d188d8dce7d35a78d9c" - integrity sha512-eYcfJDYlXE4RqtRTyp8n7SsJ0aAQlz5H335/5jch3L3CwQwC3z8KlKm258iXPiyT7fa9VVxdZqGs/rBaivx0Iw== - dependencies: - "@metamask/key-tree" "^9.1.1" - "@metamask/permission-controller" "^10.0.0" - "@metamask/rpc-errors" "^6.2.1" - "@metamask/snaps-sdk" "^6.0.0" - "@metamask/snaps-utils" "^7.7.0" - "@metamask/utils" "^8.3.0" - "@noble/hashes" "^1.3.1" - superstruct "^1.0.3" - "@metamask/snaps-sdk@^3.1.1": version "3.2.0" resolved "https://registry.yarnpkg.com/@metamask/snaps-sdk/-/snaps-sdk-3.2.0.tgz#66d60869697a479a3484adc9532d82c3b568fc19" @@ -5316,10 +5302,10 @@ fast-xml-parser "^4.3.4" superstruct "^1.0.3" -"@metamask/snaps-sdk@^6.0.0", "@metamask/snaps-sdk@^6.1.0", "@metamask/snaps-sdk@^6.2.1", "@metamask/snaps-sdk@^6.4.0", "@metamask/snaps-sdk@^6.5.0": - version "6.5.0" - resolved "https://registry.yarnpkg.com/@metamask/snaps-sdk/-/snaps-sdk-6.5.0.tgz#e3c5f2c4723d0730e472ae6e65d9c98e7f320fde" - integrity sha512-MHNbCQ/4+HwIyWAHlrLbokoO3CGNTod696FGi3WjYHlKC/1fLE06q8jE/NzuixY11Q6wkShBBk2u7MBGLyLp0w== +"@metamask/snaps-sdk@^6.1.0", "@metamask/snaps-sdk@^6.4.0", "@metamask/snaps-sdk@^6.5.0", "@metamask/snaps-sdk@^6.5.1": + version "6.5.1" + resolved "https://registry.yarnpkg.com/@metamask/snaps-sdk/-/snaps-sdk-6.5.1.tgz#527691767d98c08c802656b020d5d94d6336623e" + integrity sha512-uQEZZNjKwHZZfu9StwlmvTFle5MqiheO6AQctVhpYGJ1kjJ7Qwa+vJhMd0Ox1QI9C3qaUCqxOCDV0mpd1jPRKg== dependencies: "@metamask/key-tree" "^9.1.2" "@metamask/providers" "^17.1.2" @@ -5327,7 +5313,7 @@ "@metamask/superstruct" "^3.1.0" "@metamask/utils" "^9.2.1" -"@metamask/snaps-utils@^7.1.0", "@metamask/snaps-utils@^7.4.0", "@metamask/snaps-utils@^7.7.0", "@metamask/snaps-utils@^7.8.0", "@metamask/snaps-utils@^7.8.1": +"@metamask/snaps-utils@^7.1.0", "@metamask/snaps-utils@^7.4.0", "@metamask/snaps-utils@^7.8.0": version "7.8.1" resolved "https://registry.yarnpkg.com/@metamask/snaps-utils/-/snaps-utils-7.8.1.tgz#d18f56ece8a1d4e9ff2e8e7645c3349cf08937bc" integrity sha512-v0xNoiWeJGHvtJqP0aU5dj+phqpV6vKCJoV5tNBXl8/AvMTaV2YL4SLO/z+PTo0RWZFplgAuuDsY254kAXi9Fw== @@ -5356,7 +5342,7 @@ ses "^1.1.0" validate-npm-package-name "^5.0.0" -"@metamask/snaps-utils@^8.0.1", "@metamask/snaps-utils@^8.1.1": +"@metamask/snaps-utils@^8.1.1": version "8.1.1" resolved "https://registry.yarnpkg.com/@metamask/snaps-utils/-/snaps-utils-8.1.1.tgz#b32c403c0b5419dae3a22e4c6119099e9b3466ba" integrity sha512-oKwm+0r2WIFinMo07RYAQVb2Khr/T+c8+V0m4iT9WfJHVNG8mHUMonH3ae2jksZ0/327na0mYVj804PLQ88SNA== From a3fc2cca264ab0e102aa36ffedb067634dbb1985 Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Thu, 19 Sep 2024 16:25:11 +0200 Subject: [PATCH 18/49] fix: remove unused ts-error statements --- app/core/Engine.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/core/Engine.ts b/app/core/Engine.ts index 5fbeea542e7..96d0fbf9afe 100644 --- a/app/core/Engine.ts +++ b/app/core/Engine.ts @@ -600,7 +600,6 @@ class Engine { }), state: initialState.LoggingController, }); - // @ts-expect-error TODO: Resolve mismatch between base-controller versions. const accountsControllerMessenger: AccountsControllerMessenger = this.controllerMessenger.getRestricted({ name: 'AccountsController', @@ -742,7 +741,6 @@ class Engine { preferencesController, ), encryptor, - // @ts-expect-error TODO: Resolve mismatch between base-controller versions. messenger: this.controllerMessenger.getRestricted({ name: 'KeyringController', allowedActions: [], @@ -1110,7 +1108,6 @@ class Engine { const authenticationController = new AuthenticationController.Controller({ state: initialState.AuthenticationController, - // @ts-expect-error TODO: Resolve mismatch between base-controller versions. messenger: this.controllerMessenger.getRestricted({ name: 'AuthenticationController', allowedActions: [ @@ -1155,7 +1152,6 @@ class Engine { }, }, state: initialState.UserStorageController, - // @ts-expect-error TODO: Resolve mismatch between base-controller versions. messenger: this.controllerMessenger.getRestricted({ name: 'UserStorageController', allowedActions: [ @@ -1183,7 +1179,6 @@ class Engine { const notificationServicesController = new NotificationServicesController.Controller({ - // @ts-expect-error TODO: Resolve mismatch between base-controller versions. messenger: this.controllerMessenger.getRestricted({ name: 'NotificationServicesController', allowedActions: [ From a971856166a5e782f890c05df0d1c02d86f94e38 Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Fri, 20 Sep 2024 10:15:51 +0200 Subject: [PATCH 19/49] fix: snaps imports --- app/core/Engine.ts | 2 +- app/lib/snaps/SnapsExecutionWebView.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/core/Engine.ts b/app/core/Engine.ts index 96d0fbf9afe..9e2074d7f83 100644 --- a/app/core/Engine.ts +++ b/app/core/Engine.ts @@ -121,7 +121,7 @@ import { } from '@metamask/snaps-controllers'; import { WebViewExecutionService } from '@metamask/snaps-controllers/react-native'; -import { NotificationArgs } from '@metamask/snaps-rpc-methods/dist/types/restricted/notify'; +import { NotificationArgs } from '@metamask/snaps-rpc-methods/dist/restricted/notify.cjs'; import { getSnapsWebViewPromise } from '../lib/snaps'; import { buildSnapEndowmentSpecifications, diff --git a/app/lib/snaps/SnapsExecutionWebView.tsx b/app/lib/snaps/SnapsExecutionWebView.tsx index 157ef74df69..3debae2d18c 100644 --- a/app/lib/snaps/SnapsExecutionWebView.tsx +++ b/app/lib/snaps/SnapsExecutionWebView.tsx @@ -6,7 +6,7 @@ import React, { Component, RefObject } from 'react'; import { View, ScrollView, NativeSyntheticEvent } from 'react-native'; import WebView, { WebViewMessageEvent } from '@metamask/react-native-webview'; import { createStyles } from './styles'; -import { WebViewInterface } from '@metamask/snaps-controllers/dist/types/services/webview/WebViewMessageStream'; +import { WebViewInterface } from '@metamask/snaps-controllers/dist/services/webview/WebViewMessageStream.cjs'; import { WebViewError } from '@metamask/react-native-webview/lib/WebViewTypes'; import { PostMessageEvent } from '@metamask/post-message-stream'; @@ -89,7 +89,7 @@ export class SnapsExecutionWebView extends Component { ref={ this.setWebViewRef as unknown as React.RefObject | null } - source={{ uri: SNAPS_EE_URL}} + source={{ uri: SNAPS_EE_URL }} onMessage={this.onWebViewMessage} onError={this.onWebViewError} onLoadEnd={this.onWebViewLoad} From 92d9839105847eca1eb119bf668c77d11c86d359 Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Fri, 20 Sep 2024 16:57:08 +0200 Subject: [PATCH 20/49] fix: yarn.lock --- yarn.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/yarn.lock b/yarn.lock index 5dc1dda781a..0efbbd8aeda 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5297,10 +5297,10 @@ fast-xml-parser "^4.3.4" superstruct "^1.0.3" -"@metamask/snaps-sdk@^6.0.0", "@metamask/snaps-sdk@^6.1.0", "@metamask/snaps-sdk@^6.1.1", "@metamask/snaps-sdk@^6.2.0", "@metamask/snaps-sdk@^6.2.1", "@metamask/snaps-sdk@^6.5.0": - version "6.5.0" - resolved "https://registry.yarnpkg.com/@metamask/snaps-sdk/-/snaps-sdk-6.5.0.tgz#e3c5f2c4723d0730e472ae6e65d9c98e7f320fde" - integrity sha512-MHNbCQ/4+HwIyWAHlrLbokoO3CGNTod696FGi3WjYHlKC/1fLE06q8jE/NzuixY11Q6wkShBBk2u7MBGLyLp0w== +"@metamask/snaps-sdk@^6.1.0", "@metamask/snaps-sdk@^6.4.0", "@metamask/snaps-sdk@^6.5.0", "@metamask/snaps-sdk@^6.5.1": + version "6.5.1" + resolved "https://registry.yarnpkg.com/@metamask/snaps-sdk/-/snaps-sdk-6.5.1.tgz#527691767d98c08c802656b020d5d94d6336623e" + integrity sha512-uQEZZNjKwHZZfu9StwlmvTFle5MqiheO6AQctVhpYGJ1kjJ7Qwa+vJhMd0Ox1QI9C3qaUCqxOCDV0mpd1jPRKg== dependencies: "@metamask/key-tree" "^9.1.2" "@metamask/providers" "^17.1.2" @@ -5337,7 +5337,7 @@ ses "^1.1.0" validate-npm-package-name "^5.0.0" -"@metamask/snaps-utils@^8.0.0", "@metamask/snaps-utils@^8.0.1", "@metamask/snaps-utils@^8.1.1": +"@metamask/snaps-utils@^8.1.1": version "8.1.1" resolved "https://registry.yarnpkg.com/@metamask/snaps-utils/-/snaps-utils-8.1.1.tgz#b32c403c0b5419dae3a22e4c6119099e9b3466ba" integrity sha512-oKwm+0r2WIFinMo07RYAQVb2Khr/T+c8+V0m4iT9WfJHVNG8mHUMonH3ae2jksZ0/327na0mYVj804PLQ88SNA== From c157056ffc5f220f3679737b04a722540f4faf62 Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Mon, 23 Sep 2024 08:10:16 +0200 Subject: [PATCH 21/49] fix: yarn.lock --- yarn.lock | 54 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 9 deletions(-) diff --git a/yarn.lock b/yarn.lock index ffaea5112b5..75312d53370 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4009,7 +4009,42 @@ "@metamask/superstruct" "^3.1.0" "@metamask/utils" "^9.0.0" -"@metamask/accounts-controller@^14.0.0", "@metamask/accounts-controller@^17.2.0", "@metamask/accounts-controller@^18.1.0", "@metamask/accounts-controller@^18.2.1": +"@metamask/accounts-controller@^14.0.0": + version "14.0.0" + resolved "https://registry.yarnpkg.com/@metamask/accounts-controller/-/accounts-controller-14.0.0.tgz#aea6004b66ff02f30eea2d1ed77a9820c1f0a6d2" + integrity sha512-vI79c/Va8ziso7LQnF2du411AQUXAfO2JwhNxGVBo3EHSKPAX0v0WTz+GF/1sTUIIuCuDaOsemH1kBj5nA+rwg== + dependencies: + "@ethereumjs/util" "^8.1.0" + "@metamask/base-controller" "^5.0.2" + "@metamask/eth-snap-keyring" "^4.0.0" + "@metamask/keyring-api" "^6.0.0" + "@metamask/snaps-sdk" "^4.0.1" + "@metamask/snaps-utils" "^7.1.0" + "@metamask/utils" "^8.3.0" + deepmerge "^4.2.2" + ethereum-cryptography "^2.1.2" + immer "^9.0.6" + uuid "^8.3.2" + +"@metamask/accounts-controller@^17.2.0": + version "17.2.0" + resolved "https://registry.yarnpkg.com/@metamask/accounts-controller/-/accounts-controller-17.2.0.tgz#b74918444a9d8e6e69b9b761dc58e64aac6b466c" + integrity sha512-hfdfRV7mxxnyG1tri3CatV63WWtwPkUSl0zTz7Mq3psSXqOFr+08f1Elw4sX7pP1V/rCxZKeotoluIjUeu1Q9Q== + dependencies: + "@ethereumjs/util" "^8.1.0" + "@metamask/base-controller" "^6.0.0" + "@metamask/eth-snap-keyring" "^4.3.1" + "@metamask/keyring-api" "^8.0.0" + "@metamask/keyring-controller" "^17.1.0" + "@metamask/snaps-sdk" "^4.2.0" + "@metamask/snaps-utils" "^7.4.0" + "@metamask/utils" "^8.3.0" + deepmerge "^4.2.2" + ethereum-cryptography "^2.1.2" + immer "^9.0.6" + uuid "^8.3.2" + +"@metamask/accounts-controller@^18.2.1": version "18.2.1" resolved "https://registry.yarnpkg.com/@metamask/accounts-controller/-/accounts-controller-18.2.1.tgz#8e4a842316e9b7bbd0409b36129f7123ba4a4c79" integrity sha512-BEvux+ZFpTOQa6HbRl7i7Tq24ztqrZIsX+H0ePh47lU+N8RWq1q0JCItV+zbsgdcYnwhtcMZTsp4jJPQwPe2og== @@ -4365,7 +4400,7 @@ ethereum-cryptography "^2.1.2" randombytes "^2.1.0" -"@metamask/eth-snap-keyring@^4.3.3": +"@metamask/eth-snap-keyring@^4.0.0", "@metamask/eth-snap-keyring@^4.3.1", "@metamask/eth-snap-keyring@^4.3.3": version "4.3.4" resolved "https://registry.yarnpkg.com/@metamask/eth-snap-keyring/-/eth-snap-keyring-4.3.4.tgz#78308770d421f6f3c9d24dba925acf87a54012e8" integrity sha512-y68ksrkwZJ7J5Edej+XvTDR04CwZs0BHjOVpJbnA/328P75Gs7jSHWqOE7DtziMbwpVsFlgBMTVFPsSyrh8Fmg== @@ -4575,16 +4610,17 @@ superstruct "^1.0.3" uuid "^9.0.1" -"@metamask/keyring-api@^8.1.0": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@metamask/keyring-api/-/keyring-api-8.1.0.tgz#e4157550189797fae89557c37315dc47d4c23bed" - integrity sha512-w/B1ulJvyxQBZoJMpSsHFtrL8kbdwFc2ryjEcAgMZ3V0PNyW2urY0f9v/majYAVkPhQcN1t0AUwv8NcOSigGqg== +"@metamask/keyring-api@^8.0.0", "@metamask/keyring-api@^8.1.0": + version "8.1.1" + resolved "https://registry.yarnpkg.com/@metamask/keyring-api/-/keyring-api-8.1.1.tgz#1d35a56d251ab2619fc99dfe5568c4e3cfb733b9" + integrity sha512-J2uD7uEDpFB9JRk595bMCKkHGI/Xp5qCOO3/iF0y2LzrAftxtgPqBlGMCuU9OMAWMXPE0qkLXoE2MfrBJsar+w== dependencies: "@metamask/snaps-sdk" "^6.1.0" "@metamask/superstruct" "^3.1.0" "@metamask/utils" "^9.1.0" "@types/uuid" "^9.0.8" bech32 "^2.0.0" + deepmerge "^4.2.2" uuid "^9.0.1" "@metamask/keyring-controller@^16.0.0", "@metamask/keyring-controller@^16.1.0": @@ -4606,7 +4642,7 @@ ethereumjs-wallet "^1.0.1" immer "^9.0.6" -"@metamask/keyring-controller@^17.2.1": +"@metamask/keyring-controller@^17.1.0", "@metamask/keyring-controller@^17.2.1": version "17.2.1" resolved "https://registry.yarnpkg.com/@metamask/keyring-controller/-/keyring-controller-17.2.1.tgz#3625650e18b80af3f9a1227fc7ca106adf77f5f3" integrity sha512-9GDrP3jK5uM5e1mX/qHkvjuByAtkf7ZiJoeYRE5OIo0OAYFwMAeFw2JlIdWB+BR6CT8C0KEXo+Ne/5ZTn+HCqA== @@ -5266,7 +5302,7 @@ fast-xml-parser "^4.3.4" superstruct "^1.0.3" -"@metamask/snaps-sdk@^4.2.0": +"@metamask/snaps-sdk@^4.0.1", "@metamask/snaps-sdk@^4.2.0": version "4.4.2" resolved "https://registry.yarnpkg.com/@metamask/snaps-sdk/-/snaps-sdk-4.4.2.tgz#6d7654ca3ecbcda5cd8689f49721c084241a4495" integrity sha512-V6d1kQdkCTYQ7Z3+ZVnMWjwsS2TRaKNnSRtSHgjATdSacW5d/1td2KbTs+1x1/cSe58ULKW1SBwRNy0i0c95hA== @@ -5289,7 +5325,7 @@ "@metamask/superstruct" "^3.1.0" "@metamask/utils" "^9.2.1" -"@metamask/snaps-utils@^7.7.0", "@metamask/snaps-utils@^7.8.0", "@metamask/snaps-utils@^7.8.1": +"@metamask/snaps-utils@^7.1.0", "@metamask/snaps-utils@^7.4.0", "@metamask/snaps-utils@^7.7.0", "@metamask/snaps-utils@^7.8.0", "@metamask/snaps-utils@^7.8.1": version "7.8.1" resolved "https://registry.yarnpkg.com/@metamask/snaps-utils/-/snaps-utils-7.8.1.tgz#d18f56ece8a1d4e9ff2e8e7645c3349cf08937bc" integrity sha512-v0xNoiWeJGHvtJqP0aU5dj+phqpV6vKCJoV5tNBXl8/AvMTaV2YL4SLO/z+PTo0RWZFplgAuuDsY254kAXi9Fw== From 5d708da4896775feb527602d0cf60aec17f6f030 Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Mon, 23 Sep 2024 09:10:37 +0200 Subject: [PATCH 22/49] fix: yarn.lock --- package.json | 4 ++-- yarn.lock | 18 ++---------------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index 6820e699e99..bdc51a201ff 100644 --- a/package.json +++ b/package.json @@ -190,8 +190,8 @@ "@metamask/smart-transactions-controller": "^13.0.0", "@metamask/snaps-controllers": "^9.8.0", "@metamask/snaps-execution-environments": "^6.7.2", - "@metamask/snaps-rpc-methods": "^9.1.4", - "@metamask/snaps-sdk": "^6.5.0", + "@metamask/snaps-rpc-methods": "^11.1.1", + "@metamask/snaps-sdk": "^6.5.1", "@metamask/snaps-utils": "^8.1.1", "@metamask/swappable-obj-proxy": "^2.1.0", "@metamask/swaps-controller": "^9.0.12", diff --git a/yarn.lock b/yarn.lock index 75312d53370..042d028c400 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5276,20 +5276,6 @@ "@metamask/utils" "^9.2.1" "@noble/hashes" "^1.3.1" -"@metamask/snaps-rpc-methods@^9.1.4": - version "9.1.4" - resolved "https://registry.yarnpkg.com/@metamask/snaps-rpc-methods/-/snaps-rpc-methods-9.1.4.tgz#d0aa695b89326eece7b23d188d8dce7d35a78d9c" - integrity sha512-eYcfJDYlXE4RqtRTyp8n7SsJ0aAQlz5H335/5jch3L3CwQwC3z8KlKm258iXPiyT7fa9VVxdZqGs/rBaivx0Iw== - dependencies: - "@metamask/key-tree" "^9.1.1" - "@metamask/permission-controller" "^10.0.0" - "@metamask/rpc-errors" "^6.2.1" - "@metamask/snaps-sdk" "^6.0.0" - "@metamask/snaps-utils" "^7.7.0" - "@metamask/utils" "^8.3.0" - "@noble/hashes" "^1.3.1" - superstruct "^1.0.3" - "@metamask/snaps-sdk@^3.1.1": version "3.2.0" resolved "https://registry.yarnpkg.com/@metamask/snaps-sdk/-/snaps-sdk-3.2.0.tgz#66d60869697a479a3484adc9532d82c3b568fc19" @@ -5314,7 +5300,7 @@ fast-xml-parser "^4.3.4" superstruct "^1.0.3" -"@metamask/snaps-sdk@^6.0.0", "@metamask/snaps-sdk@^6.1.0", "@metamask/snaps-sdk@^6.1.1", "@metamask/snaps-sdk@^6.4.0", "@metamask/snaps-sdk@^6.5.0", "@metamask/snaps-sdk@^6.5.1": +"@metamask/snaps-sdk@^6.1.0", "@metamask/snaps-sdk@^6.1.1", "@metamask/snaps-sdk@^6.4.0", "@metamask/snaps-sdk@^6.5.0", "@metamask/snaps-sdk@^6.5.1": version "6.5.1" resolved "https://registry.yarnpkg.com/@metamask/snaps-sdk/-/snaps-sdk-6.5.1.tgz#527691767d98c08c802656b020d5d94d6336623e" integrity sha512-uQEZZNjKwHZZfu9StwlmvTFle5MqiheO6AQctVhpYGJ1kjJ7Qwa+vJhMd0Ox1QI9C3qaUCqxOCDV0mpd1jPRKg== @@ -5325,7 +5311,7 @@ "@metamask/superstruct" "^3.1.0" "@metamask/utils" "^9.2.1" -"@metamask/snaps-utils@^7.1.0", "@metamask/snaps-utils@^7.4.0", "@metamask/snaps-utils@^7.7.0", "@metamask/snaps-utils@^7.8.0", "@metamask/snaps-utils@^7.8.1": +"@metamask/snaps-utils@^7.1.0", "@metamask/snaps-utils@^7.4.0", "@metamask/snaps-utils@^7.8.0", "@metamask/snaps-utils@^7.8.1": version "7.8.1" resolved "https://registry.yarnpkg.com/@metamask/snaps-utils/-/snaps-utils-7.8.1.tgz#d18f56ece8a1d4e9ff2e8e7645c3349cf08937bc" integrity sha512-v0xNoiWeJGHvtJqP0aU5dj+phqpV6vKCJoV5tNBXl8/AvMTaV2YL4SLO/z+PTo0RWZFplgAuuDsY254kAXi9Fw== From 02101928babc9058f13af6faa533f31a82ef79eb Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Wed, 25 Sep 2024 13:38:43 +0200 Subject: [PATCH 23/49] fix: yarn.lock --- yarn.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yarn.lock b/yarn.lock index 8492fb10eb7..4090f094744 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5598,7 +5598,7 @@ fast-xml-parser "^4.3.4" superstruct "^1.0.3" -"@metamask/snaps-sdk@^6.1.0", "@metamask/snaps-sdk@^6.1.1", "@metamask/snaps-sdk@^6.4.0", "@metamask/snaps-sdk@^6.5.0", "@metamask/snaps-sdk@^6.5.1": +"@metamask/snaps-sdk@^6.1.0", "@metamask/snaps-sdk@^6.4.0", "@metamask/snaps-sdk@^6.5.0", "@metamask/snaps-sdk@^6.5.1": version "6.5.1" resolved "https://registry.yarnpkg.com/@metamask/snaps-sdk/-/snaps-sdk-6.5.1.tgz#527691767d98c08c802656b020d5d94d6336623e" integrity sha512-uQEZZNjKwHZZfu9StwlmvTFle5MqiheO6AQctVhpYGJ1kjJ7Qwa+vJhMd0Ox1QI9C3qaUCqxOCDV0mpd1jPRKg== @@ -5609,7 +5609,7 @@ "@metamask/superstruct" "^3.1.0" "@metamask/utils" "^9.2.1" -"@metamask/snaps-utils@^7.7.0", "@metamask/snaps-utils@^7.8.0": +"@metamask/snaps-utils@^7.1.0", "@metamask/snaps-utils@^7.4.0", "@metamask/snaps-utils@^7.8.0": version "7.8.1" resolved "https://registry.yarnpkg.com/@metamask/snaps-utils/-/snaps-utils-7.8.1.tgz#d18f56ece8a1d4e9ff2e8e7645c3349cf08937bc" integrity sha512-v0xNoiWeJGHvtJqP0aU5dj+phqpV6vKCJoV5tNBXl8/AvMTaV2YL4SLO/z+PTo0RWZFplgAuuDsY254kAXi9Fw== From f5a2aa94d881922abf8a743c3f890b91f49cc3c6 Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Thu, 3 Oct 2024 12:02:11 +0200 Subject: [PATCH 24/49] fix: bump profile-sync-controller version --- app/core/Analytics/MetaMetrics.events.ts | 10 ++++------ package.json | 2 +- yarn.lock | 13 ++++++------- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/app/core/Analytics/MetaMetrics.events.ts b/app/core/Analytics/MetaMetrics.events.ts index 08bd9877044..14ca21512ce 100644 --- a/app/core/Analytics/MetaMetrics.events.ts +++ b/app/core/Analytics/MetaMetrics.events.ts @@ -370,8 +370,8 @@ enum EVENT_NAME { LOGIN_DOWNLOAD_LOGS = 'Download State Logs Button Clicked', // Profile Syncing - ACCOUNTS_SYNC_ACCOUNT_ADDED = 'Accounts Sync Account Added', - ACCOUNTS_SYNC_ACCOUNT_NAME_UPDATED = 'Accounts Sync Account Name Updated', + ACCOUNTS_SYNC_ADDED = 'Accounts Sync Added', + ACCOUNTS_SYNC_NAME_UPDATED = 'Accounts Sync Name Updated', } enum ACTIONS { @@ -854,11 +854,9 @@ const events = { LOGIN_DOWNLOAD_LOGS: generateOpt(EVENT_NAME.LOGIN_DOWNLOAD_LOGS), // Profile Syncing - ACCOUNTS_SYNC_ACCOUNT_ADDED: generateOpt( - EVENT_NAME.ACCOUNTS_SYNC_ACCOUNT_ADDED, - ), + ACCOUNTS_SYNC_ACCOUNT_ADDED: generateOpt(EVENT_NAME.ACCOUNTS_SYNC_ADDED), ACCOUNTS_SYNC_ACCOUNT_NAME_UPDATED: generateOpt( - EVENT_NAME.ACCOUNTS_SYNC_ACCOUNT_NAME_UPDATED, + EVENT_NAME.ACCOUNTS_SYNC_NAME_UPDATED, ), }; diff --git a/package.json b/package.json index 874f0059e7b..8c0f3e6fde6 100644 --- a/package.json +++ b/package.json @@ -168,7 +168,7 @@ "@metamask/post-message-stream": "^8.0.0", "@metamask/ppom-validator": "0.32.0", "@metamask/preferences-controller": "^11.0.0", - "@metamask/profile-sync-controller": "^0.9.4", + "@metamask/profile-sync-controller": "^0.9.5", "@metamask/react-native-actionsheet": "2.4.2", "@metamask/react-native-button": "^3.0.0", "@metamask/react-native-payments": "^2.0.0", diff --git a/yarn.lock b/yarn.lock index 7a970fa056a..01d1d5f375a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4896,7 +4896,7 @@ superstruct "^1.0.3" uuid "^9.0.1" -"@metamask/keyring-api@^8.1.0", "@metamask/keyring-api@^8.1.3": +"@metamask/keyring-api@^8.0.0", "@metamask/keyring-api@^8.1.0", "@metamask/keyring-api@^8.1.3": version "8.1.3" resolved "https://registry.yarnpkg.com/@metamask/keyring-api/-/keyring-api-8.1.3.tgz#53e6a68236b88592db5bd43cf7e0d7e97dfad818" integrity sha512-Ztm4G/U5hc+GKS/VOnqLWYVh2O26lFQ03bNpeufrfKq7regydIqYuHFcSowbQyj7xCZqKPsvl9jxhKdYIxvCXQ== @@ -4906,7 +4906,6 @@ "@metamask/utils" "^9.2.1" "@types/uuid" "^9.0.8" bech32 "^2.0.0" - deepmerge "^4.2.2" uuid "^9.0.1" "@metamask/keyring-controller@^16.0.0": @@ -4928,7 +4927,7 @@ ethereumjs-wallet "^1.0.1" immer "^9.0.6" -"@metamask/keyring-controller@^17.2.1", "@metamask/keyring-controller@^17.2.2": +"@metamask/keyring-controller@^17.1.0", "@metamask/keyring-controller@^17.2.1", "@metamask/keyring-controller@^17.2.2": version "17.2.2" resolved "https://registry.yarnpkg.com/@metamask/keyring-controller/-/keyring-controller-17.2.2.tgz#944bc693305b4a6e4f1e73739a82c4bc6573dd9a" integrity sha512-Shqk0ybcTPrHQLlBJ1V+InuYC7nD3/a6Ws0XCcBCOfkLTXvtSooKIWBioK83XlHMHkfsM6+bySxSqXJVgJvBZw== @@ -5275,10 +5274,10 @@ "@metamask/base-controller" "^5.0.2" "@metamask/controller-utils" "^9.1.0" -"@metamask/profile-sync-controller@^0.9.4": - version "0.9.4" - resolved "https://registry.yarnpkg.com/@metamask/profile-sync-controller/-/profile-sync-controller-0.9.4.tgz#8cb74c1b97b8d6b93320263e56c39129076611e9" - integrity sha512-VKGXFTSnLuBC1/JMrR2/fGrP1LzgAkvlrfRrz1RKRqAPLAIbToph9MV9X06TuczDjrDkUv9fPpXa1j8tKvlCqg== +"@metamask/profile-sync-controller@^0.9.5": + version "0.9.5" + resolved "https://registry.yarnpkg.com/@metamask/profile-sync-controller/-/profile-sync-controller-0.9.5.tgz#b236153a59e43c0656f4fb2b76cb495dab38814b" + integrity sha512-3eMUe8rf1fFlrOzHiL4Vt6QQMpZVFsfPuFssJ6eIfMqUFoRVxbHSq1Ar8T9v2uKteYO7oTHm4JtnsuOGQxGvEg== dependencies: "@metamask/base-controller" "^7.0.1" "@metamask/keyring-api" "^8.1.3" From 22cfc1aef3b0f93501ce1b087f9a27ca6965d877 Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Wed, 9 Oct 2024 07:12:48 +0200 Subject: [PATCH 25/49] fix: update analytics events names --- app/core/Analytics/MetaMetrics.events.ts | 4 ++-- app/core/Engine.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/core/Analytics/MetaMetrics.events.ts b/app/core/Analytics/MetaMetrics.events.ts index 14ca21512ce..d957fac2ff5 100644 --- a/app/core/Analytics/MetaMetrics.events.ts +++ b/app/core/Analytics/MetaMetrics.events.ts @@ -854,8 +854,8 @@ const events = { LOGIN_DOWNLOAD_LOGS: generateOpt(EVENT_NAME.LOGIN_DOWNLOAD_LOGS), // Profile Syncing - ACCOUNTS_SYNC_ACCOUNT_ADDED: generateOpt(EVENT_NAME.ACCOUNTS_SYNC_ADDED), - ACCOUNTS_SYNC_ACCOUNT_NAME_UPDATED: generateOpt( + ACCOUNTS_SYNC_ADDED: generateOpt(EVENT_NAME.ACCOUNTS_SYNC_ADDED), + ACCOUNTS_SYNC_NAME_UPDATED: generateOpt( EVENT_NAME.ACCOUNTS_SYNC_NAME_UPDATED, ), }; diff --git a/app/core/Engine.ts b/app/core/Engine.ts index d70f1dbb57b..6cdddf614ce 100644 --- a/app/core/Engine.ts +++ b/app/core/Engine.ts @@ -1243,7 +1243,7 @@ class Engine { accountSyncing: { onAccountAdded: (profileId) => { MetaMetrics.getInstance().trackEvent( - MetaMetricsEvents.ACCOUNTS_SYNC_ACCOUNT_ADDED, + MetaMetricsEvents.ACCOUNTS_SYNC_ADDED, { profile_id: profileId, }, @@ -1251,7 +1251,7 @@ class Engine { }, onAccountNameUpdated: (profileId) => { MetaMetrics.getInstance().trackEvent( - MetaMetricsEvents.ACCOUNTS_SYNC_ACCOUNT_NAME_UPDATED, + MetaMetricsEvents.ACCOUNTS_SYNC_NAME_UPDATED, { profile_id: profileId, }, From 7a4dc642b546450ed63f82599a867c98f0b3c199 Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Wed, 9 Oct 2024 07:37:23 +0200 Subject: [PATCH 26/49] fix: update yarn.lock --- yarn.lock | 111 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 72 insertions(+), 39 deletions(-) diff --git a/yarn.lock b/yarn.lock index b30e1155491..26beaf98e4d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4295,7 +4295,42 @@ "@metamask/superstruct" "^3.1.0" "@metamask/utils" "^9.0.0" -"@metamask/accounts-controller@^15.0.0", "@metamask/accounts-controller@^17.2.0", "@metamask/accounts-controller@^18.1.0", "@metamask/accounts-controller@^18.2.1": +"@metamask/accounts-controller@^15.0.0": + version "15.0.0" + resolved "https://registry.yarnpkg.com/@metamask/accounts-controller/-/accounts-controller-15.0.0.tgz#7e3fbaeabd594c059196e3f4c419ceb3dcd9bf73" + integrity sha512-BS9SyKxk9w9VMjO9G7nDkzeXaz20PPakgHTry6KqNPSqtxVWGyNo331nc6lnh8aCvAX5vxOOpeSi4mbmi+fT2w== + dependencies: + "@ethereumjs/util" "^8.1.0" + "@metamask/base-controller" "^5.0.2" + "@metamask/eth-snap-keyring" "^4.1.1" + "@metamask/keyring-api" "^6.1.1" + "@metamask/snaps-sdk" "^4.2.0" + "@metamask/snaps-utils" "^7.4.0" + "@metamask/utils" "^8.3.0" + deepmerge "^4.2.2" + ethereum-cryptography "^2.1.2" + immer "^9.0.6" + uuid "^8.3.2" + +"@metamask/accounts-controller@^17.2.0": + version "17.2.0" + resolved "https://registry.yarnpkg.com/@metamask/accounts-controller/-/accounts-controller-17.2.0.tgz#b74918444a9d8e6e69b9b761dc58e64aac6b466c" + integrity sha512-hfdfRV7mxxnyG1tri3CatV63WWtwPkUSl0zTz7Mq3psSXqOFr+08f1Elw4sX7pP1V/rCxZKeotoluIjUeu1Q9Q== + dependencies: + "@ethereumjs/util" "^8.1.0" + "@metamask/base-controller" "^6.0.0" + "@metamask/eth-snap-keyring" "^4.3.1" + "@metamask/keyring-api" "^8.0.0" + "@metamask/keyring-controller" "^17.1.0" + "@metamask/snaps-sdk" "^4.2.0" + "@metamask/snaps-utils" "^7.4.0" + "@metamask/utils" "^8.3.0" + deepmerge "^4.2.2" + ethereum-cryptography "^2.1.2" + immer "^9.0.6" + uuid "^8.3.2" + +"@metamask/accounts-controller@^18.2.1": version "18.2.1" resolved "https://registry.yarnpkg.com/@metamask/accounts-controller/-/accounts-controller-18.2.1.tgz#8e4a842316e9b7bbd0409b36129f7123ba4a4c79" integrity sha512-BEvux+ZFpTOQa6HbRl7i7Tq24ztqrZIsX+H0ePh47lU+N8RWq1q0JCItV+zbsgdcYnwhtcMZTsp4jJPQwPe2og== @@ -4651,22 +4686,20 @@ ethereum-cryptography "^2.1.2" randombytes "^2.1.0" -"@metamask/eth-snap-keyring@^4.0.0", "@metamask/eth-snap-keyring@^4.3.1", "@metamask/eth-snap-keyring@^4.3.3": - version "4.3.4" - resolved "https://registry.yarnpkg.com/@metamask/eth-snap-keyring/-/eth-snap-keyring-4.3.4.tgz#78308770d421f6f3c9d24dba925acf87a54012e8" - integrity sha512-y68ksrkwZJ7J5Edej+XvTDR04CwZs0BHjOVpJbnA/328P75Gs7jSHWqOE7DtziMbwpVsFlgBMTVFPsSyrh8Fmg== +"@metamask/eth-snap-keyring@^4.1.1", "@metamask/eth-snap-keyring@^4.3.1", "@metamask/eth-snap-keyring@^4.3.3": + version "4.3.6" + resolved "https://registry.yarnpkg.com/@metamask/eth-snap-keyring/-/eth-snap-keyring-4.3.6.tgz#c010c644575d1d2dd7c47953f6a1392fe17e38d9" + integrity sha512-jds0NdBDWM99FnO7WjODnRo+fnRoo11lJZlFS+cIa4ol7TMQmJ0HQdpno7R2LNfweoTioDMQd1LY1mCBq4zXnA== dependencies: "@ethereumjs/tx" "^4.2.0" "@metamask/eth-sig-util" "^7.0.3" - "@metamask/keyring-api" "^8.1.0" - "@metamask/snaps-controllers" "^9.6.0" - "@metamask/snaps-sdk" "^6.4.0" - "@metamask/snaps-utils" "^7.8.0" + "@metamask/snaps-controllers" "^9.7.0" + "@metamask/snaps-sdk" "^6.5.1" + "@metamask/snaps-utils" "^7.8.1" "@metamask/superstruct" "^3.1.0" - "@metamask/utils" "^9.1.0" - "@types/uuid" "^9.0.1" - deepmerge "^4.2.2" - uuid "^9.0.0" + "@metamask/utils" "^9.2.1" + "@types/uuid" "^9.0.8" + uuid "^9.0.1" "@metamask/etherscan-link@^2.0.0": version "2.1.0" @@ -4849,7 +4882,7 @@ "@noble/hashes" "^1.3.2" "@scure/base" "^1.0.0" -"@metamask/keyring-api@^6.0.0", "@metamask/keyring-api@^6.1.1": +"@metamask/keyring-api@^6.1.1": version "6.4.0" resolved "https://registry.yarnpkg.com/@metamask/keyring-api/-/keyring-api-6.4.0.tgz#8d8f0adfdddeac84ac55993c3ba424e2171d4bfe" integrity sha512-JGkW7WCQ+M9lQXl5nAe49AaNmbK8HE6x/RupFL8Z5o8E4IVIeQbqEv+lW/Y5RBq0ekToHrxehlR/jDvL1iT8pg== @@ -5440,10 +5473,10 @@ fast-json-patch "^3.1.0" lodash "^4.17.21" -"@metamask/snaps-controllers@^9.6.0", "@metamask/snaps-controllers@^9.8.0": - version "9.8.0" - resolved "https://registry.yarnpkg.com/@metamask/snaps-controllers/-/snaps-controllers-9.8.0.tgz#576de64fcaec7d393cc5c39f7d94dec068f3e2bf" - integrity sha512-Ey5bHhCsODF7NIkFvr3773ZYrxhbErLE1M12AUBIiLo7p5h/h8nWY+ilObQjTj3Au58oQ5QNYK1juvHMogFgdA== +"@metamask/snaps-controllers@^9.7.0", "@metamask/snaps-controllers@^9.8.0": + version "9.11.0" + resolved "https://registry.yarnpkg.com/@metamask/snaps-controllers/-/snaps-controllers-9.11.0.tgz#06cd0976994bfa12413c1326b60d50afe6a65640" + integrity sha512-4LrwAGnYVL125OqC7TRCFLdxtTfZLUbw/xyL0h/VWeT1+wt8uc6imN7gVyCudxM6GY2ujLaBcyp0NvmLEDDrfQ== dependencies: "@metamask/approval-controller" "^7.0.2" "@metamask/base-controller" "^6.0.2" @@ -5455,9 +5488,9 @@ "@metamask/post-message-stream" "^8.1.1" "@metamask/rpc-errors" "^6.3.1" "@metamask/snaps-registry" "^3.2.1" - "@metamask/snaps-rpc-methods" "^11.1.1" - "@metamask/snaps-sdk" "^6.5.1" - "@metamask/snaps-utils" "^8.1.1" + "@metamask/snaps-rpc-methods" "^11.4.0" + "@metamask/snaps-sdk" "^6.8.0" + "@metamask/snaps-utils" "^8.4.0" "@metamask/utils" "^9.2.1" "@xstate/fsm" "^2.0.0" browserify-zlib "^0.2.0" @@ -5497,16 +5530,16 @@ "@noble/curves" "^1.2.0" "@noble/hashes" "^1.3.2" -"@metamask/snaps-rpc-methods@^11.1.1": - version "11.1.1" - resolved "https://registry.yarnpkg.com/@metamask/snaps-rpc-methods/-/snaps-rpc-methods-11.1.1.tgz#d01a82cb1d8af60ade5f3d3da3adf8a275beda48" - integrity sha512-j4oJyMSBLTLg0RA28wgsCjdbC/YZUyRB/U6/tLCsaGXDKIPnOR17yjyeOx/IKLQR91ZC2+y4dMkgFbyOVSDI3Q== +"@metamask/snaps-rpc-methods@^11.1.1", "@metamask/snaps-rpc-methods@^11.4.0": + version "11.4.0" + resolved "https://registry.yarnpkg.com/@metamask/snaps-rpc-methods/-/snaps-rpc-methods-11.4.0.tgz#6cbf6cd6d91b65a5156882b4c10b1bdbc026e4cc" + integrity sha512-vFX4NFV1y7sj7uCDH6lJdDbRSLhELQdrv1FM0x/S8UptKYLGMhKafplhfx7KcQm0DBugSIXd42rmpgE8addunQ== dependencies: "@metamask/key-tree" "^9.1.2" "@metamask/permission-controller" "^11.0.0" "@metamask/rpc-errors" "^6.3.1" - "@metamask/snaps-sdk" "^6.5.0" - "@metamask/snaps-utils" "^8.1.1" + "@metamask/snaps-sdk" "^6.8.0" + "@metamask/snaps-utils" "^8.4.0" "@metamask/superstruct" "^3.1.0" "@metamask/utils" "^9.2.1" "@noble/hashes" "^1.3.1" @@ -5523,7 +5556,7 @@ fast-xml-parser "^4.3.4" superstruct "^1.0.3" -"@metamask/snaps-sdk@^4.0.1", "@metamask/snaps-sdk@^4.2.0": +"@metamask/snaps-sdk@^4.2.0": version "4.4.2" resolved "https://registry.yarnpkg.com/@metamask/snaps-sdk/-/snaps-sdk-4.4.2.tgz#6d7654ca3ecbcda5cd8689f49721c084241a4495" integrity sha512-V6d1kQdkCTYQ7Z3+ZVnMWjwsS2TRaKNnSRtSHgjATdSacW5d/1td2KbTs+1x1/cSe58ULKW1SBwRNy0i0c95hA== @@ -5535,10 +5568,10 @@ fast-xml-parser "^4.3.4" superstruct "^1.0.3" -"@metamask/snaps-sdk@^6.1.0", "@metamask/snaps-sdk@^6.4.0", "@metamask/snaps-sdk@^6.5.0", "@metamask/snaps-sdk@^6.5.1": - version "6.5.1" - resolved "https://registry.yarnpkg.com/@metamask/snaps-sdk/-/snaps-sdk-6.5.1.tgz#527691767d98c08c802656b020d5d94d6336623e" - integrity sha512-uQEZZNjKwHZZfu9StwlmvTFle5MqiheO6AQctVhpYGJ1kjJ7Qwa+vJhMd0Ox1QI9C3qaUCqxOCDV0mpd1jPRKg== +"@metamask/snaps-sdk@^6.1.0", "@metamask/snaps-sdk@^6.5.0", "@metamask/snaps-sdk@^6.5.1", "@metamask/snaps-sdk@^6.8.0": + version "6.8.0" + resolved "https://registry.yarnpkg.com/@metamask/snaps-sdk/-/snaps-sdk-6.8.0.tgz#9afd5bbad102ff267e6e2637830e82418682a4a3" + integrity sha512-12df7r9jdh2MBUMBDieJFTDK7xxKw4cY6maO7zrRkG5Ar3Ubb5jb+JMo3X+JMPDwa3Kng0i3u7kk+EnUhFIHQQ== dependencies: "@metamask/key-tree" "^9.1.2" "@metamask/providers" "^17.1.2" @@ -5546,7 +5579,7 @@ "@metamask/superstruct" "^3.1.0" "@metamask/utils" "^9.2.1" -"@metamask/snaps-utils@^7.1.0", "@metamask/snaps-utils@^7.4.0", "@metamask/snaps-utils@^7.8.0": +"@metamask/snaps-utils@^7.4.0", "@metamask/snaps-utils@^7.8.1": version "7.8.1" resolved "https://registry.yarnpkg.com/@metamask/snaps-utils/-/snaps-utils-7.8.1.tgz#d18f56ece8a1d4e9ff2e8e7645c3349cf08937bc" integrity sha512-v0xNoiWeJGHvtJqP0aU5dj+phqpV6vKCJoV5tNBXl8/AvMTaV2YL4SLO/z+PTo0RWZFplgAuuDsY254kAXi9Fw== @@ -5575,10 +5608,10 @@ ses "^1.1.0" validate-npm-package-name "^5.0.0" -"@metamask/snaps-utils@^8.1.1": - version "8.1.1" - resolved "https://registry.yarnpkg.com/@metamask/snaps-utils/-/snaps-utils-8.1.1.tgz#b32c403c0b5419dae3a22e4c6119099e9b3466ba" - integrity sha512-oKwm+0r2WIFinMo07RYAQVb2Khr/T+c8+V0m4iT9WfJHVNG8mHUMonH3ae2jksZ0/327na0mYVj804PLQ88SNA== +"@metamask/snaps-utils@^8.1.1", "@metamask/snaps-utils@^8.4.0": + version "8.4.0" + resolved "https://registry.yarnpkg.com/@metamask/snaps-utils/-/snaps-utils-8.4.0.tgz#aefedf45e6fe7b87a6b646193b7c0150caa5e51d" + integrity sha512-xxrAsxKf+l8Z3RP9oriNp6Jboh2tUB3mYZDw/kAvzBRX0tr28KgU/sKhRj4jF8GHEL7/jJmw9OIwOlhuXxD+Kg== dependencies: "@babel/core" "^7.23.2" "@babel/types" "^7.23.0" @@ -5588,7 +5621,7 @@ "@metamask/rpc-errors" "^6.3.1" "@metamask/slip44" "^4.0.0" "@metamask/snaps-registry" "^3.2.1" - "@metamask/snaps-sdk" "^6.5.0" + "@metamask/snaps-sdk" "^6.8.0" "@metamask/superstruct" "^3.1.0" "@metamask/utils" "^9.2.1" "@noble/hashes" "^1.3.1" @@ -10342,7 +10375,7 @@ resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-9.0.2.tgz#ede1d1b1e451548d44919dc226253e32a6952c4b" integrity sha512-kNnC1GFBLuhImSnV7w4njQkUiJi0ZXUycu1rUaouPqiKlXkh77JKgdRnTAp1x5eBwcIwbtI+3otwzuIDEuDoxQ== -"@types/uuid@^9.0.1", "@types/uuid@^9.0.8": +"@types/uuid@^9.0.8": version "9.0.8" resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-9.0.8.tgz#7545ba4fc3c003d6c756f651f3bf163d8f0f29ba" integrity sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA== From b03fd6a1849ac1c6808757b7b0af7c560080ab5d Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Wed, 9 Oct 2024 09:42:57 +0200 Subject: [PATCH 27/49] fix: build issues --- app/core/Engine.ts | 4 ++-- package.json | 2 +- yarn.lock | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/core/Engine.ts b/app/core/Engine.ts index be5a0ef663d..7ddc331be6b 100644 --- a/app/core/Engine.ts +++ b/app/core/Engine.ts @@ -126,7 +126,7 @@ import { } from '@metamask/snaps-controllers'; import { WebViewExecutionService } from '@metamask/snaps-controllers/react-native'; -import { NotificationArgs } from '@metamask/snaps-rpc-methods/dist/restricted/notify.cjs'; +import { NotificationParameters } from '@metamask/snaps-rpc-methods/dist/restricted/notify.cjs'; import { getSnapsWebViewPromise } from '../lib/snaps'; import { buildSnapEndowmentSpecifications, @@ -901,7 +901,7 @@ class Engine { type, requestData: { content, placeholder }, }), - showInAppNotification: (origin: string, args: NotificationArgs) => { + showInAppNotification: (origin: string, args: NotificationParameters) => { Logger.log( 'Snaps/ showInAppNotification called with args: ', args, diff --git a/package.json b/package.json index 7e0075e3f52..acbdbc094ad 100644 --- a/package.json +++ b/package.json @@ -168,7 +168,7 @@ "@metamask/post-message-stream": "^8.0.0", "@metamask/ppom-validator": "0.32.0", "@metamask/preferences-controller": "^11.0.0", - "@metamask/profile-sync-controller": "^0.9.5", + "@metamask/profile-sync-controller": "^0.9.6", "@metamask/react-native-actionsheet": "2.4.2", "@metamask/react-native-button": "^3.0.0", "@metamask/react-native-payments": "^2.0.0", diff --git a/yarn.lock b/yarn.lock index 26beaf98e4d..38fa3721c4b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5280,10 +5280,10 @@ "@metamask/base-controller" "^5.0.2" "@metamask/controller-utils" "^10.0.0" -"@metamask/profile-sync-controller@^0.9.5": - version "0.9.5" - resolved "https://registry.yarnpkg.com/@metamask/profile-sync-controller/-/profile-sync-controller-0.9.5.tgz#b236153a59e43c0656f4fb2b76cb495dab38814b" - integrity sha512-3eMUe8rf1fFlrOzHiL4Vt6QQMpZVFsfPuFssJ6eIfMqUFoRVxbHSq1Ar8T9v2uKteYO7oTHm4JtnsuOGQxGvEg== +"@metamask/profile-sync-controller@^0.9.6": + version "0.9.6" + resolved "https://registry.yarnpkg.com/@metamask/profile-sync-controller/-/profile-sync-controller-0.9.6.tgz#c13e3152495c23d82b42f7cab1ce0807f135a863" + integrity sha512-X7f29wuX5jvWeShnYSOB94htJPwAOAOTj7nlN96oR/dyKLr8uV4Ny4JQiqeCMWXWShKlChBCS0Ya4bm0Wea1rA== dependencies: "@metamask/base-controller" "^7.0.1" "@metamask/keyring-api" "^8.1.3" From 2fee02f8d2938eedec36696374c1a0bf766bd534 Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Tue, 15 Oct 2024 18:58:57 +0200 Subject: [PATCH 28/49] fix: update yarn.lock --- yarn.lock | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 107 insertions(+), 5 deletions(-) diff --git a/yarn.lock b/yarn.lock index 9104dd2f2e7..6ec53927781 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4294,7 +4294,42 @@ "@metamask/superstruct" "^3.1.0" "@metamask/utils" "^9.0.0" -"@metamask/accounts-controller@^16.0.0", "@metamask/accounts-controller@^17.2.0", "@metamask/accounts-controller@^18.1.0", "@metamask/accounts-controller@^18.2.1": +"@metamask/accounts-controller@^16.0.0": + version "16.0.0" + resolved "https://registry.yarnpkg.com/@metamask/accounts-controller/-/accounts-controller-16.0.0.tgz#796ec5266c6976dc53c585e88f8bb0d066722e86" + integrity sha512-FizBU+zuiztKylufnszaHi4uJxkN/oP0YS5LGiGpGKjRretbqJiuTAo6ol2jUAu+J67j+oQ1qfpDwz49n0FC6A== + dependencies: + "@ethereumjs/util" "^8.1.0" + "@metamask/base-controller" "^6.0.0" + "@metamask/eth-snap-keyring" "^4.1.1" + "@metamask/keyring-api" "^6.1.1" + "@metamask/snaps-sdk" "^4.2.0" + "@metamask/snaps-utils" "^7.4.0" + "@metamask/utils" "^8.3.0" + deepmerge "^4.2.2" + ethereum-cryptography "^2.1.2" + immer "^9.0.6" + uuid "^8.3.2" + +"@metamask/accounts-controller@^17.2.0": + version "17.2.0" + resolved "https://registry.yarnpkg.com/@metamask/accounts-controller/-/accounts-controller-17.2.0.tgz#b74918444a9d8e6e69b9b761dc58e64aac6b466c" + integrity sha512-hfdfRV7mxxnyG1tri3CatV63WWtwPkUSl0zTz7Mq3psSXqOFr+08f1Elw4sX7pP1V/rCxZKeotoluIjUeu1Q9Q== + dependencies: + "@ethereumjs/util" "^8.1.0" + "@metamask/base-controller" "^6.0.0" + "@metamask/eth-snap-keyring" "^4.3.1" + "@metamask/keyring-api" "^8.0.0" + "@metamask/keyring-controller" "^17.1.0" + "@metamask/snaps-sdk" "^4.2.0" + "@metamask/snaps-utils" "^7.4.0" + "@metamask/utils" "^8.3.0" + deepmerge "^4.2.2" + ethereum-cryptography "^2.1.2" + immer "^9.0.6" + uuid "^8.3.2" + +"@metamask/accounts-controller@^18.2.1": version "18.2.1" resolved "https://registry.yarnpkg.com/@metamask/accounts-controller/-/accounts-controller-18.2.1.tgz#8e4a842316e9b7bbd0409b36129f7123ba4a4c79" integrity sha512-BEvux+ZFpTOQa6HbRl7i7Tq24ztqrZIsX+H0ePh47lU+N8RWq1q0JCItV+zbsgdcYnwhtcMZTsp4jJPQwPe2og== @@ -4832,7 +4867,19 @@ "@noble/hashes" "^1.3.2" "@scure/base" "^1.0.0" -"@metamask/keyring-api@^8.1.0", "@metamask/keyring-api@^8.1.3": +"@metamask/keyring-api@^6.1.1": + version "6.4.0" + resolved "https://registry.yarnpkg.com/@metamask/keyring-api/-/keyring-api-6.4.0.tgz#8d8f0adfdddeac84ac55993c3ba424e2171d4bfe" + integrity sha512-JGkW7WCQ+M9lQXl5nAe49AaNmbK8HE6x/RupFL8Z5o8E4IVIeQbqEv+lW/Y5RBq0ekToHrxehlR/jDvL1iT8pg== + dependencies: + "@metamask/snaps-sdk" "^4.2.0" + "@metamask/utils" "^8.4.0" + "@types/uuid" "^9.0.8" + bech32 "^2.0.0" + superstruct "^1.0.3" + uuid "^9.0.1" + +"@metamask/keyring-api@^8.0.0", "@metamask/keyring-api@^8.1.0", "@metamask/keyring-api@^8.1.3": version "8.1.3" resolved "https://registry.yarnpkg.com/@metamask/keyring-api/-/keyring-api-8.1.3.tgz#53e6a68236b88592db5bd43cf7e0d7e97dfad818" integrity sha512-Ztm4G/U5hc+GKS/VOnqLWYVh2O26lFQ03bNpeufrfKq7regydIqYuHFcSowbQyj7xCZqKPsvl9jxhKdYIxvCXQ== @@ -4844,7 +4891,7 @@ bech32 "^2.0.0" uuid "^9.0.1" -"@metamask/keyring-controller@^17.0.0", "@metamask/keyring-controller@^17.2.1", "@metamask/keyring-controller@^17.2.2": +"@metamask/keyring-controller@^17.0.0", "@metamask/keyring-controller@^17.1.0", "@metamask/keyring-controller@^17.2.1", "@metamask/keyring-controller@^17.2.2": version "17.2.2" resolved "https://registry.yarnpkg.com/@metamask/keyring-controller/-/keyring-controller-17.2.2.tgz#944bc693305b4a6e4f1e73739a82c4bc6573dd9a" integrity sha512-Shqk0ybcTPrHQLlBJ1V+InuYC7nD3/a6Ws0XCcBCOfkLTXvtSooKIWBioK83XlHMHkfsM6+bySxSqXJVgJvBZw== @@ -5222,6 +5269,23 @@ readable-stream "^3.6.2" webextension-polyfill "^0.10.0" +"@metamask/providers@^17.0.0": + version "17.2.1" + resolved "https://registry.yarnpkg.com/@metamask/providers/-/providers-17.2.1.tgz#e57105deddd0aab7c7a7efc44ce91f3bd9737906" + integrity sha512-xnF48ULB0uZ4mOPLMv5xzLWenMs1zbAUNP+wiBofetzIqnD/i6S8u9axIkAwEXBsb0JXtDI1lBPiTBJ5HUxRdw== + dependencies: + "@metamask/json-rpc-engine" "^9.0.1" + "@metamask/json-rpc-middleware-stream" "^8.0.1" + "@metamask/object-multiplex" "^2.0.0" + "@metamask/rpc-errors" "^6.3.1" + "@metamask/safe-event-emitter" "^3.1.1" + "@metamask/utils" "^9.0.0" + detect-browser "^5.2.0" + extension-port-stream "^4.1.0" + fast-deep-equal "^3.1.3" + is-stream "^2.0.0" + readable-stream "^3.6.2" + "@metamask/providers@^17.1.2": version "17.1.2" resolved "https://registry.yarnpkg.com/@metamask/providers/-/providers-17.1.2.tgz#bb29c9cbf66be4c3f83d3e24ffea93f750b3db39" @@ -5447,7 +5511,19 @@ fast-xml-parser "^4.3.4" superstruct "^1.0.3" -"@metamask/snaps-sdk@^6.0.0", "@metamask/snaps-sdk@^6.1.0", "@metamask/snaps-sdk@^6.4.0", "@metamask/snaps-sdk@^6.5.0", "@metamask/snaps-sdk@^6.5.1": +"@metamask/snaps-sdk@^4.2.0": + version "4.4.2" + resolved "https://registry.yarnpkg.com/@metamask/snaps-sdk/-/snaps-sdk-4.4.2.tgz#6d7654ca3ecbcda5cd8689f49721c084241a4495" + integrity sha512-V6d1kQdkCTYQ7Z3+ZVnMWjwsS2TRaKNnSRtSHgjATdSacW5d/1td2KbTs+1x1/cSe58ULKW1SBwRNy0i0c95hA== + dependencies: + "@metamask/key-tree" "^9.1.1" + "@metamask/providers" "^17.0.0" + "@metamask/rpc-errors" "^6.2.1" + "@metamask/utils" "^8.3.0" + fast-xml-parser "^4.3.4" + superstruct "^1.0.3" + +"@metamask/snaps-sdk@^6.1.0", "@metamask/snaps-sdk@^6.5.0", "@metamask/snaps-sdk@^6.5.1": version "6.5.1" resolved "https://registry.yarnpkg.com/@metamask/snaps-sdk/-/snaps-sdk-6.5.1.tgz#527691767d98c08c802656b020d5d94d6336623e" integrity sha512-uQEZZNjKwHZZfu9StwlmvTFle5MqiheO6AQctVhpYGJ1kjJ7Qwa+vJhMd0Ox1QI9C3qaUCqxOCDV0mpd1jPRKg== @@ -5458,6 +5534,17 @@ "@metamask/superstruct" "^3.1.0" "@metamask/utils" "^9.2.1" +"@metamask/snaps-sdk@^6.8.0": + version "6.9.0" + resolved "https://registry.yarnpkg.com/@metamask/snaps-sdk/-/snaps-sdk-6.9.0.tgz#409a36cdecf46da4825c437091c9d1541bea7bce" + integrity sha512-wPiZNvmkUXTGJ5yLIN9s+KZuB9zx4bz5LurUpufQ8geaMenQ2ZSyg8vqx7hj25q3yk3W2KncV3wnBmtixjucRA== + dependencies: + "@metamask/key-tree" "^9.1.2" + "@metamask/providers" "^17.1.2" + "@metamask/rpc-errors" "^6.3.1" + "@metamask/superstruct" "^3.1.0" + "@metamask/utils" "^9.2.1" + "@metamask/snaps-utils@^7.4.0", "@metamask/snaps-utils@^7.8.1": version "7.8.1" resolved "https://registry.yarnpkg.com/@metamask/snaps-utils/-/snaps-utils-7.8.1.tgz#d18f56ece8a1d4e9ff2e8e7645c3349cf08937bc" @@ -5516,7 +5603,7 @@ ses "^1.1.0" validate-npm-package-name "^5.0.0" -"@metamask/superstruct@^3.1.0": +"@metamask/superstruct@^3.0.0", "@metamask/superstruct@^3.1.0": version "3.1.0" resolved "https://registry.yarnpkg.com/@metamask/superstruct/-/superstruct-3.1.0.tgz#148f786a674fba3ac885c1093ab718515bf7f648" integrity sha512-N08M56HdOgBfRKkrgCMZvQppkZGcArEop3kixNEtVbJKm6P9Cfg0YkI6X0s1g78sNrj2fWUwvJADdZuzJgFttA== @@ -5629,6 +5716,21 @@ superstruct "^1.0.3" uuid "^9.0.1" +"@metamask/utils@^8.4.0": + version "8.5.0" + resolved "https://registry.yarnpkg.com/@metamask/utils/-/utils-8.5.0.tgz#ddd0d4012d5191809404c97648a837ea9962cceb" + integrity sha512-I6bkduevXb72TIM9q2LRO63JSsF9EXduh3sBr9oybNX2hNNpr/j1tEjXrsG0Uabm4MJ1xkGAQEMwifvKZIkyxQ== + dependencies: + "@ethereumjs/tx" "^4.2.0" + "@metamask/superstruct" "^3.0.0" + "@noble/hashes" "^1.3.1" + "@scure/base" "^1.1.3" + "@types/debug" "^4.1.7" + debug "^4.3.4" + pony-cause "^2.1.10" + semver "^7.5.4" + uuid "^9.0.1" + "@metamask/utils@^9.0.0", "@metamask/utils@^9.1.0", "@metamask/utils@^9.2.1": version "9.2.1" resolved "https://registry.yarnpkg.com/@metamask/utils/-/utils-9.2.1.tgz#d9f84706ff97e0c8d1bde5778549365b14269e81" From 0fa03b7f9bdd9d277cb4e583e650560a917d1e2b Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Tue, 15 Oct 2024 19:12:42 +0200 Subject: [PATCH 29/49] fix: yarn dedupe --- yarn.lock | 49 +++---------------------------------------------- 1 file changed, 3 insertions(+), 46 deletions(-) diff --git a/yarn.lock b/yarn.lock index 6ec53927781..7006ca864e2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5269,7 +5269,7 @@ readable-stream "^3.6.2" webextension-polyfill "^0.10.0" -"@metamask/providers@^17.0.0": +"@metamask/providers@^17.0.0", "@metamask/providers@^17.1.2": version "17.2.1" resolved "https://registry.yarnpkg.com/@metamask/providers/-/providers-17.2.1.tgz#e57105deddd0aab7c7a7efc44ce91f3bd9737906" integrity sha512-xnF48ULB0uZ4mOPLMv5xzLWenMs1zbAUNP+wiBofetzIqnD/i6S8u9axIkAwEXBsb0JXtDI1lBPiTBJ5HUxRdw== @@ -5286,23 +5286,6 @@ is-stream "^2.0.0" readable-stream "^3.6.2" -"@metamask/providers@^17.1.2": - version "17.1.2" - resolved "https://registry.yarnpkg.com/@metamask/providers/-/providers-17.1.2.tgz#bb29c9cbf66be4c3f83d3e24ffea93f750b3db39" - integrity sha512-hACtF02yaUYThvWrRtVU4JAc+ZLCZ4PJUYBw6dK9Rze50J7zCxtss2mB7H8w76iLx//b5hjgXx6y92gPVjuYWg== - dependencies: - "@metamask/json-rpc-engine" "^9.0.1" - "@metamask/json-rpc-middleware-stream" "^8.0.1" - "@metamask/object-multiplex" "^2.0.0" - "@metamask/rpc-errors" "^6.3.1" - "@metamask/safe-event-emitter" "^3.1.1" - "@metamask/utils" "^9.0.0" - detect-browser "^5.2.0" - extension-port-stream "^4.1.0" - fast-deep-equal "^3.1.3" - is-stream "^2.0.0" - readable-stream "^3.6.2" - "@metamask/react-native-actionsheet@2.4.2": version "2.4.2" resolved "https://registry.yarnpkg.com/@metamask/react-native-actionsheet/-/react-native-actionsheet-2.4.2.tgz#9f956fe9e784d92c8e33656877fcfaabe4a482f1" @@ -5523,18 +5506,7 @@ fast-xml-parser "^4.3.4" superstruct "^1.0.3" -"@metamask/snaps-sdk@^6.1.0", "@metamask/snaps-sdk@^6.5.0", "@metamask/snaps-sdk@^6.5.1": - version "6.5.1" - resolved "https://registry.yarnpkg.com/@metamask/snaps-sdk/-/snaps-sdk-6.5.1.tgz#527691767d98c08c802656b020d5d94d6336623e" - integrity sha512-uQEZZNjKwHZZfu9StwlmvTFle5MqiheO6AQctVhpYGJ1kjJ7Qwa+vJhMd0Ox1QI9C3qaUCqxOCDV0mpd1jPRKg== - dependencies: - "@metamask/key-tree" "^9.1.2" - "@metamask/providers" "^17.1.2" - "@metamask/rpc-errors" "^6.3.1" - "@metamask/superstruct" "^3.1.0" - "@metamask/utils" "^9.2.1" - -"@metamask/snaps-sdk@^6.8.0": +"@metamask/snaps-sdk@^6.1.0", "@metamask/snaps-sdk@^6.5.0", "@metamask/snaps-sdk@^6.5.1", "@metamask/snaps-sdk@^6.8.0": version "6.9.0" resolved "https://registry.yarnpkg.com/@metamask/snaps-sdk/-/snaps-sdk-6.9.0.tgz#409a36cdecf46da4825c437091c9d1541bea7bce" integrity sha512-wPiZNvmkUXTGJ5yLIN9s+KZuB9zx4bz5LurUpufQ8geaMenQ2ZSyg8vqx7hj25q3yk3W2KncV3wnBmtixjucRA== @@ -5701,22 +5673,7 @@ semver "^7.3.8" superstruct "^1.0.3" -"@metamask/utils@^8.1.0", "@metamask/utils@^8.2.0", "@metamask/utils@^8.3.0": - version "8.4.0" - resolved "https://registry.yarnpkg.com/@metamask/utils/-/utils-8.4.0.tgz#f44812c96467a4e1b70b2edff6ee89a9caa4e354" - integrity sha512-dbIc3C7alOe0agCuBHM1h71UaEaEqOk2W8rAtEn8QGz4haH2Qq7MoK6i7v2guzvkJVVh79c+QCzIqphC3KvrJg== - dependencies: - "@ethereumjs/tx" "^4.2.0" - "@noble/hashes" "^1.3.1" - "@scure/base" "^1.1.3" - "@types/debug" "^4.1.7" - debug "^4.3.4" - pony-cause "^2.1.10" - semver "^7.5.4" - superstruct "^1.0.3" - uuid "^9.0.1" - -"@metamask/utils@^8.4.0": +"@metamask/utils@^8.1.0", "@metamask/utils@^8.2.0", "@metamask/utils@^8.3.0", "@metamask/utils@^8.4.0": version "8.5.0" resolved "https://registry.yarnpkg.com/@metamask/utils/-/utils-8.5.0.tgz#ddd0d4012d5191809404c97648a837ea9962cceb" integrity sha512-I6bkduevXb72TIM9q2LRO63JSsF9EXduh3sBr9oybNX2hNNpr/j1tEjXrsG0Uabm4MJ1xkGAQEMwifvKZIkyxQ== From 5752f146d65f6abb6ca356073bf332439f86f2cb Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Wed, 16 Oct 2024 10:53:01 +0200 Subject: [PATCH 30/49] fix: add missing semi-colon --- app/actions/notification/helpers/index.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/actions/notification/helpers/index.ts b/app/actions/notification/helpers/index.ts index 02f08a7ee9e..b1c4c881eb9 100644 --- a/app/actions/notification/helpers/index.ts +++ b/app/actions/notification/helpers/index.ts @@ -187,13 +187,13 @@ export const syncInternalAccountsWithUserStorage = async () => { */ export const performDeleteStorage = async (): Promise => { try { - await Engine.context.UserStorageController.performDeleteStorage('notifications.notification_settings'); - await Engine.context.NotificationServicesController.createOnChainTriggers( - { + await Engine.context.UserStorageController.performDeleteStorage( + 'notifications.notification_settings', + ); + await Engine.context.NotificationServicesController.createOnChainTriggers({ resetNotifications: true, - }, - ); + }); } catch (error) { return getErrorMessage(error); } -} +}; From d859175caf11ddd2999e1d1497d9375009619c38 Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Wed, 16 Oct 2024 11:26:24 +0200 Subject: [PATCH 31/49] fix: move account syncing to its own hook file --- app/components/Views/Wallet/index.tsx | 2 +- .../hooks/useAccountSyncing.test.tsx | 102 ++++++++++++++++++ .../notifications/hooks/useAccountSyncing.ts | 32 ++++++ .../hooks/useProfileSyncing.test.tsx | 78 +------------- .../notifications/hooks/useProfileSyncing.ts | 31 ------ 5 files changed, 136 insertions(+), 109 deletions(-) create mode 100644 app/util/notifications/hooks/useAccountSyncing.test.tsx create mode 100644 app/util/notifications/hooks/useAccountSyncing.ts diff --git a/app/components/Views/Wallet/index.tsx b/app/components/Views/Wallet/index.tsx index 650d944356d..f1039012e19 100644 --- a/app/components/Views/Wallet/index.tsx +++ b/app/components/Views/Wallet/index.tsx @@ -103,7 +103,7 @@ import { } from '../../../selectors/notifications'; import { ButtonVariants } from '../../../component-library/components/Buttons/Button'; import { useListNotifications } from '../../../util/notifications/hooks/useNotifications'; -import { useAccountSyncing } from '../../../util/notifications/hooks/useProfileSyncing'; +import { useAccountSyncing } from '../../../util/notifications/hooks/useAccountSyncing'; import { isObject } from 'lodash'; diff --git a/app/util/notifications/hooks/useAccountSyncing.test.tsx b/app/util/notifications/hooks/useAccountSyncing.test.tsx new file mode 100644 index 00000000000..f9fdb72cb40 --- /dev/null +++ b/app/util/notifications/hooks/useAccountSyncing.test.tsx @@ -0,0 +1,102 @@ +/* eslint-disable import/no-namespace */ +/* eslint-disable react/prop-types */ +/* eslint-disable react/display-name */ +/* eslint-disable @typescript-eslint/no-var-requires */ +/* eslint-disable @typescript-eslint/no-require-imports */ +import { act, renderHook } from '@testing-library/react-hooks'; +import React from 'react'; +import { Provider } from 'react-redux'; +import createMockStore from 'redux-mock-store'; +import * as Actions from '../../../actions/notification/helpers'; +import initialRootState from '../../../util/test/initial-root-state'; +import { useAccountSyncing } from './useAccountSyncing'; + +function arrangeStore() { + const store = createMockStore()(initialRootState); + + // Ensure dispatch mocks are handled correctly + store.dispatch = jest.fn().mockImplementation((action) => { + if (typeof action === 'function') { + return action(store.dispatch, store.getState); + } + return Promise.resolve(); + }); + + return store; +} + +describe('useAccountSyncing', () => { + beforeEach(() => { + jest.clearAllMocks(); + }); + + function arrangeHook() { + const store = arrangeStore(); + const hook = renderHook(() => useAccountSyncing(), { + wrapper: ({ children }) => {children}, + }); + + return hook; + } + + function arrangeActions() { + const syncInternalAccountsWithUserStorageAction = jest + .spyOn(Actions, 'syncInternalAccountsWithUserStorage') + .mockResolvedValue(undefined); + + return { + syncInternalAccountsWithUserStorageAction, + }; + } + + it('dispatches account syncing and error as undefined', async () => { + const mockActions = arrangeActions(); + + const { result } = arrangeHook(); + await act(async () => { + await result.current.dispatchAccountSyncing(); + }); + + expect( + mockActions.syncInternalAccountsWithUserStorageAction, + ).toHaveBeenCalledTimes(1); + expect(result.current.error).toBeUndefined(); + }); + + it('sets error message when syncInternalAccountsWithUserStorageAction returns an error', async () => { + const mockActions = arrangeActions(); + mockActions.syncInternalAccountsWithUserStorageAction.mockRejectedValueOnce( + new Error('MOCK - failed to sync internal account with user storage'), + ); + + const { result } = arrangeHook(); + await act(async () => { + await result.current.dispatchAccountSyncing(); + }); + + expect( + mockActions.syncInternalAccountsWithUserStorageAction, + ).toHaveBeenCalledTimes(1); + expect(result.current.error).toBeDefined(); + expect(result.current.error).toEqual( + 'MOCK - failed to sync internal account with user storage', + ); + }); + + it('sets error message when an error occurs during dispatchAccountSyncing', async () => { + const mockActions = arrangeActions(); + mockActions.syncInternalAccountsWithUserStorageAction.mockRejectedValueOnce( + new Error('MOCK - failed to sync internal account with user storage'), + ); + + const { result } = arrangeHook(); + await act(async () => { + await result.current.dispatchAccountSyncing(); + }); + + expect(result.current.error).toBeDefined(); + expect(result.current.error).toEqual( + 'MOCK - failed to sync internal account with user storage', + ); + }); +}); diff --git a/app/util/notifications/hooks/useAccountSyncing.ts b/app/util/notifications/hooks/useAccountSyncing.ts new file mode 100644 index 00000000000..7c309e81deb --- /dev/null +++ b/app/util/notifications/hooks/useAccountSyncing.ts @@ -0,0 +1,32 @@ +import { useState, useCallback } from 'react'; +import { getErrorMessage } from '../../../util/errorHandling'; +import { syncInternalAccountsWithUserStorage as syncInternalAccountsWithUserStorageAction } from '../../../actions/notification/helpers'; + +/** + * Custom hook to dispatch account syncing. + * + * @returns An object containing the `dispatchAccountSyncing` function, and error state. + */ +export const useAccountSyncing = () => { + const [error, setError] = useState(); + + const dispatchAccountSyncing = useCallback(async () => { + setError(undefined); + try { + const errorMessage = await syncInternalAccountsWithUserStorageAction(); + if (errorMessage) { + setError(getErrorMessage(errorMessage)); + return errorMessage; + } + } catch (e) { + const errorMessage = getErrorMessage(e); + setError(errorMessage); + return errorMessage; + } + }, []); + + return { + dispatchAccountSyncing, + error, + }; +}; diff --git a/app/util/notifications/hooks/useProfileSyncing.test.tsx b/app/util/notifications/hooks/useProfileSyncing.test.tsx index 0215f955430..3e9885dd8ef 100644 --- a/app/util/notifications/hooks/useProfileSyncing.test.tsx +++ b/app/util/notifications/hooks/useProfileSyncing.test.tsx @@ -9,7 +9,7 @@ import { Provider } from 'react-redux'; import createMockStore from 'redux-mock-store'; import * as Actions from '../../../actions/notification/helpers'; import initialRootState from '../../../util/test/initial-root-state'; -import { useAccountSyncing, useProfileSyncing } from './useProfileSyncing'; +import { useProfileSyncing } from './useProfileSyncing'; function arrangeStore() { const store = createMockStore()(initialRootState); @@ -172,79 +172,3 @@ describe('useDisableProfileSyncing', () => { ); }); }); - -describe('useAccountSyncing', () => { - beforeEach(() => { - jest.clearAllMocks(); - }); - - function arrangeHook() { - const store = arrangeStore(); - const hook = renderHook(() => useAccountSyncing(), { - wrapper: ({ children }) => {children}, - }); - - return hook; - } - - function arrangeActions() { - const syncInternalAccountsWithUserStorageAction = jest - .spyOn(Actions, 'syncInternalAccountsWithUserStorage') - .mockResolvedValue(undefined); - - return { - syncInternalAccountsWithUserStorageAction, - }; - } - - it('dispatches account syncing and error as undefined', async () => { - const mockActions = arrangeActions(); - - const { result } = arrangeHook(); - await act(async () => { - await result.current.dispatchAccountSyncing(); - }); - - expect( - mockActions.syncInternalAccountsWithUserStorageAction, - ).toHaveBeenCalledTimes(1); - expect(result.current.error).toBeUndefined(); - }); - - it('sets error message when syncInternalAccountsWithUserStorageAction returns an error', async () => { - const mockActions = arrangeActions(); - mockActions.syncInternalAccountsWithUserStorageAction.mockRejectedValueOnce( - new Error('MOCK - failed to sync internal account with user storage'), - ); - - const { result } = arrangeHook(); - await act(async () => { - await result.current.dispatchAccountSyncing(); - }); - - expect( - mockActions.syncInternalAccountsWithUserStorageAction, - ).toHaveBeenCalledTimes(1); - expect(result.current.error).toBeDefined(); - expect(result.current.error).toEqual( - 'MOCK - failed to sync internal account with user storage', - ); - }); - - it('sets error message when an error occurs during dispatchAccountSyncing', async () => { - const mockActions = arrangeActions(); - mockActions.syncInternalAccountsWithUserStorageAction.mockRejectedValueOnce( - new Error('MOCK - failed to sync internal account with user storage'), - ); - - const { result } = arrangeHook(); - await act(async () => { - await result.current.dispatchAccountSyncing(); - }); - - expect(result.current.error).toBeDefined(); - expect(result.current.error).toEqual( - 'MOCK - failed to sync internal account with user storage', - ); - }); -}); diff --git a/app/util/notifications/hooks/useProfileSyncing.ts b/app/util/notifications/hooks/useProfileSyncing.ts index f75678b6893..5f0d742dd22 100644 --- a/app/util/notifications/hooks/useProfileSyncing.ts +++ b/app/util/notifications/hooks/useProfileSyncing.ts @@ -1,11 +1,9 @@ -/* eslint-disable import/prefer-default-export */ import { useState, useCallback } from 'react'; import { ProfileSyncingReturn } from './types'; import { getErrorMessage } from '../../../util/errorHandling'; import { disableProfileSyncing as disableProfileSyncingAction, enableProfileSyncing as enableProfileSyncingAction, - syncInternalAccountsWithUserStorage as syncInternalAccountsWithUserStorageAction, } from '../../../actions/notification/helpers'; /** @@ -57,32 +55,3 @@ export function useProfileSyncing(): ProfileSyncingReturn { return { enableProfileSyncing, disableProfileSyncing, loading, error }; } - -/** - * Custom hook to dispatch account syncing. - * - * @returns An object containing the `dispatchAccountSyncing` function, and error state. - */ -export const useAccountSyncing = () => { - const [error, setError] = useState(); - - const dispatchAccountSyncing = useCallback(async () => { - setError(undefined); - try { - const errorMessage = await syncInternalAccountsWithUserStorageAction(); - if (errorMessage) { - setError(getErrorMessage(errorMessage)); - return errorMessage; - } - } catch (e) { - const errorMessage = getErrorMessage(e); - setError(errorMessage); - return errorMessage; - } - }, []); - - return { - dispatchAccountSyncing, - error, - }; -}; From 250f1e97dd08f1007c9fa70186be422128769d01 Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Thu, 17 Oct 2024 10:48:47 +0200 Subject: [PATCH 32/49] fix: add tests --- app/components/Views/Wallet/index.test.tsx | 41 +++++++++++++++++++++- app/components/Views/Wallet/index.tsx | 2 +- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/app/components/Views/Wallet/index.test.tsx b/app/components/Views/Wallet/index.test.tsx index 9b008db9496..a269270ff5c 100644 --- a/app/components/Views/Wallet/index.test.tsx +++ b/app/components/Views/Wallet/index.test.tsx @@ -1,13 +1,15 @@ import React from 'react'; import Wallet from './'; import { renderScreen } from '../../../util/test/renderWithProvider'; -import { screen } from '@testing-library/react-native'; +import { act, screen } from '@testing-library/react-native'; import ScrollableTabView from 'react-native-scrollable-tab-view'; import Routes from '../../../constants/navigation/Routes'; import { backgroundState } from '../../../util/test/initial-root-state'; import { createMockAccountsControllerState } from '../../../util/test/accountsControllerTestUtils'; import { WalletViewSelectorsIDs } from '../../../../e2e/selectors/wallet/WalletView.selectors'; import { CommonSelectorsIDs } from '../../../../e2e/selectors/Common.selectors'; +import { useAccountSyncing } from '../../../util/notifications/hooks/useAccountSyncing'; +import { AppState } from 'react-native'; const MOCK_ADDRESS = '0xc4955c0d639d99699bfd7ec54d9fafee40e4d272'; @@ -108,6 +110,13 @@ jest.mock('react-native-scrollable-tab-view', () => { return ScrollableTabViewMock; }); +jest.mock('../../../util/notifications/hooks/useAccountSyncing', () => ({ + useAccountSyncing: jest.fn().mockReturnValue({ + dispatchAccountSyncing: jest.fn(), + error: undefined, + }), +})); + const render = (Component: React.ComponentType) => renderScreen( Component, @@ -144,4 +153,34 @@ describe('Wallet', () => { const foxIcon = screen.getByTestId(CommonSelectorsIDs.FOX_ICON); expect(foxIcon).toBeDefined(); }); + it('should dispatch account syncing on mount', () => { + jest.clearAllMocks(); + //@ts-expect-error we are ignoring the navigation params on purpose because we do not want to mock setOptions to test the navbar + render(Wallet); + expect(useAccountSyncing().dispatchAccountSyncing).toHaveBeenCalledTimes(1); + }); + it('should dispatch account syncing when appState switches from inactive|background to active', () => { + jest.clearAllMocks(); + const addEventListener = jest.spyOn(AppState, 'addEventListener'); + + //@ts-expect-error we are ignoring the navigation params on purpose because we do not want to mock setOptions to test the navbar + render(Wallet); + + expect(addEventListener).toHaveBeenCalledTimes(1); + + const handleAppStateChange = addEventListener.mock.calls[0][1]; + act(() => { + handleAppStateChange('background'); + handleAppStateChange('active'); + }); + + expect(useAccountSyncing().dispatchAccountSyncing).toHaveBeenCalledTimes(2); + + act(() => { + handleAppStateChange('inactive'); + handleAppStateChange('active'); + }); + + expect(useAccountSyncing().dispatchAccountSyncing).toHaveBeenCalledTimes(3); + }); }); diff --git a/app/components/Views/Wallet/index.tsx b/app/components/Views/Wallet/index.tsx index f1039012e19..dbc4a3f2907 100644 --- a/app/components/Views/Wallet/index.tsx +++ b/app/components/Views/Wallet/index.tsx @@ -452,7 +452,7 @@ const Wallet = ({ useLayoutEffect(() => { const handleAppStateChange = (nextAppState: AppStateStatus) => { if ( - appState.current.match(/inactive|background/) && + appState.current?.match(/inactive|background/) && nextAppState === 'active' ) { listNotifications(); From 3885490f9b11547e3e818e3d9b56d096038d4d31 Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Thu, 17 Oct 2024 11:05:12 +0200 Subject: [PATCH 33/49] feat: use new event builder --- app/core/Engine.ts | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/app/core/Engine.ts b/app/core/Engine.ts index d579952dcde..a3dd3117f30 100644 --- a/app/core/Engine.ts +++ b/app/core/Engine.ts @@ -252,6 +252,7 @@ import { HandleSnapRequestArgs } from './Snaps/types'; import { handleSnapRequest } from './Snaps/utils'; ///: END:ONLY_INCLUDE_IF import { trace } from '../util/trace'; +import { MetricsEventBuilder } from './Analytics/MetricsEventBuilder'; const NON_EMPTY = 'NON_EMPTY'; @@ -515,7 +516,7 @@ class Engine { showApprovalRequest: () => undefined, typesExcludedFromRateLimiting: [ ApprovalType.Transaction, - ApprovalType.WatchAsset + ApprovalType.WatchAsset, ], }); @@ -1220,18 +1221,24 @@ class Engine { accountSyncing: { onAccountAdded: (profileId) => { MetaMetrics.getInstance().trackEvent( - MetaMetricsEvents.ACCOUNTS_SYNC_ADDED, - { - profile_id: profileId, - }, + MetricsEventBuilder.createEventBuilder( + MetaMetricsEvents.ACCOUNTS_SYNC_ADDED, + ) + .addProperties({ + profile_id: profileId, + }) + .build(), ); }, onAccountNameUpdated: (profileId) => { MetaMetrics.getInstance().trackEvent( - MetaMetricsEvents.ACCOUNTS_SYNC_NAME_UPDATED, - { - profile_id: profileId, - }, + MetricsEventBuilder.createEventBuilder( + MetaMetricsEvents.ACCOUNTS_SYNC_NAME_UPDATED, + ) + .addProperties({ + profile_id: profileId, + }) + .build(), ); }, }, From 9ca93bade142aea5feb54f625d708719b10dc2bf Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Thu, 17 Oct 2024 11:09:16 +0200 Subject: [PATCH 34/49] fix: formatting --- app/components/Views/Wallet/index.test.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/components/Views/Wallet/index.test.tsx b/app/components/Views/Wallet/index.test.tsx index a269270ff5c..a02e454084c 100644 --- a/app/components/Views/Wallet/index.test.tsx +++ b/app/components/Views/Wallet/index.test.tsx @@ -161,6 +161,7 @@ describe('Wallet', () => { }); it('should dispatch account syncing when appState switches from inactive|background to active', () => { jest.clearAllMocks(); + const addEventListener = jest.spyOn(AppState, 'addEventListener'); //@ts-expect-error we are ignoring the navigation params on purpose because we do not want to mock setOptions to test the navbar @@ -169,6 +170,7 @@ describe('Wallet', () => { expect(addEventListener).toHaveBeenCalledTimes(1); const handleAppStateChange = addEventListener.mock.calls[0][1]; + act(() => { handleAppStateChange('background'); handleAppStateChange('active'); From d718861ec95e225cc0fe1027b607216c5125082e Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Fri, 18 Oct 2024 07:14:52 +0200 Subject: [PATCH 35/49] fix: PR feedbacks --- app/components/Views/Wallet/index.test.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/components/Views/Wallet/index.test.tsx b/app/components/Views/Wallet/index.test.tsx index a02e454084c..87ef6fe0502 100644 --- a/app/components/Views/Wallet/index.test.tsx +++ b/app/components/Views/Wallet/index.test.tsx @@ -153,13 +153,13 @@ describe('Wallet', () => { const foxIcon = screen.getByTestId(CommonSelectorsIDs.FOX_ICON); expect(foxIcon).toBeDefined(); }); - it('should dispatch account syncing on mount', () => { + it('dispatches account syncing on mount', () => { jest.clearAllMocks(); //@ts-expect-error we are ignoring the navigation params on purpose because we do not want to mock setOptions to test the navbar render(Wallet); expect(useAccountSyncing().dispatchAccountSyncing).toHaveBeenCalledTimes(1); }); - it('should dispatch account syncing when appState switches from inactive|background to active', () => { + it('dispatches account syncing when appState switches from inactive|background to active', () => { jest.clearAllMocks(); const addEventListener = jest.spyOn(AppState, 'addEventListener'); @@ -167,9 +167,13 @@ describe('Wallet', () => { //@ts-expect-error we are ignoring the navigation params on purpose because we do not want to mock setOptions to test the navbar render(Wallet); - expect(addEventListener).toHaveBeenCalledTimes(1); - - const handleAppStateChange = addEventListener.mock.calls[0][1]; + expect(addEventListener).toHaveBeenCalledWith( + 'change', + expect.any(Function), + ); + const handleAppStateChange = ( + addEventListener as jest.Mock + ).mock.calls.find(([event]) => event === 'change')[1]; act(() => { handleAppStateChange('background'); From e4cd362650f61cac663ee1a9080fbc7a56799f70 Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Fri, 18 Oct 2024 07:28:07 +0200 Subject: [PATCH 36/49] fix: update yarn.lock --- yarn.lock | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/yarn.lock b/yarn.lock index e3debb18393..e15fed634e4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4294,7 +4294,25 @@ "@metamask/superstruct" "^3.1.0" "@metamask/utils" "^9.0.0" -"@metamask/accounts-controller@^17.0.0", "@metamask/accounts-controller@^17.2.0", "@metamask/accounts-controller@^18.1.0", "@metamask/accounts-controller@^18.2.1": +"@metamask/accounts-controller@^17.0.0", "@metamask/accounts-controller@^17.2.0": + version "17.2.0" + resolved "https://registry.yarnpkg.com/@metamask/accounts-controller/-/accounts-controller-17.2.0.tgz#b74918444a9d8e6e69b9b761dc58e64aac6b466c" + integrity sha512-hfdfRV7mxxnyG1tri3CatV63WWtwPkUSl0zTz7Mq3psSXqOFr+08f1Elw4sX7pP1V/rCxZKeotoluIjUeu1Q9Q== + dependencies: + "@ethereumjs/util" "^8.1.0" + "@metamask/base-controller" "^6.0.0" + "@metamask/eth-snap-keyring" "^4.3.1" + "@metamask/keyring-api" "^8.0.0" + "@metamask/keyring-controller" "^17.1.0" + "@metamask/snaps-sdk" "^4.2.0" + "@metamask/snaps-utils" "^7.4.0" + "@metamask/utils" "^8.3.0" + deepmerge "^4.2.2" + ethereum-cryptography "^2.1.2" + immer "^9.0.6" + uuid "^8.3.2" + +"@metamask/accounts-controller@^18.2.1": version "18.2.1" resolved "https://registry.yarnpkg.com/@metamask/accounts-controller/-/accounts-controller-18.2.1.tgz#8e4a842316e9b7bbd0409b36129f7123ba4a4c79" integrity sha512-BEvux+ZFpTOQa6HbRl7i7Tq24ztqrZIsX+H0ePh47lU+N8RWq1q0JCItV+zbsgdcYnwhtcMZTsp4jJPQwPe2og== @@ -4653,7 +4671,7 @@ ethereum-cryptography "^2.1.2" randombytes "^2.1.0" -"@metamask/eth-snap-keyring@^4.1.1", "@metamask/eth-snap-keyring@^4.3.1", "@metamask/eth-snap-keyring@^4.3.3": +"@metamask/eth-snap-keyring@^4.3.1", "@metamask/eth-snap-keyring@^4.3.3": version "4.3.6" resolved "https://registry.yarnpkg.com/@metamask/eth-snap-keyring/-/eth-snap-keyring-4.3.6.tgz#c010c644575d1d2dd7c47953f6a1392fe17e38d9" integrity sha512-jds0NdBDWM99FnO7WjODnRo+fnRoo11lJZlFS+cIa4ol7TMQmJ0HQdpno7R2LNfweoTioDMQd1LY1mCBq4zXnA== @@ -4832,18 +4850,6 @@ "@noble/hashes" "^1.3.2" "@scure/base" "^1.0.0" -"@metamask/keyring-api@^6.1.1": - version "6.4.0" - resolved "https://registry.yarnpkg.com/@metamask/keyring-api/-/keyring-api-6.4.0.tgz#8d8f0adfdddeac84ac55993c3ba424e2171d4bfe" - integrity sha512-JGkW7WCQ+M9lQXl5nAe49AaNmbK8HE6x/RupFL8Z5o8E4IVIeQbqEv+lW/Y5RBq0ekToHrxehlR/jDvL1iT8pg== - dependencies: - "@metamask/snaps-sdk" "^4.2.0" - "@metamask/utils" "^8.4.0" - "@types/uuid" "^9.0.8" - bech32 "^2.0.0" - superstruct "^1.0.3" - uuid "^9.0.1" - "@metamask/keyring-api@^8.0.0", "@metamask/keyring-api@^8.1.0", "@metamask/keyring-api@^8.1.3": version "8.1.3" resolved "https://registry.yarnpkg.com/@metamask/keyring-api/-/keyring-api-8.1.3.tgz#53e6a68236b88592db5bd43cf7e0d7e97dfad818" @@ -5638,7 +5644,7 @@ semver "^7.3.8" superstruct "^1.0.3" -"@metamask/utils@^8.1.0", "@metamask/utils@^8.2.0", "@metamask/utils@^8.3.0", "@metamask/utils@^8.4.0": +"@metamask/utils@^8.1.0", "@metamask/utils@^8.2.0", "@metamask/utils@^8.3.0": version "8.5.0" resolved "https://registry.yarnpkg.com/@metamask/utils/-/utils-8.5.0.tgz#ddd0d4012d5191809404c97648a837ea9962cceb" integrity sha512-I6bkduevXb72TIM9q2LRO63JSsF9EXduh3sBr9oybNX2hNNpr/j1tEjXrsG0Uabm4MJ1xkGAQEMwifvKZIkyxQ== From e3147a889dbf9408ce90286d0506663aa24058e1 Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Wed, 23 Oct 2024 18:30:31 +0200 Subject: [PATCH 37/49] feat: (WIP) add first E2E tests --- e2e/fixtures/fixture-builder.js | 2 + .../notifications/account-syncing/mockData.js | 12 + .../sync-after-onboarding.spec.js | 54 ++++ e2e/specs/notifications/constants.js | 7 + e2e/specs/notifications/mocks.js | 79 +++++ .../userStorageMockttpController.test.ts | 304 ++++++++++++++++++ .../userStorageMockttpController.ts | 196 +++++++++++ e2e/viewHelper.js | 10 +- yarn.lock | 22 +- 9 files changed, 680 insertions(+), 6 deletions(-) create mode 100644 e2e/specs/notifications/account-syncing/mockData.js create mode 100644 e2e/specs/notifications/account-syncing/sync-after-onboarding.spec.js create mode 100644 e2e/specs/notifications/constants.js create mode 100644 e2e/specs/notifications/mocks.js create mode 100644 e2e/utils/user-storage/userStorageMockttpController.test.ts create mode 100644 e2e/utils/user-storage/userStorageMockttpController.ts diff --git a/e2e/fixtures/fixture-builder.js b/e2e/fixtures/fixture-builder.js index c4e987b3f01..4796212b349 100644 --- a/e2e/fixtures/fixture-builder.js +++ b/e2e/fixtures/fixture-builder.js @@ -421,6 +421,8 @@ class FixtureBuilder { pendingApprovalCount: 0, approvalFlows: [], }, + NotificationServicesController: {}, + UserStorageController: {}, }, }, privacy: { diff --git a/e2e/specs/notifications/account-syncing/mockData.js b/e2e/specs/notifications/account-syncing/mockData.js new file mode 100644 index 00000000000..96e92ecd849 --- /dev/null +++ b/e2e/specs/notifications/account-syncing/mockData.js @@ -0,0 +1,12 @@ +export const accountsSyncMockResponse = [ + { + HashedKey: + '997050281e559a2bb40d1c2e73d9f0887cbea1b81ff9dd7815917949e37f4f2f', + Data: '{"v":"1","t":"scrypt","d":"1yC/ZXarV57HbqEZ46nH0JWgXfPl86nTHD7kai2g5gm290FM9tw5QjOaAAwIuQESEE8TIM/J9pIj7nmlGi+BZrevTtK3DXWXwnUQsCP7amKd5Q4gs3EEQgXpA0W+WJUgyElj869rwIv/C6tl5E2pK4j/0EAjMSIm1TGoj9FPohyRgZsOIt8VhZfb7w0GODsjPwPIkN6zazvJ3gAFYFPh7yRtebFs86z3fzqCWZ9zakdCHntchC2oZiaApXR9yzaPlGgnPg==","o":{"N":131072,"r":8,"p":1,"dkLen":16},"saltLen":16}', + }, + { + HashedKey: + 'e53d8feb65b4cf0c339e57bee2a81b155e056622f9192c54b707f928c8a42a7a', + Data: '{"v":"1","t":"scrypt","d":"O7QEtUo7q/jG+UNkD/HOxQARGGRXsGPrLsDlkwDfgfoYlPI0To/M3pJRBlKD0RLEFIPHtHBEA5bv/2izB21VljvhMnhHfo0KgQ+e8Uq1t7grwa+r+ge3qbPNY+w78Xt8GtC+Hkrw5fORKvCn+xjzaCHYV6RxKYbp1TpyCJq7hDrr1XiyL8kqbpE0hAHALrrQOoV9/WXJi9pC5J118kquXx8CNA1P5wO/BXKp1AbryGR6kVW3lsp1sy3lYE/TApa5lTj+","o":{"N":131072,"r":8,"p":1,"dkLen":16},"saltLen":16}', + }, +]; diff --git a/e2e/specs/notifications/account-syncing/sync-after-onboarding.spec.js b/e2e/specs/notifications/account-syncing/sync-after-onboarding.spec.js new file mode 100644 index 00000000000..bbfdacaf1e2 --- /dev/null +++ b/e2e/specs/notifications/account-syncing/sync-after-onboarding.spec.js @@ -0,0 +1,54 @@ +import { + withFixtures, + defaultGanacheOptions, + startFixtureServer, + loadFixture, +} from '../../../fixtures/fixture-helper'; +import FixtureBuilder from '../../../fixtures/fixture-builder'; +import { mockNotificationServices } from '../mocks'; +import { + NOTIFICATIONS_TEAM_PASSWORD, + NOTIFICATIONS_TEAM_SEED_PHRASE, +} from '../constants'; +import { + startMockServer, + stopMockServer, +} from '../../../mockServer/mockServer'; +import { UserStorageMockttpController } from '../../../utils/user-storage/userStorageMockttpController'; +import { accountsSyncMockResponse } from './mockData'; +import { importWalletWithRecoveryPhrase } from '../../../viewHelper'; +import TestHelpers from '../../../helpers'; +import FixtureServer from '../../../fixtures/fixture-server'; +import { getFixturesServerPort } from '../../../fixtures/utils'; + +describe('Account syncing', () => { + it('retrieves all previously synced accounts', async () => { + // const fixtureServer = new FixtureServer(); + const userStorageMockttpController = new UserStorageMockttpController(); + + // await TestHelpers.reverseServerPort(); + // const fixture = new FixtureBuilder().withGanacheNetwork().build(); + // await startFixtureServer(fixtureServer); + // await loadFixture(fixtureServer, { fixture }); + + // const mockServer = await startMockServer({ + // // Configure mock server + // mockUrl: 'https://user-storage.api.cx.metamask.io/api/v1/userstorage', + // }); + + // userStorageMockttpController.setupPath('accounts', mockServer, { + // getResponse: accountsSyncMockResponse, + // }); + + // mockNotificationServices(mockServer, userStorageMockttpController); + + jest.setTimeout(200000); + + await device.launchApp(); + + await importWalletWithRecoveryPhrase( + NOTIFICATIONS_TEAM_SEED_PHRASE, + NOTIFICATIONS_TEAM_PASSWORD, + ); + }); +}); diff --git a/e2e/specs/notifications/constants.js b/e2e/specs/notifications/constants.js new file mode 100644 index 00000000000..8c611dcd4f4 --- /dev/null +++ b/e2e/specs/notifications/constants.js @@ -0,0 +1,7 @@ +// As we rely on profile syncing for most of our features, we need to use the same SRP for all of our tests +export const NOTIFICATIONS_TEAM_SEED_PHRASE = + 'leisure swallow trip elbow prison wait rely keep supply hole general mountain'; +export const NOTIFICATIONS_TEAM_PASSWORD = 'notify_password'; +// You can use the storage key below to generate mock data +export const NOTIFICATIONS_TEAM_STORAGE_KEY = + '0d55d30da233959674d14076737198c05ae3fb8631a17e20d3c28c60dddd82f7'; diff --git a/e2e/specs/notifications/mocks.js b/e2e/specs/notifications/mocks.js new file mode 100644 index 00000000000..78205e1b019 --- /dev/null +++ b/e2e/specs/notifications/mocks.js @@ -0,0 +1,79 @@ +import { Mockttp, RequestRuleBuilder } from 'mockttp'; +import { AuthenticationController } from '@metamask/profile-sync-controller'; +import { + NotificationServicesController, + NotificationServicesPushController, +} from '@metamask/notification-services-controller'; +import { UserStorageMockttpController } from '../../utils/user-storage/userStorageMockttpController'; + +const AuthMocks = AuthenticationController.Mocks; +const NotificationMocks = NotificationServicesController.Mocks; +const PushMocks = NotificationServicesPushController.Mocks; + +/** + * E2E mock setup for notification APIs (Auth, UserStorage, Notifications, Push Notifications, Profile syncing) + * + * @param server - server obj used to mock our endpoints + * @param userStorageMockttpController - optional controller to mock user storage endpoints + */ +export async function mockNotificationServices( + server, + userStorageMockttpController, +) { + // Auth + mockAPICall(server, AuthMocks.getMockAuthNonceResponse()); + mockAPICall(server, AuthMocks.getMockAuthLoginResponse()); + mockAPICall(server, AuthMocks.getMockAuthAccessTokenResponse()); + + // Storage + if (!userStorageMockttpController?.paths.get('accounts')) { + new UserStorageMockttpController().setupPath('accounts', server); + } + if (!userStorageMockttpController?.paths.get('networks')) { + new UserStorageMockttpController().setupPath('networks', server); + } + if (!userStorageMockttpController?.paths.get('notifications')) { + new UserStorageMockttpController().setupPath('notifications', server); + } + + // Notifications + mockAPICall(server, NotificationMocks.getMockFeatureAnnouncementResponse()); + mockAPICall(server, NotificationMocks.getMockBatchCreateTriggersResponse()); + mockAPICall(server, NotificationMocks.getMockBatchDeleteTriggersResponse()); + mockAPICall(server, NotificationMocks.getMockListNotificationsResponse()); + mockAPICall( + server, + NotificationMocks.getMockMarkNotificationsAsReadResponse(), + ); + + // Push Notifications + mockAPICall(server, PushMocks.getMockRetrievePushNotificationLinksResponse()); + mockAPICall(server, PushMocks.getMockUpdatePushNotificationLinksResponse()); + mockAPICall(server, PushMocks.getMockCreateFCMRegistrationTokenResponse()); + mockAPICall(server, PushMocks.getMockDeleteFCMRegistrationTokenResponse()); +} + +function mockAPICall(server, response) { + let requestRuleBuilder; + + if (response.requestMethod === 'GET') { + requestRuleBuilder = server.forGet(response.url); + } + + if (response.requestMethod === 'POST') { + requestRuleBuilder = server.forPost(response.url); + } + + if (response.requestMethod === 'PUT') { + requestRuleBuilder = server.forPut(response.url); + } + + if (response.requestMethod === 'DELETE') { + requestRuleBuilder = server.forDelete(response.url); + } + + requestRuleBuilder?.thenCallback(() => ({ + statusCode: 200, + json: response.response, + })); +} diff --git a/e2e/utils/user-storage/userStorageMockttpController.test.ts b/e2e/utils/user-storage/userStorageMockttpController.test.ts new file mode 100644 index 00000000000..1b6591899c0 --- /dev/null +++ b/e2e/utils/user-storage/userStorageMockttpController.test.ts @@ -0,0 +1,304 @@ +import * as mockttp from 'mockttp'; +import { UserStorageMockttpController } from './userStorageMockttpController'; + +describe('UserStorageMockttpController', () => { + let mockServer: mockttp.Mockttp; + + const baseUrl = 'https://user-storage.api.cx.metamask.io/api/v1/userstorage'; + + describe('mimics user storage behaviour', () => { + mockServer = mockttp.getLocal({ cors: true }); + + it('handles GET requests that have empty response', async () => { + const controller = new UserStorageMockttpController(); + + controller.setupPath('accounts', mockServer); + + const request = await controller.onGet('accounts', { + path: `${baseUrl}/accounts`, + }); + + expect(request.json).toEqual(null); + }); + + it('handles GET requests that have a pre-defined response', async () => { + const controller = new UserStorageMockttpController(); + const mockedData = [ + { + HashedKey: + '7f8a7963423985c50f75f6ad42a6cf4e7eac43a6c55e3c6fcd49d73f01c1471b', + Data: 'data1', + }, + { + HashedKey: + 'c236b92ea7d513b2beda062cb546986961dfa7ca4334a2913f7837e43d050468', + Data: 'data2', + }, + ]; + + controller.setupPath('accounts', mockServer, { + getResponse: mockedData, + }); + + const request = await controller.onGet('accounts', { + path: `${baseUrl}/accounts`, + }); + + expect(request.json).toEqual(mockedData); + }); + + it('handles batch GET requests', async () => { + const controller = new UserStorageMockttpController(); + const mockedData = [ + { + HashedKey: + '7f8a7963423985c50f75f6ad42a6cf4e7eac43a6c55e3c6fcd49d73f01c1471b', + Data: 'data1', + }, + { + HashedKey: + 'c236b92ea7d513b2beda062cb546986961dfa7ca4334a2913f7837e43d050468', + Data: 'data2', + }, + ]; + + controller.setupPath('accounts', mockServer, { + getResponse: mockedData, + }); + + const request = await controller.onGet('accounts', { + path: `${baseUrl}/accounts`, + }); + + expect(request.json).toEqual(mockedData); + }); + + it('handles GET requests for feature entries', async () => { + const controller = new UserStorageMockttpController(); + const mockedData = [ + { + HashedKey: + '7f8a7963423985c50f75f6ad42a6cf4e7eac43a6c55e3c6fcd49d73f01c1471b', + Data: 'data1', + }, + { + HashedKey: + 'c236b92ea7d513b2beda062cb546986961dfa7ca4334a2913f7837e43d050468', + Data: 'data2', + }, + ]; + + controller.setupPath('accounts', mockServer, { + getResponse: mockedData, + }); + + const request = await controller.onGet('accounts', { + path: `${baseUrl}/accounts/7f8a7963423985c50f75f6ad42a6cf4e7eac43a6c55e3c6fcd49d73f01c1471b`, + }); + + expect(request.json).toEqual(mockedData[0]); + }); + + it('handles PUT requests to create new entries', async () => { + const controller = new UserStorageMockttpController(); + const mockedData = [ + { + HashedKey: + '7f8a7963423985c50f75f6ad42a6cf4e7eac43a6c55e3c6fcd49d73f01c1471b', + Data: 'data1', + }, + { + HashedKey: + 'c236b92ea7d513b2beda062cb546986961dfa7ca4334a2913f7837e43d050468', + Data: 'data2', + }, + ]; + const mockedAddedData = { + HashedKey: + '6afbe024087495b4e0d56c4bdfc981c84eba44a7c284d4f455b5db4fcabc2173', + Data: 'data3', + }; + + controller.setupPath('accounts', mockServer, { + getResponse: mockedData, + }); + + const putRequest = await controller.onPut('accounts', { + path: `${baseUrl}/accounts/6afbe024087495b4e0d56c4bdfc981c84eba44a7c284d4f455b5db4fcabc2173`, + body: { + getJson: async () => ({ + data: mockedAddedData.Data, + }), + } as unknown as mockttp.CompletedBody, + }); + + expect(putRequest.statusCode).toEqual(204); + + const getRequest = await controller.onGet('accounts', { + path: `${baseUrl}/accounts`, + }); + + expect(getRequest.json).toEqual([...mockedData, mockedAddedData]); + }); + + it('handles PUT requests to update existing entries', async () => { + const controller = new UserStorageMockttpController(); + const mockedData = [ + { + HashedKey: + '7f8a7963423985c50f75f6ad42a6cf4e7eac43a6c55e3c6fcd49d73f01c1471b', + Data: 'data1', + }, + { + HashedKey: + 'c236b92ea7d513b2beda062cb546986961dfa7ca4334a2913f7837e43d050468', + Data: 'data2', + }, + ]; + const mockedUpdatedData = { + HashedKey: + 'c236b92ea7d513b2beda062cb546986961dfa7ca4334a2913f7837e43d050468', + Data: 'data3', + }; + + controller.setupPath('accounts', mockServer, { + getResponse: mockedData, + }); + + const putRequest = await controller.onPut('accounts', { + path: `${baseUrl}/accounts/c236b92ea7d513b2beda062cb546986961dfa7ca4334a2913f7837e43d050468`, + body: { + getJson: async () => ({ + data: mockedUpdatedData.Data, + }), + } as unknown as mockttp.CompletedBody, + }); + + expect(putRequest.statusCode).toEqual(204); + + const getRequest = await controller.onGet('accounts', { + path: `${baseUrl}/accounts`, + }); + + expect(getRequest.json).toEqual([mockedData[0], mockedUpdatedData]); + }); + + it('handles batch PUT requests', async () => { + const controller = new UserStorageMockttpController(); + const mockedData = [ + { + HashedKey: + '7f8a7963423985c50f75f6ad42a6cf4e7eac43a6c55e3c6fcd49d73f01c1471b', + Data: 'data1', + }, + { + HashedKey: + 'c236b92ea7d513b2beda062cb546986961dfa7ca4334a2913f7837e43d050468', + Data: 'data2', + }, + ]; + const mockedUpdatedData = [ + { + HashedKey: + '7f8a7963423985c50f75f6ad42a6cf4e7eac43a6c55e3c6fcd49d73f01c1471b', + Data: 'data3', + }, + { + HashedKey: + 'c236b92ea7d513b2beda062cb546986961dfa7ca4334a2913f7837e43d050468', + Data: 'data4', + }, + ]; + + controller.setupPath('accounts', mockServer, { + getResponse: mockedData, + }); + + const putData = {} as { [key: string]: string }; + mockedUpdatedData.forEach((entry) => { + putData[entry.HashedKey] = entry.Data; + }); + + const putRequest = await controller.onPut('accounts', { + path: `${baseUrl}/accounts`, + body: { + getJson: async () => ({ + data: putData, + }), + } as unknown as mockttp.CompletedBody, + }); + + expect(putRequest.statusCode).toEqual(204); + + const getRequest = await controller.onGet('accounts', { + path: `${baseUrl}/accounts`, + }); + + expect(getRequest.json).toEqual(mockedUpdatedData); + }); + + it('handles DELETE requests', async () => { + const controller = new UserStorageMockttpController(); + const mockedData = [ + { + HashedKey: + '7f8a7963423985c50f75f6ad42a6cf4e7eac43a6c55e3c6fcd49d73f01c1471b', + Data: 'data1', + }, + { + HashedKey: + 'c236b92ea7d513b2beda062cb546986961dfa7ca4334a2913f7837e43d050468', + Data: 'data2', + }, + ]; + + controller.setupPath('accounts', mockServer, { + getResponse: mockedData, + }); + + const deleteRequest = await controller.onDelete('accounts', { + path: `${baseUrl}/accounts/c236b92ea7d513b2beda062cb546986961dfa7ca4334a2913f7837e43d050468`, + }); + + expect(deleteRequest.statusCode).toEqual(204); + + const getRequest = await controller.onGet('accounts', { + path: `${baseUrl}/accounts`, + }); + + expect(getRequest.json).toEqual([mockedData[0]]); + }); + + it('handles batch DELETE requests', async () => { + const controller = new UserStorageMockttpController(); + const mockedData = [ + { + HashedKey: + '7f8a7963423985c50f75f6ad42a6cf4e7eac43a6c55e3c6fcd49d73f01c1471b', + Data: 'data1', + }, + { + HashedKey: + 'c236b92ea7d513b2beda062cb546986961dfa7ca4334a2913f7837e43d050468', + Data: 'data2', + }, + ]; + + controller.setupPath('accounts', mockServer, { + getResponse: mockedData, + }); + + const deleteRequest = await controller.onDelete('accounts', { + path: `${baseUrl}/accounts`, + }); + + expect(deleteRequest.statusCode).toEqual(204); + + const getRequest = await controller.onGet('accounts', { + path: `${baseUrl}/accounts`, + }); + + expect(getRequest.json).toEqual(null); + }); + }); +}); diff --git a/e2e/utils/user-storage/userStorageMockttpController.ts b/e2e/utils/user-storage/userStorageMockttpController.ts new file mode 100644 index 00000000000..970a10d1112 --- /dev/null +++ b/e2e/utils/user-storage/userStorageMockttpController.ts @@ -0,0 +1,196 @@ +import { CompletedRequest, Mockttp } from 'mockttp'; + +// TODO: Export user storage schema from @metamask/profile-sync-controller +export const pathRegexps = { + accounts: + /https:\/\/user-storage\.api\.cx\.metamask\.io\/api\/v1\/userstorage\/accounts/u, + networks: + /https:\/\/user-storage\.api\.cx\.metamask\.io\/api\/v1\/userstorage\/networks/u, + notifications: + /https:\/\/user-storage\.api\.cx\.metamask\.io\/api\/v1\/userstorage\/notifications/u, +}; + +type UserStorageResponseData = { HashedKey: string; Data: string }; + +const determineIfFeatureEntryFromURL = (url: string) => + url.substring(url.lastIndexOf('userstorage') + 12).split('/').length === 2; + +export class UserStorageMockttpController { + paths: Map< + keyof typeof pathRegexps, + { + response: UserStorageResponseData[]; + server: Mockttp; + } + > = new Map(); + + readonly onGet = async ( + path: keyof typeof pathRegexps, + request: Pick, + statusCode: number = 200, + ) => { + const internalPathData = this.paths.get(path); + + if (!internalPathData) { + return { + statusCode, + json: null, + }; + } + + const isFeatureEntry = determineIfFeatureEntryFromURL(request.path); + + if (isFeatureEntry) { + const json = + internalPathData.response?.find( + (entry) => entry.HashedKey === request.path.split('/').pop(), + ) || null; + + return { + statusCode, + json, + }; + } + + const json = internalPathData?.response.length + ? internalPathData.response + : null; + + return { + statusCode, + json, + }; + }; + + readonly onPut = async ( + path: keyof typeof pathRegexps, + request: Pick, + statusCode: number = 204, + ) => { + const isFeatureEntry = determineIfFeatureEntryFromURL(request.path); + + const data = (await request.body.getJson()) as { + data: string | { [key: string]: string }; + }; + + const newOrUpdatedSingleOrBatchEntries = + isFeatureEntry && typeof data?.data === 'string' + ? [ + { + HashedKey: request.path.split('/').pop() as string, + Data: data?.data, + }, + ] + : Object.entries(data?.data).map(([key, value]) => ({ + HashedKey: key, + Data: value, + })); + + newOrUpdatedSingleOrBatchEntries.forEach((entry) => { + const internalPathData = this.paths.get(path); + + if (!internalPathData) { + return; + } + + const doesThisEntryExist = internalPathData.response?.find( + (existingEntry) => existingEntry.HashedKey === entry.HashedKey, + ); + + if (doesThisEntryExist) { + this.paths.set(path, { + ...internalPathData, + response: internalPathData.response.map((existingEntry) => + existingEntry.HashedKey === entry.HashedKey ? entry : existingEntry, + ), + }); + } else { + this.paths.set(path, { + ...internalPathData, + response: [ + ...(internalPathData?.response || []), + entry as { HashedKey: string; Data: string }, + ], + }); + } + }); + + return { + statusCode, + }; + }; + + readonly onDelete = async ( + path: keyof typeof pathRegexps, + request: Pick, + statusCode: number = 204, + ) => { + const internalPathData = this.paths.get(path); + + if (!internalPathData) { + return { + statusCode, + }; + } + + const isFeatureEntry = determineIfFeatureEntryFromURL(request.path); + + if (isFeatureEntry) { + this.paths.set(path, { + ...internalPathData, + response: internalPathData?.response.filter( + (entry) => entry.HashedKey !== request.path.split('/').pop(), + ), + }); + } else { + this.paths.set(path, { + ...internalPathData, + response: [], + }); + } + + return { + statusCode, + }; + }; + + setupPath = ( + path: keyof typeof pathRegexps, + server: Mockttp, + overrides?: { + getResponse?: UserStorageResponseData[]; + getStatusCode?: number; + putStatusCode?: number; + deleteStatusCode?: number; + }, + ) => { + const previouslySetupPath = this.paths.get(path); + + this.paths.set(path, { + response: overrides?.getResponse || previouslySetupPath?.response || [], + server, + }); + + this.paths + .get(path) + ?.server.forGet(pathRegexps[path]) + .always() + .thenCallback((request) => + this.onGet(path, request, overrides?.getStatusCode), + ); + this.paths + .get(path) + ?.server.forPut(pathRegexps[path]) + .always() + .thenCallback((request) => + this.onPut(path, request, overrides?.putStatusCode), + ); + this.paths + .get(path) + ?.server.forDelete(pathRegexps[path]) + .always() + .thenCallback((request) => + this.onDelete(path, request, overrides?.deleteStatusCode), + ); + }; +} diff --git a/e2e/viewHelper.js b/e2e/viewHelper.js index 3e801885015..bdc10445920 100644 --- a/e2e/viewHelper.js +++ b/e2e/viewHelper.js @@ -87,7 +87,7 @@ export const skipNotificationsDeviceSettings = async () => { } }; -export const importWalletWithRecoveryPhrase = async () => { +export const importWalletWithRecoveryPhrase = async (seedPhrase, password) => { // tap on import seed phrase button await Assertions.checkIfVisible(OnboardingCarouselView.container); await OnboardingCarouselView.tapOnGetStartedButton(); @@ -98,9 +98,11 @@ export const importWalletWithRecoveryPhrase = async () => { await acceptTermOfUse(); // should import wallet with secret recovery phrase await ImportWalletView.clearSecretRecoveryPhraseInputBox(); - await ImportWalletView.enterSecretRecoveryPhrase(validAccount.seedPhrase); - await ImportWalletView.enterPassword(validAccount.password); - await ImportWalletView.reEnterPassword(validAccount.password); + await ImportWalletView.enterSecretRecoveryPhrase( + seedPhrase ?? validAccount.seedPhrase, + ); + await ImportWalletView.enterPassword(password ?? validAccount.password); + await ImportWalletView.reEnterPassword(password ?? validAccount.password); //'Should dismiss Enable device Notifications checks alert' await TestHelpers.delay(3500); diff --git a/yarn.lock b/yarn.lock index 9c0fa37dc9e..f49eb108df3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4294,7 +4294,25 @@ "@metamask/superstruct" "^3.1.0" "@metamask/utils" "^9.0.0" -"@metamask/accounts-controller@^17.2.0", "@metamask/accounts-controller@^18.1.0", "@metamask/accounts-controller@^18.2.1": +"@metamask/accounts-controller@^17.2.0": + version "17.2.0" + resolved "https://registry.yarnpkg.com/@metamask/accounts-controller/-/accounts-controller-17.2.0.tgz#b74918444a9d8e6e69b9b761dc58e64aac6b466c" + integrity sha512-hfdfRV7mxxnyG1tri3CatV63WWtwPkUSl0zTz7Mq3psSXqOFr+08f1Elw4sX7pP1V/rCxZKeotoluIjUeu1Q9Q== + dependencies: + "@ethereumjs/util" "^8.1.0" + "@metamask/base-controller" "^6.0.0" + "@metamask/eth-snap-keyring" "^4.3.1" + "@metamask/keyring-api" "^8.0.0" + "@metamask/keyring-controller" "^17.1.0" + "@metamask/snaps-sdk" "^4.2.0" + "@metamask/snaps-utils" "^7.4.0" + "@metamask/utils" "^8.3.0" + deepmerge "^4.2.2" + ethereum-cryptography "^2.1.2" + immer "^9.0.6" + uuid "^8.3.2" + +"@metamask/accounts-controller@^18.2.1": version "18.2.1" resolved "https://registry.yarnpkg.com/@metamask/accounts-controller/-/accounts-controller-18.2.1.tgz#8e4a842316e9b7bbd0409b36129f7123ba4a4c79" integrity sha512-BEvux+ZFpTOQa6HbRl7i7Tq24ztqrZIsX+H0ePh47lU+N8RWq1q0JCItV+zbsgdcYnwhtcMZTsp4jJPQwPe2og== @@ -5545,7 +5563,7 @@ resolved "https://registry.yarnpkg.com/@metamask/stake-sdk/-/stake-sdk-0.2.13.tgz#368749d698353f1ec9f9119ebc5bf9980582cc2b" integrity sha512-F6JIfiCmQ+6xg9MA2HXJw7MVbEPK5HWy4IkI/2lmb1+tBGnK/9PddhhllNn50aU3Af/T0gPUQtLSVUXErfBHfg== -"@metamask/superstruct@^3.1.0": +"@metamask/superstruct@^3.0.0", "@metamask/superstruct@^3.1.0": version "3.1.0" resolved "https://registry.yarnpkg.com/@metamask/superstruct/-/superstruct-3.1.0.tgz#148f786a674fba3ac885c1093ab718515bf7f648" integrity sha512-N08M56HdOgBfRKkrgCMZvQppkZGcArEop3kixNEtVbJKm6P9Cfg0YkI6X0s1g78sNrj2fWUwvJADdZuzJgFttA== From 84d4e406adac3cc0df5e64fd81af37b04dfa5965 Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Fri, 25 Oct 2024 10:07:58 +0200 Subject: [PATCH 38/49] fix: refine mock system & user storage --- e2e/mockServer/mockServer.js | 32 +++-- ...c-after-adding-custom-name-account.spec.js | 109 ++++++++++++++++++ .../sync-after-onboarding.spec.js | 66 ++++++----- e2e/specs/notifications/mocks.js | 49 ++++---- .../userStorageMockttpController.test.ts | 31 ++--- .../userStorageMockttpController.ts | 62 ++++++---- 6 files changed, 254 insertions(+), 95 deletions(-) create mode 100644 e2e/specs/notifications/account-syncing/sync-after-adding-custom-name-account.spec.js diff --git a/e2e/mockServer/mockServer.js b/e2e/mockServer/mockServer.js index 73c89d97ac8..9b5e64155c6 100644 --- a/e2e/mockServer/mockServer.js +++ b/e2e/mockServer/mockServer.js @@ -2,6 +2,8 @@ import { getLocal } from 'mockttp'; import { defaultMockPort } from './mockUrlCollection'; import portfinder from 'portfinder'; +import { mockNotificationServices } from '../specs/notifications/mocks'; +import { UserStorageMockttpController } from '../utils/user-storage/userStorageMockttpController'; const mockServer = getLocal(); @@ -10,6 +12,9 @@ export const startMockServer = async ({ responseCode = 500, responseBody = {}, port = defaultMockPort, + // overrides = { + // userStorageMockttpController: new UserStorageMockttpController(), + // }, }) => { if (!mockUrl) throw new Error('The mockUrl parameter is required'); await portfinder.setBasePort(port); @@ -26,15 +31,24 @@ export const startMockServer = async ({ .withQuery({ url: mockUrl }) .thenReply(responseCode, JSON.stringify(responseBody)); - await mockServer.forUnmatchedRequest().thenPassThrough({ - beforeRequest: async ({ url, method }) => { - const returnUrl = new URL(url).searchParams.get('url') || url; - const updatedUrl = device.getPlatform() === 'android' ? returnUrl.replace('localhost', '127.0.0.1') : returnUrl; - - console.log(`Mock proxy forwarding request to: ${updatedUrl}`); - return { url: updatedUrl }; - }, - }); + // // Mock all notifications related services (Auth, UserStorage, Notifications, Push Notifications, Profile syncing) + // await mockNotificationServices( + // mockServer, + // overrides?.userStorageMockttpController, + // ); + + await mockServer.forUnmatchedRequest().thenPassThrough({ + beforeRequest: async ({ url, method }) => { + const returnUrl = new URL(url).searchParams.get('url') || url; + const updatedUrl = + device.getPlatform() === 'android' + ? returnUrl.replace('localhost', '127.0.0.1') + : returnUrl; + + console.log(`Mock proxy forwarding request to: ${updatedUrl}`); + return { url: updatedUrl }; + }, + }); return mockServer; }; diff --git a/e2e/specs/notifications/account-syncing/sync-after-adding-custom-name-account.spec.js b/e2e/specs/notifications/account-syncing/sync-after-adding-custom-name-account.spec.js new file mode 100644 index 00000000000..dd811aeead0 --- /dev/null +++ b/e2e/specs/notifications/account-syncing/sync-after-adding-custom-name-account.spec.js @@ -0,0 +1,109 @@ +import { + NOTIFICATIONS_TEAM_PASSWORD, + NOTIFICATIONS_TEAM_SEED_PHRASE, + NOTIFICATIONS_TEAM_STORAGE_KEY, +} from '../constants'; +import { + startMockServer, + stopMockServer, +} from '../../../mockServer/mockServer'; +import { accountsSyncMockResponse } from './mockData'; +import { importWalletWithRecoveryPhrase } from '../../../viewHelper'; +import TestHelpers from '../../../helpers'; +import WalletView from '../../../pages/wallet/WalletView'; +import AccountListView from '../../../pages/AccountListView'; +import Assertions from '../../../utils/Assertions'; +import { SDK } from '@metamask/profile-sync-controller'; +import AddAccountModal from '../../../pages/modals/AddAccountModal'; +import AccountActionsModal from '../../../pages/modals/AccountActionsModal'; +import EditAccountNameView from '../../../pages/EditAccountNameView'; +import Gestures from '../../../utils/Gestures'; +import EditAccountNameSelectorIDs from '../../../selectors/EditAccountName.selectors'; +import { mockNotificationServices } from '../mocks'; + +describe('Account syncing', () => { + const NEW_ACCOUNT_NAME = 'My third account'; + + it('syncs newly added accounts with custom names and retrieves them after importing the same SRP', async () => { + jest.setTimeout(200000); + await TestHelpers.reverseServerPort(); + + const mockServer = await startMockServer({ + mockUrl: 'https://user-storage.api.cx.metamask.io/api/v1/userstorage', + }); + + const { userStorageMockttpControllerInstance } = + await mockNotificationServices(mockServer); + + userStorageMockttpControllerInstance.setupPath('accounts', mockServer, { + getResponse: accountsSyncMockResponse, + }); + + const decryptedAccountNames = await Promise.all( + accountsSyncMockResponse.map(async (response) => { + const decryptedAccountName = await SDK.Encryption.decryptString( + response.Data, + NOTIFICATIONS_TEAM_STORAGE_KEY, + ); + return JSON.parse(decryptedAccountName).n; + }), + ); + + await device.launchApp({ + newInstance: true, + delete: true, + }); + + await importWalletWithRecoveryPhrase( + NOTIFICATIONS_TEAM_SEED_PHRASE, + NOTIFICATIONS_TEAM_PASSWORD, + ); + + await WalletView.tapIdenticon(); + await Assertions.checkIfVisible(AccountListView.accountList); + + for (const accountName of decryptedAccountNames) { + await Assertions.checkIfVisible( + element(by.text(accountName).and(by.id('cellbase-avatar-title'))), + ); + } + + await AccountListView.tapAddAccountButton(); + await AddAccountModal.tapCreateAccount(); + + await AccountListView.swipeToDismissAccountsModal(); + + await WalletView.tapMainWalletAccountActions(); + await AccountActionsModal.tapEditAccount(); + await Gestures.clearField(EditAccountNameView.accountNameInput()); + await TestHelpers.typeTextAndHideKeyboard( + EditAccountNameSelectorIDs.ACCOUNT_NAME_INPUT, + NEW_ACCOUNT_NAME, + ); + await EditAccountNameView.tapSave(); + + await Assertions.checkIfElementToHaveText( + WalletView.accountName, + NEW_ACCOUNT_NAME, + ); + + await device.launchApp({ + newInstance: true, + delete: true, + }); + + await importWalletWithRecoveryPhrase( + NOTIFICATIONS_TEAM_SEED_PHRASE, + NOTIFICATIONS_TEAM_PASSWORD, + ); + + await WalletView.tapIdenticon(); + await Assertions.checkIfVisible(AccountListView.accountList); + + await Assertions.checkIfVisible( + element(by.text(NEW_ACCOUNT_NAME).and(by.id('cellbase-avatar-title'))), + ); + + await stopMockServer(); + }); +}); diff --git a/e2e/specs/notifications/account-syncing/sync-after-onboarding.spec.js b/e2e/specs/notifications/account-syncing/sync-after-onboarding.spec.js index bbfdacaf1e2..f7435343d4d 100644 --- a/e2e/specs/notifications/account-syncing/sync-after-onboarding.spec.js +++ b/e2e/specs/notifications/account-syncing/sync-after-onboarding.spec.js @@ -1,54 +1,66 @@ -import { - withFixtures, - defaultGanacheOptions, - startFixtureServer, - loadFixture, -} from '../../../fixtures/fixture-helper'; -import FixtureBuilder from '../../../fixtures/fixture-builder'; -import { mockNotificationServices } from '../mocks'; import { NOTIFICATIONS_TEAM_PASSWORD, NOTIFICATIONS_TEAM_SEED_PHRASE, + NOTIFICATIONS_TEAM_STORAGE_KEY, } from '../constants'; import { startMockServer, stopMockServer, } from '../../../mockServer/mockServer'; -import { UserStorageMockttpController } from '../../../utils/user-storage/userStorageMockttpController'; import { accountsSyncMockResponse } from './mockData'; import { importWalletWithRecoveryPhrase } from '../../../viewHelper'; import TestHelpers from '../../../helpers'; -import FixtureServer from '../../../fixtures/fixture-server'; -import { getFixturesServerPort } from '../../../fixtures/utils'; +import WalletView from '../../../pages/wallet/WalletView'; +import AccountListView from '../../../pages/AccountListView'; +import Assertions from '../../../utils/Assertions'; +import { SDK } from '@metamask/profile-sync-controller'; +import { mockNotificationServices } from '../mocks'; describe('Account syncing', () => { it('retrieves all previously synced accounts', async () => { - // const fixtureServer = new FixtureServer(); - const userStorageMockttpController = new UserStorageMockttpController(); - - // await TestHelpers.reverseServerPort(); - // const fixture = new FixtureBuilder().withGanacheNetwork().build(); - // await startFixtureServer(fixtureServer); - // await loadFixture(fixtureServer, { fixture }); + const decryptedAccountNames = await Promise.all( + accountsSyncMockResponse.map(async (response) => { + const decryptedAccountName = await SDK.Encryption.decryptString( + response.Data, + NOTIFICATIONS_TEAM_STORAGE_KEY, + ); + return JSON.parse(decryptedAccountName).n; + }), + ); - // const mockServer = await startMockServer({ - // // Configure mock server - // mockUrl: 'https://user-storage.api.cx.metamask.io/api/v1/userstorage', - // }); + const mockServer = await startMockServer({ + mockUrl: 'https://user-storage.api.cx.metamask.io/api/v1/userstorage', + }); - // userStorageMockttpController.setupPath('accounts', mockServer, { - // getResponse: accountsSyncMockResponse, - // }); + const { userStorageMockttpControllerInstance } = + await mockNotificationServices(mockServer); - // mockNotificationServices(mockServer, userStorageMockttpController); + userStorageMockttpControllerInstance.setupPath('accounts', mockServer, { + getResponse: accountsSyncMockResponse, + }); jest.setTimeout(200000); + await TestHelpers.reverseServerPort(); - await device.launchApp(); + await device.launchApp({ + newInstance: true, + delete: true, + }); await importWalletWithRecoveryPhrase( NOTIFICATIONS_TEAM_SEED_PHRASE, NOTIFICATIONS_TEAM_PASSWORD, ); + + await WalletView.tapIdenticon(); + await Assertions.checkIfVisible(AccountListView.accountList); + + for (const accountName of decryptedAccountNames) { + await Assertions.checkIfVisible( + element(by.text(accountName).and(by.id('cellbase-avatar-title'))), + ); + } + + await stopMockServer(); }); }); diff --git a/e2e/specs/notifications/mocks.js b/e2e/specs/notifications/mocks.js index 78205e1b019..d8a7ca2a7ca 100644 --- a/e2e/specs/notifications/mocks.js +++ b/e2e/specs/notifications/mocks.js @@ -1,4 +1,3 @@ -import { Mockttp, RequestRuleBuilder } from 'mockttp'; import { AuthenticationController } from '@metamask/profile-sync-controller'; import { NotificationServicesController, @@ -16,25 +15,19 @@ const PushMocks = NotificationServicesPushController.Mocks; * @param server - server obj used to mock our endpoints * @param userStorageMockttpController - optional controller to mock user storage endpoints */ -export async function mockNotificationServices( - server, - userStorageMockttpController, -) { +export async function mockNotificationServices(server) { // Auth mockAPICall(server, AuthMocks.getMockAuthNonceResponse()); mockAPICall(server, AuthMocks.getMockAuthLoginResponse()); mockAPICall(server, AuthMocks.getMockAuthAccessTokenResponse()); // Storage - if (!userStorageMockttpController?.paths.get('accounts')) { - new UserStorageMockttpController().setupPath('accounts', server); - } - if (!userStorageMockttpController?.paths.get('networks')) { - new UserStorageMockttpController().setupPath('networks', server); - } - if (!userStorageMockttpController?.paths.get('notifications')) { - new UserStorageMockttpController().setupPath('notifications', server); - } + const userStorageMockttpControllerInstance = + new UserStorageMockttpController(); + + userStorageMockttpControllerInstance.setupPath('accounts', server); + userStorageMockttpControllerInstance.setupPath('networks', server); + userStorageMockttpControllerInstance.setupPath('notifications', server); // Notifications mockAPICall(server, NotificationMocks.getMockFeatureAnnouncementResponse()); @@ -51,29 +44,41 @@ export async function mockNotificationServices( mockAPICall(server, PushMocks.getMockUpdatePushNotificationLinksResponse()); mockAPICall(server, PushMocks.getMockCreateFCMRegistrationTokenResponse()); mockAPICall(server, PushMocks.getMockDeleteFCMRegistrationTokenResponse()); + + return { + userStorageMockttpControllerInstance, + }; } function mockAPICall(server, response) { let requestRuleBuilder; if (response.requestMethod === 'GET') { - requestRuleBuilder = server.forGet(response.url); + requestRuleBuilder = server.forGet('/proxy'); } if (response.requestMethod === 'POST') { - requestRuleBuilder = server.forPost(response.url); + requestRuleBuilder = server.forPost('/proxy'); } if (response.requestMethod === 'PUT') { - requestRuleBuilder = server.forPut(response.url); + requestRuleBuilder = server.forPut('/proxy'); } if (response.requestMethod === 'DELETE') { - requestRuleBuilder = server.forDelete(response.url); + requestRuleBuilder = server.forDelete('/proxy'); } - requestRuleBuilder?.thenCallback(() => ({ - statusCode: 200, - json: response.response, - })); + requestRuleBuilder + ?.matching((request) => { + const url = decodeURIComponent( + String(new URL(request.url).searchParams.get('url')), + ); + + return url.includes(String(response.url)); + }) + .thenCallback(() => ({ + statusCode: 200, + json: response.response, + })); } diff --git a/e2e/utils/user-storage/userStorageMockttpController.test.ts b/e2e/utils/user-storage/userStorageMockttpController.test.ts index 1b6591899c0..94e2426e7bf 100644 --- a/e2e/utils/user-storage/userStorageMockttpController.test.ts +++ b/e2e/utils/user-storage/userStorageMockttpController.test.ts @@ -4,7 +4,8 @@ import { UserStorageMockttpController } from './userStorageMockttpController'; describe('UserStorageMockttpController', () => { let mockServer: mockttp.Mockttp; - const baseUrl = 'https://user-storage.api.cx.metamask.io/api/v1/userstorage'; + const baseUrl = + 'http://localhost/proxy?url=https://user-storage.api.cx.metamask.io/api/v1/userstorage'; describe('mimics user storage behaviour', () => { mockServer = mockttp.getLocal({ cors: true }); @@ -15,7 +16,7 @@ describe('UserStorageMockttpController', () => { controller.setupPath('accounts', mockServer); const request = await controller.onGet('accounts', { - path: `${baseUrl}/accounts`, + url: `${baseUrl}/accounts`, }); expect(request.json).toEqual(null); @@ -41,7 +42,7 @@ describe('UserStorageMockttpController', () => { }); const request = await controller.onGet('accounts', { - path: `${baseUrl}/accounts`, + url: `${baseUrl}/accounts`, }); expect(request.json).toEqual(mockedData); @@ -67,7 +68,7 @@ describe('UserStorageMockttpController', () => { }); const request = await controller.onGet('accounts', { - path: `${baseUrl}/accounts`, + url: `${baseUrl}/accounts`, }); expect(request.json).toEqual(mockedData); @@ -93,7 +94,7 @@ describe('UserStorageMockttpController', () => { }); const request = await controller.onGet('accounts', { - path: `${baseUrl}/accounts/7f8a7963423985c50f75f6ad42a6cf4e7eac43a6c55e3c6fcd49d73f01c1471b`, + url: `${baseUrl}/accounts/7f8a7963423985c50f75f6ad42a6cf4e7eac43a6c55e3c6fcd49d73f01c1471b`, }); expect(request.json).toEqual(mockedData[0]); @@ -124,7 +125,7 @@ describe('UserStorageMockttpController', () => { }); const putRequest = await controller.onPut('accounts', { - path: `${baseUrl}/accounts/6afbe024087495b4e0d56c4bdfc981c84eba44a7c284d4f455b5db4fcabc2173`, + url: `${baseUrl}/accounts/6afbe024087495b4e0d56c4bdfc981c84eba44a7c284d4f455b5db4fcabc2173`, body: { getJson: async () => ({ data: mockedAddedData.Data, @@ -135,7 +136,7 @@ describe('UserStorageMockttpController', () => { expect(putRequest.statusCode).toEqual(204); const getRequest = await controller.onGet('accounts', { - path: `${baseUrl}/accounts`, + url: `${baseUrl}/accounts`, }); expect(getRequest.json).toEqual([...mockedData, mockedAddedData]); @@ -166,7 +167,7 @@ describe('UserStorageMockttpController', () => { }); const putRequest = await controller.onPut('accounts', { - path: `${baseUrl}/accounts/c236b92ea7d513b2beda062cb546986961dfa7ca4334a2913f7837e43d050468`, + url: `${baseUrl}/accounts/c236b92ea7d513b2beda062cb546986961dfa7ca4334a2913f7837e43d050468`, body: { getJson: async () => ({ data: mockedUpdatedData.Data, @@ -177,7 +178,7 @@ describe('UserStorageMockttpController', () => { expect(putRequest.statusCode).toEqual(204); const getRequest = await controller.onGet('accounts', { - path: `${baseUrl}/accounts`, + url: `${baseUrl}/accounts`, }); expect(getRequest.json).toEqual([mockedData[0], mockedUpdatedData]); @@ -220,7 +221,7 @@ describe('UserStorageMockttpController', () => { }); const putRequest = await controller.onPut('accounts', { - path: `${baseUrl}/accounts`, + url: `${baseUrl}/accounts`, body: { getJson: async () => ({ data: putData, @@ -231,7 +232,7 @@ describe('UserStorageMockttpController', () => { expect(putRequest.statusCode).toEqual(204); const getRequest = await controller.onGet('accounts', { - path: `${baseUrl}/accounts`, + url: `${baseUrl}/accounts`, }); expect(getRequest.json).toEqual(mockedUpdatedData); @@ -257,13 +258,13 @@ describe('UserStorageMockttpController', () => { }); const deleteRequest = await controller.onDelete('accounts', { - path: `${baseUrl}/accounts/c236b92ea7d513b2beda062cb546986961dfa7ca4334a2913f7837e43d050468`, + url: `${baseUrl}/accounts/c236b92ea7d513b2beda062cb546986961dfa7ca4334a2913f7837e43d050468`, }); expect(deleteRequest.statusCode).toEqual(204); const getRequest = await controller.onGet('accounts', { - path: `${baseUrl}/accounts`, + url: `${baseUrl}/accounts`, }); expect(getRequest.json).toEqual([mockedData[0]]); @@ -289,13 +290,13 @@ describe('UserStorageMockttpController', () => { }); const deleteRequest = await controller.onDelete('accounts', { - path: `${baseUrl}/accounts`, + url: `${baseUrl}/accounts`, }); expect(deleteRequest.statusCode).toEqual(204); const getRequest = await controller.onGet('accounts', { - path: `${baseUrl}/accounts`, + url: `${baseUrl}/accounts`, }); expect(getRequest.json).toEqual(null); diff --git a/e2e/utils/user-storage/userStorageMockttpController.ts b/e2e/utils/user-storage/userStorageMockttpController.ts index 970a10d1112..e3905bf0745 100644 --- a/e2e/utils/user-storage/userStorageMockttpController.ts +++ b/e2e/utils/user-storage/userStorageMockttpController.ts @@ -12,21 +12,28 @@ export const pathRegexps = { type UserStorageResponseData = { HashedKey: string; Data: string }; -const determineIfFeatureEntryFromURL = (url: string) => - url.substring(url.lastIndexOf('userstorage') + 12).split('/').length === 2; +const determineIfFeatureEntryFromURL = (url: string) => { + const decodedUrl = decodeURIComponent(url); + return ( + decodedUrl.substring(decodedUrl.lastIndexOf('userstorage') + 12).split('/') + .length === 2 + ); +}; + +const getDecodedProxiedURL = (url: string) => + decodeURIComponent(String(new URL(url).searchParams.get('url'))); export class UserStorageMockttpController { paths: Map< keyof typeof pathRegexps, { response: UserStorageResponseData[]; - server: Mockttp; } > = new Map(); readonly onGet = async ( path: keyof typeof pathRegexps, - request: Pick, + request: Pick, statusCode: number = 200, ) => { const internalPathData = this.paths.get(path); @@ -38,12 +45,14 @@ export class UserStorageMockttpController { }; } - const isFeatureEntry = determineIfFeatureEntryFromURL(request.path); + const isFeatureEntry = determineIfFeatureEntryFromURL(request.url); if (isFeatureEntry) { const json = internalPathData.response?.find( - (entry) => entry.HashedKey === request.path.split('/').pop(), + (entry) => + entry.HashedKey === + getDecodedProxiedURL(request.url).split('/').pop(), ) || null; return { @@ -64,10 +73,10 @@ export class UserStorageMockttpController { readonly onPut = async ( path: keyof typeof pathRegexps, - request: Pick, + request: Pick, statusCode: number = 204, ) => { - const isFeatureEntry = determineIfFeatureEntryFromURL(request.path); + const isFeatureEntry = determineIfFeatureEntryFromURL(request.url); const data = (await request.body.getJson()) as { data: string | { [key: string]: string }; @@ -77,7 +86,9 @@ export class UserStorageMockttpController { isFeatureEntry && typeof data?.data === 'string' ? [ { - HashedKey: request.path.split('/').pop() as string, + HashedKey: getDecodedProxiedURL(request.url) + .split('/') + .pop() as string, Data: data?.data, }, ] @@ -122,7 +133,7 @@ export class UserStorageMockttpController { readonly onDelete = async ( path: keyof typeof pathRegexps, - request: Pick, + request: Pick, statusCode: number = 204, ) => { const internalPathData = this.paths.get(path); @@ -133,13 +144,15 @@ export class UserStorageMockttpController { }; } - const isFeatureEntry = determineIfFeatureEntryFromURL(request.path); + const isFeatureEntry = determineIfFeatureEntryFromURL(request.url); if (isFeatureEntry) { this.paths.set(path, { ...internalPathData, response: internalPathData?.response.filter( - (entry) => entry.HashedKey !== request.path.split('/').pop(), + (entry) => + entry.HashedKey !== + getDecodedProxiedURL(request.url).split('/').pop(), ), }); } else { @@ -168,26 +181,31 @@ export class UserStorageMockttpController { this.paths.set(path, { response: overrides?.getResponse || previouslySetupPath?.response || [], - server, }); - this.paths - .get(path) - ?.server.forGet(pathRegexps[path]) + server + .forGet('/proxy') + .matching((request) => + pathRegexps[path].test(getDecodedProxiedURL(request.url)), + ) .always() .thenCallback((request) => this.onGet(path, request, overrides?.getStatusCode), ); - this.paths - .get(path) - ?.server.forPut(pathRegexps[path]) + server + .forPut('/proxy') + .matching((request) => + pathRegexps[path].test(getDecodedProxiedURL(request.url)), + ) .always() .thenCallback((request) => this.onPut(path, request, overrides?.putStatusCode), ); - this.paths - .get(path) - ?.server.forDelete(pathRegexps[path]) + server + .forDelete('/proxy') + .matching((request) => + pathRegexps[path].test(getDecodedProxiedURL(request.url)), + ) .always() .thenCallback((request) => this.onDelete(path, request, overrides?.deleteStatusCode), From 3ed226391d94f3043e54666667193ccfeb9961f2 Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Fri, 25 Oct 2024 11:09:39 +0200 Subject: [PATCH 39/49] fix: change folder structure and move ts files back to js --- e2e/mockServer/mockServer.js | 11 --- ...c-after-adding-custom-name-account.spec.js | 8 +- .../sync-after-onboarding.spec.js | 6 +- .../notifications/{ => utils}/constants.js | 0 e2e/specs/notifications/utils/helpers.js | 10 +++ e2e/specs/notifications/{ => utils}/mocks.js | 7 +- .../userStorageMockttpController.js} | 83 +++++-------------- .../userStorageMockttpController.test.js} | 32 +++---- 8 files changed, 56 insertions(+), 101 deletions(-) rename e2e/specs/notifications/{ => utils}/constants.js (100%) create mode 100644 e2e/specs/notifications/utils/helpers.js rename e2e/specs/notifications/{ => utils}/mocks.js (92%) rename e2e/{utils/user-storage/userStorageMockttpController.ts => specs/notifications/utils/user-storage/userStorageMockttpController.js} (69%) rename e2e/{utils/user-storage/userStorageMockttpController.test.ts => specs/notifications/utils/user-storage/userStorageMockttpController.test.js} (91%) diff --git a/e2e/mockServer/mockServer.js b/e2e/mockServer/mockServer.js index 9b5e64155c6..ebe9885ca8a 100644 --- a/e2e/mockServer/mockServer.js +++ b/e2e/mockServer/mockServer.js @@ -2,8 +2,6 @@ import { getLocal } from 'mockttp'; import { defaultMockPort } from './mockUrlCollection'; import portfinder from 'portfinder'; -import { mockNotificationServices } from '../specs/notifications/mocks'; -import { UserStorageMockttpController } from '../utils/user-storage/userStorageMockttpController'; const mockServer = getLocal(); @@ -12,9 +10,6 @@ export const startMockServer = async ({ responseCode = 500, responseBody = {}, port = defaultMockPort, - // overrides = { - // userStorageMockttpController: new UserStorageMockttpController(), - // }, }) => { if (!mockUrl) throw new Error('The mockUrl parameter is required'); await portfinder.setBasePort(port); @@ -31,12 +26,6 @@ export const startMockServer = async ({ .withQuery({ url: mockUrl }) .thenReply(responseCode, JSON.stringify(responseBody)); - // // Mock all notifications related services (Auth, UserStorage, Notifications, Push Notifications, Profile syncing) - // await mockNotificationServices( - // mockServer, - // overrides?.userStorageMockttpController, - // ); - await mockServer.forUnmatchedRequest().thenPassThrough({ beforeRequest: async ({ url, method }) => { const returnUrl = new URL(url).searchParams.get('url') || url; diff --git a/e2e/specs/notifications/account-syncing/sync-after-adding-custom-name-account.spec.js b/e2e/specs/notifications/account-syncing/sync-after-adding-custom-name-account.spec.js index dd811aeead0..c2cbc78bbca 100644 --- a/e2e/specs/notifications/account-syncing/sync-after-adding-custom-name-account.spec.js +++ b/e2e/specs/notifications/account-syncing/sync-after-adding-custom-name-account.spec.js @@ -1,8 +1,9 @@ +import { SDK } from '@metamask/profile-sync-controller'; import { NOTIFICATIONS_TEAM_PASSWORD, NOTIFICATIONS_TEAM_SEED_PHRASE, NOTIFICATIONS_TEAM_STORAGE_KEY, -} from '../constants'; +} from '../utils/constants'; import { startMockServer, stopMockServer, @@ -13,13 +14,12 @@ import TestHelpers from '../../../helpers'; import WalletView from '../../../pages/wallet/WalletView'; import AccountListView from '../../../pages/AccountListView'; import Assertions from '../../../utils/Assertions'; -import { SDK } from '@metamask/profile-sync-controller'; import AddAccountModal from '../../../pages/modals/AddAccountModal'; import AccountActionsModal from '../../../pages/modals/AccountActionsModal'; import EditAccountNameView from '../../../pages/EditAccountNameView'; import Gestures from '../../../utils/Gestures'; import EditAccountNameSelectorIDs from '../../../selectors/EditAccountName.selectors'; -import { mockNotificationServices } from '../mocks'; +import { mockNotificationServices } from '../utils/mocks'; describe('Account syncing', () => { const NEW_ACCOUNT_NAME = 'My third account'; @@ -75,7 +75,7 @@ describe('Account syncing', () => { await WalletView.tapMainWalletAccountActions(); await AccountActionsModal.tapEditAccount(); - await Gestures.clearField(EditAccountNameView.accountNameInput()); + await Gestures.clearField(EditAccountNameView.accountNameInput); await TestHelpers.typeTextAndHideKeyboard( EditAccountNameSelectorIDs.ACCOUNT_NAME_INPUT, NEW_ACCOUNT_NAME, diff --git a/e2e/specs/notifications/account-syncing/sync-after-onboarding.spec.js b/e2e/specs/notifications/account-syncing/sync-after-onboarding.spec.js index f7435343d4d..2c5b6cb7af0 100644 --- a/e2e/specs/notifications/account-syncing/sync-after-onboarding.spec.js +++ b/e2e/specs/notifications/account-syncing/sync-after-onboarding.spec.js @@ -1,8 +1,9 @@ +import { SDK } from '@metamask/profile-sync-controller'; import { NOTIFICATIONS_TEAM_PASSWORD, NOTIFICATIONS_TEAM_SEED_PHRASE, NOTIFICATIONS_TEAM_STORAGE_KEY, -} from '../constants'; +} from '../utils/constants'; import { startMockServer, stopMockServer, @@ -13,8 +14,7 @@ import TestHelpers from '../../../helpers'; import WalletView from '../../../pages/wallet/WalletView'; import AccountListView from '../../../pages/AccountListView'; import Assertions from '../../../utils/Assertions'; -import { SDK } from '@metamask/profile-sync-controller'; -import { mockNotificationServices } from '../mocks'; +import { mockNotificationServices } from '../utils/mocks'; describe('Account syncing', () => { it('retrieves all previously synced accounts', async () => { diff --git a/e2e/specs/notifications/constants.js b/e2e/specs/notifications/utils/constants.js similarity index 100% rename from e2e/specs/notifications/constants.js rename to e2e/specs/notifications/utils/constants.js diff --git a/e2e/specs/notifications/utils/helpers.js b/e2e/specs/notifications/utils/helpers.js new file mode 100644 index 00000000000..7eed1dd5382 --- /dev/null +++ b/e2e/specs/notifications/utils/helpers.js @@ -0,0 +1,10 @@ +export const determineIfFeatureEntryFromURL = (url) => { + const decodedUrl = decodeURIComponent(url); + return ( + decodedUrl.substring(decodedUrl.lastIndexOf('userstorage') + 12).split('/') + .length === 2 + ); +}; + +export const getDecodedProxiedURL = (url) => + decodeURIComponent(String(new URL(url).searchParams.get('url'))); diff --git a/e2e/specs/notifications/mocks.js b/e2e/specs/notifications/utils/mocks.js similarity index 92% rename from e2e/specs/notifications/mocks.js rename to e2e/specs/notifications/utils/mocks.js index d8a7ca2a7ca..155e84a325a 100644 --- a/e2e/specs/notifications/mocks.js +++ b/e2e/specs/notifications/utils/mocks.js @@ -3,7 +3,8 @@ import { NotificationServicesController, NotificationServicesPushController, } from '@metamask/notification-services-controller'; -import { UserStorageMockttpController } from '../../utils/user-storage/userStorageMockttpController'; +import { UserStorageMockttpController } from './user-storage/userStorageMockttpController'; +import { getDecodedProxiedURL } from './helpers'; const AuthMocks = AuthenticationController.Mocks; const NotificationMocks = NotificationServicesController.Mocks; @@ -71,9 +72,7 @@ function mockAPICall(server, response) { requestRuleBuilder ?.matching((request) => { - const url = decodeURIComponent( - String(new URL(request.url).searchParams.get('url')), - ); + const url = getDecodedProxiedURL(request.url); return url.includes(String(response.url)); }) diff --git a/e2e/utils/user-storage/userStorageMockttpController.ts b/e2e/specs/notifications/utils/user-storage/userStorageMockttpController.js similarity index 69% rename from e2e/utils/user-storage/userStorageMockttpController.ts rename to e2e/specs/notifications/utils/user-storage/userStorageMockttpController.js index e3905bf0745..9438e2a7fc7 100644 --- a/e2e/utils/user-storage/userStorageMockttpController.ts +++ b/e2e/specs/notifications/utils/user-storage/userStorageMockttpController.js @@ -1,4 +1,7 @@ -import { CompletedRequest, Mockttp } from 'mockttp'; +import { + determineIfFeatureEntryFromURL, + getDecodedProxiedURL, +} from '../helpers'; // TODO: Export user storage schema from @metamask/profile-sync-controller export const pathRegexps = { @@ -10,32 +13,10 @@ export const pathRegexps = { /https:\/\/user-storage\.api\.cx\.metamask\.io\/api\/v1\/userstorage\/notifications/u, }; -type UserStorageResponseData = { HashedKey: string; Data: string }; - -const determineIfFeatureEntryFromURL = (url: string) => { - const decodedUrl = decodeURIComponent(url); - return ( - decodedUrl.substring(decodedUrl.lastIndexOf('userstorage') + 12).split('/') - .length === 2 - ); -}; - -const getDecodedProxiedURL = (url: string) => - decodeURIComponent(String(new URL(url).searchParams.get('url'))); - export class UserStorageMockttpController { - paths: Map< - keyof typeof pathRegexps, - { - response: UserStorageResponseData[]; - } - > = new Map(); + paths = new Map(); - readonly onGet = async ( - path: keyof typeof pathRegexps, - request: Pick, - statusCode: number = 200, - ) => { + async onGet(path, request, statusCode = 200) { const internalPathData = this.paths.get(path); if (!internalPathData) { @@ -69,26 +50,18 @@ export class UserStorageMockttpController { statusCode, json, }; - }; + } - readonly onPut = async ( - path: keyof typeof pathRegexps, - request: Pick, - statusCode: number = 204, - ) => { + async onPut(path, request, statusCode = 204) { const isFeatureEntry = determineIfFeatureEntryFromURL(request.url); - const data = (await request.body.getJson()) as { - data: string | { [key: string]: string }; - }; + const data = await request.body.getJson(); const newOrUpdatedSingleOrBatchEntries = isFeatureEntry && typeof data?.data === 'string' ? [ { - HashedKey: getDecodedProxiedURL(request.url) - .split('/') - .pop() as string, + HashedKey: getDecodedProxiedURL(request.url).split('/').pop(), Data: data?.data, }, ] @@ -118,10 +91,7 @@ export class UserStorageMockttpController { } else { this.paths.set(path, { ...internalPathData, - response: [ - ...(internalPathData?.response || []), - entry as { HashedKey: string; Data: string }, - ], + response: [...(internalPathData?.response || []), entry], }); } }); @@ -129,13 +99,9 @@ export class UserStorageMockttpController { return { statusCode, }; - }; + } - readonly onDelete = async ( - path: keyof typeof pathRegexps, - request: Pick, - statusCode: number = 204, - ) => { + async onDelete(path, request, statusCode = 204) { const internalPathData = this.paths.get(path); if (!internalPathData) { @@ -165,25 +131,16 @@ export class UserStorageMockttpController { return { statusCode, }; - }; - - setupPath = ( - path: keyof typeof pathRegexps, - server: Mockttp, - overrides?: { - getResponse?: UserStorageResponseData[]; - getStatusCode?: number; - putStatusCode?: number; - deleteStatusCode?: number; - }, - ) => { + } + + async setupPath(path, server, overrides) { const previouslySetupPath = this.paths.get(path); this.paths.set(path, { response: overrides?.getResponse || previouslySetupPath?.response || [], }); - server + await server .forGet('/proxy') .matching((request) => pathRegexps[path].test(getDecodedProxiedURL(request.url)), @@ -192,7 +149,7 @@ export class UserStorageMockttpController { .thenCallback((request) => this.onGet(path, request, overrides?.getStatusCode), ); - server + await server .forPut('/proxy') .matching((request) => pathRegexps[path].test(getDecodedProxiedURL(request.url)), @@ -201,7 +158,7 @@ export class UserStorageMockttpController { .thenCallback((request) => this.onPut(path, request, overrides?.putStatusCode), ); - server + await server .forDelete('/proxy') .matching((request) => pathRegexps[path].test(getDecodedProxiedURL(request.url)), @@ -210,5 +167,5 @@ export class UserStorageMockttpController { .thenCallback((request) => this.onDelete(path, request, overrides?.deleteStatusCode), ); - }; + } } diff --git a/e2e/utils/user-storage/userStorageMockttpController.test.ts b/e2e/specs/notifications/utils/user-storage/userStorageMockttpController.test.js similarity index 91% rename from e2e/utils/user-storage/userStorageMockttpController.test.ts rename to e2e/specs/notifications/utils/user-storage/userStorageMockttpController.test.js index 94e2426e7bf..5ea0f1603ca 100644 --- a/e2e/utils/user-storage/userStorageMockttpController.test.ts +++ b/e2e/specs/notifications/utils/user-storage/userStorageMockttpController.test.js @@ -1,19 +1,19 @@ -import * as mockttp from 'mockttp'; +import { getLocal } from 'mockttp'; import { UserStorageMockttpController } from './userStorageMockttpController'; describe('UserStorageMockttpController', () => { - let mockServer: mockttp.Mockttp; + let mockServer; const baseUrl = 'http://localhost/proxy?url=https://user-storage.api.cx.metamask.io/api/v1/userstorage'; describe('mimics user storage behaviour', () => { - mockServer = mockttp.getLocal({ cors: true }); + mockServer = getLocal({ cors: true }); it('handles GET requests that have empty response', async () => { const controller = new UserStorageMockttpController(); - controller.setupPath('accounts', mockServer); + await controller.setupPath('accounts', mockServer); const request = await controller.onGet('accounts', { url: `${baseUrl}/accounts`, @@ -37,7 +37,7 @@ describe('UserStorageMockttpController', () => { }, ]; - controller.setupPath('accounts', mockServer, { + await controller.setupPath('accounts', mockServer, { getResponse: mockedData, }); @@ -63,7 +63,7 @@ describe('UserStorageMockttpController', () => { }, ]; - controller.setupPath('accounts', mockServer, { + await controller.setupPath('accounts', mockServer, { getResponse: mockedData, }); @@ -89,7 +89,7 @@ describe('UserStorageMockttpController', () => { }, ]; - controller.setupPath('accounts', mockServer, { + await controller.setupPath('accounts', mockServer, { getResponse: mockedData, }); @@ -120,7 +120,7 @@ describe('UserStorageMockttpController', () => { Data: 'data3', }; - controller.setupPath('accounts', mockServer, { + await controller.setupPath('accounts', mockServer, { getResponse: mockedData, }); @@ -130,7 +130,7 @@ describe('UserStorageMockttpController', () => { getJson: async () => ({ data: mockedAddedData.Data, }), - } as unknown as mockttp.CompletedBody, + }, }); expect(putRequest.statusCode).toEqual(204); @@ -162,7 +162,7 @@ describe('UserStorageMockttpController', () => { Data: 'data3', }; - controller.setupPath('accounts', mockServer, { + await controller.setupPath('accounts', mockServer, { getResponse: mockedData, }); @@ -172,7 +172,7 @@ describe('UserStorageMockttpController', () => { getJson: async () => ({ data: mockedUpdatedData.Data, }), - } as unknown as mockttp.CompletedBody, + }, }); expect(putRequest.statusCode).toEqual(204); @@ -211,11 +211,11 @@ describe('UserStorageMockttpController', () => { }, ]; - controller.setupPath('accounts', mockServer, { + await controller.setupPath('accounts', mockServer, { getResponse: mockedData, }); - const putData = {} as { [key: string]: string }; + const putData = {}; mockedUpdatedData.forEach((entry) => { putData[entry.HashedKey] = entry.Data; }); @@ -226,7 +226,7 @@ describe('UserStorageMockttpController', () => { getJson: async () => ({ data: putData, }), - } as unknown as mockttp.CompletedBody, + }, }); expect(putRequest.statusCode).toEqual(204); @@ -253,7 +253,7 @@ describe('UserStorageMockttpController', () => { }, ]; - controller.setupPath('accounts', mockServer, { + await controller.setupPath('accounts', mockServer, { getResponse: mockedData, }); @@ -285,7 +285,7 @@ describe('UserStorageMockttpController', () => { }, ]; - controller.setupPath('accounts', mockServer, { + await controller.setupPath('accounts', mockServer, { getResponse: mockedData, }); From 202e4862e7dba47538933255a3f4d312d97bdf9f Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Fri, 25 Oct 2024 11:35:20 +0200 Subject: [PATCH 40/49] feat: disable account sync in production --- app/core/Engine.ts | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/app/core/Engine.ts b/app/core/Engine.ts index 1a7311d12f2..d72daaf99c3 100644 --- a/app/core/Engine.ts +++ b/app/core/Engine.ts @@ -253,6 +253,7 @@ import { handleSnapRequest } from './Snaps/utils'; ///: END:ONLY_INCLUDE_IF import { trace } from '../util/trace'; import { MetricsEventBuilder } from './Analytics/MetricsEventBuilder'; +import { isProduction } from '../util/environment'; const NON_EMPTY = 'NON_EMPTY'; @@ -1218,7 +1219,7 @@ class Engine { const userStorageController = new UserStorageController.Controller({ getMetaMetricsState: () => MetaMetrics.getInstance().isEnabled(), env: { - isAccountSyncingEnabled: true, + isAccountSyncingEnabled: !isProduction(), }, config: { accountSyncing: { @@ -1357,7 +1358,7 @@ class Engine { return Boolean( hasProperty(showIncomingTransactions, currentChainId) && - showIncomingTransactions?.[currentHexChainId], + showIncomingTransactions?.[currentHexChainId], ); }, updateTransactions: true, @@ -1708,7 +1709,7 @@ class Engine { (state: NetworkState) => { if ( state.networksMetadata[state.selectedNetworkClientId].status === - NetworkStatus.Available && + NetworkStatus.Available && networkController.getNetworkClientById( networkController?.state.selectedNetworkClientId, ).configuration.chainId !== currentChainId @@ -1733,9 +1734,10 @@ class Engine { } catch (error) { console.error( error, - `Network ID not changed, current chainId: ${networkController.getNetworkClientById( - networkController?.state.selectedNetworkClientId, - ).configuration.chainId + `Network ID not changed, current chainId: ${ + networkController.getNetworkClientById( + networkController?.state.selectedNetworkClientId, + ).configuration.chainId }`, ); } @@ -1864,7 +1866,7 @@ class Engine { const decimalsToShow = (currentCurrency === 'usd' && 2) || undefined; if ( accountsByChainId?.[toHexadecimal(chainId)]?.[ - selectSelectedInternalAccountChecksummedAddress + selectSelectedInternalAccountChecksummedAddress ] ) { ethFiat = weiToFiatNumber( @@ -1896,9 +1898,9 @@ class Engine { item.balance || (item.address in tokenBalances ? renderFromTokenMinimalUnit( - tokenBalances[item.address], - item.decimals, - ) + tokenBalances[item.address], + item.decimals, + ) : undefined); const tokenBalanceFiat = balanceToFiatNumber( // TODO: Fix this by handling or eliminating the undefined case @@ -1952,7 +1954,6 @@ class Engine { return snapKeyring; }; - /** * Removes an account from state / storage. * @@ -2329,6 +2330,6 @@ export default { removeAccount: async (address: string) => { assertEngineExists(instance); return await instance.removeAccount(address); - } + }, ///: END:ONLY_INCLUDE_IF }; From 2ab0e9f4ec08285efe97b3ad5c063ad0e338f014 Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Fri, 25 Oct 2024 14:21:06 +0200 Subject: [PATCH 41/49] feat: add notifications tests to bitrise flow --- bitrise.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/bitrise.yml b/bitrise.yml index 0cbeb6d0b66..6e6c2256920 100644 --- a/bitrise.yml +++ b/bitrise.yml @@ -135,6 +135,8 @@ stages: - run_ios_api_specs: {} - run_tag_smoke_accounts_ios: {} - run_tag_smoke_accounts_android: {} + - run_tag_smoke_notifications_ios: {} + - run_tag_smoke_notifications_android: {} # - run_tag_smoke_assets_ios: {} - run_tag_smoke_assets_android: {} - run_tag_smoke_confirmations_ios: {} @@ -159,6 +161,8 @@ stages: - run_tag_smoke_confirmations_android: {} - run_tag_smoke_accounts_ios: {} - run_tag_smoke_accounts_android: {} + - run_tag_smoke_notifications_ios: {} + - run_tag_smoke_notifications_android: {} - run_tag_smoke_assets_ios: {} - run_tag_smoke_assets_android: {} - run_tag_smoke_swaps_ios: {} @@ -522,6 +526,22 @@ workflows: - TEST_SUITE_TAG: '.*SmokeAccounts.*' after_run: - android_e2e_test + run_tag_smoke_notifications_ios: + envs: + - TEST_SUITE_FOLDER: './e2e/specs/notifications/**/*' + - TEST_SUITE_TAG: '.*SmokeNotifications.*' + after_run: + - ios_e2e_test + run_tag_smoke_notifications_android: + meta: + bitrise.io: + stack: linux-docker-android-22.04 + machine_type_id: elite-xl + envs: + - TEST_SUITE_FOLDER: './e2e/specs/notifications/**/*' + - TEST_SUITE_TAG: '.*SmokeNotifications.*' + after_run: + - android_e2e_test run_tag_smoke_assets_ios: envs: - TEST_SUITE_FOLDER: './e2e/specs/assets/*' From 727375cde34d29b3468f492368c09e93b5765db3 Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Fri, 25 Oct 2024 14:49:06 +0200 Subject: [PATCH 42/49] fix: add SmokeNotifications tag --- ...c-after-adding-custom-name-account.spec.js | 149 +++++++++--------- .../sync-after-onboarding.spec.js | 81 +++++----- e2e/tags.js | 4 + 3 files changed, 122 insertions(+), 112 deletions(-) diff --git a/e2e/specs/notifications/account-syncing/sync-after-adding-custom-name-account.spec.js b/e2e/specs/notifications/account-syncing/sync-after-adding-custom-name-account.spec.js index c2cbc78bbca..d567828b36d 100644 --- a/e2e/specs/notifications/account-syncing/sync-after-adding-custom-name-account.spec.js +++ b/e2e/specs/notifications/account-syncing/sync-after-adding-custom-name-account.spec.js @@ -20,90 +20,93 @@ import EditAccountNameView from '../../../pages/EditAccountNameView'; import Gestures from '../../../utils/Gestures'; import EditAccountNameSelectorIDs from '../../../selectors/EditAccountName.selectors'; import { mockNotificationServices } from '../utils/mocks'; +import { SmokeNotifications } from '../../../tags'; + +describe( + SmokeNotifications('Account syncing', () => { + const NEW_ACCOUNT_NAME = 'My third account'; + + it('syncs newly added accounts with custom names and retrieves them after importing the same SRP', async () => { + jest.setTimeout(200000); + await TestHelpers.reverseServerPort(); + + const mockServer = await startMockServer({ + mockUrl: 'https://user-storage.api.cx.metamask.io/api/v1/userstorage', + }); + + const { userStorageMockttpControllerInstance } = + await mockNotificationServices(mockServer); + + userStorageMockttpControllerInstance.setupPath('accounts', mockServer, { + getResponse: accountsSyncMockResponse, + }); + + const decryptedAccountNames = await Promise.all( + accountsSyncMockResponse.map(async (response) => { + const decryptedAccountName = await SDK.Encryption.decryptString( + response.Data, + NOTIFICATIONS_TEAM_STORAGE_KEY, + ); + return JSON.parse(decryptedAccountName).n; + }), + ); -describe('Account syncing', () => { - const NEW_ACCOUNT_NAME = 'My third account'; - - it('syncs newly added accounts with custom names and retrieves them after importing the same SRP', async () => { - jest.setTimeout(200000); - await TestHelpers.reverseServerPort(); - - const mockServer = await startMockServer({ - mockUrl: 'https://user-storage.api.cx.metamask.io/api/v1/userstorage', - }); + await device.launchApp({ + newInstance: true, + delete: true, + }); - const { userStorageMockttpControllerInstance } = - await mockNotificationServices(mockServer); + await importWalletWithRecoveryPhrase( + NOTIFICATIONS_TEAM_SEED_PHRASE, + NOTIFICATIONS_TEAM_PASSWORD, + ); - userStorageMockttpControllerInstance.setupPath('accounts', mockServer, { - getResponse: accountsSyncMockResponse, - }); + await WalletView.tapIdenticon(); + await Assertions.checkIfVisible(AccountListView.accountList); - const decryptedAccountNames = await Promise.all( - accountsSyncMockResponse.map(async (response) => { - const decryptedAccountName = await SDK.Encryption.decryptString( - response.Data, - NOTIFICATIONS_TEAM_STORAGE_KEY, + for (const accountName of decryptedAccountNames) { + await Assertions.checkIfVisible( + element(by.text(accountName).and(by.id('cellbase-avatar-title'))), ); - return JSON.parse(decryptedAccountName).n; - }), - ); + } - await device.launchApp({ - newInstance: true, - delete: true, - }); + await AccountListView.tapAddAccountButton(); + await AddAccountModal.tapCreateAccount(); - await importWalletWithRecoveryPhrase( - NOTIFICATIONS_TEAM_SEED_PHRASE, - NOTIFICATIONS_TEAM_PASSWORD, - ); + await AccountListView.swipeToDismissAccountsModal(); - await WalletView.tapIdenticon(); - await Assertions.checkIfVisible(AccountListView.accountList); + await WalletView.tapMainWalletAccountActions(); + await AccountActionsModal.tapEditAccount(); + await Gestures.clearField(EditAccountNameView.accountNameInput); + await TestHelpers.typeTextAndHideKeyboard( + EditAccountNameSelectorIDs.ACCOUNT_NAME_INPUT, + NEW_ACCOUNT_NAME, + ); + await EditAccountNameView.tapSave(); - for (const accountName of decryptedAccountNames) { - await Assertions.checkIfVisible( - element(by.text(accountName).and(by.id('cellbase-avatar-title'))), + await Assertions.checkIfElementToHaveText( + WalletView.accountName, + NEW_ACCOUNT_NAME, ); - } - - await AccountListView.tapAddAccountButton(); - await AddAccountModal.tapCreateAccount(); - - await AccountListView.swipeToDismissAccountsModal(); - - await WalletView.tapMainWalletAccountActions(); - await AccountActionsModal.tapEditAccount(); - await Gestures.clearField(EditAccountNameView.accountNameInput); - await TestHelpers.typeTextAndHideKeyboard( - EditAccountNameSelectorIDs.ACCOUNT_NAME_INPUT, - NEW_ACCOUNT_NAME, - ); - await EditAccountNameView.tapSave(); - - await Assertions.checkIfElementToHaveText( - WalletView.accountName, - NEW_ACCOUNT_NAME, - ); - - await device.launchApp({ - newInstance: true, - delete: true, - }); - await importWalletWithRecoveryPhrase( - NOTIFICATIONS_TEAM_SEED_PHRASE, - NOTIFICATIONS_TEAM_PASSWORD, - ); + await device.launchApp({ + newInstance: true, + delete: true, + }); - await WalletView.tapIdenticon(); - await Assertions.checkIfVisible(AccountListView.accountList); + await importWalletWithRecoveryPhrase( + NOTIFICATIONS_TEAM_SEED_PHRASE, + NOTIFICATIONS_TEAM_PASSWORD, + ); - await Assertions.checkIfVisible( - element(by.text(NEW_ACCOUNT_NAME).and(by.id('cellbase-avatar-title'))), - ); + await WalletView.tapIdenticon(); + await Assertions.checkIfVisible(AccountListView.accountList); - await stopMockServer(); - }); -}); + await Assertions.checkIfVisible( + element(by.text(NEW_ACCOUNT_NAME).and(by.id('cellbase-avatar-title'))), + ); + + await stopMockServer(); + }); + }), +); diff --git a/e2e/specs/notifications/account-syncing/sync-after-onboarding.spec.js b/e2e/specs/notifications/account-syncing/sync-after-onboarding.spec.js index 2c5b6cb7af0..b4ba8aea8e1 100644 --- a/e2e/specs/notifications/account-syncing/sync-after-onboarding.spec.js +++ b/e2e/specs/notifications/account-syncing/sync-after-onboarding.spec.js @@ -15,52 +15,55 @@ import WalletView from '../../../pages/wallet/WalletView'; import AccountListView from '../../../pages/AccountListView'; import Assertions from '../../../utils/Assertions'; import { mockNotificationServices } from '../utils/mocks'; +import { SmokeNotifications } from '../../../tags'; -describe('Account syncing', () => { - it('retrieves all previously synced accounts', async () => { - const decryptedAccountNames = await Promise.all( - accountsSyncMockResponse.map(async (response) => { - const decryptedAccountName = await SDK.Encryption.decryptString( - response.Data, - NOTIFICATIONS_TEAM_STORAGE_KEY, - ); - return JSON.parse(decryptedAccountName).n; - }), - ); +describe( + SmokeNotifications('Account syncing', () => { + it('retrieves all previously synced accounts', async () => { + const decryptedAccountNames = await Promise.all( + accountsSyncMockResponse.map(async (response) => { + const decryptedAccountName = await SDK.Encryption.decryptString( + response.Data, + NOTIFICATIONS_TEAM_STORAGE_KEY, + ); + return JSON.parse(decryptedAccountName).n; + }), + ); - const mockServer = await startMockServer({ - mockUrl: 'https://user-storage.api.cx.metamask.io/api/v1/userstorage', - }); + const mockServer = await startMockServer({ + mockUrl: 'https://user-storage.api.cx.metamask.io/api/v1/userstorage', + }); - const { userStorageMockttpControllerInstance } = - await mockNotificationServices(mockServer); + const { userStorageMockttpControllerInstance } = + await mockNotificationServices(mockServer); - userStorageMockttpControllerInstance.setupPath('accounts', mockServer, { - getResponse: accountsSyncMockResponse, - }); + userStorageMockttpControllerInstance.setupPath('accounts', mockServer, { + getResponse: accountsSyncMockResponse, + }); - jest.setTimeout(200000); - await TestHelpers.reverseServerPort(); + jest.setTimeout(200000); + await TestHelpers.reverseServerPort(); - await device.launchApp({ - newInstance: true, - delete: true, - }); + await device.launchApp({ + newInstance: true, + delete: true, + }); - await importWalletWithRecoveryPhrase( - NOTIFICATIONS_TEAM_SEED_PHRASE, - NOTIFICATIONS_TEAM_PASSWORD, - ); + await importWalletWithRecoveryPhrase( + NOTIFICATIONS_TEAM_SEED_PHRASE, + NOTIFICATIONS_TEAM_PASSWORD, + ); - await WalletView.tapIdenticon(); - await Assertions.checkIfVisible(AccountListView.accountList); + await WalletView.tapIdenticon(); + await Assertions.checkIfVisible(AccountListView.accountList); - for (const accountName of decryptedAccountNames) { - await Assertions.checkIfVisible( - element(by.text(accountName).and(by.id('cellbase-avatar-title'))), - ); - } + for (const accountName of decryptedAccountNames) { + await Assertions.checkIfVisible( + element(by.text(accountName).and(by.id('cellbase-avatar-title'))), + ); + } - await stopMockServer(); - }); -}); + await stopMockServer(); + }); + }), +); diff --git a/e2e/tags.js b/e2e/tags.js index 8e78b934e57..503188a317e 100644 --- a/e2e/tags.js +++ b/e2e/tags.js @@ -6,6 +6,7 @@ const tags = { SmokeSwaps: 'SmokeSwaps', SmokeRest: 'SmokeRest', smokeAssets: 'smokeAssets', + smokeNotifications: 'smokeNotifications', }; const Regression = (testName) => `${tags.regression} ${testName}`; @@ -15,6 +16,8 @@ const SmokeConfirmations = (testName) => `${tags.smokeConfirmations} ${testName}`; const SmokeSwaps = (testName) => `${tags.SmokeSwaps} ${testName}`; const SmokeAssets = (testName) => `${tags.smokeAssets} ${testName}`; +const SmokeNotifications = (testName) => + `${tags.smokeNotifications} ${testName}`; export { Regression, @@ -23,4 +26,5 @@ export { SmokeConfirmations, SmokeSwaps, SmokeAssets, + SmokeNotifications, }; From bbf692057d6482040f59e95e96a8c26c391e3e9a Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Fri, 25 Oct 2024 15:09:33 +0200 Subject: [PATCH 43/49] fix: usage of smokeNotifications tag --- ...c-after-adding-custom-name-account.spec.js | 146 +++++++++--------- .../sync-after-onboarding.spec.js | 80 +++++----- 2 files changed, 111 insertions(+), 115 deletions(-) diff --git a/e2e/specs/notifications/account-syncing/sync-after-adding-custom-name-account.spec.js b/e2e/specs/notifications/account-syncing/sync-after-adding-custom-name-account.spec.js index d567828b36d..cab8262e3e5 100644 --- a/e2e/specs/notifications/account-syncing/sync-after-adding-custom-name-account.spec.js +++ b/e2e/specs/notifications/account-syncing/sync-after-adding-custom-name-account.spec.js @@ -22,91 +22,89 @@ import EditAccountNameSelectorIDs from '../../../selectors/EditAccountName.selec import { mockNotificationServices } from '../utils/mocks'; import { SmokeNotifications } from '../../../tags'; -describe( - SmokeNotifications('Account syncing', () => { - const NEW_ACCOUNT_NAME = 'My third account'; - - it('syncs newly added accounts with custom names and retrieves them after importing the same SRP', async () => { - jest.setTimeout(200000); - await TestHelpers.reverseServerPort(); - - const mockServer = await startMockServer({ - mockUrl: 'https://user-storage.api.cx.metamask.io/api/v1/userstorage', - }); - - const { userStorageMockttpControllerInstance } = - await mockNotificationServices(mockServer); - - userStorageMockttpControllerInstance.setupPath('accounts', mockServer, { - getResponse: accountsSyncMockResponse, - }); - - const decryptedAccountNames = await Promise.all( - accountsSyncMockResponse.map(async (response) => { - const decryptedAccountName = await SDK.Encryption.decryptString( - response.Data, - NOTIFICATIONS_TEAM_STORAGE_KEY, - ); - return JSON.parse(decryptedAccountName).n; - }), - ); +describe(SmokeNotifications('Account syncing'), () => { + const NEW_ACCOUNT_NAME = 'My third account'; - await device.launchApp({ - newInstance: true, - delete: true, - }); + it('syncs newly added accounts with custom names and retrieves them after importing the same SRP', async () => { + jest.setTimeout(200000); + await TestHelpers.reverseServerPort(); - await importWalletWithRecoveryPhrase( - NOTIFICATIONS_TEAM_SEED_PHRASE, - NOTIFICATIONS_TEAM_PASSWORD, - ); + const mockServer = await startMockServer({ + mockUrl: 'https://user-storage.api.cx.metamask.io/api/v1/userstorage', + }); - await WalletView.tapIdenticon(); - await Assertions.checkIfVisible(AccountListView.accountList); + const { userStorageMockttpControllerInstance } = + await mockNotificationServices(mockServer); - for (const accountName of decryptedAccountNames) { - await Assertions.checkIfVisible( - element(by.text(accountName).and(by.id('cellbase-avatar-title'))), + userStorageMockttpControllerInstance.setupPath('accounts', mockServer, { + getResponse: accountsSyncMockResponse, + }); + + const decryptedAccountNames = await Promise.all( + accountsSyncMockResponse.map(async (response) => { + const decryptedAccountName = await SDK.Encryption.decryptString( + response.Data, + NOTIFICATIONS_TEAM_STORAGE_KEY, ); - } + return JSON.parse(decryptedAccountName).n; + }), + ); - await AccountListView.tapAddAccountButton(); - await AddAccountModal.tapCreateAccount(); + await device.launchApp({ + newInstance: true, + delete: true, + }); - await AccountListView.swipeToDismissAccountsModal(); + await importWalletWithRecoveryPhrase( + NOTIFICATIONS_TEAM_SEED_PHRASE, + NOTIFICATIONS_TEAM_PASSWORD, + ); - await WalletView.tapMainWalletAccountActions(); - await AccountActionsModal.tapEditAccount(); - await Gestures.clearField(EditAccountNameView.accountNameInput); - await TestHelpers.typeTextAndHideKeyboard( - EditAccountNameSelectorIDs.ACCOUNT_NAME_INPUT, - NEW_ACCOUNT_NAME, - ); - await EditAccountNameView.tapSave(); + await WalletView.tapIdenticon(); + await Assertions.checkIfVisible(AccountListView.accountList); - await Assertions.checkIfElementToHaveText( - WalletView.accountName, - NEW_ACCOUNT_NAME, + for (const accountName of decryptedAccountNames) { + await Assertions.checkIfVisible( + element(by.text(accountName).and(by.id('cellbase-avatar-title'))), ); + } + + await AccountListView.tapAddAccountButton(); + await AddAccountModal.tapCreateAccount(); + + await AccountListView.swipeToDismissAccountsModal(); + + await WalletView.tapMainWalletAccountActions(); + await AccountActionsModal.tapEditAccount(); + await Gestures.clearField(EditAccountNameView.accountNameInput); + await TestHelpers.typeTextAndHideKeyboard( + EditAccountNameSelectorIDs.ACCOUNT_NAME_INPUT, + NEW_ACCOUNT_NAME, + ); + await EditAccountNameView.tapSave(); + + await Assertions.checkIfElementToHaveText( + WalletView.accountName, + NEW_ACCOUNT_NAME, + ); + + await device.launchApp({ + newInstance: true, + delete: true, + }); - await device.launchApp({ - newInstance: true, - delete: true, - }); + await importWalletWithRecoveryPhrase( + NOTIFICATIONS_TEAM_SEED_PHRASE, + NOTIFICATIONS_TEAM_PASSWORD, + ); - await importWalletWithRecoveryPhrase( - NOTIFICATIONS_TEAM_SEED_PHRASE, - NOTIFICATIONS_TEAM_PASSWORD, - ); + await WalletView.tapIdenticon(); + await Assertions.checkIfVisible(AccountListView.accountList); - await WalletView.tapIdenticon(); - await Assertions.checkIfVisible(AccountListView.accountList); + await Assertions.checkIfVisible( + element(by.text(NEW_ACCOUNT_NAME).and(by.id('cellbase-avatar-title'))), + ); - await Assertions.checkIfVisible( - element(by.text(NEW_ACCOUNT_NAME).and(by.id('cellbase-avatar-title'))), - ); - - await stopMockServer(); - }); - }), -); + await stopMockServer(); + }); +}); diff --git a/e2e/specs/notifications/account-syncing/sync-after-onboarding.spec.js b/e2e/specs/notifications/account-syncing/sync-after-onboarding.spec.js index b4ba8aea8e1..fa160b0e2bf 100644 --- a/e2e/specs/notifications/account-syncing/sync-after-onboarding.spec.js +++ b/e2e/specs/notifications/account-syncing/sync-after-onboarding.spec.js @@ -17,53 +17,51 @@ import Assertions from '../../../utils/Assertions'; import { mockNotificationServices } from '../utils/mocks'; import { SmokeNotifications } from '../../../tags'; -describe( - SmokeNotifications('Account syncing', () => { - it('retrieves all previously synced accounts', async () => { - const decryptedAccountNames = await Promise.all( - accountsSyncMockResponse.map(async (response) => { - const decryptedAccountName = await SDK.Encryption.decryptString( - response.Data, - NOTIFICATIONS_TEAM_STORAGE_KEY, - ); - return JSON.parse(decryptedAccountName).n; - }), - ); +describe(SmokeNotifications('Account syncing'), () => { + it('retrieves all previously synced accounts', async () => { + const decryptedAccountNames = await Promise.all( + accountsSyncMockResponse.map(async (response) => { + const decryptedAccountName = await SDK.Encryption.decryptString( + response.Data, + NOTIFICATIONS_TEAM_STORAGE_KEY, + ); + return JSON.parse(decryptedAccountName).n; + }), + ); - const mockServer = await startMockServer({ - mockUrl: 'https://user-storage.api.cx.metamask.io/api/v1/userstorage', - }); + const mockServer = await startMockServer({ + mockUrl: 'https://user-storage.api.cx.metamask.io/api/v1/userstorage', + }); - const { userStorageMockttpControllerInstance } = - await mockNotificationServices(mockServer); + const { userStorageMockttpControllerInstance } = + await mockNotificationServices(mockServer); - userStorageMockttpControllerInstance.setupPath('accounts', mockServer, { - getResponse: accountsSyncMockResponse, - }); + userStorageMockttpControllerInstance.setupPath('accounts', mockServer, { + getResponse: accountsSyncMockResponse, + }); - jest.setTimeout(200000); - await TestHelpers.reverseServerPort(); + jest.setTimeout(200000); + await TestHelpers.reverseServerPort(); - await device.launchApp({ - newInstance: true, - delete: true, - }); + await device.launchApp({ + newInstance: true, + delete: true, + }); - await importWalletWithRecoveryPhrase( - NOTIFICATIONS_TEAM_SEED_PHRASE, - NOTIFICATIONS_TEAM_PASSWORD, - ); + await importWalletWithRecoveryPhrase( + NOTIFICATIONS_TEAM_SEED_PHRASE, + NOTIFICATIONS_TEAM_PASSWORD, + ); - await WalletView.tapIdenticon(); - await Assertions.checkIfVisible(AccountListView.accountList); + await WalletView.tapIdenticon(); + await Assertions.checkIfVisible(AccountListView.accountList); - for (const accountName of decryptedAccountNames) { - await Assertions.checkIfVisible( - element(by.text(accountName).and(by.id('cellbase-avatar-title'))), - ); - } + for (const accountName of decryptedAccountNames) { + await Assertions.checkIfVisible( + element(by.text(accountName).and(by.id('cellbase-avatar-title'))), + ); + } - await stopMockServer(); - }); - }), -); + await stopMockServer(); + }); +}); From 0c8aa2e0778d4cb9e498d75f49fd5bd516d75621 Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Fri, 25 Oct 2024 16:01:22 +0200 Subject: [PATCH 44/49] fix: use process.env.IS_TEST to debug bitrise failing --- app/core/Engine.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/core/Engine.ts b/app/core/Engine.ts index d72daaf99c3..48fdbedd740 100644 --- a/app/core/Engine.ts +++ b/app/core/Engine.ts @@ -253,7 +253,6 @@ import { handleSnapRequest } from './Snaps/utils'; ///: END:ONLY_INCLUDE_IF import { trace } from '../util/trace'; import { MetricsEventBuilder } from './Analytics/MetricsEventBuilder'; -import { isProduction } from '../util/environment'; const NON_EMPTY = 'NON_EMPTY'; @@ -1219,7 +1218,7 @@ class Engine { const userStorageController = new UserStorageController.Controller({ getMetaMetricsState: () => MetaMetrics.getInstance().isEnabled(), env: { - isAccountSyncingEnabled: !isProduction(), + isAccountSyncingEnabled: Boolean(process.env.IS_TEST), }, config: { accountSyncing: { From 3f53a497a8680d4e5bf3b0733b3870b1f67047eb Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Fri, 25 Oct 2024 16:27:56 +0200 Subject: [PATCH 45/49] fix: bitrise config --- bitrise.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bitrise.yml b/bitrise.yml index 6e6c2256920..a957473a0dc 100644 --- a/bitrise.yml +++ b/bitrise.yml @@ -528,7 +528,7 @@ workflows: - android_e2e_test run_tag_smoke_notifications_ios: envs: - - TEST_SUITE_FOLDER: './e2e/specs/notifications/**/*' + - TEST_SUITE_FOLDER: './e2e/specs/notifications/*' - TEST_SUITE_TAG: '.*SmokeNotifications.*' after_run: - ios_e2e_test @@ -538,7 +538,7 @@ workflows: stack: linux-docker-android-22.04 machine_type_id: elite-xl envs: - - TEST_SUITE_FOLDER: './e2e/specs/notifications/**/*' + - TEST_SUITE_FOLDER: './e2e/specs/notifications/*' - TEST_SUITE_TAG: '.*SmokeNotifications.*' after_run: - android_e2e_test From ab6011e3b81897d5922296e2e561d3d98cd36714 Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Thu, 31 Oct 2024 20:06:26 +0100 Subject: [PATCH 46/49] fix: use test matchers and pages --- e2e/pages/AccountListView.js | 7 ++ e2e/pages/modals/AccountActionsModal.js | 13 ++++ ...c-after-adding-custom-name-account.spec.js | 22 ++---- .../sync-after-onboarding.spec.js | 4 +- yarn.lock | 70 ++++++++++++------- 5 files changed, 70 insertions(+), 46 deletions(-) diff --git a/e2e/pages/AccountListView.js b/e2e/pages/AccountListView.js index c06efe7df19..f42dbc96b50 100644 --- a/e2e/pages/AccountListView.js +++ b/e2e/pages/AccountListView.js @@ -46,6 +46,13 @@ class AccountListView { return Matchers.getElementByID(CellModalSelectorsIDs.BASE_TITLE, index); } + getAccountElementByAccountName(accountName) { + return Matchers.getElementByIDAndLabel( + CellModalSelectorsIDs.BASE_TITLE, + accountName, + ); + } + getSelectElement(index) { return Matchers.getElementByID(CellModalSelectorsIDs.SELECT, index); } diff --git a/e2e/pages/modals/AccountActionsModal.js b/e2e/pages/modals/AccountActionsModal.js index 0fdfc25ef84..5ca700ed16a 100644 --- a/e2e/pages/modals/AccountActionsModal.js +++ b/e2e/pages/modals/AccountActionsModal.js @@ -1,6 +1,9 @@ import { AccountActionsModalSelectorsIDs } from '../../selectors/Modals/AccountActionsModal.selectors.js'; import Matchers from '../../utils/Matchers'; import Gestures from '../../utils/Gestures'; +import EditAccountNameSelectorIDs from '../../selectors/EditAccountName.selectors.js'; +import TestHelpers from '../../helpers.js'; +import EditAccountNameView from '../EditAccountNameView.js'; class AccountActionsModal { get editAccount() { @@ -22,6 +25,16 @@ class AccountActionsModal { async tapShowPrivateKey() { await Gestures.waitAndTap(await this.showPrivateKey); } + + async renameActiveAccount(newName) { + await this.tapEditAccount(); + await Gestures.clearField(EditAccountNameView.accountNameInput); + await TestHelpers.typeTextAndHideKeyboard( + EditAccountNameSelectorIDs.ACCOUNT_NAME_INPUT, + newName, + ); + await EditAccountNameView.tapSave(); + } } export default new AccountActionsModal(); diff --git a/e2e/specs/notifications/account-syncing/sync-after-adding-custom-name-account.spec.js b/e2e/specs/notifications/account-syncing/sync-after-adding-custom-name-account.spec.js index cab8262e3e5..d4b825ec117 100644 --- a/e2e/specs/notifications/account-syncing/sync-after-adding-custom-name-account.spec.js +++ b/e2e/specs/notifications/account-syncing/sync-after-adding-custom-name-account.spec.js @@ -7,7 +7,7 @@ import { import { startMockServer, stopMockServer, -} from '../../../mockServer/mockServer'; +} from '../../../api-mocking/mock-server'; import { accountsSyncMockResponse } from './mockData'; import { importWalletWithRecoveryPhrase } from '../../../viewHelper'; import TestHelpers from '../../../helpers'; @@ -16,9 +16,6 @@ import AccountListView from '../../../pages/AccountListView'; import Assertions from '../../../utils/Assertions'; import AddAccountModal from '../../../pages/modals/AddAccountModal'; import AccountActionsModal from '../../../pages/modals/AccountActionsModal'; -import EditAccountNameView from '../../../pages/EditAccountNameView'; -import Gestures from '../../../utils/Gestures'; -import EditAccountNameSelectorIDs from '../../../selectors/EditAccountName.selectors'; import { mockNotificationServices } from '../utils/mocks'; import { SmokeNotifications } from '../../../tags'; @@ -29,9 +26,7 @@ describe(SmokeNotifications('Account syncing'), () => { jest.setTimeout(200000); await TestHelpers.reverseServerPort(); - const mockServer = await startMockServer({ - mockUrl: 'https://user-storage.api.cx.metamask.io/api/v1/userstorage', - }); + const mockServer = await startMockServer(); const { userStorageMockttpControllerInstance } = await mockNotificationServices(mockServer); @@ -65,23 +60,16 @@ describe(SmokeNotifications('Account syncing'), () => { for (const accountName of decryptedAccountNames) { await Assertions.checkIfVisible( - element(by.text(accountName).and(by.id('cellbase-avatar-title'))), + await AccountListView.getAccountElementByAccountName(accountName), ); } await AccountListView.tapAddAccountButton(); await AddAccountModal.tapCreateAccount(); - await AccountListView.swipeToDismissAccountsModal(); await WalletView.tapMainWalletAccountActions(); - await AccountActionsModal.tapEditAccount(); - await Gestures.clearField(EditAccountNameView.accountNameInput); - await TestHelpers.typeTextAndHideKeyboard( - EditAccountNameSelectorIDs.ACCOUNT_NAME_INPUT, - NEW_ACCOUNT_NAME, - ); - await EditAccountNameView.tapSave(); + await AccountActionsModal.renameActiveAccount(NEW_ACCOUNT_NAME); await Assertions.checkIfElementToHaveText( WalletView.accountName, @@ -102,7 +90,7 @@ describe(SmokeNotifications('Account syncing'), () => { await Assertions.checkIfVisible(AccountListView.accountList); await Assertions.checkIfVisible( - element(by.text(NEW_ACCOUNT_NAME).and(by.id('cellbase-avatar-title'))), + await AccountListView.getAccountElementByAccountName(NEW_ACCOUNT_NAME), ); await stopMockServer(); diff --git a/e2e/specs/notifications/account-syncing/sync-after-onboarding.spec.js b/e2e/specs/notifications/account-syncing/sync-after-onboarding.spec.js index fa160b0e2bf..3be2697e1e3 100644 --- a/e2e/specs/notifications/account-syncing/sync-after-onboarding.spec.js +++ b/e2e/specs/notifications/account-syncing/sync-after-onboarding.spec.js @@ -7,7 +7,7 @@ import { import { startMockServer, stopMockServer, -} from '../../../mockServer/mockServer'; +} from '../../../api-mocking/mock-server'; import { accountsSyncMockResponse } from './mockData'; import { importWalletWithRecoveryPhrase } from '../../../viewHelper'; import TestHelpers from '../../../helpers'; @@ -58,7 +58,7 @@ describe(SmokeNotifications('Account syncing'), () => { for (const accountName of decryptedAccountNames) { await Assertions.checkIfVisible( - element(by.text(accountName).and(by.id('cellbase-avatar-title'))), + await AccountListView.getAccountElementByAccountName(accountName), ); } diff --git a/yarn.lock b/yarn.lock index 7c9c734299e..c01533e41e0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4410,12 +4410,12 @@ "@metamask/utils" "^9.1.0" immer "^9.0.6" -"@metamask/base-controller@^7.0.1": - version "7.0.1" - resolved "https://registry.yarnpkg.com/@metamask/base-controller/-/base-controller-7.0.1.tgz#78eef77c2cd980e1f86bd5077c229bbaa5fd2b9d" - integrity sha512-U1strOKT4v/kSJ2h4tgn9iUVVuv5Ja64J+OR145ITHd4574FaUYVJR80/imn6WmCbo8B6AYwHwEovdZ5qLGSKw== +"@metamask/base-controller@^7.0.1", "@metamask/base-controller@^7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@metamask/base-controller/-/base-controller-7.0.2.tgz#bf908858215cd4f7d072b3b0f7f0946cf886ee49" + integrity sha512-zeZ5QPKedGT/r2M1NsT4lE7z4u9ciSNcOXG2vUdmfA+QT9YLwIm5+t56UGku3ZTjKGxDn9Ukca3BEkRc57Gt0A== dependencies: - "@metamask/utils" "^9.1.0" + "@metamask/utils" "^10.0.0" immer "^9.0.6" "@metamask/browser-passworder@^4.3.0": @@ -4452,17 +4452,18 @@ resolved "https://registry.yarnpkg.com/@metamask/contract-metadata/-/contract-metadata-2.2.0.tgz#277764d0d56e37180ae7644a9d11eb96295b36fc" integrity sha512-SM6A4C7vXNbVpgMTX67kfW8QWvu3eSXxMZlY5PqZBTkvri1s9zgQ0uwRkK5r2VXNEoVmXCDnnEX/tX5EzzgNUQ== -"@metamask/controller-utils@^11.0.0", "@metamask/controller-utils@^11.0.2", "@metamask/controller-utils@^11.3.0": - version "11.3.0" - resolved "https://registry.yarnpkg.com/@metamask/controller-utils/-/controller-utils-11.3.0.tgz#530fd22289f717b752b4a7b6e504e1f2911b30a4" - integrity sha512-5b+Jg9sKKESzvQcuipHC1D7KSh98MVIi7hXQUk7iX+YVMl4KoKDv94Bl+li8g+jCBshMOV9bRMRh25/hdEvTZQ== +"@metamask/controller-utils@^11.0.0", "@metamask/controller-utils@^11.0.2", "@metamask/controller-utils@^11.3.0", "@metamask/controller-utils@^11.4.2": + version "11.4.2" + resolved "https://registry.yarnpkg.com/@metamask/controller-utils/-/controller-utils-11.4.2.tgz#0186c62c841ec94f60a67d0764dc7ab59c176c51" + integrity sha512-4zGfTTpjDgvRxo/tb3v1NBu0V/b2bqaDpSQC0noi5A4sm1yiZhyzqBY9+Zg11s8G/imp7+jvYRP1QM6OjFgIjQ== dependencies: "@ethereumjs/util" "^8.1.0" "@metamask/eth-query" "^4.0.0" "@metamask/ethjs-unit" "^0.3.0" - "@metamask/utils" "^9.1.0" + "@metamask/utils" "^10.0.0" "@spruceid/siwe-parser" "2.1.0" "@types/bn.js" "^5.1.5" + bignumber.js "^9.1.2" bn.js "^5.2.1" eth-ens-namehash "^2.0.8" fast-deep-equal "^3.1.3" @@ -4894,21 +4895,21 @@ bech32 "^2.0.0" uuid "^9.0.1" -"@metamask/keyring-controller@^17.2.1", "@metamask/keyring-controller@^17.2.2": - version "17.2.2" - resolved "https://registry.yarnpkg.com/@metamask/keyring-controller/-/keyring-controller-17.2.2.tgz#944bc693305b4a6e4f1e73739a82c4bc6573dd9a" - integrity sha512-Shqk0ybcTPrHQLlBJ1V+InuYC7nD3/a6Ws0XCcBCOfkLTXvtSooKIWBioK83XlHMHkfsM6+bySxSqXJVgJvBZw== +"@metamask/keyring-controller@^17.1.0", "@metamask/keyring-controller@^17.2.1", "@metamask/keyring-controller@^17.2.2": + version "17.3.1" + resolved "https://registry.yarnpkg.com/@metamask/keyring-controller/-/keyring-controller-17.3.1.tgz#1a498dd165df5b908761e62fc9e194b8a4f9a074" + integrity sha512-+R4tD0KtXjjAts5xOo+CKETPQVa+RJDC98L2qU2iGHyFKN05gFYt4M8HMcK4gq2GhGxm+0r6SYOUw2jK/wjD5g== dependencies: "@ethereumjs/util" "^8.1.0" "@keystonehq/metamask-airgapped-keyring" "^0.14.1" - "@metamask/base-controller" "^7.0.1" + "@metamask/base-controller" "^7.0.2" "@metamask/browser-passworder" "^4.3.0" "@metamask/eth-hd-keyring" "^7.0.4" - "@metamask/eth-sig-util" "^7.0.1" + "@metamask/eth-sig-util" "^8.0.0" "@metamask/eth-simple-keyring" "^6.0.5" "@metamask/keyring-api" "^8.1.3" - "@metamask/message-manager" "^10.1.1" - "@metamask/utils" "^9.1.0" + "@metamask/message-manager" "^11.0.1" + "@metamask/utils" "^10.0.0" async-mutex "^0.5.0" ethereumjs-wallet "^1.0.1" immer "^9.0.6" @@ -4922,15 +4923,15 @@ "@metamask/controller-utils" "^11.3.0" uuid "^8.3.2" -"@metamask/message-manager@^10.1.1": - version "10.1.1" - resolved "https://registry.yarnpkg.com/@metamask/message-manager/-/message-manager-10.1.1.tgz#390acc4dff9f7c72aaf5c183397c872e53ae7f12" - integrity sha512-VFFqEPKOyo59P79CP/vlPDpMng1a1mMHIaXuvEJYTOf/UOqeVpw77G5IHVfjuG+tZNlAQIHYp7sEmPkob+rzcA== +"@metamask/message-manager@^11.0.1": + version "11.0.1" + resolved "https://registry.yarnpkg.com/@metamask/message-manager/-/message-manager-11.0.1.tgz#7ffa6ea5a0daebb0ccb78dbd75774bf3aa0b9d69" + integrity sha512-dPkx6v14MyBPqdnKSlBPR97/BCx8KLuGudK9u0U3CmqI5dpO3mXvwXNspu5lnBrnjAoYqQVb+/e4vqkOx4/DlQ== dependencies: - "@metamask/base-controller" "^7.0.1" - "@metamask/controller-utils" "^11.3.0" - "@metamask/eth-sig-util" "^7.0.1" - "@metamask/utils" "^9.1.0" + "@metamask/base-controller" "^7.0.2" + "@metamask/controller-utils" "^11.4.2" + "@metamask/eth-sig-util" "^8.0.0" + "@metamask/utils" "^10.0.0" "@types/uuid" "^8.3.0" jsonschema "^1.2.4" uuid "^8.3.2" @@ -5676,6 +5677,21 @@ lodash "^4.17.21" uuid "^8.3.2" +"@metamask/utils@^10.0.0": + version "10.0.0" + resolved "https://registry.yarnpkg.com/@metamask/utils/-/utils-10.0.0.tgz#9285e6e195810e8b7c875147ac64981b4be51733" + integrity sha512-EoNZJijLqBbir8ikuiHBHfhCqE1s8Odae3bhtRAd8itJB109xmfFF84djY/iaQI+EAp59Sy7iwengfRohaTK8A== + dependencies: + "@ethereumjs/tx" "^4.2.0" + "@metamask/superstruct" "^3.1.0" + "@noble/hashes" "^1.3.1" + "@scure/base" "^1.1.3" + "@types/debug" "^4.1.7" + debug "^4.3.4" + pony-cause "^2.1.10" + semver "^7.5.4" + uuid "^9.0.1" + "@metamask/utils@^3.4.1": version "3.6.0" resolved "https://registry.yarnpkg.com/@metamask/utils/-/utils-3.6.0.tgz#b218b969a05ca7a8093b5d1670f6625061de707d" @@ -13311,7 +13327,7 @@ bignumber.js@^7.2.1: resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-7.2.1.tgz#80c048759d826800807c4bfd521e50edbba57a5f" integrity sha512-S4XzBk5sMB+Rcb/LNcpzXr57VRTxgAvaAEDAl1AwRx27j00hT84O6OkteE7u8UB3NuaaygCRrEpqox4uDOrbdQ== -bignumber.js@^9.0.1, bignumber.js@^9.0.2: +bignumber.js@^9.0.1, bignumber.js@^9.0.2, bignumber.js@^9.1.2: version "9.1.2" resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.2.tgz#b7c4242259c008903b13707983b5f4bbd31eda0c" integrity sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug== From 89cc06bfe7d70b627669d8ddebebb6fc0537a9f4 Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Thu, 31 Oct 2024 20:12:41 +0100 Subject: [PATCH 47/49] fix: yarn.lock --- yarn.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yarn.lock b/yarn.lock index 050ad722fa9..6543568b482 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4452,7 +4452,7 @@ resolved "https://registry.yarnpkg.com/@metamask/contract-metadata/-/contract-metadata-2.2.0.tgz#277764d0d56e37180ae7644a9d11eb96295b36fc" integrity sha512-SM6A4C7vXNbVpgMTX67kfW8QWvu3eSXxMZlY5PqZBTkvri1s9zgQ0uwRkK5r2VXNEoVmXCDnnEX/tX5EzzgNUQ== -"@metamask/controller-utils@^11.0.0", "@metamask/controller-utils@^11.0.2", "@metamask/controller-utils@^11.3.0", "@metamask/controller-utils@^11.4.2": +"@metamask/controller-utils@^11.0.0", "@metamask/controller-utils@^11.0.2", "@metamask/controller-utils@^11.3.0", "@metamask/controller-utils@^11.4.1", "@metamask/controller-utils@^11.4.2": version "11.4.2" resolved "https://registry.yarnpkg.com/@metamask/controller-utils/-/controller-utils-11.4.2.tgz#0186c62c841ec94f60a67d0764dc7ab59c176c51" integrity sha512-4zGfTTpjDgvRxo/tb3v1NBu0V/b2bqaDpSQC0noi5A4sm1yiZhyzqBY9+Zg11s8G/imp7+jvYRP1QM6OjFgIjQ== From 503549771db45d843e06e15e5a74789209b7031b Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Thu, 31 Oct 2024 22:34:45 +0100 Subject: [PATCH 48/49] fix: yarn.lock --- yarn.lock | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/yarn.lock b/yarn.lock index d61243e101d..593a75ea1f1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4418,6 +4418,14 @@ "@metamask/utils" "^9.1.0" immer "^9.0.6" +"@metamask/base-controller@^7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@metamask/base-controller/-/base-controller-7.0.2.tgz#bf908858215cd4f7d072b3b0f7f0946cf886ee49" + integrity sha512-zeZ5QPKedGT/r2M1NsT4lE7z4u9ciSNcOXG2vUdmfA+QT9YLwIm5+t56UGku3ZTjKGxDn9Ukca3BEkRc57Gt0A== + dependencies: + "@metamask/utils" "^10.0.0" + immer "^9.0.6" + "@metamask/browser-passworder@^4.3.0": version "4.3.0" resolved "https://registry.yarnpkg.com/@metamask/browser-passworder/-/browser-passworder-4.3.0.tgz#62c200750efcea864bd31d685120331859e1ab1e" @@ -4452,7 +4460,7 @@ resolved "https://registry.yarnpkg.com/@metamask/contract-metadata/-/contract-metadata-2.2.0.tgz#277764d0d56e37180ae7644a9d11eb96295b36fc" integrity sha512-SM6A4C7vXNbVpgMTX67kfW8QWvu3eSXxMZlY5PqZBTkvri1s9zgQ0uwRkK5r2VXNEoVmXCDnnEX/tX5EzzgNUQ== -"@metamask/controller-utils@^11.0.0", "@metamask/controller-utils@^11.0.2", "@metamask/controller-utils@^11.3.0", "@metamask/controller-utils@^11.4.1", "@metamask/controller-utils@^11.4.2": +"@metamask/controller-utils@^11.0.0", "@metamask/controller-utils@^11.0.2", "@metamask/controller-utils@^11.3.0", "@metamask/controller-utils@^11.4.2": version "11.4.2" resolved "https://registry.yarnpkg.com/@metamask/controller-utils/-/controller-utils-11.4.2.tgz#0186c62c841ec94f60a67d0764dc7ab59c176c51" integrity sha512-4zGfTTpjDgvRxo/tb3v1NBu0V/b2bqaDpSQC0noi5A4sm1yiZhyzqBY9+Zg11s8G/imp7+jvYRP1QM6OjFgIjQ== @@ -4460,9 +4468,10 @@ "@ethereumjs/util" "^8.1.0" "@metamask/eth-query" "^4.0.0" "@metamask/ethjs-unit" "^0.3.0" - "@metamask/utils" "^9.1.0" + "@metamask/utils" "^10.0.0" "@spruceid/siwe-parser" "2.1.0" "@types/bn.js" "^5.1.5" + bignumber.js "^9.1.2" bn.js "^5.2.1" eth-ens-namehash "^2.0.8" fast-deep-equal "^3.1.3" @@ -5676,6 +5685,21 @@ lodash "^4.17.21" uuid "^8.3.2" +"@metamask/utils@^10.0.0": + version "10.0.0" + resolved "https://registry.yarnpkg.com/@metamask/utils/-/utils-10.0.0.tgz#9285e6e195810e8b7c875147ac64981b4be51733" + integrity sha512-EoNZJijLqBbir8ikuiHBHfhCqE1s8Odae3bhtRAd8itJB109xmfFF84djY/iaQI+EAp59Sy7iwengfRohaTK8A== + dependencies: + "@ethereumjs/tx" "^4.2.0" + "@metamask/superstruct" "^3.1.0" + "@noble/hashes" "^1.3.1" + "@scure/base" "^1.1.3" + "@types/debug" "^4.1.7" + debug "^4.3.4" + pony-cause "^2.1.10" + semver "^7.5.4" + uuid "^9.0.1" + "@metamask/utils@^3.4.1": version "3.6.0" resolved "https://registry.yarnpkg.com/@metamask/utils/-/utils-3.6.0.tgz#b218b969a05ca7a8093b5d1670f6625061de707d" From d0ce1916864f1212f11915b841cbfdca8c6db25e Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Thu, 31 Oct 2024 23:05:35 +0100 Subject: [PATCH 49/49] fix: yarn.lock --- yarn.lock | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/yarn.lock b/yarn.lock index 593a75ea1f1..c01533e41e0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4410,15 +4410,7 @@ "@metamask/utils" "^9.1.0" immer "^9.0.6" -"@metamask/base-controller@^7.0.1": - version "7.0.1" - resolved "https://registry.yarnpkg.com/@metamask/base-controller/-/base-controller-7.0.1.tgz#78eef77c2cd980e1f86bd5077c229bbaa5fd2b9d" - integrity sha512-U1strOKT4v/kSJ2h4tgn9iUVVuv5Ja64J+OR145ITHd4574FaUYVJR80/imn6WmCbo8B6AYwHwEovdZ5qLGSKw== - dependencies: - "@metamask/utils" "^9.1.0" - immer "^9.0.6" - -"@metamask/base-controller@^7.0.2": +"@metamask/base-controller@^7.0.1", "@metamask/base-controller@^7.0.2": version "7.0.2" resolved "https://registry.yarnpkg.com/@metamask/base-controller/-/base-controller-7.0.2.tgz#bf908858215cd4f7d072b3b0f7f0946cf886ee49" integrity sha512-zeZ5QPKedGT/r2M1NsT4lE7z4u9ciSNcOXG2vUdmfA+QT9YLwIm5+t56UGku3ZTjKGxDn9Ukca3BEkRc57Gt0A== @@ -13335,7 +13327,7 @@ bignumber.js@^7.2.1: resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-7.2.1.tgz#80c048759d826800807c4bfd521e50edbba57a5f" integrity sha512-S4XzBk5sMB+Rcb/LNcpzXr57VRTxgAvaAEDAl1AwRx27j00hT84O6OkteE7u8UB3NuaaygCRrEpqox4uDOrbdQ== -bignumber.js@^9.0.1, bignumber.js@^9.0.2: +bignumber.js@^9.0.1, bignumber.js@^9.0.2, bignumber.js@^9.1.2: version "9.1.2" resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.2.tgz#b7c4242259c008903b13707983b5f4bbd31eda0c" integrity sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug==