chore: ordinal related improvements

This commit is contained in:
Danish Arora 2025-04-24 14:31:00 +05:30
parent 15d6d25455
commit 8129c78e1c
No known key found for this signature in database
GPG Key ID: 1C6EF37CDAE1426E
4 changed files with 291 additions and 132 deletions

View File

@ -4,11 +4,11 @@ import { useAuth } from '@/contexts/AuthContext';
import { useForum } from '@/contexts/ForumContext';
import { Button } from '@/components/ui/button';
import { Badge } from '@/components/ui/badge';
import { ShieldCheck, LogOut, Terminal, Wifi, WifiOff } from 'lucide-react';
import { ShieldCheck, LogOut, Terminal, Wifi, WifiOff, Eye, MessageSquare, RefreshCw } from 'lucide-react';
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';
const Header = () => {
const { currentUser, isAuthenticated, connectWallet, disconnectWallet, verifyOrdinal } = useAuth();
const { currentUser, isAuthenticated, verificationStatus, connectWallet, disconnectWallet, verifyOrdinal } = useAuth();
const { isNetworkConnected, isRefreshing } = useForum();
const handleConnect = async () => {
@ -22,6 +22,111 @@ const Header = () => {
const handleVerify = async () => {
await verifyOrdinal();
};
const renderAccessBadge = () => {
if (verificationStatus === 'unverified') {
return (
<Button
variant="outline"
size="sm"
onClick={handleVerify}
className="flex items-center gap-1"
>
<ShieldCheck className="w-4 h-4" />
<span>Verify Ordinal</span>
</Button>
);
}
if (verificationStatus === 'verifying') {
return (
<Badge
variant="outline"
className="flex items-center gap-1"
>
<RefreshCw className="w-3 h-3 animate-spin" />
<span className="text-xs">Verifying...</span>
</Badge>
);
}
if (verificationStatus === 'verified-none') {
return (
<div className="flex items-center gap-2">
<Tooltip>
<TooltipTrigger asChild>
<Badge
variant="secondary"
className="flex items-center gap-1 cursor-help"
>
<Eye className="w-3 h-3" />
<span className="text-xs">Read-Only Access</span>
</Badge>
</TooltipTrigger>
<TooltipContent className="max-w-[260px]">
<p className="font-semibold mb-1">Wallet Verified - No Ordinals Found</p>
<p className="text-sm mb-1">Your wallet has been verified but does not contain any Ordinal Operators.</p>
<p className="text-sm text-muted-foreground">You can browse content but cannot post, comment, or vote.</p>
</TooltipContent>
</Tooltip>
<Tooltip>
<TooltipTrigger asChild>
<Button
size="icon"
variant="ghost"
className="h-6 w-6"
onClick={handleVerify}
>
<RefreshCw className="h-3 w-3" />
</Button>
</TooltipTrigger>
<TooltipContent>
<p>Verify again</p>
</TooltipContent>
</Tooltip>
</div>
);
}
if (verificationStatus === 'verified-owner') {
return (
<div className="flex items-center gap-2">
<Tooltip>
<TooltipTrigger asChild>
<Badge
variant="default"
className="flex items-center gap-1 cursor-help bg-cyber-accent"
>
<MessageSquare className="w-3 h-3" />
<span className="text-xs">Full Access</span>
</Badge>
</TooltipTrigger>
<TooltipContent className="max-w-[260px]">
<p className="font-semibold mb-1">Ordinal Operators Verified!</p>
<p className="text-sm">You have full forum access with permission to post, comment, and vote.</p>
</TooltipContent>
</Tooltip>
<Tooltip>
<TooltipTrigger asChild>
<Button
size="icon"
variant="ghost"
className="h-6 w-6"
onClick={handleVerify}
>
<RefreshCw className="h-3 w-3" />
</Button>
</TooltipTrigger>
<TooltipContent>
<p>Verify again</p>
</TooltipContent>
</Tooltip>
</div>
);
}
return null;
};
return (
<header className="border-b border-cyber-muted bg-cyber-dark">
@ -76,17 +181,7 @@ const Header = () => {
</Button>
) : (
<>
{!isAuthenticated && (
<Button
variant="outline"
size="sm"
onClick={handleVerify}
className="flex items-center gap-1"
>
<ShieldCheck className="w-4 h-4" />
<span>Verify Ordinal</span>
</Button>
)}
{renderAccessBadge()}
<span className="hidden md:flex items-center text-sm text-cyber-neutral px-3">
{currentUser.address.slice(0, 6)}...{currentUser.address.slice(-4)}
</span>

View File

@ -5,10 +5,11 @@ import { useAuth } from '@/contexts/AuthContext';
import { Button } from '@/components/ui/button';
import { Textarea } from '@/components/ui/textarea';
import { Skeleton } from '@/components/ui/skeleton';
import { ArrowLeft, ArrowUp, ArrowDown, Clock, MessageCircle, Send, RefreshCw } from 'lucide-react';
import { ArrowLeft, ArrowUp, ArrowDown, Clock, MessageCircle, Send, RefreshCw, Eye } from 'lucide-react';
import { formatDistanceToNow } from 'date-fns';
import { Comment } from '@/types';
import { CypherImage } from './ui/CypherImage';
import { Badge } from '@/components/ui/badge';
const PostDetail = () => {
const { postId } = useParams<{ postId: string }>();
@ -27,34 +28,21 @@ const PostDetail = () => {
isRefreshing,
refreshData
} = useForum();
const { currentUser, isAuthenticated } = useAuth();
const { currentUser, isAuthenticated, verificationStatus } = useAuth();
const [newComment, setNewComment] = useState('');
if (!postId || isInitialLoading) {
if (!postId) return <div>Invalid post ID</div>;
if (isInitialLoading) {
return (
<div className="container mx-auto px-4 py-8 max-w-4xl">
<div className="mb-6">
<div className="text-cyber-accent flex items-center gap-1 text-sm">
<ArrowLeft className="w-4 h-4" /> Loading...
</div>
</div>
<div className="border border-cyber-muted rounded-sm p-4 mb-8">
<Skeleton className="h-6 w-3/4 mb-2 bg-cyber-muted" />
<Skeleton className="h-6 w-1/2 mb-4 bg-cyber-muted" />
<Skeleton className="h-4 w-32 bg-cyber-muted" />
</div>
<Skeleton className="h-32 w-full mb-8 bg-cyber-muted" />
<div className="container mx-auto px-4 py-6">
<Skeleton className="h-6 w-32 mb-6" />
<Skeleton className="h-10 w-3/4 mb-3" />
<Skeleton className="h-32 w-full mb-6" />
<Skeleton className="h-6 w-48 mb-4" />
<div className="space-y-4">
{[...Array(2)].map((_, i) => (
<div key={i} className="ml-4 border-l-2 border-cyber-muted pl-4 py-2">
<Skeleton className="h-4 w-full mb-2 bg-cyber-muted" />
<Skeleton className="h-4 w-3/4 mb-2 bg-cyber-muted" />
<Skeleton className="h-3 w-24 bg-cyber-muted" />
</div>
))}
<Skeleton className="h-24 w-full" />
<Skeleton className="h-24 w-full" />
</div>
</div>
);
@ -64,25 +52,18 @@ const PostDetail = () => {
if (!post) {
return (
<div className="container mx-auto px-4 py-8 max-w-4xl">
<div className="mb-6">
<Link to="/" className="text-cyber-accent hover:underline flex items-center gap-1 text-sm">
<ArrowLeft className="w-4 h-4" /> Back to Cells
</Link>
</div>
<div className="p-8 text-center">
<h1 className="text-2xl font-bold mb-4">Post Not Found</h1>
<p className="text-cyber-neutral mb-6">The post you're looking for doesn't exist or may have been pruned.</p>
<Button asChild>
<Link to="/">Return to Cells</Link>
</Button>
</div>
<div className="container mx-auto px-4 py-6 text-center">
<h2 className="text-xl font-bold mb-4">Post not found</h2>
<p className="mb-4">The post you're looking for doesn't exist or has been removed.</p>
<Button asChild>
<Link to="/">Go back home</Link>
</Button>
</div>
);
}
const cell = getCellById(post.cellId);
const postComments = getCommentsByPost(postId);
const postComments = getCommentsByPost(post.id);
const handleCreateComment = async (e: React.FormEvent) => {
e.preventDefault();
@ -100,12 +81,12 @@ const PostDetail = () => {
};
const handleVotePost = async (isUpvote: boolean) => {
if (!isAuthenticated) return;
if (verificationStatus !== 'verified-owner') return;
await votePost(post.id, isUpvote);
};
const handleVoteComment = async (commentId: string, isUpvote: boolean) => {
if (!isAuthenticated) return;
if (verificationStatus !== 'verified-owner') return;
await voteComment(commentId, isUpvote);
};
@ -118,44 +99,39 @@ const PostDetail = () => {
return votes.some(vote => vote.author === currentUser.address);
};
const getIdentityImageUrl = (address: string) => {
return `https://api.dicebear.com/7.x/identicon/svg?seed=${address}`;
};
return (
<div className="container mx-auto px-4 py-8 max-w-4xl">
<div className="mb-6 flex items-center justify-between">
<Link
to={cell ? `/cell/${cell.id}` : '/'}
className="text-cyber-accent hover:underline flex items-center gap-1 text-sm"
>
<ArrowLeft className="w-4 h-4" />
{cell ? `Back to ${cell.name}` : 'Back to Cells'}
</Link>
<div className="container mx-auto px-4 py-6">
<div className="mb-6">
<Button
variant="outline"
size="icon"
onClick={refreshData}
disabled={isRefreshing}
title="Refresh data"
onClick={() => navigate(`/cell/${post.cellId}`)}
variant="ghost"
size="sm"
className="mb-4"
>
<RefreshCw className={`w-4 h-4 ${isRefreshing ? 'animate-spin' : ''}`} />
<ArrowLeft className="w-4 h-4 mr-1" />
Back to /{cell?.name || 'cell'}/
</Button>
</div>
<div className="border border-cyber-muted rounded-sm p-4 mb-8">
<div className="flex gap-2 items-start">
<div className="flex flex-col items-center mr-2">
<div className="flex gap-4 items-start">
<div className="flex flex-col items-center">
<button
className={`p-1 rounded-sm hover:bg-cyber-muted/50 ${isPostUpvoted ? 'text-cyber-accent' : ''}`}
onClick={() => handleVotePost(true)}
disabled={!isAuthenticated || isVoting}
title={isAuthenticated ? "Upvote" : "Verify Ordinal to vote"}
disabled={verificationStatus !== 'verified-owner' || isVoting}
title={verificationStatus === 'verified-owner' ? "Upvote" : "Full access required to vote"}
>
<ArrowUp className="w-5 h-5" />
</button>
<span className="text-xs py-1">{post.upvotes.length - post.downvotes.length}</span>
<span className="text-sm py-1">{post.upvotes.length - post.downvotes.length}</span>
<button
className={`p-1 rounded-sm hover:bg-cyber-muted/50 ${isPostDownvoted ? 'text-cyber-accent' : ''}`}
onClick={() => handleVotePost(false)}
disabled={!isAuthenticated || isVoting}
title={isAuthenticated ? "Downvote" : "Verify Ordinal to vote"}
disabled={verificationStatus !== 'verified-owner' || isVoting}
title={verificationStatus === 'verified-owner' ? "Downvote" : "Full access required to vote"}
>
<ArrowDown className="w-5 h-5" />
</button>
@ -181,7 +157,7 @@ const PostDetail = () => {
</div>
</div>
{isAuthenticated ? (
{verificationStatus === 'verified-owner' ? (
<div className="mb-8">
<form onSubmit={handleCreateComment}>
<div className="flex gap-2">
@ -202,6 +178,17 @@ const PostDetail = () => {
</div>
</form>
</div>
) : verificationStatus === 'verified-none' ? (
<div className="mb-8 p-4 border border-cyber-muted rounded-sm bg-cyber-muted/20">
<div className="flex items-center gap-2 mb-2">
<Eye className="w-4 h-4 text-cyber-neutral" />
<h3 className="font-medium">Read-Only Mode</h3>
</div>
<p className="text-sm text-cyber-neutral">
Your wallet has been verified but does not contain any Ordinal Operators.
You can browse threads but cannot comment or vote.
</p>
</div>
) : (
<div className="mb-8 p-4 border border-cyber-muted rounded-sm bg-cyber-muted/20 text-center">
<p className="text-sm mb-3">Connect wallet and verify Ordinal ownership to comment</p>
@ -224,8 +211,8 @@ const PostDetail = () => {
<button
className={`p-0.5 rounded-sm hover:bg-cyber-muted/50 ${isCommentVoted(comment, true) ? 'text-cyber-accent' : ''}`}
onClick={() => handleVoteComment(comment.id, true)}
disabled={!isAuthenticated || isVoting}
title={isAuthenticated ? "Upvote" : "Verify Ordinal to vote"}
disabled={verificationStatus !== 'verified-owner' || isVoting}
title={verificationStatus === 'verified-owner' ? "Upvote" : "Full access required to vote"}
>
<ArrowUp className="w-4 h-4" />
</button>
@ -233,24 +220,29 @@ const PostDetail = () => {
<button
className={`p-0.5 rounded-sm hover:bg-cyber-muted/50 ${isCommentVoted(comment, false) ? 'text-cyber-accent' : ''}`}
onClick={() => handleVoteComment(comment.id, false)}
disabled={!isAuthenticated || isVoting}
title={isAuthenticated ? "Downvote" : "Verify Ordinal to vote"}
disabled={verificationStatus !== 'verified-owner' || isVoting}
title={verificationStatus === 'verified-owner' ? "Downvote" : "Full access required to vote"}
>
<ArrowDown className="w-4 h-4" />
</button>
</div>
<div className="flex-1">
<p className="text-sm mb-2">{comment.content}</p>
<div className="flex items-center gap-3 text-xs text-cyber-neutral">
<span className="flex items-center">
<Clock className="w-3 h-3 mr-1" />
<div className="bg-cyber-muted/30 rounded-sm p-3 flex-1">
<div className="flex justify-between items-start mb-2">
<div className="flex items-center gap-2">
<CypherImage
src={getIdentityImageUrl(comment.authorAddress)}
alt={comment.authorAddress.slice(0, 6)}
className="rounded-sm w-5 h-5 bg-cyber-muted"
/>
<span className="text-xs text-cyber-neutral">
{comment.authorAddress.slice(0, 6)}...{comment.authorAddress.slice(-4)}
</span>
</div>
<span className="text-xs text-cyber-neutral">
{formatDistanceToNow(comment.timestamp, { addSuffix: true })}
</span>
<span className="truncate max-w-[120px]">
{comment.authorAddress.slice(0, 6)}...{comment.authorAddress.slice(-4)}
</span>
</div>
<p className="text-sm break-words">{comment.content}</p>
</div>
</div>
</div>

View File

@ -6,9 +6,10 @@ import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Textarea } from '@/components/ui/textarea';
import { Skeleton } from '@/components/ui/skeleton';
import { ArrowLeft, MessageSquare, MessageCircle, ArrowUp, ArrowDown, Clock, RefreshCw } from 'lucide-react';
import { ArrowLeft, MessageSquare, MessageCircle, ArrowUp, ArrowDown, Clock, RefreshCw, Eye } from 'lucide-react';
import { formatDistanceToNow } from 'date-fns';
import { CypherImage } from './ui/CypherImage';
import { Badge } from '@/components/ui/badge';
const PostList = () => {
const { cellId } = useParams<{ cellId: string }>();
@ -20,9 +21,12 @@ const PostList = () => {
isInitialLoading,
isPostingPost,
isRefreshing,
refreshData
refreshData,
votePost,
isVoting,
posts
} = useForum();
const { isAuthenticated } = useAuth();
const { isAuthenticated, currentUser, verificationStatus } = useAuth();
const [newPostTitle, setNewPostTitle] = useState('');
const [newPostContent, setNewPostContent] = useState('');
@ -54,7 +58,7 @@ const PostList = () => {
}
const cell = getCellById(cellId);
const posts = getPostsByCell(cellId);
const cellPosts = getPostsByCell(cellId);
if (!cell) {
return (
@ -91,6 +95,19 @@ const PostList = () => {
}
};
const handleVotePost = async (postId: string, isUpvote: boolean) => {
if (!isAuthenticated) return;
await votePost(postId, isUpvote);
};
const isPostVoted = (postId: string, isUpvote: boolean) => {
if (!currentUser) return false;
const post = posts.find(p => p.id === postId);
if (!post) return false;
const votes = isUpvote ? post.upvotes : post.downvotes;
return votes.some(vote => vote.author === currentUser.address);
};
return (
<div className="container mx-auto px-4 py-8 max-w-4xl">
<div className="mb-6">
@ -123,7 +140,7 @@ const PostList = () => {
</div>
</div>
{isAuthenticated && (
{verificationStatus === 'verified-owner' && (
<div className="mb-8">
<form onSubmit={handleCreatePost}>
<h2 className="text-sm font-bold mb-2 flex items-center gap-1">
@ -158,8 +175,30 @@ const PostList = () => {
</div>
)}
{verificationStatus === 'verified-none' && (
<div className="mb-8 p-4 border border-cyber-muted rounded-sm bg-cyber-muted/20">
<div className="flex items-center gap-2 mb-2">
<Eye className="w-4 h-4 text-cyber-neutral" />
<h3 className="font-medium">Read-Only Mode</h3>
</div>
<p className="text-sm text-cyber-neutral mb-2">
Your wallet does not contain any Ordinal Operators. You can browse threads but cannot post or interact.
</p>
<Badge variant="outline" className="text-xs">No Ordinals Found</Badge>
</div>
)}
{!currentUser && (
<div className="mb-8 p-4 border border-cyber-muted rounded-sm bg-cyber-muted/20 text-center">
<p className="text-sm mb-3">Connect wallet and verify Ordinal ownership to post</p>
<Button asChild size="sm">
<Link to="/">Connect Wallet</Link>
</Button>
</div>
)}
<div className="space-y-4">
{posts.length === 0 ? (
{cellPosts.length === 0 ? (
<div className="text-center py-12">
<MessageCircle className="w-12 h-12 mx-auto mb-4 text-cyber-neutral opacity-50" />
<h2 className="text-xl font-bold mb-2">No Threads Yet</h2>
@ -170,32 +209,41 @@ const PostList = () => {
</p>
</div>
) : (
posts.map(post => (
<Link to={`/post/${post.id}`} key={post.id} className="thread-card block">
<div>
<h3 className="font-medium mb-1">{post.title}</h3>
<p className="text-sm mb-3">{post.content}</p>
<div className="flex items-center gap-4 text-xs text-cyber-neutral">
<span className="flex items-center">
<Clock className="w-3 h-3 mr-1" />
{formatDistanceToNow(post.timestamp, { addSuffix: true })}
</span>
<span className="flex items-center">
<MessageCircle className="w-3 h-3 mr-1" />
{getCommentsByPost(post.id).length} comments
</span>
<div className="flex items-center">
<ArrowUp className="w-3 h-3 mr-1" />
<span>{post.upvotes.length}</span>
<ArrowDown className="w-3 h-3 mx-1" />
<span>{post.downvotes.length}</span>
</div>
<span className="truncate max-w-[120px]">
{post.authorAddress.slice(0, 6)}...{post.authorAddress.slice(-4)}
</span>
cellPosts.map(post => (
<div key={post.id} className="post-card p-4 border border-cyber-muted rounded-sm bg-cyber-muted/20 hover:bg-cyber-muted/30 transition duration-200">
<div className="flex gap-4">
<div className="flex flex-col items-center">
<button
className={`p-1 rounded-sm hover:bg-cyber-muted/50 ${isPostVoted(post.id, true) ? 'text-cyber-accent' : ''}`}
onClick={() => handleVotePost(post.id, true)}
disabled={!isAuthenticated || isVoting}
title={isAuthenticated ? "Upvote" : "Verify Ordinal to vote"}
>
<ArrowUp className="w-4 h-4" />
</button>
<span className="text-sm py-1">{post.upvotes.length - post.downvotes.length}</span>
<button
className={`p-1 rounded-sm hover:bg-cyber-muted/50 ${isPostVoted(post.id, false) ? 'text-cyber-accent' : ''}`}
onClick={() => handleVotePost(post.id, false)}
disabled={!isAuthenticated || isVoting}
title={isAuthenticated ? "Downvote" : "Verify Ordinal to vote"}
>
<ArrowDown className="w-4 h-4" />
</button>
</div>
<div className="flex-1">
<Link to={`/post/${post.id}`} className="block">
<h2 className="text-lg font-bold hover:text-cyber-accent">{post.title}</h2>
<p className="line-clamp-2 text-sm mb-3">{post.content}</p>
<div className="flex items-center gap-4 text-xs text-cyber-neutral">
<span>{formatDistanceToNow(post.timestamp, { addSuffix: true })}</span>
<span>by {post.authorAddress.slice(0, 6)}...{post.authorAddress.slice(-4)}</span>
</div>
</Link>
</div>
</div>
</Link>
</div>
))
)}
</div>

View File

@ -3,10 +3,13 @@ import { useToast } from '@/components/ui/use-toast';
import { User } from '@/types';
import { OrdinalAPI } from '@/lib/identity/ordinal';
export type VerificationStatus = 'unverified' | 'verified-none' | 'verified-owner' | 'verifying';
interface AuthContextType {
currentUser: User | null;
isAuthenticated: boolean;
isAuthenticating: boolean;
verificationStatus: VerificationStatus;
connectWallet: () => Promise<void>;
disconnectWallet: () => void;
verifyOrdinal: () => Promise<boolean>;
@ -17,28 +20,34 @@ const AuthContext = createContext<AuthContextType | undefined>(undefined);
export function AuthProvider({ children }: { children: React.ReactNode }) {
const [currentUser, setCurrentUser] = useState<User | null>(null);
const [isAuthenticating, setIsAuthenticating] = useState(false);
const [verificationStatus, setVerificationStatus] = useState<VerificationStatus>('unverified');
const { toast } = useToast();
const ordinalApi = new OrdinalAPI();
// Check for existing session on mount
useEffect(() => {
const storedUser = localStorage.getItem('opchan-user');
if (storedUser) {
try {
const user = JSON.parse(storedUser);
// Check if the stored authentication is still valid (not expired)
const lastChecked = user.lastChecked || 0;
const expiryTime = 24 * 60 * 60 * 1000; // 24 hours in milliseconds
const expiryTime = 24 * 60 * 60 * 1000;
if (Date.now() - lastChecked < expiryTime) {
setCurrentUser(user);
if ('ordinalOwnership' in user) {
setVerificationStatus(user.ordinalOwnership ? 'verified-owner' : 'verified-none');
} else {
setVerificationStatus('unverified');
}
} else {
// Clear expired session
localStorage.removeItem('opchan-user');
setVerificationStatus('unverified');
}
} catch (e) {
console.error("Failed to parse stored user data", e);
localStorage.removeItem('opchan-user');
setVerificationStatus('unverified');
}
}
}, []);
@ -59,6 +68,7 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
// Store user data
setCurrentUser(newUser);
localStorage.setItem('opchan-user', JSON.stringify(newUser));
setVerificationStatus('unverified');
toast({
title: "Wallet Connected",
@ -82,6 +92,7 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
const disconnectWallet = () => {
setCurrentUser(null);
localStorage.removeItem('opchan-user');
setVerificationStatus('unverified');
toast({
title: "Disconnected",
description: "Your wallet has been disconnected.",
@ -99,8 +110,13 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
}
setIsAuthenticating(true);
setVerificationStatus('verifying');
try {
toast({ title: "Verifying Ordinal", description: "Checking your wallet for Ordinal Operators..." });
toast({
title: "Verifying Ordinal",
description: "Checking your wallet for Ordinal Operators..."
});
const response = await ordinalApi.getOperatorDetails(currentUser.address);
const hasOperators = response.has_operators;
@ -114,31 +130,38 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
setCurrentUser(updatedUser);
localStorage.setItem('opchan-user', JSON.stringify(updatedUser));
// Update verification status
setVerificationStatus(hasOperators ? 'verified-owner' : 'verified-none');
if (hasOperators) {
toast({
title: "Ordinal Verified",
description: "You can now post and interact with the forum.",
description: "You now have full access to post and interact with the forum.",
});
} else {
toast({
title: "Verification Failed",
description: "No Ordinal Operators found in the connected wallet.",
variant: "destructive",
title: "Read-Only Access",
description: "No Ordinal Operators found. You have read-only access.",
variant: "default",
});
}
return hasOperators;
} catch (error) {
console.error("Error verifying Ordinal:", error);
setVerificationStatus('unverified');
let errorMessage = "Failed to verify Ordinal ownership. Please try again.";
if (error instanceof Error) {
errorMessage = error.message;
}
toast({
title: "Verification Error",
description: errorMessage,
variant: "destructive",
});
return false;
} finally {
setIsAuthenticating(false);
@ -151,6 +174,7 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
currentUser,
isAuthenticated: !!currentUser?.ordinalOwnership,
isAuthenticating,
verificationStatus,
connectWallet,
disconnectWallet,
verifyOrdinal,