From ed3ecc705a70c094d761527cd04b6bdd69a34f96 Mon Sep 17 00:00:00 2001 From: ALPAC-4 <81249838+ALPAC-4@users.noreply.github.com> Date: Thu, 7 Nov 2024 17:09:59 +0900 Subject: [PATCH] update initia registry types package (#217) --- _packages/types/package.json | 2 +- _packages/types/src/types/Chain.ts | 17 ++++++--- _packages/types/src/zods/Chain.ts | 56 +++++++++++++----------------- 3 files changed, 38 insertions(+), 37 deletions(-) diff --git a/_packages/types/package.json b/_packages/types/package.json index 34193f3..5cb1e8b 100644 --- a/_packages/types/package.json +++ b/_packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@initia/initia-registry-types", - "version": "0.0.20", + "version": "0.0.21", "description": "The package provides TypeScript type definitions and Zod integration for initia-registry.", "types": "./dist/types/index.d.ts", "exports": { diff --git a/_packages/types/src/types/Chain.ts b/_packages/types/src/types/Chain.ts index 36b5943..e23efcd 100644 --- a/_packages/types/src/types/Chain.ts +++ b/_packages/types/src/types/Chain.ts @@ -59,7 +59,7 @@ export interface Chain { key_algos?: ("secp256k1" | "ethsecp256k1" | "ed25519" | "sr25519" | "bn254")[]; slip44?: number; alternative_slip44s?: number[]; - fees?: { + fees: { fee_tokens: FeeToken[]; }; staking?: { @@ -186,10 +186,10 @@ export interface Chain { seeds?: Peer[]; persistent_peers?: Peer[]; }; - apis?: { - rpc?: Endpoint[]; - rest?: Endpoint[]; - api?: Endpoint[]; + apis: { + rpc: SecureEndpoint[]; + rest: SecureEndpoint[]; + api?: SecureEndpoint[]; grpc?: Endpoint[]; wss?: Endpoint[]; "grpc-web"?: Endpoint[]; @@ -269,6 +269,13 @@ export interface Peer { address: string; provider?: string; } +export interface SecureEndpoint { + address: string; + provider?: string; + archive?: boolean; + authorizedUser?: string; + indexForSkip?: number; +} export interface Endpoint { address: string; provider?: string; diff --git a/_packages/types/src/zods/Chain.ts b/_packages/types/src/zods/Chain.ts index 5daf599..9f47e14 100644 --- a/_packages/types/src/zods/Chain.ts +++ b/_packages/types/src/zods/Chain.ts @@ -75,8 +75,7 @@ export const ChainSchema = z .strict() ), }) - .strict() - .optional(), + .strict(), staking: z .object({ staking_tokens: z.array( @@ -329,37 +328,33 @@ export const ChainSchema = z .optional(), apis: z .object({ - rpc: z - .array( - z - .object({ - address: z.string().url(), - provider: z.string().optional(), - archive: z.boolean().default(false), - authorizedUser: z.string().optional(), - indexForSkip: z.number().optional(), - }) - .strict() - ) - .optional(), - rest: z - .array( - z - .object({ - address: z.string().url(), - provider: z.string().optional(), - archive: z.boolean().default(false), - authorizedUser: z.string().optional(), - indexForSkip: z.number().optional(), - }) - .strict() - ) - .optional(), + rpc: z.array( + z + .object({ + address: z.string().url().regex(new RegExp("^https://.")), + provider: z.string().optional(), + archive: z.boolean().default(false), + authorizedUser: z.string().optional(), + indexForSkip: z.number().optional(), + }) + .strict() + ), + rest: z.array( + z + .object({ + address: z.string().url().regex(new RegExp("^https://.")), + provider: z.string().optional(), + archive: z.boolean().default(false), + authorizedUser: z.string().optional(), + indexForSkip: z.number().optional(), + }) + .strict() + ), api: z .array( z .object({ - address: z.string().url(), + address: z.string().url().regex(new RegExp("^https://.")), provider: z.string().optional(), archive: z.boolean().default(false), authorizedUser: z.string().optional(), @@ -421,8 +416,7 @@ export const ChainSchema = z ) .optional(), }) - .strict() - .optional(), + .strict(), explorers: z .array( z