@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.module.js
CHANGED
|
@@ -3190,7 +3190,7 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
|
|
|
3190
3190
|
}
|
|
3191
3191
|
|
|
3192
3192
|
// This calculation is not precise as we cannot recognize the actual fee and network fee. Just approximate.
|
|
3193
|
-
var standardSwapspaceFeeMultiplier = 1.
|
|
3193
|
+
var standardSwapspaceFeeMultiplier = 1.004; // usually 0.2%
|
|
3194
3194
|
var rate = BigNumber(1).div(BigNumber(result.rate).times(standardSwapspaceFeeMultiplier)).toString();
|
|
3195
3195
|
_this7._cache.put("swapspace_usdt_rate_" + coin.ticker, rate, 15 * 60000 // 15 minutes
|
|
3196
3196
|
);
|
|
@@ -3751,6 +3751,8 @@ var SwapUtils = /*#__PURE__*/function () {
|
|
|
3751
3751
|
* @param swapProvider {SwapProvider}
|
|
3752
3752
|
* @param fromCoin {Coin} enabled coin (to swap amount from)
|
|
3753
3753
|
* @param toCoin {Coin}
|
|
3754
|
+
* @param coinToCurrentFiatRate {string|null}
|
|
3755
|
+
* @param fiatCurrencyDecimals {number|null}
|
|
3754
3756
|
* @return {Promise<{
|
|
3755
3757
|
* result: true,
|
|
3756
3758
|
* min: string,
|
|
@@ -3763,7 +3765,13 @@ var SwapUtils = /*#__PURE__*/function () {
|
|
|
3763
3765
|
* reason: string
|
|
3764
3766
|
* }>}
|
|
3765
3767
|
*/
|
|
3766
|
-
SwapUtils.getInitialSwapData = function getInitialSwapData(swapProvider, fromCoin, toCoin) {
|
|
3768
|
+
SwapUtils.getInitialSwapData = function getInitialSwapData(swapProvider, fromCoin, toCoin, coinToCurrentFiatRate, fiatCurrencyDecimals) {
|
|
3769
|
+
if (coinToCurrentFiatRate === void 0) {
|
|
3770
|
+
coinToCurrentFiatRate = null;
|
|
3771
|
+
}
|
|
3772
|
+
if (fiatCurrencyDecimals === void 0) {
|
|
3773
|
+
fiatCurrencyDecimals = null;
|
|
3774
|
+
}
|
|
3767
3775
|
try {
|
|
3768
3776
|
var loggerSource = "getInitialSwapData";
|
|
3769
3777
|
return Promise.resolve(_catch$1(function () {
|
|
@@ -3776,6 +3784,7 @@ var SwapUtils = /*#__PURE__*/function () {
|
|
|
3776
3784
|
var coinAmountForDefaultUsdAmount = AmountUtils.trim(coinUsdRate.result ? defaultAmountUsd.div(coinUsdRate == null ? void 0 : coinUsdRate.rate) : defaultAmountUsd, fromCoin.digits);
|
|
3777
3785
|
Logger.log("Init: " + coinAmountForDefaultUsdAmount + " " + fromCoin.ticker + "->" + toCoin.ticker, loggerSource);
|
|
3778
3786
|
return Promise.resolve(swapProvider.getSwapInfo(fromCoin, toCoin, coinAmountForDefaultUsdAmount)).then(function (details) {
|
|
3787
|
+
var _coinToCurrentFiatRat, _fiatCurrencyDecimals;
|
|
3779
3788
|
if (!details) {
|
|
3780
3789
|
throw new Error("The details are empty: " + safeStringify(details));
|
|
3781
3790
|
}
|
|
@@ -3792,10 +3801,11 @@ var SwapUtils = /*#__PURE__*/function () {
|
|
|
3792
3801
|
}
|
|
3793
3802
|
var fiatMin = null;
|
|
3794
3803
|
var fiatMax = null;
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3804
|
+
var fiatRate = (_coinToCurrentFiatRat = coinToCurrentFiatRate) != null ? _coinToCurrentFiatRat : coinUsdRate == null ? void 0 : coinUsdRate.rate;
|
|
3805
|
+
var fiatDecimals = (_fiatCurrencyDecimals = fiatCurrencyDecimals) != null ? _fiatCurrencyDecimals : FiatCurrenciesService.getCurrencyDecimalCountByCode("USD");
|
|
3806
|
+
if (fiatRate != null) {
|
|
3807
|
+
fiatMin = BigNumber(details == null ? void 0 : details.smallestMin).times(coinToCurrentFiatRate).toFixed(fiatDecimals);
|
|
3808
|
+
fiatMax = BigNumber(details == null ? void 0 : details.greatestMax).times(coinToCurrentFiatRate).toFixed(fiatDecimals);
|
|
3799
3809
|
}
|
|
3800
3810
|
var result = {
|
|
3801
3811
|
result: true,
|