diff --git a/.changeset/light-coins-walk.md b/.changeset/light-coins-walk.md new file mode 100644 index 000000000..b9dfd77c5 --- /dev/null +++ b/.changeset/light-coins-walk.md @@ -0,0 +1,5 @@ +--- +'@hyperlane-xyz/sdk': patch +--- + +Add optional grpcUrl field to ChainMetadata diff --git a/typescript/sdk/src/consts/chainMetadata.ts b/typescript/sdk/src/consts/chainMetadata.ts index b76a673a5..00df3f733 100644 --- a/typescript/sdk/src/consts/chainMetadata.ts +++ b/typescript/sdk/src/consts/chainMetadata.ts @@ -601,6 +601,7 @@ export const neutron: ChainMetadata = { chainId: 'neutron-1', displayName: 'Neutron', domainId: 1853125230, + grpcUrls: [{ http: 'grpc-kralum.neutron-1.neutron.org:80' }], isTestnet: false, name: Chains.neutron, nativeToken: { @@ -609,7 +610,7 @@ export const neutron: ChainMetadata = { symbol: 'NTRN', }, protocol: ProtocolType.Cosmos, - restUrls: [{ http: 'grpc-kralum.neutron-1.neutron.org:80' }], + restUrls: [{ http: 'https://rest-lb.neutron.org' }], rpcUrls: [{ http: 'https://rpc-kralum.neutron-1.neutron.org' }], slip44: 118, }; diff --git a/typescript/sdk/src/metadata/chainMetadata.test.ts b/typescript/sdk/src/metadata/chainMetadata.test.ts index 347f3400c..ed0c403fd 100644 --- a/typescript/sdk/src/metadata/chainMetadata.test.ts +++ b/typescript/sdk/src/metadata/chainMetadata.test.ts @@ -60,6 +60,8 @@ describe('ChainMetadataSchema', () => { chainId: 'cosmos', bech32Prefix: 'cosmos', slip44: 118, + restUrls: [], + grpcUrls: [], }), ).to.eq(true); }); diff --git a/typescript/sdk/src/metadata/chainMetadataTypes.ts b/typescript/sdk/src/metadata/chainMetadataTypes.ts index 240174fb0..d8ee61642 100644 --- a/typescript/sdk/src/metadata/chainMetadataTypes.ts +++ b/typescript/sdk/src/metadata/chainMetadataTypes.ts @@ -111,6 +111,10 @@ export const ChainMetadataSchemaObject = z.object({ .array(RpcUrlSchema) .describe('For cosmos chains only, a list of Rest API URLs') .optional(), + grpcUrls: z + .array(RpcUrlSchema) + .describe('For cosmos chains only, a list of gRPC API URLs') + .optional(), blockExplorers: z .array( z.object({ @@ -216,6 +220,20 @@ export const ChainMetadataSchema = ChainMetadataSchemaObject.refine( message: 'Bech32Prefix and Slip44 required for Cosmos chains', path: ['bech32Prefix', 'slip44'], }, + ) + .refine( + (metadata) => { + if ( + metadata.protocol === ProtocolType.Cosmos && + (!metadata.restUrls || !metadata.grpcUrls) + ) + return false; + else return true; + }, + { + message: 'Rest and gRPC URLs required for Cosmos chains', + path: ['restUrls', 'grpcUrls'], + }, ); export type ChainMetadata = z.infer &