@@ -4,6 +4,7 @@ import type { RouteGenericInterface } from "fastify";
44import type { FastifySchema } from "fastify/types/schema" ;
55import { StatusCodes } from "http-status-codes" ;
66import { AddressSchema } from "./address" ;
7+ import { chainIdOrSlugSchema } from "./chain" ;
78
89export const baseReplyErrorSchema = Type . Object ( {
910 message : Type . Optional ( Type . String ( ) ) ,
@@ -17,10 +18,7 @@ export const baseReplyErrorSchema = Type.Object({
1718 * Basic schema for Request Parameters
1819 */
1920export const contractParamSchema = Type . Object ( {
20- chain : Type . String ( {
21- examples : [ "80002" ] ,
22- description : "Chain ID or name" ,
23- } ) ,
21+ chain : chainIdOrSlugSchema ,
2422 contractAddress : {
2523 ...AddressSchema ,
2624 description : "Contract address" ,
@@ -37,21 +35,15 @@ export const requestQuerystringSchema = Type.Object({
3735} ) ;
3836
3937export const prebuiltDeployParamSchema = Type . Object ( {
40- chain : Type . String ( {
41- examples : [ "80002" ] ,
42- description : "Chain ID or name" ,
43- } ) ,
38+ chain : chainIdOrSlugSchema ,
4439 contractType : Type . String ( {
4540 examples : Object . keys ( PREBUILT_CONTRACTS_MAP ) ,
4641 description : "Contract type to deploy" ,
4742 } ) ,
4843} ) ;
4944
5045export const publishedDeployParamSchema = Type . Object ( {
51- chain : Type . String ( {
52- examples : [ "80002" ] ,
53- description : "Chain ID or name" ,
54- } ) ,
46+ chain : chainIdOrSlugSchema ,
5547 publisher : Type . String ( {
5648 examples : [ "deployer.thirdweb.eth" ] ,
5749 description : "Address or ENS of the publisher of the contract" ,
@@ -176,10 +168,7 @@ transactionWritesResponseSchema.example = {
176168 * Basic schema for ERC721 Contract Request Parameters
177169 */
178170export const erc20ContractParamSchema = Type . Object ( {
179- chain : Type . String ( {
180- examples : [ "80002" ] ,
181- description : "Chain ID or name" ,
182- } ) ,
171+ chain : chainIdOrSlugSchema ,
183172 contractAddress : {
184173 ...AddressSchema ,
185174 description : "ERC20 contract address" ,
@@ -190,10 +179,7 @@ export const erc20ContractParamSchema = Type.Object({
190179 * Basic schema for ERC721 Contract Request Parameters
191180 */
192181export const erc1155ContractParamSchema = Type . Object ( {
193- chain : Type . String ( {
194- examples : [ "80002" ] ,
195- description : "Chain ID or name" ,
196- } ) ,
182+ chain : chainIdOrSlugSchema ,
197183 contractAddress : {
198184 ...AddressSchema ,
199185 description : "ERC1155 contract address" ,
@@ -204,10 +190,7 @@ export const erc1155ContractParamSchema = Type.Object({
204190 * Basic schema for ERC721 Contract Request Parameters
205191 */
206192export const erc721ContractParamSchema = Type . Object ( {
207- chain : Type . String ( {
208- examples : [ "80002" ] ,
209- description : "Chain ID or name" ,
210- } ) ,
193+ chain : chainIdOrSlugSchema ,
211194 contractAddress : {
212195 ...AddressSchema ,
213196 description : "ERC721 contract address" ,
@@ -234,10 +217,7 @@ export enum Status {
234217}
235218
236219export const marketplaceV3ContractParamSchema = Type . Object ( {
237- chain : Type . String ( {
238- examples : [ "80002" ] ,
239- description : "Chain ID or name" ,
240- } ) ,
220+ chain : chainIdOrSlugSchema ,
241221 contractAddress : {
242222 ...AddressSchema ,
243223 description : "Contract address" ,
0 commit comments