From d8ee8041d4f8a849c9fcb0ac76358a0264becb0a Mon Sep 17 00:00:00 2001 From: CounterFire2023 <136581895+CounterFire2023@users.noreply.github.com> Date: Thu, 20 Jul 2023 10:40:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=80=E4=B8=AA=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2crypto=E7=9A=84=E7=BE=8E=E5=85=83=E4=BB=B7=E6=A0=BC?= =?UTF-8?q?=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Data/js/main.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Data/js/main.js b/Data/js/main.js index ec21a00..e1b6fb6 100644 --- a/Data/js/main.js +++ b/Data/js/main.js @@ -363,6 +363,20 @@ function tokenPrice(funId, tokenName, amount) { function fiatList(funId) { promiseCb(funId, jc.wallet.paySvr.fetchFiatList()); } +/** + * query price of crypto -> usd + * @param {string} crypto + * @param {number} chain chain id, + */ +function getCryptoPriceOfUSD(funId, crypto, chain) { + let chainData = jc.wallet.currentChain; + if (chain) { + chainData = jc.wallet.chainList.find((v) => v.chainId === +chain); + } + let network = chainData.type !== 'Testnet' ? chainData.network || chainData.symbol : 'ARBITRUM'; + network = network || 'ARBITRUM'; + promiseCb(funId, jc.wallet.paySvr.queryTokenPrice(network, crypto)); +} /** * format price