Skip to content
This repository was archived by the owner on Mar 2, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/background/controller/provider/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)] : [];
Expand Down
24 changes: 13 additions & 11 deletions src/ui/components/PrivateRoute.tsx
Original file line number Diff line number Diff line change
@@ -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);
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/ui/components/password/PasswordTextarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
6 changes: 3 additions & 3 deletions src/ui/views/Linked/LinkedNftDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -481,7 +480,8 @@ const LinkedNftDetail = () => {
{chrome.i18n.getMessage('Send')}
</Button>
)}

{/* TODO: TB July 2025. This is not working as the script doesn't exist. Turning off for now */}
{/*
{nftDetail?.collectionID && (
<Button
sx={{
Expand All @@ -498,14 +498,14 @@ const LinkedNftDetail = () => {
disabled={!isAccessibleNft}
onClick={() => setMoveOpen(true)}
>
{/* <IosShareOutlinedIcon color="primary" /> */}
<CardMedia
image={DetailMove}
sx={{ width: '20px', height: '20px', color: '#fff', marginRight: '8px' }}
/>
{chrome.i18n.getMessage('Move')}
</Button>
)}
*/}
</Box>

{moveOpen && (
Expand Down
9 changes: 7 additions & 2 deletions src/ui/views/NFT/Detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,22 @@ const Detail = () => {
const [contactOne, setContactOne] = useState<any>(emptyContact);
const [contactTwo, setContactTwo] = useState<any>(emptyContact);
const [isAccessibleNft, setisAccessibleNft] = useState<any>(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);

const canMoveChild = activeAccountType !== 'child' && currentWallet.address;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition currentWallet.address might throw if currentWallet is null/undefined. Consider adding a null check: activeAccountType !== 'child' && currentWallet?.address

/*
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) {
Expand Down
9 changes: 6 additions & 3 deletions src/ui/views/SortHat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -68,8 +69,10 @@ const SortHat = () => {
}, [getApproval, rejectApproval, wallet]);

useEffect(() => {
loadView();
}, [loadView]);
if (walletLoaded) {
loadView();
}
}, [loadView, walletLoaded]);

return (
// <Box sx={{}}>
Expand Down
10 changes: 8 additions & 2 deletions src/ui/views/Welcome/Register/index.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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);
Expand Down Expand Up @@ -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 (
<LandingComponents
activeIndex={Object.values(STEPS).indexOf(activeTab)}
direction="right"
showBackButton={activeTab !== STEPS.ALL_SET}
showBackButton={showBackButton}
onBack={goBack}
showConfetti={activeTab === STEPS.ALL_SET}
showRegisterHeader={true}
Expand Down
19 changes: 15 additions & 4 deletions src/ui/views/Welcome/import-profile/index.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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);
Expand Down Expand Up @@ -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' });
Expand All @@ -131,11 +138,15 @@ const ImportProfile = () => {
/>
);
}

const showBackButton =
activeTab !== IMPORT_STEPS.ALL_SET &&
(activeTab !== IMPORT_STEPS.IMPORT || location.key !== 'default');
return (
<LandingComponents
activeIndex={Object.values(IMPORT_STEPS).indexOf(activeTab)}
direction="right"
showBackButton={activeTab !== IMPORT_STEPS.ALL_SET && activeTab !== IMPORT_STEPS.IMPORT}
showBackButton={showBackButton}
onBack={goBack}
showConfetti={activeTab === IMPORT_STEPS.ALL_SET}
showRegisterHeader={true}
Expand Down
Loading