Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 0 additions & 51 deletions apps/dashboard/src/components/network-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ const LOW_BALANCE_THRESHOLDS = {
// Per-type display constants
const NETWORK_ICONS = { evm: '🔷', solana: '🟣', stacks: '🟠' } as const;
const NATIVE_SYMBOLS = { evm: 'ETH', solana: 'SOL', stacks: 'STX' } as const;
const SETTLEMENT_LABELS = { evm: 'EVM chain', solana: 'Solana', stacks: 'Stacks' } as const;
const IMPORT_DESCRIPTIONS = {
evm: 'Enter your private key (0x-prefixed hex). It will be encrypted and stored securely.',
solana: 'Enter your Solana private key (base58 encoded). It will be encrypted and stored securely.',
Expand Down Expand Up @@ -287,12 +286,8 @@ interface WalletTypeCardProps {
showTestnets: boolean;
isGenerating: boolean;
isImporting: boolean;
isDeleting: boolean;
isAirdroppingDevnet?: boolean;
onGenerate: () => void;
onImport: (privateKey: string) => void;
onDelete: () => void;
onAirdropDevnet?: () => void;
}

export function WalletTypeCard({
Expand All @@ -304,12 +299,8 @@ export function WalletTypeCard({
showTestnets,
isGenerating,
isImporting,
isDeleting,
isAirdroppingDevnet = false,
onGenerate,
onImport,
onDelete,
onAirdropDevnet,
}: WalletTypeCardProps) {
const [copied, setCopied] = useState(false);
const [isImportOpen, setIsImportOpen] = useState(false);
Expand Down Expand Up @@ -433,48 +424,6 @@ export function WalletTypeCard({
</p>
)}

{type === 'solana' && solanaNetwork === 'solana-devnet' && (
<div className="flex flex-wrap gap-2">
<Button
variant="outline"
size="sm"
onClick={onAirdropDevnet}
disabled={isAirdroppingDevnet || !onAirdropDevnet}
>
{isAirdroppingDevnet ? (
<Loader2 className="w-4 h-4 mr-2 animate-spin" />
) : (
<Plus className="w-4 h-4 mr-2" />
)}
Airdrop 1 SOL
</Button>
<Button variant="ghost" size="sm" asChild>
<a
href={`https://faucet.solana.com/?address=${wallet?.address || ''}`}
target="_blank"
rel="noopener noreferrer"
>
<ExternalLink className="w-4 h-4 mr-2" />
Faucet
</a>
</Button>
</div>
)}

{/* Change Wallet */}
<Button
variant="outline"
size="sm"
onClick={() => {
if (confirm(`Remove ${title}? This will stop ${SETTLEMENT_LABELS[type]} settlements.`)) {
onDelete();
}
}}
disabled={isDeleting}
>
{isDeleting ? <Loader2 className="w-4 h-4 mr-2 animate-spin" /> : null}
Change Wallet
</Button>
</div>
) : (
/* Not configured state */
Expand Down
49 changes: 0 additions & 49 deletions apps/dashboard/src/components/networks-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Globe } from 'lucide-react';
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
import { Switch } from '@/components/ui/switch';
import { Label } from '@/components/ui/label';
import { useToast } from '@/hooks/use-toast';
import {
WalletTypeCard,
SUPPORTED_NETWORKS,
Expand All @@ -22,7 +21,6 @@ interface NetworksSectionProps {

export function NetworksSection({ facilitatorId }: NetworksSectionProps) {
const queryClient = useQueryClient();
const { toast } = useToast();
const [showTestnets, setShowTestnets] = useState(false);

// EVM Wallet queries
Expand Down Expand Up @@ -61,13 +59,6 @@ export function NetworksSection({ facilitatorId }: NetworksSectionProps) {
},
});

const deleteEvmWallet = useMutation({
mutationFn: () => api.deleteWallet(facilitatorId),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['wallet', facilitatorId] });
},
});

// Solana Wallet mutations
const generateSolanaWallet = useMutation({
mutationFn: () => api.generateSolanaWallet(facilitatorId),
Expand All @@ -83,31 +74,6 @@ export function NetworksSection({ facilitatorId }: NetworksSectionProps) {
},
});

const deleteSolanaWallet = useMutation({
mutationFn: () => api.deleteSolanaWallet(facilitatorId),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['solanaWallet', facilitatorId] });
},
});

const airdropSolanaDevnet = useMutation({
mutationFn: () => api.airdropSolanaDevnet(facilitatorId),
onSuccess: (result) => {
queryClient.invalidateQueries({ queryKey: ['solanaWallet', facilitatorId] });
toast({
title: 'Devnet SOL requested',
description: result.balance ? `New devnet balance: ${result.balance.sol} SOL` : 'Airdrop submitted.',
});
},
onError: (error) => {
toast({
title: 'Airdrop failed',
description: error instanceof Error ? error.message : 'Unable to request devnet SOL.',
variant: 'destructive',
});
},
});

