@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.
@@ -2390,18 +2390,24 @@ class ExistingSwap {
2390
2390
  * @param confirmations {number}
2391
2391
  * @param rate {string}
2392
2392
  * @param refundAddress {string}
2393
+ * @param payToAddress {string}
2393
2394
  * @param fromCoin {Coin}
2394
2395
  * @param fromAmount {string}
2395
2396
  * @param fromTransactionId {string}
2397
+ * @param fromTransactionLink {string}
2396
2398
  * @param toCoin {Coin}
2397
2399
  * @param toAmount {string}
2398
2400
  * @param toTransactionId {string|null}
2401
+ * @param toTransactionLink {string}
2399
2402
  * @param toAddress {string}
2400
2403
  * @param partner {string}
2404
+ * @param fromExtraId {string}
2405
+ * @param toExtraId {string}
2406
+ * @param refundExtraId {string}
2401
2407
  */
2402
2408
  constructor(swapId, status, createdAt, expiresAt, confirmations, rate, refundAddress, payToAddress, fromCoin, fromAmount, fromTransactionId, fromTransactionLink, toCoin, toAmount, toTransactionId, toTransactionLink, toAddress,
2403
2409
  // TODO: [refactoring, moderate] toAddress is not quite clear. How about recipientAddress? task_id=0815a111c99543b78d374217eadbde4f
2404
- partner) {
2410
+ partner, fromExtraId, toExtraId, refundExtraId) {
2405
2411
  this.swapId = swapId;
2406
2412
  this.status = status;
2407
2413
  this.createdAt = createdAt;
@@ -2420,6 +2426,9 @@ class ExistingSwap {
2420
2426
  this.toAmount = toAmount;
2421
2427
  this.toAddress = toAddress;
2422
2428
  this.partner = partner;
2429
+ this.fromExtraId = fromExtraId;
2430
+ this.toExtraId = toExtraId;
2431
+ this.refundExtraId = refundExtraId;
2423
2432
  }
2424
2433
  }
2425
2434
 
@@ -2432,21 +2441,27 @@ class ExistingSwapWithFiatData extends ExistingSwap {
2432
2441
  * @param confirmations {number}
2433
2442
  * @param rate {string}
2434
2443
  * @param refundAddress {string}
2444
+ * @param payToAddress {string}
2435
2445
  * @param fromCoin {Coin}
2436
2446
  * @param fromAmount {string}
2437
2447
  * @param fromTransactionId {string}
2448
+ * @param fromTransactionLink {string}
2438
2449
  * @param toCoin {Coin}
2439
2450
  * @param toAmount {string}
2440
2451
  * @param toTransactionId {string|null}
2452
+ * @param toTransactionLink
2441
2453
  * @param toAddress {string}
2442
2454
  * @param partner {string}
2455
+ * @param fromExtraId {string}
2456
+ * @param toExtraId {string}
2457
+ * @param refundExtraId {string}
2443
2458
  * @param fromAmountFiat {number}
2444
2459
  * @param toAmountFiat {number}
2445
2460
  * @param fiatCurrencyCode {string}
2446
2461
  * @param fiatCurrencyDecimals {number}
2447
2462
  */
2448
- constructor(swapId, status, createdAt, expiresAt, confirmations, rate, refundAddress, payToAddress, fromCoin, fromAmount, fromTransactionId, fromTransactionLink, toCoin, toAmount, toTransactionId, toTransactionLink, toAddress, partner, fromAmountFiat, toAmountFiat, fiatCurrencyCode, fiatCurrencyDecimals) {
2449
- super(swapId, status, createdAt, expiresAt, confirmations, rate, refundAddress, payToAddress, fromCoin, fromAmount, fromTransactionId, fromTransactionLink, toCoin, toAmount, toTransactionId, toTransactionLink, toAddress, partner);
2463
+ constructor(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) {
2464
+ super(swapId, status, createdAt, expiresAt, confirmations, rate, refundAddress, payToAddress, fromCoin, fromAmount, fromTransactionId, fromTransactionLink, toCoin, toAmount, toTransactionId, toTransactionLink, toAddress, partner, fromExtraId, toExtraId, refundExtraId);
2450
2465
  this.fromAmountFiat = fromAmountFiat;
2451
2466
  this.toAmountFiat = toAmountFiat;
2452
2467
  this.fiatCurrencyCode = fiatCurrencyCode;
@@ -2462,7 +2477,7 @@ class ExistingSwapWithFiatData extends ExistingSwap {
2462
2477
  * @return {ExistingSwapWithFiatData}
2463
2478
  */
2464
2479
  static fromExistingSwap(existingSwap, fromAmountFiat, toAmountFiat, fiatCurrencyCode, fiatCurrencyDecimals) {
2465
- 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);
2480
+ 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);
2466
2481
  }
2467
2482
  }
2468
2483
 
@@ -2602,6 +2617,8 @@ class SwapProvider {
2602
2617
  * @param refundAddress {string}
2603
2618
  * @param rawSwapData {Object|null}
2604
2619
  * @param clientIpAddress {string}
2620
+ * @param [toCurrencyExtraId=""] {string} optional extra ID
2621
+ * @param [refundExtraId=""] {string} optional extra ID for refund address
2605
2622
  * @return {Promise<({
2606
2623
  * result: true,
2607
2624
  * swapId: string,
@@ -2611,14 +2628,15 @@ class SwapProvider {
2611
2628
  * toCoin: Coin,
2612
2629
  * toAmount: string,
2613
2630
  * toAddress: string,
2614
- * rate: string
2631
+ * rate: string,
2632
+ * fromCurrencyExtraId: string|undefined
2615
2633
  * }|{
2616
2634
  * result: false,
2617
2635
  * reason: string,
2618
2636
  * partner: string
2619
2637
  * })>}
2620
2638
  */
2621
- async createSwap(fromCoin, toCoin, amount, toAddress, refundAddress, rawSwapData = null, clientIpAddress) {
2639
+ async createSwap(fromCoin, toCoin, amount, toAddress, refundAddress, rawSwapData = null, clientIpAddress, toCurrencyExtraId = "", refundExtraId = "") {
2622
2640
  throw new Error("Not implemented in base");
2623
2641
  }
2624
2642
 
@@ -2649,6 +2667,14 @@ class SwapProvider {
2649
2667
  isAddressValidForAsset(asset, address) {
2650
2668
  throw new Error("Not implemented in base");
2651
2669
  }
2670
+
2671
+ /**
2672
+ * @param asset {Coin}
2673
+ * @return {string|null}
2674
+ */
2675
+ getExtraIdNameIfPresent(asset) {
2676
+ throw new Error("Not implemented in base");
2677
+ }
2652
2678
  }
2653
2679
  SwapProvider.COMMON_ERRORS = {
2654
2680
  REQUESTS_LIMIT_EXCEEDED: "requestsLimitExceeded"
@@ -2684,7 +2710,7 @@ class SwapspaceSwapProvider extends SwapProvider {
2684
2710
  constructor(apiKeysProxyUrl, cache, customCoinBuilder = (coin, network) => null, useRestrictedCoinsSet = true) {
2685
2711
  super();
2686
2712
  this._supportedCoins = [];
2687
- this._URL = `${apiKeysProxyUrl}`;
2713
+ this._URL = `${apiKeysProxyUrl}/swapspace`;
2688
2714
  this._maxRateDigits = 20;
2689
2715
  this.useRestrictedCoinsSet = useRestrictedCoinsSet;
2690
2716
  this._customCoinBuilder = customCoinBuilder;
@@ -2790,8 +2816,6 @@ class SwapspaceSwapProvider extends SwapProvider {
2790
2816
  const rawResponse = await axios.get(`${this._URL}/api/v2/currencies`);
2791
2817
  Logger.log(`Retrieved ${rawResponse == null || (_rawResponse$data = rawResponse.data) == null ? void 0 : _rawResponse$data.length}`, loggerSource);
2792
2818
  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
2819
  Logger.log(`Allowed cnt ${allowedCoins.length}`, loggerSource);
2796
2820
  this._supportedCoins = allowedCoins.map(item => {
2797
2821
  let coin = this._customCoinBuilder(item.code, item.network);
@@ -2820,7 +2844,8 @@ class SwapspaceSwapProvider extends SwapProvider {
2820
2844
  coin: coin,
2821
2845
  code: item.code,
2822
2846
  network: item.network,
2823
- extraId: item.extraIdName,
2847
+ hasExtraId: item.hasExtraId,
2848
+ extraIdName: item.extraIdName,
2824
2849
  isPopular: !!(item != null && item.popular),
2825
2850
  iconURL: item.icon ? `https://storage.swapspace.co${item.icon}` : FALLBACK_ICON_URL,
2826
2851
  deposit: (_item$deposit = item.deposit) != null ? _item$deposit : false,
@@ -3019,11 +3044,10 @@ class SwapspaceSwapProvider extends SwapProvider {
3019
3044
  improveAndRethrow(e, loggerSource);
3020
3045
  }
3021
3046
  }
3022
- async createSwap(fromCoin, toCoin, amount, toAddress, refundAddress, rawSwapData, clientIpAddress) {
3047
+ async createSwap(fromCoin, toCoin, amount, toAddress, refundAddress, rawSwapData, clientIpAddress, toCurrencyExtraId = "", refundExtraId = "") {
3023
3048
  const loggerSource = "createSwap";
3024
3049
  const partner = rawSwapData == null ? void 0 : rawSwapData.partner;
3025
3050
  try {
3026
- var _this$_supportedCoins9, _this$_supportedCoins10;
3027
3051
  if (!(fromCoin instanceof Coin) || !(toCoin instanceof Coin) || typeof amount !== "string" || typeof toAddress !== "string" || typeof refundAddress !== "string") {
3028
3052
  throw new Error(`Invalid input: ${fromCoin} ${toCoin} ${amount} ${toAddress} ${refundAddress}`);
3029
3053
  }
@@ -3032,10 +3056,6 @@ class SwapspaceSwapProvider extends SwapProvider {
3032
3056
  throw new Error(`Invalid raw swap data: ${safeStringify(rawSwapData)}`);
3033
3057
  }
3034
3058
  await this._fetchSupportedCurrenciesIfNeeded();
3035
- const toCurrencyExtraId = (_this$_supportedCoins9 = (_this$_supportedCoins10 = this._supportedCoins.find(item => {
3036
- var _item$coin4;
3037
- return ((_item$coin4 = item.coin) == null ? void 0 : _item$coin4.ticker) === (toCoin == null ? void 0 : toCoin.ticker);
3038
- })) == null ? void 0 : _this$_supportedCoins10.extraId) != null ? _this$_supportedCoins9 : "";
3039
3059
  const requestData = {
3040
3060
  partner: partner,
3041
3061
  fromCurrency: rawSwapData == null ? void 0 : rawSwapData.fromCurrency,
@@ -3046,6 +3066,8 @@ class SwapspaceSwapProvider extends SwapProvider {
3046
3066
  amount: amount,
3047
3067
  fixed: false,
3048
3068
  extraId: toCurrencyExtraId != null ? toCurrencyExtraId : "",
3069
+ refundExtraId: refundExtraId != null ? refundExtraId : "",
3070
+ // This param is not documented. But the refund is usually manual so this is not critical.
3049
3071
  rateId: rawSwapData == null ? void 0 : rawSwapData.id,
3050
3072
  userIp: clientIpAddress,
3051
3073
  refund: refundAddress
@@ -3055,7 +3077,7 @@ class SwapspaceSwapProvider extends SwapProvider {
3055
3077
  const result = response.data;
3056
3078
  Logger.log(`Creation result ${safeStringify(result)}`, loggerSource);
3057
3079
  if (result != null && result.id) {
3058
- var _result$from, _result$from2, _result$to, _result$to2, _result$from4, _result$from5, _result$to4, _result$to5;
3080
+ var _result$from, _result$from2, _result$to, _result$to2, _result$from4, _result$from5, _result$to4, _result$to5, _result$from$extraId, _result$from6;
3059
3081
  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}`);
3060
3082
  /* We use the returned rate preferably but if the retrieved
3061
3083
  * rate 0/null/undefined we calculate it manually */
@@ -3075,6 +3097,7 @@ class SwapspaceSwapProvider extends SwapProvider {
3075
3097
  toCoin: toCoin,
3076
3098
  toAmount: AmountUtils.trim(result == null || (_result$to4 = result.to) == null ? void 0 : _result$to4.amount, toCoin.digits),
3077
3099
  toAddress: result == null || (_result$to5 = result.to) == null ? void 0 : _result$to5.address,
3100
+ fromCurrencyExtraId: (_result$from$extraId = result == null || (_result$from6 = result.from) == null ? void 0 : _result$from6.extraId) != null ? _result$from$extraId : "",
3078
3101
  rate: AmountUtils.trim(rate, this._maxRateDigits)
3079
3102
  };
3080
3103
  }
@@ -3152,9 +3175,9 @@ class SwapspaceSwapProvider extends SwapProvider {
3152
3175
  const wo404 = responses.flat();
3153
3176
  Logger.log("All swaps RAW: " + JSON.stringify(wo404.map(r => r.data)), loggerSource);
3154
3177
  const swaps = wo404.map(r => r.data).map((swap, index) => {
3155
- var _this$_supportedCoins11, _this$_supportedCoins12;
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;
3157
- const toCoin = (_this$_supportedCoins12 = this._supportedCoins.find(i => i.code === swap.to.code && i.network === swap.to.network)) == null ? void 0 : _this$_supportedCoins12.coin;
3178
+ var _this$_supportedCoins9, _this$_supportedCoins10, _swap$from$extraId, _swap$to$extraId, _swap$refundExtraId;
3179
+ const fromCoin = (_this$_supportedCoins9 = this._supportedCoins.find(i => i.code === swap.from.code && i.network === swap.from.network)) == null ? void 0 : _this$_supportedCoins9.coin;
3180
+ const toCoin = (_this$_supportedCoins10 = this._supportedCoins.find(i => i.code === swap.to.code && i.network === swap.to.network)) == null ? void 0 : _this$_supportedCoins10.coin;
3158
3181
  if (!fromCoin || !toCoin) {
3159
3182
  return []; // We skip swaps with not supported coins for now
3160
3183
  }
@@ -3164,7 +3187,7 @@ class SwapspaceSwapProvider extends SwapProvider {
3164
3187
  const status = this._mapSwapspaceStatusToRabbitStatus(swap.status, isExpiredByTime);
3165
3188
  const toDigits = status === SwapProvider.SWAP_STATUSES.REFUNDED ? fromCoin.digits : toCoin.digits;
3166
3189
  const addressToSendCoinsToSwapspace = swap.from.address;
3167
- return new ExistingSwap(swapIds[index], status, toUtcTimestamp(swap.timestamps.createdAt), expiresAt, swap.confirmations, AmountUtils.trim(swap.rate, this._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);
3190
+ return new ExistingSwap(swapIds[index], status, toUtcTimestamp(swap.timestamps.createdAt), expiresAt, swap.confirmations, AmountUtils.trim(swap.rate, this._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);
3168
3191
  }).flat();
3169
3192
  Logger.log(`Swap details result ${safeStringify(swaps)}`, loggerSource);
3170
3193
  return {
@@ -3204,6 +3227,17 @@ class SwapspaceSwapProvider extends SwapProvider {
3204
3227
  }
3205
3228
  return false;
3206
3229
  }
3230
+ getExtraIdNameIfPresent(asset) {
3231
+ try {
3232
+ const assetData = this._supportedCoins.find(i => {
3233
+ var _i$coin4;
3234
+ return ((_i$coin4 = i.coin) == null ? void 0 : _i$coin4.ticker) === (asset == null ? void 0 : asset.ticker);
3235
+ });
3236
+ return assetData != null && assetData.hasExtraId ? assetData == null ? void 0 : assetData.extraIdName : null;
3237
+ } catch (e) {
3238
+ improveAndRethrow(e, "getExtraIdNameIfPresent");
3239
+ }
3240
+ }
3207
3241
  }
3208
3242
 
3209
3243
  class SwapUtils {
@@ -3443,6 +3477,7 @@ class PublicSwapService {
3443
3477
  * @param fromCoin {Coin}
3444
3478
  * @param toCoin {Coin}
3445
3479
  * @param fromAmountCoins {string}
3480
+ * @param [withoutFiat=false] {boolean} pass true if you don't need the fiat equivalent - this will diminish requests count
3446
3481
  * @return {Promise<{
3447
3482
  * result: false,
3448
3483
  * reason: string,
@@ -3456,11 +3491,11 @@ class PublicSwapService {
3456
3491
  * swapCreationInfo: BaseSwapCreationInfo
3457
3492
  * }>}
3458
3493
  */
3459
- async getPublicSwapDetails(fromCoin, toCoin, fromAmountCoins) {
3494
+ async getPublicSwapDetails(fromCoin, toCoin, fromAmountCoins, withoutFiat = false) {
3460
3495
  const loggerSource = "getPublicSwapDetails";
3461
3496
  try {
3462
3497
  var _await$this$_swapProv, _await$this$_swapProv2, _result$swapCreationI, _result$swapCreationI2;
3463
- const coinUsdtRate = (_await$this$_swapProv = (_await$this$_swapProv2 = await this._swapProvider.getCoinToUSDTRate(fromCoin)) == null ? void 0 : _await$this$_swapProv2.rate) != null ? _await$this$_swapProv : null;
3498
+ const coinUsdtRate = withoutFiat ? null : (_await$this$_swapProv = (_await$this$_swapProv2 = await this._swapProvider.getCoinToUSDTRate(fromCoin)) == null ? void 0 : _await$this$_swapProv2.rate) != null ? _await$this$_swapProv : null;
3464
3499
  const details = await this._swapProvider.getSwapInfo(fromCoin, toCoin, fromAmountCoins, coinUsdtRate);
3465
3500
  const min = details.result ? details.min : details.smallestMin;
3466
3501
  const max = details.result ? details.max : details.greatestMax;
@@ -3526,6 +3561,8 @@ class PublicSwapService {
3526
3561
  * @param toAddress {string}
3527
3562
  * @param refundAddress {string}
3528
3563
  * @param clientIp {string}
3564
+ * @param [toCurrencyExtraId] {string}
3565
+ * @param [refundExtraId] {string}
3529
3566
  * @return {Promise<{
3530
3567
  * result: true,
3531
3568
  * fiatCurrencyCode: string,
@@ -3539,13 +3576,14 @@ class PublicSwapService {
3539
3576
  * fiatCurrencyDecimals: number,
3540
3577
  * fromCoin: Coin,
3541
3578
  * rate: string,
3542
- * swapId: string
3579
+ * swapId: string,
3580
+ * fromCurrencyExtraId: string
3543
3581
  * }|{
3544
3582
  * result: false,
3545
3583
  * reason: string
3546
3584
  * }>}
3547
3585
  */
3548
- async createPublicSwap(fromCoin, toCoin, fromAmount, swapCreationInfo, toAddress, refundAddress, clientIp) {
3586
+ async createPublicSwap(fromCoin, toCoin, fromAmount, swapCreationInfo, toAddress, refundAddress, clientIp, toCurrencyExtraId, refundExtraId) {
3549
3587
  const loggerSource = "createPublicSwap";
3550
3588
  try {
3551
3589
  var _swapCreationInfo$fro, _swapCreationInfo$toC;
@@ -3556,7 +3594,7 @@ class PublicSwapService {
3556
3594
  fromCoin: swapCreationInfo == null || (_swapCreationInfo$fro = swapCreationInfo.fromCoin) == null ? void 0 : _swapCreationInfo$fro.ticker,
3557
3595
  toCoin: swapCreationInfo == null || (_swapCreationInfo$toC = swapCreationInfo.toCoin) == null ? void 0 : _swapCreationInfo$toC.ticker
3558
3596
  }))}`, loggerSource);
3559
- const result = await this._swapProvider.createSwap(fromCoin, toCoin, fromAmount, toAddress, refundAddress, swapCreationInfo.rawSwapData, clientIp);
3597
+ const result = await this._swapProvider.createSwap(fromCoin, toCoin, fromAmount, toAddress, refundAddress, swapCreationInfo.rawSwapData, clientIp, toCurrencyExtraId, refundExtraId);
3560
3598
  Logger.log(`Created:${safeStringify(_extends({}, result, {
3561
3599
  fromCoin: fromCoin == null ? void 0 : fromCoin.ticker,
3562
3600
  toCoin: toCoin == null ? void 0 : toCoin.ticker
@@ -3578,6 +3616,7 @@ class PublicSwapService {
3578
3616
  }
3579
3617
  }
3580
3618
  if (result.result && result != null && result.swapId) {
3619
+ var _result$fromCurrencyE;
3581
3620
  let fromAmountFiat = null,
3582
3621
  toAmountFiat = null;
3583
3622
  try {
@@ -3607,7 +3646,9 @@ class PublicSwapService {
3607
3646
  fiatCurrencyDecimals: PublicSwapService._fiatDecimalsCount,
3608
3647
  rate: result.rate,
3609
3648
  durationMinutesRange: swapCreationInfo.durationMinutesRange,
3610
- address: result.fromAddress // CRITICAL: this is the address to send coins to swaps provider
3649
+ address: result.fromAddress,
3650
+ // CRITICAL: this is the address to send coins to swaps provider
3651
+ fromCurrencyExtraId: (_result$fromCurrencyE = result.fromCurrencyExtraId) != null ? _result$fromCurrencyE : "" // CRITICAL: this is the extra ID for address to send coins to swaps provider
3611
3652
  };
3612
3653
  this._savePublicSwapIdLocally(result.swapId);
3613
3654
  Logger.log(`Returning: ${safeStringify(_extends({}, toReturn, {
@@ -3776,6 +3817,18 @@ class PublicSwapService {
3776
3817
  }
3777
3818
  return null;
3778
3819
  }
3820
+
3821
+ /**
3822
+ * @param asset {Coin}
3823
+ * @return {string|null}
3824
+ */
3825
+ getExtraIdNameIfPresentForAsset(asset) {
3826
+ try {
3827
+ return this._swapProvider.getExtraIdNameIfPresent(asset);
3828
+ } catch (e) {
3829
+ improveAndRethrow(e, "getExtraIdNameIfPresentForAsset");
3830
+ }
3831
+ }
3779
3832
  }
3780
3833
  PublicSwapService.PUBLIC_SWAP_CREATED_EVENT = "publicSwapCreatedEvent";
3781
3834
  PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS = {