From 1b8b44c597a858fd710fb90e72b9ff608e7a5a8b Mon Sep 17 00:00:00 2001 From: peepopoggers <72892531+peepopoggers@users.noreply.github.com> Date: Thu, 21 Jan 2021 22:21:02 +0000 Subject: [PATCH] Creation of sharedendpoints. Used for linear and inverse client --- src/shared-endpoints.ts | 58 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/shared-endpoints.ts diff --git a/src/shared-endpoints.ts b/src/shared-endpoints.ts new file mode 100644 index 0000000..ca18fca --- /dev/null +++ b/src/shared-endpoints.ts @@ -0,0 +1,58 @@ +//type Constructor = new (...args: any[]) => {}; +import { GenericAPIResponse } from './util/requestUtils'; +import RequestWrapper from './util/requestWrapper'; + +export class SharedEndpoints { + protected requestWrapper: RequestWrapper; // XXX Is there a way to say that Base has to provide this? + + + + //------------Wallet Data Endpoints------------> + + getWalletBalance(params: { + coin: string; + }): GenericAPIResponse { + return this.requestWrapper.get('v2/private/wallet/balance',params) + } + + getAssetExchangeRecords(params?: { + limit?: number; + from?: number; + direction?: string; + }): GenericAPIResponse { + return this.requestWrapper.get('v2/private/exchange-order/list', params); + } + + getWalletFundRecords(params?: { + start_date?: string; + end_date?: string; + currency?: string; + coin?: string; + wallet_fund_type?: string; + page?: number; + limit?: number; + }): GenericAPIResponse { + return this.requestWrapper.get('v2/private/wallet/fund/records', params); + } + + getWithdrawRecords(params: { + start_date?: string; + end_date?: string; + coin?: string; + status?: string; + page?: number; + limit?: number; + }): GenericAPIResponse { + return this.requestWrapper.get('v2/private/wallet/withdraw/list', params); + } + + //-------------API Data Endpoints--------------> + + getServerTime(): GenericAPIResponse { + return this.requestWrapper.get('v2/public/time'); + } + + getApiAnnouncements(): GenericAPIResponse { + return this.requestWrapper.get('v2/public/announcement'); + } +}