create-awarizon-app 1.0.9 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/index.js +0 -0
  2. package/package.json +8 -8
  3. package/templates/expo/app/(tabs)/_layout.tsx +4 -3
  4. package/templates/expo/app/(tabs)/index.tsx +40 -64
  5. package/templates/expo/app/(tabs)/nft.tsx +142 -0
  6. package/templates/expo/app/(tabs)/wallet.tsx +127 -0
  7. package/templates/expo/babel.config.js +6 -0
  8. package/templates/expo/package.json +22 -23
  9. package/templates/expo-js/app/(tabs)/_layout.jsx +4 -3
  10. package/templates/expo-js/app/(tabs)/index.jsx +40 -66
  11. package/templates/expo-js/app/(tabs)/nft.jsx +141 -0
  12. package/templates/expo-js/app/(tabs)/wallet.jsx +128 -0
  13. package/templates/expo-js/package.json +19 -20
  14. package/templates/nextjs/app/layout.tsx +5 -1
  15. package/templates/nextjs/app/nft/page.tsx +140 -0
  16. package/templates/nextjs/app/page.tsx +37 -155
  17. package/templates/nextjs/app/wallet/page.tsx +116 -0
  18. package/templates/nextjs/components/Header.tsx +56 -0
  19. package/templates/nextjs/package.json +15 -16
  20. package/templates/nextjs-js/app/layout.jsx +5 -1
  21. package/templates/nextjs-js/app/nft/page.jsx +139 -0
  22. package/templates/nextjs-js/app/page.jsx +37 -128
  23. package/templates/nextjs-js/app/wallet/page.jsx +116 -0
  24. package/templates/nextjs-js/components/Header.jsx +56 -0
  25. package/templates/nextjs-js/package.json +11 -12
  26. package/templates/react/package.json +14 -15
  27. package/templates/react/src/App.tsx +88 -145
  28. package/templates/react/src/pages/NftPage.tsx +138 -0
  29. package/templates/react/src/pages/WalletPage.tsx +114 -0
  30. package/templates/react-js/package.json +11 -12
  31. package/templates/react-js/src/App.jsx +86 -118
  32. package/templates/react-js/src/pages/NftPage.jsx +137 -0
  33. package/templates/react-js/src/pages/WalletPage.jsx +114 -0
@@ -1,168 +1,50 @@
1
1
  'use client'
2
2
 
3
- import { useReadContract, ConnectButton } from '@awarizon/react'
4
- import { ERC20_ABI } from '@awarizon/web3'
5
- import { Badge } from '@/components/ui/Badge'
6
- import { Button } from '@/components/ui/Button'
7
- import { Card } from '@/components/ui/Card'
3
+ import { usePrices } from '@awarizon/react'
8
4
  import { Skeleton } from '@/components/ui/Skeleton'
9
- import { StatCard } from '@/components/ui/StatCard'
10
5
 
11
- const USDC_BASE = '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
12
-
13
- function DataRow({ label, value, loading }: { label: string; value?: string; loading: boolean }) {
14
- return (
15
- <div className="flex items-center justify-between py-3 border-b border-zinc-800/50 last:border-0">
16
- <code className="text-[11px] text-yellow-400/70 font-mono">{label}</code>
17
- {loading
18
- ? <Skeleton className="h-3.5 w-28" />
19
- : <span className="font-mono text-xs text-zinc-300">{value ?? '—'}</span>}
20
- </div>
21
- )
22
- }
6
+ const TOKENS = [
7
+ { symbol: 'ETH', name: 'Ethereum', color: '#627EEA' },
8
+ { symbol: 'BTC', name: 'Bitcoin', color: '#F7931A' },
9
+ { symbol: 'USDC', name: 'USD Coin', color: '#2775CA' },
10
+ { symbol: 'BNB', name: 'BNB', color: '#F3BA2F' },
11
+ { symbol: 'SOL', name: 'Solana', color: '#9945FF' },
12
+ ]
23
13
 
