Skip to content

Commit 7d0a14c

Browse files
committed
Add Templates section with x402 and EncryptedERC starter kits
Added a new Templates section to the documentation with comprehensive guides for two Avalanche starter kits: 1. x402 Starter Kit - Next.js template for payment-gated APIs and content services using the x402 protocol on Avalanche C-Chain 2. EncryptedERC - Privacy-preserving ERC-20 token protocol with confidential transfers using zero-knowledge proofs Features: - New Templates tab in docs navigation bar - Templates landing page with overview - Detailed x402 Starter Kit guide with step-by-step setup - Complete EncryptedERC guide with ZK-proof implementation - Hamburger menu with quick links to both templates Files added: - content/docs/templates/index.mdx - content/docs/templates/meta.json - content/docs/templates/x402-starter-kit.mdx - content/docs/templates/encrypted-erc.mdx Files modified: - lib/source.ts - app/docs/layout.tsx - app/docs/docs-layout-wrapper.tsx - components/navigation/docs-subnav.tsx
1 parent 8905ee8 commit 7d0a14c

File tree

10 files changed

+1017
-11
lines changed

10 files changed

+1017
-11
lines changed

app/docs/docs-layout-wrapper.tsx

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { DocsSubNav } from '@/components/navigation/docs-subnav';
88
import { DocsNavbarToggle } from '@/components/navigation/docs-navbar-toggle';
99
import { ForceMobileSidebar } from '@/components/navigation/force-mobile-sidebar';
1010
import { NavbarDropdownInjector } from '@/components/navigation/navbar-dropdown-injector';
11-
import {
11+
import {
1212
BookOpen,
1313
Code,
1414
Layers,
@@ -22,7 +22,8 @@ import {
2222
CircleDollarSign,
2323
Terminal,
2424
Package,
25-
Milestone
25+
Milestone,
26+
LayoutTemplate
2627
} from 'lucide-react';
2728

2829
interface DocsLayoutWrapperProps {
@@ -32,6 +33,7 @@ interface DocsLayoutWrapperProps {
3233
rpcsTree: any;
3334
toolingTree: any;
3435
acpsTree: any;
36+
templatesTree: any;
3537
}
3638

3739
export function DocsLayoutWrapper({
@@ -41,6 +43,7 @@ export function DocsLayoutWrapper({
4143
rpcsTree,
4244
toolingTree,
4345
acpsTree,
46+
templatesTree,
4447
}: DocsLayoutWrapperProps) {
4548
const pathname = usePathname();
4649

@@ -61,6 +64,8 @@ export function DocsLayoutWrapper({
6164
document.body.setAttribute('data-docs-section', 'api-reference');
6265
} else if (pathname.startsWith('/docs/rpcs')) {
6366
document.body.setAttribute('data-docs-section', 'rpcs');
67+
} else if (pathname.startsWith('/docs/templates')) {
68+
document.body.setAttribute('data-docs-section', 'templates');
6469
} else if (pathname.startsWith('/docs')) {
6570
document.body.setAttribute('data-docs-section', 'documentation');
6671
}
@@ -228,6 +233,22 @@ export function DocsLayoutWrapper({
228233
},
229234
];
230235

236+
// Templates hamburger menu options
237+
const templatesOptions = [
238+
{
239+
title: 'x402 Starter Kit',
240+
description: 'Payment-gated APIs with micropayments',
241+
icon: <CircleDollarSign className="w-5 h-5" />,
242+
url: '/docs/templates/x402-starter-kit',
243+
},
244+
{
245+
title: 'EncryptedERC',
246+
description: 'Private transactions with zero-knowledge proofs',
247+
icon: <Code className="w-5 h-5" />,
248+
url: '/docs/templates/encrypted-erc',
249+
},
250+
];
251+
231252
// Determine which section we're in and get the appropriate tree
232253
let pageTree;
233254
let sidebarOptions: any = {};
@@ -247,6 +268,11 @@ export function DocsLayoutWrapper({
247268
sidebarOptions = {
248269
tabs: toolingOptions,
249270
};
271+
} else if (pathname.startsWith('/docs/templates')) {
272+
pageTree = templatesTree;
273+
sidebarOptions = {
274+
tabs: templatesOptions,
275+
};
250276
} else if (pathname.startsWith('/docs/acps')) {
251277
pageTree = acpsTree;
252278
// No hamburger menu for ACPs - explicitly disable tabs

app/docs/layout.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import type { ReactNode } from 'react';
22
import { baseOptions } from '@/app/layout.config';
3-
import {
3+
import {
44
getDocumentationTree,
55
getApiReferenceTree,
66
getRpcsTree,
77
getToolingTree,
8-
getAcpsTree
8+
getAcpsTree,
9+
getTemplatesTree
910
} from '@/lib/source';
1011
import { DocsLayoutWrapper } from './docs-layout-wrapper';
1112
import { LayoutWrapper } from '@/app/layout-wrapper.client';
@@ -19,6 +20,7 @@ export default function Layout({ children }: { children: ReactNode }) {
1920
const rpcsTree = getRpcsTree();
2021
const toolingTree = getToolingTree();
2122
const acpsTree = getAcpsTree();
23+
const templatesTree = getTemplatesTree();
2224

2325
return (
2426
<LayoutWrapper baseOptions={baseOptions}>
@@ -28,6 +30,7 @@ export default function Layout({ children }: { children: ReactNode }) {
2830
rpcsTree={rpcsTree}
2931
toolingTree={toolingTree}
3032
acpsTree={acpsTree}
33+
templatesTree={templatesTree}
3134
>
3235
{children}
3336
</DocsLayoutWrapper>

components/navigation/docs-subnav.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ const tabs = [
1414
!path.startsWith("/docs/api-reference") &&
1515
!path.startsWith("/docs/rpcs") &&
1616
!path.startsWith("/docs/tooling") &&
17-
!path.startsWith("/docs/acps")),
17+
!path.startsWith("/docs/acps") &&
18+
!path.startsWith("/docs/templates")),
1819
},
1920
{
2021
label: "Node RPCs",
@@ -31,6 +32,11 @@ const tabs = [
3132
href: "/docs/tooling/avalanche-sdk",
3233
pathMatch: (path: string) => path.startsWith("/docs/tooling"),
3334
},
35+
{
36+
label: "Templates",
37+
href: "/docs/templates",
38+
pathMatch: (path: string) => path.startsWith("/docs/templates"),
39+
},
3440
{
3541
label: "ACPs",
3642
href: "/docs/acps",

0 commit comments

Comments
 (0)