增加一个查询crypto的美元价格的方法
This commit is contained in:
parent
406ba18744
commit
d8ee8041d4
@ -363,6 +363,20 @@ function tokenPrice(funId, tokenName, amount) {
|
|||||||
function fiatList(funId) {
|
function fiatList(funId) {
|
||||||
promiseCb(funId, jc.wallet.paySvr.fetchFiatList());
|
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
|
* format price
|
||||||
|
Loading…
x
Reference in New Issue
Block a user