@rabbitio/ui-kit 1.0.0-beta.24 → 1.0.0-beta.26
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.
- package/dist/index.cjs +16 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +9 -6
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +16 -6
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +16 -6
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/swaps-lib/external-apis/swapspaceSwapProvider.js +1 -1
- package/src/swaps-lib/utils/swapUtils.js +18 -8
package/dist/index.cjs
CHANGED
|
@@ -3196,7 +3196,7 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
|
|
|
3196
3196
|
}
|
|
3197
3197
|
|
|
3198
3198
|
// This calculation is not precise as we cannot recognize the actual fee and network fee. Just approximate.
|
|
3199
|
-
var standardSwapspaceFeeMultiplier = 1.
|
|
3199
|
+
var standardSwapspaceFeeMultiplier = 1.004; // usually 0.2%
|
|
3200
3200
|
var rate = bignumber_js.BigNumber(1).div(bignumber_js.BigNumber(result.rate).times(standardSwapspaceFeeMultiplier)).toString();
|
|
3201
3201
|
_this7._cache.put("swapspace_usdt_rate_" + coin.ticker, rate, 15 * 60000 // 15 minutes
|
|
3202
3202
|
);
|
|
@@ -3757,6 +3757,8 @@ var SwapUtils = /*#__PURE__*/function () {
|
|
|
3757
3757
|
* @param swapProvider {SwapProvider}
|
|
3758
3758
|
* @param fromCoin {Coin} enabled coin (to swap amount from)
|
|
3759
3759
|
* @param toCoin {Coin}
|
|
3760
|
+
* @param coinToCurrentFiatRate {string|null}
|
|
3761
|
+
* @param fiatCurrencyDecimals {number|null}
|
|
3760
3762
|
* @return {Promise<{
|
|
3761
3763
|
* result: true,
|
|
3762
3764
|
* min: string,
|
|
@@ -3769,7 +3771,13 @@ var SwapUtils = /*#__PURE__*/function () {
|
|
|
3769
3771
|
* reason: string
|
|
3770
3772
|
* }>}
|
|
3771
3773
|
*/
|
|
3772
|
-
SwapUtils.getInitialSwapData = function getInitialSwapData(swapProvider, fromCoin, toCoin) {
|
|
3774
|
+
SwapUtils.getInitialSwapData = function getInitialSwapData(swapProvider, fromCoin, toCoin, coinToCurrentFiatRate, fiatCurrencyDecimals) {
|
|
3775
|
+
if (coinToCurrentFiatRate === void 0) {
|
|
3776
|
+
coinToCurrentFiatRate = null;
|
|
3777
|
+
}
|
|
3778
|
+
if (fiatCurrencyDecimals === void 0) {
|
|
3779
|
+
fiatCurrencyDecimals = null;
|
|
3780
|
+
}
|
|
3773
3781
|
try {
|
|
3774
3782
|
var loggerSource = "getInitialSwapData";
|
|
3775
3783
|
return Promise.resolve(_catch$1(function () {
|
|
@@ -3782,6 +3790,7 @@ var SwapUtils = /*#__PURE__*/function () {
|
|
|
3782
3790
|
var coinAmountForDefaultUsdAmount = AmountUtils.trim(coinUsdRate.result ? defaultAmountUsd.div(coinUsdRate == null ? void 0 : coinUsdRate.rate) : defaultAmountUsd, fromCoin.digits);
|
|
3783
3791
|
Logger.log("Init: " + coinAmountForDefaultUsdAmount + " " + fromCoin.ticker + "->" + toCoin.ticker, loggerSource);
|
|
3784
3792
|
return Promise.resolve(swapProvider.getSwapInfo(fromCoin, toCoin, coinAmountForDefaultUsdAmount)).then(function (details) {
|
|
3793
|
+
var _coinToCurrentFiatRat, _fiatCurrencyDecimals;
|
|
3785
3794
|
if (!details) {
|
|
3786
3795
|
throw new Error("The details are empty: " + safeStringify(details));
|
|
3787
3796
|
}
|
|
@@ -3798,10 +3807,11 @@ var SwapUtils = /*#__PURE__*/function () {
|
|
|
3798
3807
|
}
|
|
3799
3808
|
var fiatMin = null;
|
|
3800
3809
|
var fiatMax = null;
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3810
|
+
var fiatRate = (_coinToCurrentFiatRat = coinToCurrentFiatRate) != null ? _coinToCurrentFiatRat : coinUsdRate == null ? void 0 : coinUsdRate.rate;
|
|
3811
|
+
var fiatDecimals = (_fiatCurrencyDecimals = fiatCurrencyDecimals) != null ? _fiatCurrencyDecimals : FiatCurrenciesService.getCurrencyDecimalCountByCode("USD");
|
|
3812
|
+
if (fiatRate != null) {
|
|
3813
|
+
fiatMin = bignumber_js.BigNumber(details == null ? void 0 : details.smallestMin).times(coinToCurrentFiatRate).toFixed(fiatDecimals);
|
|
3814
|
+
fiatMax = bignumber_js.BigNumber(details == null ? void 0 : details.greatestMax).times(coinToCurrentFiatRate).toFixed(fiatDecimals);
|
|
3805
3815
|
}
|
|
3806
3816
|
var result = {
|
|
3807
3817
|
result: true,
|