Skip to content

Commit c5f3c04

Browse files
committed
minor fix
1 parent b4a3fb7 commit c5f3c04

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

hooks/useWithdraw.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,16 @@ const useWithdraw = (inputBalance: number) => {
2222

2323
const executeWithdraw = async () => {
2424
try {
25+
if (!contractAddress) {
26+
toast.error(
27+
`No WETH contract found for ${chain?.name || 'this network'}`
28+
);
29+
return;
30+
}
2531
toast.promise(
2632
(async () => {
2733
const hash = await writeContractAsync({
28-
address: contractAddress || '',
34+
address: contractAddress,
2935
abi: WethAbi,
3036
functionName: 'withdraw',
3137
args: [BigInt(parseEther(debouncedValue.toString() || '0'))]
@@ -51,7 +57,7 @@ const useWithdraw = (inputBalance: number) => {
5157
writeWithdraw: executeWithdraw,
5258
isWritePending,
5359
isWriteError,
54-
canWithdraw: Boolean(debouncedValue)
60+
canWithdraw: debouncedValue > 0
5561
};
5662
};
5763

0 commit comments

Comments
 (0)