Skip to content

Commit

Permalink
fix null data
Browse files Browse the repository at this point in the history
  • Loading branch information
xieqian committed Feb 5, 2024
1 parent 74071d3 commit a6347cf
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion store/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,17 @@ const getPythPrices = async () => {
};
const price_array = (await Promise.all(allRequest)) as IPythPrice[];
const format_price: IAssetPrice[] = price_array.map((priceObject: IPythPrice, index) => {
const coin = array_coins[index];
if (!priceObject)
return {
asset_id: coin[0],
price: {
multiplier: "0",
decimals: coin[1].decimals + coin[1].fraction_digits,
},
};
const { price, expo } = priceObject;
const p = new Decimal(10).pow(expo).mul(price).toNumber();
const coin = array_coins[index];
if (coin[0] === nearTokenId) {
near_pyth_price_obj = priceObject;
}
Expand Down

0 comments on commit a6347cf

Please sign in to comment.