Skip to content

Commit

Permalink
fixed build
Browse files Browse the repository at this point in the history
  • Loading branch information
JJ-Cro committed Sep 13, 2024
1 parent 759ef0d commit 9b52a4b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
4 changes: 2 additions & 2 deletions examples/advanced-private-rest.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AdvancedTradeClient } from '../src/index.js';
import { CBAdvancedTradeClient } from '../src/index.js';

async function main() {
const client = new AdvancedTradeClient({
const client = new CBAdvancedTradeClient({
// cdpApiKey: credsTradePermission,
apiKeyName: '',
apiPrivateKey: '',
Expand Down
4 changes: 2 additions & 2 deletions examples/advanced-public-rest.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AdvancedTradeClient } from '../src/AdvancedTradeClient.js';
import { CBAdvancedTradeClient } from '../src/index.js';

const advancedTradeClient = new AdvancedTradeClient({});
const advancedTradeClient = new CBAdvancedTradeClient({});

async function main() {
try {
Expand Down
4 changes: 2 additions & 2 deletions examples/cb-app-private.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CoinbaseAppClient } from '../src/index.js';
import { CBAppClient } from '../src/index.js';

async function main() {
const client = new CoinbaseAppClient({
const client = new CBAppClient({
// cdpApiKey: credsTradePermission,
apiKeyName: '',
apiPrivateKey: '',
Expand Down
4 changes: 2 additions & 2 deletions examples/coinbase-international-client-rest.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CoinbaseInternational } from '../src/CoinbaseInternational.js';
import { CBInternationalClient } from '../src/index.js';

const coinbaseInternational = new CoinbaseInternational({});
const coinbaseInternational = new CBInternationalClient({});

async function main() {
try {
Expand Down
15 changes: 8 additions & 7 deletions src/WebsocketClient.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import { AdvancedTradeClient } from './CBAdvancedTradeClient.js';
import { CBAdvancedTradeClient } from './CBAdvancedTradeClient.js';
import { BaseWebsocketClient, EmittableEvent } from './lib/BaseWSClient.js';
import { neverGuard } from './lib/misc-util.js';
import {
Expand Down Expand Up @@ -44,18 +44,19 @@ export const PUBLIC_WS_KEYS: WsKey[] = [
type WsTopic = string;

export class WebsocketClient extends BaseWebsocketClient<WsKey> {
private RESTClientCache: Record<WsMarket, AdvancedTradeClient | undefined> = {
advancedTrade: undefined,
};
private RESTClientCache: Record<WsMarket, CBAdvancedTradeClient | undefined> =
{
advancedTrade: undefined,
};

private getRESTClient(wsKey: WsKey): AdvancedTradeClient {
private getRESTClient(wsKey: WsKey): CBAdvancedTradeClient {
if (wsKey === 'spotPublicV1' || wsKey === 'spotPrivateV1') {
const clientType = 'advancedTrade';
if (this.RESTClientCache[clientType]) {
return this.RESTClientCache[clientType];
}

this.RESTClientCache[clientType] = new AdvancedTradeClient({
this.RESTClientCache[clientType] = new CBAdvancedTradeClient({
apiKeyName: this.options.apiKey,
apiPrivateKey: this.options.apiSecret,
});
Expand All @@ -67,7 +68,7 @@ export class WebsocketClient extends BaseWebsocketClient<WsKey> {
return this.RESTClientCache[clientType];
}

this.RESTClientCache[clientType] = new AdvancedTradeClient({
this.RESTClientCache[clientType] = new CBAdvancedTradeClient({
apiKeyName: this.options.apiKey,
apiPrivateKey: this.options.apiSecret,
});
Expand Down

0 comments on commit 9b52a4b

Please sign in to comment.