Skip to content

Commit cbbcf10

Browse files
committed
docs: comprehensive Getting Started guide in docs page, rename web to @arcnames/web
1 parent 521a5e9 commit cbbcf10

3 files changed

Lines changed: 58 additions & 16 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"lint": "npm run lint --workspaces --if-present",
1515
"test": "npm run test --workspaces --if-present",
1616
"dev:api": "npm run build -w @arcnames/sdk && npm run dev -w @arcnames/api",
17-
"dev:web": "npm run build -w @arcnames/sdk && npm run dev -w @arc/names-web",
17+
"dev:web": "npm run build -w @arcnames/sdk && npm run dev -w @arcnames/web",
1818
"build:sdk": "npm run build -w @arcnames/sdk",
1919
"build:contracts": "npm run build -w @arc/contracts"
2020
}

packages/web/app/docs/page.tsx

Lines changed: 56 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -129,28 +129,40 @@ export default function DocsPage() {
129129
</div>
130130
</section>
131131

132-
{/* ═══════ QUICK START ═══════ */}
132+
{/* ═══════ GETTING STARTED ═══════ */}
133133
<section id="quickstart" className="docs-section">
134-
<h2>Quick Start — 5 Minutes</h2>
135-
<h3>Install</h3>
136-
<CodeBlock lang="bash" code={`npm install @arcnames/sdk
137-
# For React hooks:
134+
<h2>Getting Started</h2>
135+
<p className="docs-lead">
136+
Integrate .arc name resolution into any dApp in under 5 minutes. Install from npm, instantiate, and resolve.
137+
</p>
138+
139+
<h3>Step 1 — Install</h3>
140+
<CodeBlock lang="bash" code={`# Core SDK (required)
141+
npm install @arcnames/sdk
142+
143+
# React hooks (optional, for React/Next.js apps)
138144
npm install @arcnames/sdk-react`} />
139145

140-
<h3 className="mt-lg">Pattern A: Resolve before sending USDC</h3>
141-
<p>The most common use case — convert a .arc name to an address before sending a transaction.</p>
146+
<h3 className="mt-lg">Step 2 — Instantiate</h3>
147+
<p>Create a single SDK instance. All read methods cache automatically.</p>
142148
<CodeBlock code={`import { ARCNames } from "@arcnames/sdk";
143149
144150
const ans = new ARCNames({
145151
rpcUrl: "https://rpc.testnet.arc.network",
146152
registryAddress: "0xf5e0E328119D16c75Fb4a001282a3a7b733EF6db",
147-
});
153+
cacheTimeout: 60000, // optional, default 60s
154+
});`} />
148155

149-
const address = await ans.resolve("david");
156+
<h3 className="mt-lg">Step 3 — Resolve</h3>
157+
<p>Convert any .arc name to an address instantly:</p>
158+
<CodeBlock code={`const address = await ans.resolve("david");
150159
if (!address) throw new Error("Name not found");
160+
161+
// Use the resolved address in any transaction
151162
await sendUSDC(address, amount);`} />
152163

153-
<h3 className="mt-lg">Pattern B: Show .arc name in your navbar (React)</h3>
164+
<h3 className="mt-lg">Pattern — Show .arc names in your UI (React)</h3>
165+
<p>Replace raw 0x addresses with readable names in navbars, profiles, and transaction lists.</p>
154166
<CodeBlock code={`import { useANSReverse } from "@arcnames/sdk-react";
155167
156168
function Navbar({ walletAddress }) {
@@ -166,7 +178,8 @@ function Navbar({ walletAddress }) {
166178
);
167179
}`} />
168180

169-
<h3 className="mt-lg">Pattern C: Address input with live resolution</h3>
181+
<h3 className="mt-lg">Pattern — Address input with live resolution</h3>
182+
<p>Let users type <code>alice.arc</code> instead of <code>0x...</code> in any send/receive form.</p>
170183
<CodeBlock code={`import { useANSResolve } from "@arcnames/sdk-react";
171184
172185
function RecipientInput({ onResolved }) {
@@ -181,21 +194,50 @@ function RecipientInput({ onResolved }) {
181194
182195
return (
183196
<div>
184-
<input value={input} onChange={(e) => setInput(e.target.value)} placeholder="0x... or name.arc" />
197+
<input
198+
value={input}
199+
onChange={(e) => setInput(e.target.value)}
200+
placeholder="0x... or name.arc"
201+
/>
185202
{isResolving && <span>Resolving...</span>}
186203
{arcName && address && <span>{arcName} → {address.slice(0, 10)}...</span>}
187204
{reason === "not_registered" && <span>Name not found</span>}
188205
</div>
189206
);
190207
}`} />
191208

192-
<h3 className="mt-lg">Pattern D: Batch resolve for CSV payouts</h3>
209+
<h3 className="mt-lg">Pattern — Batch resolve for payouts</h3>
210+
<p>Resolve hundreds of names in a single multicall. Perfect for payroll, airdrops, and treasury ops.</p>
193211
<CodeBlock code={`const recipients = ["alice", "bob", "charlie", "david"];
194212
const results = await ans.resolveMany(recipients);
195-
// [{ name: "alice.arc", address: "0x..." }, { name: "bob.arc", address: null }, ...]
196213
214+
// [{ name: "alice.arc", address: "0x..." }, { name: "bob.arc", address: null }, ...]
197215
const valid = results.filter((r) => r.address !== null);
198216
const failed = results.filter((r) => r.address === null);`} />
217+
218+
<h3 className="mt-lg">Pattern — Check availability before registering</h3>
219+
<p>Pre-flight check before showing a registration form.</p>
220+
<CodeBlock code={`const available = await ans.isAvailable("myname");
221+
if (available) {
222+
const price = await ans.quotePrice("myname", 1); // 1 year in USDC (6 decimals)
223+
console.log(\`Register for \${price} USDC\`);
224+
}`} />
225+
226+
<h3 className="mt-lg">Pattern — Register a name</h3>
227+
<p>Requires an ethers.js signer for on-chain transactions. Auto-detects commit-reveal mode.</p>
228+
<CodeBlock code={`import { BrowserProvider } from "ethers";
229+
230+
const provider = new BrowserProvider(window.ethereum);
231+
const signer = await provider.getSigner();
232+
233+
const ansWrite = new ARCNames({
234+
rpcUrl: "https://rpc.testnet.arc.network",
235+
registryAddress: "0xf5e0E328119D16c75Fb4a001282a3a7b733EF6db",
236+
signer,
237+
});
238+
239+
const txHash = await ansWrite.register("myname");
240+
console.log(\`Registered: https://testnet.arcscan.app/tx/\${txHash}\`);`} />
199241
</section>
200242

201243
{/* ═══════ SDK ═══════ */}

packages/web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@arc/names-web",
2+
"name": "@arcnames/web",
33
"version": "0.1.0",
44
"private": true,
55
"scripts": {

0 commit comments

Comments
 (0)