File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed
typescript/solver/solvers Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 11import z from "zod" ;
22import { chainNames } from "../../config/index.js" ;
3+ import { addressSchema } from "../../config/types.js" ;
34import type { IntentCreatedEventObject } from "../../typechain/eco/contracts/IntentSource.js" ;
45
56export const EcoMetadataSchema = z . object ( {
67 protocolName : z . string ( ) ,
78 intentSources : z . array (
89 z . object ( {
9- address : z . string ( ) ,
10+ address : addressSchema ,
1011 chainName : z . string ( ) . refine ( ( name ) => chainNames . includes ( name ) , {
1112 message : "Invalid chainName" ,
1213 } ) ,
1314 } ) ,
1415 ) ,
1516 adapters : z . array (
1617 z . object ( {
17- address : z . string ( ) ,
18+ address : addressSchema ,
1819 chainName : z . string ( ) . refine ( ( name ) => chainNames . includes ( name ) , {
1920 message : "Invalid chainName" ,
2021 } ) ,
Original file line number Diff line number Diff line change 11import type { BigNumber } from "ethers" ;
22import z from "zod" ;
33import { chainNames } from "../../config/index.js" ;
4+ import { addressSchema } from "../../config/types.js" ;
45import type { OpenEventObject } from "../../typechain/hyperlane7683/contracts/Hyperlane7683.js" ;
56
67export type ExtractStruct < T , K extends object > = T extends ( infer U & K ) [ ]
@@ -44,7 +45,7 @@ export const Hyperlane7683MetadataSchema = z.object({
4445 protocolName : z . string ( ) ,
4546 originSettlers : z . array (
4647 z . object ( {
47- address : z . string ( ) ,
48+ address : addressSchema ,
4849 chainName : z . string ( ) . refine ( ( name ) => chainNames . includes ( name ) , {
4950 message : "Invalid chainName" ,
5051 } ) ,
Original file line number Diff line number Diff line change 1+ import { isValidAddress } from "@hyperlane-xyz/utils" ;
2+ import z from "zod" ;
3+
4+ export const addressSchema = z . string ( ) . refine ( ( address ) => isValidAddress ( address ) , {
5+ message : "Invalid address" ,
6+ } ) ;
You can’t perform that action at this time.
0 commit comments