Skip to content

Commit

Permalink
feat: [GSW-630] Change get token price api endpoint (#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
jinoosss authored Dec 7, 2023
1 parent fedb03f commit e8fb9f1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
23 changes: 14 additions & 9 deletions packages/web/src/hooks/token/use-token-data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,21 @@ export const useTokenData = () => {
}
return 0;
}).filter((_, index) => index < 3);
return sortedTokens.map(token => (
tokenPrices[token.priceId] ? {
token,
upDown: BigNumber(tokenPrices[token.priceId].change1d).isPositive() ? "up" : "down",
content: `${BigNumber(tokenPrices[token.priceId].change1d).toFixed()}%`
} : {
return sortedTokens.map(token => {
const tokenPrice = tokenPrices[token.priceId];
if (!tokenPrice || BigNumber(tokenPrice.change1d).isNaN()) {
return {
token,
upDown: "none",
content: "-"
};
}
return {
token,
upDown: "none",
content: "-"
}));
upDown: BigNumber(tokenPrice.change1d).isPositive() ? "up" : "down",
content: `${BigNumber(tokenPrice.change1d).toFixed()}%`
};
});
}, [tokens, tokenPrices]);

const recentlyAddedTokens: CardListTokenInfo[] = useMemo(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class TokenRepositoryImpl implements TokenRepository {

public getTokenPrices = async (): Promise<TokenPriceListResponse> => {
const response = await this.networkClient.get<TokenPriceListResponse>({
url: "/tokenPrices",
url: "/token_prices",
});
return response.data;
};
Expand Down

0 comments on commit e8fb9f1

Please sign in to comment.