Skip to content

Commit

Permalink
chore(): misc cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagosiebler committed Sep 26, 2024
1 parent 66acfa3 commit b319fd7
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 81 deletions.
16 changes: 1 addition & 15 deletions src/CBAdvancedTradeClient.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import { AxiosRequestConfig } from 'axios';

import { BaseRestClient } from './lib/BaseRestClient.js';
import {
REST_CLIENT_TYPE_ENUM,
RestClientOptions,
RestClientType,
} from './lib/requestUtils.js';
import { REST_CLIENT_TYPE_ENUM, RestClientType } from './lib/requestUtils.js';
import {
AllocateAdvTradePortfolioRequest,
CloseAdvTradePositionRequest,
Expand Down Expand Up @@ -59,14 +53,6 @@ import {
* https://docs.cdp.coinbase.com/advanced-trade/docs/api-overview/
*/
export class CBAdvancedTradeClient extends BaseRestClient {
constructor(
restClientOptions: RestClientOptions = {},
requestOptions: AxiosRequestConfig = {},
) {
super(restClientOptions, requestOptions);
return this;
}

getClientType(): RestClientType {
return REST_CLIENT_TYPE_ENUM.advancedTrade;
}
Expand Down
16 changes: 1 addition & 15 deletions src/CBCommerceClient.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
import { AxiosRequestConfig } from 'axios';

import { BaseRestClient } from './lib/BaseRestClient.js';
import {
REST_CLIENT_TYPE_ENUM,
RestClientOptions,
RestClientType,
} from './lib/requestUtils.js';
import { REST_CLIENT_TYPE_ENUM, RestClientType } from './lib/requestUtils.js';

/**
* REST client for Coinbase Prime API:
* https://docs.cdp.coinbase.com/commerce-onchain/docs/welcome
*/
export class CBCommerceClient extends BaseRestClient {
constructor(
restClientOptions: RestClientOptions = {},
requestOptions: AxiosRequestConfig = {},
) {
super(restClientOptions, requestOptions);
return this;
}

getClientType(): RestClientType {
return REST_CLIENT_TYPE_ENUM.commerce;
}
Expand Down
16 changes: 1 addition & 15 deletions src/CBExchangeClient.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import { AxiosRequestConfig } from 'axios';

import { BaseRestClient } from './lib/BaseRestClient.js';
import {
REST_CLIENT_TYPE_ENUM,
RestClientOptions,
RestClientType,
} from './lib/requestUtils.js';
import { REST_CLIENT_TYPE_ENUM, RestClientType } from './lib/requestUtils.js';
import {
CancelCBExchOrderRequest,
CBExchDepositFromCoinbaseAccount,
Expand Down Expand Up @@ -43,14 +37,6 @@ import {
* https://docs.cdp.coinbase.com/exchange/docs/welcome
*/
export class CBExchangeClient extends BaseRestClient {
constructor(
restClientOptions: RestClientOptions = {},
requestOptions: AxiosRequestConfig = {},
) {
super(restClientOptions, requestOptions);
return this;
}

getClientType(): RestClientType {
return REST_CLIENT_TYPE_ENUM.exchange;
}
Expand Down
16 changes: 1 addition & 15 deletions src/CBInternationalClient.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import { AxiosRequestConfig } from 'axios';

import { BaseRestClient } from './lib/BaseRestClient.js';
import {
REST_CLIENT_TYPE_ENUM,
RestClientOptions,
RestClientType,
} from './lib/requestUtils.js';
import { REST_CLIENT_TYPE_ENUM, RestClientType } from './lib/requestUtils.js';
import {
CancelINTXOrdersRequest,
GetINTXAggregatedCandlesData,
Expand All @@ -28,14 +22,6 @@ import {
* https://docs.cdp.coinbase.com/intx/docs/welcome
*/
export class CBInternationalClient extends BaseRestClient {
constructor(
restClientOptions: RestClientOptions = {},
requestOptions: AxiosRequestConfig = {},
) {
super(restClientOptions, requestOptions);
return this;
}

getClientType(): RestClientType {
return REST_CLIENT_TYPE_ENUM.international;
}
Expand Down
16 changes: 1 addition & 15 deletions src/CBPrimeClient.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import { AxiosRequestConfig } from 'axios';

import { BaseRestClient } from './lib/BaseRestClient.js';
import {
REST_CLIENT_TYPE_ENUM,
RestClientOptions,
RestClientType,
} from './lib/requestUtils.js';
import { REST_CLIENT_TYPE_ENUM, RestClientType } from './lib/requestUtils.js';
import {
CreatePrimeAddressBookEntryRequest,
CreatePrimeConversionRequest,
Expand Down Expand Up @@ -38,14 +32,6 @@ import {
* https://docs.cdp.coinbase.com/prime/docs/welcome
*/
export class CBPrimeClient extends BaseRestClient {
constructor(
restClientOptions: RestClientOptions = {},
requestOptions: AxiosRequestConfig = {},
) {
super(restClientOptions, requestOptions);
return this;
}

getClientType(): RestClientType {
return REST_CLIENT_TYPE_ENUM.prime;
}
Expand Down
7 changes: 2 additions & 5 deletions src/WebsocketClient.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import { CBAdvancedTradeClient } from './CBAdvancedTradeClient.js';
import { BaseWebsocketClient, EmittableEvent } from './lib/BaseWSClient.js';
import { signWSJWT } from './lib/jwtNode.js';
import { neverGuard } from './lib/misc-util.js';
import { signMessage } from './lib/webCryptoAPI.js';
import {
isCBAdvancedTradeErrorEvent,
isCBAdvancedTradeWSEvent,
Expand All @@ -17,7 +14,6 @@ import {
getCBInternationalWSSign,
getCBPrimeWSSign,
getMergedCBExchangeWSRequestOperations,
getMergedCBINTXRequestOperations,
MessageEventLike,
WS_KEY_MAP,
WS_URL_MAP,
Expand Down Expand Up @@ -411,6 +407,7 @@ export class WebsocketClient extends BaseWebsocketClient<WsKey> {
case WS_KEY_MAP.advTradeUserData:
// Technically, INTX supports request batching but not with nested parameters, so we'll send one at a time
case WS_KEY_MAP.internationalMarketData:
case WS_KEY_MAP.primeMarketData:
return 1;
// Exchange supports request batching, no known limit to max topics per request
case WS_KEY_MAP.exchangeDirectMarketData:
Expand Down Expand Up @@ -655,7 +652,7 @@ export class WebsocketClient extends BaseWebsocketClient<WsKey> {
);
}

// We're over the max topics per request limit. Break into batches.
// INTX supports batching, but only if all channels use the same product_ids. Easier to just avoid batching for now....
const finalOperations: string[] = [];
for (const operationEvent of operationEvents) {
if (!apiKey || !apiSecret || !apiPassphrase) {
Expand Down
1 change: 0 additions & 1 deletion src/types/websockets/requests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
export type WsOperation = 'subscribe' | 'unsubscribe';

/**
Expand Down

0 comments on commit b319fd7

Please sign in to comment.