Skip to content

Commit c1993a6

Browse files
more fixes
1 parent a74e1a2 commit c1993a6

File tree

3 files changed

+65
-4
lines changed

3 files changed

+65
-4
lines changed

apps/portal/src/app/wallets/pregenerate-wallets/page.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Create wallets for users before they authenticate, enabling smoother onboarding
2424

2525
## API Reference
2626

27-
<OpenApiEndpoint path="/v1/wallets/user/pregenerate" method="POST" />
27+
<OpenApiEndpoint path="/v1/wallets/user" method="POST" />
2828

2929
<Callout variant='info' title='Ecosystem Requirements'>
3030
For ecosystem wallets, the secret key must be from the same account as the ecosystem owner.

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

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,20 @@ function createCurlCommand(params: { metadata: ApiEndpointMeta }) {
247247
url += `?${queryParams}`;
248248
}
249249

250-
const headers = params.metadata.request.headers
251-
.filter((h) => h.example !== undefined)
250+
const displayHeaders = params.metadata.request.headers.filter(
251+
(h) => h.example !== undefined,
252+
);
253+
254+
// always show secret key header in examples
255+
displayHeaders.push({
256+
name: "x-secret-key",
257+
example: "<your-project-secret-key>",
258+
description:
259+
"Project secret key - for backend usage only. Should not be used in frontend code.",
260+
required: false,
261+
});
262+
263+
const headers = displayHeaders
252264
.map((h) => {
253265
return `-H "${h.name}:${
254266
typeof h.example === "object" && h !== null
@@ -290,7 +302,28 @@ function createFetchCommand(params: { metadata: ApiEndpointMeta }) {
290302
url += `?${queryParams}`;
291303
}
292304

293-
for (const param of request.headers) {
305+
const displayHeaders = request.headers.filter((h) => h.example !== undefined);
306+
307+
// always show secret key header in examples
308+
if (params.metadata.path.includes("/v1/auth")) {
309+
displayHeaders.push({
310+
name: "x-client-id",
311+
example: "<your-project-client-id>",
312+
description:
313+
"Project client ID - for frontend usage on authorized domains.",
314+
required: false,
315+
});
316+
} else {
317+
displayHeaders.push({
318+
name: "x-secret-key",
319+
example: "<your-project-secret-key>",
320+
description:
321+
"Project secret key - for backend usage only. Should not be used in frontend code.",
322+
required: false,
323+
});
324+
}
325+
326+
for (const param of displayHeaders) {
294327
if (param.example !== undefined) {
295328
headersObj[param.name] = param.example;
296329
}

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,34 @@ function transformOpenApiToApiEndpointMeta(
309309
}
310310
}
311311

312+
// push default headers hardcoded for now
313+
headers.push({
314+
name: "x-secret-key",
315+
type: "backend",
316+
description:
317+
"Project secret key - for backend usage only. Should not be used in frontend code.",
318+
required: false,
319+
example: undefined,
320+
});
321+
headers.push({
322+
name: "x-client-id",
323+
type: "frontend",
324+
description:
325+
"Project client ID - for frontend usage on authorized domains.",
326+
required: false,
327+
example: undefined,
328+
});
329+
330+
if (method === "POST" && !path.includes("/v1/contracts/read")) {
331+
headers.push({
332+
name: "Authorization",
333+
type: "frontend",
334+
description: "Bearer token (JWT) for user wallet authentication",
335+
required: false,
336+
example: undefined,
337+
});
338+
}
339+
312340
// Transform request body parameters
313341
const bodyParameters: APIParameter[] = [];
314342

0 commit comments

Comments
 (0)