Use cluster API URL with mainnet beta

This commit is contained in:
Shreerang Kale 2025-07-21 17:40:37 +05:30
parent 0e23e2f3dc
commit 4f6674818c

View File

@ -2,15 +2,15 @@
import { useCallback, useMemo, useState } from 'react';
import BN from 'bn.js';
import assert from 'assert';
// import assert from 'assert';
import { Connection } from '@solana/web3.js';
import { clusterApiUrl, Connection } from '@solana/web3.js';
import { sendSolanaTokenPayment } from '@/services/solana';
import { PaymentModalProps } from '@/types';
assert(process.env.NEXT_PUBLIC_SOLANA_RPC_URL, 'SOLANA_RPC_URL is required');
const SOLANA_RPC_URL = process.env.NEXT_PUBLIC_SOLANA_RPC_URL;
// assert(process.env.NEXT_PUBLIC_SOLANA_RPC_URL, 'SOLANA_RPC_URL is required');
// const SOLANA_RPC_URL = process.env.NEXT_PUBLIC_SOLANA_RPC_URL;
export default function PaymentModal({
isOpen,
@ -22,7 +22,8 @@ export default function PaymentModal({
const [loading, setLoading] = useState(false);
const [error, setError] = useState('');
const connection = useMemo(() => new Connection(SOLANA_RPC_URL), [])
const connection = useMemo(() => new Connection(clusterApiUrl("mainnet-beta")), []);
// const connection = useMemo(() => new Connection(SOLANA_RPC_URL), [])
// Get configuration from environment variables directly
const amount = parseInt(process.env.NEXT_PUBLIC_SOLANA_PAYMENT_AMOUNT!);