From f96cf020d12bf113eaec76897caaae5e41234fb8 Mon Sep 17 00:00:00 2001 From: kaito <80802871+kaitoo1@users.noreply.github.com> Date: Wed, 10 Apr 2024 15:42:32 +0900 Subject: [PATCH] if primary address is non eth, check other wallets to mint to --- .../MintCampaignPreTransaction.tsx | 43 ++++++++++++++----- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/apps/mobile/src/components/Mint/MintCampaign/MintCampaignPreTransaction.tsx b/apps/mobile/src/components/Mint/MintCampaign/MintCampaignPreTransaction.tsx index 456ae26ded..c6a0d26a3e 100644 --- a/apps/mobile/src/components/Mint/MintCampaign/MintCampaignPreTransaction.tsx +++ b/apps/mobile/src/components/Mint/MintCampaign/MintCampaignPreTransaction.tsx @@ -152,6 +152,11 @@ function MintButton({ user { primaryWallet { dbid + chain + } + wallets { + dbid + chain } } } @@ -161,17 +166,35 @@ function MintButton({ {} ); - const recipientWalletId = query.viewer?.user?.primaryWallet?.dbid; + // Since the mint is only available for Ethereum addresses, look for the first connected Eth wallet starting with the primary wallet + const recipientWalletId = useMemo(() => { + const user = query.viewer?.user; + if (!user) { + return; + } + if (user.primaryWallet?.chain === 'Ethereum') { + return user.primaryWallet?.dbid; + } + + return user.wallets?.find((wallet) => wallet?.chain === 'Ethereum')?.dbid; + }, [query.viewer?.user]); return ( -