Skip to content

Commit 5d047da

Browse files
links
1 parent 96efe71 commit 5d047da

File tree

9 files changed

+33
-35
lines changed

9 files changed

+33
-35
lines changed

apps/playground-web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"next": "15.3.5",
2323
"next-themes": "^0.4.6",
2424
"nextjs-toploader": "^1.6.12",
25-
"openapi-types": "^12.1.3",
25+
"openapi-types": "12.1.3",
2626
"posthog-js": "1.256.1",
2727
"prettier": "3.6.2",
2828
"react": "19.1.0",

apps/portal/src/app/wallets/custom-auth/page.mdx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ You will be asked to enter the following values
6868

6969
<TabsContent value="http">
7070

71-
<OpenApiEndpoint path="/v1/auth/initiate" method="POST" />
71+
<OpenApiEndpoint path="/v1/auth/complete" method="POST" requestBodyOverride={{
72+
type: "jwt",
73+
payload: "<your-jwt>",
74+
}}/>
7275

7376
</TabsContent>
7477

apps/portal/src/app/wallets/get-users/page.mdx

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ From your backend, you can list all your users and fetch the details of any user
2020
<TabsList>
2121
<TabsTrigger value="single">Single User</TabsTrigger>
2222
<TabsTrigger value="all">All Users</TabsTrigger>
23-
<TabsTrigger value="create">Create User</TabsTrigger>
2423
</TabsList>
2524

2625
<TabsContent value="single">
@@ -82,31 +81,6 @@ Required headers:
8281

8382
</TabsContent>
8483

85-
<TabsContent value="create">
86-
87-
## Create User Wallet (Pregeneration)
88-
89-
Pregenerate a user wallet before authentication. This creates a wallet in advance that can be claimed later when the user authenticates.
90-
91-
### Use Cases
92-
93-
- Create wallets based on known email addresses or user IDs
94-
- Pre-fund wallets with tokens or NFTs before users claim them
95-
- Enable smoother onboarding experiences
96-
97-
### Authentication
98-
99-
Required headers:
100-
- `x-secret-key`: Your secret key for authentication
101-
- `x-ecosystem-id` (optional): Your ecosystem ID
102-
- `x-ecosystem-partner-id` (optional): Your ecosystem partner ID
103-
104-
### Example
105-
106-
<OpenApiEndpoint path="/v1/wallets/user" method="POST" />
107-
108-
</TabsContent>
109-
11084
</Tabs>
11185

11286
## SDK Integration

