Add token price in KRW#170
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR extends the token stats endpoint to include token prices in multiple currencies (USD and KRW), updating the interface and implementation to support handling an array of currencies.
- Updated the IStatsService interface to accept a "currencies" parameter and return an array of ExtendedTokenStats.
- Modified the implementation in StatsService.ts to perform price lookups for each specified currency.
- Adjusted TokenStatsController.ts to call the updated service method with the currencies ['usd', 'krw'].
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/services/StatsService.ts | Modified getTokenStatsExtended to accept currencies and return an array of ExtendedTokenStats, mapping over each currency to retrieve prices. |
| src/controllers/TokenStatsController.ts | Updated the endpoint to pass ['usd', 'krw'] ensuring token prices in both USD and KRW are fetched. |
| * @returns Token statistics including total supply and circulating supply. | ||
| */ | ||
| public async getTokenStatsExtended(network: NetworkType): Promise<ExtendedTokenStats> { | ||
| public async getTokenStatsExtended(network: NetworkType, currencies: string[]): Promise<ExtendedTokenStats[]> { |
There was a problem hiding this comment.
Update the documentation comment for getTokenStatsExtended to include details about the new 'currencies' parameter and the updated return type.
|
Visit the preview URL for this PR (updated for commit b7602bd): https://astar-token-api--pr170-feat-krw-price-y5vusjdv.web.app (expires Fri, 23 May 2025 07:33:48 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: f99fa4f4f8f3bb450e6e842f7e1c7783d6d896a3 |
There was a problem hiding this comment.
Pull Request Overview
This pull request extends the token stats endpoint to provide token information with prices in multiple currencies, including KRW.
- Modified the IStatsService interface and implementation to accept an array of currency codes and return a corresponding array of stats.
- Updated the TokenStatsController to pass both 'usd' and 'krw' when fetching token stats.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/services/StatsService.ts | Updated getTokenStatsExtended to accept multiple currencies and return an array of ExtendedTokenStats with corresponding prices and market caps. |
| src/controllers/TokenStatsController.ts | Revised the API call to supply both 'usd' and 'krw' as currency parameters. |
| * not in circulation from total token supply. | ||
| * @param network NetworkType (astar or shiden) to calculate token supply for. | ||
| * @returns Token statistics including total supply and circulating supply. | ||
| * @param currencies |
There was a problem hiding this comment.
Enhance the JSDoc comment for the 'currencies' parameter by specifying the expected currency codes and explaining that the function returns an array of statistics, one per currency.
Extended token stats endpoint to provide token info with prices in USD and KRW