nerve-sdk-js
Version:
nerve nerve-js nerve-sdk nerve-js-sdk
547 lines (459 loc) • 21.3 kB
JavaScript
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
var nerve = require('../index');
var {
NERVE_INFOS,
RPC_URL
} = require('./htgConfig');
var isMainnet = true;
if (isMainnet) {
nerve.mainnet();
} else {
nerve.testnet();
}
var NERVE_INFO = nerve.chainId() == 9 ? NERVE_INFOS.mainnet : nerve.chainId() == 5 ? NERVE_INFOS.testnet : null;
var api_ethers = require('./api_ethers');
var util = require('./api/util');
var ethers = require("ethers"); // 9-445 metis
// 9-446 iotx
// 9-447 op
// 9-448 klay
// 9-449 bch
function getPrice(_x, _x2) {
return _getPrice.apply(this, arguments);
} // getPrice(9, 445);
// getPrice(9, 446);
// getPrice(9, 447);
// getPrice(9, 448);
// getPrice(9, 449);
// 917958010468536
// f();
// withdrawalToETH(isMainnet);
// withdrawalToOETH(isMainnet);
// withdrawalToKAVA(isMainnet);
// withdrawalToBSC(isMainnet);
// withdrawalToHECO(isMainnet);
// withdrawalToOKT(isMainnet);
// withdrawalToONE(isMainnet);
// withdrawalToMATIC(isMainnet);
// withdrawalToKCS(isMainnet);
// withdrawalToTRX(isMainnet, 'TRX');
// withdrawalToCRO(isMainnet);
// withdrawalToFTM(isMainnet);
// withdrawalToFTMByNVT(isMainnet);
// withdrawalToLineaByNVT(isMainnet);
// withdrawalToLineaByNVT(isMainnet);
// withdrawalToLineaByETH(isMainnet);
// withdrawalToLineaByETH(isMainnet);
// withdrawalToAvaxByNVT(isMainnet);
// withdrawalToAvaxByETH(isMainnet);
// withdrawalToPolygon(isMainnet);
// withdrawalToScrollByNVT(isMainnet);
// withdrawalToScrollByETH(isMainnet);
// withdrawalToSomeoneByNVT("SCROLL", isMainnet);
// withdrawalToSomeoneByETH("SCROLL", isMainnet);
// withdrawalToSomeoneByNVT("BASE", isMainnet);
// withdrawalToSomeoneByETH("BASE", isMainnet);
// withdrawalToSomeoneByNVT("OP", isMainnet);
// withdrawalToSomeoneByETH("OP", isMainnet);
// withdrawalToL2SomeoneByETH("BASE", 129, isMainnet);
// withdrawalToL2SomeoneByETH("MANTA", 133, isMainnet);
// withdrawalToL2SomeoneByNVT("MANTA", 133, isMainnet);
// withdrawalToL2SomeoneByETH("OP", 115, isMainnet);
// withdrawalToL2SomeoneByNVT("OP", 115, isMainnet);
// withdrawalToL2SomeoneByETH("BASE", 129, isMainnet);
function _getPrice() {
_getPrice = _asyncToGenerator(function* (chainId, assetId) {
var withdrawCoinPrice = yield util.getSymbolPriceOfUsdt(chainId, assetId);
console.log(withdrawCoinPrice, "withdrawCoinPrice", chainId + "-" + assetId);
});
return _getPrice.apply(this, arguments);
}
withdrawalToL2SomeoneByNVT("BASE", 129, isMainnet); // withdrawalToL2SomeoneByETH("SCROLL", 130, isMainnet);
// withdrawalToL2SomeoneByNVT("SCROLL", 130, isMainnet);
// let provider = new ethers.providers.JsonRpcProvider('https://geth.nerve.network');
// getWithdrawGas(new ethers.providers.JsonRpcProvider('https://geth.nerve.network'))
// getWithdrawGas(new ethers.providers.JsonRpcProvider('https://eth.drpc.org/'))
// withdrawalToL2SomeoneByNVT("BLAST", 139, isMainnet);
// withdrawalToSomeoneByNVT("REI", isMainnet);
// withdrawalToSomeoneByOwnMainAsset("REI", isMainnet);
function getWithdrawGas(_x3) {
return _getWithdrawGas.apply(this, arguments);
}
function _getWithdrawGas() {
_getWithdrawGas = _asyncToGenerator(function* (provider) {
return provider.getGasPrice().then(gasPrice => {
console.log('gasPrice', provider.connection.url, ethers.utils.formatUnits(gasPrice, 9), 'gasPriceHex', gasPrice);
return gasPrice;
});
});
return _getWithdrawGas.apply(this, arguments);
}
function withdrawalToL2SomeoneByETH(_x4, _x5, _x6) {
return _withdrawalToL2SomeoneByETH.apply(this, arguments);
}
function _withdrawalToL2SomeoneByETH() {
_withdrawalToL2SomeoneByETH = _asyncToGenerator(function* (chain, htgChainId, isMainnet) {
// let ethRpc = isMainnet ? "https://geth.nerve.network" : "https://rpc.ankr.com/eth_goerli";
var ethRpc = isMainnet ? "https://cloudflare-eth.com" : "https://rpc.ankr.com/eth_goerli"; // const ethGasPrice = new ethers.utils.BigNumber("47486431180");
var provider = new ethers.providers.JsonRpcProvider(ethRpc);
var ethGasPrice = yield getWithdrawGas(provider);
console.log(ethers.utils.formatUnits(ethGasPrice, 9), 'eth gasPrice');
var providerChain = api_ethers.getProvider(chain, isMainnet ? "main" : "test");
var chainGasPrice = yield getWithdrawGas(providerChain);
console.log(ethers.utils.formatUnits(chainGasPrice, 9), chain + 'gasPrice');
var feeNumber = ethers.utils.formatUnits(chainGasPrice.mul(210000), 18);
console.log("提现到" + chain + "网络需要L2Fee的ETH:" + feeNumber);
var l1Fee = nerve.getL1Fee(htgChainId, ethGasPrice);
console.log("提现到" + chain + "网络需要L1Fee的ETH:" + ethers.utils.formatUnits(l1Fee, 18));
console.log("提现到" + chain + "网络需要totalFee的ETH:" + ethers.utils.formatUnits(l1Fee.add(ethers.utils.parseUnits(feeNumber, 18)), 18));
console.log("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=");
});
return _withdrawalToL2SomeoneByETH.apply(this, arguments);
}
function withdrawalToL2SomeoneByNVT(_x7, _x8, _x9) {
return _withdrawalToL2SomeoneByNVT.apply(this, arguments);
}
function _withdrawalToL2SomeoneByNVT() {
_withdrawalToL2SomeoneByNVT = _asyncToGenerator(function* (chain, htgChainId, isMainnet) {
var nerveChainId = isMainnet ? 9 : 5; // let ethRpc = isMainnet ? "https://geth.nerve.network" : "https://rpc.ankr.com/eth_goerli";
var ethRpc = isMainnet ? "https://eth.drpc.org/" : "https://rpc.ankr.com/eth_goerli";
var feeNumber = yield calcFee(chain, isMainnet, true, "NVT");
console.log("提现到" + chain + "网络需要的NVT:" + feeNumber);
var nvtCoinPrice = yield util.getSymbolPriceOfUsdt(nerveChainId, 1, 'FEE');
var ethCoinPrice = yield util.getSymbolPriceOfUsdt(nerveChainId, 2);
console.log(nvtCoinPrice, "nvtCoinPrice");
console.log(ethCoinPrice, "ethCoinPrice");
var provider = new ethers.providers.JsonRpcProvider(ethRpc);
var gasPrice = yield getWithdrawGas(provider); // const gasPrice = '54861998732';
console.log(ethers.utils.formatUnits(gasPrice, 9), 'eth gasPrice');
var l1Fee = nerve.getL1Fee(htgChainId, gasPrice);
var nvtTemp = l1Fee.mul(ethers.utils.parseUnits(ethCoinPrice, 18)).mul(ethers.utils.parseUnits("1", 18)).div(ethers.utils.parseUnits(nvtCoinPrice, 18));
var l1FeeNvtNumber = ethers.utils.formatUnits(nvtTemp, 36);
console.log("提现到" + chain + "网络需要L1Fee的ETH:" + ethers.utils.formatUnits(l1Fee, 18));
console.log("提现到" + chain + "网络需要L1Fee的NVT:" + l1FeeNvtNumber);
console.log("提现到" + chain + "网络需要totalFee的NVT:" + (Number(l1FeeNvtNumber) + Number(feeNumber)));
console.log("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=");
});
return _withdrawalToL2SomeoneByNVT.apply(this, arguments);
}
function withdrawalToOETH(_x10) {
return _withdrawalToOETH.apply(this, arguments);
}
function _withdrawalToOETH() {
_withdrawalToOETH = _asyncToGenerator(function* (isMainnet) {
var feeNumber = yield calcFee("OETH", isMainnet, true, "NVT");
console.log("提现到OETH网络:" + feeNumber);
});
return _withdrawalToOETH.apply(this, arguments);
}
function withdrawalToKAVA(_x11) {
return _withdrawalToKAVA.apply(this, arguments);
}
function _withdrawalToKAVA() {
_withdrawalToKAVA = _asyncToGenerator(function* (isMainnet) {
var feeNumber = yield calcFee("KAVA", isMainnet, true, "NVT");
console.log("提现到KAVA网络:" + feeNumber);
});
return _withdrawalToKAVA.apply(this, arguments);
}
function withdrawalToETH(_x12) {
return _withdrawalToETH.apply(this, arguments);
}
function _withdrawalToETH() {
_withdrawalToETH = _asyncToGenerator(function* (isMainnet) {
var feeNumber = yield calcFee("ETH", isMainnet, true, "BNB");
console.log("提现到ETH网络:" + feeNumber);
});
return _withdrawalToETH.apply(this, arguments);
}
function withdrawalToBSC(_x13) {
return _withdrawalToBSC.apply(this, arguments);
}
function _withdrawalToBSC() {
_withdrawalToBSC = _asyncToGenerator(function* (isMainnet) {
var feeNumber = yield calcFee("BNB", isMainnet, true, "NVT");
console.log("提现到BSC网络:" + feeNumber);
});
return _withdrawalToBSC.apply(this, arguments);
}
function withdrawalToHECO(_x14) {
return _withdrawalToHECO.apply(this, arguments);
}
function _withdrawalToHECO() {
_withdrawalToHECO = _asyncToGenerator(function* (isMainnet) {
var feeNumber = yield calcFee("HT", isMainnet, true, "ONE");
console.log("提现到HECO网络:" + feeNumber);
});
return _withdrawalToHECO.apply(this, arguments);
}
function withdrawalToOKT(_x15) {
return _withdrawalToOKT.apply(this, arguments);
}
function _withdrawalToOKT() {
_withdrawalToOKT = _asyncToGenerator(function* (isMainnet) {
var feeNumber = yield calcFee("OKT", isMainnet, true, "NVT");
console.log("提现到OKT网络:" + feeNumber);
});
return _withdrawalToOKT.apply(this, arguments);
}
function withdrawalToONE(_x16) {
return _withdrawalToONE.apply(this, arguments);
}
function _withdrawalToONE() {
_withdrawalToONE = _asyncToGenerator(function* (isMainnet) {
var feeNumber = yield calcFee("ONE", isMainnet, true, "NVT");
console.log("提现到ONE网络:" + feeNumber);
});
return _withdrawalToONE.apply(this, arguments);
}
function withdrawalToMATIC(_x17) {
return _withdrawalToMATIC.apply(this, arguments);
}
function _withdrawalToMATIC() {
_withdrawalToMATIC = _asyncToGenerator(function* (isMainnet) {
var feeNumber = yield calcFee("MATIC", isMainnet, true, "NVT");
console.log("提现到MATIC网络:" + feeNumber);
});
return _withdrawalToMATIC.apply(this, arguments);
}
function withdrawalToKCS(_x18) {
return _withdrawalToKCS.apply(this, arguments);
}
function _withdrawalToKCS() {
_withdrawalToKCS = _asyncToGenerator(function* (isMainnet) {
var feeNumber = yield calcFee("KCS", isMainnet, true, "NVT");
console.log("提现到KCS网络:" + feeNumber);
});
return _withdrawalToKCS.apply(this, arguments);
}
function withdrawalToTRX(_x19) {
return _withdrawalToTRX.apply(this, arguments);
}
function _withdrawalToTRX() {
_withdrawalToTRX = _asyncToGenerator(function* (isMainnet) {
var feeChain = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "NVT";
var feeNumber = yield calcFee("TRX", isMainnet, true, feeChain);
console.log("提现到TRX网络:" + feeNumber);
});
return _withdrawalToTRX.apply(this, arguments);
}
function withdrawalToCRO(_x20) {
return _withdrawalToCRO.apply(this, arguments);
}
function _withdrawalToCRO() {
_withdrawalToCRO = _asyncToGenerator(function* (isMainnet) {
var feeNumber = yield calcFee("CRO", isMainnet, true, "NVT");
console.log("提现到CRO网络:" + feeNumber);
});
return _withdrawalToCRO.apply(this, arguments);
}
function withdrawalToFTM(_x21) {
return _withdrawalToFTM.apply(this, arguments);
}
function _withdrawalToFTM() {
_withdrawalToFTM = _asyncToGenerator(function* (isMainnet) {
var feeNumber = yield calcFee("FTM", isMainnet, false, "FTM");
console.log("提现到FTM网络:" + feeNumber);
});
return _withdrawalToFTM.apply(this, arguments);
}
function withdrawalToFTMByNVT(_x22) {
return _withdrawalToFTMByNVT.apply(this, arguments);
}
function _withdrawalToFTMByNVT() {
_withdrawalToFTMByNVT = _asyncToGenerator(function* (isMainnet) {
var feeNumber = yield calcFee("FTM", isMainnet, false, "NVT");
console.log("提现到FTM网络:" + feeNumber);
});
return _withdrawalToFTMByNVT.apply(this, arguments);
}
function withdrawalToLineaByNVT(_x23) {
return _withdrawalToLineaByNVT.apply(this, arguments);
}
function _withdrawalToLineaByNVT() {
_withdrawalToLineaByNVT = _asyncToGenerator(function* (isMainnet) {
var feeNumber = yield calcFee("LINEA", isMainnet, true, "NVT");
console.log("提现到LINEA网络:" + feeNumber);
console.log("1.1倍+5个: ", Number(feeNumber) * 1.1 + 5);
console.log("1.2倍+5个: ", Number(feeNumber) * 1.2 + 5);
console.log("1.5倍+5个: ", Number(feeNumber) * 1.5 + 5);
});
return _withdrawalToLineaByNVT.apply(this, arguments);
}
function withdrawalToLineaByETH(_x24) {
return _withdrawalToLineaByETH.apply(this, arguments);
}
function _withdrawalToLineaByETH() {
_withdrawalToLineaByETH = _asyncToGenerator(function* (isMainnet) {
var feeNumber = yield calcFee("LINEA", isMainnet, true, "ETH");
console.log("提现到LINEA网络:" + feeNumber);
console.log("1.2倍: ", Number(feeNumber) * 1.2);
console.log("1.5倍: ", Number(feeNumber) * 1.5);
});
return _withdrawalToLineaByETH.apply(this, arguments);
}
function withdrawalToScrollByNVT(_x25) {
return _withdrawalToScrollByNVT.apply(this, arguments);
}
function _withdrawalToScrollByNVT() {
_withdrawalToScrollByNVT = _asyncToGenerator(function* (isMainnet) {
var feeNumber = yield calcFee("SCROLL", isMainnet, true, "NVT");
console.log("提现到SCROLL网络需要的NVT:" + feeNumber);
console.log("1.1倍+5个: ", Number(feeNumber) * 1.1 + 5);
console.log("1.2倍+5个: ", Number(feeNumber) * 1.2 + 5);
console.log("1.5倍+5个: ", Number(feeNumber) * 1.5 + 5);
});
return _withdrawalToScrollByNVT.apply(this, arguments);
}
function withdrawalToScrollByETH(_x26) {
return _withdrawalToScrollByETH.apply(this, arguments);
}
function _withdrawalToScrollByETH() {
_withdrawalToScrollByETH = _asyncToGenerator(function* (isMainnet) {
var feeNumber = yield calcFee("SCROLL", isMainnet, true, "ETH");
console.log("提现到SCROLL网络需要的ETH:" + feeNumber);
console.log("1.2倍ETH: ", Number(feeNumber) * 1.2);
console.log("1.5倍ETH: ", Number(feeNumber) * 1.5);
});
return _withdrawalToScrollByETH.apply(this, arguments);
}
function withdrawalToSomeoneByNVT(_x27, _x28) {
return _withdrawalToSomeoneByNVT.apply(this, arguments);
}
function _withdrawalToSomeoneByNVT() {
_withdrawalToSomeoneByNVT = _asyncToGenerator(function* (chain, isMainnet) {
var feeNumber = yield calcFee(chain, isMainnet, true, "NVT");
console.log("提现到" + chain + "网络需要的NVT:" + feeNumber); // console.log("1.1倍+5个: ", Number(feeNumber) * 1.1 + 5)
// console.log("1.2倍+5个: ", Number(feeNumber) * 1.2 + 5)
// console.log("1.5倍+5个: ", Number(feeNumber) * 1.5 + 5)
console.log(chain + ", 15倍+5个: ", Number(feeNumber) * 15 + 5);
console.log(chain + ", 20倍+5个: ", Number(feeNumber) * 20 + 5);
console.log(chain + ", 200倍+5个: ", Number(feeNumber) * 200 + 5);
});
return _withdrawalToSomeoneByNVT.apply(this, arguments);
}
function withdrawalToSomeoneByETH(_x29, _x30) {
return _withdrawalToSomeoneByETH.apply(this, arguments);
}
function _withdrawalToSomeoneByETH() {
_withdrawalToSomeoneByETH = _asyncToGenerator(function* (chain, isMainnet) {
var feeNumber = yield calcFee(chain, isMainnet, true, "ETH");
console.log("提现到" + chain + "网络需要的ETH:" + feeNumber); // console.log("1.2倍ETH: ", Number(feeNumber) * 1.2)
// console.log("1.5倍ETH: ", Number(feeNumber) * 1.5)
console.log(chain + ", 15倍ETH: ", Number(feeNumber) * 15);
console.log(chain + ", 20倍ETH: ", Number(feeNumber) * 20);
console.log(chain + ", 2000倍ETH: ", Number(feeNumber) * 2000);
});
return _withdrawalToSomeoneByETH.apply(this, arguments);
}
function withdrawalToSomeoneByOwnMainAsset(_x31, _x32) {
return _withdrawalToSomeoneByOwnMainAsset.apply(this, arguments);
}
function _withdrawalToSomeoneByOwnMainAsset() {
_withdrawalToSomeoneByOwnMainAsset = _asyncToGenerator(function* (chain, isMainnet) {
var feeNumber = yield calcFee(chain, isMainnet, true, chain);
console.log("提现到" + chain + "网络需要的" + chain + ":" + feeNumber);
console.log(chain + ", 1.2倍: ", Number(feeNumber) * 1.2);
console.log(chain + ", 1.5倍: ", Number(feeNumber) * 1.5);
console.log(chain + ", 15倍: ", Number(feeNumber) * 15);
console.log(chain + ", 20倍: ", Number(feeNumber) * 20);
console.log(chain + ", 2000倍: ", Number(feeNumber) * 2000);
});
return _withdrawalToSomeoneByOwnMainAsset.apply(this, arguments);
}
function withdrawalToAvaxByNVT(_x33) {
return _withdrawalToAvaxByNVT.apply(this, arguments);
}
function _withdrawalToAvaxByNVT() {
_withdrawalToAvaxByNVT = _asyncToGenerator(function* (isMainnet) {
var feeNumber = yield calcFee("AVAX", isMainnet, true, "NVT");
console.log("提现到AVAX网络:" + feeNumber);
console.log("1.2倍+5个: ", Number(feeNumber) * 1.2 + 5);
console.log("1.5倍+5个: ", Number(feeNumber) * 1.5 + 5);
});
return _withdrawalToAvaxByNVT.apply(this, arguments);
}
function withdrawalToAvaxByETH(_x34) {
return _withdrawalToAvaxByETH.apply(this, arguments);
}
function _withdrawalToAvaxByETH() {
_withdrawalToAvaxByETH = _asyncToGenerator(function* (isMainnet) {
var feeNumber = yield calcFee("AVAX", isMainnet, true, "AVAX");
console.log("提现到AVAX网络:" + feeNumber);
console.log("1.2倍: ", Number(feeNumber) * 1.2);
console.log("1.5倍: ", Number(feeNumber) * 1.5);
});
return _withdrawalToAvaxByETH.apply(this, arguments);
}
function withdrawalToPolygon(_x35) {
return _withdrawalToPolygon.apply(this, arguments);
}
function _withdrawalToPolygon() {
_withdrawalToPolygon = _asyncToGenerator(function* (isMainnet) {
var feeNumber = yield calcFee("MATIC", isMainnet, true, "HT");
console.log("提现到Polygon网络:" + feeNumber);
});
return _withdrawalToPolygon.apply(this, arguments);
}
function calcFee(_x36, _x37, _x38, _x39) {
return _calcFee.apply(this, arguments);
}
function _calcFee() {
_calcFee = _asyncToGenerator(function* (withdrawChain, isMainnet, isToken, feeChain) {
// 默认使用NVT作为跨链手续费
if (!feeChain || feeChain === '') {
feeChain = 'NVT';
}
if (withdrawChain === 'TRX') {
return calcFeeForTRX(isMainnet, isToken, feeChain);
}
var provider = api_ethers.getProvider(withdrawChain, isMainnet ? "main" : "test");
var withdrawCoin = NERVE_INFO.htgMainAsset[withdrawChain];
if (feeChain === withdrawChain) {
var _result = yield api_ethers.calcMainAssetOfWithdrawProtocol15Test(provider, isToken);
return api_ethers.formatOtherMainAsset(_result, withdrawCoin);
} // 获取资产信息
var feeCoin = NERVE_INFO.htgMainAsset[feeChain];
var feeCoinPrice = yield util.getSymbolPriceOfUsdt(feeCoin.chainId, feeCoin.assetId, 'FEE'); // let feeCoinPrice = await util.getSymbolPriceOfUsdt(feeCoin.chainId, feeCoin.assetId);
var withdrawCoinPrice = yield util.getSymbolPriceOfUsdt(withdrawCoin.chainId, withdrawCoin.assetId);
console.log(feeCoinPrice, "feeCoinPrice", feeChain);
console.log(withdrawCoinPrice, "withdrawCoinPrice", withdrawChain);
var result = yield api_ethers.calcOtherMainAssetOfWithdrawTest(provider, feeCoin, feeCoinPrice, withdrawCoinPrice, isToken);
return api_ethers.formatOtherMainAsset(result, feeCoin);
});
return _calcFee.apply(this, arguments);
}
function calcFeeForTRX(_x40, _x41, _x42) {
return _calcFeeForTRX.apply(this, arguments);
}
function _calcFeeForTRX() {
_calcFeeForTRX = _asyncToGenerator(function* (isMainnet, isToken, feeChain) {
var withdrawChain = 'TRX';
var withdrawCoin = NERVE_INFO.htgMainAsset[withdrawChain];
if (feeChain === withdrawChain) {
return api_ethers.formatOtherMainAsset(NERVE_INFO.trxWithdrawFee, withdrawCoin);
} // 获取资产信息
var feeCoin = NERVE_INFO.htgMainAsset[feeChain];
var feeCoinPrice = yield util.getSymbolPriceOfUsdt(feeCoin.chainId, feeCoin.assetId);
var withdrawCoinPrice = yield util.getSymbolPriceOfUsdt(withdrawCoin.chainId, withdrawCoin.assetId); // console.log(feeCoinPrice, "feeCoinPrice", feeChain);
// console.log(withdrawCoinPrice, "withdrawCoinPrice", withdrawChain);
var result = yield api_ethers.calcOtherMainAssetOfWithdrawForTRX(feeCoin, feeCoinPrice, withdrawCoinPrice, NERVE_INFO.trxWithdrawFee);
return api_ethers.formatOtherMainAsset(result, feeCoin);
});
return _calcFeeForTRX.apply(this, arguments);
}
function f() {
return _f.apply(this, arguments);
}
function _f() {
_f = _asyncToGenerator(function* () {
var provider = api_ethers.getProvider("BNB", "test");
var nvtFeeCoin = NERVE_INFO.htgMainAsset['NVT'];
var nvtPrice = '0.0355';
var htgPrice = '504.482';
var result = yield api_ethers.calcOtherMainAssetOfWithdrawTest(provider, nvtFeeCoin, nvtPrice, htgPrice, true);
console.log(api_ethers.formatNVT(result));
});
return _f.apply(this, arguments);
}