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