Skip to content

Commit

Permalink
Fix types and overflow possibility
Browse files Browse the repository at this point in the history
  • Loading branch information
xbtmatt committed Dec 14, 2024
1 parent ac4e38f commit 052c4b0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/typescript/frontend/src/app/dexscreener/asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ export interface Asset {
id: string;
name: string;
symbol: string;
totalSupply: number;
circulatingSupply: number;
totalSupply: number | string;
circulatingSupply?: number | string;
coinGeckoId?: string;
coinMarketCapId?: string;
metadata?: Record<string, string>;
Expand All @@ -56,14 +56,14 @@ export interface AssetResponse {
* Fetches an asset by a string of the emojis that represent the asset
* @param assetId
*/
export async function getAsset(assetId: string): Asset {
export async function getAsset(assetId: string): Promise<Asset> {
const marketEmojiData = toMarketEmojiData(assetId);
const symbolEmojis = symbolEmojiStringToArray(assetId);
const marketState = await fetchMarketState({ searchEmojis: symbolEmojis });

const circulatingSupply: { circulatingSupply?: number } = {};
const circulatingSupply: { circulatingSupply?: number | string } = {};
if (marketState && marketState.state) {
circulatingSupply.circulatingSupply = calculateCirculatingSupply(marketState.state);
circulatingSupply.circulatingSupply = calculateCirculatingSupply(marketState.state).toString();
}

return {
Expand Down

0 comments on commit 052c4b0

Please sign in to comment.