24
14
  export default function Home() {
25
- const { data: name, isLoading: l1 } = useReadContract({ address: USDC_BASE, abi: ERC20_ABI, method: 'name' })
26
- const { data: symbol, isLoading: l2 } = useReadContract({ address: USDC_BASE, abi: ERC20_ABI, method: 'symbol' })
27
- const { data: decimals, isLoading: l3 } = useReadContract({ address: USDC_BASE, abi: ERC20_ABI, method: 'decimals' })
28
- const { data: totalSupply, isLoading: l4 } = useReadContract({ address: USDC_BASE, abi: ERC20_ABI, method: 'totalSupply' })
29
-
30
- const formatted =
31
- totalSupply !== undefined && decimals !== undefined
32
- ? (Number(totalSupply as bigint) / 10 ** Number(decimals as bigint))
33
- .toLocaleString(undefined, { maximumFractionDigits: 2 })
34
- : undefined
35
-
36
- const synced = !l1 && !l2 && !l3 && !l4
15
+ const { prices, isLoading } = usePrices(TOKENS.map(t => t.symbol))
37
16
 
38
17
  return (
39
- <div className="min-h-screen bg-zinc-950 text-zinc-100">
40
-
41
- {/* ── Header ─────────────────────────────────────── */}
42
- <header className="sticky top-0 z-10 border-b border-zinc-800/60 bg-zinc-950/80 backdrop-blur-sm px-6 py-4">
43
- <div className="max-w-4xl mx-auto flex items-center justify-between">
44
- <div className="flex items-center gap-2.5">
45
- <div className="w-5 h-5 rounded-[4px] bg-yellow-400" />
46
- <span className="font-mono text-[11px] tracking-[0.2em] text-zinc-400 uppercase">
47
- {{project-name}}
48
- </span>
49
- </div>
50
- <div className="flex items-center gap-3">
51
- <Badge variant="outline">Base</Badge>
52
- <Badge variant={synced ? 'success' : 'loading'}>
53
- {synced ? '● Live' : '○ Loading'}
54
- </Badge>
55
- {process.env.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID && <ConnectButton />}
56
- </div>
57
- </div>
58
- </header>
59
-
60
- <main className="max-w-4xl mx-auto px-6 py-12">
61
-
62
- {/* ── Hero ───────────────────────────────────────── */}
63
- <div className="mb-10">
64
- <Badge variant="outline" className="mb-5">Awarizon Web3 SDK · Next.js</Badge>
65
- <h1 className="text-4xl font-bold tracking-tight text-white mb-3">{{ProjectName}}</h1>
66
- <p className="text-zinc-400 text-base max-w-lg leading-relaxed">
67
- Live on-chain reads from Base — no backend required. Built with{' '}
68
- <code className="font-mono text-[11px] text-yellow-400/80">@awarizon/react</code>.
69
- </p>
70
- </div>
71
-
72
- {/* ── Data grid ──────────────────────────────────── */}
73
- <div className="grid md:grid-cols-3 gap-4 mb-4">
74
-
75
- {/* Contract reader — spans 2 cols */}
76
- <Card className="md:col-span-2">
77
- <div className="flex items-start justify-between mb-4">
78
- <div>
79
- <p className="font-mono text-[9px] tracking-widest text-zinc-600 uppercase mb-1.5">
80
- Contract · Live Read
81
- </p>
82
- <code className="font-mono text-xs text-zinc-500">
83
- 0x8335…2913 · Base
84
- </code>
85
- </div>
86
- <Badge variant={synced ? 'success' : 'loading'}>
87
- {synced ? 'Synced' : 'Fetching…'}
88
- </Badge>
89
- </div>
90
- <DataRow label="name()" value={name as string} loading={l1} />
91
- <DataRow label="symbol()" value={symbol as string} loading={l2} />
92
- <DataRow label="decimals()" value={String(decimals ?? '')} loading={l3} />
93
- <DataRow label="totalSupply()" value={formatted} loading={l4} />
94
- </Card>
95
-
96
- {/* Stat column */}
97
- <div className="flex flex-col gap-4">
98
- <StatCard
99
- label="Total Supply"
100
- value={formatted}
101
- loading={l4}
102
- sub="USDC · formatted"
103
- className="flex-1"
104
- />
105
- <StatCard
106
- label="Token"
107
- value={symbol as string}
108
- loading={l2}
109
- sub="Base mainnet"
110
- className="flex-1"
111
- />
112
- </div>
113
- </div>
114
-
115
- {/* ── Network info ────────────────────────────────── */}
116
- <div className="grid sm:grid-cols-3 gap-4 mb-4">
117
- {[
118
- { label: 'Network', value: 'Base Mainnet' },
119
- { label: 'Chain ID', value: '8453' },
120
- { label: 'SDK', value: '@awarizon/react' },
121
- ].map(({ label, value }) => (
18
+ <main className="max-w-5xl mx-auto px-6 py-10">
19
+ <div className="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-4">
20
+ {TOKENS.map(({ symbol, name, color }) => {
21
+ const price = prices[symbol]?.price
22
+ return (
122
23
  <div
123
- key={label}
124
- className="bg-zinc-900/50 border border-zinc-800/40 rounded-xl px-5 py-4 flex items-center justify-between"
24
+ key={symbol}
25
+ className="bg-zinc-900/40 border border-zinc-800/40 rounded-2xl p-5 hover:bg-zinc-900/60 hover:border-zinc-700/50 transition-all cursor-default"
125
26
  >
126
- <span className="font-mono text-[10px] text-zinc-600 uppercase tracking-widest">{label}</span>
127
- <code className="font-mono text-xs text-zinc-400">{value}</code>
27
+ <div className="mb-4">
28
+ <div
29
+ className="w-10 h-10 rounded-full flex items-center justify-center text-[10px] font-bold tracking-wider mb-3"
30
+ style={{ backgroundColor: `${color}18`, border: `1px solid ${color}25`, color }}
31
+ >
32
+ {symbol.slice(0, 3)}
33
+ </div>
34
+ <p className="text-[11px] text-zinc-500 font-medium mb-0.5">{symbol}</p>
35
+ <p className="text-xs text-zinc-600">{name}</p>
36
+ </div>
37
+ <div className="text-lg font-semibold text-white tracking-tight">
38
+ {isLoading
39
+ ? <Skeleton className="h-5 w-20" />
40
+ : price != null
41
+ ? `$${price.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`
42
+ : '—'}
43
+ </div>
128
44
  </div>
129
- ))}
130
- </div>
131
-
132
- {/* ── Next steps ──────────────────────────────────── */}
133
- <Card>
134
- <p className="font-mono text-[9px] tracking-widest text-zinc-600 uppercase mb-4">
135
- Next Steps
136
- </p>
137
- <ul className="space-y-3 mb-6">
138
- {[
139
- ['01', 'Replace USDC_BASE with your contract address'],
140
- ['02', 'Swap ERC20_ABI for your contract ABI'],
141
- ['03', 'Change chain="base" in app/layout.tsx to your target network'],
142
- ['04', 'Use useWriteContract() for send transactions'],
143
- ['05', 'Add walletConnectProjectId to AwarizonProvider for mobile wallet support'],
144
- ].map(([n, s]) => (
145
- <li key={n} className="flex items-start gap-3">
146
- <span className="font-mono text-[10px] text-yellow-400/50 mt-0.5 shrink-0 select-none">{n}</span>
147
- <span className="text-sm text-zinc-400 leading-relaxed">{s}</span>
148
- </li>
149
- ))}
150
- </ul>
151
- <div className="flex flex-wrap gap-2">
152
- <Button href="https://awarizon.com/docs" target="_blank" rel="noreferrer">
153
- Read the docs →
154
- </Button>
155
- <Button
156
- href="https://awarizon.com/dashboard"
157
- target="_blank"
158
- rel="noreferrer"
159
- variant="secondary"
160
- >
161
- Dashboard
162
- </Button>
163
- </div>
164
- </Card>
165
- </main>
166
- </div>
45
+ )
46
+ })}
47
+ </div>
48
+ </main>
167
49
  )
168
50
  }
