@riocrypto/common-server 1.0.941 → 1.0.942
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -16,15 +16,19 @@ const ccxt_client_1 = require("../clients/ccxt-client");
|
|
|
16
16
|
const getNetworkFees = (crypto, conversionRateToUSD) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
17
|
const address = crypto === common_1.Crypto.USDCSolana
|
|
18
18
|
? "HN7cABqLq46Es1jh92dQQisAq662SmxELLLsHHe4YWrH"
|
|
19
|
-
:
|
|
20
|
-
? "TDnvjqzjzBhjQp1b7SSQukAm71WusJeiej"
|
|
21
|
-
: "0x66ECBd38905CC32249ddd6f4f0B4A3DdDDCbd608";
|
|
19
|
+
: "0x66ECBd38905CC32249ddd6f4f0B4A3DdDDCbd608";
|
|
22
20
|
const fireblocksClient = yield (0, fireblocks_client_1.buildFireblocksClient)();
|
|
23
|
-
|
|
21
|
+
// Hacky way bc ccxt doesn't support TRON, so quote in MATIC
|
|
22
|
+
const cryptoToWithdraw = crypto === common_1.Crypto.USDTTron ? common_1.Crypto.USDCPolygon : crypto;
|
|
23
|
+
const withdrawFee = yield fireblocksClient.estimateWithdrawFee(cryptoToWithdraw, address, 100);
|
|
24
24
|
if (!withdrawFee) {
|
|
25
25
|
throw new common_1.GenericInternalError();
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
// Hacky way bc ccxt doesn't support TRON, so quote in MATIC
|
|
28
|
+
const gasSymbol = crypto === common_1.Crypto.USDTTron
|
|
29
|
+
? "MATIC"
|
|
30
|
+
: new common_1.CryptoAsset(crypto).getGasSymbol();
|
|
31
|
+
const withdrawFeeUSDResponse = yield ccxt_client_1.ccxtWrapper.getSellQuote(gasSymbol, common_1.Fiat.USD, undefined, Number(withdrawFee));
|
|
28
32
|
const withdrawFeeInBaseCrypto = withdrawFeeUSDResponse.amountFiat;
|
|
29
33
|
const withdrawFeeInBaseFiat = Number(withdrawFeeUSDResponse.amountFiat) * (1 / conversionRateToUSD);
|
|
30
34
|
return { withdrawFeeInBaseFiat, withdrawFeeInBaseCrypto };
|