We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b4a3fb7 commit c5f3c04Copy full SHA for c5f3c04
1 file changed
hooks/useWithdraw.tsx
@@ -22,10 +22,16 @@ const useWithdraw = (inputBalance: number) => {
22
23
const executeWithdraw = async () => {
24
try {
25
+ if (!contractAddress) {
26
+ toast.error(
27
+ `No WETH contract found for ${chain?.name || 'this network'}`
28
+ );
29
+ return;
30
+ }
31
toast.promise(
32
(async () => {
33
const hash = await writeContractAsync({
- address: contractAddress || '',
34
+ address: contractAddress,
35
abi: WethAbi,
36
functionName: 'withdraw',
37
args: [BigInt(parseEther(debouncedValue.toString() || '0'))]
@@ -51,7 +57,7 @@ const useWithdraw = (inputBalance: number) => {
51
57
writeWithdraw: executeWithdraw,
52
58
isWritePending,
53
59
isWriteError,
54
- canWithdraw: Boolean(debouncedValue)
60
+ canWithdraw: debouncedValue > 0
55
61
};
56
62
63
0 commit comments