From 2fb2b7cc400f7a66e87ffedd5eec91ad3670564e Mon Sep 17 00:00:00 2001 From: Thijmen Maus Date: Tue, 12 Sep 2023 11:25:43 +0200 Subject: [PATCH] make method generic and add mapping --- src/rest-client-v5.ts | 6 +++--- src/types/response/v5-market.ts | 14 ++++++++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/rest-client-v5.ts b/src/rest-client-v5.ts index 9653caa..14f12c7 100644 --- a/src/rest-client-v5.ts +++ b/src/rest-client-v5.ts @@ -231,9 +231,9 @@ export class RestClientV5 extends BaseRestClient { * * Note: Spot does not support pagination, so limit & cursor are invalid. */ - getInstrumentsInfo( - params: GetInstrumentsInfoParamsV5, - ): Promise> { + getInstrumentsInfo( + params: GetInstrumentsInfoParamsV5 & { category: C }, + ): Promise>> { return this.get('/v5/market/instruments-info', params); } diff --git a/src/types/response/v5-market.ts b/src/types/response/v5-market.ts index d65a1f7..217dae8 100644 --- a/src/types/response/v5-market.ts +++ b/src/types/response/v5-market.ts @@ -1,6 +1,8 @@ import { CategoryCursorListV5, + CategoryV5, ContractTypeV5, + CursorListV5, InstrumentStatusV5, OptionTypeV5, OrderSideV5, @@ -110,10 +112,14 @@ export interface SpotInstrumentInfoV5 { }; } -export type InstrumentInfoResponseV5 = - | CategoryCursorListV5 - | CategoryCursorListV5 - | CategoryCursorListV5; +type InstrumentInfoV5Mapping = { + linear: LinearInverseInstrumentInfoV5[], + inverse: LinearInverseInstrumentInfoV5[], + option: OptionInstrumentInfoV5[], + spot: SpotInstrumentInfoV5[] +}; + +export type InstrumentInfoResponseV5 = CategoryCursorListV5; export default interface OrderbookLevelV5 { price: string;