@@ -0,0 +1,116 @@
1
+ 'use client'
2
+
3
+ import { useWallet, useNativeBalance, usePrices, ConnectButton } from '@awarizon/react'
4
+ import { Badge } from '@/components/ui/Badge'
5
+ import { Card } from '@/components/ui/Card'
6
+ import { Skeleton } from '@/components/ui/Skeleton'
7
+ import { StatCard } from '@/components/ui/StatCard'
8
+
9
+ const SYMBOLS = ['ETH', 'BTC', 'USDC']
10
+
11
+ function DataRow({ label, value, loading }: { label: string; value?: string; loading: boolean }) {
12
+ return (
13
+ <div className="flex items-center justify-between py-3 border-b border-zinc-800/50 last:border-0">
14
+ <span className="font-mono text-[10px] text-zinc-600 uppercase tracking-widest">{label}</span>
15
+ {loading
16
+ ? <Skeleton className="h-3.5 w-32" />
17
+ : <span className="font-mono text-xs text-zinc-300">{value ?? '—'}</span>}
18
+ </div>
19
+ )
20
+ }
21
+
22
+ export default function WalletPage() {
23
+ const { address, isConnected, isChainMismatch, chainId, connectorInfo } = useWallet()
24
+ const { formatted: nativeBalance, isLoading: balanceLoading } = useNativeBalance(
25
+ address ?? undefined,
26
+ 12_000,
27
+ )
28
+ const { prices, isLoading: pricesLoading } = usePrices(SYMBOLS)
29
+
30
+ const fmtPrice = (sym: string) =>
31
+ prices[sym]?.price != null
32
+ ? `$${prices[sym].price.toLocaleString(undefined, { maximumFractionDigits: 2 })}`
33
+ : undefined
34
+
35
+ const ethFiatValue =
36
+ nativeBalance != null && prices['ETH']?.price != null
37
+ ? `$${(parseFloat(nativeBalance) * prices['ETH'].price).toLocaleString(undefined, { maximumFractionDigits: 2 })}`
38
+ : undefined
39
+
40
+ return (
41
+ <main className="max-w-4xl mx-auto px-6 py-12">
42
+
43
+ {/* ── Hero ───────────────────────────────────────── */}
44
+ <div className="mb-10">
45
+ <Badge variant="outline" className="mb-5">Portfolio</Badge>
46
+ <h1 className="text-4xl font-bold tracking-tight text-white mb-3">Wallet</h1>
47
+ <p className="text-zinc-400 text-base max-w-lg leading-relaxed">
48
+ Live balance and portfolio data via{' '}
49
+ <code className="font-mono text-[11px] text-yellow-400/80">useWallet</code>,{' '}
50
+ <code className="font-mono text-[11px] text-yellow-400/80">useNativeBalance</code>, and{' '}
51
+ <code className="font-mono text-[11px] text-yellow-400/80">usePrices</code>.
52
+ </p>
53
+ </div>
54
+
55
+ {!isConnected ? (
56
+ <Card className="py-12 flex flex-col items-center text-center">
57
+ <p className="font-mono text-[10px] tracking-widest text-zinc-600 uppercase mb-3">
58
+ No Wallet Connected
59
+ </p>
60
+ <p className="text-zinc-400 text-sm mb-6 max-w-sm leading-relaxed">
61
+ Connect a wallet to view your address, native balance, and real-time portfolio value.
62
+ </p>
63
+ <ConnectButton />
64
+ </Card>
65
+ ) : (
66
+ <>
67
+ {isChainMismatch && (
68
+ <div className="mb-4 px-4 py-3 bg-amber-500/10 border border-amber-500/20 rounded-xl">
69
+ <span className="font-mono text-xs text-amber-400">
70
+ Wrong network — switch to the chain configured in components/Providers.tsx
71
+ </span>
72
+ </div>
73
+ )}
74
+
75
+ {/* ── Account ──────────────────────────────────── */}
76
+ <Card className="mb-4">
77
+ <p className="font-mono text-[9px] tracking-widest text-zinc-600 uppercase mb-4">Account</p>
78
+ <DataRow label="Address" value={address ?? undefined} loading={false} />
79
+ <DataRow label="Chain ID" value={chainId != null ? String(chainId) : undefined} loading={false} />
80
+ <DataRow label="Connector" value={connectorInfo?.name ?? connectorInfo?.type} loading={false} />
81
+ </Card>
82
+
83
+ {/* ── Balance ──────────────────────────────────── */}
84
+ <div className="grid sm:grid-cols-3 gap-4 mb-4">
85
+ <StatCard
86
+ label="Native Balance"
87
+ value={nativeBalance != null ? `${parseFloat(nativeBalance).toFixed(6)} ETH` : undefined}
88
+ loading={balanceLoading}
89
+ sub="useNativeBalance · 12 s poll"
90
+ className="sm:col-span-2"
91
+ />
92
+ <StatCard
93
+ label="Est. Value"
94
+ value={ethFiatValue}
95
+ loading={balanceLoading || pricesLoading}
96
+ sub="ETH × market price"
97
+ />
98
+ </div>
99
+
100
+ {/* ── Prices ───────────────────────────────────── */}
101
+ <div className="grid sm:grid-cols-3 gap-4">
102
+ {SYMBOLS.map(sym => (
103
+ <StatCard
104
+ key={sym}
105
+ label={sym}
106
+ value={fmtPrice(sym)}
107
+ loading={pricesLoading}
108
+ sub="USD · usePrices"
109
+ />
110
+ ))}
111
+ </div>
112
+ </>
113
+ )}
114
+ </main>
115
+ )
116
+ }
@@ -0,0 +1,56 @@
1
+ 'use client'
2
+
3
+ import Link from 'next/link'
4
+ import { usePathname } from 'next/navigation'
5
+ import { ConnectButton } from '@awarizon/react'
6
+
7
+ const NAV = [
8
+ { href: '/', label: 'Markets' },
9
+ { href: '/nft', label: 'NFT' },
10
+ { href: '/wallet', label: 'Wallet' },
11
+ ]
12
+
13
+ export function Header() {
14
+ const pathname = usePathname()
15
+ return (
16
+ <header className="sticky top-0 z-50 border-b border-white/[0.06] bg-zinc-950/70 backdrop-blur-2xl">
17
+ <div className="max-w-5xl mx-auto px-6 h-16 flex items-center justify-between gap-8">
18
+
19
+ <div className="flex items-center gap-2.5 shrink-0">
20
+ <div className="w-7 h-7 rounded-lg bg-yellow-400" />
21
+ <span className="text-sm font-semibold text-white">{'{{project-name}}'}</span>
22
+ </div>
23
+
24
+ <nav className="flex items-center">
25
+ {NAV.map(({ href, label }) => {
26
+ const active = pathname === href
27
+ return (
28
+ <Link
29
+ key={href}
30
+ href={href}
31
+ className={[
32
+ 'relative px-4 py-2 text-sm font-medium transition-colors',
33
+ active ? 'text-white' : 'text-zinc-500 hover:text-zinc-300',
34
+ ].join(' ')}
35
+ >
36
+ {label}
37
+ {active && (
38
+ <span className="absolute bottom-0 left-4 right-4 h-px bg-yellow-400" />
39
+ )}
40
+ </Link>
41
+ )
42
+ })}
43
+ </nav>
44
+
45
+ <div className="flex items-center gap-3 shrink-0">
46
+ <div className="hidden sm:flex items-center gap-1.5 px-3 py-1.5 rounded-full border border-zinc-800 bg-zinc-900/60 text-xs text-zinc-400 font-medium">
47
+ <span className="w-1.5 h-1.5 rounded-full bg-green-400 inline-block" />
48
+ Base
49
+ </div>
50
+ {process.env.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID && <ConnectButton />}
51
+ </div>
52
+
53
+ </div>
54
+ </header>
55
+ )
56
+ }
@@ -3,28 +3,27 @@
3
3
  "version": "0.1.0",
