From 540b7327f82de6c0b337540e51f3cba82ff91c48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Torres?= Date: Wed, 22 May 2024 13:15:43 +0100 Subject: [PATCH] hotfix: chain id --- packages/web-app/app/_lib/actions.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/web-app/app/_lib/actions.tsx b/packages/web-app/app/_lib/actions.tsx index c0e26709..0e0329ff 100644 --- a/packages/web-app/app/_lib/actions.tsx +++ b/packages/web-app/app/_lib/actions.tsx @@ -13,7 +13,7 @@ import { useWriteCtzndSaleBuy, useWriteCtzndErc20Approve, } from '@/wagmi.generated'; -import { sepolia } from 'viem/chains'; +import { mainnet, sepolia } from 'viem/chains'; import { appSignal } from '../app-signal'; export const useAcquireAccessGrantMutation = () => { @@ -246,7 +246,11 @@ export const useBuyCtzndTokens = () => { }; export const useSetPaymentTokenAllowance = () => { - const saleAddress = ctzndSaleAddress[sepolia.id]; + const chainId = + process.env.NEXT_PUBLIC_ENABLE_TESTNETS === 'true' + ? sepolia.id + : mainnet.id; + const saleAddress = ctzndSaleAddress[chainId]; const { data: paymentToken } = useReadCtzndSalePaymentToken(); const { writeContract,