diff --git a/.env.example b/.env.example
index a45a019..975175e 100644
--- a/.env.example
+++ b/.env.example
@@ -1,8 +1,8 @@
# Client-side environment variables (must be prefixed with NEXT_PUBLIC_)
-# Solana Token Payment Configuration
-# TODO: Use different RPC URL or use browser wallet
+# Solana Payment Configuration
NEXT_PUBLIC_SOLANA_RPC_URL=https://skilled-prettiest-seed.solana-mainnet.quiknode.pro/eeecfebd04e345f69f1900cc3483cbbfea02a158
+NEXT_PUBLIC_SOLANA_SOL_RPC_URL=https://rpc.gorbagana.wtf
NEXT_PUBLIC_SOLANA_TOKEN_MINT_ADDRESS=71Jvq4Epe2FCJ7JFSF7jLXdNk1Wy4Bhqd9iL6bEFELvg
# Multisig address
diff --git a/src/app/api/registry/route.ts b/src/app/api/registry/route.ts
index 5d82733..e5a7055 100644
--- a/src/app/api/registry/route.ts
+++ b/src/app/api/registry/route.ts
@@ -15,7 +15,10 @@ import { PaymentMethod, SOL_PAYMENT_AMOUNT_LAMPORTS } from '@/constants/payments
import { getRecipientAddress } from '@/services/solana';
assert(process.env.NEXT_PUBLIC_SOLANA_RPC_URL, 'SOLANA_RPC_URL is required');
+assert(process.env.NEXT_PUBLIC_SOLANA_SOL_RPC_URL, 'SOLANA_SOL_RPC_URL is required');
+
const SOLANA_RPC_URL = process.env.NEXT_PUBLIC_SOLANA_RPC_URL;
+const SOLANA_SOL_RPC_URL = process.env.NEXT_PUBLIC_SOLANA_SOL_RPC_URL;
// Allow 20% slippage due to price fluctuations
const ALLOWED_SLIPPAGE_FACTOR = 0.2
@@ -136,16 +139,19 @@ export const registryTransactionWithRetry = async (
throw lastError;
};
-let connection: Connection;
+// Helper function to get the appropriate connection based on payment method
+const getConnection = (paymentMethod: PaymentMethod): Connection => {
+ if (paymentMethod === 'sol' && SOLANA_SOL_RPC_URL) {
+ return new Connection(SOLANA_SOL_RPC_URL);
+ }
+ return new Connection(SOLANA_RPC_URL);
+};
export async function POST(request: NextRequest) {
try {
- if (!connection) {
- connection = new Connection(SOLANA_RPC_URL);
- }
-
// First check if the request body is valid JSON
let url, txHash, senderPublicKey, paymentMethod;
+ let connection: Connection;
try {
const body = await request.json();
@@ -153,6 +159,9 @@ export async function POST(request: NextRequest) {
txHash = body.txHash;
paymentMethod = body.paymentMethod as PaymentMethod;
+ // Get the appropriate connection based on payment method
+ connection = getConnection(paymentMethod);
+
const tx = await connection.getParsedTransaction(txHash, 'confirmed');
if (!tx) {
console.error("Transaction not found.");
diff --git a/src/app/layout.tsx b/src/app/layout.tsx
index f6ddd85..b6af7db 100644
--- a/src/app/layout.tsx
+++ b/src/app/layout.tsx
@@ -4,6 +4,7 @@ import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";
import ErrorBoundaryWrapper from "../components/ErrorBoundaryWrapper";
import WalletProviders from "../components/WalletProviders";
+import { PaymentMethodProvider } from "../contexts/PaymentMethodContext";
const geistSans = Geist({
@@ -32,9 +33,11 @@ export default function RootLayout({
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>
-
- {children}
-
+
+
+ {children}
+
+