@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.modern.js
CHANGED
|
@@ -2858,7 +2858,7 @@ class SwapspaceSwapProvider extends SwapProvider {
|
|
|
2858
2858
|
}
|
|
2859
2859
|
|
|
2860
2860
|
// This calculation is not precise as we cannot recognize the actual fee and network fee. Just approximate.
|
|
2861
|
-
const standardSwapspaceFeeMultiplier = 1.
|
|
2861
|
+
const standardSwapspaceFeeMultiplier = 1.004; // usually 0.2%
|
|
2862
2862
|
const rate = BigNumber(1).div(BigNumber(result.rate).times(standardSwapspaceFeeMultiplier)).toString();
|
|
2863
2863
|
this._cache.put("swapspace_usdt_rate_" + coin.ticker, rate, 15 * 60000 // 15 minutes
|
|
2864
2864
|
);
|
|
@@ -3197,6 +3197,8 @@ class SwapUtils {
|
|
|
3197
3197
|
* @param swapProvider {SwapProvider}
|
|
3198
3198
|
* @param fromCoin {Coin} enabled coin (to swap amount from)
|
|
3199
3199
|
* @param toCoin {Coin}
|
|
3200
|
+
* @param coinToCurrentFiatRate {string|null}
|
|
3201
|
+
* @param fiatCurrencyDecimals {number|null}
|
|
3200
3202
|
* @return {Promise<{
|
|
3201
3203
|
* result: true,
|
|
3202
3204
|
* min: string,
|
|
@@ -3209,7 +3211,7 @@ class SwapUtils {
|
|
|
3209
3211
|
* reason: string
|
|
3210
3212
|
* }>}
|
|
3211
3213
|
*/
|
|
3212
|
-
static async getInitialSwapData(swapProvider, fromCoin, toCoin) {
|
|
3214
|
+
static async getInitialSwapData(swapProvider, fromCoin, toCoin, coinToCurrentFiatRate = null, fiatCurrencyDecimals = null) {
|
|
3213
3215
|
const loggerSource = "getInitialSwapData";
|
|
3214
3216
|
try {
|
|
3215
3217
|
/* We use some amount here that should fit at least some of the limits of the swap providers.
|
|
@@ -3237,10 +3239,11 @@ class SwapUtils {
|
|
|
3237
3239
|
}
|
|
3238
3240
|
let fiatMin = null;
|
|
3239
3241
|
let fiatMax = null;
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3242
|
+
const fiatRate = coinToCurrentFiatRate != null ? coinToCurrentFiatRate : coinUsdRate == null ? void 0 : coinUsdRate.rate;
|
|
3243
|
+
const fiatDecimals = fiatCurrencyDecimals != null ? fiatCurrencyDecimals : FiatCurrenciesService.getCurrencyDecimalCountByCode("USD");
|
|
3244
|
+
if (fiatRate != null) {
|
|
3245
|
+
fiatMin = BigNumber(details == null ? void 0 : details.smallestMin).times(coinToCurrentFiatRate).toFixed(fiatDecimals);
|
|
3246
|
+
fiatMax = BigNumber(details == null ? void 0 : details.greatestMax).times(coinToCurrentFiatRate).toFixed(fiatDecimals);
|
|
3244
3247
|
}
|
|
3245
3248
|
const result = {
|
|
3246
3249
|
result: true,
|