Skip to content

Commit

Permalink
fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
bennycode committed Dec 5, 2023
1 parent e6a0f1c commit 2c7fc9d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
13 changes: 5 additions & 8 deletions src/client/RESTClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class RESTClient extends EventEmitter {
super();
this.logger = util.debuglog('coinbase-pro-node');

this.httpClient = axios.default.create({
this.httpClient = axios.create({
baseURL: baseURL,
timeout: 50_000,
});
Expand Down Expand Up @@ -105,13 +105,10 @@ export class RESTClient extends EventEmitter {
requestPath,
});

config.headers = {
...config.headers,
'CB-ACCESS-KEY': signedRequest.key,
'CB-ACCESS-PASSPHRASE': signedRequest.passphrase,
'CB-ACCESS-SIGN': signedRequest.signature,
'CB-ACCESS-TIMESTAMP': `${signedRequest.timestamp}`,
};
config.headers.set('CB-ACCESS-KEY', signedRequest.key)

Check failure on line 108 in src/client/RESTClient.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 18.x)

Insert `;`

Check failure on line 108 in src/client/RESTClient.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 18.x)

Insert `;`
config.headers.set('CB-ACCESS-PASSPHRASE', signedRequest.passphrase)

Check failure on line 109 in src/client/RESTClient.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 18.x)

Insert `;`

Check failure on line 109 in src/client/RESTClient.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 18.x)

Insert `;`
config.headers.set('CB-ACCESS-SIGN', signedRequest.signature)

Check failure on line 110 in src/client/RESTClient.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 18.x)

Insert `;`

Check failure on line 110 in src/client/RESTClient.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 18.x)

Insert `;`
config.headers.set('CB-ACCESS-TIMESTAMP', `${signedRequest.timestamp}`)

Check failure on line 111 in src/client/RESTClient.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 18.x)

Insert `;`

Check failure on line 111 in src/client/RESTClient.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 18.x)

Insert `;`

return config;
});
Expand Down
2 changes: 1 addition & 1 deletion src/exchange-rate/ExchangeRateAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class ExchangeRateAPI {
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-exchange-rates#get-exchange-rates
*/
async getExchangeRates(currency: string = 'USD'): Promise<ExchangeRate> {
const response = await axios.default.get<{
const response = await axios.get<{
data: ExchangeRate;
}>(`${this.baseURL}${ExchangeRateAPI.URL.V2_EXCHANGE_RATES}`, {params: {currency}});
return response.data.data;
Expand Down
4 changes: 3 additions & 1 deletion src/order/OrderAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ export class OrderAPI {
const resource = OrderAPI.URL.ORDERS;
const response = await this.apiClient.get<Order[]>(`${resource}`, {
params: query,
paramsSerializer: querystring.stringify,
paramsSerializer: (params) => {

Check failure on line 159 in src/order/OrderAPI.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 18.x)

Replace `(params)` with `params`

Check failure on line 159 in src/order/OrderAPI.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 18.x)

Replace `(params)` with `params`
return querystring.stringify(params);
},
});
return {
data: response.data,
Expand Down
2 changes: 1 addition & 1 deletion src/time/TimeAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class TimeAPI {
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-time
*/
async getTime(): Promise<TimeSkew> {
const response = await axios.default.get<TimeSkew>(`${this.baseURL}${TimeAPI.URL.TIME}`, {
const response = await axios.get<TimeSkew>(`${this.baseURL}${TimeAPI.URL.TIME}`, {
// This trick forces axios to set JSON headers
data: {},
});
Expand Down
4 changes: 3 additions & 1 deletion src/transfer/TransferAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ export class TransferAPI {
}
const response = await this.apiClient.get<TransferInformation[]>(resource, {
params,
paramsSerializer: querystring.stringify,
paramsSerializer: (params) => {

Check failure on line 75 in src/transfer/TransferAPI.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 18.x)

Replace `(params)` with `params`

Check failure on line 75 in src/transfer/TransferAPI.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 18.x)

Replace `(params)` with `params`
return querystring.stringify(params);
},
});

z.array(TransferInformationSchema).parse(response.data);
Expand Down

0 comments on commit 2c7fc9d

Please sign in to comment.