Skip to content
This repository was archived by the owner on Mar 2, 2026. It is now read-only.
Merged
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
Loading