Compare commits

..

No commits in common. "main" and "solana-payment" have entirely different histories.

9 changed files with 124 additions and 313 deletions

View File

@ -1,6 +1,4 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
transpilePackages: ["geist"],
};
const nextConfig = {};
module.exports = nextConfig;

View File

@ -15,7 +15,7 @@ export default function Form() {
useEffect(() => {
if (ready && authenticated) {
router.push("/dashboard/rent");
router.push("/dashboard/home");
}
}, [ready, authenticated, router]);

View File

@ -4,7 +4,6 @@ import Sidebar from "@/components/Sidebar";
import Topbar from "@/components/Topbar";
import { usePrivy } from "@privy-io/react-auth";
import { useRouter } from "next/navigation";
import Script from "next/script";
export default function DashboardLayout({
children,
@ -22,26 +21,6 @@ export default function DashboardLayout({
}
return (
<main className="relative z-10">
<Script id="landbot-script">{`
window.addEventListener('mouseover', initLandbot, { once: true });
window.addEventListener('touchstart', initLandbot, { once: true });
var myLandbot;
function initLandbot() {
if (!myLandbot) {
var s = document.createElement('script');
s.type = "module"
s.async = true;
s.addEventListener('load', function() {
var myLandbot = new Landbot.Livechat({
configUrl: 'https://storage.googleapis.com/landbot.online/v3/H-2923167-WL26NF7VJKJ3PAMV/index.json',
});
});
s.src = 'https://cdn.landbot.io/landbot-3/landbot-3.0.0.mjs';
var x = document.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s, x);
}
}
`}</Script>
<div className="mx-auto container max-w-[1720px] px-14">
<div className="min-h-[100svh] p-14 grid grid-cols-[268px_auto] gap-12 overflow-hidden">
<Sidebar />

View File

@ -19,10 +19,10 @@ export default function Boxes() {
const gpus: IGPU[] = [
{
id: 'k80',
title: 'NVIDIA K80',
title: 'NVIDIA Tesla K80',
subTitle: '24 GB GDDR5 - 4992 CUDA Cores',
price: '$0.15/hour ($110/mo)',
price_usd: 110, //110,
price_usd: 110,
},
{
id: 't1000',

View File

@ -1,5 +1,10 @@
"use client";
import { motion } from "framer-motion";
import Image from "next/image";
import serverIcon1 from "@/assets/images/server-1-icon.svg";
import serverIcon2 from "@/assets/images/server-2-icon.svg";
import serverIcon3 from "@/assets/images/server-3-icon.svg";
import serverIcon4 from "@/assets/images/server-4-icon.svg";
export default function Box() {
return (
@ -17,249 +22,91 @@ export default function Box() {
}}
className="relative p-5 border border-white/5 bg-[#0E1618]/10 backdrop-blur-sm"
>
<h3 className="mb-1 font-medium uppercase text-[#0CE77E]">All Systems Operational</h3>
<h3 className="mb-1 font-medium uppercase text-[#0CE77E]">Live and preparing servers</h3>
<p className="mb-4 text-sm text-white/75">
Last updated on{" "}
{new Date(Date.now() - 3 * 60 * 1000)
.toLocaleString("en-US", {
month: "short",
day: "numeric",
hour: "numeric",
minute: "2-digit",
hour12: true,
timeZoneName: "short",
})
.replace(",", "")
.replace("AM", "am")
.replace("PM", "pm")}
</p>
<p className="mb-4 text-sm text-white/75">List of our GPUs and their current status</p>
<div className="py-4 border-t border-[#0CE77E]/25 items-center">
<div className="flex items-center justify-between mb-2">
<h3 className="font-medium text-[#0CE77E]">GPU Instance</h3>
<h3 className="font-medium text-[#0CE77E]">99.960% uptime</h3>
</div>
<div className="py-4 border-t border-[#0CE77E]/25 grid grid-cols-[250px_auto] items-center">
<div className="flex items-center gap-4">
<Image src={serverIcon1} alt="" className="w-[40px] h-[40px]" />
{/* uptime status */}
<div className="relative">
<div className="flex h-[28px] w-full overflow-visible relative">
{[
{ status: "operational", width: "60%", details: "No incident reported" },
{
status: "degraded",
width: "0.5%",
details: "Resolved - Nvidia driver issue",
},
{ status: "operational", width: "39.5%", details: "No incident reported" },
].map((segment, index) => (
<div
key={index}
className={`h-full group cursor-help relative
${
segment.status === "operational"
? "bg-[#0CE77E]"
: segment.status === "degraded"
? "bg-yellow-500"
: "bg-red-500"
}`}
style={{ width: segment.width }}
>
<div className="absolute invisible z-20 group-hover:visible bg-black/90 text-white text-xs py-1 px-2 rounded -top-8 left-1/2 -translate-x-1/2 whitespace-nowrap">
{segment.status === "operational"
? "Fully Operational"
: segment.status === "degraded"
? "Degraded Performance"
: "System Down"}
<br />
Status: {segment.details}
</div>
</div>
))}
</div>
<div className="mt-2 text-xs text-white/50">Last 30 days - Hover segments for more details</div>
<div>
<h3 className="font-medium text-[#0CE77E]">GAMING GPUs</h3>
<p className="text-sm text-white/75">Total GPUs : 52</p>
</div>
</div>
<div className="py-4 border-t border-[#0CE77E]/25 items-center">
<div className="flex items-center justify-between mb-2">
<h3 className="font-medium text-[#0CE77E]">Console</h3>
<h3 className="font-medium text-[#0CE77E]">99.890% uptime</h3>
<div className="flex">
<div className="flex-1 h-[28px] px-5 bg-[#0CE77E] flex items-center">
<p className="text-sm font-semibold uppercase text-[#0B1315]">Ready : 38</p>
</div>
{/* uptime status */}
<div className="relative">
<div className="flex h-[28px] w-full overflow-visible relative">
{[
{ status: "operational", width: "20%", details: "No incident reported" },
{
status: "downtime",
width: "0.5%",
details: "Service Unavailable",
},
{ status: "operational", width: "28%", details: "No incident reported" },
{ status: "degraded", width: "0.5%", details: "Updating SMTP" },
{ status: "operational", width: "51%", details: "No incident reported" },
].map((segment, index) => (
<div
key={index}
className={`h-full group cursor-help relative
${
segment.status === "operational"
? "bg-[#0CE77E]"
: segment.status === "degraded"
? "bg-yellow-500"
: "bg-red-500"
}`}
style={{ width: segment.width }}
>
<div className="absolute invisible z-20 group-hover:visible bg-black/90 text-white text-xs py-1 px-2 rounded -top-8 left-1/2 -translate-x-1/2 whitespace-nowrap">
{segment.status === "operational"
? "Fully Operational"
: segment.status === "degraded"
? "Degraded Performance"
: "System Down"}
<br />
Status: {segment.details}
<div className="h-[28px] px-5 bg-[#0A492F] flex items-center">
<p className="text-sm font-medium uppercase text-[#0CE77E]">PREPARING : 14</p>
</div>
</div>
))}
</div>
<div className="mt-2 text-xs text-white/50">Last 30 days - Hover segments for more details</div>
</div>
</div>
<div className="py-4 border-t border-[#0CE77E]/25 items-center">
<div className="flex items-center justify-between mb-2">
<h3 className="font-medium text-[#0CE77E]">Network</h3>
<h3 className="font-medium text-[#0CE77E]">99.940% uptime</h3>
</div>
<div className="py-4 border-t border-[#0CE77E]/25 grid grid-cols-[250px_auto] items-center">
<div className="flex items-center gap-4">
<Image src={serverIcon2} alt="" className="w-[40px] h-[40px]" />
{/* uptime status */}
<div className="relative">
<div className="flex h-[28px] w-full overflow-visible relative">
{[
{ status: "operational", width: "34%", details: "No incident reported" },
{
status: "degraded",
width: "0.5%",
details: "Resolved - Unusual high latency on some regions",
},
{ status: "operational", width: "35%", details: "No incident reported" },
{ status: "downtime", width: "0.5%", details: "Service Unavailable" },
{ status: "operational", width: "30%", details: "No incident reported" },
].map((segment, index) => (
<div
key={index}
className={`h-full group cursor-help relative
${
segment.status === "operational"
? "bg-[#0CE77E]"
: segment.status === "degraded"
? "bg-yellow-500"
: "bg-red-500"
}`}
style={{ width: segment.width }}
>
<div className="absolute invisible z-20 group-hover:visible bg-black/90 text-white text-xs py-1 px-2 rounded -top-8 left-1/2 -translate-x-1/2 whitespace-nowrap">
{segment.status === "operational"
? "Fully Operational"
: segment.status === "degraded"
? "Degraded Performance"
: "System Down"}
<br />
Status: {segment.details}
</div>
</div>
))}
</div>
<div className="mt-2 text-xs text-white/50">Last 30 days - Hover segments for more details</div>
<div>
<h3 className="font-medium text-[#E2F410]">Datacenter GPUs</h3>
<p className="text-sm text-white/75">Total GPUs : 45</p>
</div>
</div>
<div className="py-4 border-t border-[#0CE77E]/25 items-center">
<div className="flex items-center justify-between mb-2">
<h3 className="font-medium text-[#0CE77E]">Proxy</h3>
<h3 className="font-medium text-[#0CE77E]">100% uptime</h3>
<div className="flex">
<div className="flex-1 h-[28px] px-5 bg-[#0CE77E] flex items-center">
<p className="text-sm font-semibold uppercase text-[#0B1315]">Ready : 33</p>
</div>
{/* uptime status */}
<div className="relative">
<div className="flex h-[28px] w-full overflow-visible relative">
{[{ status: "operational", width: "100%", details: "No incident reported" }].map(
(segment, index) => (
<div
key={index}
className={`h-full group cursor-help relative
${
segment.status === "operational"
? "bg-[#0CE77E]"
: segment.status === "degraded"
? "bg-yellow-500"
: "bg-red-500"
}`}
style={{ width: segment.width }}
>
<div className="absolute invisible z-20 group-hover:visible bg-black/90 text-white text-xs py-1 px-2 rounded -top-8 left-1/2 -translate-x-1/2 whitespace-nowrap">
{segment.status === "operational"
? "Fully Operational"
: segment.status === "degraded"
? "Degraded Performance"
: "System Down"}
<br />
Status: {segment.details}
<div className="h-[28px] px-5 bg-[#0A492F] flex items-center">
<p className="text-sm font-medium uppercase text-[#0CE77E]">PREPARING : 12</p>
</div>
</div>
)
)}
</div>
<div className="mt-2 text-xs text-white/50">Last 30 days - Hover segments for more details</div>
</div>
</div>
<div className="py-4 border-t border-[#0CE77E]/25 items-center">
<div className="flex items-center justify-between mb-2">
<h3 className="font-medium text-[#0CE77E]">Database</h3>
<h3 className="font-medium text-[#0CE77E]">99.910% uptime</h3>
<div className="py-4 border-t border-[#0CE77E]/25 grid grid-cols-[250px_auto] items-center">
<div className="flex items-center gap-4">
<Image src={serverIcon3} alt="" className="w-[40px] h-[40px]" />
<div>
<h3 className="font-medium text-[#F65927]">Integrated GPUs</h3>
<p className="text-sm text-white/75">Total GPUs : 17</p>
</div>
</div>
{/* uptime status */}
<div className="relative">
<div className="flex h-[28px] w-full overflow-visible relative">
{[
{ status: "operational", width: "80%", details: "No incident reported" },
{
status: "degraded",
width: "0.5%",
details: "Resolved - Deprecated DB API",
},
{ status: "operational", width: "19%", details: "No incident reported" },
].map((segment, index) => (
<div
key={index}
className={`h-full group cursor-help relative
${
segment.status === "operational"
? "bg-[#0CE77E]"
: segment.status === "degraded"
? "bg-yellow-500"
: "bg-red-500"
}`}
style={{ width: segment.width }}
>
<div className="absolute invisible z-20 group-hover:visible bg-black/90 text-white text-xs py-1 px-2 rounded -top-8 left-1/2 -translate-x-1/2 whitespace-nowrap">
{segment.status === "operational"
? "Fully Operational"
: segment.status === "degraded"
? "Degraded Performance"
: "System Down"}
<br />
Status: {segment.details}
<div className="flex">
<div className="flex-1 h-[28px] px-5 bg-[#0CE77E] flex items-center">
<p className="text-sm font-semibold uppercase text-[#0B1315]">Ready : 12</p>
</div>
<div className="h-[28px] px-5 bg-[#0A492F] flex items-center">
<p className="text-sm font-medium uppercase text-[#0CE77E]">PREPARING : 5</p>
</div>
</div>
))}
</div>
<div className="mt-2 text-xs text-white/50">Last 30 days - Hover segments for more details</div>
<div className="py-4 border-t border-[#0CE77E]/25 grid grid-cols-[250px_auto] items-center">
<div className="flex items-center gap-4">
<Image src={serverIcon4} alt="" className="w-[40px] h-[40px]" />
<div>
<h3 className="font-medium text-[#0CBFE7]">AI GPUs</h3>
<p className="text-sm text-white/75">Total GPUs : 61</p>
</div>
</div>
<div className="flex">
<div className="flex-1 h-[28px] px-5 bg-[#0CE77E] flex items-center">
<p className="text-sm font-semibold uppercase text-[#0B1315]">Ready : 44</p>
</div>
<div className="h-[28px] px-5 bg-[#0A492F] flex items-center">
<p className="text-sm font-medium uppercase text-[#0CE77E]">PREPARING : 17</p>
</div>
</div>
</div>

View File

@ -1,10 +1,12 @@
import type { Metadata } from "next";
import { GeistSans } from "geist/font/sans";
import { GeistMono } from "geist/font/mono";
import { GeistSans, GeistMono } from "geist/font";
import "./globals.css";
import Bg from "@/components/Bg";
import Providers from "@/components/Providers";
const geistSans = GeistSans;
const geistMono = GeistMono;
export const metadata: Metadata = {
title: "Login to Your Dashboard - Vertex",
description:
@ -26,7 +28,7 @@ export default function RootLayout({
}>) {
return (
<html lang="en">
<body className={`${GeistSans.variable} ${GeistMono.className} antialiased bg-[#070F11]`}>
<body className={`${geistSans.variable} ${geistMono.className} antialiased bg-[#070F11]`}>
<Providers>{children}</Providers>
<Bg />
</body>

View File

@ -1,6 +1,5 @@
'use client';
import { useEffect, useState } from 'react';
import React from "react";
import {
@ -18,7 +17,6 @@ import {
getAssociatedTokenAddress,
createTransferInstruction,
TOKEN_PROGRAM_ID,
ASSOCIATED_TOKEN_PROGRAM_ID,
createAssociatedTokenAccountInstruction,
} from "@solana/spl-token";
@ -44,7 +42,7 @@ const BUSINESS_WALLET = process.env.NEXT_PUBLIC_BUSINESS_WALLET!;
const EMAIL_API_URL = process.env.NEXT_PUBLIC_EMAIL_API_URL!;
const CUSTOM_TOKEN_API_URL = "https://catools.dev3vds1.link/get/vertex";
const USDC_MINT = new PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");
const USDC_MINT = new PublicKey("Es9vMFrzaCERJ8gLhEvX5yQceQ2uKcXfUrx2Wcikgqay");
const CornerEdge = ({ position }: { position: 'left-top' | 'right-top' | 'left-bottom' | 'right-bottom' }) => {
const paths = {
@ -311,7 +309,7 @@ export const GpuPaymentModal = ({ isOpen, onClose, gpu }: GpuPaymentModalProps)
// Second attempt: Try using Jupiter Aggregator API for Solana tokens
try {
// Jupiter provides price data for most Solana tokens
const jupiterUrl = `https://lite-api.jup.ag/price/v2?ids=${tokenAddress}`;
const jupiterUrl = `https://price.jup.ag/v4/price?ids=${tokenAddress}`;
const jupResponse = await axios.get(jupiterUrl);
if (jupResponse.data &&
@ -425,8 +423,6 @@ export const GpuPaymentModal = ({ isOpen, onClose, gpu }: GpuPaymentModalProps)
setErrorMsg(null);
setSuccessMsg(null);
let priceUsd = selectedToken === "VERTEX" ? gpu.price_usd * 0.9 : gpu.price_usd;
try {
if (!userEmail || !isValidEmail(userEmail)) {
throw new Error("Please enter a valid email address for your receipt.");
@ -437,10 +433,6 @@ export const GpuPaymentModal = ({ isOpen, onClose, gpu }: GpuPaymentModalProps)
throw new Error("No connected Solana wallet found or wallet can't sign.");
}
// Define the correct program IDs
const TOKEN_PROGRAM_ID = new PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");
const ASSOCIATED_TOKEN_PROGRAM_ID = new PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");
const fromPubKey = new PublicKey(solWallet.address);
const toPubKey = new PublicKey(BUSINESS_WALLET);
const transaction = new Transaction();
@ -449,7 +441,6 @@ export const GpuPaymentModal = ({ isOpen, onClose, gpu }: GpuPaymentModalProps)
let amountDisplay = "";
if (selectedToken === "SOL") {
// SOL Payment Logic (unchanged)
const { data } = await axios.get(
"https://api.coingecko.com/api/v3/simple/price?ids=solana&vs_currencies=usd"
);
@ -465,7 +456,7 @@ export const GpuPaymentModal = ({ isOpen, onClose, gpu }: GpuPaymentModalProps)
})
);
} else {
// Token Payment Logic
// For both USDC and VERTEX tokens
const selectedMint = selectedToken === "USDC"
? USDC_MINT
: new PublicKey(customToken?.address || "");
@ -477,45 +468,31 @@ export const GpuPaymentModal = ({ isOpen, onClose, gpu }: GpuPaymentModalProps)
tokenPrice = customTokenPrice || 0.5;
}
const priceUsd = selectedToken === "VERTEX" ? gpu.price_usd * 0.9 : gpu.price_usd;
const tokenAmount = (priceUsd / tokenPrice).toFixed(tokenDecimals);
const tokenAmount = (gpu.price_usd / tokenPrice).toFixed(tokenDecimals);
amountDisplay = `${tokenAmount} ${selectedToken}`;
// Get or create token accounts using the correct method
const fromTokenAccount = await getAssociatedTokenAddress(
selectedMint,
fromPubKey,
false,
TOKEN_PROGRAM_ID,
ASSOCIATED_TOKEN_PROGRAM_ID
);
const fromTokenAccount = await getAssociatedTokenAddress(selectedMint, fromPubKey);
const toTokenAccount = await getAssociatedTokenAddress(selectedMint, toPubKey);
const toTokenAccount = await getAssociatedTokenAddress(
selectedMint,
toPubKey,
false,
TOKEN_PROGRAM_ID,
ASSOCIATED_TOKEN_PROGRAM_ID
);
// Check if destination token account exists
// Check if destination token account exists, if not create it
const toTokenAccountInfo = await connection.getAccountInfo(toTokenAccount);
if (!toTokenAccountInfo) {
// Create associated token account with explicit program IDs
// Import the necessary function
const { createAssociatedTokenAccountInstruction } = await import("@solana/spl-token");
// Add instruction to create the associated token account for the business wallet
transaction.add(
createAssociatedTokenAccountInstruction(
fromPubKey,
toTokenAccount,
toPubKey,
selectedMint,
TOKEN_PROGRAM_ID,
ASSOCIATED_TOKEN_PROGRAM_ID
fromPubKey, // payer
toTokenAccount, // associated token account address
toPubKey, // owner of the new account
selectedMint // token mint
)
);
}
// Add token transfer instruction with explicit program ID
// Add the transfer instruction after ensuring the account exists
transaction.add(
createTransferInstruction(
fromTokenAccount,
@ -528,24 +505,22 @@ export const GpuPaymentModal = ({ isOpen, onClose, gpu }: GpuPaymentModalProps)
);
}
// Set transaction properties (unchanged)
transaction.feePayer = fromPubKey;
const { blockhash } = await connection.getLatestBlockhash();
transaction.recentBlockhash = blockhash;
// Sign and send (unchanged)
const signedTx = await solWallet.signTransaction(transaction);
txId = await connection.sendRawTransaction(signedTx.serialize());
await connection.confirmTransaction(txId, "confirmed");
// Process order completion (unchanged)
await axios.post(EMAIL_API_URL, {
email: userEmail,
product: gpu.title,
price_hour: gpu.price_per_hour,
price: priceUsd.toFixed(2)
price: gpu.price_usd.toFixed(2)
});
// Generate a random order ID (in production this would come from the backend)
const generatedOrderId = `${Math.floor(Math.random() * 900) + 100}-${Math.floor(Math.random() * 900) + 100}-${Math.floor(Math.random() * 900) + 100}`;
setOrderId(generatedOrderId);
@ -553,7 +528,7 @@ export const GpuPaymentModal = ({ isOpen, onClose, gpu }: GpuPaymentModalProps)
{
gpu: `${gpu.id} ${gpu.title}`,
user_email: userEmail,
amount_usd: priceUsd,
amount_usd: gpu.price_usd,
token_used: tokenUsed,
token_amount: amountDisplay,
token_tx_signature: txId,
@ -576,7 +551,7 @@ export const GpuPaymentModal = ({ isOpen, onClose, gpu }: GpuPaymentModalProps)
{
gpu: `${gpu.id} ${gpu.title}`,
user_email: userEmail,
amount_usd: priceUsd,
amount_usd: gpu.price_usd,
token_used: selectedToken,
status: "failed",
error_message: err.message || "Unknown error",
@ -596,10 +571,6 @@ export const GpuPaymentModal = ({ isOpen, onClose, gpu }: GpuPaymentModalProps)
};
if (!isOpen) return null;
const displayPrice = selectedToken === 'VERTEX'
? (gpu.price_usd * 0.9).toFixed(2)
: gpu.price_usd.toFixed(2);
// Show failure screen if payment failed
if (paymentFailure) {
@ -732,7 +703,7 @@ export const GpuPaymentModal = ({ isOpen, onClose, gpu }: GpuPaymentModalProps)
<div className="flex justify-between items-center p-3 w-full">
<span className="text-base font-medium text-white">Total Price</span>
<div className="flex gap-3 items-center">
<span className="text-base font-bold text-[#0CE77E]">${displayPrice}</span>
<span className="text-base font-bold text-[#0CE77E]">${gpu.price_usd}</span>
<span className="text-base text-[#0CE77E]">(~{currentTokenAmount} {selectedToken})</span>
</div>
</div>

View File

@ -47,6 +47,20 @@ export default function Sidebar() {
{
title: "Dashboard",
links: [
{
icon: (
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M5.31636 3.57182L4.56635 4.15724C3.42886 5.04511 2.86011 5.48905 2.55505 6.115C2.25 6.74094 2.25 7.46404 2.25 8.91022V10.4786C2.25 13.3172 2.25 14.7364 3.12868 15.6182C4.00736 16.5 5.42157 16.5 8.25 16.5H9.75C12.5784 16.5 13.9927 16.5 14.8713 15.6182C15.75 14.7364 15.75 13.3172 15.75 10.4786V8.91022C15.75 7.46404 15.75 6.74094 15.445 6.115C15.1399 5.48905 14.5712 5.04511 13.4336 4.15724L12.6836 3.57182C10.9141 2.19061 10.0293 1.5 9 1.5C7.9707 1.5 7.0859 2.19061 5.31636 3.57182Z"
stroke="#0CE77E"
strokeWidth="1.125"
strokeLinejoin="round"
/>
</svg>
),
title: "Home",
href: "/dashboard/home",
},
{
icon: (
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
@ -216,7 +230,7 @@ export default function Sidebar() {
<div className="border border-white/5 bg-[#0E1618] h-full p-5 flex flex-col justify-between">
<div>
<div className="pb-5 border-b border-[#0CE77E]/25 flex justify-center">
<Link href={"/dashboard/rent"}>
<Link href={"/dashboard/home"}>
<Image src={iconImg} alt="" width={32} height={32} />
</Link>
</div>