From 8ac00c84f71cff7143f4968186ad52870bff2e06 Mon Sep 17 00:00:00 2001 From: Shreerang Kale Date: Thu, 24 Jul 2025 12:56:26 +0530 Subject: [PATCH] Put native gor payment method behind flag --- .env.example | 1 + src/app/page.tsx | 99 ++++++++++++++++++++++++------------------------ 2 files changed, 51 insertions(+), 49 deletions(-) diff --git a/.env.example b/.env.example index bfbe710..af6cdaa 100644 --- a/.env.example +++ b/.env.example @@ -7,6 +7,7 @@ NEXT_PUBLIC_GORBAGANA_RPC_URL=https://rpc.gorbagana.wtf NEXT_PUBLIC_SOLANA_TOKEN_MINT_ADDRESS=71Jvq4Epe2FCJ7JFSF7jLXdNk1Wy4Bhqd9iL6bEFELvg NEXT_PUBLIC_SOLANA_TOKEN_SYMBOL=GOR NEXT_PUBLIC_SOLANA_PAYMENT_AMOUNT_USD=5 # Payment amount in USD +NEXT_PUBLIC_ENABLE_NATIVE_GOR_TRANSFER=true # Multisig address NEXT_PUBLIC_SOLANA_TOKEN_RECIPIENT_ADDRESS=FFDx3SdAEeXrp6BTmStB4BDHpctGsaasZq4FFcowRobY diff --git a/src/app/page.tsx b/src/app/page.tsx index 9d4c7a4..d0bd60b 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -36,6 +36,14 @@ export default function Home() { const [error, setError] = useState(null); const [incorrectChainWarining, setIncorrectChainWarining] = useState(null); + const isNatGorEnabled = process.env.NEXT_PUBLIC_ENABLE_NATIVE_GOR_TRANSFER === "true"; + + useEffect(() => { + if (!isNatGorEnabled) { + setSelectedPaymentMethod(PaymentMethod.SPL_TOKEN); + } + }, [isNatGorEnabled, setSelectedPaymentMethod]); + useEffect(() => { if (!wallet || wallet.adapter.name !== BackpackWalletName) { return; @@ -64,7 +72,6 @@ export default function Home() { if (previousPaymentMethodRef.current !== null && previousPaymentMethodRef.current !== selectedPaymentMethod && connected) { - console.log("DISCONNECT TRIGGERED - Payment method switched while connected") disconnect(); } @@ -144,49 +151,49 @@ export default function Home() { {/* Step 1: Payment Method Selection */} -
-

- 1 - Choose Payment Method -

-
- +
- - -
- + + } {/* Step 2: Wallet Connection */}

- 2 Connect Compatible Wallet

{!selectedPaymentMethod ? ( @@ -272,8 +277,6 @@ export default function Home() { opacity: (connected && isWalletCompatible()) ? '1' : '0.6' }}>

- 3 Enter URL to Deploy

- 4 Deployment Status