Skip to content

Commit 23de1af

Browse files
committed
chore: Hide withdrawal if not available in ABI;
1 parent 9e2c6e0 commit 23de1af

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/components/Zap/ZapWidgetStack.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,15 @@ export const ZapWidgetStack: FC<ZapWidgetStackProps> = ({
3939
return customInformation?.projectData;
4040
}, [customInformation?.projectData]);
4141

42-
// Get zap data to check if user has deposited
42+
// Get zap data to check if user has deposited and if withdraw is available
4343
const {
44+
zapData,
4445
depositTokenData,
4546
isLoadingDepositTokenData,
4647
} = useEnhancedZapData(projectData);
4748

4849
const hasDeposited = !isLoadingDepositTokenData && !!depositTokenData;
50+
const hasWithdrawAbi = !!zapData?.abi?.withdraw;
4951

5052
const tabs = useMemo(() => [
5153
{
@@ -55,9 +57,9 @@ export const ZapWidgetStack: FC<ZapWidgetStackProps> = ({
5557
{
5658
value: 'withdraw',
5759
label: 'Withdraw',
58-
disabled: !hasDeposited,
60+
disabled: !hasDeposited || !hasWithdrawAbi,
5961
},
60-
], [hasDeposited]);
62+
], [hasDeposited, hasWithdrawAbi]);
6163

6264
const handleTabChange = (event: React.SyntheticEvent, newValue: string) => {
6365
setActiveTab(newValue as 'deposit' | 'withdraw');

0 commit comments

Comments
 (0)