@rabbitio/ui-kit 1.0.0-beta.16 → 1.0.0-beta.18
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 +81 -57
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +38 -24
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +80 -57
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +84 -61
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/common/utils/logging/logger.js +1 -1
- package/src/swaps-lib/external-apis/swapspaceSwapProvider.js +8 -6
- package/src/swaps-lib/services/publicSwapService.js +40 -23
- package/src/swaps-lib/utils/swapUtils.js +4 -3
package/dist/index.module.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useState, useRef, useEffect, useCallback } from 'react';
|
|
2
2
|
import { BigNumber } from 'bignumber.js';
|
|
3
3
|
import axios from 'axios';
|
|
4
|
+
import EventBusInstance from 'eventbusjs';
|
|
4
5
|
|
|
5
6
|
function createCommonjsModule(fn) {
|
|
6
7
|
var module = { exports: {} };
|
|
@@ -1604,7 +1605,7 @@ var Logger = /*#__PURE__*/function () {
|
|
|
1604
1605
|
}
|
|
1605
1606
|
var finalErrorText = message + ". " + safeStringify(e);
|
|
1606
1607
|
// eslint-disable-next-line no-console
|
|
1607
|
-
console.error(finalErrorText);
|
|
1608
|
+
console.error(finalErrorText, e);
|
|
1608
1609
|
if (!onlyToConsole) {
|
|
1609
1610
|
this.log(finalErrorText, "logError");
|
|
1610
1611
|
}
|
|
@@ -3369,7 +3370,7 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
|
|
|
3369
3370
|
});
|
|
3370
3371
|
}, function (e) {
|
|
3371
3372
|
var _e$response4, _e$response5;
|
|
3372
|
-
Logger.
|
|
3373
|
+
Logger.logError(e, loggerSource, "Failed to create swap. Error is: " + safeStringify(e));
|
|
3373
3374
|
var composeFailResult = function composeFailResult(reason) {
|
|
3374
3375
|
return {
|
|
3375
3376
|
result: false,
|
|
@@ -3478,7 +3479,7 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
|
|
|
3478
3479
|
});
|
|
3479
3480
|
}, function (e) {
|
|
3480
3481
|
var _e$response6, _e$response7;
|
|
3481
|
-
Logger.
|
|
3482
|
+
Logger.logError(e, loggerSource, "Failed to get swap details. Error is: " + safeStringify(e));
|
|
3482
3483
|
var composeFailResult = function composeFailResult(reason) {
|
|
3483
3484
|
return {
|
|
3484
3485
|
result: false,
|
|
@@ -3754,7 +3755,7 @@ var SwapUtils = /*#__PURE__*/function () {
|
|
|
3754
3755
|
});
|
|
3755
3756
|
});
|
|
3756
3757
|
}, function (e) {
|
|
3757
|
-
Logger.
|
|
3758
|
+
Logger.logError(e, loggerSource, "Failed to init swap: " + safeStringify(e));
|
|
3758
3759
|
improveAndRethrow(e, loggerSource);
|
|
3759
3760
|
}));
|
|
3760
3761
|
} catch (e) {
|
|
@@ -3854,9 +3855,7 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
3854
3855
|
try {
|
|
3855
3856
|
var _this = this;
|
|
3856
3857
|
var _temp = _catch(function () {
|
|
3857
|
-
return Promise.resolve(_this._swapProvider.initialize()).then(function () {
|
|
3858
|
-
SwapUtils.safeHandleRequestsLimitExceeding();
|
|
3859
|
-
});
|
|
3858
|
+
return Promise.resolve(_this._swapProvider.initialize()).then(function () {});
|
|
3860
3859
|
}, function (e) {
|
|
3861
3860
|
Logger.logError(e, "PublicSwapService.initialize");
|
|
3862
3861
|
});
|
|
@@ -3865,22 +3864,45 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
3865
3864
|
return Promise.reject(e);
|
|
3866
3865
|
}
|
|
3867
3866
|
};
|
|
3868
|
-
_proto.
|
|
3869
|
-
if (currencyThatShouldNotBeFirst === void 0) {
|
|
3870
|
-
currencyThatShouldNotBeFirst = null;
|
|
3871
|
-
}
|
|
3867
|
+
_proto.getDepositCurrenciesListForPublicSwap = function getDepositCurrenciesListForPublicSwap() {
|
|
3872
3868
|
try {
|
|
3873
3869
|
var _this2 = this;
|
|
3870
|
+
return Promise.resolve(_catch(function () {
|
|
3871
|
+
return Promise.resolve(_this2._getCurrenciesListForPublicSwap(false));
|
|
3872
|
+
}, function (e) {
|
|
3873
|
+
improveAndRethrow(e, "getDepositCurrenciesListForPublicSwap");
|
|
3874
|
+
}));
|
|
3875
|
+
} catch (e) {
|
|
3876
|
+
return Promise.reject(e);
|
|
3877
|
+
}
|
|
3878
|
+
};
|
|
3879
|
+
_proto.getWithdrawCurrenciesListForPublicSwap = function getWithdrawCurrenciesListForPublicSwap() {
|
|
3880
|
+
try {
|
|
3881
|
+
var _this3 = this;
|
|
3882
|
+
return Promise.resolve(_catch(function () {
|
|
3883
|
+
return Promise.resolve(_this3._getCurrenciesListForPublicSwap(true));
|
|
3884
|
+
}, function (e) {
|
|
3885
|
+
improveAndRethrow(e, "getWithdrawCurrenciesListForPublicSwap");
|
|
3886
|
+
}));
|
|
3887
|
+
} catch (e) {
|
|
3888
|
+
return Promise.reject(e);
|
|
3889
|
+
}
|
|
3890
|
+
};
|
|
3891
|
+
_proto._getCurrenciesListForPublicSwap = function _getCurrenciesListForPublicSwap(withdraw) {
|
|
3892
|
+
if (withdraw === void 0) {
|
|
3893
|
+
withdraw = false;
|
|
3894
|
+
}
|
|
3895
|
+
try {
|
|
3896
|
+
var _this4 = this;
|
|
3874
3897
|
var loggerSource = "getCurrenciesListForPublicSwap";
|
|
3875
3898
|
return Promise.resolve(_catch(function () {
|
|
3876
|
-
|
|
3877
|
-
return Promise.resolve(currencyThatShouldNotBeFirst ? _this2._swapProvider.getWithdrawalCurrencies(currencyThatShouldNotBeFirst) : _this2._swapProvider.getDepositCurrencies()).then(function (result) {
|
|
3899
|
+
return Promise.resolve(withdraw ? _this4._swapProvider.getWithdrawalCurrencies() : _this4._swapProvider.getDepositCurrencies()).then(function (result) {
|
|
3878
3900
|
var _result$coins;
|
|
3879
3901
|
if (result.reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) {
|
|
3880
3902
|
SwapUtils.safeHandleRequestsLimitExceeding();
|
|
3881
3903
|
return {
|
|
3882
3904
|
result: false,
|
|
3883
|
-
reason:
|
|
3905
|
+
reason: PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
3884
3906
|
};
|
|
3885
3907
|
}
|
|
3886
3908
|
Logger.log("Retrieved " + (result == null || (_result$coins = result.coins) == null ? void 0 : _result$coins.length) + " supported currencies for swap", loggerSource);
|
|
@@ -3921,21 +3943,21 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
3921
3943
|
;
|
|
3922
3944
|
_proto.getInitialPublicSwapData = function getInitialPublicSwapData(fromCoin, toCoin) {
|
|
3923
3945
|
try {
|
|
3924
|
-
var
|
|
3946
|
+
var _this5 = this;
|
|
3925
3947
|
return Promise.resolve(_catch(function () {
|
|
3926
|
-
return Promise.resolve(SwapUtils.getInitialSwapData(
|
|
3948
|
+
return Promise.resolve(SwapUtils.getInitialSwapData(_this5._swapProvider, fromCoin, toCoin)).then(function (result) {
|
|
3927
3949
|
if (!result.result) {
|
|
3928
3950
|
if (result.reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) {
|
|
3929
3951
|
SwapUtils.safeHandleRequestsLimitExceeding();
|
|
3930
3952
|
return {
|
|
3931
3953
|
result: false,
|
|
3932
|
-
reason:
|
|
3954
|
+
reason: PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
3933
3955
|
};
|
|
3934
3956
|
}
|
|
3935
3957
|
if (result.reason === SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED) {
|
|
3936
3958
|
return {
|
|
3937
3959
|
result: false,
|
|
3938
|
-
reason:
|
|
3960
|
+
reason: PublicSwapService.PUBLIC_SWAP_DETAILS_FAIL_REASONS.PAIR_NOT_SUPPORTED
|
|
3939
3961
|
};
|
|
3940
3962
|
}
|
|
3941
3963
|
}
|
|
@@ -3970,13 +3992,13 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
3970
3992
|
;
|
|
3971
3993
|
_proto.getPublicSwapDetails = function getPublicSwapDetails(fromCoin, toCoin, fromAmountCoins) {
|
|
3972
3994
|
try {
|
|
3973
|
-
var
|
|
3995
|
+
var _this6 = this;
|
|
3974
3996
|
var loggerSource = "getPublicSwapDetails";
|
|
3975
3997
|
return Promise.resolve(_catch(function () {
|
|
3976
|
-
return Promise.resolve(
|
|
3977
|
-
var
|
|
3978
|
-
var coinUsdtRate = (
|
|
3979
|
-
return Promise.resolve(
|
|
3998
|
+
return Promise.resolve(_this6._swapProvider.getCoinToUSDTRate(fromCoin)).then(function (_this6$_swapProvider$) {
|
|
3999
|
+
var _this6$_swapProvider$2;
|
|
4000
|
+
var coinUsdtRate = (_this6$_swapProvider$2 = _this6$_swapProvider$ == null ? void 0 : _this6$_swapProvider$.rate) != null ? _this6$_swapProvider$2 : null;
|
|
4001
|
+
return Promise.resolve(_this6._swapProvider.getSwapInfo(fromCoin, toCoin, fromAmountCoins, coinUsdtRate)).then(function (details) {
|
|
3980
4002
|
var _result$swapCreationI, _result$swapCreationI2;
|
|
3981
4003
|
var min = details.result ? details.min : details.smallestMin;
|
|
3982
4004
|
var max = details.result ? details.max : details.greatestMax;
|
|
@@ -3984,10 +4006,10 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
3984
4006
|
fiatMax = null;
|
|
3985
4007
|
if (coinUsdtRate != null) {
|
|
3986
4008
|
if (min != null) {
|
|
3987
|
-
fiatMin = BigNumber(min).times(coinUsdtRate).toFixed(
|
|
4009
|
+
fiatMin = BigNumber(min).times(coinUsdtRate).toFixed(PublicSwapService._fiatDecimalsCount);
|
|
3988
4010
|
}
|
|
3989
4011
|
if (max != null) {
|
|
3990
|
-
fiatMax = BigNumber(max).times(coinUsdtRate).toFixed(
|
|
4012
|
+
fiatMax = BigNumber(max).times(coinUsdtRate).toFixed(PublicSwapService._fiatDecimalsCount);
|
|
3991
4013
|
}
|
|
3992
4014
|
}
|
|
3993
4015
|
var composeFailResult = function composeFailResult(reason) {
|
|
@@ -4003,16 +4025,16 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
4003
4025
|
};
|
|
4004
4026
|
};
|
|
4005
4027
|
if (!details.result) {
|
|
4006
|
-
if ((details == null ? void 0 : details.reason) === SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED) return composeFailResult(
|
|
4028
|
+
if ((details == null ? void 0 : details.reason) === SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED) return composeFailResult(PublicSwapService.PUBLIC_SWAP_DETAILS_FAIL_REASONS.PAIR_NOT_SUPPORTED);else if ((details == null ? void 0 : details.reason) === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) {
|
|
4007
4029
|
SwapUtils.safeHandleRequestsLimitExceeding();
|
|
4008
|
-
return composeFailResult(
|
|
4030
|
+
return composeFailResult(PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED);
|
|
4009
4031
|
}
|
|
4010
4032
|
}
|
|
4011
4033
|
var fromAmountBigNumber = BigNumber(fromAmountCoins);
|
|
4012
4034
|
if (typeof min === "string" && fromAmountBigNumber.lt(min)) {
|
|
4013
|
-
return composeFailResult(
|
|
4035
|
+
return composeFailResult(PublicSwapService.PUBLIC_SWAP_DETAILS_FAIL_REASONS.AMOUNT_LESS_THAN_MIN_SWAPPABLE);
|
|
4014
4036
|
} else if (typeof max === "string" && fromAmountBigNumber.gt(max)) {
|
|
4015
|
-
return composeFailResult(
|
|
4037
|
+
return composeFailResult(PublicSwapService.PUBLIC_SWAP_DETAILS_FAIL_REASONS.AMOUNT_HIGHER_THAN_MAX_SWAPPABLE);
|
|
4016
4038
|
}
|
|
4017
4039
|
var toAmountCoins = AmountUtils.trim(fromAmountBigNumber.times(details.rate), fromCoin.digits);
|
|
4018
4040
|
var result = {
|
|
@@ -4045,6 +4067,7 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
4045
4067
|
* @param swapCreationInfo {BaseSwapCreationInfo}
|
|
4046
4068
|
* @param toAddress {string}
|
|
4047
4069
|
* @param refundAddress {string}
|
|
4070
|
+
* @param clientIp {string}
|
|
4048
4071
|
* @return {Promise<{
|
|
4049
4072
|
* result: true,
|
|
4050
4073
|
* fiatCurrencyCode: string,
|
|
@@ -4067,7 +4090,7 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
4067
4090
|
;
|
|
4068
4091
|
_proto.createPublicSwap = function createPublicSwap(fromCoin, toCoin, fromAmount, swapCreationInfo, toAddress, refundAddress, clientIp) {
|
|
4069
4092
|
try {
|
|
4070
|
-
var
|
|
4093
|
+
var _this7 = this;
|
|
4071
4094
|
var loggerSource = "createPublicSwap";
|
|
4072
4095
|
return Promise.resolve(_catch(function () {
|
|
4073
4096
|
var _swapCreationInfo$fro, _swapCreationInfo$toC;
|
|
@@ -4078,10 +4101,10 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
4078
4101
|
fromCoin: swapCreationInfo == null || (_swapCreationInfo$fro = swapCreationInfo.fromCoin) == null ? void 0 : _swapCreationInfo$fro.ticker,
|
|
4079
4102
|
toCoin: swapCreationInfo == null || (_swapCreationInfo$toC = swapCreationInfo.toCoin) == null ? void 0 : _swapCreationInfo$toC.ticker
|
|
4080
4103
|
})), loggerSource);
|
|
4081
|
-
return Promise.resolve(
|
|
4104
|
+
return Promise.resolve(_this7._swapProvider.createSwap(fromCoin, toCoin, fromAmount, toAddress, refundAddress, swapCreationInfo.rawSwapData, clientIp)).then(function (result) {
|
|
4082
4105
|
var _exit;
|
|
4083
|
-
function _temp5(
|
|
4084
|
-
if (_exit) return
|
|
4106
|
+
function _temp5(_result7) {
|
|
4107
|
+
if (_exit) return _result7;
|
|
4085
4108
|
throw new Error("Unexpected result from provider " + safeStringify(result));
|
|
4086
4109
|
}
|
|
4087
4110
|
Logger.log("Created:" + safeStringify(_extends({}, result, {
|
|
@@ -4093,21 +4116,21 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
4093
4116
|
SwapUtils.safeHandleRequestsLimitExceeding();
|
|
4094
4117
|
return {
|
|
4095
4118
|
result: false,
|
|
4096
|
-
reason:
|
|
4119
|
+
reason: PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
4097
4120
|
};
|
|
4098
4121
|
}
|
|
4099
4122
|
if ((result == null ? void 0 : result.reason) === SwapProvider.CREATION_FAIL_REASONS.RETRIABLE_FAIL) {
|
|
4100
4123
|
// TODO: [feature, high] implement retrying if one partner fail and we have another partners task_id=a07e367e488f4a4899613ac9056fa359
|
|
4101
4124
|
// return {
|
|
4102
4125
|
// result: false,
|
|
4103
|
-
// reason:
|
|
4126
|
+
// reason: PublicSwapService.SWAP_CREATION_FAIL_REASONS.RETRIABLE_FAIL,
|
|
4104
4127
|
// };
|
|
4105
4128
|
}
|
|
4106
4129
|
}
|
|
4107
4130
|
var _temp4 = function () {
|
|
4108
4131
|
if (result.result && result != null && result.swapId) {
|
|
4109
4132
|
var _temp3 = function _temp3() {
|
|
4110
|
-
EventBusInstance.dispatch(
|
|
4133
|
+
EventBusInstance.dispatch(PublicSwapService.PUBLIC_SWAP_CREATED_EVENT, null, fromCoin.ticker, toCoin.ticker, _fromAmountFiat);
|
|
4111
4134
|
var toReturn = {
|
|
4112
4135
|
result: true,
|
|
4113
4136
|
swapId: result.swapId,
|
|
@@ -4118,12 +4141,12 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
4118
4141
|
fromAmountFiat: _fromAmountFiat,
|
|
4119
4142
|
toAmountFiat: _toAmountFiat,
|
|
4120
4143
|
fiatCurrencyCode: "USD",
|
|
4121
|
-
fiatCurrencyDecimals:
|
|
4144
|
+
fiatCurrencyDecimals: PublicSwapService._fiatDecimalsCount,
|
|
4122
4145
|
rate: result.rate,
|
|
4123
4146
|
durationMinutesRange: swapCreationInfo.durationMinutesRange,
|
|
4124
4147
|
address: result.fromAddress // CRITICAL: this is the address to send coins to swaps provider
|
|
4125
4148
|
};
|
|
4126
|
-
|
|
4149
|
+
_this7._savePublicSwapIdLocally(result.swapId);
|
|
4127
4150
|
Logger.log("Returning: " + safeStringify(_extends({}, toReturn, {
|
|
4128
4151
|
fromCoin: fromCoin == null ? void 0 : fromCoin.ticker,
|
|
4129
4152
|
toCoin: toCoin == null ? void 0 : toCoin.ticker
|
|
@@ -4134,17 +4157,17 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
4134
4157
|
var _fromAmountFiat = null,
|
|
4135
4158
|
_toAmountFiat = null;
|
|
4136
4159
|
var _temp2 = _catch(function () {
|
|
4137
|
-
return Promise.resolve(
|
|
4138
|
-
var
|
|
4139
|
-
var fromCoinUsdtRate = (
|
|
4140
|
-
return Promise.resolve(
|
|
4141
|
-
var
|
|
4142
|
-
var toCoinUsdtRate = (
|
|
4160
|
+
return Promise.resolve(_this7._swapProvider.getCoinToUSDTRate(fromCoin)).then(function (_this7$_swapProvider$) {
|
|
4161
|
+
var _this7$_swapProvider$3;
|
|
4162
|
+
var fromCoinUsdtRate = (_this7$_swapProvider$3 = _this7$_swapProvider$ == null ? void 0 : _this7$_swapProvider$.rate) != null ? _this7$_swapProvider$3 : null;
|
|
4163
|
+
return Promise.resolve(_this7._swapProvider.getCoinToUSDTRate(fromCoin)).then(function (_this7$_swapProvider$2) {
|
|
4164
|
+
var _this7$_swapProvider$4;
|
|
4165
|
+
var toCoinUsdtRate = (_this7$_swapProvider$4 = _this7$_swapProvider$2 == null ? void 0 : _this7$_swapProvider$2.rate) != null ? _this7$_swapProvider$4 : null;
|
|
4143
4166
|
if (fromCoinUsdtRate != null && result.fromAmount != null) {
|
|
4144
|
-
_fromAmountFiat = BigNumber(result.fromAmount).times(fromCoinUsdtRate).toFixed(
|
|
4167
|
+
_fromAmountFiat = BigNumber(result.fromAmount).times(fromCoinUsdtRate).toFixed(PublicSwapService._fiatDecimalsCount);
|
|
4145
4168
|
}
|
|
4146
4169
|
if (toCoinUsdtRate != null && result.toAmount != null) {
|
|
4147
|
-
_toAmountFiat = BigNumber(result.toAmount).times(toCoinUsdtRate).toFixed(
|
|
4170
|
+
_toAmountFiat = BigNumber(result.toAmount).times(toCoinUsdtRate).toFixed(PublicSwapService._fiatDecimalsCount);
|
|
4148
4171
|
}
|
|
4149
4172
|
});
|
|
4150
4173
|
});
|
|
@@ -4179,16 +4202,16 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
4179
4202
|
;
|
|
4180
4203
|
_proto.getPublicExistingSwapDetailsAndStatus = function getPublicExistingSwapDetailsAndStatus(swapIds) {
|
|
4181
4204
|
try {
|
|
4182
|
-
var
|
|
4205
|
+
var _this8 = this;
|
|
4183
4206
|
var loggerSource = "getPublicExistingSwapDetailsAndStatus";
|
|
4184
4207
|
return Promise.resolve(_catch(function () {
|
|
4185
|
-
return Promise.resolve(SwapUtils.getExistingSwapsDetailsWithFiatAmounts(
|
|
4208
|
+
return Promise.resolve(SwapUtils.getExistingSwapsDetailsWithFiatAmounts(_this8._swapProvider, swapIds)).then(function (result) {
|
|
4186
4209
|
if (!(result != null && result.result)) {
|
|
4187
4210
|
if (result.reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) {
|
|
4188
4211
|
SwapUtils.safeHandleRequestsLimitExceeding();
|
|
4189
4212
|
return {
|
|
4190
4213
|
result: false,
|
|
4191
|
-
reason:
|
|
4214
|
+
reason: PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
4192
4215
|
};
|
|
4193
4216
|
}
|
|
4194
4217
|
throw new Error("Unknown reason: " + (result == null ? void 0 : result.reason));
|
|
@@ -4217,20 +4240,20 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
4217
4240
|
_proto.getPublicSwapsHistory = function getPublicSwapsHistory() {
|
|
4218
4241
|
try {
|
|
4219
4242
|
var _exit2;
|
|
4220
|
-
var
|
|
4243
|
+
var _this9 = this;
|
|
4221
4244
|
return Promise.resolve(_catch(function () {
|
|
4222
|
-
function _temp7(
|
|
4223
|
-
return _exit2 ?
|
|
4245
|
+
function _temp7(_result9) {
|
|
4246
|
+
return _exit2 ? _result9 : {
|
|
4224
4247
|
result: true,
|
|
4225
4248
|
swaps: []
|
|
4226
4249
|
};
|
|
4227
4250
|
}
|
|
4228
|
-
var swapIds =
|
|
4251
|
+
var swapIds = _this9._getPublicSwapIdsSavedLocally();
|
|
4229
4252
|
var _temp6 = function () {
|
|
4230
4253
|
if (swapIds.length) {
|
|
4231
|
-
return Promise.resolve(
|
|
4254
|
+
return Promise.resolve(_this9.getPublicExistingSwapDetailsAndStatus(swapIds)).then(function (_await$_this9$getPubl) {
|
|
4232
4255
|
_exit2 = 1;
|
|
4233
|
-
return _await$
|
|
4256
|
+
return _await$_this9$getPubl;
|
|
4234
4257
|
});
|
|
4235
4258
|
}
|
|
4236
4259
|
}();
|
|
@@ -4298,9 +4321,9 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
4298
4321
|
*/;
|
|
4299
4322
|
_proto.getAssetToUsdtRate = function getAssetToUsdtRate(asset) {
|
|
4300
4323
|
try {
|
|
4301
|
-
var
|
|
4324
|
+
var _this10 = this;
|
|
4302
4325
|
return Promise.resolve(_catch(function () {
|
|
4303
|
-
return Promise.resolve(
|
|
4326
|
+
return Promise.resolve(_this10._swapProvider.getCoinToUSDTRate(asset)).then(function (result) {
|
|
4304
4327
|
var _result$rate;
|
|
4305
4328
|
return (_result$rate = result == null ? void 0 : result.rate) != null ? _result$rate : null;
|
|
4306
4329
|
});
|