apps/portal/src/components/Document/APIEndpointMeta/ApiEndpoint.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
2+
import { ExternalLinkIcon } from "lucide-react";
23
import { cn } from "../../../lib/utils";
34
import { CodeBlock } from "../Code";
45
import { Details } from "../Details";
@@ -27,6 +28,7 @@ export type RequestExampleType = {
2728
export type ApiEndpointMeta = {
2829
title: string;
2930
description: React.ReactNode;
31+
referenceUrl: string;
3032
path: string;
3133
origin: string;
3234
method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
@@ -109,7 +111,7 @@ export function ApiEndpoint(props: { metadata: ApiEndpointMeta }) {
109111
return (
110112
<div>
111113
<div>
112-
<Heading anchorId="request" className="text-lg lg:text-lg" level={3}>
114+
<Heading anchorId={`request#${props.metadata.method.toLowerCase()}${props.metadata.path}`} className="text-lg lg:text-lg" level={3}>
113115
Request
114116
</Heading>
115117

@@ -118,6 +120,7 @@ export function ApiEndpoint(props: { metadata: ApiEndpointMeta }) {
118120
<DynamicRequestExample
119121
requestExamples={requestExamples}
120122
endpointUrl={props.metadata.path}
123+
referenceUrl={props.metadata.referenceUrl}
121124
method={props.metadata.method}
122125
pathParameters={request.pathParameters}
123126
headers={request.headers}
@@ -139,6 +142,7 @@ export function ApiEndpoint(props: { metadata: ApiEndpointMeta }) {
139142
label: example.label,
140143
}))}
141144
endpointUrl={props.metadata.path}
145+
referenceUrl={props.metadata.referenceUrl}
142146
method={props.metadata.method}
143147
/>
144148

@@ -177,7 +181,7 @@ export function ApiEndpoint(props: { metadata: ApiEndpointMeta }) {
177181
</div>
178182

179183
<div>
180-
<Heading anchorId="response" className="text-lg lg:text-lg" level={3}>
184+
<Heading anchorId={`response#${props.metadata.method.toLowerCase()}${props.metadata.path}`} className="text-lg lg:text-lg" level={3}>
181185
Response
182186
</Heading>
183187
<div className="overflow-hidden rounded-lg border">

apps/portal/src/components/Document/APIEndpointMeta/DynamicRequestExample.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ interface DynamicRequestExampleProps {
1717
bodyParameters?: APIParameter[];
1818
}>;
1919
endpointUrl: string;
20+
referenceUrl: string;
2021
method: string;
2122
pathParameters: APIParameter[];
2223
headers: APIParameter[];
@@ -77,6 +78,7 @@ function ParameterSection(props: {
7778
return (
7879
<div className="border-b last:border-b-0">
7980
<Details
81+
key={props.title}
8082
summary={
8183
<div className="flex items-center gap-3">
8284
<span className="text-sm font-medium">{props.title}</span>
@@ -154,6 +156,7 @@ export function DynamicRequestExample(props: DynamicRequestExampleProps) {
154156
exampleType: example.exampleType,
155157
}))}
156158
endpointUrl={props.endpointUrl}
159+
referenceUrl={props.referenceUrl}
157160
method={props.method}
158161
hasSeparateDropdowns={props.hasMultipleExamples}
159162
selectedExample={

apps/portal/src/components/Document/APIEndpointMeta/OpenApiEndpoint.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,12 +427,15 @@ function transformOpenApiToApiEndpointMeta(
427427
}
428428
}
429429

430+
const tag = operation.tags?.[0] || "";
431+
430432
return {
431433
title: operation.summary || `${method.toUpperCase()} ${path}`,
432434
description: operation.description || operation.summary || "",
433435
path,
434436
origin: baseUrl,
435437
method: method.toUpperCase() as "GET" | "POST" | "PUT" | "DELETE" | "PATCH",
438+
referenceUrl: generateReferenceUrl(tag, path, method),
436439
request: {
437440
pathParameters,
438441
headers,
@@ -479,7 +482,7 @@ async function OpenApiEndpointInner({
479482
requestBodyOverride,
480483
responseExampleOverride,
481484
);
482-
return <ApiEndpoint metadata={metadata} key={specUrl + path} />;
485+
return <ApiEndpoint metadata={metadata} key={specUrl + path + method} />;
483486
} catch (error) {
484487
return (
485488
<div className="rounded-lg border border-red-200 bg-red-50 p-4">
@@ -491,3 +494,9 @@ async function OpenApiEndpointInner({
491494
);
492495
}
493496
}
497+
498+
const BASE_API_URL = "https://api.thirdweb.com";
499+
500+
function generateReferenceUrl(tag: string, path: string, method: string): string {
501+
return `${BASE_API_URL}/reference#tag/${tag.toLowerCase()}/${method.toLowerCase()}${path}`;
502+
}

apps/portal/src/components/Document/APIEndpointMeta/RequestExample.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
SelectTrigger,
1010
SelectValue,
1111
} from "@/components/ui/select";
12+
import { ExternalLinkIcon } from "lucide-react";
1213

1314
export function RequestExample(props: {
1415
codeExamples: Array<{
@@ -19,6 +20,7 @@ export function RequestExample(props: {
1920
}>;
2021
method: string;
2122
endpointUrl: string;
23+
referenceUrl: string;
2224
onExampleChange?: (label: string) => void;
2325
onFormatChange?: (format: "fetch" | "curl") => void;
2426
onExampleTypeChange?: (exampleType: string) => void;
@@ -77,7 +79,10 @@ export function RequestExample(props: {
7779
{props.method}
7880
</Badge>
7981
<span className="truncate font-mono text-sm">
80-
{props.endpointUrl}
82+
<a href={props.referenceUrl} target="_blank" rel="noopener noreferrer" className="flex items-center gap-2 hover:underline">
83+
{props.endpointUrl}
84+
<ExternalLinkIcon className="size-3" />
85+
</a>
8186
</span>
8287
</div>
8388
{props.hasSeparateDropdowns ? (

apps/portal/src/components/Document/Details.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ export function Details(props: {
2828
defaultOpen={props.startExpanded}
2929
trigger={
3030
<div className="flex gap-3">
31-
<p
31+
<span
3232
className={cn(
3333
"break-all font-bold text-foreground text-sm tracking-tight",
3434
"flex w-full gap-3 text-left font-semibold text-foreground group-hover:underline",
3535
props.headingClassName,
3636
)}
3737
>
3838
{props.summary}
39-
</p>
39+
</span>
4040
{props.tags && props.tags.length > 0 && (
4141
<div className="ml-auto flex items-center gap-2">
4242
{props.tags?.map((flag) => {

pnpm-lock.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)