// Stacks Wallet mutations
const generateStacksWallet = useMutation({
mutationFn: () => api.generateStacksWallet(facilitatorId),
Expand All @@ -123,13 +89,6 @@ export function NetworksSection({ facilitatorId }: NetworksSectionProps) {
},
});

const deleteStacksWallet = useMutation({
mutationFn: () => api.deleteStacksWallet(facilitatorId),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['stacksWallet', facilitatorId] });
},
});

// Map wallet data
const getEvmWalletInfo = (): WalletInfo | null => {
if (!evmWallet?.hasWallet) return null;
Expand Down Expand Up @@ -209,10 +168,8 @@ export function NetworksSection({ facilitatorId }: NetworksSectionProps) {
showTestnets={showTestnets}
isGenerating={generateEvmWallet.isPending}
isImporting={importEvmWallet.isPending}
isDeleting={deleteEvmWallet.isPending}
onGenerate={() => generateEvmWallet.mutate()}
onImport={(pk) => importEvmWallet.mutate(pk)}
onDelete={() => deleteEvmWallet.mutate()}
/>

<WalletTypeCard
Expand All @@ -224,12 +181,8 @@ export function NetworksSection({ facilitatorId }: NetworksSectionProps) {
showTestnets={showTestnets}
isGenerating={generateSolanaWallet.isPending}
isImporting={importSolanaWallet.isPending}
isDeleting={deleteSolanaWallet.isPending}
isAirdroppingDevnet={airdropSolanaDevnet.isPending}
onGenerate={() => generateSolanaWallet.mutate()}
onImport={(pk) => importSolanaWallet.mutate(pk)}
onDelete={() => deleteSolanaWallet.mutate()}
onAirdropDevnet={() => airdropSolanaDevnet.mutate()}
/>

<WalletTypeCard
Expand All @@ -241,10 +194,8 @@ export function NetworksSection({ facilitatorId }: NetworksSectionProps) {
showTestnets={showTestnets}
isGenerating={generateStacksWallet.isPending}
isImporting={importStacksWallet.isPending}
isDeleting={deleteStacksWallet.isPending}
onGenerate={() => generateStacksWallet.mutate()}
onImport={(pk) => importStacksWallet.mutate(pk)}
onDelete={() => deleteStacksWallet.mutate()}
/>
</div>
</div>
Expand Down
34 changes: 0 additions & 34 deletions apps/dashboard/src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,6 @@ export interface SolanaWalletInfo {
};
}

export interface SolanaDevnetAirdropResponse {
success: boolean;
address: string;
signature: string;
balance: { sol: string; lamports: string } | null;
}

export interface StacksWalletInfo {
hasWallet: boolean;
address: string | null;
Expand Down Expand Up @@ -674,12 +667,6 @@ class ApiClient {
});
}

async deleteWallet(facilitatorId: string): Promise<{ success: boolean; message: string }> {
return this.request(`/api/admin/facilitators/${facilitatorId}/wallet`, {
method: 'DELETE',
});
}

// Solana Wallet Management
async getSolanaWallet(facilitatorId: string): Promise<SolanaWalletInfo> {
return this.request(`/api/admin/facilitators/${facilitatorId}/wallet/solana`);
Expand All @@ -698,19 +685,6 @@ class ApiClient {
});
}

async deleteSolanaWallet(facilitatorId: string): Promise<{ success: boolean; message: string }> {
return this.request(`/api/admin/facilitators/${facilitatorId}/wallet/solana`, {
method: 'DELETE',
});
}

async airdropSolanaDevnet(facilitatorId: string, amount = 1): Promise<SolanaDevnetAirdropResponse> {
return this.request(`/api/admin/facilitators/${facilitatorId}/wallet/solana/devnet/airdrop`, {
method: 'POST',
body: JSON.stringify({ amount }),
});
}

// ============ Stacks Wallet ============

async getStacksWallet(facilitatorId: string): Promise<StacksWalletInfo> {
Expand All @@ -733,14 +707,6 @@ class ApiClient {
});
}

async deleteStacksWallet(
facilitatorId: string
): Promise<{ success: boolean; message: string }> {
return this.request(`/api/admin/facilitators/${facilitatorId}/wallet/stacks`, {
method: 'DELETE',
});
}

// Favicon Management
async getFavicon(facilitatorId: string): Promise<{ hasFavicon: boolean; favicon: string | null }> {
return this.request(`/api/admin/facilitators/${facilitatorId}/favicon`);
Expand Down
Loading
Loading