4
4
  "private": true,
5
5
  "scripts": {
6
- "dev": "next dev",
6
+ "dev": "next dev",
7
7
  "build": "next build",
8
8
  "start": "next start",
9
- "lint": "next lint"
9
+ "lint": "next lint"
10
10
  },
11
11
  "dependencies": {
12
- "@awarizon/react": "^1.6.1",
13
- "@awarizon/web3": "^1.3.4",
14
- "next": "14.2.5",
15
- "react": "^18",
16
- "react-dom": "^18"
12
+ "@awarizon/react": "^1.6.2",
13
+ "@awarizon/web3": "^1.3.5",
14
+ "next": "14.2.5",
15
+ "react": "^18",
16
+ "react-dom": "^18"
17
17
  },
18
18
  "devDependencies": {
19
- "@types/node": "^20",
20
- "@types/react": "^18",
21
- "@types/react-dom": "^18",
22
- "typescript": "^5",
23
- "eslint": "^8",
19
+ "@types/node": "^20",
20
+ "@types/react": "^18",
21
+ "@types/react-dom": "^18",
22
+ "typescript": "^5",
23
+ "eslint": "^8",
24
24
  "eslint-config-next": "14.2.5",
25
- "autoprefixer": "^10.4.19",
26
- "postcss": "^8.4.38",
27
- "tailwindcss": "^3.4.4"
25
+ "autoprefixer": "^10.4.19",
26
+ "postcss": "^8.4.38",
27
+ "tailwindcss": "^3.4.4"
28
28
  }
