-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implements Ability to Annotate Offers on CSFloat
- Loading branch information
Showing
5 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import {SimpleHandler} from './main'; | ||
import {RequestType} from './types'; | ||
|
||
export interface AnnotateOfferRequest { | ||
assets_to_send: string[]; | ||
assets_to_receive: string[]; | ||
offer_id: string; | ||
} | ||
|
||
export interface AnnotateOfferResponse {} | ||
|
||
export const AnnotateOffer = new SimpleHandler<AnnotateOfferRequest, AnnotateOfferResponse>( | ||
RequestType.ANNOTATE_OFFER, | ||
async (req) => { | ||
const resp = await fetch(`https://csfloat.com/api/v1/trades/annotate-offer`, { | ||
credentials: 'include', | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify(req), | ||
}); | ||
|
||
if (resp.status !== 200) { | ||
throw new Error('invalid status'); | ||
} | ||
|
||
return resp.json() as Promise<AnnotateOfferResponse>; | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,5 @@ export enum RequestType { | |
FETCH_PENDING_TRADES, | ||
FETCH_SKIN_MODEL, | ||
FETCH_EXTENSION_FILE, | ||
ANNOTATE_OFFER, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters