Skip to content

Commit

Permalink
fix fetch token price to Binance API
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenmarcus committed Jul 14, 2024
1 parent 34483fe commit 5a60ccf
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/data/src/api/nearPrice/nearPrice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ export const fetchPriceFromBinance = async (): Promise<NearPriceData> => {

export const nearPrice = async (): Promise<ParsedDataReturn<string>> => {
try {
const res = await Promise.any([
fetchPriceFromCoinGecko(),
fetchPriceFromBinance(),
]);

let res: NearPriceData;
try {
res = await fetchPriceFromBinance();
} catch (err) {
res = await fetchPriceFromCoinGecko();
}
return parseData(res.price);
} catch (err) {
console.error(
Expand Down

0 comments on commit 5a60ccf

Please sign in to comment.