Skip to content

Commit 6a5f302

Browse files
feat: update API endpoints and add cancelOrder method
Co-authored-by: aider (o3-mini) <[email protected]>
1 parent c6b25a4 commit 6a5f302

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

packages/bridge-status-controller/src/intent-api.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

917
export 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

Comments
 (0)