From 4c6b6f8df34f60b830a8c3d230cc5660837999f6 Mon Sep 17 00:00:00 2001 From: Arnau Briet Date: Fri, 20 Mar 2026 10:30:59 +0100 Subject: [PATCH 1/5] Treat delegated accounts like EOAs in wallet --- src/hooks/wallet/useEmbeddedEthereumWallet.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/hooks/wallet/useEmbeddedEthereumWallet.ts b/src/hooks/wallet/useEmbeddedEthereumWallet.ts index b39e571..b7ebd1a 100644 --- a/src/hooks/wallet/useEmbeddedEthereumWallet.ts +++ b/src/hooks/wallet/useEmbeddedEthereumWallet.ts @@ -160,7 +160,7 @@ export function useEmbeddedEthereumWallet(options: UseEmbeddedEthereumWalletOpti const accounts = await client.embeddedWallet.list({ limit: 100, chainType: ChainTypeEnum.EVM, - accountType: walletConfig?.accountType === AccountTypeEnum.EOA ? undefined : AccountTypeEnum.SMART_ACCOUNT, + accountType: walletConfig?.accountType === AccountTypeEnum.EOA || walletConfig?.accountType === AccountTypeEnum.DELEGATED_ACCOUNT ? undefined : walletConfig?.accountType || AccountTypeEnum.SMART_ACCOUNT, }) // Filter for Ethereum accounts only setEmbeddedAccounts(accounts) @@ -287,8 +287,8 @@ export function useEmbeddedEthereumWallet(options: UseEmbeddedEthereumWalletOpti const wallets: ConnectedEmbeddedEthereumWallet[] = useMemo(() => { // Deduplicate accounts based on account type const deduplicatedAccounts = embeddedAccounts.reduce((acc, account) => { - if (walletConfig?.accountType === AccountTypeEnum.EOA) { - // For EOAs, deduplicate by address only (EOAs work across all chains) + if (walletConfig?.accountType === AccountTypeEnum.EOA || walletConfig?.accountType === AccountTypeEnum.DELEGATED_ACCOUNT) { + // For EOAs and delegated accounts, deduplicate by address only (they work across all chains) if (!acc.some((a) => a.address.toLowerCase() === account.address.toLowerCase())) { acc.push(account) } @@ -353,7 +353,7 @@ export function useEmbeddedEthereumWallet(options: UseEmbeddedEthereumWalletOpti const accountType = createOptions?.accountType || walletConfig?.accountType || AccountTypeEnum.SMART_ACCOUNT // Create embedded wallet const embeddedAccount = await client.embeddedWallet.create({ - chainId: accountType === AccountTypeEnum.EOA ? undefined : chainId, + chainId: accountType === AccountTypeEnum.EOA || accountType === AccountTypeEnum.DELEGATED_ACCOUNT ? undefined : chainId, accountType, chainType: ChainTypeEnum.EVM, recoveryParams, @@ -465,8 +465,8 @@ export function useEmbeddedEthereumWallet(options: UseEmbeddedEthereumWalletOpti // Find account to recover let embeddedAccountToRecover: EmbeddedAccount | undefined - if (walletConfig?.accountType === AccountTypeEnum.EOA) { - // For EOAs, match only by address (EOAs work across all chains) + if (walletConfig?.accountType === AccountTypeEnum.EOA || walletConfig?.accountType === AccountTypeEnum.DELEGATED_ACCOUNT) { + // For EOAs and delegated accounts, match only by address (they work across all chains) embeddedAccountToRecover = embeddedAccounts.find( (account) => account.address.toLowerCase() === setActiveOptions.address.toLowerCase() ) @@ -480,8 +480,8 @@ export function useEmbeddedEthereumWallet(options: UseEmbeddedEthereumWalletOpti if (!embeddedAccountToRecover) { const errorMsg = - walletConfig?.accountType === AccountTypeEnum.EOA - ? `No embedded EOA account found for address ${setActiveOptions.address}` + walletConfig?.accountType === AccountTypeEnum.EOA || walletConfig?.accountType === AccountTypeEnum.DELEGATED_ACCOUNT + ? `No embedded ${walletConfig?.accountType} account found for address ${setActiveOptions.address}` : `No embedded smart account found for address ${setActiveOptions.address} on chain ID ${chainId}` throw new OpenfortError(errorMsg, OpenfortErrorType.WALLET_ERROR) } From 51f6993823ddd39dc8a8d64be5a3db13c5d93b21 Mon Sep 17 00:00:00 2001 From: Arnau Briet Date: Fri, 20 Mar 2026 10:35:31 +0100 Subject: [PATCH 2/5] biome check fix --- src/hooks/wallet/useEmbeddedEthereumWallet.ts | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/hooks/wallet/useEmbeddedEthereumWallet.ts b/src/hooks/wallet/useEmbeddedEthereumWallet.ts index b7ebd1a..4a794dc 100644 --- a/src/hooks/wallet/useEmbeddedEthereumWallet.ts +++ b/src/hooks/wallet/useEmbeddedEthereumWallet.ts @@ -160,7 +160,11 @@ export function useEmbeddedEthereumWallet(options: UseEmbeddedEthereumWalletOpti const accounts = await client.embeddedWallet.list({ limit: 100, chainType: ChainTypeEnum.EVM, - accountType: walletConfig?.accountType === AccountTypeEnum.EOA || walletConfig?.accountType === AccountTypeEnum.DELEGATED_ACCOUNT ? undefined : walletConfig?.accountType || AccountTypeEnum.SMART_ACCOUNT, + accountType: + walletConfig?.accountType === AccountTypeEnum.EOA || + walletConfig?.accountType === AccountTypeEnum.DELEGATED_ACCOUNT + ? undefined + : walletConfig?.accountType || AccountTypeEnum.SMART_ACCOUNT, }) // Filter for Ethereum accounts only setEmbeddedAccounts(accounts) @@ -287,7 +291,10 @@ export function useEmbeddedEthereumWallet(options: UseEmbeddedEthereumWalletOpti const wallets: ConnectedEmbeddedEthereumWallet[] = useMemo(() => { // Deduplicate accounts based on account type const deduplicatedAccounts = embeddedAccounts.reduce((acc, account) => { - if (walletConfig?.accountType === AccountTypeEnum.EOA || walletConfig?.accountType === AccountTypeEnum.DELEGATED_ACCOUNT) { + if ( + walletConfig?.accountType === AccountTypeEnum.EOA || + walletConfig?.accountType === AccountTypeEnum.DELEGATED_ACCOUNT + ) { // For EOAs and delegated accounts, deduplicate by address only (they work across all chains) if (!acc.some((a) => a.address.toLowerCase() === account.address.toLowerCase())) { acc.push(account) @@ -353,7 +360,10 @@ export function useEmbeddedEthereumWallet(options: UseEmbeddedEthereumWalletOpti const accountType = createOptions?.accountType || walletConfig?.accountType || AccountTypeEnum.SMART_ACCOUNT // Create embedded wallet const embeddedAccount = await client.embeddedWallet.create({ - chainId: accountType === AccountTypeEnum.EOA || accountType === AccountTypeEnum.DELEGATED_ACCOUNT ? undefined : chainId, + chainId: + accountType === AccountTypeEnum.EOA || accountType === AccountTypeEnum.DELEGATED_ACCOUNT + ? undefined + : chainId, accountType, chainType: ChainTypeEnum.EVM, recoveryParams, @@ -465,7 +475,10 @@ export function useEmbeddedEthereumWallet(options: UseEmbeddedEthereumWalletOpti // Find account to recover let embeddedAccountToRecover: EmbeddedAccount | undefined - if (walletConfig?.accountType === AccountTypeEnum.EOA || walletConfig?.accountType === AccountTypeEnum.DELEGATED_ACCOUNT) { + if ( + walletConfig?.accountType === AccountTypeEnum.EOA || + walletConfig?.accountType === AccountTypeEnum.DELEGATED_ACCOUNT + ) { // For EOAs and delegated accounts, match only by address (they work across all chains) embeddedAccountToRecover = embeddedAccounts.find( (account) => account.address.toLowerCase() === setActiveOptions.address.toLowerCase() @@ -480,7 +493,8 @@ export function useEmbeddedEthereumWallet(options: UseEmbeddedEthereumWalletOpti if (!embeddedAccountToRecover) { const errorMsg = - walletConfig?.accountType === AccountTypeEnum.EOA || walletConfig?.accountType === AccountTypeEnum.DELEGATED_ACCOUNT + walletConfig?.accountType === AccountTypeEnum.EOA || + walletConfig?.accountType === AccountTypeEnum.DELEGATED_ACCOUNT ? `No embedded ${walletConfig?.accountType} account found for address ${setActiveOptions.address}` : `No embedded smart account found for address ${setActiveOptions.address} on chain ID ${chainId}` throw new OpenfortError(errorMsg, OpenfortErrorType.WALLET_ERROR) From 15e5b1c77613fc51d400ba2cdc4d3f669df840d7 Mon Sep 17 00:00:00 2001 From: Arnau Briet Date: Fri, 20 Mar 2026 11:27:09 +0100 Subject: [PATCH 3/5] Remove special-case for delegated accounts --- src/hooks/wallet/useEmbeddedEthereumWallet.ts | 24 ++++++------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/src/hooks/wallet/useEmbeddedEthereumWallet.ts b/src/hooks/wallet/useEmbeddedEthereumWallet.ts index 4a794dc..4685939 100644 --- a/src/hooks/wallet/useEmbeddedEthereumWallet.ts +++ b/src/hooks/wallet/useEmbeddedEthereumWallet.ts @@ -291,11 +291,8 @@ export function useEmbeddedEthereumWallet(options: UseEmbeddedEthereumWalletOpti const wallets: ConnectedEmbeddedEthereumWallet[] = useMemo(() => { // Deduplicate accounts based on account type const deduplicatedAccounts = embeddedAccounts.reduce((acc, account) => { - if ( - walletConfig?.accountType === AccountTypeEnum.EOA || - walletConfig?.accountType === AccountTypeEnum.DELEGATED_ACCOUNT - ) { - // For EOAs and delegated accounts, deduplicate by address only (they work across all chains) + if (walletConfig?.accountType === AccountTypeEnum.EOA) { + // For EOAs, deduplicate by address only (EOAs work across all chains) if (!acc.some((a) => a.address.toLowerCase() === account.address.toLowerCase())) { acc.push(account) } @@ -360,10 +357,7 @@ export function useEmbeddedEthereumWallet(options: UseEmbeddedEthereumWalletOpti const accountType = createOptions?.accountType || walletConfig?.accountType || AccountTypeEnum.SMART_ACCOUNT // Create embedded wallet const embeddedAccount = await client.embeddedWallet.create({ - chainId: - accountType === AccountTypeEnum.EOA || accountType === AccountTypeEnum.DELEGATED_ACCOUNT - ? undefined - : chainId, + chainId: accountType === AccountTypeEnum.EOA ? undefined : chainId, accountType, chainType: ChainTypeEnum.EVM, recoveryParams, @@ -475,11 +469,8 @@ export function useEmbeddedEthereumWallet(options: UseEmbeddedEthereumWalletOpti // Find account to recover let embeddedAccountToRecover: EmbeddedAccount | undefined - if ( - walletConfig?.accountType === AccountTypeEnum.EOA || - walletConfig?.accountType === AccountTypeEnum.DELEGATED_ACCOUNT - ) { - // For EOAs and delegated accounts, match only by address (they work across all chains) + if (walletConfig?.accountType === AccountTypeEnum.EOA) { + // For EOAs, match only by address (EOAs work across all chains) embeddedAccountToRecover = embeddedAccounts.find( (account) => account.address.toLowerCase() === setActiveOptions.address.toLowerCase() ) @@ -493,9 +484,8 @@ export function useEmbeddedEthereumWallet(options: UseEmbeddedEthereumWalletOpti if (!embeddedAccountToRecover) { const errorMsg = - walletConfig?.accountType === AccountTypeEnum.EOA || - walletConfig?.accountType === AccountTypeEnum.DELEGATED_ACCOUNT - ? `No embedded ${walletConfig?.accountType} account found for address ${setActiveOptions.address}` + walletConfig?.accountType === AccountTypeEnum.EOA + ? `No embedded EOA account found for address ${setActiveOptions.address}` : `No embedded smart account found for address ${setActiveOptions.address} on chain ID ${chainId}` throw new OpenfortError(errorMsg, OpenfortErrorType.WALLET_ERROR) } From 08e78ab6bb5105ad788a05f0f0af2cd559d8357e Mon Sep 17 00:00:00 2001 From: Arnau Briet Date: Fri, 20 Mar 2026 11:32:24 +0100 Subject: [PATCH 4/5] fix: include DELEGATED_ACCOUNT in embedded wallet list filter --- .changeset/dry-yaks-jump.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/dry-yaks-jump.md diff --git a/.changeset/dry-yaks-jump.md b/.changeset/dry-yaks-jump.md new file mode 100644 index 0000000..5a007f3 --- /dev/null +++ b/.changeset/dry-yaks-jump.md @@ -0,0 +1,5 @@ +--- +"@openfort/react-native": patch +--- + +fix: include DELEGATED_ACCOUNT in embedded wallet list filter From 97dc44d06fb27a225b42722f8ee1b17c5f102b2d Mon Sep 17 00:00:00 2001 From: Arnau Briet Date: Fri, 20 Mar 2026 11:41:04 +0100 Subject: [PATCH 5/5] change default creation acc type to EOA --- src/hooks/wallet/useEmbeddedEthereumWallet.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hooks/wallet/useEmbeddedEthereumWallet.ts b/src/hooks/wallet/useEmbeddedEthereumWallet.ts index 4685939..f1e05c5 100644 --- a/src/hooks/wallet/useEmbeddedEthereumWallet.ts +++ b/src/hooks/wallet/useEmbeddedEthereumWallet.ts @@ -354,7 +354,7 @@ export function useEmbeddedEthereumWallet(options: UseEmbeddedEthereumWalletOpti // Build recovery params const recoveryParams = await buildRecoveryParams({ ...createOptions, userId: user?.id }, walletConfig) - const accountType = createOptions?.accountType || walletConfig?.accountType || AccountTypeEnum.SMART_ACCOUNT + const accountType = createOptions?.accountType || walletConfig?.accountType || AccountTypeEnum.EOA // Create embedded wallet const embeddedAccount = await client.embeddedWallet.create({ chainId: accountType === AccountTypeEnum.EOA ? undefined : chainId,