Skip to content

Commit

Permalink
useApproval bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
brucedonovan committed Sep 25, 2023
1 parent 5227997 commit dfc2392
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/components/cactiComponents/hooks/useApproval.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,28 +42,28 @@ const useApproval = (params: ApprovalBasicParams) => {
queryFn: async () => {
if (!spender) {
console.error(`Spender not found for approval`);
return;
return {};
}

// is eth
if (!tokenAddress) {
return;
return {};
}

const config = await prepareWriteContract({
const {request} = await prepareWriteContract({
address: tokenAddress,
abi: erc20ABI,
functionName: 'approve',
args: [spender, amountToUse],
chainId,
});

return config;
return request;
},
refetchOnWindowFocus: false,
});

const { write: approveTx, data, isLoading: isWaitingOnUser } = useContractWrite(config!);
const { write: approveTx, data, isLoading: isWaitingOnUser } = useContractWrite(config || {});

const {
isError,
Expand Down

0 comments on commit dfc2392

Please sign in to comment.