Skip to content

Commit 0000252

Browse files
authored
Merge pull request #865 from bobanetwork/fix/crashes-on-claim-check
Gateway Claim Crash Fixes!
2 parents 51c39ee + 1afc98b commit 0000252

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

src/contexts/WithdrawalContext.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const WithdrawalProvider = ({ children }: { children: React.ReactNode })
4040
setClaimTxHash
4141
} = useWithdrawalStore()
4242

43-
43+
const { isActiveNetworkSepolia } = useNetworkInfo()
4444
const {
4545
initializeNativeWithdrawal,
4646
initializeERC20Withdrawal,
@@ -112,12 +112,18 @@ export const WithdrawalProvider = ({ children }: { children: React.ReactNode })
112112
useEffect(() => {
113113
const checkClaimTx = async () => {
114114
try {
115-
await canClaimWithdrawal(JSON.parse(withdrawalTxData))
116-
setStep('claim')
115+
const res = await canClaimWithdrawal(JSON.parse(withdrawalTxData))
116+
if (isActiveNetworkSepolia) {
117+
setStep('claim')
118+
} else if (res) {
119+
setStep('claim')
120+
}
117121
} catch (error) {
118-
console.error('Error checking claim status:', error)
119-
setError('Failed to check claim status')
120-
setStep('error')
122+
if (error && (error as any).message && !(error as any).message.includes(`proven withdrawal has not matured yet`)) {
123+
console.error('Error checking claim status:', error)
124+
setError('Failed to check claim status')
125+
setStep('error')
126+
}
121127
}
122128
}
123129

src/hooks/bridge/useAnchorageWithdrawalClaim.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,9 @@ export function useAnchorageWithdrawalClaim() {
4040
]
4141
});
4242

43-
console.log(`resuest for claim`, request)
4443
const walletClient = getWalletClient(chainId!)
4544

4645
const hash = await walletClient.writeContract(request as any);
47-
console.log(`write claim tsx hash`, hash);
4846
return {
4947
hash
5048
};

src/hooks/bridge/useAnchorageWithdrawalClaimable.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,11 @@ export function useAnchorageWithdrawalClaimable() {
5151
}
5252

5353
} catch (error) {
54-
console.log(`claimable`, error)
55-
console.error(`${ERROR_CODE}: claim error:`, error)
54+
if (error && (error as any).message && !(error as any).message.includes(`proven withdrawal has not matured yet`)) {
55+
console.log(`claimable`, error)
56+
console.error(`${ERROR_CODE}: claim error:`, error)
57+
}
58+
5659
throw error
5760
}
5861
}

0 commit comments

Comments
 (0)