@@ -103,7 +103,7 @@ export const InitialClaimLinkView = (props: IClaimScreenProps) => {
103103 isXChain,
104104 setIsXChain,
105105 } = useContext ( tokenSelectorContext )
106- const { claimLink, claimLinkXchain } = useClaimLink ( )
106+ const { claimLink, claimLinkXchain, removeParamStep } = useClaimLink ( )
107107 const { isConnected : isPeanutWallet , address, fetchBalance } = useWallet ( )
108108 const router = useRouter ( )
109109 const { user } = useAuth ( )
@@ -157,7 +157,7 @@ export const InitialClaimLinkView = (props: IClaimScreenProps) => {
157157 } , [ recipientType , claimLinkData . chainId , isPeanutChain , claimLinkData . tokenAddress ] )
158158
159159 const handleClaimLink = useCallback (
160- async ( bypassModal = false ) => {
160+ async ( bypassModal = false , autoClaim = false ) => {
161161 if ( ! isPeanutWallet && ! bypassModal ) {
162162 setShowConfirmationModal ( true )
163163 return
@@ -175,8 +175,11 @@ export const InitialClaimLinkView = (props: IClaimScreenProps) => {
175175 try {
176176 setLoadingState ( 'Executing transaction' )
177177 if ( isPeanutWallet ) {
178- await sendLinksApi . claim ( user ?. user . username ?? address , claimLinkData . link )
179-
178+ if ( autoClaim ) {
179+ await sendLinksApi . autoClaimLink ( user ?. user . username ?? address , claimLinkData . link )
180+ } else {
181+ await sendLinksApi . claim ( user ?. user . username ?? address , claimLinkData . link )
182+ }
180183 setClaimType ( 'claim' )
181184 onCustom ( 'SUCCESS' )
182185 fetchBalance ( )
@@ -623,6 +626,14 @@ export const InitialClaimLinkView = (props: IClaimScreenProps) => {
623626 }
624627 }
625628
629+ useEffect ( ( ) => {
630+ const stepFromURL = searchParams . get ( 'step' )
631+ if ( user && claimLinkData . status !== 'CLAIMED' && stepFromURL === 'claim' && isPeanutWallet ) {
632+ removeParamStep ( )
633+ handleClaimLink ( false , true )
634+ }
635+ } , [ user , searchParams , isPeanutWallet ] )
636+
626637 if ( claimBankFlowStep ) {
627638 return < BankFlowManager { ...props } />
628639 }
@@ -780,9 +791,13 @@ export const InitialClaimLinkView = (props: IClaimScreenProps) => {
780791 modalPanelClassName = "max-w-md mx-8"
781792 />
782793 < GuestVerificationModal
794+ redirectToVerification
783795 secondaryCtaLabel = "Claim with other method"
784- isOpen = { showVerificationModal && ! user }
785- onClose = { ( ) => setShowVerificationModal ( false ) }
796+ isOpen = { showVerificationModal }
797+ onClose = { ( ) => {
798+ removeParamStep ( )
799+ setShowVerificationModal ( false )
800+ } }
786801 description = "The sender isn't verified, so please create an account and verify your identity to have the funds deposited to your bank."
787802 />
788803 </ div >
0 commit comments