Early release. This is published in
@uzolabs/sdk 0.2.0 on npm and you can use it today. The API may change before 1.0, so pin the version.What you’ll build
A Next.js page that shows the testnet USDT contract’s verified name, read on the server, and a client component that reads the connected wallet’s balance.Prerequisites
- Node.js 20 or later.
- A Next.js project using the App Router:
npx create-next-app@latest. npm install @uzolabs/sdk viem wagmi @tanstack/react-query.
Server or client?
@uzolabs/sdk/chains, /contracts and /explorer don’t use browser or Node-only APIs, so they work on both sides.
Steps
1
Read on the server
A server component can be
async, so call the SDK directly:app/page.tsx
2
Add the wagmi providers
wagmi hooks need a client boundary. Save the config from Use with wagmi as Then wrap
app/wagmi.ts, then create the providers in a file marked "use client":app/providers.tsx
{children} with <Providers> in app/layout.tsx. The layout itself stays a server component.3
Read the wallet on the client
app/balance.tsx
Verify
Runnpm run dev and open the page. The heading shows the USDT contract’s name from BOTScan. After you connect a wallet on testnet, your tBOT balance appears below it.
Troubleshooting
Hydration mismatch on wallet data
Hydration mismatch on wallet data
The server never knows the wallet, so render wallet data only in client components, as above.
ExplorerError during build
ExplorerError during build
Server components that fetch run at build time unless they’re dynamic. If BOTScan is slow or down, the build fails with
ExplorerError. Catch it and render a fallback, or use export const dynamic = "force-dynamic".Secrets in client components
Secrets in client components
Anything in a
"use client" file is sent to the browser. Keep private keys and paid RPC URLs in server code, and never give them a NEXT_PUBLIC_ prefix.Next steps
Explorer module
What you can read from BOTScan.
Connect a wallet
Connect buttons and network switching.