Skip to content

Commit

Permalink
add support for xoxno data API provider (#1437)
Browse files Browse the repository at this point in the history
  • Loading branch information
cfaur09 authored Jan 14, 2025
1 parent 9aa2e7b commit c38c4fa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/common/data-api/data-api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,18 @@ export class DataApiService {
}

try {
const [cexTokensRaw, xExchangeTokensRaw, hatomTokensRaw] = await Promise.all([
const [cexTokensRaw, xExchangeTokensRaw, hatomTokensRaw, xoxnoTokensRaw] = await Promise.all([
this.apiService.get(`${this.apiConfigService.getDataApiServiceUrl()}/v1/tokens/cex?fields=identifier`),
this.apiService.get(`${this.apiConfigService.getDataApiServiceUrl()}/v1/tokens/xexchange?fields=identifier`),
this.apiService.get(`${this.apiConfigService.getDataApiServiceUrl()}/v1/tokens/hatom?fields=identifier`),
this.apiService.get(`${this.apiConfigService.getDataApiServiceUrl()}/v1/tokens/xoxno?fields=identifier`),
]);

const cexTokens: DataApiToken[] = cexTokensRaw.data.map((token: any) => new DataApiToken({ identifier: token.identifier, market: 'cex' }));
const xExchangeTokens: DataApiToken[] = xExchangeTokensRaw.data.map((token: any) => new DataApiToken({ identifier: token.identifier, market: 'xexchange' }));
const hatomTokens: DataApiToken[] = hatomTokensRaw.data.map((token: any) => new DataApiToken({ identifier: token.identifier, market: 'hatom' }));

const tokens = [...cexTokens, ...xExchangeTokens, ...hatomTokens].toRecord<DataApiToken>(x => x.identifier);
const xoxnoTokens: DataApiToken[] = xoxnoTokensRaw.data.map((token: any) => new DataApiToken({ identifier: token.identifier, market: 'xoxno' }));
const tokens = [...cexTokens, ...xExchangeTokens, ...hatomTokens, ...xoxnoTokens].toRecord<DataApiToken>(x => x.identifier);
return tokens;
} catch (error) {
this.logger.error(`An unexpected error occurred while fetching tokens from Data API.`);
Expand Down
2 changes: 1 addition & 1 deletion src/common/data-api/entities/data-api.token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ export class DataApiToken {
}

identifier: string = '';
market: 'cex' | 'xexchange' | 'hatom' = 'cex';
market: 'cex' | 'xexchange' | 'hatom' | 'xoxno' = 'cex';
}

0 comments on commit c38c4fa

Please sign in to comment.