@@ -4,6 +4,14 @@ export interface IntentSubmissionParams {
44 quote : any ;
55 signature : string ;
66 userAddress : string ;
7+ async cancelOrder ( orderUid : string , providerName : string , srcChainId : string ) : Promise < any > {
8+ const endpoint = `${ this . baseUrl } /cancelOrder?orderUid=${ orderUid } &providerName=${ encodeURIComponent ( providerName ) } &srcChainId=${ srcChainId } ` ;
9+ const response = ( await this . fetchFn ( endpoint , { method : 'GET' } ) ) as Response ;
10+ if ( ! response . ok ) {
11+ throw new Error ( `Failed to cancel order: ${ response . statusText } ` ) ;
12+ }
13+ return response . json ( ) ;
14+ }
715}
816
917export interface IntentApi {
@@ -20,7 +28,7 @@ export class IntentApiImpl implements IntentApi {
2028 }
2129
2230 async submitIntent ( params : IntentSubmissionParams ) : Promise < any > {
23- const endpoint = `${ this . baseUrl } /submitIntent ` ;
31+ const endpoint = `${ this . baseUrl } /submitOrder ` ;
2432 const response = ( await this . fetchFn ( endpoint , {
2533 method : 'POST' ,
2634 headers : { 'Content-Type' : 'application/json' } ,
@@ -33,7 +41,7 @@ export class IntentApiImpl implements IntentApi {
3341 }
3442
3543 async getOrderStatus ( orderUid : string , providerName : string , srcChainId : string ) : Promise < any > {
36- const endpoint = `${ this . baseUrl } /orderStatus ?orderUid=${ orderUid } &providerName=${ encodeURIComponent ( providerName ) } &srcChainId=${ srcChainId } ` ;
44+ const endpoint = `${ this . baseUrl } /getOrderStatus ?orderUid=${ orderUid } &providerName=${ encodeURIComponent ( providerName ) } &srcChainId=${ srcChainId } ` ;
3745 const response = ( await this . fetchFn ( endpoint , { method : 'GET' } ) ) as Response ;
3846 if ( ! response . ok ) {
3947 throw new Error ( `Failed to get order status: ${ response . statusText } ` ) ;
0 commit comments