From daf7c1853659a687b66e752f7f48e9e198f0d2d8 Mon Sep 17 00:00:00 2001 From: Tom Beckenham <34339192+tombeckenham@users.noreply.github.com> Date: Wed, 23 Jul 2025 15:09:07 +1000 Subject: [PATCH 1/6] Corrected type issue getting the evm address when requesting accounts Closes #1204 --- src/background/controller/provider/controller.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/background/controller/provider/controller.ts b/src/background/controller/provider/controller.ts index 19cd96ad3..a2fa840a9 100644 --- a/src/background/controller/provider/controller.ts +++ b/src/background/controller/provider/controller.ts @@ -235,17 +235,20 @@ class ProviderController extends BaseController { } const currentWallet = await Wallet.getParentAddress(); - let evmAddress; + let evmAddress: string; if (!currentWallet) { throw new Error('Current wallet not found'); } try { // Attempt to query the EVM address - evmAddress = await userWalletService.getEvmAccountOfParent(currentWallet); - if (!isValidEthereumAddress(evmAddress)) { + + const evmAccount = await userWalletService.getEvmAccountOfParent(currentWallet); + + if (!evmAccount || !isValidEthereumAddress(evmAccount.address)) { throw new Error('Invalid EVM address'); } + evmAddress = evmAccount.address; } catch (error) { // If an error occurs, request approval consoleError('ethRequestAccounts - Error querying EVM address:', error); @@ -257,10 +260,12 @@ class ProviderController extends BaseController { }, { height: 599 } ); - evmAddress = await userWalletService.getEvmAccountOfParent(currentWallet); - if (!isValidEthereumAddress(evmAddress)) { + const evmAccount = await userWalletService.getEvmAccountOfParent(currentWallet); + + if (!evmAccount || !isValidEthereumAddress(evmAccount.address)) { throw new Error('Invalid EVM address'); } + evmAddress = evmAccount.address; } const account = evmAddress ? [ensureEvmAddressPrefix(evmAddress)] : []; From b98c662a6985e8ab92075c06b68dea25c3b1a954 Mon Sep 17 00:00:00 2001 From: Tom Beckenham <34339192+tombeckenham@users.noreply.github.com> Date: Wed, 23 Jul 2025 15:34:48 +1000 Subject: [PATCH 2/6] Fixed back button and seed phrase import padding Closes #1206 --- .../components/password/PasswordTextarea.tsx | 2 ++ src/ui/views/Welcome/import-profile/index.tsx | 19 +++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/ui/components/password/PasswordTextarea.tsx b/src/ui/components/password/PasswordTextarea.tsx index 24fcfeecb..8f575885a 100644 --- a/src/ui/components/password/PasswordTextarea.tsx +++ b/src/ui/components/password/PasswordTextarea.tsx @@ -61,11 +61,13 @@ const PasswordTextarea = ({ // The actual textarea styling '& .MuiInputBase-input': { padding: '20px', + paddingRight: '40px', resize: 'none', fontSize: '16px', fontFamily: 'Inter', fontWeight: 400, color: '#fff', + WebkitTextSecurity: showPassword ? 'none' : 'disc', '&::placeholder': { color: '#767676', diff --git a/src/ui/views/Welcome/import-profile/index.tsx b/src/ui/views/Welcome/import-profile/index.tsx index e808e9382..75e9d87e9 100644 --- a/src/ui/views/Welcome/import-profile/index.tsx +++ b/src/ui/views/Welcome/import-profile/index.tsx @@ -1,6 +1,6 @@ import { Alert, Snackbar } from '@mui/material'; import React, { useEffect, useReducer } from 'react'; -import { useNavigate } from 'react-router'; +import { useLocation, useNavigate } from 'react-router'; import { IMPORT_STEPS, @@ -27,6 +27,7 @@ export const initImportProfileState = (initialState: ImportState): ImportState = const ImportProfile = () => { const navigate = useNavigate(); + const location = useLocation(); const usewallet = useWallet(); const [state, dispatch] = useReducer(importProfileReducer, INITIAL_IMPORT_STATE); @@ -107,8 +108,14 @@ const ImportProfile = () => { }; const goBack = () => { - if (activeTab === IMPORT_STEPS.GOOGLE_BACKUP || activeTab === IMPORT_STEPS.ALL_SET) { - navigate(-1); + if ( + activeTab === IMPORT_STEPS.GOOGLE_BACKUP || + activeTab === IMPORT_STEPS.ALL_SET || + activeTab === IMPORT_STEPS.IMPORT + ) { + if (location.key !== 'default') { + navigate(-1); + } return; } dispatch({ type: 'GO_BACK' }); @@ -131,11 +138,15 @@ const ImportProfile = () => { /> ); } + + const showBackButton = + activeTab !== IMPORT_STEPS.ALL_SET && + (activeTab !== IMPORT_STEPS.IMPORT || location.key !== 'default'); return ( Date: Thu, 24 Jul 2025 10:07:47 +1000 Subject: [PATCH 3/6] Turn off moving NFT from child until we can redo it Closes #1208 --- src/ui/views/Linked/LinkedNftDetail.tsx | 6 +++--- src/ui/views/NFT/Detail.tsx | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/ui/views/Linked/LinkedNftDetail.tsx b/src/ui/views/Linked/LinkedNftDetail.tsx index 209adad0a..51f942f12 100644 --- a/src/ui/views/Linked/LinkedNftDetail.tsx +++ b/src/ui/views/Linked/LinkedNftDetail.tsx @@ -8,7 +8,6 @@ import React, { useCallback, useEffect, useState } from 'react'; import { useLocation, useNavigate } from 'react-router'; import fallback from '@/ui/assets/image/errorImage.png'; -import DetailMove from '@/ui/assets/svg/detailMove.svg'; import SendIcon from '@/ui/assets/svg/detailSend.svg'; import { useWallet } from '@/ui/hooks/use-wallet'; import { useProfiles } from '@/ui/hooks/useProfileHook'; @@ -481,7 +480,8 @@ const LinkedNftDetail = () => { {chrome.i18n.getMessage('Send')} )} - + {/* TODO: TB July 2025. This is not working as the script doesn't exist. Turning off for now */} + {/* {nftDetail?.collectionID && ( )} + */} {moveOpen && ( diff --git a/src/ui/views/NFT/Detail.tsx b/src/ui/views/NFT/Detail.tsx index 2ff9ffe29..813eee214 100644 --- a/src/ui/views/NFT/Detail.tsx +++ b/src/ui/views/NFT/Detail.tsx @@ -49,17 +49,20 @@ const Detail = () => { const [contactOne, setContactOne] = useState(emptyContact); const [contactTwo, setContactTwo] = useState(emptyContact); const [isAccessibleNft, setisAccessibleNft] = useState(false); - const [canMoveChild, setCanMoveChild] = useState(true); + // TB July 2025. This always fails as the script doesn't exist. Turning off for now + const [canMoveChild, setCanMoveChild] = useState(false); + /* useEffect(() => { const checkPermission = async () => { + // TODO: TB July 2025. This always fails as the script doesn't exist. Turning off for now const result = await usewallet.checkCanMoveChild(currentWallet.address); setCanMoveChild(result); }; checkPermission(); }, [usewallet, currentWallet.address]); - + */ useEffect(() => { const savedState = localStorage.getItem('nftDetailState'); if (savedState) { From b493005452e67b3ac48e11d8905939a746494534 Mon Sep 17 00:00:00 2001 From: Tom Beckenham <34339192+tombeckenham@users.noreply.github.com> Date: Thu, 24 Jul 2025 10:13:05 +1000 Subject: [PATCH 4/6] Corrected back button on create new profile Closes #1208 --- src/ui/views/Welcome/Register/index.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ui/views/Welcome/Register/index.tsx b/src/ui/views/Welcome/Register/index.tsx index 3573898f9..949db1e09 100644 --- a/src/ui/views/Welcome/Register/index.tsx +++ b/src/ui/views/Welcome/Register/index.tsx @@ -1,7 +1,7 @@ import { Box } from '@mui/material'; import * as bip39 from 'bip39'; import React, { useCallback, useEffect, useReducer } from 'react'; -import { useNavigate } from 'react-router'; +import { useLocation, useNavigate } from 'react-router'; import { INITIAL_REGISTER_STATE, @@ -28,6 +28,8 @@ export const initRegisterState = (initialState: RegisterState): RegisterState => const Register = () => { const navigate = useNavigate(); + const location = useLocation(); + const usewallet = useWallet(); const [state, dispatch] = useReducer(registerReducer, INITIAL_REGISTER_STATE, initRegisterState); @@ -66,11 +68,15 @@ const Register = () => { } }; + // Only show the back button if there is a page to go back to + const showBackButton = + activeTab !== STEPS.ALL_SET && (activeTab !== STEPS.USERNAME || location.key !== 'default'); + return ( Date: Thu, 24 Jul 2025 11:31:40 +1000 Subject: [PATCH 5/6] Now wants til wallet is loaded before redirecting Closes #1208 --- src/ui/components/PrivateRoute.tsx | 24 +++++++++++++----------- src/ui/views/SortHat.tsx | 9 ++++++--- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/ui/components/PrivateRoute.tsx b/src/ui/components/PrivateRoute.tsx index e64b5be3b..6dd5acee8 100644 --- a/src/ui/components/PrivateRoute.tsx +++ b/src/ui/components/PrivateRoute.tsx @@ -1,13 +1,14 @@ import React, { useEffect, useState } from 'react'; import { Navigate } from 'react-router'; -import { useWallet } from '@/ui/hooks/use-wallet'; +import { useWallet, useWalletLoaded } from '@/ui/hooks/use-wallet'; import { getUiType } from '../utils'; import { openInternalPageInTab } from '../utils/webapi'; const PrivateRoute = ({ children }) => { const wallet = useWallet(); + const walletLoaded = useWalletLoaded(); const [booted, setBooted] = useState(false); const [unlocked, setUnlocked] = useState(false); @@ -28,20 +29,21 @@ const PrivateRoute = ({ children }) => { return { booted, unlocked }; } }; - - // Initial check - fetchLockState().then(({ booted, unlocked }) => { - if (mounted) { - setBooted(booted); - setUnlocked(unlocked); - setLoading(false); - } - }); + if (walletLoaded) { + // Initial check + fetchLockState().then(({ booted, unlocked }) => { + if (mounted) { + setBooted(booted); + setUnlocked(unlocked); + setLoading(false); + } + }); + } return () => { mounted = false; }; - }, [wallet]); + }, [wallet, walletLoaded]); if (loading) { // If we haven't loaded, we can't make a decision on whether to render the children diff --git a/src/ui/views/SortHat.tsx b/src/ui/views/SortHat.tsx index f1241c2aa..3916f4f6c 100644 --- a/src/ui/views/SortHat.tsx +++ b/src/ui/views/SortHat.tsx @@ -3,12 +3,13 @@ import { Navigate } from 'react-router'; import Spin from '@/ui/components/Spin'; import { useApproval } from '@/ui/hooks/use-approval'; -import { useWallet } from '@/ui/hooks/use-wallet'; +import { useWallet, useWalletLoaded } from '@/ui/hooks/use-wallet'; import { getUiType } from '@/ui/utils'; import { openInternalPageInTab } from '@/ui/utils/webapi'; const SortHat = () => { const wallet = useWallet(); + const walletLoaded = useWalletLoaded(); const [to, setTo] = useState(''); // eslint-disable-next-line prefer-const let [getApproval, , rejectApproval] = useApproval(); @@ -68,8 +69,10 @@ const SortHat = () => { }, [getApproval, rejectApproval, wallet]); useEffect(() => { - loadView(); - }, [loadView]); + if (walletLoaded) { + loadView(); + } + }, [loadView, walletLoaded]); return ( // From 4eef8fc8bb8e723cf0b1acc5d50c6b6a28d2cd7a Mon Sep 17 00:00:00 2001 From: Tom Beckenham <34339192+tombeckenham@users.noreply.github.com> Date: Thu, 24 Jul 2025 11:38:12 +1000 Subject: [PATCH 6/6] Re-enabled move button for main accounts Closes #1208 --- src/ui/views/NFT/Detail.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ui/views/NFT/Detail.tsx b/src/ui/views/NFT/Detail.tsx index 813eee214..8fb23ae57 100644 --- a/src/ui/views/NFT/Detail.tsx +++ b/src/ui/views/NFT/Detail.tsx @@ -51,7 +51,9 @@ const Detail = () => { const [isAccessibleNft, setisAccessibleNft] = useState(false); // TB July 2025. This always fails as the script doesn't exist. Turning off for now - const [canMoveChild, setCanMoveChild] = useState(false); + // const [canMoveChild, setCanMoveChild] = useState(false); + + const canMoveChild = activeAccountType !== 'child' && currentWallet.address; /* useEffect(() => { const checkPermission = async () => {