Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function modifyParametersForPlayground(_parameters: BlueprintParameter[]) {
const parameters = [..._parameters];

// make chain query param required - its not required in open api spec - because it either has to be set in subdomain or as a query param
const chainIdParameter = parameters.find((p) => p.name === "chain");
const chainIdParameter = parameters.find((p) => p.name === "chain_id");
if (chainIdParameter) {
chainIdParameter.required = true;
}
Expand All @@ -122,6 +122,12 @@ function modifyParametersForPlayground(_parameters: BlueprintParameter[]) {
parameters.splice(clientIdParameterIndex, 1);
}

// remove the chain parameter if it is present
const chainParameterIndex = parameters.findIndex((p) => p.name === "chain");
if (chainParameterIndex !== -1) {
parameters.splice(chainParameterIndex, 1);
}

return parameters;
}

Expand Down Expand Up @@ -163,7 +169,7 @@ function BlueprintPlaygroundUI(props: {
values[param.name] = Math.floor(
(Date.now() - 3 * 30 * 24 * 60 * 60 * 1000) / 1000,
);
} else if (param.name === "chain") {
} else if (param.name === "chain_id") {
values[param.name] = [];
} else {
values[param.name] = "";
Expand Down Expand Up @@ -466,7 +472,7 @@ function ParameterSection(props: {
key={param.name}
className={cn(
"grid items-center",
param.name === "chain"
param.name === "chain_id"
? "grid-cols-1 lg:grid-cols-2"
: "grid-cols-2",
)}
Expand All @@ -485,14 +491,14 @@ function ParameterSection(props: {
)}
</div>
<div className="relative">
{param.name === "chain" ? (
{param.name === "chain_id" ? (
<MultiNetworkSelector
selectedBadgeClassName="bg-background"
selectedChainIds={
props.form.watch("chain") as number[]
props.form.watch("chain_id") as number[]
}
onChange={(chainIds) => {
props.form.setValue("chain", chainIds, {
props.form.setValue("chain_id", chainIds, {
shouldValidate: true,
shouldDirty: true,
});
Expand Down Expand Up @@ -821,6 +827,9 @@ function openAPIV3ParamToZodFormSchema(
function createParametersFormSchema(parameters: BlueprintParameter[]) {
const shape: z.ZodRawShape = {};
for (const param of parameters) {
if (param.deprecated) {
continue;
}
const paramSchema = openAPIV3ParamToZodFormSchema(
param.schema,
!!param.required,
Expand Down
2 changes: 1 addition & 1 deletion apps/playground-web/src/app/insight/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default function Page() {

function BlueprintSection(props: {
title: string;
blueprints: { name: string; link: string }[];
blueprints: { name: string; link: string; deprecated?: boolean }[];
}) {
return (
<div className="overflow-hidden rounded-lg border bg-card">
Expand Down
5 changes: 4 additions & 1 deletion apps/playground-web/src/app/insight/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import type { OpenAPIV3 } from "openapi-types";
export type BlueprintParameter = OpenAPIV3.ParameterObject;
export type BlueprintPathMetadata = OpenAPIV3.PathItemObject;

const THIRDWEB_INSIGHT_API_DOMAIN =
process.env.NEXT_PUBLIC_INSIGHT_URL || "insight.thirdweb.com";

export type BlueprintListItem = {
id: string;
name: string;
Expand Down Expand Up @@ -40,7 +43,7 @@ export async function fetchBlueprintSpec(params: {
blueprintId: string;
}) {
const res = await fetch(
`https://insight.thirdweb.com/v1/blueprints/${params.blueprintId}`,
`https://${THIRDWEB_INSIGHT_API_DOMAIN}/v1/blueprints/${params.blueprintId}`,
);

if (!res.ok) {
Expand Down
Loading