29
29
  }
30
-
@@ -1,4 +1,5 @@
1
1
  import { Providers } from '@/components/Providers'
2
+ import { Header } from '@/components/Header'
2
3
  import './globals.css'
3
4
 
4
5
  /** @type {import('next').Metadata} */
@@ -11,7 +12,10 @@ export default function RootLayout({ children }) {
11
12
  return (
12
13
  <html lang="en">
13
14
  <body>
14
- <Providers>{children}</Providers>
15
+ <Providers>
16
+ <Header />
17
+ {children}
18
+ </Providers>
15
19
  </body>
16
20
  </html>
17
21
  )
@@ -0,0 +1,139 @@
1
+ 'use client'
2
+
3
+ import { useState } from 'react'
4
+ import { useNFT } from '@awarizon/react'
5
+ import { Badge } from '@/components/ui/Badge'
6
+ import { Button } from '@/components/ui/Button'
7
+ import { Card } from '@/components/ui/Card'
8
+ import { Skeleton } from '@/components/ui/Skeleton'
9
+
10
+ // Replace with your ERC-721 contract address on your configured chain.
11
+ const NFT_ADDRESS = '0x0000000000000000000000000000000000000000'
12
+
13
+ function DataRow({ label, value, loading }) {
14
+ return (
15
+ <div className="flex items-center justify-between py-3 border-b border-zinc-800/50 last:border-0">
16
+ <code className="text-[11px] text-yellow-400/70 font-mono">{label}</code>
17
+ {loading
18
+ ? <Skeleton className="h-3.5 w-28" />
19
+ : <span className="font-mono text-xs text-zinc-300">{value ?? '—'}</span>}
20
+ </div>
21
+ )
22
+ }
23
+
24
+ export default function NftPage() {
25
+ const { name, symbol, isLoading, error, ownerOf, tokenURI } = useNFT(NFT_ADDRESS)
26
+
27
+ const [tokenId, setTokenId] = useState('')
28
+ const [owner, setOwner] = useState(null)
29
+ const [uri, setUri] = useState(null)
30
+ const [lookupLoading, setLookupLoading] = useState(false)
31
+ const [lookupError, setLookupError] = useState(null)
32
+
33
+ async function handleLookup() {
34
+ if (!tokenId) return
35
+ setLookupLoading(true)
36
+ setLookupError(null)
37
+ setOwner(null)
38
+ setUri(null)
39
+ try {
40
+ const id = BigInt(tokenId)
41
+ const [o, u] = await Promise.all([ownerOf(id), tokenURI(id)])
42
+ setOwner(o)
43
+ setUri(u)
44
+ } catch (e) {
45
+ setLookupError(e instanceof Error ? e.message : 'Lookup failed')
46
+ } finally {
47
+ setLookupLoading(false)
48
+ }
49
+ }
50
+
51
+ return (
52
+ <main className="max-w-4xl mx-auto px-6 py-12">
53
+
54
+ {/* ── Hero ───────────────────────────────────────── */}
55
+ <div className="mb-10">
56
+ <Badge variant="outline" className="mb-5">ERC-721</Badge>
57
+ <h1 className="text-4xl font-bold tracking-tight text-white mb-3">NFT Collection</h1>
58
+ <p className="text-zinc-400 text-base max-w-lg leading-relaxed">
59
+ Zero-ABI reads from any ERC-721 contract using{' '}
60
+ <code className="font-mono text-[11px] text-yellow-400/80">useNFT</code>.
61
+ Replace <code className="font-mono text-[11px] text-yellow-400/80">NFT_ADDRESS</code> at the top of this file.
62
+ </p>
63
+ </div>
64
+
65
+ {error && (
66
+ <div className="mb-4 px-4 py-3 bg-red-500/10 border border-red-500/20 rounded-xl">
67
+ <code className="font-mono text-xs text-red-400">{error.message}</code>
68
+ </div>
69
+ )}
70
+
71
+ {/* ── Cards ──────────────────────────────────────── */}
72
+ <div className="grid md:grid-cols-2 gap-4 mb-4">
73
+
74
+ <Card>
75
+ <div className="mb-4">
76
+ <p className="font-mono text-[9px] tracking-widest text-zinc-600 uppercase mb-1.5">Collection Info</p>
77
+ <code className="font-mono text-xs text-zinc-500">
78
+ {NFT_ADDRESS.slice(0, 6)}…{NFT_ADDRESS.slice(-4)}
79
+ </code>
80
+ </div>
81
+ <DataRow label="name()" value={name ?? undefined} loading={isLoading} />
82
+ <DataRow label="symbol()" value={symbol ?? undefined} loading={isLoading} />
83
+ </Card>
84
+
85
+ <Card>
86
+ <p className="font-mono text-[9px] tracking-widest text-zinc-600 uppercase mb-4">Token Lookup</p>
87
+ <div className="flex gap-2 mb-4">
88
+ <input
89
+ type="number"
90
+ min="0"
91
+ value={tokenId}
92
+ onChange={e => setTokenId(e.target.value)}
93
+ placeholder="Token ID"
94
+ className="flex-1 bg-zinc-800 border border-zinc-700 rounded-lg px-3 py-2 font-mono text-xs text-zinc-200 placeholder-zinc-600 outline-none focus:border-yellow-400/40"
95
+ />
96
+ <Button onClick={handleLookup} disabled={!tokenId || lookupLoading}>
97
+ {lookupLoading ? 'Loading…' : 'Look up'}
98
+ </Button>
99
+ </div>
100
+ {lookupError && (
101
+ <p className="font-mono text-[11px] text-red-400 mb-3">{lookupError}</p>
102
+ )}
103
+ {owner !== null && (
104
+ <DataRow
105
+ label="ownerOf()"
106
+ value={`${owner.slice(0, 6)}…${owner.slice(-4)}`}
107
+ loading={false}
108
+ />
109
+ )}
110
+ {uri !== null && (
111
+ <div className="pt-3">
112
+ <p className="font-mono text-[9px] tracking-widest text-zinc-600 uppercase mb-1.5">tokenURI()</p>
113
+ <p className="font-mono text-xs text-zinc-300 break-all">{uri}</p>
114
+ </div>
115
+ )}
116
+ </Card>
117
+ </div>
118
+
119
+ {/* ── Notes ──────────────────────────────────────── */}
120
+ <Card>
121
+ <p className="font-mono text-[9px] tracking-widest text-zinc-600 uppercase mb-4">Usage Notes</p>
122
+ <ul className="space-y-3">
123
+ {[
124
+ ['01', 'Replace NFT_ADDRESS with any ERC-721 contract on your configured chain'],
125
+ ['02', 'useNFT requires no ABI — the SDK uses the built-in ERC-721 interface'],
126
+ ['03', 'ownerOf(tokenId) returns the owner address of a specific token'],
127
+ ['04', 'tokenURI(tokenId) returns the metadata URI (IPFS, Arweave, HTTP, etc.)'],
128
+ ['05', 'balanceOf(address) counts how many tokens a given address holds'],
129
+ ].map(([n, s]) => (
130
+ <li key={n} className="flex items-start gap-3">
131
+ <span className="font-mono text-[10px] text-yellow-400/50 mt-0.5 shrink-0 select-none">{n}</span>
132
+ <span className="text-sm text-zinc-400 leading-relaxed">{s}</span>
133
+ </li>
134
+ ))}
135
+ </ul>
136
+ </Card>
137
+ </main>
138
+ )
139
+ }