From 2b7d12088739d760624da407ff648ab617b000e0 Mon Sep 17 00:00:00 2001 From: Shreerang Kale Date: Mon, 21 Jul 2025 16:03:03 +0530 Subject: [PATCH] Fix script to remove deployments --- .env.example | 3 ++- README.md | 4 ++-- deploy/README.md | 2 +- deploy/remove-deployment.sh | 4 ++-- src/app/api/registry/route.ts | 2 +- src/components/PaymentModal.tsx | 6 +++--- src/components/URLForm.tsx | 2 +- 7 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.env.example b/.env.example index 6da1355..73d70c2 100644 --- a/.env.example +++ b/.env.example @@ -8,7 +8,8 @@ NEXT_PUBLIC_SOLANA_TOKEN_MINT_ADDRESS=71Jvq4Epe2FCJ7JFSF7jLXdNk1Wy4Bhqd9iL6bEFEL # Multisig address NEXT_PUBLIC_SOLANA_TOKEN_RECIPIENT_ADDRESS=FFDx3SdAEeXrp6BTmStB4BDHpctGsaasZq4FFcowRobY NEXT_PUBLIC_SOLANA_TOKEN_SYMBOL=GOR -NEXT_PUBLIC_MIN_SOLANA_PAYMENT_AMOUNT=400000000 # Approx. 5 USD +NEXT_PUBLIC_SOLANA_TOKEN_DECIMALS=6 +NEXT_PUBLIC_SOLANA_PAYMENT_AMOUNT=400000000 # Approx. 5 USD # UI Configuration NEXT_PUBLIC_EXAMPLE_URL=https://git.vdb.to/cerc-io/test-progressive-web-app diff --git a/README.md b/README.md index e34a499..67f91f7 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Client-side (must be prefixed with NEXT_PUBLIC_): - `NEXT_PUBLIC_SOLANA_TOKEN_RECIPIENT_ADDRESS` - The Solana address that will receive token payments - `NEXT_PUBLIC_SOLANA_TOKEN_SYMBOL` - The token symbol to display (e.g., "GOR") - `NEXT_PUBLIC_SOLANA_TOKEN_DECIMALS` - The number of decimals for the token (e.g., 6) -- `NEXT_PUBLIC_MIN_SOLANA_PAYMENT_AMOUNT` - The fixed payment amount required (e.g., 50) +- `NEXT_PUBLIC_SOLANA_PAYMENT_AMOUNT` - The fixed payment amount required (e.g., 400) - `NEXT_PUBLIC_DOMAIN_SUFFIX` - Optional suffix to append to DNS names in the UI (e.g. ".example.com") - `NEXT_PUBLIC_EXAMPLE_URL` - Example URL to pre-fill in the URL form (e.g. "https://github.com/cerc-io/laconic-registry-cli") @@ -185,7 +185,7 @@ docker run -p 3000:3000 --env-file .env.production gor-deploy - **Wrong token**: Verify the `NEXT_PUBLIC_SOLANA_TOKEN_MINT_ADDRESS` matches your desired SPL token. - **Incorrect decimals**: Ensure `NEXT_PUBLIC_SOLANA_TOKEN_DECIMALS` matches the token's actual decimal count. -- **Payment amount**: Adjust `NEXT_PUBLIC_MIN_SOLANA_PAYMENT_AMOUNT` to the desired payment amount. +- **Payment amount**: Adjust `NEXT_PUBLIC_SOLANA_PAYMENT_AMOUNT` to the desired payment amount. ### Laconic Registry Issues diff --git a/deploy/README.md b/deploy/README.md index 2032d0d..6918815 100644 --- a/deploy/README.md +++ b/deploy/README.md @@ -71,7 +71,7 @@ # In gor-deploy/deploy dir docker run -it \ -v ./:/app/deploy -w /app/deploy \ - -e DEPLOYMENT_REORD_ID= \ + -e DEPLOYMENT_RECORD_ID= \ cerc/laconic-registry-cli:latest \ ./remove-deployment.sh ``` diff --git a/deploy/remove-deployment.sh b/deploy/remove-deployment.sh index f1f757c..5c9d000 100755 --- a/deploy/remove-deployment.sh +++ b/deploy/remove-deployment.sh @@ -2,7 +2,7 @@ set -e -if [[ -z $DEPLOYMENT_REORD_ID ]]; then +if [[ -z $DEPLOYMENT_RECORD_ID ]]; then echo "Error: please pass the deployment record ID" >&2 exit 1 fi @@ -10,7 +10,7 @@ fi source .registry.env echo "Using DEPLOYER_LRN: $DEPLOYER_LRN" -echo "Deployment record ID: $DEPLOYMENT_REORD_ID" +echo "Deployment record ID: $DEPLOYMENT_RECORD_ID" # Generate application-deployment-removal-request.yml REMOVAL_REQUEST_RECORD_FILE=./records/application-deployment-removal-request.yml diff --git a/src/app/api/registry/route.ts b/src/app/api/registry/route.ts index 0afd54b..9627c6c 100644 --- a/src/app/api/registry/route.ts +++ b/src/app/api/registry/route.ts @@ -161,7 +161,7 @@ export async function POST(request: NextRequest) { // Verify Solana payment console.log('Step 0: Verifying Solana token payment...'); - const paymentAmount = parseInt(process.env.NEXT_PUBLIC_MIN_SOLANA_PAYMENT_AMOUNT!); + const paymentAmount = parseInt(process.env.NEXT_PUBLIC_SOLANA_PAYMENT_AMOUNT!); const tokenAmount = new BN(paymentAmount); const solanaPaymentResult = await verifyUnusedSolanaPayment(connection, txHash, tokenAmount); diff --git a/src/components/PaymentModal.tsx b/src/components/PaymentModal.tsx index f252ecd..a0a644a 100644 --- a/src/components/PaymentModal.tsx +++ b/src/components/PaymentModal.tsx @@ -25,13 +25,13 @@ export default function PaymentModal({ const connection = useMemo(() => new Connection(SOLANA_RPC_URL), []) // Get configuration from environment variables directly - const amount = parseInt(process.env.NEXT_PUBLIC_MIN_SOLANA_PAYMENT_AMOUNT!); + const amount = parseInt(process.env.NEXT_PUBLIC_SOLANA_PAYMENT_AMOUNT!); const divisor = useMemo(() => { - const decimalsEnv = process.env.NEXT_PUBLIC_MIN_SOLANA_TOKEN_DECIMALS; + const decimalsEnv = process.env.NEXT_PUBLIC_SOLANA_TOKEN_DECIMALS; const decimals = parseInt(decimalsEnv!, 10); if (isNaN(decimals)) { - console.warn("Invalid NEXT_PUBLIC_MIN_SOLANA_TOKEN_DECIMALS; defaulting to 6."); + console.warn("Invalid NEXT_PUBLIC_SOLANA_TOKEN_DECIMALS; defaulting to 6."); return 1e6; } return 10 ** decimals; diff --git a/src/components/URLForm.tsx b/src/components/URLForm.tsx index a9dbcfd..3ab5aaa 100644 --- a/src/components/URLForm.tsx +++ b/src/components/URLForm.tsx @@ -10,7 +10,7 @@ interface URLFormProps { export default function URLForm({ onSubmit, disabled }: URLFormProps) { // Get example URL from environment variables or use a default const exampleUrl = process.env.NEXT_PUBLIC_EXAMPLE_URL || 'https://example.com'; - const [url, setUrl] = useState(exampleUrl); + const [url, setUrl] = useState(''); const [error, setError] = useState(''); const handleSubmit = (e: React.FormEvent) => {