Skip to content

Commit

Permalink
Merge pull request #25 from tiagosiebler/tsnextheaders
Browse files Browse the repository at this point in the history
feat(): add hmac auth and configure auth per client type
  • Loading branch information
tiagosiebler authored Sep 17, 2024
2 parents 72bf308 + 82e1cda commit c75df90
Show file tree
Hide file tree
Showing 9 changed files with 266 additions and 69 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ dist

coverage
ts-adv-trade-test-private.ts
examples/ts-app-priv.ts
examples/ts-commerce.ts
4 changes: 2 additions & 2 deletions examples/advanced-private-rest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { CBAdvancedTradeClient } from '../src/index.js';
async function main() {
const client = new CBAdvancedTradeClient({
// cdpApiKey: credsTradePermission,
apiKeyName: '',
apiPrivateKey: '',
apiKey: '',
apiSecret: '',
});

try {
Expand Down
4 changes: 2 additions & 2 deletions examples/cb-app-private.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { CBAppClient } from '../src/index.js';
async function main() {
const client = new CBAppClient({
// cdpApiKey: credsTradePermission,
apiKeyName: '',
apiPrivateKey: '',
apiKey: '',
apiSecret: '',
});

const res = await client.getAccounts();
Expand Down
2 changes: 1 addition & 1 deletion examples/coinbase-international-client-rest.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CBInternationalClient } from '../src/index.js';

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

async function main() {
try {
Expand Down
8 changes: 4 additions & 4 deletions src/WebsocketClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ export class WebsocketClient extends BaseWebsocketClient<WsKey> {
}

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

this.RESTClientCache[clientType] = new CBAdvancedTradeClient({
apiKeyName: this.options.apiKey,
apiPrivateKey: this.options.apiSecret,
apiKey: this.options.apiKey,
apiSecret: this.options.apiSecret,
});
return this.RESTClientCache[clientType];
throw new Error(`Unhandled WsKey: "${wsKey}"`);
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export * from './CBAdvancedTradeClient.js';
export * from './CBAppClient.js';
export * from './CBCommerceClient.js';
export * from './CBExchangeClient.js';
export * from './CBInternationalClient.js';
export * from './CBPrimeClient.js';
Expand Down
Loading

0 comments on commit c75df90

Please sign in to comment.