@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.cjs
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
var React = require('react');
|
|
2
2
|
var bignumber_js = require('bignumber.js');
|
|
3
3
|
var axios = require('axios');
|
|
4
|
+
var EventBusInstance = require('eventbusjs');
|
|
4
5
|
|
|
5
6
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
6
7
|
|
|
7
8
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
8
9
|
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
10
|
+
var EventBusInstance__default = /*#__PURE__*/_interopDefaultLegacy(EventBusInstance);
|
|
9
11
|
|
|
10
12
|
function createCommonjsModule(fn) {
|
|
11
13
|
var module = { exports: {} };
|
|
@@ -1609,7 +1611,7 @@ var Logger = /*#__PURE__*/function () {
|
|
|
1609
1611
|
}
|
|
1610
1612
|
var finalErrorText = message + ". " + safeStringify(e);
|
|
1611
1613
|
// eslint-disable-next-line no-console
|
|
1612
|
-
console.error(finalErrorText);
|
|
1614
|
+
console.error(finalErrorText, e);
|
|
1613
1615
|
if (!onlyToConsole) {
|
|
1614
1616
|
this.log(finalErrorText, "logError");
|
|
1615
1617
|
}
|
|
@@ -3374,7 +3376,7 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
|
|
|
3374
3376
|
});
|
|
3375
3377
|
}, function (e) {
|
|
3376
3378
|
var _e$response4, _e$response5;
|
|
3377
|
-
Logger.
|
|
3379
|
+
Logger.logError(e, loggerSource, "Failed to create swap. Error is: " + safeStringify(e));
|
|
3378
3380
|
var composeFailResult = function composeFailResult(reason) {
|
|
3379
3381
|
return {
|
|
3380
3382
|
result: false,
|
|
@@ -3483,7 +3485,7 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
|
|
|
3483
3485
|
});
|
|
3484
3486
|
}, function (e) {
|
|
3485
3487
|
var _e$response6, _e$response7;
|
|
3486
|
-
Logger.
|
|
3488
|
+
Logger.logError(e, loggerSource, "Failed to get swap details. Error is: " + safeStringify(e));
|
|
3487
3489
|
var composeFailResult = function composeFailResult(reason) {
|
|
3488
3490
|
return {
|
|
3489
3491
|
result: false,
|
|
@@ -3759,7 +3761,7 @@ var SwapUtils = /*#__PURE__*/function () {
|
|
|
3759
3761
|
});
|
|
3760
3762
|
});
|
|
3761
3763
|
}, function (e) {
|
|
3762
|
-
Logger.
|
|
3764
|
+
Logger.logError(e, loggerSource, "Failed to init swap: " + safeStringify(e));
|
|
3763
3765
|
improveAndRethrow(e, loggerSource);
|
|
3764
3766
|
}));
|
|
3765
3767
|
} catch (e) {
|
|
@@ -3859,9 +3861,7 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
3859
3861
|
try {
|
|
3860
3862
|
var _this = this;
|
|
3861
3863
|
var _temp = _catch(function () {
|
|
3862
|
-
return Promise.resolve(_this._swapProvider.initialize()).then(function () {
|
|
3863
|
-
SwapUtils.safeHandleRequestsLimitExceeding();
|
|
3864
|
-
});
|
|
3864
|
+
return Promise.resolve(_this._swapProvider.initialize()).then(function () {});
|
|
3865
3865
|
}, function (e) {
|
|
3866
3866
|
Logger.logError(e, "PublicSwapService.initialize");
|
|
3867
3867
|
});
|
|
@@ -3870,22 +3870,45 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
3870
3870
|
return Promise.reject(e);
|
|
3871
3871
|
}
|
|
3872
3872
|
};
|
|
3873
|
-
_proto.
|
|
3874
|
-
if (currencyThatShouldNotBeFirst === void 0) {
|
|
3875
|
-
currencyThatShouldNotBeFirst = null;
|
|
3876
|
-
}
|
|
3873
|
+
_proto.getDepositCurrenciesListForPublicSwap = function getDepositCurrenciesListForPublicSwap() {
|
|
3877
3874
|
try {
|
|
3878
3875
|
var _this2 = this;
|
|
3876
|
+
return Promise.resolve(_catch(function () {
|
|
3877
|
+
return Promise.resolve(_this2._getCurrenciesListForPublicSwap(false));
|
|
3878
|
+
}, function (e) {
|
|
3879
|
+
improveAndRethrow(e, "getDepositCurrenciesListForPublicSwap");
|
|
3880
|
+
}));
|
|
3881
|
+
} catch (e) {
|
|
3882
|
+
return Promise.reject(e);
|
|
3883
|
+
}
|
|
3884
|
+
};
|
|
3885
|
+
_proto.getWithdrawCurrenciesListForPublicSwap = function getWithdrawCurrenciesListForPublicSwap() {
|
|
3886
|
+
try {
|
|
3887
|
+
var _this3 = this;
|
|
3888
|
+
return Promise.resolve(_catch(function () {
|
|
3889
|
+
return Promise.resolve(_this3._getCurrenciesListForPublicSwap(true));
|
|
3890
|
+
}, function (e) {
|
|
3891
|
+
improveAndRethrow(e, "getWithdrawCurrenciesListForPublicSwap");
|
|
3892
|
+
}));
|
|
3893
|
+
} catch (e) {
|
|
3894
|
+
return Promise.reject(e);
|
|
3895
|
+
}
|
|
3896
|
+
};
|
|
3897
|
+
_proto._getCurrenciesListForPublicSwap = function _getCurrenciesListForPublicSwap(withdraw) {
|
|
3898
|
+
if (withdraw === void 0) {
|
|
3899
|
+
withdraw = false;
|
|
3900
|
+
}
|
|
3901
|
+
try {
|
|
3902
|
+
var _this4 = this;
|
|
3879
3903
|
var loggerSource = "getCurrenciesListForPublicSwap";
|
|
3880
3904
|
return Promise.resolve(_catch(function () {
|
|
3881
|
-
|
|
3882
|
-
return Promise.resolve(currencyThatShouldNotBeFirst ? _this2._swapProvider.getWithdrawalCurrencies(currencyThatShouldNotBeFirst) : _this2._swapProvider.getDepositCurrencies()).then(function (result) {
|
|
3905
|
+
return Promise.resolve(withdraw ? _this4._swapProvider.getWithdrawalCurrencies() : _this4._swapProvider.getDepositCurrencies()).then(function (result) {
|
|
3883
3906
|
var _result$coins;
|
|
3884
3907
|
if (result.reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) {
|
|
3885
3908
|
SwapUtils.safeHandleRequestsLimitExceeding();
|
|
3886
3909
|
return {
|
|
3887
3910
|
result: false,
|
|
3888
|
-
reason:
|
|
3911
|
+
reason: PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
3889
3912
|
};
|
|
3890
3913
|
}
|
|
3891
3914
|
Logger.log("Retrieved " + (result == null || (_result$coins = result.coins) == null ? void 0 : _result$coins.length) + " supported currencies for swap", loggerSource);
|
|
@@ -3926,21 +3949,21 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
3926
3949
|
;
|
|
3927
3950
|
_proto.getInitialPublicSwapData = function getInitialPublicSwapData(fromCoin, toCoin) {
|
|
3928
3951
|
try {
|
|
3929
|
-
var
|
|
3952
|
+
var _this5 = this;
|
|
3930
3953
|
return Promise.resolve(_catch(function () {
|
|
3931
|
-
return Promise.resolve(SwapUtils.getInitialSwapData(
|
|
3954
|
+
return Promise.resolve(SwapUtils.getInitialSwapData(_this5._swapProvider, fromCoin, toCoin)).then(function (result) {
|
|
3932
3955
|
if (!result.result) {
|
|
3933
3956
|
if (result.reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) {
|
|
3934
3957
|
SwapUtils.safeHandleRequestsLimitExceeding();
|
|
3935
3958
|
return {
|
|
3936
3959
|
result: false,
|
|
3937
|
-
reason:
|
|
3960
|
+
reason: PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
3938
3961
|
};
|
|
3939
3962
|
}
|
|
3940
3963
|
if (result.reason === SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED) {
|
|
3941
3964
|
return {
|
|
3942
3965
|
result: false,
|
|
3943
|
-
reason:
|
|
3966
|
+
reason: PublicSwapService.PUBLIC_SWAP_DETAILS_FAIL_REASONS.PAIR_NOT_SUPPORTED
|
|
3944
3967
|
};
|
|
3945
3968
|
}
|
|
3946
3969
|
}
|
|
@@ -3975,13 +3998,13 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
3975
3998
|
;
|
|
3976
3999
|
_proto.getPublicSwapDetails = function getPublicSwapDetails(fromCoin, toCoin, fromAmountCoins) {
|
|
3977
4000
|
try {
|
|
3978
|
-
var
|
|
4001
|
+
var _this6 = this;
|
|
3979
4002
|
var loggerSource = "getPublicSwapDetails";
|
|
3980
4003
|
return Promise.resolve(_catch(function () {
|
|
3981
|
-
return Promise.resolve(
|
|
3982
|
-
var
|
|
3983
|
-
var coinUsdtRate = (
|
|
3984
|
-
return Promise.resolve(
|
|
4004
|
+
return Promise.resolve(_this6._swapProvider.getCoinToUSDTRate(fromCoin)).then(function (_this6$_swapProvider$) {
|
|
4005
|
+
var _this6$_swapProvider$2;
|
|
4006
|
+
var coinUsdtRate = (_this6$_swapProvider$2 = _this6$_swapProvider$ == null ? void 0 : _this6$_swapProvider$.rate) != null ? _this6$_swapProvider$2 : null;
|
|
4007
|
+
return Promise.resolve(_this6._swapProvider.getSwapInfo(fromCoin, toCoin, fromAmountCoins, coinUsdtRate)).then(function (details) {
|
|
3985
4008
|
var _result$swapCreationI, _result$swapCreationI2;
|
|
3986
4009
|
var min = details.result ? details.min : details.smallestMin;
|
|
3987
4010
|
var max = details.result ? details.max : details.greatestMax;
|
|
@@ -3989,10 +4012,10 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
3989
4012
|
fiatMax = null;
|
|
3990
4013
|
if (coinUsdtRate != null) {
|
|
3991
4014
|
if (min != null) {
|
|
3992
|
-
fiatMin = bignumber_js.BigNumber(min).times(coinUsdtRate).toFixed(
|
|
4015
|
+
fiatMin = bignumber_js.BigNumber(min).times(coinUsdtRate).toFixed(PublicSwapService._fiatDecimalsCount);
|
|
3993
4016
|
}
|
|
3994
4017
|
if (max != null) {
|
|
3995
|
-
fiatMax = bignumber_js.BigNumber(max).times(coinUsdtRate).toFixed(
|
|
4018
|
+
fiatMax = bignumber_js.BigNumber(max).times(coinUsdtRate).toFixed(PublicSwapService._fiatDecimalsCount);
|
|
3996
4019
|
}
|
|
3997
4020
|
}
|
|
3998
4021
|
var composeFailResult = function composeFailResult(reason) {
|
|
@@ -4008,16 +4031,16 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
4008
4031
|
};
|
|
4009
4032
|
};
|
|
4010
4033
|
if (!details.result) {
|
|
4011
|
-
if ((details == null ? void 0 : details.reason) === SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED) return composeFailResult(
|
|
4034
|
+
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) {
|
|
4012
4035
|
SwapUtils.safeHandleRequestsLimitExceeding();
|
|
4013
|
-
return composeFailResult(
|
|
4036
|
+
return composeFailResult(PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED);
|
|
4014
4037
|
}
|
|
4015
4038
|
}
|
|
4016
4039
|
var fromAmountBigNumber = bignumber_js.BigNumber(fromAmountCoins);
|
|
4017
4040
|
if (typeof min === "string" && fromAmountBigNumber.lt(min)) {
|
|
4018
|
-
return composeFailResult(
|
|
4041
|
+
return composeFailResult(PublicSwapService.PUBLIC_SWAP_DETAILS_FAIL_REASONS.AMOUNT_LESS_THAN_MIN_SWAPPABLE);
|
|
4019
4042
|
} else if (typeof max === "string" && fromAmountBigNumber.gt(max)) {
|
|
4020
|
-
return composeFailResult(
|
|
4043
|
+
return composeFailResult(PublicSwapService.PUBLIC_SWAP_DETAILS_FAIL_REASONS.AMOUNT_HIGHER_THAN_MAX_SWAPPABLE);
|
|
4021
4044
|
}
|
|
4022
4045
|
var toAmountCoins = AmountUtils.trim(fromAmountBigNumber.times(details.rate), fromCoin.digits);
|
|
4023
4046
|
var result = {
|
|
@@ -4050,6 +4073,7 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
4050
4073
|
* @param swapCreationInfo {BaseSwapCreationInfo}
|
|
4051
4074
|
* @param toAddress {string}
|
|
4052
4075
|
* @param refundAddress {string}
|
|
4076
|
+
* @param clientIp {string}
|
|
4053
4077
|
* @return {Promise<{
|
|
4054
4078
|
* result: true,
|
|
4055
4079
|
* fiatCurrencyCode: string,
|
|
@@ -4072,7 +4096,7 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
4072
4096
|
;
|
|
4073
4097
|
_proto.createPublicSwap = function createPublicSwap(fromCoin, toCoin, fromAmount, swapCreationInfo, toAddress, refundAddress, clientIp) {
|
|
4074
4098
|
try {
|
|
4075
|
-
var
|
|
4099
|
+
var _this7 = this;
|
|
4076
4100
|
var loggerSource = "createPublicSwap";
|
|
4077
4101
|
return Promise.resolve(_catch(function () {
|
|
4078
4102
|
var _swapCreationInfo$fro, _swapCreationInfo$toC;
|
|
@@ -4083,10 +4107,10 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
4083
4107
|
fromCoin: swapCreationInfo == null || (_swapCreationInfo$fro = swapCreationInfo.fromCoin) == null ? void 0 : _swapCreationInfo$fro.ticker,
|
|
4084
4108
|
toCoin: swapCreationInfo == null || (_swapCreationInfo$toC = swapCreationInfo.toCoin) == null ? void 0 : _swapCreationInfo$toC.ticker
|
|
4085
4109
|
})), loggerSource);
|
|
4086
|
-
return Promise.resolve(
|
|
4110
|
+
return Promise.resolve(_this7._swapProvider.createSwap(fromCoin, toCoin, fromAmount, toAddress, refundAddress, swapCreationInfo.rawSwapData, clientIp)).then(function (result) {
|
|
4087
4111
|
var _exit;
|
|
4088
|
-
function _temp5(
|
|
4089
|
-
if (_exit) return
|
|
4112
|
+
function _temp5(_result7) {
|
|
4113
|
+
if (_exit) return _result7;
|
|
4090
4114
|
throw new Error("Unexpected result from provider " + safeStringify(result));
|
|
4091
4115
|
}
|
|
4092
4116
|
Logger.log("Created:" + safeStringify(_extends({}, result, {
|
|
@@ -4098,21 +4122,21 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
4098
4122
|
SwapUtils.safeHandleRequestsLimitExceeding();
|
|
4099
4123
|
return {
|
|
4100
4124
|
result: false,
|
|
4101
|
-
reason:
|
|
4125
|
+
reason: PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
4102
4126
|
};
|
|
4103
4127
|
}
|
|
4104
4128
|
if ((result == null ? void 0 : result.reason) === SwapProvider.CREATION_FAIL_REASONS.RETRIABLE_FAIL) {
|
|
4105
4129
|
// TODO: [feature, high] implement retrying if one partner fail and we have another partners task_id=a07e367e488f4a4899613ac9056fa359
|
|
4106
4130
|
// return {
|
|
4107
4131
|
// result: false,
|
|
4108
|
-
// reason:
|
|
4132
|
+
// reason: PublicSwapService.SWAP_CREATION_FAIL_REASONS.RETRIABLE_FAIL,
|
|
4109
4133
|
// };
|
|
4110
4134
|
}
|
|
4111
4135
|
}
|
|
4112
4136
|
var _temp4 = function () {
|
|
4113
4137
|
if (result.result && result != null && result.swapId) {
|
|
4114
4138
|
var _temp3 = function _temp3() {
|
|
4115
|
-
|
|
4139
|
+
EventBusInstance__default["default"].dispatch(PublicSwapService.PUBLIC_SWAP_CREATED_EVENT, null, fromCoin.ticker, toCoin.ticker, _fromAmountFiat);
|
|
4116
4140
|
var toReturn = {
|
|
4117
4141
|
result: true,
|
|
4118
4142
|
swapId: result.swapId,
|
|
@@ -4123,12 +4147,12 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
4123
4147
|
fromAmountFiat: _fromAmountFiat,
|
|
4124
4148
|
toAmountFiat: _toAmountFiat,
|
|
4125
4149
|
fiatCurrencyCode: "USD",
|
|
4126
|
-
fiatCurrencyDecimals:
|
|
4150
|
+
fiatCurrencyDecimals: PublicSwapService._fiatDecimalsCount,
|
|
4127
4151
|
rate: result.rate,
|
|
4128
4152
|
durationMinutesRange: swapCreationInfo.durationMinutesRange,
|
|
4129
4153
|
address: result.fromAddress // CRITICAL: this is the address to send coins to swaps provider
|
|
4130
4154
|
};
|
|
4131
|
-
|
|
4155
|
+
_this7._savePublicSwapIdLocally(result.swapId);
|
|
4132
4156
|
Logger.log("Returning: " + safeStringify(_extends({}, toReturn, {
|
|
4133
4157
|
fromCoin: fromCoin == null ? void 0 : fromCoin.ticker,
|
|
4134
4158
|
toCoin: toCoin == null ? void 0 : toCoin.ticker
|
|
@@ -4139,17 +4163,17 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
4139
4163
|
var _fromAmountFiat = null,
|
|
4140
4164
|
_toAmountFiat = null;
|
|
4141
4165
|
var _temp2 = _catch(function () {
|
|
4142
|
-
return Promise.resolve(
|
|
4143
|
-
var
|
|
4144
|
-
var fromCoinUsdtRate = (
|
|
4145
|
-
return Promise.resolve(
|
|
4146
|
-
var
|
|
4147
|
-
var toCoinUsdtRate = (
|
|
4166
|
+
return Promise.resolve(_this7._swapProvider.getCoinToUSDTRate(fromCoin)).then(function (_this7$_swapProvider$) {
|
|
4167
|
+
var _this7$_swapProvider$3;
|
|
4168
|
+
var fromCoinUsdtRate = (_this7$_swapProvider$3 = _this7$_swapProvider$ == null ? void 0 : _this7$_swapProvider$.rate) != null ? _this7$_swapProvider$3 : null;
|
|
4169
|
+
return Promise.resolve(_this7._swapProvider.getCoinToUSDTRate(fromCoin)).then(function (_this7$_swapProvider$2) {
|
|
4170
|
+
var _this7$_swapProvider$4;
|
|
4171
|
+
var toCoinUsdtRate = (_this7$_swapProvider$4 = _this7$_swapProvider$2 == null ? void 0 : _this7$_swapProvider$2.rate) != null ? _this7$_swapProvider$4 : null;
|
|
4148
4172
|
if (fromCoinUsdtRate != null && result.fromAmount != null) {
|
|
4149
|
-
_fromAmountFiat = bignumber_js.BigNumber(result.fromAmount).times(fromCoinUsdtRate).toFixed(
|
|
4173
|
+
_fromAmountFiat = bignumber_js.BigNumber(result.fromAmount).times(fromCoinUsdtRate).toFixed(PublicSwapService._fiatDecimalsCount);
|
|
4150
4174
|
}
|
|
4151
4175
|
if (toCoinUsdtRate != null && result.toAmount != null) {
|
|
4152
|
-
_toAmountFiat = bignumber_js.BigNumber(result.toAmount).times(toCoinUsdtRate).toFixed(
|
|
4176
|
+
_toAmountFiat = bignumber_js.BigNumber(result.toAmount).times(toCoinUsdtRate).toFixed(PublicSwapService._fiatDecimalsCount);
|
|
4153
4177
|
}
|
|
4154
4178
|
});
|
|
4155
4179
|
});
|
|
@@ -4184,16 +4208,16 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
4184
4208
|
;
|
|
4185
4209
|
_proto.getPublicExistingSwapDetailsAndStatus = function getPublicExistingSwapDetailsAndStatus(swapIds) {
|
|
4186
4210
|
try {
|
|
4187
|
-
var
|
|
4211
|
+
var _this8 = this;
|
|
4188
4212
|
var loggerSource = "getPublicExistingSwapDetailsAndStatus";
|
|
4189
4213
|
return Promise.resolve(_catch(function () {
|
|
4190
|
-
return Promise.resolve(SwapUtils.getExistingSwapsDetailsWithFiatAmounts(
|
|
4214
|
+
return Promise.resolve(SwapUtils.getExistingSwapsDetailsWithFiatAmounts(_this8._swapProvider, swapIds)).then(function (result) {
|
|
4191
4215
|
if (!(result != null && result.result)) {
|
|
4192
4216
|
if (result.reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) {
|
|
4193
4217
|
SwapUtils.safeHandleRequestsLimitExceeding();
|
|
4194
4218
|
return {
|
|
4195
4219
|
result: false,
|
|
4196
|
-
reason:
|
|
4220
|
+
reason: PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
4197
4221
|
};
|
|
4198
4222
|
}
|
|
4199
4223
|
throw new Error("Unknown reason: " + (result == null ? void 0 : result.reason));
|
|
@@ -4222,20 +4246,20 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
4222
4246
|
_proto.getPublicSwapsHistory = function getPublicSwapsHistory() {
|
|
4223
4247
|
try {
|
|
4224
4248
|
var _exit2;
|
|
4225
|
-
var
|
|
4249
|
+
var _this9 = this;
|
|
4226
4250
|
return Promise.resolve(_catch(function () {
|
|
4227
|
-
function _temp7(
|
|
4228
|
-
return _exit2 ?
|
|
4251
|
+
function _temp7(_result9) {
|
|
4252
|
+
return _exit2 ? _result9 : {
|
|
4229
4253
|
result: true,
|
|
4230
4254
|
swaps: []
|
|
4231
4255
|
};
|
|
4232
4256
|
}
|
|
4233
|
-
var swapIds =
|
|
4257
|
+
var swapIds = _this9._getPublicSwapIdsSavedLocally();
|
|
4234
4258
|
var _temp6 = function () {
|
|
4235
4259
|
if (swapIds.length) {
|
|
4236
|
-
return Promise.resolve(
|
|
4260
|
+
return Promise.resolve(_this9.getPublicExistingSwapDetailsAndStatus(swapIds)).then(function (_await$_this9$getPubl) {
|
|
4237
4261
|
_exit2 = 1;
|
|
4238
|
-
return _await$
|
|
4262
|
+
return _await$_this9$getPubl;
|
|
4239
4263
|
});
|
|
4240
4264
|
}
|
|
4241
4265
|
}();
|
|
@@ -4303,9 +4327,9 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
4303
4327
|
*/;
|
|
4304
4328
|
_proto.getAssetToUsdtRate = function getAssetToUsdtRate(asset) {
|
|
4305
4329
|
try {
|
|
4306
|
-
var
|
|
4330
|
+
var _this10 = this;
|
|
4307
4331
|
return Promise.resolve(_catch(function () {
|
|
4308
|
-
return Promise.resolve(
|
|
4332
|
+
return Promise.resolve(_this10._swapProvider.getCoinToUSDTRate(asset)).then(function (result) {
|
|
4309
4333
|
var _result$rate;
|
|
4310
4334
|
return (_result$rate = result == null ? void 0 : result.rate) != null ? _result$rate : null;
|
|
4311
4335
|
});
|