@rabbitio/ui-kit 1.0.0-beta.30 → 1.0.0-beta.32
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 +17 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +13 -9
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +17 -9
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +17 -9
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/swaps-lib/external-apis/swapspaceSwapProvider.js +16 -4
- package/src/swaps-lib/services/publicSwapService.js +3 -3
package/dist/index.modern.js
CHANGED
|
@@ -2684,7 +2684,7 @@ class SwapspaceSwapProvider extends SwapProvider {
|
|
|
2684
2684
|
constructor(apiKeysProxyUrl, cache, customCoinBuilder = (coin, network) => null, useRestrictedCoinsSet = true) {
|
|
2685
2685
|
super();
|
|
2686
2686
|
this._supportedCoins = [];
|
|
2687
|
-
this._URL = `${apiKeysProxyUrl}
|
|
2687
|
+
this._URL = `${apiKeysProxyUrl}`;
|
|
2688
2688
|
this._maxRateDigits = 20;
|
|
2689
2689
|
this.useRestrictedCoinsSet = useRestrictedCoinsSet;
|
|
2690
2690
|
this._customCoinBuilder = customCoinBuilder;
|
|
@@ -2788,8 +2788,12 @@ class SwapspaceSwapProvider extends SwapProvider {
|
|
|
2788
2788
|
if (!((_this$_supportedCoins7 = this._supportedCoins) != null && _this$_supportedCoins7.length)) {
|
|
2789
2789
|
var _rawResponse$data, _rawResponse$data2;
|
|
2790
2790
|
const rawResponse = await axios.get(`${this._URL}/api/v2/currencies`);
|
|
2791
|
-
Logger.log(`Retrieved ${rawResponse == null || (_rawResponse$data = rawResponse.data) == null ? void 0 : _rawResponse$data.length}
|
|
2792
|
-
|
|
2791
|
+
Logger.log(`Retrieved ${rawResponse == null || (_rawResponse$data = rawResponse.data) == null ? void 0 : _rawResponse$data.length}`, loggerSource);
|
|
2792
|
+
let allowedCoins = (_rawResponse$data2 = rawResponse == null ? void 0 : rawResponse.data) != null ? _rawResponse$data2 : [];
|
|
2793
|
+
// TODO: [feature, critical] add support for extra ID. task_id=7219d65d41c242a292dfa47479b8d63f
|
|
2794
|
+
allowedCoins = allowedCoins.filter(c => c.hasExtraId !== true && c.hasExtraId !== "true");
|
|
2795
|
+
Logger.log(`Allowed cnt ${allowedCoins.length}`, loggerSource);
|
|
2796
|
+
this._supportedCoins = allowedCoins.map(item => {
|
|
2793
2797
|
let coin = this._customCoinBuilder(item.code, item.network);
|
|
2794
2798
|
if (!coin && !this.useRestrictedCoinsSet) {
|
|
2795
2799
|
/** Building coin object for coin that isn't supported OOB in Rabbit.
|
|
@@ -2805,11 +2809,10 @@ class SwapspaceSwapProvider extends SwapProvider {
|
|
|
2805
2809
|
const ticker = `${code}${code === network ? "" : network}`;
|
|
2806
2810
|
const defaultDecimalPlacesForCoinNotSupportedOOB = 8;
|
|
2807
2811
|
const defaultMinConfirmationsForCoinNotSupportedOOB = 1;
|
|
2812
|
+
// TODO: [dev] maybe we should recognize standard protocols?
|
|
2808
2813
|
coin = new Coin(item.name, ticker, code, defaultDecimalPlacesForCoinNotSupportedOOB, null, "", null, null, defaultMinConfirmationsForCoinNotSupportedOOB, null, [], 60000, null,
|
|
2809
2814
|
// We cannot recognize blockchain from swapspace data
|
|
2810
|
-
code !== network ? new Protocol(network) : null,
|
|
2811
|
-
// TODO: [dev] maybe we should recognize standard protocols?
|
|
2812
|
-
item.contractAddress || null, false);
|
|
2815
|
+
code !== network ? new Protocol(network) : null, item.contractAddress || null, false);
|
|
2813
2816
|
}
|
|
2814
2817
|
if (coin) {
|
|
2815
2818
|
var _item$deposit, _item$withdrawal, _item$validationRegex;
|
|
@@ -3147,6 +3150,7 @@ class SwapspaceSwapProvider extends SwapProvider {
|
|
|
3147
3150
|
};
|
|
3148
3151
|
const responses = await Promise.all(swapIds.map(swapId => getNotFailingOn404(swapId)));
|
|
3149
3152
|
const wo404 = responses.flat();
|
|
3153
|
+
Logger.log("All swaps RAW: " + JSON.stringify(wo404.map(r => r.data)), loggerSource);
|
|
3150
3154
|
const swaps = wo404.map(r => r.data).map((swap, index) => {
|
|
3151
3155
|
var _this$_supportedCoins11, _this$_supportedCoins12;
|
|
3152
3156
|
const fromCoin = (_this$_supportedCoins11 = this._supportedCoins.find(i => i.code === swap.from.code && i.network === swap.from.network)) == null ? void 0 : _this$_supportedCoins11.coin;
|
|
@@ -3325,8 +3329,8 @@ class SwapUtils {
|
|
|
3325
3329
|
}
|
|
3326
3330
|
|
|
3327
3331
|
class PublicSwapService {
|
|
3328
|
-
constructor(
|
|
3329
|
-
this._swapProvider = new SwapspaceSwapProvider(
|
|
3332
|
+
constructor(apiKeysProxyUrl, cache) {
|
|
3333
|
+
this._swapProvider = new SwapspaceSwapProvider(apiKeysProxyUrl, cache, () => null, false);
|
|
3330
3334
|
}
|
|
3331
3335
|
async initialize() {
|
|
3332
3336
|
try {
|
|
@@ -3382,7 +3386,7 @@ class PublicSwapService {
|
|
|
3382
3386
|
reason: PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
3383
3387
|
};
|
|
3384
3388
|
}
|
|
3385
|
-
Logger.log(`Retrieved ${result == null || (_result$coins2 = result.coins) == null ? void 0 : _result$coins2.length} supported currencies for swap`, loggerSource);
|
|
3389
|
+
Logger.log(`Retrieved ${result == null || (_result$coins2 = result.coins) == null ? void 0 : _result$coins2.length} supported currencies for swap (withdraw=${withdraw})`, loggerSource);
|
|
3386
3390
|
return {
|
|
3387
3391
|
result: true,
|
|
3388
3392
|
coins: result.coins
|