@@ -14,6 +14,8 @@ import { useTranslation } from 'react-i18next';
1414import { useFulaBalance , useFormattedFulaBalance } from '../../hooks/useFulaBalance' ;
1515import { useClaimableTokens } from '../../hooks/useClaimableTokens' ;
1616import { useUserProfileStore } from '../../stores/useUserProfileStore' ;
17+ import { useSettingsStore } from '../../stores/useSettingsStore' ;
18+ import { useBloxsStore } from '../../stores/useBloxsStore' ;
1719
1820type EarningCardProps = React . ComponentProps < typeof FxBox > & {
1921 data : { totalFula : string } ;
@@ -50,6 +52,10 @@ export const EarningCard = ({
5052 ( state ) => state . manualSignatureWalletAddress
5153 ) ;
5254
55+ // Get selected chain and current Blox peerId for claim portal
56+ const selectedChain = useSettingsStore ( ( state ) => state . selectedChain ) ;
57+ const currentBloxPeerId = useBloxsStore ( ( state ) => state . currentBloxPeerId ) ;
58+
5359 // Use claimable rewards hook
5460 const {
5561 totalUnclaimed,
@@ -93,10 +99,22 @@ export const EarningCard = ({
9399 onRefreshPress ?.( ) ;
94100 } ;
95101
96- // Handler for opening claim web portal
102+ // Handler for opening claim web portal in MetaMask browser
97103 const handleOpenClaimPortal = async ( ) => {
98104 try {
99- await Linking . openURL ( 'https://claim-web.fula.network' ) ;
105+ // Build the claim URL with network and peerId parameters
106+ const claimBaseUrl = 'https://claim-web.fula.network' ;
107+ const params = new URLSearchParams ( ) ;
108+ params . append ( 'network' , selectedChain ) ;
109+ if ( currentBloxPeerId ) {
110+ params . append ( 'peerId' , currentBloxPeerId ) ;
111+ }
112+ const claimUrl = `${ claimBaseUrl } ?${ params . toString ( ) } ` ;
113+
114+ // Wrap in MetaMask deep link to open in MetaMask browser
115+ const metamaskDeepLink = `https://metamask.app.link/dapp/${ encodeURIComponent ( claimUrl ) } ` ;
116+
117+ await Linking . openURL ( metamaskDeepLink ) ;
100118 } catch ( error : any ) {
101119 queueToast ( {
102120 type : 'error' ,
0 commit comments