Skip to content

Commit

Permalink
feat: add the cancelOffer method
Browse files Browse the repository at this point in the history
  • Loading branch information
vansergen committed Feb 15, 2021
1 parent fa74649 commit ffee052
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/auth1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ export interface NewOfferParams {
direction: "lend" | "loan";
}

export interface CancelOfferParams {
offer_id: number;
}

export interface ClaimParams {
position_id: number;
amount?: string;
Expand Down Expand Up @@ -327,7 +331,7 @@ export interface Offer {
original_amount: string;
remaining_amount: string;
executed_amount: string;
offer_id: number;
offer_id?: number;
}

export interface AuthenticatedClient1Options extends PublicClient1Params {
Expand Down Expand Up @@ -615,6 +619,13 @@ export class AuthenticatedClient1 extends PublicClient1 {
return offer;
}

/** Cancel an offer. */
public async cancelOffer(body: CancelOfferParams): Promise<Offer> {
const request = "/v1/offer/cancel";
const offer = (await this.post(request, {}, { ...body })) as Offer;
return offer;
}

public set nonce(nonce: () => number) {
this.#nonce = nonce;
}
Expand Down

0 comments on commit ffee052

Please sign in to comment.