UNPKG

@hyperlane-xyz/registry

Version:

A collection of configs, artifacts, and schemas for Hyperlane

26 lines (25 loc) 961 B
import { ChainMetadataSchema } from '@hyperlane-xyz/sdk/metadata/chainMetadataTypes'; import { z } from 'zod'; import { WARP_ROUTE_ID_REGEX } from './consts.js'; export const ChainAddressesSchema = z.record(z.string()); /** * Schema for warp route filter parameters. * This serves as the single source of truth for both TypeScript types and validation. */ export const WarpRouteFilterSchema = z .object({ symbol: z.string().optional(), label: z.string().optional(), }) .strict(); export const UpdateChainSchema = z.object({ metadata: ChainMetadataSchema.optional(), addresses: ChainAddressesSchema.optional(), }); export const WarpRouteIdSchema = z .string() .regex(WARP_ROUTE_ID_REGEX, 'Must be in the format SYMBOL/label (e.g., ETH/ethereum-base, USDC.e/arbitrum-polygon)'); export const AddWarpRouteConfigOptionsSchema = z.union([ z.object({ symbol: z.string() }), z.object({ warpRouteId: WarpRouteIdSchema }), ]);