@@ -6,20 +6,15 @@ import {
66 WarpRouteDeployConfig ,
77} from '@hyperlane-xyz/sdk' ;
88import {
9+ AddWarpRouteConfigOptions ,
910 ChainAddresses ,
1011 MaybePromise ,
1112 UpdateChainParams ,
1213 WarpDeployConfigMap ,
1314 WarpRouteConfigMap ,
1415 WarpRouteFilterParams ,
1516} from '../types.js' ;
16- import {
17- IRegistry ,
18- RegistryContent ,
19- RegistryType ,
20- AddWarpRouteConfigOptions ,
21- IRegistryMethods ,
22- } from './IRegistry.js' ;
17+ import { IRegistry , IRegistryMethods , RegistryContent , RegistryType } from './IRegistry.js' ;
2318
2419export class HttpError extends Error {
2520 public status : number ;
@@ -43,10 +38,6 @@ export class HttpClientRegistry implements IRegistry {
4338 'getChainLogoUri' ,
4439 'addChain' ,
4540 'removeChain' ,
46- 'addWarpRoute' ,
47- 'getWarpDeployConfig' ,
48- 'getWarpDeployConfigs' ,
49- 'addWarpRouteConfig' ,
5041 'merge' ,
5142 ] ) ;
5243
@@ -137,23 +128,36 @@ export class HttpClientRegistry implements IRegistry {
137128 return this . fetchJson < WarpRouteConfigMap > ( `/warp-route/core?${ queryParams . toString ( ) } ` ) ;
138129 }
139130
140- addWarpRoute ( _config : WarpCoreConfig ) : MaybePromise < void > {
141- throw new Error ( 'Method not implemented.' ) ;
131+ async addWarpRoute ( config : WarpCoreConfig , options ?: AddWarpRouteConfigOptions ) : Promise < void > {
132+ await this . fetchJson < void > ( '/warp-route' , {
133+ method : 'POST' ,
134+ body : JSON . stringify ( { config, options } ) ,
135+ } ) ;
142136 }
143137
144138 getWarpDeployConfig ( routeId : string ) : MaybePromise < WarpRouteDeployConfig | null > {
145139 return this . fetchJson < WarpRouteDeployConfig | null > ( `/warp-route/deploy/${ routeId } ` ) ;
146140 }
147141
148- getWarpDeployConfigs ( ) : MaybePromise < WarpDeployConfigMap > {
149- throw new Error ( 'Method not implemented.' ) ;
142+ getWarpDeployConfigs ( filter ?: WarpRouteFilterParams ) : MaybePromise < WarpDeployConfigMap > {
143+ const queryParams = new URLSearchParams ( ) ;
144+ if ( filter ?. symbol ) {
145+ queryParams . set ( 'symbol' , filter . symbol ) ;
146+ }
147+ if ( filter ?. label ) {
148+ queryParams . set ( 'label' , filter . label ) ;
149+ }
150+ return this . fetchJson < WarpDeployConfigMap > ( `/warp-route/deploy?${ queryParams . toString ( ) } ` ) ;
150151 }
151152
152- addWarpRouteConfig (
153- _config : WarpRouteDeployConfig ,
154- _options : AddWarpRouteConfigOptions ,
155- ) : MaybePromise < void > {
156- throw new Error ( 'Method not implemented.' ) ;
153+ async addWarpRouteConfig (
154+ config : WarpRouteDeployConfig ,
155+ options : AddWarpRouteConfigOptions ,
156+ ) : Promise < void > {
157+ await this . fetchJson < void > ( '/warp-route/deploy' , {
158+ method : 'POST' ,
159+ body : JSON . stringify ( { config, options } ) ,
160+ } ) ;
157161 }
158162
159163 merge ( _otherRegistry : IRegistry ) : IRegistry {
0 commit comments