Skip to content

Commit

Permalink
fix(investor-box): fix coinmarketcap endpoint
Browse files Browse the repository at this point in the history
update (1) use of new coinmarketcap data endpoint, (2) data fallback via null-checks, (3) rounding
add.

fix #1841;
  • Loading branch information
migbash committed Nov 29, 2023
1 parent c028dde commit e80ca0c
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import { get, post } from '$lib/api/utils.js';
import { dlogv2 } from '$lib/utils/debug.js';
import { shortenWeb3WalletAddress, viewport_change } from '$lib/utils/platform-functions.js';
import { shortenWeb3WalletAddress, toDecimalFix, viewport_change } from '$lib/utils/platform-functions.js';
import { passByValue } from '@betarena/scores-lib/dist/functions/func.common.js';
import { tryCatchAsync } from '@betarena/scores-lib/dist/util/util.common.js';
Expand Down Expand Up @@ -640,7 +640,10 @@
{
cryptoPrices = await get
(
'https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest?symbol=USDT,USDC&CMC_PRO_API_KEY=af3ceee8-f47b-4dba-80f1-242f5aa1156c'
`/api/coinmarketcap?tickers=USDT,USDC`,
null,
true,
true
) as ICoinMarketCapDataMain;
[
Expand Down Expand Up @@ -1031,7 +1034,7 @@
m-t-5
"
>
{depositAmount} {cryptoDepositOptionSelect?.name} ≈ {cryptoPrices?.data?.['USDC']?.quote?.USD?.price}$
{depositAmount} {cryptoDepositOptionSelect?.name} ≈ {toDecimalFix(cryptoPrices?.data?.['USDC']?.quote?.USD?.price) ?? '-'} $
</p>

</div>
Expand Down

0 comments on commit e80ca0c

Please sign in to comment.