Skip to content

Commit 483ce36

Browse files
committed
replace chain with chain_id in insight playground
1 parent 6cf92c6 commit 483ce36

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

apps/playground-web/src/app/insight/[blueprint_slug]/blueprint-playground.client.tsx

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ function modifyParametersForPlayground(_parameters: BlueprintParameter[]) {
109109
const parameters = [..._parameters];
110110

111111
// 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
112-
const chainIdParameter = parameters.find((p) => p.name === "chain");
112+
const chainIdParameter = parameters.find((p) => p.name === "chain_id");
113113
if (chainIdParameter) {
114114
chainIdParameter.required = true;
115115
}
@@ -122,6 +122,12 @@ function modifyParametersForPlayground(_parameters: BlueprintParameter[]) {
122122
parameters.splice(clientIdParameterIndex, 1);
123123
}
124124

125+
// remove the chain parameter if it is present
126+
const chainParameterIndex = parameters.findIndex((p) => p.name === "chain");
127+
if (chainParameterIndex !== -1) {
128+
parameters.splice(chainParameterIndex, 1);
129+
}
130+
125131
return parameters;
126132
}
127133

@@ -163,7 +169,7 @@ function BlueprintPlaygroundUI(props: {
163169
values[param.name] = Math.floor(
164170
(Date.now() - 3 * 30 * 24 * 60 * 60 * 1000) / 1000,
165171
);
166-
} else if (param.name === "chain") {
172+
} else if (param.name === "chain_id") {
167173
values[param.name] = [];
168174
} else {
169175
values[param.name] = "";
@@ -466,7 +472,7 @@ function ParameterSection(props: {
466472
key={param.name}
467473
className={cn(
468474
"grid items-center",
469-
param.name === "chain"
475+
param.name === "chain_id"
470476
? "grid-cols-1 lg:grid-cols-2"
471477
: "grid-cols-2",
472478
)}
@@ -485,14 +491,15 @@ function ParameterSection(props: {
485491
)}
486492
</div>
487493
<div className="relative">
488-
{param.name === "chain" ? (
494+
{param.name === "chain_id" ? (
489495
<MultiNetworkSelector
490496
selectedBadgeClassName="bg-background"
491497
selectedChainIds={
492-
props.form.watch("chain") as number[]
498+
props.form.watch("chain_id") as number[]
493499
}
494500
onChange={(chainIds) => {
495-
props.form.setValue("chain", chainIds, {
501+
console.log("chainIds", chainIds);
502+
props.form.setValue("chain_id", chainIds, {
496503
shouldValidate: true,
497504
shouldDirty: true,
498505
});
@@ -821,6 +828,9 @@ function openAPIV3ParamToZodFormSchema(
821828
function createParametersFormSchema(parameters: BlueprintParameter[]) {
822829
const shape: z.ZodRawShape = {};
823830
for (const param of parameters) {
831+
if (param.deprecated) {
832+
continue;
833+
}
824834
const paramSchema = openAPIV3ParamToZodFormSchema(
825835
param.schema,
826836
!!param.required,

apps/playground-web/src/app/insight/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default function Page() {
4141

4242
function BlueprintSection(props: {
4343
title: string;
44-
blueprints: { name: string; link: string }[];
44+
blueprints: { name: string; link: string; deprecated?: boolean }[];
4545
}) {
4646
return (
4747
<div className="overflow-hidden rounded-lg border bg-card">

0 commit comments

Comments
 (0)