@rabbitio/ui-kit 1.0.0-beta.32 → 1.0.0-beta.34

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 CHANGED
@@ -2623,18 +2623,24 @@ var ExistingSwap =
2623
2623
  * @param confirmations {number}
2624
2624
  * @param rate {string}
2625
2625
  * @param refundAddress {string}
2626
+ * @param payToAddress {string}
2626
2627
  * @param fromCoin {Coin}
2627
2628
  * @param fromAmount {string}
2628
2629
  * @param fromTransactionId {string}
2630
+ * @param fromTransactionLink {string}
2629
2631
  * @param toCoin {Coin}
2630
2632
  * @param toAmount {string}
2631
2633
  * @param toTransactionId {string|null}
2634
+ * @param toTransactionLink {string}
2632
2635
  * @param toAddress {string}
2633
2636
  * @param partner {string}
2637
+ * @param fromExtraId {string}
2638
+ * @param toExtraId {string}
2639
+ * @param refundExtraId {string}
2634
2640
  */
2635
2641
  function ExistingSwap(swapId, status, createdAt, expiresAt, confirmations, rate, refundAddress, payToAddress, fromCoin, fromAmount, fromTransactionId, fromTransactionLink, toCoin, toAmount, toTransactionId, toTransactionLink, toAddress,
2636
2642
  // TODO: [refactoring, moderate] toAddress is not quite clear. How about recipientAddress? task_id=0815a111c99543b78d374217eadbde4f
2637
- partner) {
2643
+ partner, fromExtraId, toExtraId, refundExtraId) {
2638
2644
  this.swapId = swapId;
2639
2645
  this.status = status;
2640
2646
  this.createdAt = createdAt;
@@ -2653,6 +2659,9 @@ partner) {
2653
2659
  this.toAmount = toAmount;
2654
2660
  this.toAddress = toAddress;
2655
2661
  this.partner = partner;
2662
+ this.fromExtraId = fromExtraId;
2663
+ this.toExtraId = toExtraId;
2664
+ this.refundExtraId = refundExtraId;
2656
2665
  };
2657
2666
 
