@riocrypto/common-server 1.0.940 → 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.
@@ -39,7 +39,7 @@ declare class CCXTClient {
39
39
  crypto: Crypto;
40
40
  fiat: Fiat;
41
41
  }>;
42
- getDepositAddress(crypto: Crypto): Promise<any>;
42
+ getDepositAddress(crypto: Crypto): Promise<string>;
43
43
  }
44
44
  export declare const ccxtWrapper: CCXTClient;
45
45
  export {};
@@ -141,7 +141,7 @@ class CCXTClient {
141
141
  getOptimalExchange(crypto) {
142
142
  return __awaiter(this, void 0, void 0, function* () {
143
143
  for (let exchangeId of ccxt_1.default.exchanges) {
144
- if (exchangeId === "coinbase") {
144
+ if (exchangeId === "bitstamp") {
145
145
  const SECRET = yield secret_manager_client_1.secretManagerClient.getSecretValue(`${exchangeId.toLocaleUpperCase()}_SECRET`);
146
146
  if (!SECRET) {
147
147
  throw new Error("Unable to get SECRET");
@@ -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
- : crypto === common_1.Crypto.USDTTron
20
- ? "TDnvjqzjzBhjQp1b7SSQukAm71WusJeiej"
21
- : "0x66ECBd38905CC32249ddd6f4f0B4A3DdDDCbd608";
19
+ : "0x66ECBd38905CC32249ddd6f4f0B4A3DdDDCbd608";
22
20
  const fireblocksClient = yield (0, fireblocks_client_1.buildFireblocksClient)();
23
- const withdrawFee = yield fireblocksClient.estimateWithdrawFee(crypto, address, 100);
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
- const withdrawFeeUSDResponse = yield ccxt_client_1.ccxtWrapper.getSellQuote(new common_1.CryptoAsset(crypto).getGasSymbol(), common_1.Fiat.USD, undefined, Number(withdrawFee));
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.940",
3
+ "version": "1.0.942",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -24,7 +24,7 @@
24
24
  "@aws-sdk/client-s3": "^3.297.0",
25
25
  "@everapi/currencyapi-js": "^1.0.6",
26
26
  "@google-cloud/storage": "^6.9.5",
27
- "@riocrypto/common": "^1.0.809",
27
+ "@riocrypto/common": "^1.0.810",
28
28
  "@types/express": "^4.17.13",
29
29
  "axios": "^0.27.2",
30
30
  "ccxt": "^3.0.30",