2658
2667
  var ExistingSwapWithFiatData = /*#__PURE__*/function (_ExistingSwap) {
@@ -2665,22 +2674,28 @@ var ExistingSwapWithFiatData = /*#__PURE__*/function (_ExistingSwap) {
2665
2674
  * @param confirmations {number}
2666
2675
  * @param rate {string}
2667
2676
  * @param refundAddress {string}
2677
+ * @param payToAddress {string}
2668
2678
  * @param fromCoin {Coin}
2669
2679
  * @param fromAmount {string}
2670
2680
  * @param fromTransactionId {string}
2681
+ * @param fromTransactionLink {string}
2671
2682
  * @param toCoin {Coin}
2672
2683
  * @param toAmount {string}
2673
2684
  * @param toTransactionId {string|null}
2685
+ * @param toTransactionLink
2674
2686
  * @param toAddress {string}
2675
2687
  * @param partner {string}
2688
+ * @param fromExtraId {string}
2689
+ * @param toExtraId {string}
2690
+ * @param refundExtraId {string}
2676
2691
  * @param fromAmountFiat {number}
2677
2692
  * @param toAmountFiat {number}
2678
2693
  * @param fiatCurrencyCode {string}
2679
2694
  * @param fiatCurrencyDecimals {number}
2680
2695
  */
2681
- function ExistingSwapWithFiatData(swapId, status, createdAt, expiresAt, confirmations, rate, refundAddress, payToAddress, fromCoin, fromAmount, fromTransactionId, fromTransactionLink, toCoin, toAmount, toTransactionId, toTransactionLink, toAddress, partner, fromAmountFiat, toAmountFiat, fiatCurrencyCode, fiatCurrencyDecimals) {
2696
+ function ExistingSwapWithFiatData(swapId, status, createdAt, expiresAt, confirmations, rate, refundAddress, payToAddress, fromCoin, fromAmount, fromTransactionId, fromTransactionLink, toCoin, toAmount, toTransactionId, toTransactionLink, toAddress, partner, fromExtraId, toExtraId, refundExtraId, fromAmountFiat, toAmountFiat, fiatCurrencyCode, fiatCurrencyDecimals) {
2682
2697
  var _this;
2683
- _this = _ExistingSwap.call(this, swapId, status, createdAt, expiresAt, confirmations, rate, refundAddress, payToAddress, fromCoin, fromAmount, fromTransactionId, fromTransactionLink, toCoin, toAmount, toTransactionId, toTransactionLink, toAddress, partner) || this;
2698
+ _this = _ExistingSwap.call(this, swapId, status, createdAt, expiresAt, confirmations, rate, refundAddress, payToAddress, fromCoin, fromAmount, fromTransactionId, fromTransactionLink, toCoin, toAmount, toTransactionId, toTransactionLink, toAddress, partner, fromExtraId, toExtraId, refundExtraId) || this;
2684
2699
  _this.fromAmountFiat = fromAmountFiat;
2685
2700
  _this.toAmountFiat = toAmountFiat;
2686
2701
  _this.fiatCurrencyCode = fiatCurrencyCode;
@@ -2697,7 +2712,7 @@ var ExistingSwapWithFiatData = /*#__PURE__*/function (_ExistingSwap) {
2697
2712
  * @return {ExistingSwapWithFiatData}
2698
2713
  */
2699
2714
  ExistingSwapWithFiatData.fromExistingSwap = function fromExistingSwap(existingSwap, fromAmountFiat, toAmountFiat, fiatCurrencyCode, fiatCurrencyDecimals) {
2700
- return new ExistingSwapWithFiatData(existingSwap.swapId, existingSwap.status, existingSwap.createdAt, existingSwap.expiresAt, existingSwap.confirmations, existingSwap.rate, existingSwap.refundAddress, existingSwap.payToAddress, existingSwap.fromCoin, existingSwap.fromAmount, existingSwap.fromTransactionId, existingSwap.fromTransactionLink, existingSwap.toCoin, existingSwap.toAmount, existingSwap.toTransactionId, existingSwap.toTransactionLink, existingSwap.toAddress, existingSwap.partner, fromAmountFiat, toAmountFiat, fiatCurrencyCode, fiatCurrencyDecimals);
2715
+ return new ExistingSwapWithFiatData(existingSwap.swapId, existingSwap.status, existingSwap.createdAt, existingSwap.expiresAt, existingSwap.confirmations, existingSwap.rate, existingSwap.refundAddress, existingSwap.payToAddress, existingSwap.fromCoin, existingSwap.fromAmount, existingSwap.fromTransactionId, existingSwap.fromTransactionLink, existingSwap.toCoin, existingSwap.toAmount, existingSwap.toTransactionId, existingSwap.toTransactionLink, existingSwap.toAddress, existingSwap.partner, existingSwap.fromExtraId, existingSwap.toExtraId, existingSwap.refundExtraId, fromAmountFiat, toAmountFiat, fiatCurrencyCode, fiatCurrencyDecimals);
2701
2716
  };
2702
2717
  return ExistingSwapWithFiatData;
2703
2718
  }(ExistingSwap);
@@ -2862,6 +2877,8 @@ var SwapProvider = /*#__PURE__*/function () {
2862
2877
  * @param refundAddress {string}
2863
2878
  * @param rawSwapData {Object|null}
2864
2879
  * @param clientIpAddress {string}
2880
+ * @param [toCurrencyExtraId=""] {string} optional extra ID
2881
+ * @param [refundExtraId=""] {string} optional extra ID for refund address
2865
2882
  * @return {Promise<({
2866
2883
  * result: true,
2867
2884
  * swapId: string,
@@ -2871,7 +2888,8 @@ var SwapProvider = /*#__PURE__*/function () {
2871
2888
  * toCoin: Coin,
2872
2889
  * toAmount: string,
2873
2890
  * toAddress: string,
2874
- * rate: string
2891
+ * rate: string,
2892
+ * fromCurrencyExtraId: string|undefined
2875
2893
  * }|{
2876
2894
  * result: false,
2877
2895
  * reason: string,
@@ -2879,7 +2897,7 @@ var SwapProvider = /*#__PURE__*/function () {
2879
2897
  * })>}
2880
2898
  */
2881
2899
  ;
2882
- _proto.createSwap = function createSwap(fromCoin, toCoin, amount, toAddress, refundAddress, rawSwapData, clientIpAddress) {
2900
+ _proto.createSwap = function createSwap(fromCoin, toCoin, amount, toAddress, refundAddress, rawSwapData, clientIpAddress, toCurrencyExtraId, refundExtraId) {
2883
2901
  try {
2884
2902
  throw new Error("Not implemented in base");
2885
2903
  } catch (e) {
@@ -2917,6 +2935,14 @@ var SwapProvider = /*#__PURE__*/function () {
2917
2935
  */;
2918
2936
  _proto.isAddressValidForAsset = function isAddressValidForAsset(asset, address) {
2919
2937
  throw new Error("Not implemented in base");
2938
+ }
2939
+
2940
+ /**
2941
+ * @param asset {Coin}
2942
+ * @return {string|null}
2943
+ */;
2944
+ _proto.getExtraIdNameIfPresent = function getExtraIdNameIfPresent(asset) {
2945
+ throw new Error("Not implemented in base");
2920
2946
  };
2921
2947
  return SwapProvider;
2922
2948
  }();
@@ -2975,7 +3001,7 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
2975
3001
  }
2976
3002
  _this = _SwapProvider.call(this) || this;
2977
3003
  _this._supportedCoins = [];
2978
- _this._URL = "" + apiKeysProxyUrl;
3004
+ _this._URL = apiKeysProxyUrl + "/swapspace";
2979
3005
  _this._maxRateDigits = 20;
2980
3006
  _this.useRestrictedCoinsSet = useRestrictedCoinsSet;
2981
3007
  _this._customCoinBuilder = customCoinBuilder;
@@ -3121,10 +3147,6 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
3121
3147
  var _rawResponse$data, _rawResponse$data2;
3122
3148
  Logger.log("Retrieved " + (rawResponse == null || (_rawResponse$data = rawResponse.data) == null ? void 0 : _rawResponse$data.length), loggerSource);
3123
3149
  var allowedCoins = (_rawResponse$data2 = rawResponse == null ? void 0 : rawResponse.data) != null ? _rawResponse$data2 : [];
3124
- // TODO: [feature, critical] add support for extra ID. task_id=7219d65d41c242a292dfa47479b8d63f
3125
- allowedCoins = allowedCoins.filter(function (c) {
3126
- return c.hasExtraId !== true && c.hasExtraId !== "true";
3127
- });
3128
3150
  Logger.log("Allowed cnt " + allowedCoins.length, loggerSource);
3129
3151
  _this6._supportedCoins = allowedCoins.map(function (item) {
3130
3152
  var coin = _this6._customCoinBuilder(item.code, item.network);
@@ -3153,7 +3175,8 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
3153
3175
  coin: coin,
3154
3176
  code: item.code,
3155
3177
  network: item.network,
3156
- extraId: item.extraIdName,
3178
+ hasExtraId: item.hasExtraId,
3179
+ extraIdName: item.extraIdName,
3157
3180
  isPopular: !!(item != null && item.popular),
3158
3181
  iconURL: item.icon ? "https://storage.swapspace.co" + item.icon : FALLBACK_ICON_URL,
3159
3182
  deposit: (_item$deposit = item.deposit) != null ? _item$deposit : false,
@@ -3381,7 +3404,13 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
3381
3404
  return Promise.reject(e);
3382
3405
  }
3383
3406
  };
3384
- _proto.createSwap = function createSwap(fromCoin, toCoin, amount, toAddress, refundAddress, rawSwapData, clientIpAddress) {
3407
+ _proto.createSwap = function createSwap(fromCoin, toCoin, amount, toAddress, refundAddress, rawSwapData, clientIpAddress, toCurrencyExtraId, refundExtraId) {
3408
+ if (toCurrencyExtraId === void 0) {
3409
+ toCurrencyExtraId = "";
3410
+ }
3411
+ if (refundExtraId === void 0) {
3412
+ refundExtraId = "";
3413
+ }
3385
3414
  try {
3386
3415
  var _this9 = this;
3387
3416
  var loggerSource = "createSwap";
@@ -3395,11 +3424,7 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
3395
3424
  throw new Error("Invalid raw swap data: " + safeStringify(rawSwapData));
3396
3425
  }
3397
3426
  return Promise.resolve(_this9._fetchSupportedCurrenciesIfNeeded()).then(function () {
3398
- var _this9$_supportedCoin, _this9$_supportedCoin2;
3399
- var toCurrencyExtraId = (_this9$_supportedCoin = (_this9$_supportedCoin2 = _this9._supportedCoins.find(function (item) {
3400
- var _item$coin4;
3401
- return ((_item$coin4 = item.coin) == null ? void 0 : _item$coin4.ticker) === (toCoin == null ? void 0 : toCoin.ticker);
3402
- })) == null ? void 0 : _this9$_supportedCoin2.extraId) != null ? _this9$_supportedCoin : "";
3427
+ var _toCurrencyExtraId, _refundExtraId;
3403
3428
  var requestData = {
3404
3429
  partner: partner,
3405
3430
  fromCurrency: rawSwapData == null ? void 0 : rawSwapData.fromCurrency,
@@ -3409,7 +3434,9 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
3409
3434
  address: toAddress,
3410
3435
  amount: amount,
3411
3436
  fixed: false,
3412
- extraId: toCurrencyExtraId != null ? toCurrencyExtraId : "",
3437
+ extraId: (_toCurrencyExtraId = toCurrencyExtraId) != null ? _toCurrencyExtraId : "",
3438
+ refundExtraId: (_refundExtraId = refundExtraId) != null ? _refundExtraId : "",
3439
+ // This param is not documented. But the refund is usually manual so this is not critical.
3413
3440
  rateId: rawSwapData == null ? void 0 : rawSwapData.id,
3414
3441
  userIp: clientIpAddress,
3415
3442
  refund: refundAddress
@@ -3419,7 +3446,7 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
3419
3446
  var result = response.data;
3420
3447
  Logger.log("Creation result " + safeStringify(result), loggerSource);
3421
3448
  if (result != null && result.id) {
3422
- var _result$from, _result$from2, _result$to, _result$to2, _result$from4, _result$from5, _result$to4, _result$to5;
3449
+ var _result$from, _result$from2, _result$to, _result$to2, _result$from4, _result$from5, _result$to4, _result$to5, _result$from$extraId, _result$from6;
3423
3450
  if (typeof (result == null || (_result$from = result.from) == null ? void 0 : _result$from.amount) !== "number" || typeof (result == null || (_result$from2 = result.from) == null ? void 0 : _result$from2.address) !== "string" || typeof (result == null || (_result$to = result.to) == null ? void 0 : _result$to.amount) !== "number" || typeof (result == null || (_result$to2 = result.to) == null ? void 0 : _result$to2.address) !== "string") throw new Error("Wrong swap creation result " + result);
3424
3451
  /* We use the returned rate preferably but if the retrieved
3425
3452
  * rate 0/null/undefined we calculate it manually */
@@ -3439,6 +3466,7 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
3439
3466
  toCoin: toCoin,
3440
3467
  toAmount: AmountUtils.trim(result == null || (_result$to4 = result.to) == null ? void 0 : _result$to4.amount, toCoin.digits),
3441
3468
  toAddress: result == null || (_result$to5 = result.to) == null ? void 0 : _result$to5.address,
3469
+ fromCurrencyExtraId: (_result$from$extraId = result == null || (_result$from6 = result.from) == null ? void 0 : _result$from6.extraId) != null ? _result$from$extraId : "",
3442
3470
  rate: AmountUtils.trim(rate, _this9._maxRateDigits)
3443
3471
  };
3444
3472
  }
@@ -3538,7 +3566,7 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
3538
3566
  var swaps = wo404.map(function (r) {
3539
3567
  return r.data;
3540
3568
  }).map(function (swap, index) {
3541
- var _this10$_supportedCoi, _this10$_supportedCoi2;
3569
+ var _this10$_supportedCoi, _this10$_supportedCoi2, _swap$from$extraId, _swap$to$extraId, _swap$refundExtraId;
3542
3570
  var fromCoin = (_this10$_supportedCoi = _this10._supportedCoins.find(function (i) {
3543
3571
  return i.code === swap.from.code && i.network === swap.from.network;
3544
3572
  })) == null ? void 0 : _this10$_supportedCoi.coin;
@@ -3556,7 +3584,7 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
3556
3584
  var status = _this10._mapSwapspaceStatusToRabbitStatus(swap.status, isExpiredByTime);
3557
3585
  var toDigits = status === SwapProvider.SWAP_STATUSES.REFUNDED ? fromCoin.digits : toCoin.digits;
3558
3586
  var addressToSendCoinsToSwapspace = swap.from.address;
3559
- return new ExistingSwap(swapIds[index], status, toUtcTimestamp(swap.timestamps.createdAt), expiresAt, swap.confirmations, AmountUtils.trim(swap.rate, _this10._maxRateDigits), swap.refundAddress, addressToSendCoinsToSwapspace, fromCoin, AmountUtils.trim(swap.from.amount, fromCoin.digits), swap.from.transactionHash, swap.blockExplorerTransactionUrl.from, toCoin, AmountUtils.trim(swap.to.amount, toDigits), swap.to.transactionHash, swap.blockExplorerTransactionUrl.to, swap.to.address, swap.partner);
3587
+ return new ExistingSwap(swapIds[index], status, toUtcTimestamp(swap.timestamps.createdAt), expiresAt, swap.confirmations, AmountUtils.trim(swap.rate, _this10._maxRateDigits), swap.refundAddress, addressToSendCoinsToSwapspace, fromCoin, AmountUtils.trim(swap.from.amount, fromCoin.digits), swap.from.transactionHash, swap.blockExplorerTransactionUrl.from, toCoin, AmountUtils.trim(swap.to.amount, toDigits), swap.to.transactionHash, swap.blockExplorerTransactionUrl.to, swap.to.address, swap.partner, (_swap$from$extraId = swap.from.extraId) != null ? _swap$from$extraId : null, (_swap$to$extraId = swap.to.extraId) != null ? _swap$to$extraId : null, (_swap$refundExtraId = swap.refundExtraId) != null ? _swap$refundExtraId : null);
3560
3588
  }).flat();
3561
3589
  Logger.log("Swap details result " + safeStringify(swaps), loggerSource);
3562
3590
  return {
@@ -3602,6 +3630,17 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
3602
3630
  }
3603
3631
  return false;
3604
3632
  };
3633
+ _proto.getExtraIdNameIfPresent = function getExtraIdNameIfPresent(asset) {
3634
+ try {
3635
+ var assetData = this._supportedCoins.find(function (i) {
3636
+ var _i$coin4;
3637
+ return ((_i$coin4 = i.coin) == null ? void 0 : _i$coin4.ticker) === (asset == null ? void 0 : asset.ticker);
3638
+ });
3639
+ return assetData != null && assetData.hasExtraId ? assetData == null ? void 0 : assetData.extraIdName : null;
3640
+ } catch (e) {
3641
+ improveAndRethrow(e, "getExtraIdNameIfPresent");
3642
+ }
3643
+ };
3605
3644
  return SwapspaceSwapProvider;
3606
3645
  }(SwapProvider);
3607
3646
 
@@ -4096,6 +4135,7 @@ var PublicSwapService = /*#__PURE__*/function () {
4096
4135
  * @param fromCoin {Coin}
4097
4136
  * @param toCoin {Coin}
4098
4137
  * @param fromAmountCoins {string}
4138
+ * @param [withoutFiat=false] {boolean} pass true if you don't need the fiat equivalent - this will diminish requests count
4099
4139
  * @return {Promise<{
4100
4140
  * result: false,
4101
4141
  * reason: string,
@@ -4110,14 +4150,17 @@ var PublicSwapService = /*#__PURE__*/function () {
4110
4150
  * }>}
4111
4151
  */
4112
4152
  ;
4113
- _proto.getPublicSwapDetails = function getPublicSwapDetails(fromCoin, toCoin, fromAmountCoins) {
4153
+ _proto.getPublicSwapDetails = function getPublicSwapDetails(fromCoin, toCoin, fromAmountCoins, withoutFiat) {
4154
+ if (withoutFiat === void 0) {
4155
+ withoutFiat = false;
4156
+ }
4114
4157
  try {
4115
4158
  var _this7 = this;
4116
4159
  var loggerSource = "getPublicSwapDetails";
4117
4160
  return Promise.resolve(_catch(function () {
4118
- return Promise.resolve(_this7._swapProvider.getCoinToUSDTRate(fromCoin)).then(function (_this7$_swapProvider$) {
4161
+ function _temp2(_this7$_swapProvider$) {
4119
4162
  var _this7$_swapProvider$2;
4120
- var coinUsdtRate = (_this7$_swapProvider$2 = _this7$_swapProvider$ == null ? void 0 : _this7$_swapProvider$.rate) != null ? _this7$_swapProvider$2 : null;
4163
+ var coinUsdtRate = withoutFiat ? _this7$_swapProvider$ : (_this7$_swapProvider$2 = _this7$_swapProvider$ == null ? void 0 : _this7$_swapProvider$.rate) != null ? _this7$_swapProvider$2 : null;
4121
4164
  return Promise.resolve(_this7._swapProvider.getSwapInfo(fromCoin, toCoin, fromAmountCoins, coinUsdtRate)).then(function (details) {
4122
4165
  var _result$swapCreationI, _result$swapCreationI2;
4123
4166
  var min = details.result ? details.min : details.smallestMin;
@@ -4170,7 +4213,8 @@ var PublicSwapService = /*#__PURE__*/function () {
4170
4213
  }), loggerSource);
4171
4214
  return result;
4172
4215
  });
4173
- });
4216
+ }
4217
+ return withoutFiat ? _temp2(null) : Promise.resolve(_this7._swapProvider.getCoinToUSDTRate(fromCoin)).then(_temp2);
4174
4218
  }, function (e) {
4175
4219
  improveAndRethrow(e, loggerSource);
4176
4220
  }));
@@ -4188,6 +4232,8 @@ var PublicSwapService = /*#__PURE__*/function () {
4188
4232
  * @param toAddress {string}
4189
4233
  * @param refundAddress {string}
4190
4234
  * @param clientIp {string}
4235
+ * @param [toCurrencyExtraId] {string}
4236
+ * @param [refundExtraId] {string}
4191
4237
  * @return {Promise<{
4192
4238
  * result: true,
4193
4239
  * fiatCurrencyCode: string,
@@ -4201,14 +4247,15 @@ var PublicSwapService = /*#__PURE__*/function () {
4201
4247
  * fiatCurrencyDecimals: number,
4202
4248
  * fromCoin: Coin,
4203
4249
  * rate: string,
4204
- * swapId: string
4250
+ * swapId: string,
4251
+ * fromCurrencyExtraId: string
4205
4252
  * }|{
4206
4253
  * result: false,
4207
4254
  * reason: string
4208
4255
  * }>}
4209
4256
  */
4210
4257
  ;
4211
- _proto.createPublicSwap = function createPublicSwap(fromCoin, toCoin, fromAmount, swapCreationInfo, toAddress, refundAddress, clientIp) {
4258
+ _proto.createPublicSwap = function createPublicSwap(fromCoin, toCoin, fromAmount, swapCreationInfo, toAddress, refundAddress, clientIp, toCurrencyExtraId, refundExtraId) {
4212
4259
  try {
4213
4260
  var _this8 = this;
4214
4261
  var loggerSource = "createPublicSwap";
@@ -4221,9 +4268,9 @@ var PublicSwapService = /*#__PURE__*/function () {
4221
4268
  fromCoin: swapCreationInfo == null || (_swapCreationInfo$fro = swapCreationInfo.fromCoin) == null ? void 0 : _swapCreationInfo$fro.ticker,
4222
4269
  toCoin: swapCreationInfo == null || (_swapCreationInfo$toC = swapCreationInfo.toCoin) == null ? void 0 : _swapCreationInfo$toC.ticker
4223
4270
  })), loggerSource);
4224
- return Promise.resolve(_this8._swapProvider.createSwap(fromCoin, toCoin, fromAmount, toAddress, refundAddress, swapCreationInfo.rawSwapData, clientIp)).then(function (result) {
4271
+ return Promise.resolve(_this8._swapProvider.createSwap(fromCoin, toCoin, fromAmount, toAddress, refundAddress, swapCreationInfo.rawSwapData, clientIp, toCurrencyExtraId, refundExtraId)).then(function (result) {
4225
4272
  var _exit;
4226
- function _temp5(_result8) {
4273
+ function _temp6(_result8) {
4227
4274
  if (_exit) return _result8;
4228
4275
  throw new Error("Unexpected result from provider " + safeStringify(result));
4229
4276
  }
@@ -4247,9 +4294,10 @@ var PublicSwapService = /*#__PURE__*/function () {
4247
4294
  // };
4248
4295
  }
4249
4296
  }
4250
- var _temp4 = function () {
4297
+ var _temp5 = function () {
4251
4298
  if (result.result && result != null && result.swapId) {
4252
- var _temp3 = function _temp3() {
4299
+ var _temp4 = function _temp4() {
4300
+ var _result$fromCurrencyE;
4253
4301
  EventBusInstance__default["default"].dispatch(PublicSwapService.PUBLIC_SWAP_CREATED_EVENT, null, fromCoin.ticker, toCoin.ticker, _fromAmountFiat);
4254
4302
  var toReturn = {
4255
4303
  result: true,
@@ -4264,7 +4312,9 @@ var PublicSwapService = /*#__PURE__*/function () {
4264
4312
  fiatCurrencyDecimals: PublicSwapService._fiatDecimalsCount,
4265
4313
  rate: result.rate,
4266
4314
  durationMinutesRange: swapCreationInfo.durationMinutesRange,
4267
- address: result.fromAddress // CRITICAL: this is the address to send coins to swaps provider
4315
+ address: result.fromAddress,
4316
+ // CRITICAL: this is the address to send coins to swaps provider
4317
+ fromCurrencyExtraId: (_result$fromCurrencyE = result.fromCurrencyExtraId) != null ? _result$fromCurrencyE : "" // CRITICAL: this is the extra ID for address to send coins to swaps provider
4268
4318
  };
4269
4319
  _this8._savePublicSwapIdLocally(result.swapId);
4270
4320
  Logger.log("Returning: " + safeStringify(_extends({}, toReturn, {
@@ -4276,7 +4326,7 @@ var PublicSwapService = /*#__PURE__*/function () {
4276
4326
  };
4277
4327
  var _fromAmountFiat = null,
4278
4328
  _toAmountFiat = null;
4279
- var _temp2 = _catch(function () {
4329
+ var _temp3 = _catch(function () {
4280
4330
  return Promise.resolve(_this8._swapProvider.getCoinToUSDTRate(fromCoin)).then(function (_this8$_swapProvider$) {
4281
4331
  var _this8$_swapProvider$3;
4282
4332
  var fromCoinUsdtRate = (_this8$_swapProvider$3 = _this8$_swapProvider$ == null ? void 0 : _this8$_swapProvider$.rate) != null ? _this8$_swapProvider$3 : null;
@@ -4294,10 +4344,10 @@ var PublicSwapService = /*#__PURE__*/function () {
4294
4344
  }, function (e) {
4295
4345
  Logger.logError(e, loggerSource, "Failed to calculate fiat amounts for result");
4296
4346
  });
4297
- return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2);
4347
+ return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
4298
4348
  }
4299
4349
  }();
4300
- return _temp4 && _temp4.then ? _temp4.then(_temp5) : _temp5(_temp4);
4350
+ return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5);
4301
4351
  });
4302
4352
  }, function (e) {
4303
4353
  improveAndRethrow(e, loggerSource);
@@ -4362,14 +4412,14 @@ var PublicSwapService = /*#__PURE__*/function () {
4362
4412
  var _exit2;
4363
4413
  var _this10 = this;
4364
4414
  return Promise.resolve(_catch(function () {
4365
- function _temp7(_result10) {
4415
+ function _temp8(_result10) {
4366
4416
  return _exit2 ? _result10 : {
4367
4417
  result: true,
4368
4418
  swaps: []
4369
4419
  };
4370
4420
  }
4371
4421
  var swapIds = _this10._getPublicSwapIdsSavedLocally();
4372
- var _temp6 = function () {
4422
+ var _temp7 = function () {
4373
4423
  if (swapIds.length) {
4374
4424
  return Promise.resolve(_this10.getPublicExistingSwapDetailsAndStatus(swapIds)).then(function (_await$_this10$getPub) {
4375
4425
  _exit2 = 1;
@@ -4377,7 +4427,7 @@ var PublicSwapService = /*#__PURE__*/function () {
4377
4427
  });
4378
4428
  }
4379
4429
  }();
4380
- return _temp6 && _temp6.then ? _temp6.then(_temp7) : _temp7(_temp6);
4430
+ return _temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7);
4381
4431
  }, function (e) {
4382
4432
  improveAndRethrow(e, "getPublicSwapsHistory");
4383
4433
  }));
@@ -4478,11 +4528,11 @@ var PublicSwapService = /*#__PURE__*/function () {
4478
4528
  try {
4479
4529
  var _exit3;
4480
4530
  var _this12 = this;
4481
- var _temp9 = _catch(function () {
4531
+ var _temp10 = _catch(function () {
4482
4532
  if (!addressString) {
4483
- var _temp8 = null;
4533
+ var _temp9 = null;
4484
4534
  _exit3 = 1;
4485
- return _temp8;
4535
+ return _temp9;
4486
4536
  }
4487
4537
  var addressLowerCase = addressString.toLowerCase();
4488
4538
  return Promise.resolve(_this12._swapProvider.getAllSupportedCurrencies()).then(function (allCoins) {
@@ -4497,12 +4547,24 @@ var PublicSwapService = /*#__PURE__*/function () {
4497
4547
  }, function (e) {
4498
4548
  Logger.logError(e, "getTokenByContractAddress");
4499
4549
  });
4500
- return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function (_result13) {
4550
+ return Promise.resolve(_temp10 && _temp10.then ? _temp10.then(function (_result13) {
4501
4551
  return _exit3 ? _result13 : null;
4502
- }) : _exit3 ? _temp9 : null);
4552
+ }) : _exit3 ? _temp10 : null);
4503
4553
  } catch (e) {
4504
4554
  return Promise.reject(e);
4505
4555
  }
4556
+ }
4557
+ /**
4558
+ * @param asset {Coin}
4559
+ * @return {string|null}
4560
+ */
4561
+ ;
4562
+ _proto.getExtraIdNameIfPresentForAsset = function getExtraIdNameIfPresentForAsset(asset) {
4563
+ try {
4564
+ return this._swapProvider.getExtraIdNameIfPresent(asset);
4565
+ } catch (e) {
4566
+ improveAndRethrow(e, "getExtraIdNameIfPresentForAsset");
4567
+ }
4506
4568
  };
4507
4569
  return PublicSwapService;
4508
4570
  }();