@rabbitio/ui-kit 1.0.0-beta.89 → 1.0.0-beta.90

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.
Files changed (289) hide show
  1. package/coverage/clover.xml +7146 -2602
  2. package/coverage/coverage-final.json +181 -114
  3. package/coverage/index.html +374 -104
  4. package/coverage/{rabbit-ui-kit → ui-kit}/index.html +3 -3
  5. package/coverage/{rabbit-ui-kit → ui-kit}/index.js.html +3 -3
  6. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/adapters/analyticsAdapters/googleAnalyticsAdapter.js.html +3 -3
  7. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/adapters/analyticsAdapters/index.html +3 -3
  8. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/adapters/analyticsAdapters/metrikaAdapter.js.html +3 -3
  9. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/adapters/analyticsAdapters/mixpanelAdapter.js.html +3 -3
  10. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/adapters/axiosAdapter.js.html +3 -3
  11. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/adapters/index.html +3 -3
  12. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/adapters/qrUtils.js.html +3 -3
  13. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/external-apis/apiGroups.js.html +3 -3
  14. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/external-apis/emailAPI.js.html +3 -3
  15. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/external-apis/index.html +3 -3
  16. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/external-apis/ipAddressProviders.js.html +3 -3
  17. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/globalConstants.jsx.html +3 -3
  18. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/index.html +3 -3
  19. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/models/blockchain.js.html +6 -6
  20. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/models/coin.js.html +3 -3
  21. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/models/index.html +20 -20
  22. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/models/protocol.js.html +16 -16
  23. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/services/fiatCurrenciesService.js.html +3 -3
  24. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/services/index.html +3 -3
  25. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/amountUtils.js.html +23 -23
  26. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/cache.js.html +8 -8
  27. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/errorUtils.js.html +15 -15
  28. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/index.html +3 -3
  29. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/logging/index.html +3 -3
  30. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/logging/logger.js.html +23 -23
  31. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/logging/logsStorage.js.html +5 -5
  32. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/postponeExecution.js.html +3 -3
  33. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/rabbitTicker.js.html +3 -3
  34. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/safeStringify.js.html +36 -36
  35. package/coverage/{rabbit-ui-kit → ui-kit}/src/index.html +7 -7
  36. package/coverage/{rabbit-ui-kit → ui-kit}/src/index.js.html +9 -6
  37. package/coverage/{rabbit-ui-kit → ui-kit}/src/robust-api-caller/cacheAndConcurrentRequestsResolver.js.html +3 -3
  38. package/coverage/{rabbit-ui-kit → ui-kit}/src/robust-api-caller/cachedRobustExternalApiCallerService.js.html +3 -3
  39. package/coverage/{rabbit-ui-kit → ui-kit}/src/robust-api-caller/cancelProcessing.js.html +3 -3
  40. package/coverage/{rabbit-ui-kit → ui-kit}/src/robust-api-caller/concurrentCalculationsMetadataHolder.js.html +3 -3
  41. package/coverage/{rabbit-ui-kit → ui-kit}/src/robust-api-caller/externalApiProvider.js.html +3 -3
  42. package/coverage/{rabbit-ui-kit → ui-kit}/src/robust-api-caller/externalServicesStatsCollector.js.html +3 -3
  43. package/coverage/{rabbit-ui-kit → ui-kit}/src/robust-api-caller/index.html +3 -3
  44. package/coverage/{rabbit-ui-kit → ui-kit}/src/robust-api-caller/robustExternalAPICallerService.js.html +3 -3
  45. package/coverage/ui-kit/src/swaps-lib/external-apis/exolixSwapProvider.js.html +1813 -0
  46. package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/external-apis/index.html +41 -26
  47. package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/external-apis/letsExchangeSwapProvider.js.html +23 -14
  48. package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/external-apis/swapProvider.js.html +296 -392
  49. package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/external-apis/swapspaceSwapProvider.js.html +108 -138
  50. package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/baseSwapCreationInfo.js.html +21 -6
  51. package/coverage/ui-kit/src/swaps-lib/models/existingSwap.js.html +514 -0
  52. package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/existingSwapWithFiatData.js.html +147 -87
  53. package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/index.html +43 -43
  54. package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/partner.js.html +6 -6
  55. package/coverage/ui-kit/src/swaps-lib/models/swapProviderCoinInfo.js.html +331 -0
  56. package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/services/index.html +7 -7
  57. package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/services/publicSwapService.js.html +76 -817
  58. package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/utils/index.html +3 -3
  59. package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/utils/swapUtils.js.html +4 -4
  60. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/arrowIcon.jsx.html +3 -3
  61. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/arrowTosca.jsx.html +3 -3
  62. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/arrowWhite.jsx.html +3 -3
  63. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/darkRectangle.jsx.html +3 -3
  64. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/determinedError.jsx.html +3 -3
  65. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/failedValidationIcon.jsx.html +3 -3
  66. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/index.html +3 -3
  67. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/infoIcon.jsx.html +3 -3
  68. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/messageIcon.jsx.html +3 -3
  69. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/noticeQuestionIcon.jsx.html +3 -3
  70. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/successfulValidationIcon.jsx.html +3 -3
  71. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/supportDialogImage.jsx.html +3 -3
  72. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/walletIcon.jsx.html +3 -3
  73. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/AssetIcon/AssetIcon.jsx.html +3 -3
  74. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/AssetIcon/index.html +3 -3
  75. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/AssetSelection/AssetSelection.jsx.html +3 -3
  76. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/AssetSelection/index.html +3 -3
  77. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/BackgroundTitle/BackgroundTitle.jsx.html +3 -3
  78. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/BackgroundTitle/index.html +3 -3
  79. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/InformationMessage/InformationMessage.jsx.html +3 -3
  80. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/InformationMessage/index.html +3 -3
  81. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/Input/Input.jsx.html +3 -3
  82. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/Input/index.html +3 -3
  83. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/LoadingDots/LoadingDots.jsx.html +3 -3
  84. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/LoadingDots/index.html +3 -3
  85. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/NoticeIcon/NoticeIcon.jsx.html +3 -3
  86. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/NoticeIcon/index.html +3 -3
  87. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/QrCode/QrCode.jsx.html +3 -3
  88. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/QrCode/index.html +3 -3
  89. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/RateSelector/RateSelector.jsx.html +3 -3
  90. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/RateSelector/index.html +3 -3
  91. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/SupportChat/SupportChat.jsx.html +3 -3
  92. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/SupportChat/index.html +3 -3
  93. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/Textarea/Textarea.jsx.html +3 -3
  94. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/Textarea/index.html +3 -3
  95. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/TitleBox/TitleBox.jsx.html +3 -3
  96. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/TitleBox/index.html +3 -3
  97. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/Tooltip/Tooltip.jsx.html +3 -3
  98. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/Tooltip/index.html +3 -3
  99. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/TwoLinesOfText/LinesOfText.jsx.html +3 -3
  100. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/TwoLinesOfText/index.html +3 -3
  101. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/Validation/Validation.jsx.html +3 -3
  102. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/Validation/index.html +3 -3
  103. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/buttons/Button/Button.jsx.html +3 -3
  104. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/buttons/Button/index.html +3 -3
  105. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/buttons/Close/Close.jsx.html +3 -3
  106. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/buttons/Close/index.html +3 -3
  107. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/buttons/LinkButton/LinkButton.jsx.html +3 -3
  108. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/buttons/LinkButton/index.html +3 -3
  109. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx.html +3 -3
  110. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/buttons/RadioButtonWithText/index.html +3 -3
  111. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/AmountInput/AmountInput.jsx.html +3 -3
  112. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/AmountInput/index.html +3 -3
  113. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/CoinPicker/CoinPicker.jsx.html +3 -3
  114. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/CoinPicker/index.html +3 -3
  115. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/ColoredNotice/ColoredNotice.jsx.html +3 -3
  116. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/ColoredNotice/index.html +3 -3
  117. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/LineWithIconLink/LineWithIconLink.jsx.html +3 -3
  118. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/LineWithIconLink/index.html +3 -3
  119. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/LogoCarousel/LogoCarousel.jsx.html +3 -3
  120. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/LogoCarousel/index.html +3 -3
  121. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/SearchableCoinsList/SearchableCoinsList.jsx.html +3 -3
  122. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/SearchableCoinsList/index.html +3 -3
  123. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx.html +3 -3
  124. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/TitledLineWithIconLink/index.html +3 -3
  125. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx.html +3 -3
  126. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/CoinPickerDialogStep/index.html +3 -3
  127. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/Dialog/Dialog.jsx.html +3 -3
  128. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/Dialog/DialogButtons/DialogButtons.jsx.html +3 -3
  129. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/Dialog/DialogButtons/index.html +3 -3
  130. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/Dialog/DialogStep/DialogStep.jsx.html +3 -3
  131. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/Dialog/DialogStep/index.html +3 -3
  132. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/Dialog/index.html +3 -3
  133. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/SwapForm/SwapForm.jsx.html +13 -7
  134. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/SwapForm/index.html +7 -7
  135. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/WaitlistSubscription/WaitlistSubscription.jsx.html +3 -3
  136. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/WaitlistSubscription/index.html +3 -3
  137. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx.html +3 -3
  138. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/templates/DeterminedErrorDialogStep/index.html +3 -3
  139. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/hooks/index.html +3 -3
  140. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/hooks/useCallHandlingErrors.js.html +3 -3
  141. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/hooks/useIsHydrated.js.html +3 -3
  142. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/hooks/useReferredState.js.html +3 -3
  143. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/utils/index.html +3 -3
  144. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/utils/inputValueProviders.js.html +3 -3
  145. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/utils/textUtils.js.html +3 -3
  146. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/utils/uiUtils.js.html +3 -3
  147. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/utils/urlQueryUtils.js.html +3 -3
  148. package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/BackgroundTitle.stories.jsx.html +3 -3
  149. package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/LinesOfText.stories.jsx.html +3 -3
  150. package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/LoadingDots.stories.jsx.html +3 -3
  151. package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/QrCode.stories.jsx.html +3 -3
  152. package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/RateSelector.stories.jsx.html +3 -3
  153. package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/Validation.stories.jsx.html +3 -3
  154. package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/buttons/Button.stories.jsx.html +3 -3
  155. package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/buttons/Close.stories.jsx.html +3 -3
  156. package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/buttons/LinkButton.stories.jsx.html +3 -3
  157. package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/buttons/index.html +3 -3
  158. package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/index.html +3 -3
  159. package/coverage/{rabbit-ui-kit → ui-kit}/stories/molecules/AmountInput.stories.jsx.html +3 -3
  160. package/coverage/{rabbit-ui-kit → ui-kit}/stories/molecules/CoinPicker.stories.jsx.html +3 -3
  161. package/coverage/{rabbit-ui-kit → ui-kit}/stories/molecules/ColoredNotice.stories.jsx.html +3 -3
  162. package/coverage/{rabbit-ui-kit → ui-kit}/stories/molecules/LineWithIconLink.stories.jsx.html +3 -3
  163. package/coverage/{rabbit-ui-kit → ui-kit}/stories/molecules/LogoCarousel.stories.jsx.html +3 -3
  164. package/coverage/{rabbit-ui-kit → ui-kit}/stories/molecules/TitledLineWithIconLink.stories.jsx.html +3 -3
  165. package/coverage/{rabbit-ui-kit → ui-kit}/stories/molecules/index.html +3 -3
  166. package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/Dialog.stories.jsx.html +3 -3
  167. package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/DialogButtons/DialogButtons.stories.jsx.html +3 -3
  168. package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/DialogButtons/index.html +3 -3
  169. package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/DialogStep/DialogStep.stories.jsx.html +3 -3
  170. package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/DialogStep/index.html +3 -3
  171. package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/index.html +3 -3
  172. package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/WaitlistSubscription.stories.jsx.html +3 -3
  173. package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/index.html +3 -3
  174. package/coverage/{rabbit-ui-kit → ui-kit}/stories/stubs/coins.jsx.html +3 -3
  175. package/coverage/{rabbit-ui-kit → ui-kit}/stories/stubs/exampleContent.jsx.html +3 -3
  176. package/coverage/{rabbit-ui-kit → ui-kit}/stories/stubs/index.html +3 -3
  177. package/coverage/{rabbit-ui-kit → ui-kit}/stories/templates/DeterminedErrorDialogStep.stories.jsx.html +3 -3
  178. package/coverage/{rabbit-ui-kit → ui-kit}/stories/templates/index.html +3 -3
  179. package/coverage/ui-kit/storybook-static/223.063dc770.iframe.bundle.js.html +85 -0
  180. package/coverage/ui-kit/storybook-static/230.7eace282.iframe.bundle.js.html +85 -0
  181. package/coverage/ui-kit/storybook-static/242.981bebe4.iframe.bundle.js.html +85 -0
  182. package/coverage/ui-kit/storybook-static/312.6f62bbd9.iframe.bundle.js.html +85 -0
  183. package/coverage/ui-kit/storybook-static/341.57a15f57.iframe.bundle.js.html +85 -0
  184. package/coverage/ui-kit/storybook-static/374.99dab897.iframe.bundle.js.html +85 -0
  185. package/coverage/ui-kit/storybook-static/506.c6cb656d.iframe.bundle.js.html +85 -0
  186. package/coverage/ui-kit/storybook-static/547.cc28f1fd.iframe.bundle.js.html +85 -0
  187. package/coverage/ui-kit/storybook-static/586.ec70f0e7.iframe.bundle.js.html +85 -0
  188. package/coverage/ui-kit/storybook-static/595.2e40d981.iframe.bundle.js.html +85 -0
  189. package/coverage/ui-kit/storybook-static/607.3ea32459.iframe.bundle.js.html +85 -0
  190. package/coverage/ui-kit/storybook-static/609.097df435.iframe.bundle.js.html +85 -0
  191. package/coverage/ui-kit/storybook-static/797.c87cdf19.iframe.bundle.js.html +85 -0
  192. package/coverage/ui-kit/storybook-static/889.a357fd2d.iframe.bundle.js.html +85 -0
  193. package/coverage/ui-kit/storybook-static/909.28bf3d7c.iframe.bundle.js.html +85 -0
  194. package/coverage/ui-kit/storybook-static/976.b5f1a5d4.iframe.bundle.js.html +85 -0
  195. package/coverage/ui-kit/storybook-static/996.07a638d5.iframe.bundle.js.html +85 -0
  196. package/coverage/ui-kit/storybook-static/atoms-BackgroundTitle-stories.1a5386a1.iframe.bundle.js.html +85 -0
  197. package/coverage/ui-kit/storybook-static/atoms-LinesOfText-stories.b7c8f08a.iframe.bundle.js.html +85 -0
  198. package/coverage/ui-kit/storybook-static/atoms-LoadingDots-stories.5180c2f1.iframe.bundle.js.html +85 -0
  199. package/coverage/ui-kit/storybook-static/atoms-QrCode-stories.006bd0cc.iframe.bundle.js.html +85 -0
  200. package/coverage/ui-kit/storybook-static/atoms-RateSelector-stories.19c65c98.iframe.bundle.js.html +85 -0
  201. package/coverage/ui-kit/storybook-static/atoms-Validation-stories.d561b311.iframe.bundle.js.html +85 -0
  202. package/coverage/ui-kit/storybook-static/atoms-buttons-Button-stories.e8e6b930.iframe.bundle.js.html +85 -0
  203. package/coverage/ui-kit/storybook-static/atoms-buttons-Close-stories.0a902a7c.iframe.bundle.js.html +85 -0
  204. package/coverage/ui-kit/storybook-static/atoms-buttons-LinkButton-stories.10813be5.iframe.bundle.js.html +85 -0
  205. package/coverage/ui-kit/storybook-static/index.html +656 -0
  206. package/coverage/ui-kit/storybook-static/main.54ca9836.iframe.bundle.js.html +85 -0
  207. package/coverage/ui-kit/storybook-static/molecules-ColoredNotice-stories.7a5d624e.iframe.bundle.js.html +85 -0
  208. package/coverage/ui-kit/storybook-static/molecules-LineWithIconLink-stories.b7f70ee2.iframe.bundle.js.html +85 -0
  209. package/coverage/ui-kit/storybook-static/molecules-LogoCarousel-stories.9be2ef69.iframe.bundle.js.html +85 -0
  210. package/coverage/ui-kit/storybook-static/molecules-TitledLineWithIconLink-stories.1383fe3f.iframe.bundle.js.html +85 -0
  211. package/coverage/ui-kit/storybook-static/organisms-Dialog-Dialog-stories.4e6da717.iframe.bundle.js.html +85 -0
  212. package/coverage/ui-kit/storybook-static/organisms-Dialog-DialogButtons-DialogButtons-stories.1d1f9803.iframe.bundle.js.html +85 -0
  213. package/coverage/ui-kit/storybook-static/organisms-Dialog-DialogStep-DialogStep-stories.74896048.iframe.bundle.js.html +85 -0
  214. package/coverage/ui-kit/storybook-static/organisms-WaitlistSubscription-stories.a7c49a29.iframe.bundle.js.html +85 -0
  215. package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/dist/global.css.html +118 -0
  216. package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/dist/index.html +116 -0
  217. package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/@storybook/addon-backgrounds/dist/index.html +116 -0
  218. package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/@storybook/addon-backgrounds/dist/preview.js.html +118 -0
  219. package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/@storybook/components/dist/formatter-SWP5E3XI.mjs.html +118 -0
  220. package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/@storybook/components/dist/index.html +116 -0
  221. package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/buffer/index.html +116 -0
  222. package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/buffer/index.js.html +118 -0
  223. package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/markdown-to-jsx/dist/index.html +116 -0
  224. package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/markdown-to-jsx/dist/index.modern.js.html +118 -0
  225. package/coverage/ui-kit/storybook-static/runtime~main.bf0b2dcd.iframe.bundle.js.html +85 -0
  226. package/coverage/ui-kit/storybook-static/sb-addons/actions-9/index.html +116 -0
  227. package/coverage/ui-kit/storybook-static/sb-addons/actions-9/manager-bundle.js.html +94 -0
  228. package/coverage/ui-kit/storybook-static/sb-addons/essentials-backgrounds-2/index.html +116 -0
  229. package/coverage/ui-kit/storybook-static/sb-addons/essentials-backgrounds-2/manager-bundle.js.html +121 -0
  230. package/coverage/ui-kit/storybook-static/sb-addons/essentials-controls-1/index.html +116 -0
  231. package/coverage/ui-kit/storybook-static/sb-addons/essentials-controls-1/manager-bundle.js.html +274 -0
  232. package/coverage/ui-kit/storybook-static/sb-addons/essentials-measure-4/index.html +116 -0
  233. package/coverage/ui-kit/storybook-static/sb-addons/essentials-measure-4/manager-bundle.js.html +94 -0
  234. package/coverage/ui-kit/storybook-static/sb-addons/essentials-outline-5/index.html +116 -0
  235. package/coverage/ui-kit/storybook-static/sb-addons/essentials-outline-5/manager-bundle.js.html +94 -0
  236. package/coverage/ui-kit/storybook-static/sb-addons/essentials-toolbars-3/index.html +116 -0
  237. package/coverage/ui-kit/storybook-static/sb-addons/essentials-toolbars-3/manager-bundle.js.html +94 -0
  238. package/coverage/ui-kit/storybook-static/sb-addons/interactions-7/index.html +116 -0
  239. package/coverage/ui-kit/storybook-static/sb-addons/interactions-7/manager-bundle.js.html +121 -0
  240. package/coverage/ui-kit/storybook-static/sb-addons/links-0/index.html +116 -0
  241. package/coverage/ui-kit/storybook-static/sb-addons/links-0/manager-bundle.js.html +94 -0
  242. package/coverage/ui-kit/storybook-static/sb-addons/onboarding-6/index.html +116 -0
  243. package/coverage/ui-kit/storybook-static/sb-addons/onboarding-6/manager-bundle.js.html +1588 -0
  244. package/coverage/ui-kit/storybook-static/sb-addons/viewport-8/index.html +116 -0
  245. package/coverage/ui-kit/storybook-static/sb-addons/viewport-8/manager-bundle.js.html +94 -0
  246. package/coverage/ui-kit/storybook-static/sb-manager/WithTooltip-V3YHNWJZ-LVYLGZW2.js.html +88 -0
  247. package/coverage/ui-kit/storybook-static/sb-manager/chunk-2IXBUOFS.js.html +106 -0
  248. package/coverage/ui-kit/storybook-static/sb-manager/chunk-INSKDKQB.js.html +1129 -0
  249. package/coverage/ui-kit/storybook-static/sb-manager/chunk-NGTUFCUO.js.html +112 -0
  250. package/coverage/ui-kit/storybook-static/sb-manager/chunk-UUEAOBSN.js.html +1303 -0
  251. package/coverage/ui-kit/storybook-static/sb-manager/chunk-ZEU7PDD3.js.html +88 -0
  252. package/coverage/ui-kit/storybook-static/sb-manager/formatter-SWP5E3XI-7BGIK6BL.js.html +553 -0
  253. package/coverage/ui-kit/storybook-static/sb-manager/globals-module-info.js.html +88 -0
  254. package/coverage/ui-kit/storybook-static/sb-manager/globals.js.html +88 -0
  255. package/coverage/ui-kit/storybook-static/sb-manager/index.html +281 -0
  256. package/coverage/ui-kit/storybook-static/sb-manager/index.js.html +88 -0
  257. package/coverage/ui-kit/storybook-static/sb-manager/runtime.js.html +88 -0
  258. package/coverage/ui-kit/storybook-static/sb-manager/syntaxhighlighter-V7JZZA35-DXZCI2WR.js.html +88 -0
  259. package/coverage/ui-kit/storybook-static/sb-preview/globals.js.html +88 -0
  260. package/coverage/ui-kit/storybook-static/sb-preview/index.html +131 -0
  261. package/coverage/ui-kit/storybook-static/sb-preview/runtime.js.html +421 -0
  262. package/coverage/ui-kit/storybook-static/templates-DeterminedErrorDialogStep-stories.3cc14214.iframe.bundle.js.html +85 -0
  263. package/dist/index.cjs +1248 -904
  264. package/dist/index.cjs.map +1 -1
  265. package/dist/index.modern.js +577 -404
  266. package/dist/index.modern.js.map +1 -1
  267. package/dist/index.module.js +1172 -830
  268. package/dist/index.module.js.map +1 -1
  269. package/dist/index.umd.js +1249 -905
  270. package/dist/index.umd.js.map +1 -1
  271. package/package.json +1 -1
  272. package/src/index.js +1 -0
  273. package/src/swaps-lib/external-apis/exolixSwapProvider.js +576 -0
  274. package/src/swaps-lib/external-apis/letsExchangeSwapProvider.js +11 -8
  275. package/src/swaps-lib/external-apis/swapProvider.js +16 -48
  276. package/src/swaps-lib/external-apis/swapspaceSwapProvider.js +15 -25
  277. package/src/swaps-lib/models/baseSwapCreationInfo.js +5 -0
  278. package/src/swaps-lib/models/existingSwap.js +92 -22
  279. package/src/swaps-lib/models/existingSwapWithFiatData.js +52 -32
  280. package/src/swaps-lib/models/swapProviderCoinInfo.js +6 -6
  281. package/src/swaps-lib/services/publicSwapService.js +70 -317
  282. package/src/swaps-lib/test/external-apis/exolixSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +34 -0
  283. package/src/swaps-lib/test/external-apis/exolixSwapProvider/createSwap.test.js +1043 -0
  284. package/src/swaps-lib/test/external-apis/exolixSwapProvider/getSwapInfo.test.js +611 -0
  285. package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/createSwap.test.js +57 -92
  286. package/src/swaps-lib/utils/swapUtils.js +1 -1
  287. package/src/ui-kit/components/organisms/SwapForm/SwapForm.jsx +3 -1
  288. package/coverage/rabbit-ui-kit/src/swaps-lib/models/existingSwap.js.html +0 -304
  289. package/coverage/rabbit-ui-kit/src/swaps-lib/models/swapProviderCoinInfo.js.html +0 -331
package/dist/index.cjs CHANGED
@@ -5,7 +5,7 @@ var ResizeObserver$1 = require('resize-observer-polyfill');
5
5
  var bodyScrollLock = require('body-scroll-lock');
6
6
  var animateScrollTo = require('animated-scroll-to');
7
7
  var copy = require('clipboard-copy');
8
- var bignumber_js = require('bignumber.js');
8
+ var BigNumber = require('bignumber.js');
9
9
  var TextareaAutosize = require('react-textarea-autosize');
10
10
  var QRCode = require('qrcode');
11
11
  var axios = require('axios');
@@ -20,6 +20,7 @@ var AnimateHeight__default = /*#__PURE__*/_interopDefaultLegacy(AnimateHeight);
20
20
  var ResizeObserver__default = /*#__PURE__*/_interopDefaultLegacy(ResizeObserver$1);
21
21
  var animateScrollTo__default = /*#__PURE__*/_interopDefaultLegacy(animateScrollTo);
22
22
  var copy__default = /*#__PURE__*/_interopDefaultLegacy(copy);
23
+ var BigNumber__default = /*#__PURE__*/_interopDefaultLegacy(BigNumber);
23
24
  var TextareaAutosize__default = /*#__PURE__*/_interopDefaultLegacy(TextareaAutosize);
24
25
  var QRCode__default = /*#__PURE__*/_interopDefaultLegacy(QRCode);
25
26
  var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
@@ -39,12 +40,12 @@ function createCommonjsModule(fn) {
39
40
  * This source code is licensed under the MIT license found in the
40
41
  * LICENSE file in the root directory of this source tree.
41
42
  */
42
- var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
43
+ var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e$1=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
43
44
  Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
44
- function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}var AsyncMode=l;var ConcurrentMode=m;var ContextConsumer=k;var ContextProvider=h;var Element=c;var ForwardRef=n;var Fragment=e;var Lazy=t;var Memo=r;var Portal=d;
45
- var Profiler=g;var StrictMode=f;var Suspense=p;var isAsyncMode=function(a){return A(a)||z(a)===l};var isConcurrentMode=A;var isContextConsumer=function(a){return z(a)===k};var isContextProvider=function(a){return z(a)===h};var isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};var isForwardRef=function(a){return z(a)===n};var isFragment=function(a){return z(a)===e};var isLazy=function(a){return z(a)===t};
45
+ function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e$1:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}var AsyncMode=l;var ConcurrentMode=m;var ContextConsumer=k;var ContextProvider=h;var Element=c;var ForwardRef=n;var Fragment=e$1;var Lazy=t;var Memo=r;var Portal=d;
46
+ var Profiler=g;var StrictMode=f;var Suspense=p;var isAsyncMode=function(a){return A(a)||z(a)===l};var isConcurrentMode=A;var isContextConsumer=function(a){return z(a)===k};var isContextProvider=function(a){return z(a)===h};var isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};var isForwardRef=function(a){return z(a)===n};var isFragment=function(a){return z(a)===e$1};var isLazy=function(a){return z(a)===t};
46
47
  var isMemo=function(a){return z(a)===r};var isPortal=function(a){return z(a)===d};var isProfiler=function(a){return z(a)===g};var isStrictMode=function(a){return z(a)===f};var isSuspense=function(a){return z(a)===p};
47
- var isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};var typeOf=z;
48
+ var isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e$1||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};var typeOf=z;
48
49
 
49
50
  var reactIs_production_min = {
50
51
  AsyncMode: AsyncMode,
@@ -1659,7 +1660,7 @@ var Logger = /*#__PURE__*/function () {
1659
1660
  return Logger;
1660
1661
  }();
1661
1662
 
1662
- function _catch$g(body, recover) {
1663
+ function _catch$h(body, recover) {
1663
1664
  try {
1664
1665
  var result = body();
1665
1666
  } catch (e) {
@@ -1675,7 +1676,7 @@ function useCallHandlingErrors() {
1675
1676
  setState = _useState[1];
1676
1677
  return React.useCallback(function (functionToBeCalled, event) {
1677
1678
  try {
1678
- var _temp = _catch$g(function () {
1679
+ var _temp = _catch$h(function () {
1679
1680
  return Promise.resolve(functionToBeCalled(event)).then(function () {});
1680
1681
  }, function (error) {
1681
1682
  Logger.logError(error, (functionToBeCalled == null ? void 0 : functionToBeCalled.name) || "errorBoundaryTrigger", "Caught by ErrorBoundary");
@@ -3665,7 +3666,7 @@ var InputValuesProviders = /*#__PURE__*/function () {
3665
3666
  }
3666
3667
  if (maxValue != null) {
3667
3668
  var _parts$;
3668
- var maxDigitsCountBeforeTheDot = bignumber_js.BigNumber(maxValue).toFixed(0).length;
3669
+ var maxDigitsCountBeforeTheDot = BigNumber.BigNumber(maxValue).toFixed(0).length;
3669
3670
  if (((_parts$ = parts[0]) == null ? void 0 : _parts$.length) > maxDigitsCountBeforeTheDot) {
3670
3671
  // removes redundant prefix digits
3671
3672
  parts[0] = parts[0].substring(parts[0].length - maxDigitsCountBeforeTheDot, parts[0].length);
@@ -3761,13 +3762,13 @@ var AmountUtils = /*#__PURE__*/function () {
3761
3762
  if (this._checkIfAmountInvalid(amount, true) || typeof currencyCode !== "string") return "NULL";
3762
3763
  var currencySymbol = FiatCurrenciesService.getCurrencySymbolByCode(currencyCode);
3763
3764
  var currencyDecimalCount = FiatCurrenciesService.getCurrencyDecimalCountByCode(currencyCode);
3764
- var trimmedByMaxDigits = bignumber_js.BigNumber(amount).toFixed(currencyDecimalCount, bignumber_js.BigNumber.ROUND_FLOOR);
3765
- var processedAmount = bignumber_js.BigNumber(trimmedByMaxDigits);
3766
- if (params.collapsible && processedAmount.gte(bignumber_js.BigNumber("1000000"))) {
3765
+ var trimmedByMaxDigits = BigNumber.BigNumber(amount).toFixed(currencyDecimalCount, BigNumber.BigNumber.ROUND_FLOOR);
3766
+ var processedAmount = BigNumber.BigNumber(trimmedByMaxDigits);
3767
+ if (params.collapsible && processedAmount.gte(BigNumber.BigNumber("1000000"))) {
3767
3768
  processedAmount = this._collapseToMillionsAndFormat(processedAmount, this.collapsedDecimalCount, params);
3768
3769
  } else {
3769
3770
  var limitResult = this._limitTotalAmountLengthIfNeeded(trimmedByMaxDigits, params);
3770
- processedAmount = bignumber_js.BigNumber(limitResult.processedAmount).toFormat(); // Adds commas to integer part
3771
+ processedAmount = BigNumber.BigNumber(limitResult.processedAmount).toFormat(); // Adds commas to integer part
3771
3772
  }
3772
3773
 
3773
3774
  // Add the currency code or currency symbol, if symbol is enabled and available
@@ -3836,10 +3837,10 @@ var AmountUtils = /*#__PURE__*/function () {
3836
3837
  var params = _extends({}, this.defaultCryptoParams, passedParams);
3837
3838
  if (this._checkIfAmountInvalid(amount) || typeof ticker !== "string" && params.ticker) return "NULL";
3838
3839
  var addPeriods = false;
3839
- var amountBigNumber = bignumber_js.BigNumber(amount);
3840
- var processedAmount = amountBigNumber.toFixed(digits, bignumber_js.BigNumber.ROUND_FLOOR);
3840
+ var amountBigNumber = BigNumber.BigNumber(amount);
3841
+ var processedAmount = amountBigNumber.toFixed(digits, BigNumber.BigNumber.ROUND_FLOOR);
3841
3842
  processedAmount = this.removeRedundantRightZerosFromNumberString(processedAmount);
3842
- var originalAmountDecimalPlaces = bignumber_js.BigNumber(processedAmount).decimalPlaces();
3843
+ var originalAmountDecimalPlaces = BigNumber.BigNumber(processedAmount).decimalPlaces();
3843
3844
  // Check decimal count and throw an error, if the amount has more decimal digits than supported by the asset
3844
3845
  if (originalAmountDecimalPlaces > digits) {
3845
3846
  var errorMessage = "An attempt to render a crypto value with too many digits after period was made: " + amount + ", allowed digits: " + digits + ". This is a no-op, since the logical and visually rendered values would differ, which is not acceptable for crypto amounts. Please trim the amount before rendering, using the trimCryptoAmountByCoin(amount, coin) method.";
@@ -3850,7 +3851,7 @@ var AmountUtils = /*#__PURE__*/function () {
3850
3851
 
3851
3852
  // Shortening the value to general significant number of digits after period
3852
3853
  if (params.trim) {
3853
- processedAmount = this.removeRedundantRightZerosFromNumberString(amountBigNumber.toFixed(this.significantDecimalCount, bignumber_js.BigNumber.ROUND_FLOOR));
3854
+ processedAmount = this.removeRedundantRightZerosFromNumberString(amountBigNumber.toFixed(this.significantDecimalCount, BigNumber.BigNumber.ROUND_FLOOR));
3854
3855
  addPeriods = originalAmountDecimalPlaces > this.significantDecimalCount;
3855
3856
  }
3856
3857
  var limitResult = this._limitTotalAmountLengthIfNeeded(processedAmount, params);
@@ -3859,11 +3860,11 @@ var AmountUtils = /*#__PURE__*/function () {
3859
3860
  var wereMillionsCollapsed = false;
3860
3861
  if (params.collapsible && amountBigNumber.gte("1000000")) {
3861
3862
  // Collapse the 1M+ amounts if applicable
3862
- processedAmount = this._collapseToMillionsAndFormat(bignumber_js.BigNumber(processedAmount), this.collapsedDecimalCount, params);
3863
+ processedAmount = this._collapseToMillionsAndFormat(BigNumber.BigNumber(processedAmount), this.collapsedDecimalCount, params);
3863
3864
  wereMillionsCollapsed = true;
3864
3865
  } else if (params.numberPartsSeparator) {
3865
3866
  // Add separators to integer part of the amount
3866
- processedAmount = bignumber_js.BigNumber(processedAmount).toFormat();
3867
+ processedAmount = BigNumber.BigNumber(processedAmount).toFormat();
3867
3868
  }
3868
3869
 
3869
3870
  // Adding periods, if the amount was shortened
@@ -3884,7 +3885,7 @@ var AmountUtils = /*#__PURE__*/function () {
3884
3885
  if (allowNumbers === void 0) {
3885
3886
  allowNumbers = false;
3886
3887
  }
3887
- return amount == null || amount === "" || !bignumber_js.BigNumber.isBigNumber(amount) && typeof amount !== "string" && (!allowNumbers || typeof amount !== "number");
3888
+ return amount == null || amount === "" || !BigNumber.BigNumber.isBigNumber(amount) && typeof amount !== "string" && (!allowNumbers || typeof amount !== "number");
3888
3889
  }
3889
3890
 
3890
3891
  /**
@@ -3900,7 +3901,7 @@ var AmountUtils = /*#__PURE__*/function () {
3900
3901
  AmountUtils.trim = function trim(amount, digits) {
3901
3902
  try {
3902
3903
  if (this._checkIfAmountInvalid(amount, true)) return null;
3903
- return bignumber_js.BigNumber(amount).toFixed(digits, bignumber_js.BigNumber.ROUND_FLOOR);
3904
+ return BigNumber.BigNumber(amount).toFixed(digits, BigNumber.BigNumber.ROUND_FLOOR);
3904
3905
  } catch (e) {
3905
3906
  improveAndRethrow(e, "trim", "Passed: " + amount + ", " + digits);
3906
3907
  }
@@ -3931,10 +3932,10 @@ var AmountUtils = /*#__PURE__*/function () {
3931
3932
  }
3932
3933
  try {
3933
3934
  // TODO: [feature, moderate] use local format here - take from JS locales (comma/dot etc.)
3934
- var millionBigNumber = bignumber_js.BigNumber("1000000");
3935
- var millions = amountBigNumber.div(millionBigNumber).toFixed(decimalCount, bignumber_js.BigNumber.ROUND_FLOOR);
3935
+ var millionBigNumber = BigNumber.BigNumber("1000000");
3936
+ var millions = amountBigNumber.div(millionBigNumber).toFixed(decimalCount, BigNumber.BigNumber.ROUND_FLOOR);
3936
3937
  var limitedResult = this._limitTotalAmountLengthIfNeeded(millions, params);
3937
- var formatted = bignumber_js.BigNumber(limitedResult.processedAmount).toFormat();
3938
+ var formatted = BigNumber.BigNumber(limitedResult.processedAmount).toFormat();
3938
3939
  return formatted + "M";
3939
3940
  } catch (e) {
3940
3941
  improveAndRethrow(e, "_collapseAmountAndFormat", "Passed: " + amountBigNumber.toFixed() + ", " + decimalCount);
@@ -3953,9 +3954,9 @@ var AmountUtils = /*#__PURE__*/function () {
3953
3954
  var maxLength = params.extraSmallLength ? this.extraSmallMaxTotalLength : this.maxTotalLength;
3954
3955
  if (amountString.length > maxLength) {
3955
3956
  var delta = amountString.length - maxLength;
3956
- var currentDecimalsCount = bignumber_js.BigNumber(amountString).decimalPlaces();
3957
+ var currentDecimalsCount = BigNumber.BigNumber(amountString).decimalPlaces();
3957
3958
  var newDecimalCount = currentDecimalsCount - delta;
3958
- amountString = bignumber_js.BigNumber(amountString).toFixed(newDecimalCount > 2 ? newDecimalCount : 2, bignumber_js.BigNumber.ROUND_FLOOR);
3959
+ amountString = BigNumber.BigNumber(amountString).toFixed(newDecimalCount > 2 ? newDecimalCount : 2, BigNumber.BigNumber.ROUND_FLOOR);
3959
3960
  addPeriods = currentDecimalsCount > newDecimalCount;
3960
3961
  }
3961
3962
  }
@@ -3992,18 +3993,18 @@ var AmountUtils = /*#__PURE__*/function () {
3992
3993
  if (rightCurrencyDigitsAfterDots < 0) {
3993
3994
  rightCurrencyDigitsAfterDots = this.significantDecimalCount;
3994
3995
  }
3995
- var leftNumber = bignumber_js.BigNumber("1");
3996
- var multiplier = bignumber_js.BigNumber("100");
3996
+ var leftNumber = BigNumber.BigNumber("1");
3997
+ var multiplier = BigNumber.BigNumber("100");
3997
3998
  var maxAttemptsToGetRate = 10;
3998
3999
  var right = null;
3999
- var rateBigNumber = bignumber_js.BigNumber(rate);
4000
- if (bignumber_js.BigNumber(rate).eq("0")) {
4001
- right = bignumber_js.BigNumber("0");
4002
- } else if (rate && (bignumber_js.BigNumber.isBigNumber(rate) || !Number.isNaN(+rate))) {
4000
+ var rateBigNumber = BigNumber.BigNumber(rate);
4001
+ if (BigNumber.BigNumber(rate).eq("0")) {
4002
+ right = BigNumber.BigNumber("0");
4003
+ } else if (rate && (BigNumber.BigNumber.isBigNumber(rate) || !Number.isNaN(+rate))) {
4003
4004
  for (var i = 0; i < maxAttemptsToGetRate; ++i) {
4004
- var rightNumberAttempt = rateBigNumber.times(leftNumber).toFixed(rightCurrencyDigitsAfterDots, bignumber_js.BigNumber.ROUND_FLOOR);
4005
- if (!bignumber_js.BigNumber(rightNumberAttempt).eq(bignumber_js.BigNumber("0"))) {
4006
- right = bignumber_js.BigNumber(rightNumberAttempt);
4005
+ var rightNumberAttempt = rateBigNumber.times(leftNumber).toFixed(rightCurrencyDigitsAfterDots, BigNumber.BigNumber.ROUND_FLOOR);
4006
+ if (!BigNumber.BigNumber(rightNumberAttempt).eq(BigNumber.BigNumber("0"))) {
4007
+ right = BigNumber.BigNumber(rightNumberAttempt);
4007
4008
  break;
4008
4009
  } else {
4009
4010
  leftNumber = leftNumber.times(multiplier);
@@ -4011,7 +4012,7 @@ var AmountUtils = /*#__PURE__*/function () {
4011
4012
  }
4012
4013
  }
4013
4014
  var leftAmountString = AmountUtils.toIntegerString(leftNumber);
4014
- var rightAmountString = right != null ? right.toFixed(rightCurrencyDigitsAfterDots, bignumber_js.BigNumber.ROUND_FLOOR) : null;
4015
+ var rightAmountString = right != null ? right.toFixed(rightCurrencyDigitsAfterDots, BigNumber.BigNumber.ROUND_FLOOR) : null;
4015
4016
  return leftAmountString + " " + leftTicker + " " + (strictRate ? "=" : "~") + " " + (rightAmountString != null ? rightAmountString : "?") + " " + rightTicker;
4016
4017
  } catch (e) {
4017
4018
  // eslint-disable-next-line no-console
@@ -4226,7 +4227,7 @@ var AmountInput = /*#__PURE__*/React__default["default"].forwardRef(function (_r
4226
4227
  setCoinAmountValue(correctedAmount);
4227
4228
  if (handlerEnabled) handleCoinAmountChange(correctedAmount);
4228
4229
  if (correctedAmount !== "" && cryptoAssetToFiatRate != null) {
4229
- var fiatAmount = bignumber_js.BigNumber(correctedAmount).times(cryptoAssetToFiatRate).toFixed(fiatCurrencyDecimals);
4230
+ var fiatAmount = BigNumber.BigNumber(correctedAmount).times(cryptoAssetToFiatRate).toFixed(fiatCurrencyDecimals);
4230
4231
  setFiatAmountValue(fiatAmount);
4231
4232
  handleFiatAmountChange(fiatAmount);
4232
4233
  } else {
@@ -4249,8 +4250,8 @@ var AmountInput = /*#__PURE__*/React__default["default"].forwardRef(function (_r
4249
4250
  var correctedFiatAmount = InputValuesProviders.provideFormatOfFloatValueByInputString(newAmountString, fiatCurrencyDecimals);
4250
4251
  setFiatAmountValue(correctedFiatAmount);
4251
4252
  handleFiatAmountChange(correctedFiatAmount);
4252
- var coinAmount = correctedFiatAmount !== "" ? bignumber_js.BigNumber(correctedFiatAmount).div(cryptoAssetToFiatRate).toFixed(assetDecimalPlaces) : "0";
4253
- var coinsAmount = bignumber_js.BigNumber(coinAmount).isZero() ? "" : coinAmount;
4253
+ var coinAmount = correctedFiatAmount !== "" ? BigNumber.BigNumber(correctedFiatAmount).div(cryptoAssetToFiatRate).toFixed(assetDecimalPlaces) : "0";
4254
+ var coinsAmount = BigNumber.BigNumber(coinAmount).isZero() ? "" : coinAmount;
4254
4255
  setCoinAmountValue(coinsAmount);
4255
4256
  handleCoinAmountChange(coinsAmount);
4256
4257
  } catch (e) {
@@ -4291,7 +4292,7 @@ var AmountInput = /*#__PURE__*/React__default["default"].forwardRef(function (_r
4291
4292
  // Check if input & balance highlights are needed after a change in either the asset amount or the balance
4292
4293
  React.useEffect(function () {
4293
4294
  if (!showBalanceValidation || (assetBalance == null ? void 0 : assetBalance.assetAmount) == null) return;
4294
- var enableHighlight = bignumber_js.BigNumber(coinAmountValue).gt(assetBalance == null ? void 0 : assetBalance.assetAmount);
4295
+ var enableHighlight = BigNumber.BigNumber(coinAmountValue).gt(assetBalance == null ? void 0 : assetBalance.assetAmount);
4295
4296
  handleBalanceValidationChange(enableHighlight);
4296
4297
  setHighlightBalance(enableHighlight);
4297
4298
  setHighlightInput(enableHighlight);
@@ -4858,7 +4859,7 @@ function useIsHydrated() {
4858
4859
  * @constructor
4859
4860
  */
4860
4861
 
4861
- function _catch$f(body, recover) {
4862
+ function _catch$g(body, recover) {
4862
4863
  try {
4863
4864
  var result = body();
4864
4865
  } catch (e) {
@@ -5123,7 +5124,7 @@ var SwapForm = function SwapForm(_ref) {
5123
5124
  setIsLastEditedReceiving(false);
5124
5125
  var receiveAmount = "";
5125
5126
  if (amount != null && amount !== "" && swapRate != null) {
5126
- receiveAmount = AmountUtils.trim(bignumber_js.BigNumber(amount).times(swapRate), receivingAssetDecimalCount);
5127
+ receiveAmount = AmountUtils.trim(BigNumber.BigNumber(amount).times(swapRate), receivingAssetDecimalCount);
5127
5128
  }
5128
5129
  setReceiveAssetAmount(receiveAmount);
5129
5130
  setUpdateReceiveInputTo(receiveAmount);
@@ -5134,7 +5135,7 @@ var SwapForm = function SwapForm(_ref) {
5134
5135
  if (isFixedRate.current) setIsLastEditedReceiving(true);
5135
5136
  var sendAssetAmount = "";
5136
5137
  if (amount != null && amount !== "" && swapRate != null) {
5137
- sendAssetAmount = AmountUtils.trim(bignumber_js.BigNumber(amount).div(swapRate), sendingAssetDecimalCount);
5138
+ sendAssetAmount = AmountUtils.trim(BigNumber.BigNumber(amount).div(swapRate), sendingAssetDecimalCount);
5138
5139
  }
5139
5140
  setUpdateSendInputTo(sendAssetAmount);
5140
5141
  setSendAssetAmount(sendAssetAmount);
@@ -5179,8 +5180,8 @@ var SwapForm = function SwapForm(_ref) {
5179
5180
  var processMinMaxAmounts = function processMinMaxAmounts(amount) {
5180
5181
  var _minimalAmount$curren5;
5181
5182
  if (amount === null) return;
5182
- setMaximumAmountValid(!maximumAmount.current || bignumber_js.BigNumber(amount).eq("0") || bignumber_js.BigNumber(amount).lte(maximumAmount.current.crypto));
5183
- setMinimalAmountValid(!minimalAmount.current || bignumber_js.BigNumber(amount).eq("0") || bignumber_js.BigNumber(amount).gte((_minimalAmount$curren5 = minimalAmount.current) == null ? void 0 : _minimalAmount$curren5.crypto));
5183
+ setMaximumAmountValid(!maximumAmount.current || BigNumber.BigNumber(amount).eq("0") || BigNumber.BigNumber(amount).lte(maximumAmount.current.crypto));
5184
+ setMinimalAmountValid(!minimalAmount.current || BigNumber.BigNumber(amount).eq("0") || BigNumber.BigNumber(amount).gte((_minimalAmount$curren5 = minimalAmount.current) == null ? void 0 : _minimalAmount$curren5.crypto));
5184
5185
  };
5185
5186
  var requestDataRefresh = function requestDataRefresh(amount, immediately, isSwapAll, ignoreEmptyAmount) {
5186
5187
  if (immediately === void 0) {
@@ -5201,7 +5202,7 @@ var SwapForm = function SwapForm(_ref) {
5201
5202
  if (!amount && !ignoreEmptyAmount) {
5202
5203
  return;
5203
5204
  }
5204
- if (bignumber_js.BigNumber(amount).eq("0") || amount == null || amount === "") {
5205
+ if (BigNumber.BigNumber(amount).eq("0") || amount == null || amount === "") {
5205
5206
  if (immediately) {
5206
5207
  loadMinimalAmountAndSwapRate(true);
5207
5208
  } else {
@@ -5257,7 +5258,7 @@ var SwapForm = function SwapForm(_ref) {
5257
5258
  }
5258
5259
  (function () {
5259
5260
  try {
5260
- return _catch$f(function () {
5261
+ return _catch$g(function () {
5261
5262
  var _minimalAmount$curren6, _maximumAmount$curren5, _isFixedRate$current;
5262
5263
  var dataMemento = {
5263
5264
  rate: swapRate,
@@ -5293,7 +5294,7 @@ var SwapForm = function SwapForm(_ref) {
5293
5294
  if (response.result) {
5294
5295
  var swapCreationInfo = response == null ? void 0 : response.swapCreationInfo;
5295
5296
  if (isSwapAll.current) {
5296
- setIsAmountZero(bignumber_js.BigNumber("0").eq(swapCreationInfo.fromAmountCoins));
5297
+ setIsAmountZero(BigNumber.BigNumber("0").eq(swapCreationInfo.fromAmountCoins));
5297
5298
  }
5298
5299
  setUpdateSendInputTo(swapCreationInfo.fromAmountCoins);
5299
5300
  setUpdateReceiveInputTo(swapCreationInfo.toAmountCoins);
@@ -5343,7 +5344,7 @@ var SwapForm = function SwapForm(_ref) {
5343
5344
  }
5344
5345
  (function () {
5345
5346
  try {
5346
- return _catch$f(function () {
5347
+ return _catch$g(function () {
5347
5348
  setIsLoading(true);
5348
5349
  setMinimalAmount(null);
5349
5350
  setMaximumAmount(null);
@@ -5414,7 +5415,7 @@ var SwapForm = function SwapForm(_ref) {
5414
5415
  React.useEffect(function () {
5415
5416
  if (!sendingAssetTicker || !receivingAssetTicker) return;
5416
5417
  var currentAmount = isLastEditedReceiving.current ? receiveAssetAmount.current : sendAssetAmount.current;
5417
- var isCurrentAmountNotZero = currentAmount && !bignumber_js.BigNumber("0").eq(currentAmount);
5418
+ var isCurrentAmountNotZero = currentAmount && !BigNumber.BigNumber("0").eq(currentAmount);
5418
5419
  if (isCurrentAmountNotZero) {
5419
5420
  loadFullEstimation(currentAmount);
5420
5421
  } else {
@@ -5452,6 +5453,7 @@ var SwapForm = function SwapForm(_ref) {
5452
5453
  setIsRecipientAddressValid(_validateAddressByTic);
5453
5454
  };
5454
5455
  if (!receivingAssetTicker) return;
5456
+ setValidationContent("");
5455
5457
  var _temp = recipientAddress.current === "";
5456
5458
  return _temp ? _temp2(false) : Promise.resolve(validateAddressByTicker(receivingAssetTicker, recipientAddress.current, isFixedRate.current, setValidationContent)).then(_temp2);
5457
5459
  } catch (e) {
@@ -5467,6 +5469,7 @@ var SwapForm = function SwapForm(_ref) {
5467
5469
  setIsRefundAddressValid(_validateAddressByTic2);
5468
5470
  };
5469
5471
  if (!sendingAssetTicker || !isRefundAddressRequired) return;
5472
+ setValidationContent("");
5470
5473
  var _temp3 = refundAddress.current === "";
5471
5474
  return _temp3 ? _temp4(false) : Promise.resolve(validateAddressByTicker(sendingAssetTicker, refundAddress.current, isFixedRate.current, setValidationContent)).then(_temp4);
5472
5475
  } catch (e) {
@@ -5514,9 +5517,9 @@ var SwapForm = function SwapForm(_ref) {
5514
5517
  React.useEffect(function () {
5515
5518
  if (swapRate != null && (isLastEditedReceiving.current ? receiveAssetAmount.current : sendAssetAmount.current) != null) {
5516
5519
  if (isLastEditedReceiving.current) {
5517
- setUpdateSendInputTo(AmountUtils.trim(bignumber_js.BigNumber(receiveAssetAmount.current).div(swapRate), sendingAssetDecimalCount));
5520
+ setUpdateSendInputTo(AmountUtils.trim(BigNumber.BigNumber(receiveAssetAmount.current).div(swapRate), sendingAssetDecimalCount));
5518
5521
  } else {
5519
- setUpdateReceiveInputTo(AmountUtils.trim(bignumber_js.BigNumber(sendAssetAmount.current).times(swapRate), receivingAssetDecimalCount));
5522
+ setUpdateReceiveInputTo(AmountUtils.trim(BigNumber.BigNumber(sendAssetAmount.current).times(swapRate), receivingAssetDecimalCount));
5520
5523
  }
5521
5524
  }
5522
5525
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -5531,7 +5534,7 @@ var SwapForm = function SwapForm(_ref) {
5531
5534
  var handleAmountChange = function handleAmountChange(amount) {
5532
5535
  requestDataRefresh(amount);
5533
5536
  processMinMaxAmounts(amount);
5534
- setIsAmountZero(bignumber_js.BigNumber("0").eq(amount));
5537
+ setIsAmountZero(BigNumber.BigNumber("0").eq(amount));
5535
5538
  setIsSwapCalculated(false);
5536
5539
  };
5537
5540
  React.useEffect(function () {
@@ -5545,12 +5548,12 @@ var SwapForm = function SwapForm(_ref) {
5545
5548
  return /*#__PURE__*/React__default["default"].createElement("div", {
5546
5549
  className: s$b["swap-form"]
5547
5550
  }, /*#__PURE__*/React__default["default"].createElement(TitleBox, {
5548
- linkButtonClick: bignumber_js.BigNumber(sendingAssetBalance == null ? void 0 : sendingAssetBalance.assetAmount).eq(0) ? null : function (resetButtonLoader) {
5551
+ linkButtonClick: BigNumber.BigNumber(sendingAssetBalance == null ? void 0 : sendingAssetBalance.assetAmount).eq(0) ? null : function (resetButtonLoader) {
5549
5552
  return handleSwapAllClick(resetButtonLoader);
5550
5553
  },
5551
5554
  linkText: !formHasBalance ? "" : isSwapAll.current ? translations.swapAllButtonTitles.cancel : translations.swapAllButtonTitles.enable,
5552
5555
  linkButtonLoader: true,
5553
- isLinkButtonDisabled: isLoading.current || sendingAssetTicker === receivingAssetTicker || bignumber_js.BigNumber(sendingAssetBalance == null ? void 0 : sendingAssetBalance.assetAmount).eq(0)
5556
+ isLinkButtonDisabled: isLoading.current || sendingAssetTicker === receivingAssetTicker || BigNumber.BigNumber(sendingAssetBalance == null ? void 0 : sendingAssetBalance.assetAmount).eq(0)
5554
5557
  }, displayRateSelector ? /*#__PURE__*/React__default["default"].createElement("div", {
5555
5558
  className: s$b["swap-form-rate-selector"]
5556
5559
  }, /*#__PURE__*/React__default["default"].createElement(RateSelector, {
@@ -5606,7 +5609,7 @@ var SwapForm = function SwapForm(_ref) {
5606
5609
  assetIconProtocolSrc: receivingAssetProtocolIconSrc,
5607
5610
  fallbackAssetIconSrc: fallBackAssetIconSrc,
5608
5611
  disabled: isSwapAll.current || sendingAssetTicker === null || receivingAssetTicker === null,
5609
- locked: !formHasBalance,
5612
+ locked: true,
5610
5613
  handleCoinAmountChange: handleReceiveAssetAmountChange,
5611
5614
  handleChangeAssetClick: handleChangeReceivingAssetClick,
5612
5615
  updateAssetInputTo: updateReceiveInputTo,
@@ -5812,7 +5815,7 @@ SwapForm.defaultProps = {
5812
5815
  * @return {Promise<string>} xml string of generated svg image
5813
5816
  */
5814
5817
 
5815
- function _catch$e(body, recover) {
5818
+ function _catch$f(body, recover) {
5816
5819
  try {
5817
5820
  var result = body();
5818
5821
  } catch (e) {
@@ -5825,7 +5828,7 @@ function _catch$e(body, recover) {
5825
5828
  }
5826
5829
  var generateQrAndShowInCanvas = function generateQrAndShowInCanvas(encodingString) {
5827
5830
  try {
5828
- return Promise.resolve(_catch$e(function () {
5831
+ return Promise.resolve(_catch$f(function () {
5829
5832
  return Promise.resolve(QRCode__default["default"].toString(encodingString, {
5830
5833
  type: "svg"
5831
5834
  }));
@@ -5850,7 +5853,7 @@ var s$8 = {"qr-code":"_VZ0dT","fill":"_hFE1l"};
5850
5853
  * @returns {JSX.Element} A div containing the generated QR code.
5851
5854
  */
5852
5855
 
5853
- function _catch$d(body, recover) {
5856
+ function _catch$e(body, recover) {
5854
5857
  try {
5855
5858
  var result = body();
5856
5859
  } catch (e) {
@@ -5869,7 +5872,7 @@ var QrCode = function QrCode(_ref) {
5869
5872
  React.useEffect(function () {
5870
5873
  (function () {
5871
5874
  try {
5872
- return _catch$d(function () {
5875
+ return _catch$e(function () {
5873
5876
  var _temp = function () {
5874
5877
  if (address) {
5875
5878
  return Promise.resolve(generateQrAndShowInCanvas(address)).then(function (_generateQrAndShowInC) {
@@ -6713,7 +6716,7 @@ SearchableCoinsList.defaultProps = {
6713
6716
  setIsSearchResultEmpty: function setIsSearchResultEmpty() {}
6714
6717
  };
6715
6718
 
6716
- function _catch$c(body, recover) {
6719
+ function _catch$d(body, recover) {
6717
6720
  try {
6718
6721
  var result = body();
6719
6722
  } catch (e) {
@@ -6904,7 +6907,7 @@ var CoinPicker = function CoinPicker(_ref) {
6904
6907
  var loadCoinsAndSaveToState = function loadCoinsAndSaveToState() {
6905
6908
  (function () {
6906
6909
  try {
6907
- var _temp = _catch$c(function () {
6910
+ var _temp = _catch$d(function () {
6908
6911
  return Promise.resolve(loadCoinsAndContent ? loadCoinsAndContent() : defaultLoadCoinsAndContent()).then(function (data) {
6909
6912
  setCoins(data.coins);
6910
6913
  setCoinsContent(data.content);
@@ -7646,7 +7649,7 @@ var supportDialogImage = (function () {
7646
7649
  * @returns {JSX.Element} The WaitlistSubscription component.
7647
7650
  */
7648
7651
 
7649
- function _catch$b(body, recover) {
7652
+ function _catch$c(body, recover) {
7650
7653
  try {
7651
7654
  var result = body();
7652
7655
  } catch (e) {
@@ -7701,7 +7704,7 @@ var WaitlistSubscription = function WaitlistSubscription(_ref) {
7701
7704
  };
7702
7705
  var subscribe = function subscribe(resetButtonLoader) {
7703
7706
  try {
7704
- var _temp = _catch$b(function () {
7707
+ var _temp = _catch$c(function () {
7705
7708
  setErrorEncountered(false);
7706
7709
  return Promise.resolve(saveSubscription(coin, inputValue)).then(function (result) {
7707
7710
  if (result) {
@@ -8242,7 +8245,7 @@ var Cache = /*#__PURE__*/function () {
8242
8245
  return Cache;
8243
8246
  }();
8244
8247
 
8245
- function _catch$a(body, recover) {
8248
+ function _catch$b(body, recover) {
8246
8249
  try {
8247
8250
  var result = body();
8248
8251
  } catch (e) {
@@ -8260,7 +8263,7 @@ function postponeExecution(execution, timeoutMS) {
8260
8263
  return new Promise(function (resolve, reject) {
8261
8264
  setTimeout(function () {
8262
8265
  try {
8263
- var _temp = _catch$a(function () {
8266
+ var _temp = _catch$b(function () {
8264
8267
  return Promise.resolve(execution()).then(function (_execution) {
8265
8268
  resolve(_execution);
8266
8269
  });
@@ -8344,7 +8347,7 @@ var AxiosAdapter = /*#__PURE__*/function () {
8344
8347
  return AxiosAdapter;
8345
8348
  }();
8346
8349
 
8347
- function _catch$9(body, recover) {
8350
+ function _catch$a(body, recover) {
8348
8351
  try {
8349
8352
  var result = body();
8350
8353
  } catch (e) {
@@ -8360,7 +8363,7 @@ var EmailsApi = /*#__PURE__*/function () {
8360
8363
  EmailsApi.sendEmail = function sendEmail(subject, body) {
8361
8364
  try {
8362
8365
  var _this = this;
8363
- var _temp = _catch$9(function () {
8366
+ var _temp = _catch$a(function () {
8364
8367
  var url = window.location.protocol + "//" + window.location.host + "/api/v1/" + _this.serverEndpointEntity;
8365
8368
  return Promise.resolve(axios__default["default"].post(url, {
8366
8369
  subject: subject,
@@ -8778,7 +8781,7 @@ var ExternalServicesStatsCollector = /*#__PURE__*/function () {
8778
8781
  * improve the reliability of a data retrieval.
8779
8782
  */
8780
8783
 
8781
- function _catch$8(body, recover) {
8784
+ function _catch$9(body, recover) {
8782
8785
  try {
8783
8786
  var result = body();
8784
8787
  } catch (e) {
@@ -8789,21 +8792,21 @@ function _catch$8(body, recover) {
8789
8792
  }
8790
8793
  return result;
8791
8794
  }
8792
- function _settle$2(pact, state, value) {
8795
+ function _settle$3(pact, state, value) {
8793
8796
  if (!pact.s) {
8794
- if (value instanceof _Pact$2) {
8797
+ if (value instanceof _Pact$3) {
8795
8798
  if (value.s) {
8796
8799
  if (state & 1) {
8797
8800
  state = value.s;
8798
8801
  }
8799
8802
  value = value.v;
8800
8803
  } else {
8801
- value.o = _settle$2.bind(null, pact, state);
8804
+ value.o = _settle$3.bind(null, pact, state);
8802
8805
  return;
8803
8806
  }
8804
8807
  }
8805
8808
  if (value && value.then) {
8806
- value.then(_settle$2.bind(null, pact, state), _settle$2.bind(null, pact, 2));
8809
+ value.then(_settle$3.bind(null, pact, state), _settle$3.bind(null, pact, 2));
8807
8810
  return;
8808
8811
  }
8809
8812
  pact.s = state;
@@ -8814,7 +8817,7 @@ function _settle$2(pact, state, value) {
8814
8817
  }
8815
8818
  }
8816
8819
  }
8817
- var _Pact$2 = /*#__PURE__*/function () {
8820
+ var _Pact$3 = /*#__PURE__*/function () {
8818
8821
  function _Pact() {}
8819
8822
  _Pact.prototype.then = function (onFulfilled, onRejected) {
8820
8823
  var result = new _Pact();
@@ -8823,9 +8826,9 @@ var _Pact$2 = /*#__PURE__*/function () {
8823
8826
  var callback = state & 1 ? onFulfilled : onRejected;
8824
8827
  if (callback) {
8825
8828
  try {
8826
- _settle$2(result, 1, callback(this.v));
8829
+ _settle$3(result, 1, callback(this.v));
8827
8830
  } catch (e) {
8828
- _settle$2(result, 2, e);
8831
+ _settle$3(result, 2, e);
8829
8832
  }
8830
8833
  return result;
8831
8834
  } else {
@@ -8836,28 +8839,28 @@ var _Pact$2 = /*#__PURE__*/function () {
8836
8839
  try {
8837
8840
  var value = _this.v;
8838
8841
  if (_this.s & 1) {
8839
- _settle$2(result, 1, onFulfilled ? onFulfilled(value) : value);
8842
+ _settle$3(result, 1, onFulfilled ? onFulfilled(value) : value);
8840
8843
  } else if (onRejected) {
8841
- _settle$2(result, 1, onRejected(value));
8844
+ _settle$3(result, 1, onRejected(value));
8842
8845
  } else {
8843
- _settle$2(result, 2, value);
8846
+ _settle$3(result, 2, value);
8844
8847
  }
8845
8848
  } catch (e) {
8846
- _settle$2(result, 2, e);
8849
+ _settle$3(result, 2, e);
8847
8850
  }
8848
8851
  };
8849
8852
  return result;
8850
8853
  };
8851
8854
  return _Pact;
8852
8855
  }();
8853
- function _isSettledPact$2(thenable) {
8854
- return thenable instanceof _Pact$2 && thenable.s & 1;
8856
+ function _isSettledPact$3(thenable) {
8857
+ return thenable instanceof _Pact$3 && thenable.s & 1;
8855
8858
  }
8856
- function _for$1(test, update, body) {
8859
+ function _for$2(test, update, body) {
8857
8860
  var stage;
8858
8861
  for (;;) {
8859
8862
  var shouldContinue = test();
8860
- if (_isSettledPact$2(shouldContinue)) {
8863
+ if (_isSettledPact$3(shouldContinue)) {
8861
8864
  shouldContinue = shouldContinue.v;
8862
8865
  }
8863
8866
  if (!shouldContinue) {
@@ -8869,7 +8872,7 @@ function _for$1(test, update, body) {
8869
8872
  }
8870
8873
  var result = body();
8871
8874
  if (result && result.then) {
8872
- if (_isSettledPact$2(result)) {
8875
+ if (_isSettledPact$3(result)) {
8873
8876
  result = result.s;
8874
8877
  } else {
8875
8878
  stage = 1;
@@ -8878,14 +8881,14 @@ function _for$1(test, update, body) {
8878
8881
  }
8879
8882
  if (update) {
8880
8883
  var updateValue = update();
8881
- if (updateValue && updateValue.then && !_isSettledPact$2(updateValue)) {
8884
+ if (updateValue && updateValue.then && !_isSettledPact$3(updateValue)) {
8882
8885
  stage = 2;
8883
8886
  break;
8884
8887
  }
8885
8888
  }
8886
8889
  }
8887
- var pact = new _Pact$2();
8888
- var reject = _settle$2.bind(null, pact, 2);
8890
+ var pact = new _Pact$3();
8891
+ var reject = _settle$3.bind(null, pact, 2);
8889
8892
  (stage === 0 ? shouldContinue.then(_resumeAfterTest) : stage === 1 ? result.then(_resumeAfterBody) : updateValue.then(_resumeAfterUpdate)).then(void 0, reject);
8890
8893
  return pact;
8891
8894
  function _resumeAfterBody(value) {
@@ -8893,14 +8896,14 @@ function _for$1(test, update, body) {
8893
8896
  do {
8894
8897
  if (update) {
8895
8898
  updateValue = update();
8896
- if (updateValue && updateValue.then && !_isSettledPact$2(updateValue)) {
8899
+ if (updateValue && updateValue.then && !_isSettledPact$3(updateValue)) {
8897
8900
  updateValue.then(_resumeAfterUpdate).then(void 0, reject);
8898
8901
  return;
8899
8902
  }
8900
8903
  }
8901
8904
  shouldContinue = test();
8902
- if (!shouldContinue || _isSettledPact$2(shouldContinue) && !shouldContinue.v) {
8903
- _settle$2(pact, 1, result);
8905
+ if (!shouldContinue || _isSettledPact$3(shouldContinue) && !shouldContinue.v) {
8906
+ _settle$3(pact, 1, result);
8904
8907
  return;
8905
8908
  }
8906
8909
  if (shouldContinue.then) {
@@ -8908,7 +8911,7 @@ function _for$1(test, update, body) {
8908
8911
  return;
8909
8912
  }
8910
8913
  result = body();
8911
- if (_isSettledPact$2(result)) {
8914
+ if (_isSettledPact$3(result)) {
8912
8915
  result = result.v;
8913
8916
  }
8914
8917
  } while (!result || !result.then);
@@ -8923,7 +8926,7 @@ function _for$1(test, update, body) {
8923
8926
  _resumeAfterBody(result);
8924
8927
  }
8925
8928
  } else {
8926
- _settle$2(pact, 1, result);
8929
+ _settle$3(pact, 1, result);
8927
8930
  }
8928
8931
  }
8929
8932
  function _resumeAfterUpdate() {
@@ -8934,7 +8937,7 @@ function _for$1(test, update, body) {
8934
8937
  _resumeAfterTest(shouldContinue);
8935
8938
  }
8936
8939
  } else {
8937
- _settle$2(pact, 1, result);
8940
+ _settle$3(pact, 1, result);
8938
8941
  }
8939
8942
  }
8940
8943
  }
@@ -8954,7 +8957,7 @@ function _do(body, test) {
8954
8957
  do {
8955
8958
  var result = body();
8956
8959
  if (result && result.then) {
8957
- if (_isSettledPact$2(result)) {
8960
+ if (_isSettledPact$3(result)) {
8958
8961
  result = result.v;
8959
8962
  } else {
8960
8963
  awaitBody = true;
@@ -8962,22 +8965,22 @@ function _do(body, test) {
8962
8965
  }
8963
8966
  }
8964
8967
  var shouldContinue = test();
8965
- if (_isSettledPact$2(shouldContinue)) {
8968
+ if (_isSettledPact$3(shouldContinue)) {
8966
8969
  shouldContinue = shouldContinue.v;
8967
8970
  }
8968
8971
  if (!shouldContinue) {
8969
8972
  return result;
8970
8973
  }
8971
8974
  } while (!shouldContinue.then);
8972
- var pact = new _Pact$2();
8973
- var reject = _settle$2.bind(null, pact, 2);
8975
+ var pact = new _Pact$3();
8976
+ var reject = _settle$3.bind(null, pact, 2);
8974
8977
  (awaitBody ? result.then(_resumeAfterBody) : shouldContinue.then(_resumeAfterTest)).then(void 0, reject);
8975
8978
  return pact;
8976
8979
  function _resumeAfterBody(value) {
8977
8980
  result = value;
8978
8981
  for (;;) {
8979
8982
  shouldContinue = test();
8980
- if (_isSettledPact$2(shouldContinue)) {
8983
+ if (_isSettledPact$3(shouldContinue)) {
8981
8984
  shouldContinue = shouldContinue.v;
8982
8985
  }
8983
8986
  if (!shouldContinue) {
@@ -8989,7 +8992,7 @@ function _do(body, test) {
8989
8992
  }
8990
8993
  result = body();
8991
8994
  if (result && result.then) {
8992
- if (_isSettledPact$2(result)) {
8995
+ if (_isSettledPact$3(result)) {
8993
8996
  result = result.v;
8994
8997
  } else {
8995
8998
  result.then(_resumeAfterBody).then(void 0, reject);
@@ -8997,14 +9000,14 @@ function _do(body, test) {
8997
9000
  }
8998
9001
  }
8999
9002
  }
9000
- _settle$2(pact, 1, result);
9003
+ _settle$3(pact, 1, result);
9001
9004
  }
9002
9005
  function _resumeAfterTest(shouldContinue) {
9003
9006
  if (shouldContinue) {
9004
9007
  do {
9005
9008
  result = body();
9006
9009
  if (result && result.then) {
9007
- if (_isSettledPact$2(result)) {
9010
+ if (_isSettledPact$3(result)) {
9008
9011
  result = result.v;
9009
9012
  } else {
9010
9013
  result.then(_resumeAfterBody).then(void 0, reject);
@@ -9012,17 +9015,17 @@ function _do(body, test) {
9012
9015
  }
9013
9016
  }
9014
9017
  shouldContinue = test();
9015
- if (_isSettledPact$2(shouldContinue)) {
9018
+ if (_isSettledPact$3(shouldContinue)) {
9016
9019
  shouldContinue = shouldContinue.v;
9017
9020
  }
9018
9021
  if (!shouldContinue) {
9019
- _settle$2(pact, 1, result);
9022
+ _settle$3(pact, 1, result);
9020
9023
  return;
9021
9024
  }
9022
9025
  } while (!shouldContinue.then);
9023
9026
  shouldContinue.then(_resumeAfterTest).then(void 0, reject);
9024
9027
  } else {
9025
- _settle$2(pact, 1, result);
9028
+ _settle$3(pact, 1, result);
9026
9029
  }
9027
9030
  }
9028
9031
  }
@@ -9035,21 +9038,21 @@ function _forTo$1(array, body, check) {
9035
9038
  while (++i < array.length && (!check || !check())) {
9036
9039
  result = body(i);
9037
9040
  if (result && result.then) {
9038
- if (_isSettledPact$2(result)) {
9041
+ if (_isSettledPact$3(result)) {
9039
9042
  result = result.v;
9040
9043
  } else {
9041
- result.then(_cycle, reject || (reject = _settle$2.bind(null, pact = new _Pact$2(), 2)));
9044
+ result.then(_cycle, reject || (reject = _settle$3.bind(null, pact = new _Pact$3(), 2)));
9042
9045
  return;
9043
9046
  }
9044
9047
  }
9045
9048
  }
9046
9049
  if (pact) {
9047
- _settle$2(pact, 1, result);
9050
+ _settle$3(pact, 1, result);
9048
9051
  } else {
9049
9052
  pact = result;
9050
9053
  }
9051
9054
  } catch (e) {
9052
- _settle$2(pact || (pact = new _Pact$2()), 2, e);
9055
+ _settle$3(pact || (pact = new _Pact$3()), 2, e);
9053
9056
  }
9054
9057
  }
9055
9058
  _cycle();
@@ -9117,7 +9120,7 @@ var RobustExternalAPICallerService = /*#__PURE__*/function () {
9117
9120
  var result;
9118
9121
  var calculationUuid = concurrentCalculationsMetadataHolder.startCalculation(_this.bio);
9119
9122
  return Promise.resolve(_finallyRethrows$1(function () {
9120
- return _catch$8(function () {
9123
+ return _catch$9(function () {
9121
9124
  function _temp5() {
9122
9125
  var _result2, _result3;
9123
9126
  if (((_result2 = result) == null ? void 0 : _result2.data) == null) {
@@ -9132,7 +9135,7 @@ var RobustExternalAPICallerService = /*#__PURE__*/function () {
9132
9135
  return (_result3 = result) == null ? void 0 : _result3.data;
9133
9136
  }
9134
9137
  var i = 0;
9135
- var _temp4 = _for$1(function () {
9138
+ var _temp4 = _for$2(function () {
9136
9139
  var _result4, _result5;
9137
9140
  return (i < attemptsCount || !!((_result4 = result) != null && _result4.shouldBeForceRetried)) && ((_result5 = result) == null ? void 0 : _result5.data) == null;
9138
9141
  }, function () {
@@ -9145,7 +9148,7 @@ var RobustExternalAPICallerService = /*#__PURE__*/function () {
9145
9148
  */
9146
9149
  var rpsFactor = result ? result.rpsFactor : RobustExternalAPICallerService.defaultRPSFactor;
9147
9150
  result = null;
9148
- var _temp3 = _catch$8(function () {
9151
+ var _temp3 = _catch$9(function () {
9149
9152
  function _temp2() {
9150
9153
  var _result$errors;
9151
9154
  if ((_result$errors = result.errors) != null && _result$errors.length) {
@@ -9169,7 +9172,7 @@ var RobustExternalAPICallerService = /*#__PURE__*/function () {
9169
9172
  return Promise.resolve(new Promise(function (resolve, reject) {
9170
9173
  setTimeout(function () {
9171
9174
  try {
9172
- var _temp6 = _catch$8(function () {
9175
+ var _temp6 = _catch$9(function () {
9173
9176
  return Promise.resolve(_this._performCallAttempt(parametersValues, timeoutMS, cancelToken, rpsFactor, doNotFailForNowData)).then(function (_this$_performCallAtt2) {
9174
9177
  resolve(_this$_performCallAtt2);
9175
9178
  });
@@ -9225,7 +9228,7 @@ var RobustExternalAPICallerService = /*#__PURE__*/function () {
9225
9228
  providerIndex = 0,
9226
9229
  countOfRequestsDeclinedByRps = 0,
9227
9230
  errors = [];
9228
- var _temp14 = _for$1(function () {
9231
+ var _temp14 = _for$2(function () {
9229
9232
  return !data && providerIndex < providers.length;
9230
9233
  }, void 0, function () {
9231
9234
  var provider = providers[providerIndex];
@@ -9239,7 +9242,7 @@ var RobustExternalAPICallerService = /*#__PURE__*/function () {
9239
9242
  return;
9240
9243
  }
9241
9244
  var _temp13 = _finallyRethrows$1(function () {
9242
- return _catch$8(function () {
9245
+ return _catch$9(function () {
9243
9246
  var _provider$specificHea;
9244
9247
  function _temp12() {
9245
9248
  if (iterationsData.length) {
@@ -9417,21 +9420,21 @@ function punishProvider(provider) {
9417
9420
  * TODO: [tests, critical++] add unit tests - massively used logic and can produce sophisticated concurrency bugs
9418
9421
  */
9419
9422
 
9420
- function _settle$1(pact, state, value) {
9423
+ function _settle$2(pact, state, value) {
9421
9424
  if (!pact.s) {
9422
- if (value instanceof _Pact$1) {
9425
+ if (value instanceof _Pact$2) {
9423
9426
  if (value.s) {
9424
9427
  if (state & 1) {
9425
9428
  state = value.s;
9426
9429
  }
9427
9430
  value = value.v;
9428
9431
  } else {
9429
- value.o = _settle$1.bind(null, pact, state);
9432
+ value.o = _settle$2.bind(null, pact, state);
9430
9433
  return;
9431
9434
  }
9432
9435
  }
9433
9436
  if (value && value.then) {
9434
- value.then(_settle$1.bind(null, pact, state), _settle$1.bind(null, pact, 2));
9437
+ value.then(_settle$2.bind(null, pact, state), _settle$2.bind(null, pact, 2));
9435
9438
  return;
9436
9439
  }
9437
9440
  pact.s = state;
@@ -9447,7 +9450,7 @@ function _settle$1(pact, state, value) {
9447
9450
  * Util class to control access to a resource when it can be called in parallel for the same result.
9448
9451
  * (E.g. getting today coins-fiat rates from some API).
9449
9452
  */
9450
- var _Pact$1 = /*#__PURE__*/function () {
9453
+ var _Pact$2 = /*#__PURE__*/function () {
9451
9454
  function _Pact() {}
9452
9455
  _Pact.prototype.then = function (onFulfilled, onRejected) {
9453
9456
  var result = new _Pact();
@@ -9456,9 +9459,9 @@ var _Pact$1 = /*#__PURE__*/function () {
9456
9459
  var callback = state & 1 ? onFulfilled : onRejected;
9457
9460
  if (callback) {
9458
9461
  try {
9459
- _settle$1(result, 1, callback(this.v));
9462
+ _settle$2(result, 1, callback(this.v));
9460
9463
  } catch (e) {
9461
- _settle$1(result, 2, e);
9464
+ _settle$2(result, 2, e);
9462
9465
  }
9463
9466
  return result;
9464
9467
  } else {
@@ -9469,28 +9472,28 @@ var _Pact$1 = /*#__PURE__*/function () {
9469
9472
  try {
9470
9473
  var value = _this.v;
9471
9474
  if (_this.s & 1) {
9472
- _settle$1(result, 1, onFulfilled ? onFulfilled(value) : value);
9475
+ _settle$2(result, 1, onFulfilled ? onFulfilled(value) : value);
9473
9476
  } else if (onRejected) {
9474
- _settle$1(result, 1, onRejected(value));
9477
+ _settle$2(result, 1, onRejected(value));
9475
9478
  } else {
9476
- _settle$1(result, 2, value);
9479
+ _settle$2(result, 2, value);
9477
9480
  }
9478
9481
  } catch (e) {
9479
- _settle$1(result, 2, e);
9482
+ _settle$2(result, 2, e);
9480
9483
  }
9481
9484
  };
9482
9485
  return result;
9483
9486
  };
9484
9487
  return _Pact;
9485
9488
  }();
9486
- function _isSettledPact$1(thenable) {
9487
- return thenable instanceof _Pact$1 && thenable.s & 1;
9489
+ function _isSettledPact$2(thenable) {
9490
+ return thenable instanceof _Pact$2 && thenable.s & 1;
9488
9491
  }
9489
- function _for(test, update, body) {
9492
+ function _for$1(test, update, body) {
9490
9493
  var stage;
9491
9494
  for (;;) {
9492
9495
  var shouldContinue = test();
9493
- if (_isSettledPact$1(shouldContinue)) {
9496
+ if (_isSettledPact$2(shouldContinue)) {
9494
9497
  shouldContinue = shouldContinue.v;
9495
9498
  }
9496
9499
  if (!shouldContinue) {
@@ -9502,7 +9505,7 @@ function _for(test, update, body) {
9502
9505
  }
9503
9506
  var result = body();
9504
9507
  if (result && result.then) {
9505
- if (_isSettledPact$1(result)) {
9508
+ if (_isSettledPact$2(result)) {
9506
9509
  result = result.s;
9507
9510
  } else {
9508
9511
  stage = 1;
@@ -9511,14 +9514,14 @@ function _for(test, update, body) {
9511
9514
  }
9512
9515
  if (update) {
9513
9516
  var updateValue = update();
9514
- if (updateValue && updateValue.then && !_isSettledPact$1(updateValue)) {
9517
+ if (updateValue && updateValue.then && !_isSettledPact$2(updateValue)) {
9515
9518
  stage = 2;
9516
9519
  break;
9517
9520
  }
9518
9521
  }
9519
9522
  }
9520
- var pact = new _Pact$1();
9521
- var reject = _settle$1.bind(null, pact, 2);
9523
+ var pact = new _Pact$2();
9524
+ var reject = _settle$2.bind(null, pact, 2);
9522
9525
  (stage === 0 ? shouldContinue.then(_resumeAfterTest) : stage === 1 ? result.then(_resumeAfterBody) : updateValue.then(_resumeAfterUpdate)).then(void 0, reject);
9523
9526
  return pact;
9524
9527
  function _resumeAfterBody(value) {
@@ -9526,14 +9529,14 @@ function _for(test, update, body) {
9526
9529
  do {
9527
9530
  if (update) {
9528
9531
  updateValue = update();
9529
- if (updateValue && updateValue.then && !_isSettledPact$1(updateValue)) {
9532
+ if (updateValue && updateValue.then && !_isSettledPact$2(updateValue)) {
9530
9533
  updateValue.then(_resumeAfterUpdate).then(void 0, reject);
9531
9534
  return;
9532
9535
  }
9533
9536
  }
9534
9537
  shouldContinue = test();
9535
- if (!shouldContinue || _isSettledPact$1(shouldContinue) && !shouldContinue.v) {
9536
- _settle$1(pact, 1, result);
9538
+ if (!shouldContinue || _isSettledPact$2(shouldContinue) && !shouldContinue.v) {
9539
+ _settle$2(pact, 1, result);
9537
9540
  return;
9538
9541
  }
9539
9542
  if (shouldContinue.then) {
@@ -9541,7 +9544,7 @@ function _for(test, update, body) {
9541
9544
  return;
9542
9545
  }
9543
9546
  result = body();
9544
- if (_isSettledPact$1(result)) {
9547
+ if (_isSettledPact$2(result)) {
9545
9548
  result = result.v;
9546
9549
  }
9547
9550
  } while (!result || !result.then);
@@ -9556,7 +9559,7 @@ function _for(test, update, body) {
9556
9559
  _resumeAfterBody(result);
9557
9560
  }
9558
9561
  } else {
9559
- _settle$1(pact, 1, result);
9562
+ _settle$2(pact, 1, result);
9560
9563
  }
9561
9564
  }
9562
9565
  function _resumeAfterUpdate() {
@@ -9567,11 +9570,11 @@ function _for(test, update, body) {
9567
9570
  _resumeAfterTest(shouldContinue);
9568
9571
  }
9569
9572
  } else {
9570
- _settle$1(pact, 1, result);
9573
+ _settle$2(pact, 1, result);
9571
9574
  }
9572
9575
  }
9573
9576
  }
9574
- function _catch$7(body, recover) {
9577
+ function _catch$8(body, recover) {
9575
9578
  try {
9576
9579
  var result = body();
9577
9580
  } catch (e) {
@@ -9650,7 +9653,7 @@ var CacheAndConcurrentRequestsResolver = /*#__PURE__*/function () {
9650
9653
  _proto.getCachedOrWaitForCachedOrAcquireLock = function getCachedOrWaitForCachedOrAcquireLock(cacheId) {
9651
9654
  try {
9652
9655
  var _this = this;
9653
- return Promise.resolve(_catch$7(function () {
9656
+ return Promise.resolve(_catch$8(function () {
9654
9657
  function _temp2() {
9655
9658
  var _cached, _cached2;
9656
9659
  return calculationId ? {
@@ -9681,7 +9684,7 @@ var CacheAndConcurrentRequestsResolver = /*#__PURE__*/function () {
9681
9684
  var isRetrievedCacheExpired = true;
9682
9685
  var isWaitingForActiveCalculationSucceeded;
9683
9686
  var weStillHaveSomeTimeToProceedExecution = true;
9684
- var _temp = _for(function () {
9687
+ var _temp = _for$1(function () {
9685
9688
  return calculationId == null && cached == null && !!isRetrievedCacheExpired && !!weStillHaveSomeTimeToProceedExecution;
9686
9689
  }, void 0, function () {
9687
9690
  return Promise.resolve(_this._requestsManager.startCalculationOrWaitForActiveToFinish(cacheId)).then(function (result) {
@@ -9729,7 +9732,7 @@ var CacheAndConcurrentRequestsResolver = /*#__PURE__*/function () {
9729
9732
  _proto.acquireLock = function acquireLock(cacheId) {
9730
9733
  try {
9731
9734
  var _this2 = this;
9732
- return Promise.resolve(_catch$7(function () {
9735
+ return Promise.resolve(_catch$8(function () {
9733
9736
  return Promise.resolve(_this2._requestsManager.acquireLock(cacheId));
9734
9737
  }, function (e) {
9735
9738
  improveAndRethrow(e, "acquireLock");
@@ -9899,7 +9902,7 @@ var ManagerOfRequestsToTheSameResource = /*#__PURE__*/function () {
9899
9902
  try {
9900
9903
  var _exit;
9901
9904
  var _this3 = this;
9902
- var _temp3 = _catch$7(function () {
9905
+ var _temp3 = _catch$8(function () {
9903
9906
  var activeCalculationIdForHash = _this3._activeCalculationsIds.get(requestHash);
9904
9907
  if (activeCalculationIdForHash == null) {
9905
9908
  var id = uuid.v4();
@@ -9933,7 +9936,7 @@ var ManagerOfRequestsToTheSameResource = /*#__PURE__*/function () {
9933
9936
  _proto2.acquireLock = function acquireLock(requestHash) {
9934
9937
  try {
9935
9938
  var _this4 = this;
9936
- return Promise.resolve(_catch$7(function () {
9939
+ return Promise.resolve(_catch$8(function () {
9937
9940
  var _this4$_nextCalculati;
9938
9941
  var activeId = _this4._activeCalculationsIds.get(requestHash);
9939
9942
  var nextId = uuid.v4();
@@ -10084,7 +10087,7 @@ var ManagerOfRequestsToTheSameResource = /*#__PURE__*/function () {
10084
10087
  * TODO: [tests, critical] Massively used logic
10085
10088
  */
10086
10089
 
10087
- function _catch$6(body, recover) {
10090
+ function _catch$7(body, recover) {
10088
10091
  try {
10089
10092
  var result = body();
10090
10093
  } catch (e) {
@@ -10181,7 +10184,7 @@ var CachedRobustExternalApiCallerService = /*#__PURE__*/function () {
10181
10184
  var cacheId;
10182
10185
  var result;
10183
10186
  return Promise.resolve(_finallyRethrows(function () {
10184
- return _catch$6(function () {
10187
+ return _catch$7(function () {
10185
10188
  cacheId = _this._calculateCacheId(parametersValues, customHashFunctionForParams);
10186
10189
  return Promise.resolve(_this._cahceAndRequestsResolver.getCachedOrWaitForCachedOrAcquireLock(cacheId)).then(function (_this$_cahceAndReques) {
10187
10190
  var _result2, _result4;
@@ -10250,7 +10253,7 @@ var CachedRobustExternalApiCallerService = /*#__PURE__*/function () {
10250
10253
  return CachedRobustExternalApiCallerService;
10251
10254
  }();
10252
10255
 
10253
- function _catch$5(body, recover) {
10256
+ function _catch$6(body, recover) {
10254
10257
  try {
10255
10258
  var result = body();
10256
10259
  } catch (e) {
@@ -10334,7 +10337,7 @@ var IpAddressProvider = /*#__PURE__*/function () {
10334
10337
  IpAddressProvider.getClientIpAddress = function getClientIpAddress() {
10335
10338
  try {
10336
10339
  var _this = this;
10337
- return Promise.resolve(_catch$5(function () {
10340
+ return Promise.resolve(_catch$6(function () {
10338
10341
  return Promise.resolve(_this.externalIPAddressAPICaller.callExternalAPICached([], 7000));
10339
10342
  }, function (e) {
10340
10343
  improveAndRethrow(e, "getClientIpAddress");
@@ -10457,30 +10460,77 @@ var CancelProcessing = /*#__PURE__*/function () {
10457
10460
  return CancelProcessing;
10458
10461
  }();
10459
10462
 
10460
- var ExistingSwap =
10461
10463
  /**
10462
- * @param swapId {string}
10463
- * @param status {SwapProvider.SWAP_STATUSES}
10464
- * @param createdAt {number}
10465
- * @param expiresAt {number}
10466
- * @param confirmations {number}
10467
- * @param rate {string}
10468
- * @param fixed {boolean}
10469
- * @param refundAddress {string}
10470
- * @param payToAddress {string}
10471
- * @param fromCoin {Coin}
10472
- * @param fromAmount {string}
10473
- * @param fromTransactionId {string}
10474
- * @param fromTransactionLink {string}
10475
- * @param toCoin {Coin}
10476
- * @param toAmount {string}
10477
- * @param toTransactionId {string|null}
10478
- * @param toTransactionLink {string}
10479
- * @param toAddress {string}
10480
- * @param partner {string}
10481
- * @param fromExtraId {string}
10482
- * @param toExtraId {string}
10483
- * @param refundExtraId {string}
10464
+ * Represents an existing swap.
10465
+ */
10466
+ var ExistingSwap = /** @type {string} The ID of the swap. */
10467
+
10468
+ /** @type {SwapProvider.SWAP_STATUSES} The status of the swap. */
10469
+
10470
+ /** @type {number} The timestamp when the swap was created. */
10471
+
10472
+ /** @type {number} The timestamp when the swap expires. */
10473
+
10474
+ /** @type {number|null} The number of confirmations the swap has received, or null if not applicable. */
10475
+
10476
+ /** @type {string} The exchange rate for the swap. */
10477
+
10478
+ /** @type {boolean} Whether the rate is fixed. */
10479
+
10480
+ /** @type {string|null} The refund address in case the swap fails, or null if not applicable. */
10481
+
10482
+ /** @type {string} The address to send the payment to. */
10483
+
10484
+ /** @type {Coin} The coin from which the swap is made. */
10485
+
10486
+ /** @type {string} The amount of the fromCoin being swapped. */
10487
+
10488
+ /** @type {string|null} The transaction ID for the fromCoin, or null if not applicable. */
10489
+
10490
+ /** @type {string|null} The link to view the fromCoin transaction, or null if not applicable. */
10491
+
10492
+ /** @type {Coin} The coin to which the swap is made. */
10493
+
10494
+ /** @type {string} The amount of the toCoin received. */
10495
+
10496
+ /** @type {string|null} The transaction ID for the toCoin, or null if not applicable. */
10497
+
10498
+ /** @type {string|null} The link to view the toCoin transaction, or null if not applicable. */
10499
+
10500
+ /** @type {string} The address to send the swapped toCoin to. */
10501
+
10502
+ /** @type {string|null} The partner associated with the swap, or null if not applicable. */
10503
+
10504
+ /** @type {string|null} Extra identifier for the fromCoin, or null if not applicable. */
10505
+
10506
+ /** @type {string|null} Extra identifier for the toCoin, or null if not applicable. */
10507
+
10508
+ /** @type {string|null} Extra identifier for refund, or null if not applicable. */
10509
+
10510
+ /**
10511
+ * @constructor
10512
+ * @param {string} swapId - The ID of the swap.
10513
+ * @param {SwapProvider.SWAP_STATUSES} status - The status of the swap.
10514
+ * @param {number} createdAt - The timestamp when the swap was created.
10515
+ * @param {number} expiresAt - The timestamp when the swap expires.
10516
+ * @param {number|null} confirmations - The number of confirmations the swap has received, or null.
10517
+ * @param {string} rate - The exchange rate for the swap.
10518
+ * @param {boolean} fixed - Indicates if the rate is fixed.
10519
+ * @param {string|null} refundAddress - The address to refund to in case of failure, or null.
10520
+ * @param {string} payToAddress - The address to send the funds to.
10521
+ * @param {Coin} fromCoin - The coin that is being swapped from.
10522
+ * @param {string} fromAmount - The amount of the coin being swapped from.
10523
+ * @param {string|null} fromTransactionId - The transaction ID for the fromCoin, or null.
10524
+ * @param {string|null} fromTransactionLink - The link to view the fromCoin transaction, or null.
10525
+ * @param {Coin} toCoin - The coin that is being swapped to.
10526
+ * @param {string} toAmount - The amount of the coin being swapped to.
10527
+ * @param {string|null} toTransactionId - The transaction ID for the toCoin, or null.
10528
+ * @param {string|null} toTransactionLink - The link to view the toCoin transaction, or null.
10529
+ * @param {string} toAddress - The address to send the swapped coin to.
10530
+ * @param {string|null} partner - The partner associated with the swap, or null.
10531
+ * @param {string|null} fromExtraId - Any extra ID related to the fromCoin, or null.
10532
+ * @param {string|null} toExtraId - Any extra ID related to the toCoin, or null.
10533
+ * @param {string|null} refundExtraId - Any extra ID related to the refund, or null.
10484
10534
  */
10485
10535
  function ExistingSwap(swapId, status, createdAt, expiresAt, confirmations, rate, fixed, refundAddress, payToAddress, fromCoin, fromAmount, fromTransactionId, fromTransactionLink, toCoin, toAmount, toTransactionId, toTransactionLink, toAddress,
10486
10536
  // TODO: [refactoring, moderate] toAddress is not quite clear. How about recipientAddress? task_id=0815a111c99543b78d374217eadbde4f
@@ -10509,35 +10559,49 @@ partner, fromExtraId, toExtraId, refundExtraId) {
10509
10559
  this.refundExtraId = refundExtraId;
10510
10560
  };
10511
10561
 
10562
+ /**
10563
+ * @class ExistingSwapWithFiatData
10564
+ * @extends {ExistingSwap}
10565
+ * @description Represents a swap with additional fiat currency data.
10566
+ */
10512
10567
  var ExistingSwapWithFiatData = /*#__PURE__*/function (_ExistingSwap) {
10513
10568
  _inheritsLoose(ExistingSwapWithFiatData, _ExistingSwap);
10569
+ /** @type {number|null} The fiat equivalent of the fromAmount. */
10570
+
10571
+ /** @type {number|null} The fiat equivalent of the toAmount. */
10572
+
10573
+ /** @type {string} The fiat currency code (e.g., USD, EUR). */
10574
+
10575
+ /** @type {number} The number of decimals for the fiat currency. */
10576
+
10514
10577
  /**
10515
- * @param swapId {string}
10516
- * @param status {SwapProvider.SWAP_STATUSES}
10517
- * @param createdAt {number}
10518
- * @param expiresAt {number}
10519
- * @param confirmations {number}
10520
- * @param rate {string}
10521
- * @param fixed {boolean}
10522
- * @param refundAddress {string}
10523
- * @param payToAddress {string}
10524
- * @param fromCoin {Coin}
10525
- * @param fromAmount {string}
10526
- * @param fromTransactionId {string}
10527
- * @param fromTransactionLink {string}
10528
- * @param toCoin {Coin}
10529
- * @param toAmount {string}
10530
- * @param toTransactionId {string|null}
10531
- * @param toTransactionLink
10532
- * @param toAddress {string}
10533
- * @param partner {string}
10534
- * @param fromExtraId {string}
10535
- * @param toExtraId {string}
10536
- * @param refundExtraId {string}
10537
- * @param fromAmountFiat {number}
10538
- * @param toAmountFiat {number}
10539
- * @param fiatCurrencyCode {string}
10540
- * @param fiatCurrencyDecimals {number}
10578
+ * @constructor
10579
+ * @param {string} swapId - The ID of the swap.
10580
+ * @param {SwapProvider.SWAP_STATUSES} status - The status of the swap.
10581
+ * @param {number} createdAt - The timestamp when the swap was created.
10582
+ * @param {number} expiresAt - The timestamp when the swap expires.
10583
+ * @param {number|null} confirmations - The number of confirmations the swap has received.
10584
+ * @param {string} rate - The exchange rate for the swap.
10585
+ * @param {boolean} fixed - Indicates if the rate is fixed.
10586
+ * @param {string|null} refundAddress - The address to refund to in case of failure.
10587
+ * @param {string} payToAddress - The address to send the funds to.
10588
+ * @param {Coin} fromCoin - The coin that is being swapped from.
10589
+ * @param {string} fromAmount - The amount of the coin being swapped from.
10590
+ * @param {string|null} fromTransactionId - The transaction ID for the fromCoin.
10591
+ * @param {string|null} fromTransactionLink - The link to view the fromCoin transaction.
10592
+ * @param {Coin} toCoin - The coin that is being swapped to.
10593
+ * @param {string} toAmount - The amount of the coin being swapped to.
10594
+ * @param {string|null} toTransactionId - The transaction ID for the toCoin.
10595
+ * @param {string|null} toTransactionLink - The link to view the toCoin transaction.
10596
+ * @param {string} toAddress - The address to send the swapped coin to.
10597
+ * @param {string|null} partner - The partner id associated with the swap.
10598
+ * @param {string|null} fromExtraId - Any extra ID related to the fromCoin.
10599
+ * @param {string|null} toExtraId - Any extra ID related to the toCoin.
10600
+ * @param {string|null} refundExtraId - Any extra ID related to the refund.
10601
+ * @param {number|null} fromAmountFiat - The fiat equivalent of the fromAmount.
10602
+ * @param {number|null} toAmountFiat - The fiat equivalent of the toAmount.
10603
+ * @param {string} fiatCurrencyCode - The fiat currency code (e.g., USD, EUR).
10604
+ * @param {number} fiatCurrencyDecimals - The number of decimals for the fiat currency.
10541
10605
  */
10542
10606
  function ExistingSwapWithFiatData(swapId, status, createdAt, expiresAt, confirmations, rate, fixed, refundAddress, payToAddress, fromCoin, fromAmount, fromTransactionId, fromTransactionLink, toCoin, toAmount, toTransactionId, toTransactionLink, toAddress, partner, fromExtraId, toExtraId, refundExtraId, fromAmountFiat, toAmountFiat, fiatCurrencyCode, fiatCurrencyDecimals) {
10543
10607
  var _this;
@@ -10550,12 +10614,14 @@ var ExistingSwapWithFiatData = /*#__PURE__*/function (_ExistingSwap) {
10550
10614
  }
10551
10615
 
10552
10616
  /**
10553
- * @param existingSwap {ExistingSwap}
10554
- * @param fromAmountFiat {number}
10555
- * @param toAmountFiat {number}
10556
- * @param fiatCurrencyCode {string}
10557
- * @param fiatCurrencyDecimals {number}
10558
- * @return {ExistingSwapWithFiatData}
10617
+ * Creates an instance of ExistingSwapWithFiatData from an ExistingSwap.
10618
+ * @static
10619
+ * @param {ExistingSwap} existingSwap - The existing swap data.
10620
+ * @param {number|null} fromAmountFiat - The fiat equivalent of the fromAmount.
10621
+ * @param {number|null} toAmountFiat - The fiat equivalent of the toAmount.
10622
+ * @param {string} fiatCurrencyCode - The fiat currency code (e.g., USD, EUR).
10623
+ * @param {number} fiatCurrencyDecimals - The number of decimals for the fiat currency.
10624
+ * @returns {ExistingSwapWithFiatData} A new instance of ExistingSwapWithFiatData.
10559
10625
  */
10560
10626
  ExistingSwapWithFiatData.fromExistingSwap = function fromExistingSwap(existingSwap, fromAmountFiat, toAmountFiat, fiatCurrencyCode, fiatCurrencyDecimals) {
10561
10627
  return new ExistingSwapWithFiatData(existingSwap.swapId, existingSwap.status, existingSwap.createdAt, existingSwap.expiresAt, existingSwap.confirmations, existingSwap.rate, existingSwap.fixed, 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);
@@ -10587,6 +10653,8 @@ var BaseSwapCreationInfo = /** @type {Coin} */
10587
10653
 
10588
10654
  /** @type {boolean} */
10589
10655
 
10656
+ /** @type {string|null} */
10657
+
10590
10658
  /** @type {boolean} */
10591
10659
 
10592
10660
  /**
@@ -10602,9 +10670,13 @@ var BaseSwapCreationInfo = /** @type {Coin} */
10602
10670
  * @param fiatMax {number}
10603
10671
  * @param durationMinutesRange {string}
10604
10672
  * @param fixed {boolean}
10673
+ * @param partner {string|null} rabbit partner id
10605
10674
  * @param [isRefundAddressRequired=false] {boolean}
10606
10675
  */
10607
- function BaseSwapCreationInfo(fromCoin, toCoin, fromAmountCoins, toAmountCoins, rate, rawSwapData, min, fiatMin, max, fiatMax, durationMinutesRange, fixed, isRefundAddressRequired) {
10676
+ function BaseSwapCreationInfo(fromCoin, toCoin, fromAmountCoins, toAmountCoins, rate, rawSwapData, min, fiatMin, max, fiatMax, durationMinutesRange, fixed, partner, isRefundAddressRequired) {
10677
+ if (partner === void 0) {
10678
+ partner = null;
10679
+ }
10608
10680
  if (isRefundAddressRequired === void 0) {
10609
10681
  isRefundAddressRequired = false;
10610
10682
  }
@@ -10620,12 +10692,13 @@ function BaseSwapCreationInfo(fromCoin, toCoin, fromAmountCoins, toAmountCoins,
10620
10692
  this.fiatMax = fiatMax;
10621
10693
  this.durationMinutesRange = durationMinutesRange;
10622
10694
  this.fixed = fixed;
10695
+ this.partner = partner;
10623
10696
  this.isRefundAddressRequired = isRefundAddressRequired;
10624
10697
  };
10625
10698
 
10626
10699
  /**
10627
- * Coin construction rules:
10628
- * 1. ticker should be CODEPROTOCOL_CODE e.g. USDTERC20
10700
+ * construction rules:
10701
+ * 1. Coin class ticker should be built using toRabbitTicker function
10629
10702
  * 2. name should not contain (PROTOCOL_CODE) or just PROTOCOL_CODe
10630
10703
  * 3. protocol should be null for coins major for their blockchains like BTC, ETH
10631
10704
  * 4. isPopular should be a number - the higher -> the more popular
@@ -10653,13 +10726,13 @@ var SwapProviderCoinInfo = /** @type {Coin} */
10653
10726
  /** @type {boolean} */
10654
10727
 
10655
10728
  /**
10656
- * @param {string} coin - The name of the coin.
10657
- * @param {string} code - The ticker code for the coin, e.g., USDTERC20.
10658
- * @param {string} network - The network on which the coin operates.
10729
+ * @param {Coin} coin
10730
+ * @param {string} code - The ticker code raw as in the provider
10731
+ * @param {string} network - The network raw as in the provider
10659
10732
  * @param {boolean} hasExtraId - Whether the coin requires an extra ID for transactions.
10660
10733
  * @param {string|null} extraIdName - The name of the extra ID, if applicable.
10661
10734
  * @param {number} popularity - A number indicating the popularity of the coin.
10662
- * @param {string} [iconURL=FALLBACK_ASSET_ICON_URL] - The URL of the coin's icon. Falls back to a default value if not provided.
10735
+ * @param {string} iconURL - The URL of the coin's icon.
10663
10736
  * @param {boolean} [deposit=false] - Indicates whether deposits are supported. Defaults to `false`.
10664
10737
  * @param {boolean} [withdrawal=false] - Indicates whether withdrawals are supported. Defaults to `false`.
10665
10738
  * @param {string|null} [validationRegexp=null] - A regular expression for validating addresses, if applicable.
@@ -10679,7 +10752,9 @@ function SwapProviderCoinInfo(coin, code, network, hasExtraId, extraIdName, popu
10679
10752
  this.isAvailable = isAvailable != null ? isAvailable : true;
10680
10753
  };
10681
10754
 
10682
- function _catch$4(body, recover) {
10755
+ // TODO: [refactoring, moderate] extract structure of _supportedCoins into model class
10756
+
10757
+ function _catch$5(body, recover) {
10683
10758
  try {
10684
10759
  var result = body();
10685
10760
  } catch (e) {
@@ -10689,10 +10764,7 @@ function _catch$4(body, recover) {
10689
10764
  return result.then(void 0, recover);
10690
10765
  }
10691
10766
  return result;
10692
- } // TODO: [refactoring, moderate] extract structure of _supportedCoins into model class
10693
- var PRE_LISTED_COINS = [new SwapProviderCoinInfo(new Coin("Hamster Kombat", "HMSTRTON", "HMSTR", 18, null, "", null, null, 1, null, [], 60000, null, new Protocol("TON"), null, false), "HMSTR", "TON", true, "MEMO", 100, "https://rabbit.io/asset-icons/HMSTR.png",
10694
- // "https://hamsterkombat.io/images/icons/hamster-coin.png"
10695
- true, true, "^(EQ|UQ)[A-Za-z0-9-_]{46}$", false)];
10767
+ }
10696
10768
  var SwapProvider = /*#__PURE__*/function () {
10697
10769
  /** @type {string} */
10698
10770
 
@@ -10710,7 +10782,9 @@ var SwapProvider = /*#__PURE__*/function () {
10710
10782
 
10711
10783
  /** @type {boolean} */
10712
10784
 
10713
- function SwapProvider(id, cache, customCoinBuilder, useRestrictedCoinsSet) {
10785
+ /** @type {boolean} */
10786
+
10787
+ function SwapProvider(id, cache, customCoinBuilder, useRestrictedCoinsSet, isAggregator, isReceiveAmountEstimationSupported) {
10714
10788
  if (customCoinBuilder === void 0) {
10715
10789
  customCoinBuilder = function customCoinBuilder(coin, network) {
10716
10790
  return null;
@@ -10719,6 +10793,12 @@ var SwapProvider = /*#__PURE__*/function () {
10719
10793
  if (useRestrictedCoinsSet === void 0) {
10720
10794
  useRestrictedCoinsSet = true;
10721
10795
  }
10796
+ if (isAggregator === void 0) {
10797
+ isAggregator = false;
10798
+ }
10799
+ if (isReceiveAmountEstimationSupported === void 0) {
10800
+ isReceiveAmountEstimationSupported = false;
10801
+ }
10722
10802
  this.id = id;
10723
10803
  this._supportedCoins = [];
10724
10804
  this._supportedCoinsLastUpdateTimestamp = 0;
@@ -10726,7 +10806,8 @@ var SwapProvider = /*#__PURE__*/function () {
10726
10806
  this.useRestrictedCoinsSet = useRestrictedCoinsSet;
10727
10807
  this._customCoinBuilder = customCoinBuilder;
10728
10808
  this._cache = cache;
10729
- this.isAggregator = false;
10809
+ this.isAggregator = isAggregator;
10810
+ this.isReceiveAmountEstimationSupported = isReceiveAmountEstimationSupported;
10730
10811
  }
10731
10812
  var _proto = SwapProvider.prototype;
10732
10813
  /**
@@ -10807,21 +10888,7 @@ var SwapProvider = /*#__PURE__*/function () {
10807
10888
  * @private
10808
10889
  */;
10809
10890
  _proto._fetchSupportedCurrenciesIfNeeded = function _fetchSupportedCurrenciesIfNeeded() {
10810
- try {
10811
- var _this2 = this;
10812
- if (!_this2.useRestrictedCoinsSet) {
10813
- PRE_LISTED_COINS.forEach(function (preListedCoin) {
10814
- if (!_this2._supportedCoins.find(function (existingCoin) {
10815
- return preListedCoin.coin.ticker === existingCoin.coin.ticker;
10816
- })) {
10817
- _this2._supportedCoins.push(preListedCoin);
10818
- }
10819
- });
10820
- }
10821
- return Promise.resolve();
10822
- } catch (e) {
10823
- return Promise.reject(e);
10824
- }
10891
+ return Promise.resolve();
10825
10892
  }
10826
10893
  /**
10827
10894
  * Retrieves all currencies supported by this swap provider.
@@ -10832,15 +10899,15 @@ var SwapProvider = /*#__PURE__*/function () {
10832
10899
  ;
10833
10900
  _proto.getAllSupportedCurrencies = function getAllSupportedCurrencies() {
10834
10901
  try {
10835
- var _this3 = this;
10902
+ var _this2 = this;
10836
10903
  var loggerSource = "getAllSupportedCurrencies";
10837
- return Promise.resolve(_catch$4(function () {
10838
- return Promise.resolve(_this3._fetchSupportedCurrenciesIfNeeded()).then(function () {
10839
- var _this3$_supportedCoin;
10840
- Logger.log("We have " + ((_this3$_supportedCoin = _this3._supportedCoins) == null ? void 0 : _this3$_supportedCoin.length) + " supported coins returning", loggerSource);
10904
+ return Promise.resolve(_catch$5(function () {
10905
+ return Promise.resolve(_this2._fetchSupportedCurrenciesIfNeeded()).then(function () {
10906
+ var _this2$_supportedCoin;
10907
+ Logger.log("We have " + ((_this2$_supportedCoin = _this2._supportedCoins) == null ? void 0 : _this2$_supportedCoin.length) + " supported coins returning", loggerSource);
10841
10908
  return {
10842
10909
  result: true,
10843
- coins: _this3._supportedCoins.map(function (item) {
10910
+ coins: _this2._supportedCoins.map(function (item) {
10844
10911
  return item.coin;
10845
10912
  })
10846
10913
  };
@@ -10868,15 +10935,15 @@ var SwapProvider = /*#__PURE__*/function () {
10868
10935
  ;
10869
10936
  _proto.getAllSupportedCurrenciesWithRawDetails = function getAllSupportedCurrenciesWithRawDetails() {
10870
10937
  try {
10871
- var _this4 = this;
10938
+ var _this3 = this;
10872
10939
  var loggerSource = "getAllSupportedCurrenciesWithRawDetails";
10873
- return Promise.resolve(_catch$4(function () {
10874
- return Promise.resolve(_this4._fetchSupportedCurrenciesIfNeeded()).then(function () {
10875
- var _this4$_supportedCoin;
10876
- Logger.log("We have " + ((_this4$_supportedCoin = _this4._supportedCoins) == null ? void 0 : _this4$_supportedCoin.length) + " supported coins returning", loggerSource);
10940
+ return Promise.resolve(_catch$5(function () {
10941
+ return Promise.resolve(_this3._fetchSupportedCurrenciesIfNeeded()).then(function () {
10942
+ var _this3$_supportedCoin;
10943
+ Logger.log("We have " + ((_this3$_supportedCoin = _this3._supportedCoins) == null ? void 0 : _this3$_supportedCoin.length) + " supported coins returning", loggerSource);
10877
10944
  return {
10878
10945
  result: true,
10879
- coinsInfo: [].concat(_this4._supportedCoins)
10946
+ coinsInfo: [].concat(_this3._supportedCoins)
10880
10947
  };
10881
10948
  });
10882
10949
  }, function (e) {
@@ -10902,15 +10969,15 @@ var SwapProvider = /*#__PURE__*/function () {
10902
10969
  ;
10903
10970
  _proto.getDepositCurrencies = function getDepositCurrencies() {
10904
10971
  try {
10905
- var _this5 = this;
10972
+ var _this4 = this;
10906
10973
  var loggerSource = "getDepositCurrencies";
10907
- return Promise.resolve(_catch$4(function () {
10908
- return Promise.resolve(_this5._fetchSupportedCurrenciesIfNeeded()).then(function () {
10909
- var _this5$_supportedCoin;
10910
- Logger.log("We have " + ((_this5$_supportedCoin = _this5._supportedCoins) == null ? void 0 : _this5$_supportedCoin.length) + " supported coins, getting depositable", loggerSource);
10974
+ return Promise.resolve(_catch$5(function () {
10975
+ return Promise.resolve(_this4._fetchSupportedCurrenciesIfNeeded()).then(function () {
10976
+ var _this4$_supportedCoin;
10977
+ Logger.log("We have " + ((_this4$_supportedCoin = _this4._supportedCoins) == null ? void 0 : _this4$_supportedCoin.length) + " supported coins, getting depositable", loggerSource);
10911
10978
  return {
10912
10979
  result: true,
10913
- coins: _this5._supportedCoins.filter(function (item) {
10980
+ coins: _this4._supportedCoins.filter(function (item) {
10914
10981
  return item.deposit;
10915
10982
  }).map(function (item) {
10916
10983
  return item.coin;
@@ -10944,15 +11011,15 @@ var SwapProvider = /*#__PURE__*/function () {
10944
11011
  exceptCurrency = null;
10945
11012
  }
10946
11013
  try {
10947
- var _this6 = this;
11014
+ var _this5 = this;
10948
11015
  var loggerSource = "getWithdrawalCurrencies";
10949
- return Promise.resolve(_catch$4(function () {
10950
- return Promise.resolve(_this6._fetchSupportedCurrenciesIfNeeded()).then(function () {
10951
- var _this6$_supportedCoin;
10952
- Logger.log("We have " + ((_this6$_supportedCoin = _this6._supportedCoins) == null ? void 0 : _this6$_supportedCoin.length) + " supported coins, getting withdrawable", loggerSource);
11016
+ return Promise.resolve(_catch$5(function () {
11017
+ return Promise.resolve(_this5._fetchSupportedCurrenciesIfNeeded()).then(function () {
11018
+ var _this5$_supportedCoin;
11019
+ Logger.log("We have " + ((_this5$_supportedCoin = _this5._supportedCoins) == null ? void 0 : _this5$_supportedCoin.length) + " supported coins, getting withdrawable", loggerSource);
10953
11020
  return {
10954
11021
  result: true,
10955
- coins: _this6._supportedCoins.filter(function (item) {
11022
+ coins: _this5._supportedCoins.filter(function (item) {
10956
11023
  var _item$coin, _exceptCurrency;
10957
11024
  return item.withdrawal && (!exceptCurrency || ((_item$coin = item.coin) == null ? void 0 : _item$coin.ticker) !== ((_exceptCurrency = exceptCurrency) == null ? void 0 : _exceptCurrency.ticker));
10958
11025
  }).map(function (item) {
@@ -11009,25 +11076,25 @@ var SwapProvider = /*#__PURE__*/function () {
11009
11076
  */;
11010
11077
  _proto.getCoinToUSDTRate = function getCoinToUSDTRate(coinOrTicker) {
11011
11078
  try {
11012
- var _this7 = this;
11079
+ var _this6 = this;
11013
11080
  var loggerSource = "getCoinToUSDTRate";
11014
- return Promise.resolve(_catch$4(function () {
11015
- return coinOrTicker ? Promise.resolve(_this7._fetchSupportedCurrenciesIfNeeded()).then(function () {
11016
- var _this7$_supportedCoin;
11081
+ return Promise.resolve(_catch$5(function () {
11082
+ return coinOrTicker ? Promise.resolve(_this6._fetchSupportedCurrenciesIfNeeded()).then(function () {
11083
+ var _this6$_supportedCoin;
11017
11084
  var ticker = coinOrTicker instanceof Coin ? coinOrTicker.ticker : coinOrTicker;
11018
- var coin = _this7.getCoinByTickerIfPresent(ticker);
11085
+ var coin = _this6.getCoinByTickerIfPresent(ticker);
11019
11086
  if (!coin) return null;
11020
11087
 
11021
11088
  // Using USDT TRC20 as usually fee in this network is smaller than ERC20 and this network is widely used for USDT
11022
11089
  // This calculation is not precise as we cannot recognize the actual fee and network fee. Just approximate.
11023
11090
  // standard market fee is about 0.4% usually
11024
- var usdtTrc20 = (_this7$_supportedCoin = _this7._supportedCoins.find(function (i) {
11091
+ var usdtTrc20 = (_this6$_supportedCoin = _this6._supportedCoins.find(function (i) {
11025
11092
  return i.coin.ticker === "USDTTRC20";
11026
- })) == null ? void 0 : _this7$_supportedCoin.coin;
11093
+ })) == null ? void 0 : _this6$_supportedCoin.coin;
11027
11094
  if (!usdtTrc20) {
11028
11095
  return null;
11029
11096
  }
11030
- var cached = _this7._cache.get("swapspace_usdt_rate_" + ticker);
11097
+ var cached = _this6._cache.get("swapspace_usdt_rate_" + ticker);
11031
11098
  if (cached != null) {
11032
11099
  return {
11033
11100
  result: true,
@@ -11035,13 +11102,13 @@ var SwapProvider = /*#__PURE__*/function () {
11035
11102
  };
11036
11103
  }
11037
11104
  Logger.log("Loading USDT->coin rate as not found in cache:", ticker);
11038
- return Promise.resolve(_this7.getSwapInfo(usdtTrc20, coin, "5000", false)).then(function (result) {
11105
+ return Promise.resolve(_this6.getSwapInfo(usdtTrc20, coin, "5000", false)).then(function (result) {
11039
11106
  if (!result.result) {
11040
11107
  return null;
11041
11108
  }
11042
11109
  var standardSwapspaceFeeMultiplier = 1.004;
11043
- var rate = bignumber_js.BigNumber(1).div(bignumber_js.BigNumber(result.rate).times(standardSwapspaceFeeMultiplier)).toString();
11044
- _this7._cache.put("swap_usdt_rate_" + ticker, rate, 10 * 60000 // 15 minutes
11110
+ var rate = BigNumber.BigNumber(1).div(BigNumber.BigNumber(result.rate).times(standardSwapspaceFeeMultiplier)).toString();
11111
+ _this6._cache.put("swap_usdt_rate_" + ticker, rate, 10 * 60000 // 15 minutes
11045
11112
  );
11046
11113
  return {
11047
11114
  result: true,
@@ -11104,7 +11171,7 @@ var SwapProvider = /*#__PURE__*/function () {
11104
11171
  * @param amount {string}
11105
11172
  * @param toAddress {string}
11106
11173
  * @param refundAddress {string}
11107
- * @param rawSwapData {Object|null}
11174
+ * @param proprietarySwapEstimationData {Object|null}
11108
11175
  * @param clientIpAddress {string}
11109
11176
  * @param fixed {boolean}
11110
11177
  * @param [toCurrencyExtraId=""] {string} optional extra ID
@@ -11129,7 +11196,7 @@ var SwapProvider = /*#__PURE__*/function () {
11129
11196
  * })>}
11130
11197
  */
11131
11198
  ;
11132
- _proto.createSwap = function createSwap(fromCoin, toCoin, amount, toAddress, refundAddress, rawSwapData, clientIpAddress, fixed, toCurrencyExtraId, refundExtraId, amountIsToReceive) {
11199
+ _proto.createSwap = function createSwap(fromCoin, toCoin, amount, toAddress, refundAddress, proprietarySwapEstimationData, clientIpAddress, fixed, toCurrencyExtraId, refundExtraId, amountIsToReceive) {
11133
11200
  try {
11134
11201
  throw new Error("Not implemented in base");
11135
11202
  } catch (e) {
@@ -11306,7 +11373,7 @@ var KYC_LEVELS = {
11306
11373
  HIGH: "high"
11307
11374
  };
11308
11375
 
11309
- function _catch$3(body, recover) {
11376
+ function _catch$4(body, recover) {
11310
11377
  try {
11311
11378
  var result = body();
11312
11379
  } catch (e) {
@@ -11341,13 +11408,12 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
11341
11408
  if (apiKey === void 0) {
11342
11409
  apiKey = null;
11343
11410
  }
11344
- _this = _SwapProvider.call(this, "swapspace", cache, customCoinBuilder, useRestrictedCoinsSet) || this;
11411
+ _this = _SwapProvider.call(this, "swapspace", cache, customCoinBuilder, useRestrictedCoinsSet, true, false) || this;
11345
11412
  _this._partners = [];
11346
11413
  _this._URL = apiKey ? "https://api.swapspace.co" : apiKeysProxyUrl + "/" + _this.id;
11347
11414
  _this._headers = apiKey ? {
11348
11415
  Authorization: apiKey
11349
11416
  } : {};
11350
- _this.isAggregator = true;
11351
11417
  return _this;
11352
11418
  }
11353
11419
  var _proto = SwapspaceSwapProvider.prototype;
@@ -11360,7 +11426,7 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
11360
11426
  try {
11361
11427
  var _this2 = this;
11362
11428
  var loggerSource = "_fetchSupportedCurrenciesIfNeeded";
11363
- return Promise.resolve(_catch$3(function () {
11429
+ return Promise.resolve(_catch$4(function () {
11364
11430
  var _temp = function () {
11365
11431
  if (_this2._shouldCoinsListBeLoaded()) {
11366
11432
  return Promise.resolve(axios__default["default"].get(_this2._URL + "/api/v2/currencies", {
@@ -11418,7 +11484,7 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
11418
11484
  try {
11419
11485
  var _this3 = this;
11420
11486
  var loggerSource = "_fetchPartnersListIfNeeded";
11421
- return Promise.resolve(_catch$3(function () {
11487
+ return Promise.resolve(_catch$4(function () {
11422
11488
  var _temp2 = function (_this3$_partners) {
11423
11489
  if (((_this3$_partners = _this3._partners) == null ? void 0 : _this3$_partners.length) === 0) {
11424
11490
  return Promise.resolve(axios__default["default"].get(_this3._URL + "/api/v2/partners", {
@@ -11454,9 +11520,9 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
11454
11520
  try {
11455
11521
  var _this4 = this;
11456
11522
  var loggerSource = "getSwapInfo";
11457
- return Promise.resolve(_catch$3(function () {
11523
+ return Promise.resolve(_catch$4(function () {
11458
11524
  if (amountIsToReceive) throw new Error("Swapspace doesn't support exchanging to get the exact receiving amount");
11459
- if (!(fromCoin instanceof Coin) || !(toCoin instanceof Coin) || typeof amountCoins !== "string" || bignumber_js.BigNumber(amountCoins).lt("0") || fixed !== null && typeof fixed !== "boolean") {
11525
+ if (!(fromCoin instanceof Coin) || !(toCoin instanceof Coin) || typeof amountCoins !== "string" || BigNumber.BigNumber(amountCoins).lt("0") || fixed !== null && typeof fixed !== "boolean") {
11460
11526
  throw new Error("Wrong input params: " + amountCoins + " " + fromCoin.ticker + " -> " + toCoin.ticker + ", " + (fromCoin instanceof Coin) + ", " + (toCoin instanceof Coin) + ", " + typeof fixed + " " + fixed);
11461
11527
  }
11462
11528
  return Promise.resolve(_this4._fetchSupportedCurrenciesIfNeeded()).then(function () {
@@ -11480,7 +11546,7 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
11480
11546
  if (_exit) return _result;
11481
11547
  var result = {
11482
11548
  result: false,
11483
- reason: smallestMin && bignumber_js.BigNumber(amountCoins).lt(smallestMin) ? SwapProvider.NO_SWAPS_REASONS.TOO_LOW : greatestMax && bignumber_js.BigNumber(amountCoins).gt(greatestMax) ? SwapProvider.NO_SWAPS_REASONS.TOO_HIGH : SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED,
11549
+ reason: smallestMin && BigNumber.BigNumber(amountCoins).lt(smallestMin) ? SwapProvider.NO_SWAPS_REASONS.TOO_LOW : greatestMax && BigNumber.BigNumber(amountCoins).gt(greatestMax) ? SwapProvider.NO_SWAPS_REASONS.TOO_HIGH : SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED,
11484
11550
  smallestMin: smallestMin,
11485
11551
  greatestMax: greatestMax
11486
11552
  };
@@ -11521,31 +11587,31 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
11521
11587
  // min=0 or max=0 means there is no limit for the partner
11522
11588
  var smallestMin = null;
11523
11589
  if (exchangesSupportingThePair.find(function (ex) {
11524
- return bignumber_js.BigNumber(ex.min).isZero();
11590
+ return BigNumber.BigNumber(ex.min).isZero();
11525
11591
  }) == null) {
11526
11592
  smallestMin = exchangesSupportingThePair.reduce(function (prev, cur) {
11527
- if (typeof cur.min === "number" && (prev === null || bignumber_js.BigNumber(cur.min).lt(prev))) return bignumber_js.BigNumber(cur.min);
11593
+ if (typeof cur.min === "number" && (prev === null || BigNumber.BigNumber(cur.min).lt(prev))) return BigNumber.BigNumber(cur.min);
11528
11594
  return prev;
11529
11595
  }, null);
11530
11596
  }
11531
11597
  var greatestMax = null;
11532
11598
  if (exchangesSupportingThePair.find(function (ex) {
11533
- return bignumber_js.BigNumber(ex.max).isZero();
11599
+ return BigNumber.BigNumber(ex.max).isZero();
11534
11600
  }) == null) {
11535
11601
  greatestMax = exchangesSupportingThePair.reduce(function (prev, cur) {
11536
- if (typeof cur.max === "number" && (prev === null || bignumber_js.BigNumber(cur.max).gt(prev))) return bignumber_js.BigNumber(cur.max);
11602
+ if (typeof cur.max === "number" && (prev === null || BigNumber.BigNumber(cur.max).gt(prev))) return BigNumber.BigNumber(cur.max);
11537
11603
  return prev;
11538
11604
  }, null);
11539
11605
  }
11540
11606
  var extraCoinsToFitMinMax = "0";
11541
- if (typeof fromCoinToUsdRate === "string" && bignumber_js.BigNumber(fromCoinToUsdRate).gt("0")) {
11542
- var extraUsdToFitMinMax = bignumber_js.BigNumber("1"); // We correct the limits as the exact limit can fluctuate and cause failed swap creation
11607
+ if (typeof fromCoinToUsdRate === "string" && BigNumber.BigNumber(fromCoinToUsdRate).gt("0")) {
11608
+ var extraUsdToFitMinMax = BigNumber.BigNumber("1"); // We correct the limits as the exact limit can fluctuate and cause failed swap creation
11543
11609
  extraCoinsToFitMinMax = AmountUtils.trim(extraUsdToFitMinMax.div(fromCoinToUsdRate), fromCoin.digits);
11544
11610
  }
11545
- if (smallestMin instanceof bignumber_js.BigNumber) {
11611
+ if (smallestMin instanceof BigNumber.BigNumber) {
11546
11612
  smallestMin = AmountUtils.trim(smallestMin.plus(extraCoinsToFitMinMax), fromCoin.digits);
11547
11613
  }
11548
- if (greatestMax instanceof bignumber_js.BigNumber) {
11614
+ if (greatestMax instanceof BigNumber.BigNumber) {
11549
11615
  if (greatestMax > extraCoinsToFitMinMax) {
11550
11616
  greatestMax = AmountUtils.trim(greatestMax.minus(extraCoinsToFitMinMax), fromCoin.digits);
11551
11617
  } else {
@@ -11563,14 +11629,14 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
11563
11629
  var min = null;
11564
11630
  if (extraCoinsToFitMinMax != null) {
11565
11631
  if (typeof bestOpt.max === "number" && bestOpt.max !== 0) {
11566
- max = bignumber_js.BigNumber(bestOpt.max).minus(extraCoinsToFitMinMax);
11632
+ max = BigNumber.BigNumber(bestOpt.max).minus(extraCoinsToFitMinMax);
11567
11633
  max = AmountUtils.trim(max.lt(0) ? "0" : max, fromCoin.digits);
11568
11634
  }
11569
11635
  if (typeof bestOpt.min === "number" && bestOpt.min !== 0) {
11570
- min = AmountUtils.trim(bignumber_js.BigNumber(bestOpt.min).plus(extraCoinsToFitMinMax), fromCoin.digits);
11636
+ min = AmountUtils.trim(BigNumber.BigNumber(bestOpt.min).plus(extraCoinsToFitMinMax), fromCoin.digits);
11571
11637
  }
11572
11638
  }
11573
- var rate = bestOpt.toAmount && bestOpt.fromAmount ? bignumber_js.BigNumber(bestOpt.toAmount).div(bestOpt.fromAmount) : null;
11639
+ var rate = bestOpt.toAmount && bestOpt.fromAmount ? BigNumber.BigNumber(bestOpt.toAmount).div(bestOpt.fromAmount) : null;
11574
11640
  return Promise.resolve(_this4._fetchPartnersListIfNeeded()).then(function () {
11575
11641
  var _bestOpt$duration;
11576
11642
  var partner = _this4._partners.find(function (p) {
@@ -11617,7 +11683,7 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
11617
11683
  return Promise.reject(e);
11618
11684
  }
11619
11685
  };
11620
- _proto.createSwap = function createSwap(fromCoin, toCoin, amount, toAddress, refundAddress, rawSwapData, clientIpAddress, fixed, toCurrencyExtraId, refundExtraId, amountIsToReceive) {
11686
+ _proto.createSwap = function createSwap(fromCoin, toCoin, amount, toAddress, refundAddress, proprietarySwapEstimationData, clientIpAddress, fixed, toCurrencyExtraId, refundExtraId, amountIsToReceive) {
11621
11687
  if (toCurrencyExtraId === void 0) {
11622
11688
  toCurrencyExtraId = "";
11623
11689
  }
@@ -11630,36 +11696,40 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
11630
11696
  try {
11631
11697
  var _this5 = this;
11632
11698
  var loggerSource = "createSwap";
11633
- var partner = rawSwapData == null ? void 0 : rawSwapData.partner;
11634
- return Promise.resolve(_catch$3(function () {
11699
+ var partner = proprietarySwapEstimationData == null ? void 0 : proprietarySwapEstimationData.partner;
11700
+ return Promise.resolve(_catch$4(function () {
11635
11701
  if (amountIsToReceive) throw new Error("Swapspace doesn't support exchanging to get the exact receiving amount");
11636
11702
  if (!(fromCoin instanceof Coin) || !(toCoin instanceof Coin) || typeof amount !== "string" || typeof toAddress !== "string" || typeof refundAddress !== "string" || typeof clientIpAddress != "string" || typeof fixed != "boolean" || clientIpAddress.length === 0) {
11637
11703
  throw new Error("Invalid input: " + fromCoin + " " + toCoin + " " + amount + " " + toAddress + " " + refundAddress + " " + (clientIpAddress == null ? void 0 : clientIpAddress.length) + " " + fixed);
11638
11704
  }
11639
- if (typeof partner !== "string" || typeof (rawSwapData == null ? void 0 : rawSwapData.fromCurrency) !== "string" || typeof (rawSwapData == null ? void 0 : rawSwapData.fromNetwork) !== "string" || typeof (rawSwapData == null ? void 0 : rawSwapData.toCurrency) !== "string" || typeof (rawSwapData == null ? void 0 : rawSwapData.toNetwork) !== "string" || typeof (rawSwapData == null ? void 0 : rawSwapData.id) !== "string" // can be just empty
11640
- ) {
11641
- throw new Error("Invalid raw swap data: " + safeStringify(rawSwapData));
11705
+ var rateId = proprietarySwapEstimationData == null ? void 0 : proprietarySwapEstimationData.id;
11706
+ if (typeof partner !== "string" || typeof rateId !== "string") {
11707
+ throw new Error("Invalid raw swap data: " + safeStringify(proprietarySwapEstimationData));
11642
11708
  }
11643
11709
  return Promise.resolve(_this5._fetchSupportedCurrenciesIfNeeded()).then(function () {
11644
11710
  var _toCurrencyExtraId, _refundExtraId;
11645
- var _this5$_supportedCoin = _this5._supportedCoins.reduce(function (prev, coinData) {
11646
- return [coinData.coin.ticker === fromCoin.ticker ? coinData.hasExtraId : prev[0], coinData.coin.ticker === toCoin.ticker ? coinData.hasExtraId : prev[1]];
11647
- }, [false, false]),
11648
- fromCurrencyHasExtraId = _this5$_supportedCoin[0],
11649
- toCurrencyHasExtraId = _this5$_supportedCoin[1];
11711
+ var _map = [fromCoin.ticker, toCoin.ticker].map(function (t) {
11712
+ return _this5._supportedCoins.find(function (coinData) {
11713
+ return coinData.coin.ticker === t;
11714
+ });
11715
+ }),
11716
+ fromCoinData = _map[0],
11717
+ toCoinData = _map[1];
11718
+ var fromCurrencyHasExtraId = !!fromCoinData.hasExtraId,
11719
+ toCurrencyHasExtraId = !!toCoinData.hasExtraId;
11650
11720
  var requestData = {
11651
11721
  partner: partner,
11652
- fromCurrency: rawSwapData == null ? void 0 : rawSwapData.fromCurrency,
11653
- fromNetwork: rawSwapData == null ? void 0 : rawSwapData.fromNetwork,
11654
- toCurrency: rawSwapData == null ? void 0 : rawSwapData.toCurrency,
11655
- toNetwork: rawSwapData == null ? void 0 : rawSwapData.toNetwork,
11722
+ fromCurrency: fromCoinData.code,
11723
+ fromNetwork: fromCoinData.network,
11724
+ toCurrency: toCoinData.code,
11725
+ toNetwork: toCoinData.network,
11656
11726
  address: toAddress,
11657
11727
  amount: amount,
11658
11728
  fixed: fixed,
11659
11729
  extraId: toCurrencyHasExtraId ? (_toCurrencyExtraId = toCurrencyExtraId) != null ? _toCurrencyExtraId : "" : "",
11660
11730
  // This param is not documented. But the refund is usually manual so this is not critical.
11661
11731
  refundExtraId: fromCurrencyHasExtraId ? (_refundExtraId = refundExtraId) != null ? _refundExtraId : "" : "",
11662
- rateId: rawSwapData == null ? void 0 : rawSwapData.id,
11732
+ rateId: rateId,
11663
11733
  userIp: clientIpAddress,
11664
11734
  refund: refundAddress
11665
11735
  };
@@ -11675,11 +11745,11 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
11675
11745
  /* We use the returned rate preferably but if the retrieved
11676
11746
  * rate 0/null/undefined we calculate it manually */
11677
11747
  var rate = result.rate;
11678
- if (typeof rate !== "number" || bignumber_js.BigNumber(rate).isZero()) {
11748
+ if (typeof rate !== "number" || BigNumber.BigNumber(rate).isZero()) {
11679
11749
  var _result$to3, _result$from3;
11680
- rate = bignumber_js.BigNumber(result == null || (_result$to3 = result.to) == null ? void 0 : _result$to3.amount).div(result == null || (_result$from3 = result.from) == null ? void 0 : _result$from3.amount);
11750
+ rate = BigNumber.BigNumber(result == null || (_result$to3 = result.to) == null ? void 0 : _result$to3.amount).div(result == null || (_result$from3 = result.from) == null ? void 0 : _result$from3.amount);
11681
11751
  } else {
11682
- rate = bignumber_js.BigNumber(rate);
11752
+ rate = BigNumber.BigNumber(rate);
11683
11753
  }
11684
11754
  return {
11685
11755
  result: true,
@@ -11762,15 +11832,15 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
11762
11832
  try {
11763
11833
  var _this6 = this;
11764
11834
  var loggerSource = "getExistingSwapsDetailsAndStatus";
11765
- return Promise.resolve(_catch$3(function () {
11835
+ return Promise.resolve(_catch$4(function () {
11766
11836
  if (swapIds.find(function (id) {
11767
11837
  return typeof id !== "string";
11768
11838
  })) {
11769
- throw new Error("Swap id is not string: " + safeStringify(swapIds));
11839
+ throw new Error("Swap id is not string: " + safeStringify(swapIds) + " " + _this6.id);
11770
11840
  }
11771
11841
  var getNotFailingOn404 = function getNotFailingOn404(swapId) {
11772
11842
  try {
11773
- return Promise.resolve(_catch$3(function () {
11843
+ return Promise.resolve(_catch$4(function () {
11774
11844
  return Promise.resolve(axios__default["default"].get(_this6._URL + "/api/v2/exchange/" + swapId, {
11775
11845
  headers: _this6._headers
11776
11846
  }));
@@ -11844,7 +11914,7 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
11844
11914
  _proto.getPartnersList = function getPartnersList() {
11845
11915
  try {
11846
11916
  var _this7 = this;
11847
- return Promise.resolve(_catch$3(function () {
11917
+ return Promise.resolve(_catch$4(function () {
11848
11918
  return Promise.resolve(_this7._fetchPartnersListIfNeeded()).then(function () {
11849
11919
  var swapspacePartners = _this7._partners.map(function (p) {
11850
11920
  var _p$image;
@@ -11863,7 +11933,7 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
11863
11933
  return SwapspaceSwapProvider;
11864
11934
  }(SwapProvider);
11865
11935
 
11866
- function _catch$2(body, recover) {
11936
+ function _catch$3(body, recover) {
11867
11937
  try {
11868
11938
  var result = body();
11869
11939
  } catch (e) {
@@ -11889,10 +11959,9 @@ var LetsExchangeSwapProvider = /*#__PURE__*/function (_SwapProvider) {
11889
11959
  if (apiKey === void 0) {
11890
11960
  apiKey = null;
11891
11961
  }
11892
- _this = _SwapProvider.call(this, "letsexchange", cache, customCoinBuilder, useRestrictedCoinsSet) || this;
11962
+ _this = _SwapProvider.call(this, "letsexchange", cache, customCoinBuilder, useRestrictedCoinsSet, false, true) || this;
11893
11963
  _this._partners = [];
11894
11964
  _this._URL = apiKey ? "https://api.letsexchange.io/api" : apiKeysProxyUrl + "/" + _this.id;
11895
- _this.isAggregator = false;
11896
11965
  _this._headers = apiKey ? {
11897
11966
  Authorization: "Bearer " + apiKey,
11898
11967
  "Content-Type": "application/json",
@@ -11908,7 +11977,7 @@ var LetsExchangeSwapProvider = /*#__PURE__*/function (_SwapProvider) {
11908
11977
  try {
11909
11978
  var _this2 = this;
11910
11979
  var loggerSource = "_fetchSupportedCurrenciesIfNeeded";
11911
- return Promise.resolve(_catch$2(function () {
11980
+ return Promise.resolve(_catch$3(function () {
11912
11981
  var _temp = function () {
11913
11982
  if (_this2._shouldCoinsListBeLoaded()) {
11914
11983
  return Promise.resolve(axios__default["default"].get(_this2._URL + "/v2/coins", {
@@ -11955,7 +12024,7 @@ var LetsExchangeSwapProvider = /*#__PURE__*/function (_SwapProvider) {
11955
12024
  return Promise.reject(e);
11956
12025
  }
11957
12026
  };
11958
- _proto.getSwapInfo = function getSwapInfo(fromCoin, toCoin, amountCoins, fixed, fromCoinToUsdRate, amountIsToReceive) {
12027
+ _proto.getSwapInfo = function getSwapInfo(fromCoin, toCoin, amountCoins, fixed, fromCoinToUsdRate, amountIsToReceive, bannedPartners) {
11959
12028
  if (fixed === void 0) {
11960
12029
  fixed = false;
11961
12030
  }
@@ -11967,8 +12036,8 @@ var LetsExchangeSwapProvider = /*#__PURE__*/function (_SwapProvider) {
11967
12036
  var loggerSource = "getSwapInfo";
11968
12037
  var min = null;
11969
12038
  var max = null;
11970
- return Promise.resolve(_catch$2(function () {
11971
- if (!(fromCoin instanceof Coin) || !(toCoin instanceof Coin) || typeof amountCoins !== "string" || bignumber_js.BigNumber(amountCoins).lt("0") || fixed !== null && typeof fixed !== "boolean" || amountIsToReceive && !fixed) {
12039
+ return Promise.resolve(_catch$3(function () {
12040
+ if (!(fromCoin instanceof Coin) || !(toCoin instanceof Coin) || typeof amountCoins !== "string" || BigNumber.BigNumber(amountCoins).lt("0") || fixed !== null && typeof fixed !== "boolean" || amountIsToReceive && !fixed) {
11972
12041
  throw new Error("Wrong input params: " + amountCoins + " " + fromCoin.ticker + " -> " + toCoin.ticker + ", " + (fromCoin instanceof Coin) + ", " + (toCoin instanceof Coin) + ", " + typeof fixed + " " + fixed + ", " + amountIsToReceive);
11973
12042
  }
11974
12043
  return Promise.resolve(_this3._fetchSupportedCurrenciesIfNeeded()).then(function () {
@@ -12022,13 +12091,13 @@ var LetsExchangeSwapProvider = /*#__PURE__*/function (_SwapProvider) {
12022
12091
  // }
12023
12092
  throw new Error("Failed to estimate swap letsexchange");
12024
12093
  }
12025
- if (bignumber_js.BigNumber(data.rate).eq("0") || bignumber_js.BigNumber(data.amount).eq("0")) {
12094
+ if (BigNumber.BigNumber(data.rate).eq("0") || BigNumber.BigNumber(data.amount).eq("0")) {
12026
12095
  // TODO actualize according to letsexchage clarification - decide, can we count on min/max abcense? task_id=76512110797f4eab8b37f1bb789825cb
12027
12096
  // amount: "0", rate: "0", rate_id: ""
12028
12097
  var reason = SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED;
12029
- if (min && bignumber_js.BigNumber(amountCoins).lt(min)) {
12098
+ if (min && BigNumber.BigNumber(amountCoins).lt(min)) {
12030
12099
  reason = SwapProvider.NO_SWAPS_REASONS.TOO_LOW;
12031
- } else if (max && bignumber_js.BigNumber(amountCoins).gt(max)) {
12100
+ } else if (max && BigNumber.BigNumber(amountCoins).gt(max)) {
12032
12101
  reason = SwapProvider.NO_SWAPS_REASONS.TOO_HIGH;
12033
12102
  } else if (!amountIsToReceive) {
12034
12103
  // If we are not requesting receiving amount (it cannot be floating-rate)
@@ -12048,7 +12117,7 @@ var LetsExchangeSwapProvider = /*#__PURE__*/function (_SwapProvider) {
12048
12117
  greatestMax: max
12049
12118
  };
12050
12119
  }
12051
- var rate = amountIsToReceive ? bignumber_js.BigNumber(amountCoins).div(data.amount) : bignumber_js.BigNumber(data.amount).div(amountCoins);
12120
+ var rate = amountIsToReceive ? BigNumber.BigNumber(amountCoins).div(data.amount) : BigNumber.BigNumber(data.amount).div(amountCoins);
12052
12121
  return {
12053
12122
  result: true,
12054
12123
  min: min,
@@ -12086,7 +12155,7 @@ var LetsExchangeSwapProvider = /*#__PURE__*/function (_SwapProvider) {
12086
12155
  return Promise.reject(e);
12087
12156
  }
12088
12157
  };
12089
- _proto.createSwap = function createSwap(fromCoin, toCoin, amount, toAddress, refundAddress, rawSwapData, clientIpAddress, fixed, toCurrencyExtraId, refundExtraId, amountIsToReceive) {
12158
+ _proto.createSwap = function createSwap(fromCoin, toCoin, amount, toAddress, refundAddress, proprietarySwapEstimationData, clientIpAddress, fixed, toCurrencyExtraId, refundExtraId, amountIsToReceive) {
12090
12159
  if (toCurrencyExtraId === void 0) {
12091
12160
  toCurrencyExtraId = "";
12092
12161
  }
@@ -12099,12 +12168,12 @@ var LetsExchangeSwapProvider = /*#__PURE__*/function (_SwapProvider) {
12099
12168
  try {
12100
12169
  var _this4 = this;
12101
12170
  var loggerSource = "createSwap";
12102
- return Promise.resolve(_catch$2(function () {
12171
+ return Promise.resolve(_catch$3(function () {
12103
12172
  if (!(fromCoin instanceof Coin) || !(toCoin instanceof Coin) || typeof amount !== "string" || typeof toAddress !== "string" || typeof refundAddress !== "string" || typeof clientIpAddress != "string" || typeof fixed != "boolean") {
12104
12173
  throw new Error("Invalid input: " + fromCoin + " " + toCoin + " " + amount + " " + toAddress + " " + refundAddress + " " + fixed);
12105
12174
  }
12106
- if (typeof rawSwapData !== "object" || fixed && !rawSwapData.rate_id) {
12107
- throw new Error("Invalid raw swap data: " + safeStringify(rawSwapData));
12175
+ if (typeof proprietarySwapEstimationData !== "object" || fixed && !proprietarySwapEstimationData.rate_id) {
12176
+ throw new Error("Invalid raw swap data: " + safeStringify(proprietarySwapEstimationData));
12108
12177
  }
12109
12178
  return Promise.resolve(_this4._fetchSupportedCurrenciesIfNeeded()).then(function () {
12110
12179
  var fromCoinDetails = _this4._supportedCoins.find(function (i) {
@@ -12135,7 +12204,7 @@ var LetsExchangeSwapProvider = /*#__PURE__*/function (_SwapProvider) {
12135
12204
  requestBody.deposit_amount = amount;
12136
12205
  }
12137
12206
  if (fixed) {
12138
- requestBody.rate_id = rawSwapData.rate_id;
12207
+ requestBody.rate_id = proprietarySwapEstimationData.rate_id;
12139
12208
  }
12140
12209
  return Promise.resolve(axios__default["default"].post(_this4._URL + "/v1/transaction" + (amountIsToReceive ? "-revert" : "?float=" + !fixed), requestBody, {
12141
12210
  headers: _this4._headers
@@ -12144,7 +12213,7 @@ var LetsExchangeSwapProvider = /*#__PURE__*/function (_SwapProvider) {
12144
12213
  Logger.log("Creation result " + safeStringify(result), loggerSource);
12145
12214
  if (result != null && result.transaction_id) {
12146
12215
  var _result$rate, _result$deposit_extra;
12147
- var rate = bignumber_js.BigNumber((_result$rate = result.rate) != null ? _result$rate : 0).isZero() ? bignumber_js.BigNumber(result.withdrawal_amount).div(result.deposit_amount) : bignumber_js.BigNumber(result.rate);
12216
+ var rate = BigNumber.BigNumber((_result$rate = result.rate) != null ? _result$rate : 0).isZero() ? BigNumber.BigNumber(result.withdrawal_amount).div(result.deposit_amount) : BigNumber.BigNumber(result.rate);
12148
12217
  return {
12149
12218
  result: true,
12150
12219
  swapId: result.transaction_id,
@@ -12192,11 +12261,11 @@ var LetsExchangeSwapProvider = /*#__PURE__*/function (_SwapProvider) {
12192
12261
  try {
12193
12262
  var _this5 = this;
12194
12263
  var loggerSource = "getExistingSwapsDetailsAndStatus";
12195
- return Promise.resolve(_catch$2(function () {
12264
+ return Promise.resolve(_catch$3(function () {
12196
12265
  if (swapIds.find(function (id) {
12197
12266
  return typeof id !== "string";
12198
12267
  })) {
12199
- throw new Error("Swap id is not string: " + safeStringify(swapIds));
12268
+ throw new Error("Swap id is not string: " + safeStringify(swapIds) + " " + _this5.id);
12200
12269
  }
12201
12270
  return Promise.resolve(axios__default["default"].get(_this5._URL + "/v1/transactions-list?ids[]=" + swapIds.join("&ids[]="), {
12202
12271
  headers: _this5._headers
@@ -12223,7 +12292,7 @@ var LetsExchangeSwapProvider = /*#__PURE__*/function (_SwapProvider) {
12223
12292
  var toDigits = status === SwapProvider.SWAP_STATUSES.REFUNDED ? fromCoin.digits : toCoin.digits;
12224
12293
  var deposit = swap.real_deposit_amount && swap.real_deposit_amount !== "" ? swap.real_deposit_amount : swap.deposit_amount;
12225
12294
  var withdrawal = swap.real_withdrawal_amount && swap.real_withdrawal_amount !== "" ? swap.real_withdrawal_amount : swap.withdrawal_amount;
12226
- var rate = bignumber_js.BigNumber(withdrawal).div(deposit).toFixed(_this5._maxRateDigits); // We don't use their rate as it excludes their fee
12295
+ var rate = BigNumber.BigNumber(withdrawal).div(deposit).toFixed(_this5._maxRateDigits); // We don't use their rate as it excludes their fee
12227
12296
  return new ExistingSwap(swapIds[index], status, createdAt, expiresAt, swap.confirmations, rate, swap.is_float != null ? !swap.is_float : false, swap["return"], swap.deposit, fromCoin, AmountUtils.trim(deposit, fromCoin.digits), swap.hash_in, swap.hash_in ? "" + swap.coin_from_explorer_url + swap.hash_in : null, toCoin, AmountUtils.trim(withdrawal, toDigits), swap.hash_out, swap.hash_out ? "" + swap.coin_to_explorer_url + swap.hash_out : null, swap.withdrawal, "letsexchange", (_swap$deposit_extra_i = swap.deposit_extra_id) != null ? _swap$deposit_extra_i : null, (_swap$withdrawal_extr = swap.withdrawal_extra_id) != null ? _swap$withdrawal_extr : null, (_swap$return_extra_id = swap.return_extra_id) != null ? _swap$return_extra_id : null);
12228
12297
  }).flat();
12229
12298
  Logger.log("Swap details result " + safeStringify(swaps), loggerSource);
@@ -12309,38 +12378,652 @@ var LetsExchangeSwapProvider = /*#__PURE__*/function (_SwapProvider) {
12309
12378
  }(SwapProvider);
12310
12379
  LetsExchangeSwapProvider.AFFILIATE_ID = "0zbj9hf7xg7jgdgv";
12311
12380
 
12312
- function _catch$1(body, recover) {
12313
- try {
12314
- var result = body();
12315
- } catch (e) {
12316
- return recover(e);
12317
- }
12318
- if (result && result.then) {
12319
- return result.then(void 0, recover);
12320
- }
12321
- return result;
12322
- }
12323
- var _iteratorSymbol = typeof Symbol !== "undefined" ? Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator")) : "@@iterator";
12324
- function _settle(pact, state, value) {
12381
+ function _settle$1(pact, state, value) {
12325
12382
  if (!pact.s) {
12326
- if (value instanceof _Pact) {
12383
+ if (value instanceof _Pact$1) {
12327
12384
  if (value.s) {
12328
12385
  if (state & 1) {
12329
12386
  state = value.s;
12330
12387
  }
12331
12388
  value = value.v;
12332
12389
  } else {
12333
- value.o = _settle.bind(null, pact, state);
12390
+ value.o = _settle$1.bind(null, pact, state);
12334
12391
  return;
12335
12392
  }
12336
12393
  }
12337
12394
  if (value && value.then) {
12338
- value.then(_settle.bind(null, pact, state), _settle.bind(null, pact, 2));
12395
+ value.then(_settle$1.bind(null, pact, state), _settle$1.bind(null, pact, 2));
12339
12396
  return;
12340
12397
  }
12341
12398
  pact.s = state;
12342
12399
  pact.v = value;
12343
- var observer = pact.o;
12400
+ const observer = pact.o;
12401
+ if (observer) {
12402
+ observer(pact);
12403
+ }
12404
+ }
12405
+ }
12406
+ var _Pact$1 = /*#__PURE__*/function () {
12407
+ function _Pact() {}
12408
+ _Pact.prototype.then = function (onFulfilled, onRejected) {
12409
+ var result = new _Pact();
12410
+ var state = this.s;
12411
+ if (state) {
12412
+ var callback = state & 1 ? onFulfilled : onRejected;
12413
+ if (callback) {
12414
+ try {
12415
+ _settle$1(result, 1, callback(this.v));
12416
+ } catch (e) {
12417
+ _settle$1(result, 2, e);
12418
+ }
12419
+ return result;
12420
+ } else {
12421
+ return this;
12422
+ }
12423
+ }
12424
+ this.o = function (_this) {
12425
+ try {
12426
+ var value = _this.v;
12427
+ if (_this.s & 1) {
12428
+ _settle$1(result, 1, onFulfilled ? onFulfilled(value) : value);
12429
+ } else if (onRejected) {
12430
+ _settle$1(result, 1, onRejected(value));
12431
+ } else {
12432
+ _settle$1(result, 2, value);
12433
+ }
12434
+ } catch (e) {
12435
+ _settle$1(result, 2, e);
12436
+ }
12437
+ };
12438
+ return result;
12439
+ };
12440
+ return _Pact;
12441
+ }();
12442
+ function _isSettledPact$1(thenable) {
12443
+ return thenable instanceof _Pact$1 && thenable.s & 1;
12444
+ }
12445
+ function _for(test, update, body) {
12446
+ var stage;
12447
+ for (;;) {
12448
+ var shouldContinue = test();
12449
+ if (_isSettledPact$1(shouldContinue)) {
12450
+ shouldContinue = shouldContinue.v;
12451
+ }
12452
+ if (!shouldContinue) {
12453
+ return result;
12454
+ }
12455
+ if (shouldContinue.then) {
12456
+ stage = 0;
12457
+ break;
12458
+ }
12459
+ var result = body();
12460
+ if (result && result.then) {
12461
+ if (_isSettledPact$1(result)) {
12462
+ result = result.s;
12463
+ } else {
12464
+ stage = 1;
12465
+ break;
12466
+ }
12467
+ }
12468
+ if (update) {
12469
+ var updateValue = update();
12470
+ if (updateValue && updateValue.then && !_isSettledPact$1(updateValue)) {
12471
+ stage = 2;
12472
+ break;
12473
+ }
12474
+ }
12475
+ }
12476
+ var pact = new _Pact$1();
12477
+ var reject = _settle$1.bind(null, pact, 2);
12478
+ (stage === 0 ? shouldContinue.then(_resumeAfterTest) : stage === 1 ? result.then(_resumeAfterBody) : updateValue.then(_resumeAfterUpdate)).then(void 0, reject);
12479
+ return pact;
12480
+ function _resumeAfterBody(value) {
12481
+ result = value;
12482
+ do {
12483
+ if (update) {
12484
+ updateValue = update();
12485
+ if (updateValue && updateValue.then && !_isSettledPact$1(updateValue)) {
12486
+ updateValue.then(_resumeAfterUpdate).then(void 0, reject);
12487
+ return;
12488
+ }
12489
+ }
12490
+ shouldContinue = test();
12491
+ if (!shouldContinue || _isSettledPact$1(shouldContinue) && !shouldContinue.v) {
12492
+ _settle$1(pact, 1, result);
12493
+ return;
12494
+ }
12495
+ if (shouldContinue.then) {
12496
+ shouldContinue.then(_resumeAfterTest).then(void 0, reject);
12497
+ return;
12498
+ }
12499
+ result = body();
12500
+ if (_isSettledPact$1(result)) {
12501
+ result = result.v;
12502
+ }
12503
+ } while (!result || !result.then);
12504
+ result.then(_resumeAfterBody).then(void 0, reject);
12505
+ }
12506
+ function _resumeAfterTest(shouldContinue) {
12507
+ if (shouldContinue) {
12508
+ result = body();
12509
+ if (result && result.then) {
12510
+ result.then(_resumeAfterBody).then(void 0, reject);
12511
+ } else {
12512
+ _resumeAfterBody(result);
12513
+ }
12514
+ } else {
12515
+ _settle$1(pact, 1, result);
12516
+ }
12517
+ }
12518
+ function _resumeAfterUpdate() {
12519
+ if (shouldContinue = test()) {
12520
+ if (shouldContinue.then) {
12521
+ shouldContinue.then(_resumeAfterTest).then(void 0, reject);
12522
+ } else {
12523
+ _resumeAfterTest(shouldContinue);
12524
+ }
12525
+ } else {
12526
+ _settle$1(pact, 1, result);
12527
+ }
12528
+ }
12529
+ }
12530
+ function _catch$2(body, recover) {
12531
+ try {
12532
+ var result = body();
12533
+ } catch (e) {
12534
+ return recover(e);
12535
+ }
12536
+ if (result && result.then) {
12537
+ return result.then(void 0, recover);
12538
+ }
12539
+ return result;
12540
+ }
12541
+ var ExolixSwapProvider = /*#__PURE__*/function (_SwapProvider) {
12542
+ _inheritsLoose(ExolixSwapProvider, _SwapProvider);
12543
+ function ExolixSwapProvider(apiKeysProxyUrl, cache, customCoinBuilder, useRestrictedCoinsSet, apiKey) {
12544
+ var _this;
12545
+ if (customCoinBuilder === void 0) {
12546
+ customCoinBuilder = function customCoinBuilder(coin, network) {
12547
+ return null;
12548
+ };
12549
+ }
12550
+ if (useRestrictedCoinsSet === void 0) {
12551
+ useRestrictedCoinsSet = true;
12552
+ }
12553
+ if (apiKey === void 0) {
12554
+ apiKey = "";
12555
+ }
12556
+ _this = _SwapProvider.call(this, "exolix", cache, customCoinBuilder, useRestrictedCoinsSet, false, true) || this;
12557
+ _this.axiosGetPreset = {
12558
+ headers: _this.headers,
12559
+ validateStatus: function validateStatus(responseCode) {
12560
+ return [200, 201, 404].find(function (code) {
12561
+ return code === responseCode;
12562
+ });
12563
+ }
12564
+ };
12565
+ _this._partners = [];
12566
+ _this._URL = apiKey ? "https://exolix.com/api/v2" : apiKeysProxyUrl + "/" + _this.id;
12567
+ _this.COINS_EXPIRATION_TIME_MS = 5 * 60 * 1000;
12568
+ _this.coinsLastUpdateTimestamp = null;
12569
+ _this.headers = apiKey ? {
12570
+ Authorization: "Bearer " + apiKey
12571
+ } : {};
12572
+ return _this;
12573
+ }
12574
+ var _proto = ExolixSwapProvider.prototype;
12575
+ _proto.getSwapCreationInfoTtlMs = function getSwapCreationInfoTtlMs() {
12576
+ return 110000;
12577
+ };
12578
+ _proto._fetchSupportedCurrenciesIfNeeded = function _fetchSupportedCurrenciesIfNeeded() {
12579
+ try {
12580
+ var _exit;
12581
+ var _this2 = this;
12582
+ var loggerSource = "_fetchSupportedCurrenciesIfNeeded";
12583
+ var pageSize = 100;
12584
+ return Promise.resolve(_catch$2(function () {
12585
+ if (_this2._shouldCoinsListBeLoaded()) {
12586
+ var _temp2 = function _temp2(_result) {
12587
+ if (_exit) return _result;
12588
+ _this2._supportedCoins = _allCoins.map(function (item) {
12589
+ var code = item.code.toUpperCase();
12590
+ if (!Array.isArray(item.networks)) return [];
12591
+ return item.networks.map(function (networkDetails) {
12592
+ var network = networkDetails.network;
12593
+ var networkShortAdaptive = networkDetails.shortName === "" || !(networkDetails != null && networkDetails.shortName) ? networkDetails.network : networkDetails.shortName;
12594
+ var coin = _this2._customCoinBuilder != null ? _this2._customCoinBuilder(code, code !== network ? networkShortAdaptive : "") : null;
12595
+ if (!coin && !_this2.useRestrictedCoinsSet) {
12596
+ var name = item.name;
12597
+ var ticker = toRabbitTicker(code, code === network ? "" : networkShortAdaptive);
12598
+ var defaultDecimalPlacesForCoinNotSupportedOOB = DEFAULT_CRYPTO_DECIMAL_COUNT;
12599
+ var defaultMinConfirmationsForCoinNotSupportedOOB = 1;
12600
+ coin = new Coin(name, ticker, code, defaultDecimalPlacesForCoinNotSupportedOOB, null, "", null, null, defaultMinConfirmationsForCoinNotSupportedOOB, null, [], 60000, null, code !== network ? new Protocol(networkShortAdaptive) : null, null, false);
12601
+ }
12602
+ if (coin) {
12603
+ var _networkDetails$memoN, _networkDetails$addre;
12604
+ return new SwapProviderCoinInfo(coin, item.code, network, !!networkDetails.memoNeeded, (_networkDetails$memoN = networkDetails.memoName) != null ? _networkDetails$memoN : null, 0, item.icon ? item.icon : FALLBACK_ASSET_ICON_URL, true, true, (_networkDetails$addre = networkDetails.addressRegex) != null ? _networkDetails$addre : null, true);
12605
+ }
12606
+ return [];
12607
+ });
12608
+ }).flat();
12609
+ _this2._supportedCoinsLastUpdateTimestamp = Date.now();
12610
+ _this2._putPopularCoinsFirst();
12611
+ return Promise.resolve(_SwapProvider.prototype._fetchSupportedCurrenciesIfNeeded.call(_this2)).then(function () {});
12612
+ };
12613
+ var _interrupt;
12614
+ var page = 1;
12615
+ var _allCoins = [];
12616
+ var _temp = _for(function () {
12617
+ return !(_interrupt || _exit);
12618
+ }, void 0, function () {
12619
+ return Promise.resolve(axios__default["default"].get(_this2._URL + "/currencies", _extends({}, _this2.axiosGetPreset, {
12620
+ params: {
12621
+ withNetworks: true,
12622
+ page: page,
12623
+ size: pageSize
12624
+ }
12625
+ }))).then(function (responseRaw) {
12626
+ var response = responseRaw == null ? void 0 : responseRaw.data;
12627
+
12628
+ // Validating the response
12629
+ if (responseRaw.status !== 200 || !response || typeof (response == null ? void 0 : response.data) !== "object" || typeof (response == null ? void 0 : response.count) !== "number" || (response == null ? void 0 : response.count) < 1 || (response == null ? void 0 : response.count) > 1000 || typeof (response == null ? void 0 : response.errors) === "object") {
12630
+ var errorMessages = response != null && response.errors ? ". Errors - " + Object.keys(response == null ? void 0 : response.errors).map(function (errorCode) {
12631
+ return errorCode + ": " + (response == null ? void 0 : response.errors[errorCode]);
12632
+ }).join(", ") : "";
12633
+ throw new Error("Failed to load the currencies list for Exolix" + errorMessages);
12634
+ }
12635
+ _allCoins.push.apply(_allCoins, response.data);
12636
+ if (page >= Math.floor(response.count / pageSize)) {
12637
+ _interrupt = 1;
12638
+ return;
12639
+ }
12640
+ page++;
12641
+ });
12642
+ });
12643
+ return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
12644
+ }
12645
+ }, function (e) {
12646
+ improveAndRethrow(e, loggerSource);
12647
+ }));
12648
+ } catch (e) {
12649
+ return Promise.reject(e);
12650
+ }
12651
+ };
12652
+ _proto.getSwapInfo = function getSwapInfo(fromCoin, toCoin, amountCoins, fixed, fromCoinToUsdRate, amountIsToReceive, bannedPartners) {
12653
+ if (fixed === void 0) {
12654
+ fixed = false;
12655
+ }
12656
+ if (amountIsToReceive === void 0) {
12657
+ amountIsToReceive = false;
12658
+ }
12659
+ try {
12660
+ var _this3 = this;
12661
+ var loggerSource = "getSwapInfo";
12662
+ var validateAndProcessLimits = function validateAndProcessLimits(fromAmount, toAmount, fromCoin, toCoin, amountCoins, amountIsToReceive, minAmount, maxAmount, rate, status) {
12663
+ var min;
12664
+ var max;
12665
+ var returnObject;
12666
+ if (typeof minAmount === "number" && minAmount > 0) min = AmountUtils.trim(minAmount, amountIsToReceive ? toCoin.digits : fromCoin.digits);
12667
+ if (typeof maxAmount === "number" && maxAmount > 0) max = AmountUtils.trim(maxAmount, amountIsToReceive ? toCoin.digits : fromCoin.digits);
12668
+ if (status !== 200 || typeof fromAmount !== "number" || typeof toAmount !== "number" || typeof minAmount !== "number" || typeof maxAmount !== "number" || BigNumber__default["default"](rate).lte("0") || BigNumber__default["default"](fromAmount).lte("0") || BigNumber__default["default"](toAmount).lte("0")) {
12669
+ var reason = SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED;
12670
+ if (min && BigNumber__default["default"](amountCoins).lt(min)) {
12671
+ reason = SwapProvider.NO_SWAPS_REASONS.TOO_LOW;
12672
+ } else if (max && BigNumber__default["default"](amountCoins).gt(max)) {
12673
+ reason = SwapProvider.NO_SWAPS_REASONS.TOO_HIGH;
12674
+ }
12675
+ returnObject = {
12676
+ result: false,
12677
+ reason: reason,
12678
+ smallestMin: min,
12679
+ greatestMax: max
12680
+ };
12681
+ }
12682
+ return [returnObject, min, max];
12683
+ };
12684
+ return Promise.resolve(_catch$2(function () {
12685
+ if (!(fromCoin instanceof Coin) || !(toCoin instanceof Coin) || typeof amountCoins !== "string" || BigNumber__default["default"](amountCoins).lt("0") || fixed !== null && typeof fixed !== "boolean") {
12686
+ throw new Error("Wrong input params: " + amountCoins + " " + fromCoin.ticker + " -> " + toCoin.ticker + ", " + (fromCoin instanceof Coin) + ", " + (toCoin instanceof Coin) + ", " + typeof fixed + " " + fixed + ", " + amountIsToReceive);
12687
+ }
12688
+ var fromCoinDetails = _this3._supportedCoins.find(function (i) {
12689
+ var _i$coin;
12690
+ return ((_i$coin = i.coin) == null ? void 0 : _i$coin.ticker) === (fromCoin == null ? void 0 : fromCoin.ticker);
12691
+ });
12692
+ var toCoinDetails = _this3._supportedCoins.find(function (i) {
12693
+ var _i$coin2;
12694
+ return ((_i$coin2 = i.coin) == null ? void 0 : _i$coin2.ticker) === (toCoin == null ? void 0 : toCoin.ticker);
12695
+ });
12696
+ return !fromCoinDetails || !toCoinDetails || !fromCoinDetails.deposit || !fromCoinDetails.isAvailable || !toCoinDetails.withdrawal || !toCoinDetails.isAvailable ? {
12697
+ result: false,
12698
+ reason: SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED
12699
+ } : Promise.resolve(axios__default["default"].get(_this3._URL + "/rate", _extends({}, _this3.axiosGetPreset, {
12700
+ params: {
12701
+ coinFrom: fromCoinDetails.code,
12702
+ networkFrom: fromCoinDetails.network,
12703
+ coinTo: toCoinDetails.code,
12704
+ networkTo: toCoinDetails.network,
12705
+ amount: amountIsToReceive ? undefined : amountCoins,
12706
+ withdrawalAmount: amountIsToReceive ? amountCoins : undefined,
12707
+ rateType: fixed ? "fixed" : "float"
12708
+ }
12709
+ }))).then(function (response) {
12710
+ Logger.log("Retrieved " + (response == null ? void 0 : response.data), loggerSource);
12711
+ if (typeof (response == null ? void 0 : response.data) !== "object") {
12712
+ Logger.log("Swap response didn't include the data object " + safeStringify(e), loggerSource);
12713
+ return {
12714
+ result: false,
12715
+ reason: SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED
12716
+ };
12717
+ }
12718
+ var data = response == null ? void 0 : response.data;
12719
+ var _validateAndProcessLi = validateAndProcessLimits(data == null ? void 0 : data.fromAmount, data == null ? void 0 : data.toAmount, fromCoin, toCoin, amountCoins, amountIsToReceive, data == null ? void 0 : data.minAmount, data == null ? void 0 : data.maxAmount, data == null ? void 0 : data.rate, response == null ? void 0 : response.status),
12720
+ returnObject = _validateAndProcessLi[0],
12721
+ min = _validateAndProcessLi[1],
12722
+ max = _validateAndProcessLi[2];
12723
+ if (returnObject) return returnObject;
12724
+ if (min && max & BigNumber__default["default"](max).lt(min)) {
12725
+ Logger.log("Exolix swap info failed, max limit is below the min one. " + safeStringify(response), loggerSource);
12726
+ return {
12727
+ result: false,
12728
+ reason: SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED
12729
+ };
12730
+ }
12731
+ var rate = amountIsToReceive ? BigNumber__default["default"](amountCoins).div(data.fromAmount) : BigNumber__default["default"](data.toAmount).div(amountCoins);
12732
+ return {
12733
+ result: true,
12734
+ min: min != null ? min : null,
12735
+ max: max != null ? max : null,
12736
+ smallestMin: min != null ? min : null,
12737
+ greatestMax: max != null ? max : null,
12738
+ rate: AmountUtils.trim(rate, _this3._maxRateDigits),
12739
+ durationMinutesRange: null,
12740
+ fixed: fixed,
12741
+ rawSwapData: data,
12742
+ isRefundAddressRequired: false
12743
+ };
12744
+ });
12745
+ }, function (e) {
12746
+ var _e$response, _e$response2, _e$response3, _e$response4, _e$response5, _e$response6;
12747
+ var status = e == null || (_e$response = e.response) == null ? void 0 : _e$response.status;
12748
+ var data = e == null || (_e$response2 = e.response) == null ? void 0 : _e$response2.data;
12749
+ if (status === 429) {
12750
+ return {
12751
+ result: false,
12752
+ reason: SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
12753
+ };
12754
+ }
12755
+ var _validateAndProcessLi2 = validateAndProcessLimits(data == null ? void 0 : data.fromAmount, data == null ? void 0 : data.toAmount, fromCoin, toCoin, amountCoins, amountIsToReceive, data == null ? void 0 : data.minAmount, data == null ? void 0 : data.maxAmount, data == null ? void 0 : data.rate, e == null || (_e$response3 = e.response) == null ? void 0 : _e$response3.status),
12756
+ returnObject = _validateAndProcessLi2[0],
12757
+ min = _validateAndProcessLi2[1],
12758
+ max = _validateAndProcessLi2[2];
12759
+ if (returnObject) return returnObject;
12760
+ if ((e == null || (_e$response4 = e.response) == null ? void 0 : _e$response4.status) === 400 || e != null && (_e$response5 = e.response) != null && (_e$response5 = _e$response5.data) != null && _e$response5.error || e != null && (_e$response6 = e.response) != null && (_e$response6 = _e$response6.data) != null && _e$response6.errors) {
12761
+ var _e$response7, _e$response8, _e$response10;
12762
+ var errorMessages = e != null && (_e$response7 = e.response) != null && (_e$response7 = _e$response7.data) != null && _e$response7.errors ? ". Errors - " + Object.keys(e == null || (_e$response8 = e.response) == null || (_e$response8 = _e$response8.data) == null ? void 0 : _e$response8.errors).map(function (errorCode) {
12763
+ var _e$response9;
12764
+ return errorCode + ": " + (e == null || (_e$response9 = e.response) == null || (_e$response9 = _e$response9.data) == null ? void 0 : _e$response9.errors[errorCode]);
12765
+ }).join(", ") : "";
12766
+ Logger.log("Failed to estimate swap for Exolix (" + (e == null || (_e$response10 = e.response) == null ? void 0 : _e$response10.status) + ")" + errorMessages + (" " + safeStringify(e)), loggerSource);
12767
+ } else {
12768
+ Logger.log("Internal error when getting swap options " + safeStringify(e), loggerSource);
12769
+ }
12770
+ improveAndRethrow(e, loggerSource);
12771
+ }));
12772
+ } catch (e) {
12773
+ return Promise.reject(e);
12774
+ }
12775
+ };
12776
+ _proto.createSwap = function createSwap(fromCoin, toCoin, amount, toAddress, refundAddress, proprietarySwapEstimationData, clientIpAddress, fixed, toCurrencyExtraId, refundExtraId, amountIsToReceive) {
12777
+ if (toCurrencyExtraId === void 0) {
12778
+ toCurrencyExtraId = "";
12779
+ }
12780
+ if (refundExtraId === void 0) {
12781
+ refundExtraId = "";
12782
+ }
12783
+ if (amountIsToReceive === void 0) {
12784
+ amountIsToReceive = false;
12785
+ }
12786
+ try {
12787
+ var _this4 = this;
12788
+ var loggerSource = "createSwap";
12789
+ return Promise.resolve(_catch$2(function () {
12790
+ if (!(fromCoin instanceof Coin) || !(toCoin instanceof Coin) || typeof amount !== "string" || typeof toAddress !== "string" || typeof refundAddress !== "string" || typeof fixed != "boolean") {
12791
+ throw new Error("Invalid input: " + fromCoin + " " + toCoin + " " + amount + " " + toAddress + " " + refundAddress + " " + fixed);
12792
+ }
12793
+ return Promise.resolve(_this4._fetchSupportedCurrenciesIfNeeded()).then(function () {
12794
+ var _toCurrencyExtraId, _refundExtraId;
12795
+ var fromCoinExtended = _this4._supportedCoins.find(function (item) {
12796
+ return item.coin.ticker == fromCoin.ticker;
12797
+ });
12798
+ var toCoinExtended = _this4._supportedCoins.find(function (item) {
12799
+ return item.coin.ticker == toCoin.ticker;
12800
+ });
12801
+ if (!fromCoinExtended || !toCoinExtended) {
12802
+ throw new Error("Failed to find coin details for: " + fromCoin.ticker + " -> " + toCoin.ticker);
12803
+ }
12804
+ var fromCurrencyHasExtraId = fromCoinExtended.hasExtraId;
12805
+ var toCurrencyHasExtraId = toCoinExtended.hasExtraId;
12806
+ var requestData = {
12807
+ coinFrom: fromCoinExtended.code,
12808
+ networkFrom: fromCoinExtended.network,
12809
+ coinTo: toCoinExtended.code,
12810
+ networkTo: toCoinExtended.network,
12811
+ amount: amountIsToReceive ? undefined : amount,
12812
+ withdrawalAmount: amountIsToReceive ? amount : undefined,
12813
+ withdrawalAddress: toAddress,
12814
+ withdrawalExtraId: toCurrencyHasExtraId ? (_toCurrencyExtraId = toCurrencyExtraId) != null ? _toCurrencyExtraId : "" : "",
12815
+ refundAddress: refundAddress,
12816
+ refundExtraId: fromCurrencyHasExtraId ? (_refundExtraId = refundExtraId) != null ? _refundExtraId : "" : "",
12817
+ rateType: fixed ? "fixed" : "float"
12818
+ };
12819
+ Logger.log("Sending create request: " + safeStringify(requestData), loggerSource);
12820
+ return Promise.resolve(axios__default["default"].post(_this4._URL + "/transactions", requestData, _this4.axiosGetPreset)).then(function (response) {
12821
+ var _result$withdrawalExt;
12822
+ var result = response == null ? void 0 : response.data;
12823
+ Logger.log("Creation result " + safeStringify(result), loggerSource);
12824
+ if (!(result != null && result.id) || typeof (result == null ? void 0 : result.id) !== "string" || typeof (result == null ? void 0 : result.amount) !== "number" || typeof (result == null ? void 0 : result.amountTo) !== "number" || typeof (result == null ? void 0 : result.depositAddress) !== "string" || typeof (result == null ? void 0 : result.withdrawalAddress) !== "string" || !((result == null ? void 0 : result.rateType) === "fixed" || (result == null ? void 0 : result.rateType) === "float")) {
12825
+ var errorMessage;
12826
+ errorMessage = result != null && result.id ? "Swap was created but the data was incorrect: " + safeStringify(response) : "Swap creation failed, API response: " + safeStringify(response);
12827
+ Logger.log(errorMessage, loggerSource);
12828
+ throw new Error(errorMessage);
12829
+ }
12830
+ var rate;
12831
+ if (typeof rate !== "number" || BigNumber__default["default"](result == null ? void 0 : result.rate).isZero()) {
12832
+ rate = BigNumber__default["default"](result == null ? void 0 : result.amountTo).div(result == null ? void 0 : result.amount);
12833
+ } else {
12834
+ rate = BigNumber__default["default"](result == null ? void 0 : result.rate);
12835
+ }
12836
+ return {
12837
+ result: true,
12838
+ swapId: result == null ? void 0 : result.id,
12839
+ fromCoin: fromCoin,
12840
+ fromAmount: AmountUtils.trim(result == null ? void 0 : result.amount, fromCoin.digits),
12841
+ fromAddress: result == null ? void 0 : result.depositAddress,
12842
+ toCoin: toCoin,
12843
+ toAmount: AmountUtils.trim(result == null ? void 0 : result.amountTo, toCoin.digits),
12844
+ toAddress: result == null ? void 0 : result.withdrawalAddress,
12845
+ fromCurrencyExtraId: (_result$withdrawalExt = result == null ? void 0 : result.withdrawalExtraId) != null ? _result$withdrawalExt : "",
12846
+ rate: AmountUtils.trim(rate, _this4._maxRateDigits),
12847
+ fixed: (result == null ? void 0 : result.rateType) === "fixed"
12848
+ };
12849
+ });
12850
+ });
12851
+ }, function (e) {
12852
+ var _e$response11, _e$response12, _e$response13, _e$response14, _e$response15, _e$response17;
12853
+ var composeFailResult = function composeFailResult(reason) {
12854
+ return {
12855
+ result: false,
12856
+ reason: reason
12857
+ };
12858
+ };
12859
+ if ((e == null || (_e$response11 = e.response) == null ? void 0 : _e$response11.status) === 400 || e != null && (_e$response12 = e.response) != null && (_e$response12 = _e$response12.data) != null && (_e$response12 = _e$response12.message) != null && _e$response12.includes("Amount to exchange is higher") || e != null && (_e$response13 = e.response) != null && (_e$response13 = _e$response13.data) != null && (_e$response13 = _e$response13.message) != null && _e$response13.includes("Amount to exchange is below")) {
12860
+ return composeFailResult(SwapProvider.CREATION_FAIL_REASONS.RETRIABLE_FAIL);
12861
+ }
12862
+ if ((e == null || (_e$response14 = e.response) == null ? void 0 : _e$response14.status) === 422 && (e == null || (_e$response15 = e.response) == null ? void 0 : _e$response15.data.error) === "Such exchange pair is not available") {
12863
+ var _e$response16;
12864
+ Logger.log("Unable to create a swap with a not available currency " + (e == null || (_e$response16 = e.response) == null ? void 0 : _e$response16.data), loggerSource);
12865
+ return composeFailResult(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
12866
+ }
12867
+ if ((e == null || (_e$response17 = e.response) == null ? void 0 : _e$response17.status) === 429) {
12868
+ var _e$response18;
12869
+ Logger.log("Returning fail - RPS limit exceeded " + (e == null || (_e$response18 = e.response) == null ? void 0 : _e$response18.data), loggerSource);
12870
+ return composeFailResult(SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED);
12871
+ }
12872
+ Logger.log("Internal error for swap: " + safeStringify(e), loggerSource);
12873
+ improveAndRethrow(e, loggerSource);
12874
+ }));
12875
+ } catch (e) {
12876
+ return Promise.reject(e);
12877
+ }
12878
+ };
12879
+ _proto.getExistingSwapsDetailsAndStatus = function getExistingSwapsDetailsAndStatus(swapIds) {
12880
+ try {
12881
+ var _this5 = this;
12882
+ var loggerSource = "getExistingSwapsDetailsAndStatus";
12883
+ return Promise.resolve(_catch$2(function () {
12884
+ if (swapIds.find(function (id) {
12885
+ return typeof id !== "string";
12886
+ })) {
12887
+ throw new Error("Swap id is not string: " + safeStringify(swapIds));
12888
+ }
12889
+ var getSwap = function getSwap(swapId) {
12890
+ try {
12891
+ return Promise.resolve(_catch$2(function () {
12892
+ return Promise.resolve(axios__default["default"].get(_this5._URL + "/transactions/" + swapId, _this5.axiosGetPreset));
12893
+ }, function (error) {
12894
+ var _error$response;
12895
+ if ((error == null || (_error$response = error.response) == null ? void 0 : _error$response.status) === 404) return [];
12896
+ throw error;
12897
+ }));
12898
+ } catch (e) {
12899
+ return Promise.reject(e);
12900
+ }
12901
+ };
12902
+ return Promise.resolve(Promise.all(swapIds.map(function (swapId) {
12903
+ return getSwap(swapId);
12904
+ }))).then(function (responses) {
12905
+ var fetchedSwaps = responses.flat();
12906
+ Logger.log("All swaps RAW: " + JSON.stringify(fetchedSwaps.map(function (r) {
12907
+ return r.data;
12908
+ })), loggerSource);
12909
+ var swaps = fetchedSwaps.map(function (r) {
12910
+ return r.data;
12911
+ }).map(function (swap, index) {
12912
+ var _this5$_supportedCoin, _this5$_supportedCoin2, _swap$depositExtraId, _swap$withdrawalExtra, _swap$refundExtraId;
12913
+ var fromCoin = (_this5$_supportedCoin = _this5._supportedCoins.find(function (i) {
12914
+ return i.code === swap.coinFrom.coinCode && i.network === swap.coinFrom.network;
12915
+ })) == null ? void 0 : _this5$_supportedCoin.coin;
12916
+ var toCoin = (_this5$_supportedCoin2 = _this5._supportedCoins.find(function (i) {
12917
+ return i.code === swap.coinTo.coinCode && i.network === swap.coinTo.network;
12918
+ })) == null ? void 0 : _this5$_supportedCoin2.coin;
12919
+ if (!fromCoin || !toCoin) {
12920
+ return []; // We skip swaps with not supported coins for now
12921
+ }
12922
+ var toUtcTimestamp = function toUtcTimestamp(timeStr) {
12923
+ return Date.parse(timeStr.match(/.+[Zz]$/) ? timeStr : timeStr + "Z");
12924
+ };
12925
+ var createdAt = toUtcTimestamp(swap.createdAt);
12926
+ var expiresAt = createdAt + 25 * 60 * 1000; // Hack with hard-coded 25 minutes
12927
+ var isExpiredByTime = expiresAt < Date.now();
12928
+ var status = _this5._mapExolixStatusToRabbitStatus(swap.status, isExpiredByTime);
12929
+ var toDigits = status === SwapProvider.SWAP_STATUSES.REFUNDED ? fromCoin.digits : toCoin.digits;
12930
+ return new ExistingSwap(swapIds[index], status, createdAt, expiresAt, -1, AmountUtils.trim(swap.rate, _this5._maxRateDigits), (swap == null ? void 0 : swap.rateType) === "fixed", swap.refundAddress, swap.depositAddress, fromCoin, AmountUtils.trim(swap.amount, fromCoin.digits), swap.hashIn.hash, swap.hashIn.link, toCoin, AmountUtils.trim(swap.amountTo, toDigits), swap.hashOut.hash, swap.hashOut.link, swap.withdrawalAddress, _this5.id, (_swap$depositExtraId = swap.depositExtraId) != null ? _swap$depositExtraId : null, (_swap$withdrawalExtra = swap.withdrawalExtraId) != null ? _swap$withdrawalExtra : null, (_swap$refundExtraId = swap.refundExtraId) != null ? _swap$refundExtraId : null);
12931
+ }).flat();
12932
+ Logger.log("Swap details result " + safeStringify(swaps), loggerSource);
12933
+ return {
12934
+ result: true,
12935
+ swaps: swaps
12936
+ };
12937
+ });
12938
+ }, function (e) {
12939
+ var _e$response19, _e$response20;
12940
+ Logger.logError(e, loggerSource, "Failed to get swap details. Error is: " + safeStringify(e));
12941
+ var composeFailResult = function composeFailResult(reason) {
12942
+ return {
12943
+ result: false,
12944
+ reason: reason
12945
+ };
12946
+ };
12947
+ var status = e == null || (_e$response19 = e.response) == null ? void 0 : _e$response19.status;
12948
+ var data = e == null || (_e$response20 = e.response) == null ? void 0 : _e$response20.data;
12949
+ if (status === 429) {
12950
+ Logger.log("Returning fail - RPS limit exceeded " + data, loggerSource);
12951
+ return composeFailResult(SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED);
12952
+ }
12953
+ improveAndRethrow(e, loggerSource);
12954
+ }));
12955
+ } catch (e) {
12956
+ return Promise.reject(e);
12957
+ }
12958
+ };
12959
+ _proto._mapExolixStatusToRabbitStatus = function _mapExolixStatusToRabbitStatus(status, isExpiredByTime) {
12960
+ switch (status) {
12961
+ case "wait":
12962
+ if (isExpiredByTime) {
12963
+ return SwapProvider.SWAP_STATUSES.EXPIRED;
12964
+ }
12965
+ return SwapProvider.SWAP_STATUSES.WAITING_FOR_PAYMENT;
12966
+ case "confirmation":
12967
+ return SwapProvider.SWAP_STATUSES.CONFIRMING;
12968
+ case "confirmed":
12969
+ return SwapProvider.SWAP_STATUSES.PAYMENT_RECEIVED;
12970
+ case "exchanging":
12971
+ return SwapProvider.SWAP_STATUSES.EXCHANGING;
12972
+ case "sending":
12973
+ return SwapProvider.SWAP_STATUSES.EXCHANGING;
12974
+ case "success":
12975
+ return SwapProvider.SWAP_STATUSES.COMPLETED;
12976
+ case "overdue":
12977
+ return SwapProvider.SWAP_STATUSES.EXPIRED;
12978
+ case "refunded":
12979
+ return SwapProvider.SWAP_STATUSES.REFUNDED;
12980
+ default:
12981
+ throw new Error("Unknown Exolix status: " + status);
12982
+ }
12983
+ };
12984
+ _proto.getPartnersList = function getPartnersList() {
12985
+ try {
12986
+ var _this6 = this;
12987
+ return Promise.resolve([new Partner(_this6.id, "Exolix", "https://storage.swapspace.co/static/9WRkfc_QCUUmOBTcvgC9p57l9.svg", null)]);
12988
+ } catch (e) {
12989
+ return Promise.reject(e);
12990
+ }
12991
+ };
12992
+ return ExolixSwapProvider;
12993
+ }(SwapProvider);
12994
+
12995
+ function _catch$1(body, recover) {
12996
+ try {
12997
+ var result = body();
12998
+ } catch (e) {
12999
+ return recover(e);
13000
+ }
13001
+ if (result && result.then) {
13002
+ return result.then(void 0, recover);
13003
+ }
13004
+ return result;
13005
+ }
13006
+ var _iteratorSymbol = typeof Symbol !== "undefined" ? Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator")) : "@@iterator";
13007
+ function _settle(pact, state, value) {
13008
+ if (!pact.s) {
13009
+ if (value instanceof _Pact) {
13010
+ if (value.s) {
13011
+ if (state & 1) {
13012
+ state = value.s;
13013
+ }
13014
+ value = value.v;
13015
+ } else {
13016
+ value.o = _settle.bind(null, pact, state);
13017
+ return;
13018
+ }
13019
+ }
13020
+ if (value && value.then) {
13021
+ value.then(_settle.bind(null, pact, state), _settle.bind(null, pact, 2));
13022
+ return;
13023
+ }
13024
+ pact.s = state;
13025
+ pact.v = value;
13026
+ var observer = pact.o;
12344
13027
  if (observer) {
12345
13028
  observer(pact);
12346
13029
  }
@@ -12516,7 +13199,7 @@ var SwapUtils = /*#__PURE__*/function () {
12516
13199
  * So we are going to get some rate to be used as the default for the on-flight calculations before we get
12517
13200
  * the exact rate (that should be retrieved by getSwapCreationInfo method) for a specific amount.
12518
13201
  */
12519
- var defaultAmountUsd = bignumber_js.BigNumber("300");
13202
+ var defaultAmountUsd = BigNumber.BigNumber("300");
12520
13203
  return Promise.resolve(swapProvider.getCoinToUSDTRate(fromCoin)).then(function (coinUsdRate) {
12521
13204
  var coinAmountForDefaultUsdAmount = AmountUtils.trim(coinUsdRate != null && coinUsdRate.result ? defaultAmountUsd.div(coinUsdRate == null ? void 0 : coinUsdRate.rate) : defaultAmountUsd, fromCoin.digits);
12522
13205
  Logger.log("Init: " + coinAmountForDefaultUsdAmount + " " + fromCoin.ticker + "->" + toCoin.ticker, loggerSource);
@@ -12541,8 +13224,8 @@ var SwapUtils = /*#__PURE__*/function () {
12541
13224
  var fiatRate = (_coinToCurrentFiatRat = coinToCurrentFiatRate) != null ? _coinToCurrentFiatRat : coinUsdRate == null ? void 0 : coinUsdRate.rate;
12542
13225
  var fiatDecimals = (_fiatCurrencyDecimals = fiatCurrencyDecimals) != null ? _fiatCurrencyDecimals : FiatCurrenciesService.getCurrencyDecimalCountByCode("USD");
12543
13226
  if (fiatRate != null) {
12544
- fiatMin = bignumber_js.BigNumber(details == null ? void 0 : details.smallestMin).times(fiatRate).toFixed(fiatDecimals);
12545
- fiatMax = bignumber_js.BigNumber(details == null ? void 0 : details.greatestMax).times(fiatRate).toFixed(fiatDecimals);
13227
+ fiatMin = BigNumber.BigNumber(details == null ? void 0 : details.smallestMin).times(fiatRate).toFixed(fiatDecimals);
13228
+ fiatMax = BigNumber.BigNumber(details == null ? void 0 : details.greatestMax).times(fiatRate).toFixed(fiatDecimals);
12546
13229
  }
12547
13230
  var result = {
12548
13231
  result: true,
@@ -12617,7 +13300,7 @@ var SwapUtils = /*#__PURE__*/function () {
12617
13300
  var remainingSwapIds = new Set(swapIds);
12618
13301
  var failResults = [];
12619
13302
  var _temp7 = _forOf(swapProviders, function (provider) {
12620
- return Promise.resolve(provider.getExistingSwapsDetailsAndStatus([].concat(remainingSwapIds))).then(function (result) {
13303
+ return Promise.resolve(provider.getExistingSwapsDetailsAndStatus(Array.from(remainingSwapIds))).then(function (result) {
12621
13304
  var _temp6 = function () {
12622
13305
  if (result.result) {
12623
13306
  var _temp5 = function _temp5() {
@@ -12636,249 +13319,89 @@ var SwapUtils = /*#__PURE__*/function () {
12636
13319
  var _temp2 = function () {
12637
13320
  if (swap.status === SwapProvider.SWAP_STATUSES.REFUNDED) {
12638
13321
  return Promise.resolve(provider.getCoinToUSDTRate(swap.fromCoin)).then(function (rate) {
12639
- _extendedSwaps.push(ExistingSwapWithFiatData.fromExistingSwap(swap, (rate == null ? void 0 : rate.rate) != null ? bignumber_js.BigNumber(swap.fromAmount).times(rate.rate).toNumber() : null, (rate == null ? void 0 : rate.rate) != null ? bignumber_js.BigNumber(swap.toAmount).times(rate.rate).toNumber() : null, "USD", FiatCurrenciesService.getCurrencyDecimalCountByCode("USD")));
13322
+ _extendedSwaps.push(ExistingSwapWithFiatData.fromExistingSwap(swap, (rate == null ? void 0 : rate.rate) != null ? BigNumber.BigNumber(swap.fromAmount).times(rate.rate).toNumber() : null, (rate == null ? void 0 : rate.rate) != null ? BigNumber.BigNumber(swap.toAmount).times(rate.rate).toNumber() : null, "USD", FiatCurrenciesService.getCurrencyDecimalCountByCode("USD")));
12640
13323
  });
12641
13324
  } else {
12642
13325
  return Promise.resolve(Promise.all([provider.getCoinToUSDTRate(swap.fromCoin), provider.getCoinToUSDTRate(swap.toCoin)])).then(function (_ref) {
12643
13326
  var fromCoinFiatRate = _ref[0],
12644
13327
  toCoinFiatRate = _ref[1];
12645
- _extendedSwaps.push(ExistingSwapWithFiatData.fromExistingSwap(swap, (fromCoinFiatRate == null ? void 0 : fromCoinFiatRate.rate) != null ? bignumber_js.BigNumber(swap.fromAmount).times(fromCoinFiatRate.rate).toNumber() : null, (toCoinFiatRate == null ? void 0 : toCoinFiatRate.rate) != null ? bignumber_js.BigNumber(swap.toAmount).times(toCoinFiatRate.rate).toNumber() : null, "USD", FiatCurrenciesService.getCurrencyDecimalCountByCode("USD")));
13328
+ _extendedSwaps.push(ExistingSwapWithFiatData.fromExistingSwap(swap, (fromCoinFiatRate == null ? void 0 : fromCoinFiatRate.rate) != null ? BigNumber.BigNumber(swap.fromAmount).times(fromCoinFiatRate.rate).toNumber() : null, (toCoinFiatRate == null ? void 0 : toCoinFiatRate.rate) != null ? BigNumber.BigNumber(swap.toAmount).times(toCoinFiatRate.rate).toNumber() : null, "USD", FiatCurrenciesService.getCurrencyDecimalCountByCode("USD")));
12646
13329
  });
12647
13330
  }
12648
13331
  }();
12649
13332
  return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2);
12650
13333
  });
12651
13334
  return _temp4 && _temp4.then ? _temp4.then(_temp5) : _temp5(_temp4);
12652
- } else {
12653
- failResults.push(result);
12654
- }
12655
- }();
12656
- if (_temp6 && _temp6.then) return _temp6.then(function () {});
12657
- });
12658
- }, function () {
12659
- return _interrupt;
12660
- });
12661
- return _temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7);
12662
- }, function (e) {
12663
- improveAndRethrow(e, "getExistingSwapsDetailsWithFiatAmounts");
12664
- }));
12665
- } catch (e) {
12666
- return Promise.reject(e);
12667
- }
12668
- };
12669
- return SwapUtils;
12670
- }();
12671
-
12672
- function _catch(body, recover) {
12673
- try {
12674
- var result = body();
12675
- } catch (e) {
12676
- return recover(e);
12677
- }
12678
- if (result && result.then) {
12679
- return result.then(void 0, recover);
12680
- }
12681
- return result;
12682
- }
12683
- var PublicSwapService = /*#__PURE__*/function () {
12684
- /**
12685
- * TODO: [feature, critical] implement more adequate providers list&initiation logic. task_id=6a6b0fbbee8a413690c49b1e4ee289cb
12686
- *
12687
- * @param apiKeysProxyUrl {string|null}
12688
- * @param cache {Cache}
12689
- * @param providers {SwapProvider[]|null}
12690
- */
12691
- function PublicSwapService(apiKeysProxyUrl, cache, providers) {
12692
- var _providers;
12693
- if (providers === void 0) {
12694
- providers = null;
12695
- }
12696
- if (apiKeysProxyUrl) {
12697
- this._swapProvider = new SwapspaceSwapProvider(apiKeysProxyUrl, cache, function () {
12698
- return null;
12699
- }, false);
12700
- this._fixedSwapProvider = new LetsExchangeSwapProvider(apiKeysProxyUrl, cache, function () {
12701
- return null;
12702
- }, false);
12703
- } else if ((_providers = providers) != null && _providers.length) {
12704
- this._swapProvider = providers.find(function (p) {
12705
- return p.id === "swapspace";
12706
- });
12707
- this._fixedSwapProvider = providers.find(function (p) {
12708
- return p.id === "letsexchange";
12709
- });
12710
- }
12711
- }
12712
- var _proto = PublicSwapService.prototype;
12713
- _proto.initialize = function initialize() {
12714
- try {
12715
- var _this = this;
12716
- var _temp = _catch(function () {
12717
- return Promise.resolve(Promise.all([_this._swapProvider.initialize(), _this._fixedSwapProvider.initialize()])).then(function () {});
12718
- }, function (e) {
12719
- Logger.logError(e, "PublicSwapService.initialize");
12720
- });
12721
- return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
12722
- } catch (e) {
12723
- return Promise.reject(e);
12724
- }
12725
- }
12726
- /**
12727
- * Gets all currencies across all partners. Useful for sitemap or supported currencies count/list.
12728
- *
12729
- * @return {Promise<{result: boolean, coins: Coin[]}|{result: boolean, reason: string}>}
12730
- */
12731
- ;
12732
- _proto.getAllSupportedCurrenciesListForPublicSwap = function getAllSupportedCurrenciesListForPublicSwap() {
12733
- try {
12734
- var _this2 = this;
12735
- var loggerSource = "getAllSupportedCurrenciesListForPublicSwap";
12736
- return Promise.resolve(_catch(function () {
12737
- return Promise.resolve(_this2.initialize()).then(function () {
12738
- return Promise.resolve(Promise.all([_this2._fixedSwapProvider.getAllSupportedCurrencies(), _this2._swapProvider.getAllSupportedCurrencies()])).then(function (result) {
12739
- var _result$0$coins, _result$1$coins, _result$coins;
12740
- var allCoins = [].concat((_result$0$coins = result[0].coins) != null ? _result$0$coins : []);
12741
- ((_result$1$coins = result[1].coins) != null ? _result$1$coins : []).forEach(function (c) {
12742
- if (!allCoins.find(function (existingCoin) {
12743
- return existingCoin.ticker === c.ticker;
12744
- })) {
12745
- allCoins.push(c);
12746
- }
12747
- });
12748
- if (result[0].reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED || result[1].reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) {
12749
- SwapUtils.safeHandleRequestsLimitExceeding();
12750
- // TODO: [dev] improve this during the whitebit integration. task_id=20e7e41211b540d081bf98f392a34b2c
12751
- // return {
12752
- // result: false,
12753
- // reason: PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED,
12754
- // };
12755
- } else if (result[0].reason || result[1].reason) {
12756
- console.log("Failed to get all supported coins", result[0].reason, result[1].reason);
12757
- }
12758
- Logger.log("Retrieved " + (result == null || (_result$coins = result.coins) == null ? void 0 : _result$coins.length) + " supported currencies for swap", loggerSource);
12759
- return {
12760
- result: true,
12761
- coins: allCoins
12762
- };
12763
- });
12764
- });
12765
- }, function (e) {
12766
- improveAndRethrow(e, "getAllSupportedCurrenciesListForPublicSwap");
12767
- }));
12768
- } catch (e) {
12769
- return Promise.reject(e);
12770
- }
12771
- };
12772
- _proto.getDepositCurrenciesListForPublicSwap = function getDepositCurrenciesListForPublicSwap(fixed) {
12773
- if (fixed === void 0) {
12774
- fixed = false;
12775
- }
12776
- try {
12777
- var _this3 = this;
12778
- return Promise.resolve(_catch(function () {
12779
- return Promise.resolve(_this3._getCurrenciesListForPublicSwap(false, fixed));
12780
- }, function (e) {
12781
- improveAndRethrow(e, "getDepositCurrenciesListForPublicSwap");
12782
- }));
12783
- } catch (e) {
12784
- return Promise.reject(e);
12785
- }
12786
- };
12787
- _proto.getWithdrawCurrenciesListForPublicSwap = function getWithdrawCurrenciesListForPublicSwap(fixed) {
12788
- if (fixed === void 0) {
12789
- fixed = false;
12790
- }
12791
- try {
12792
- var _this4 = this;
12793
- return Promise.resolve(_catch(function () {
12794
- return Promise.resolve(_this4._getCurrenciesListForPublicSwap(true, fixed));
12795
- }, function (e) {
12796
- improveAndRethrow(e, "getWithdrawCurrenciesListForPublicSwap");
12797
- }));
12798
- } catch (e) {
12799
- return Promise.reject(e);
12800
- }
12801
- };
12802
- _proto._getCurrenciesListForPublicSwap = function _getCurrenciesListForPublicSwap(withdraw, fixed) {
12803
- if (withdraw === void 0) {
12804
- withdraw = false;
12805
- }
12806
- if (fixed === void 0) {
12807
- fixed = false;
12808
- }
12809
- try {
12810
- var _this5 = this;
12811
- var loggerSource = "getCurrenciesListForPublicSwap";
12812
- return Promise.resolve(_catch(function () {
12813
- var provider = fixed ? _this5._fixedSwapProvider : _this5._swapProvider;
12814
- return Promise.resolve(withdraw ? provider.getWithdrawalCurrencies() : provider.getDepositCurrencies()).then(function (result) {
12815
- var _result$coins2;
12816
- if (result.reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) {
12817
- SwapUtils.safeHandleRequestsLimitExceeding();
12818
- return {
12819
- result: false,
12820
- reason: PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
12821
- };
12822
- }
12823
- Logger.log("Retrieved " + (result == null || (_result$coins2 = result.coins) == null ? void 0 : _result$coins2.length) + " supported currencies for swap (withdraw=" + withdraw + ")", loggerSource);
12824
- return {
12825
- result: true,
12826
- coins: result.coins
12827
- };
13335
+ } else {
13336
+ failResults.push(result);
13337
+ }
13338
+ }();
13339
+ if (_temp6 && _temp6.then) return _temp6.then(function () {});
13340
+ });
13341
+ }, function () {
13342
+ return _interrupt;
12828
13343
  });
13344
+ return _temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7);
12829
13345
  }, function (e) {
12830
- improveAndRethrow(e, loggerSource);
13346
+ improveAndRethrow(e, "getExistingSwapsDetailsWithFiatAmounts");
12831
13347
  }));
12832
13348
  } catch (e) {
12833
13349
  return Promise.reject(e);
12834
13350
  }
13351
+ };
13352
+ return SwapUtils;
13353
+ }();
13354
+
13355
+ function _catch(body, recover) {
13356
+ try {
13357
+ var result = body();
13358
+ } catch (e) {
13359
+ return recover(e);
12835
13360
  }
13361
+ if (result && result.then) {
13362
+ return result.then(void 0, recover);
13363
+ }
13364
+ return result;
13365
+ }
13366
+ var PublicSwapService = /*#__PURE__*/function () {
12836
13367
  /**
12837
- * Retrieves initial data for swapping two coins.
12838
- *
12839
- * Always FLOATING rate, FIXED is not supported - if you want to change it the default rate - all
12840
- * the swaps code logic should be verified to align with this change.
13368
+ * TODO: [feature, critical] implement more adequate providers list&initiation logic. task_id=6a6b0fbbee8a413690c49b1e4ee289cb
12841
13369
  *
12842
- * @param fromCoin {Coin}
12843
- * @param toCoin {Coin}
12844
- * @return {Promise<{
12845
- * result: true,
12846
- * min: string,
12847
- * fiatMin: (number|null),
12848
- * max: string,
12849
- * fiatMax: (number|null),
12850
- * rate: (string|null)
12851
- * }|{
12852
- * result: false,
12853
- * reason: string
12854
- * }>}
13370
+ * @param apiKeysProxyUrl {string|null}
13371
+ * @param cache {Cache}
13372
+ * @param providers {SwapProvider[]|null}
12855
13373
  */
12856
- ;
12857
- _proto.getInitialPublicSwapData = function getInitialPublicSwapData(fromCoin, toCoin) {
13374
+ function PublicSwapService(apiKeysProxyUrl, cache, providers) {
13375
+ var _providers;
13376
+ if (providers === void 0) {
13377
+ providers = null;
13378
+ }
13379
+ if (apiKeysProxyUrl) {
13380
+ this._swapProvider = new SwapspaceSwapProvider(apiKeysProxyUrl, cache, function () {
13381
+ return null;
13382
+ }, false);
13383
+ this._fixedSwapProvider = new LetsExchangeSwapProvider(apiKeysProxyUrl, cache, function () {
13384
+ return null;
13385
+ }, false);
13386
+ } else if ((_providers = providers) != null && _providers.length) {
13387
+ this._swapProvider = providers.find(function (p) {
13388
+ return p.id === "swapspace";
13389
+ });
13390
+ this._fixedSwapProvider = providers.find(function (p) {
13391
+ return p.id === "letsexchange";
13392
+ });
13393
+ }
13394
+ }
13395
+ var _proto = PublicSwapService.prototype;
13396
+ _proto.initialize = function initialize() {
12858
13397
  try {
12859
- var _this6 = this;
12860
- return Promise.resolve(_catch(function () {
12861
- return Promise.resolve(SwapUtils.getInitialSwapData(_this6._swapProvider, fromCoin, toCoin)).then(function (result) {
12862
- if (!result.result) {
12863
- if (result.reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) {
12864
- SwapUtils.safeHandleRequestsLimitExceeding();
12865
- return {
12866
- result: false,
12867
- reason: PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
12868
- };
12869
- }
12870
- if (result.reason === SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED) {
12871
- return {
12872
- result: false,
12873
- reason: PublicSwapService.PUBLIC_SWAP_DETAILS_FAIL_REASONS.PAIR_NOT_SUPPORTED
12874
- };
12875
- }
12876
- }
12877
- return result;
12878
- });
13398
+ var _this = this;
13399
+ var _temp = _catch(function () {
13400
+ return Promise.resolve(Promise.all([_this._swapProvider.initialize(), _this._fixedSwapProvider.initialize()])).then(function () {});
12879
13401
  }, function (e) {
12880
- improveAndRethrow(e, "getInitialPublicSwapData");
12881
- }));
13402
+ Logger.logError(e, "PublicSwapService.initialize");
13403
+ });
13404
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
12882
13405
  } catch (e) {
12883
13406
  return Promise.reject(e);
12884
13407
  }
@@ -12886,14 +13409,15 @@ var PublicSwapService = /*#__PURE__*/function () {
12886
13409
  /**
12887
13410
  * Retrieves swap details that can be used to create swap.
12888
13411
  *
13412
+ * @param provider {SwapProvider}
12889
13413
  * @param fromCoinOrTicker {Coin|string}
12890
13414
  * @param toCoinOrTicker {Coin|string}
12891
13415
  * @param amountCoins {string}
12892
13416
  * @param [fixed=false] {boolean|null} null means fixed or float doesn't matter
12893
- * @param [withoutFiat=false] {boolean} pass true if you don't need the fiat equivalent - this will diminish requests count
13417
+ * @param [coinUsdtRate=null] {number|null} rate of amount coin to USDT
12894
13418
  * @param [amountIsToReceive=false] {boolean} whether the given amount is receiving amount.
12895
13419
  * False means the amount is the sending amount.
12896
- * @param bannedPartners {string[]} array of banned swap partners (providers) ids
13420
+ * @param bannedPartners {string[]} array of banned swap partners (providers) ids (rabbit ids)
12897
13421
  * @return {Promise<{
12898
13422
  * result: false,
12899
13423
  * reason: string,
@@ -12908,12 +13432,12 @@ var PublicSwapService = /*#__PURE__*/function () {
12908
13432
  * }>}
12909
13433
  */
12910
13434
  ;
12911
- _proto.getPublicSwapDetails = function getPublicSwapDetails(fromCoinOrTicker, toCoinOrTicker, amountCoins, fixed, withoutFiat, amountIsToReceive, bannedPartners) {
13435
+ _proto.getPublicSwapDetails = function getPublicSwapDetails(provider, fromCoinOrTicker, toCoinOrTicker, amountCoins, fixed, coinUsdtRate, amountIsToReceive, bannedPartners) {
12912
13436
  if (fixed === void 0) {
12913
13437
  fixed = false;
12914
13438
  }
12915
- if (withoutFiat === void 0) {
12916
- withoutFiat = false;
13439
+ if (coinUsdtRate === void 0) {
13440
+ coinUsdtRate = null;
12917
13441
  }
12918
13442
  if (amountIsToReceive === void 0) {
12919
13443
  amountIsToReceive = false;
@@ -12922,89 +13446,22 @@ var PublicSwapService = /*#__PURE__*/function () {
12922
13446
  bannedPartners = [];
12923
13447
  }
12924
13448
  try {
12925
- var _this7 = this;
13449
+ var _this2 = this;
12926
13450
  var loggerSource = "getPublicSwapDetails";
12927
13451
  return Promise.resolve(_catch(function () {
12928
- function _temp2(_operatingPartner$get) {
12929
- var _operatingPartner$get2;
12930
- var coinUsdtRate = withoutFiat ? _operatingPartner$get : (_operatingPartner$get2 = _operatingPartner$get == null ? void 0 : _operatingPartner$get.rate) != null ? _operatingPartner$get2 : null;
12931
- // TODO: [feature, high] implement base logic for provider selection based on the list of allowed providers - call estimation for all allowed and select the best option. task_id=6a6b0fbbee8a413690c49b1e4ee289cb
12932
- return Promise.resolve(operatingPartner.getSwapInfo(fromCoin, toCoin, amountCoins, fixed, coinUsdtRate, amountIsToReceive, bannedPartners)).then(function (details) {
12933
- var _result$swapCreationI, _result$swapCreationI2;
12934
- // eslint-disable-next-line no-console
12935
- console.log("getSwapInfo result: ", details);
12936
- var min = details.smallestMin != null && bignumber_js.BigNumber(details.smallestMin).gt("0") ? details.smallestMin : null;
12937
- var max = details.greatestMax != null && bignumber_js.BigNumber(details.greatestMax).gt("0") ? details.greatestMax : null;
12938
- var fiatMin = null,
12939
- fiatMax = null;
12940
- if (coinUsdtRate != null) {
12941
- if (min != null) {
12942
- fiatMin = bignumber_js.BigNumber(min).times(coinUsdtRate).toFixed(PublicSwapService._fiatDecimalsCount);
12943
- }
12944
- if (max != null) {
12945
- fiatMax = bignumber_js.BigNumber(max).times(coinUsdtRate).toFixed(PublicSwapService._fiatDecimalsCount);
12946
- }
12947
- }
12948
- var composeFailResult = function composeFailResult(reason) {
12949
- var _details$rate;
12950
- return {
12951
- result: false,
12952
- reason: reason,
12953
- min: min != null ? min : null,
12954
- fiatMin: fiatMin,
12955
- max: max != null ? max : null,
12956
- fiatMax: fiatMax,
12957
- rate: (_details$rate = details.rate) != null ? _details$rate : null
12958
- };
12959
- };
12960
- if (!details.result) {
12961
- if ((details == null ? void 0 : details.reason) === SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED) {
12962
- return composeFailResult(PublicSwapService.PUBLIC_SWAP_DETAILS_FAIL_REASONS.PAIR_NOT_SUPPORTED);
12963
- } else if ((details == null ? void 0 : details.reason) === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) {
12964
- SwapUtils.safeHandleRequestsLimitExceeding();
12965
- return composeFailResult(PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED);
12966
- } else if ((details == null ? void 0 : details.reason) === SwapProvider.NO_SWAPS_REASONS.NO_FLOATING_BUT_HAVE_FIXED) {
12967
- return composeFailResult(PublicSwapService.PUBLIC_SWAP_DETAILS_FAIL_REASONS.NO_FLOATING_BUT_HAVE_FIXED_PUBLIC_SWAP_OPTION);
12968
- } else if ((details == null ? void 0 : details.reason) === SwapProvider.NO_SWAPS_REASONS.NO_FIXED_BUT_HAVE_FLOATING) {
12969
- return composeFailResult(PublicSwapService.PUBLIC_SWAP_DETAILS_FAIL_REASONS.NO_FIXED_BUT_HAVE_FLOATING_PUBLIC_SWAP_OPTION);
12970
- }
12971
- }
12972
- var amountBigNumber = bignumber_js.BigNumber(amountCoins);
12973
- if (typeof min === "string" && amountBigNumber.lt(min)) {
12974
- return composeFailResult(PublicSwapService.PUBLIC_SWAP_DETAILS_FAIL_REASONS.AMOUNT_LESS_THAN_MIN_SWAPPABLE);
12975
- } else if (typeof max === "string" && amountBigNumber.gt(max)) {
12976
- return composeFailResult(PublicSwapService.PUBLIC_SWAP_DETAILS_FAIL_REASONS.AMOUNT_HIGHER_THAN_MAX_SWAPPABLE);
12977
- }
12978
- var fromAmountCoins = amountIsToReceive ? AmountUtils.trim(amountBigNumber.div(details.rate), fromCoin.digits) : amountCoins;
12979
- var toAmountCoins = amountIsToReceive ? amountCoins : AmountUtils.trim(amountBigNumber.times(details.rate), toCoin.digits);
12980
- var result = {
12981
- result: true,
12982
- swapCreationInfo: new BaseSwapCreationInfo(fromCoin, toCoin, fromAmountCoins, toAmountCoins, details.rate, details.rawSwapData, min, fiatMin, max, fiatMax, details.durationMinutesRange, details.fixed, details.isRefundAddressRequired)
12983
- };
12984
- Logger.log("Result: " + safeStringify({
12985
- result: result.result,
12986
- swapCreationInfo: _extends({}, result.swapCreationInfo, {
12987
- fromCoin: result == null || (_result$swapCreationI = result.swapCreationInfo) == null || (_result$swapCreationI = _result$swapCreationI.fromCoin) == null ? void 0 : _result$swapCreationI.ticker,
12988
- toCoin: result == null || (_result$swapCreationI2 = result.swapCreationInfo) == null || (_result$swapCreationI2 = _result$swapCreationI2.toCoin) == null ? void 0 : _result$swapCreationI2.ticker
12989
- })
12990
- }), loggerSource);
12991
- return result;
12992
- });
12993
- }
12994
13452
  if (amountIsToReceive && !fixed) {
12995
13453
  throw new Error("Estimating allowed only for fixed rate.");
12996
13454
  }
12997
13455
  var fromCoin = fromCoinOrTicker;
12998
13456
  if (typeof fromCoin === "string") {
12999
- fromCoin = _this7.getCoinByTickerIfPresent(fromCoin);
13457
+ fromCoin = _this2.getCoinByTickerIfPresent(fromCoin);
13000
13458
  }
13001
13459
  var toCoin = toCoinOrTicker;
13002
13460
  if (typeof toCoin === "string") {
13003
- toCoin = _this7.getCoinByTickerIfPresent(toCoin);
13461
+ toCoin = _this2.getCoinByTickerIfPresent(toCoin);
13004
13462
  }
13005
- var operatingPartner = fixed ? _this7._fixedSwapProvider : _this7._swapProvider;
13006
13463
  var isPartnerBanned = !!bannedPartners.find(function (banned) {
13007
- return banned === operatingPartner.id;
13464
+ return banned === provider.id;
13008
13465
  });
13009
13466
  return !fromCoin || !toCoin || isPartnerBanned ? {
13010
13467
  result: false,
@@ -13014,7 +13471,67 @@ var PublicSwapService = /*#__PURE__*/function () {
13014
13471
  fiatMin: null,
13015
13472
  fiatMax: null,
13016
13473
  rate: undefined
13017
- } : withoutFiat ? _temp2(null) : Promise.resolve(operatingPartner.getCoinToUSDTRate(amountIsToReceive ? toCoin : fromCoin)).then(_temp2);
13474
+ } : Promise.resolve(provider.getSwapInfo(fromCoin, toCoin, amountCoins, fixed, coinUsdtRate, amountIsToReceive, bannedPartners)).then(function (details) {
13475
+ var _result$swapCreationI, _result$swapCreationI2;
13476
+ // eslint-disable-next-line no-console
13477
+ console.log("getSwapInfo raw result: ", details, loggerSource);
13478
+ var min = details.smallestMin != null && BigNumber.BigNumber(details.smallestMin).gt("0") ? details.smallestMin : null;
13479
+ var max = details.greatestMax != null && BigNumber.BigNumber(details.greatestMax).gt("0") ? details.greatestMax : null;
13480
+ var fiatMin = null,
13481
+ fiatMax = null;
13482
+ if (coinUsdtRate != null) {
13483
+ if (min != null) {
13484
+ fiatMin = BigNumber.BigNumber(min).times(coinUsdtRate).toFixed(PublicSwapService._fiatDecimalsCount);
13485
+ }
13486
+ if (max != null) {
13487
+ fiatMax = BigNumber.BigNumber(max).times(coinUsdtRate).toFixed(PublicSwapService._fiatDecimalsCount);
13488
+ }
13489
+ }
13490
+ var composeFailResult = function composeFailResult(reason) {
13491
+ var _details$rate;
13492
+ return {
13493
+ result: false,
13494
+ reason: reason,
13495
+ min: min != null ? min : null,
13496
+ fiatMin: fiatMin,
13497
+ max: max != null ? max : null,
13498
+ fiatMax: fiatMax,
13499
+ rate: (_details$rate = details.rate) != null ? _details$rate : null
13500
+ };
13501
+ };
13502
+ if (!details.result) {
13503
+ if ((details == null ? void 0 : details.reason) === SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED) {
13504
+ return composeFailResult(PublicSwapService.PUBLIC_SWAP_DETAILS_FAIL_REASONS.PAIR_NOT_SUPPORTED);
13505
+ } else if ((details == null ? void 0 : details.reason) === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) {
13506
+ SwapUtils.safeHandleRequestsLimitExceeding();
13507
+ return composeFailResult(PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED);
13508
+ } else if ((details == null ? void 0 : details.reason) === SwapProvider.NO_SWAPS_REASONS.NO_FLOATING_BUT_HAVE_FIXED) {
13509
+ return composeFailResult(PublicSwapService.PUBLIC_SWAP_DETAILS_FAIL_REASONS.NO_FLOATING_BUT_HAVE_FIXED_PUBLIC_SWAP_OPTION);
13510
+ } else if ((details == null ? void 0 : details.reason) === SwapProvider.NO_SWAPS_REASONS.NO_FIXED_BUT_HAVE_FLOATING) {
13511
+ return composeFailResult(PublicSwapService.PUBLIC_SWAP_DETAILS_FAIL_REASONS.NO_FIXED_BUT_HAVE_FLOATING_PUBLIC_SWAP_OPTION);
13512
+ }
13513
+ }
13514
+ var amountBigNumber = BigNumber.BigNumber(amountCoins);
13515
+ if (typeof min === "string" && amountBigNumber.lt(min)) {
13516
+ return composeFailResult(PublicSwapService.PUBLIC_SWAP_DETAILS_FAIL_REASONS.AMOUNT_LESS_THAN_MIN_SWAPPABLE);
13517
+ } else if (typeof max === "string" && amountBigNumber.gt(max)) {
13518
+ return composeFailResult(PublicSwapService.PUBLIC_SWAP_DETAILS_FAIL_REASONS.AMOUNT_HIGHER_THAN_MAX_SWAPPABLE);
13519
+ }
13520
+ var fromAmountCoins = amountIsToReceive ? AmountUtils.trim(amountBigNumber.div(details.rate), fromCoin.digits) : amountCoins;
13521
+ var toAmountCoins = amountIsToReceive ? amountCoins : AmountUtils.trim(amountBigNumber.times(details.rate), toCoin.digits);
13522
+ var result = {
13523
+ result: true,
13524
+ swapCreationInfo: new BaseSwapCreationInfo(fromCoin, toCoin, fromAmountCoins, toAmountCoins, details.rate, details.rawSwapData, min, fiatMin, max, fiatMax, details.durationMinutesRange, details.fixed, provider.id, details.isRefundAddressRequired)
13525
+ };
13526
+ Logger.log("Result: " + safeStringify({
13527
+ result: result.result,
13528
+ swapCreationInfo: _extends({}, result.swapCreationInfo, {
13529
+ fromCoin: result == null || (_result$swapCreationI = result.swapCreationInfo) == null || (_result$swapCreationI = _result$swapCreationI.fromCoin) == null ? void 0 : _result$swapCreationI.ticker,
13530
+ toCoin: result == null || (_result$swapCreationI2 = result.swapCreationInfo) == null || (_result$swapCreationI2 = _result$swapCreationI2.toCoin) == null ? void 0 : _result$swapCreationI2.ticker
13531
+ })
13532
+ }), loggerSource);
13533
+ return result;
13534
+ });
13018
13535
  }, function (e) {
13019
13536
  improveAndRethrow(e, loggerSource);
13020
13537
  }));
@@ -13025,10 +13542,11 @@ var PublicSwapService = /*#__PURE__*/function () {
13025
13542
  /**
13026
13543
  * Creates swap by given params.
13027
13544
  *
13028
- * @param fromCoin {Coin}
13029
- * @param toCoin {Coin}
13545
+ * @param provider {SwapProvider}
13546
+ * @param fromCoinTicker {string}
13547
+ * @param toCoinTicker {string}
13030
13548
  * @param amount {string}
13031
- * @param swapCreationInfo {BaseSwapCreationInfo}
13549
+ * @param proprietarySwapEstimationData {Object|null}
13032
13550
  * @param toAddress {string}
13033
13551
  * @param refundAddress {string}
13034
13552
  * @param clientIp {string}
@@ -13036,10 +13554,11 @@ var PublicSwapService = /*#__PURE__*/function () {
13036
13554
  * @param [refundExtraId] {string}
13037
13555
  * @param [amountIsToReceive=false] {boolean} whether the given amount is receiving amount.
13038
13556
  * False means the amount is the sending amount.
13557
+ * @param isFixed {boolean}
13039
13558
  * @return {Promise<{
13040
13559
  * result: true,
13041
13560
  * fiatCurrencyCode: string,
13042
- * toCoin: Coin,
13561
+ * toCoinTicker: string,
13043
13562
  * fromAmountFiat: (number|null),
13044
13563
  * address: string,
13045
13564
  * durationMinutesRange: string,
@@ -13047,7 +13566,7 @@ var PublicSwapService = /*#__PURE__*/function () {
13047
13566
  * toAmount: string,
13048
13567
  * toAmountFiat: (number|null),
13049
13568
  * fiatCurrencyDecimals: number,
13050
- * fromCoin: Coin,
13569
+ * fromCoinTicker: string,
13051
13570
  * rate: string,
13052
13571
  * swapId: string,
13053
13572
  * fromCurrencyExtraId: string,
@@ -13058,31 +13577,35 @@ var PublicSwapService = /*#__PURE__*/function () {
13058
13577
  * }>}
13059
13578
  */
13060
13579
  ;
13061
- _proto.createPublicSwap = function createPublicSwap(fromCoin, toCoin, amount, swapCreationInfo, toAddress, refundAddress, clientIp, toCurrencyExtraId, refundExtraId, amountIsToReceive) {
13580
+ _proto.createPublicSwap = function createPublicSwap(provider, fromCoinTicker, toCoinTicker, amount, proprietarySwapEstimationData, toAddress, refundAddress, clientIp, toCurrencyExtraId, refundExtraId, amountIsToReceive, isFixed) {
13062
13581
  if (amountIsToReceive === void 0) {
13063
13582
  amountIsToReceive = false;
13064
13583
  }
13584
+ if (isFixed === void 0) {
13585
+ isFixed = false;
13586
+ }
13065
13587
  try {
13066
- var _this8 = this;
13588
+ var _this3 = this;
13067
13589
  var loggerSource = "createPublicSwap";
13068
13590
  return Promise.resolve(_catch(function () {
13069
- var _swapCreationInfo$fro, _swapCreationInfo$toC;
13070
- if (!(fromCoin instanceof Coin) || !(toCoin instanceof Coin) || typeof amount !== "string" || typeof toAddress !== "string" || swapCreationInfo.isRefundAddressRequired && (typeof refundAddress !== "string" || refundAddress.length === 0) || !(swapCreationInfo instanceof BaseSwapCreationInfo)) {
13071
- throw new Error("Wrong input: " + fromCoin.ticker + " " + toCoin.ticker + " " + amount + " " + swapCreationInfo);
13591
+ if (!(provider instanceof SwapProvider) || typeof fromCoinTicker !== "string" || typeof toCoinTicker !== "string" || typeof amount !== "string" || typeof toAddress !== "string") {
13592
+ throw new Error("Wrong input: " + provider + " " + fromCoinTicker + " " + toCoinTicker + " " + amount + " " + isFixed);
13072
13593
  }
13073
- Logger.log("Start: " + amount + " " + fromCoin.ticker + " -> " + toCoin.ticker + ". Details: " + safeStringify(_extends({}, swapCreationInfo, {
13074
- fromCoin: swapCreationInfo == null || (_swapCreationInfo$fro = swapCreationInfo.fromCoin) == null ? void 0 : _swapCreationInfo$fro.ticker,
13075
- toCoin: swapCreationInfo == null || (_swapCreationInfo$toC = swapCreationInfo.toCoin) == null ? void 0 : _swapCreationInfo$toC.ticker
13076
- })), loggerSource);
13077
- return Promise.resolve((swapCreationInfo.fixed ? _this8._fixedSwapProvider : _this8._swapProvider).createSwap(fromCoin, toCoin, amount, toAddress, refundAddress, swapCreationInfo.rawSwapData, clientIp, swapCreationInfo.fixed, toCurrencyExtraId, refundExtraId, amountIsToReceive)).then(function (result) {
13594
+ Logger.log("Start: " + provider.id + " " + amount + " " + fromCoinTicker + " -> " + toCoinTicker + ". raw data: " + proprietarySwapEstimationData, loggerSource);
13595
+ var _map = [fromCoinTicker, toCoinTicker].map(function (t) {
13596
+ return _this3.getCoinByTickerIfPresent(t);
13597
+ }),
13598
+ fromCoin = _map[0],
13599
+ toCoin = _map[1];
13600
+ return Promise.resolve(provider.createSwap(fromCoin, toCoin, amount, toAddress, refundAddress, proprietarySwapEstimationData, clientIp, isFixed, toCurrencyExtraId, refundExtraId, amountIsToReceive)).then(function (result) {
13078
13601
  var _exit;
13079
- function _temp6(_result8) {
13080
- if (_exit) return _result8;
13602
+ function _temp5(_result3) {
13603
+ if (_exit) return _result3;
13081
13604
  throw new Error("Unexpected result from provider " + safeStringify(result));
13082
13605
  }
13083
13606
  Logger.log("Created:" + safeStringify(_extends({}, result, {
13084
- fromCoin: fromCoin == null ? void 0 : fromCoin.ticker,
13085
- toCoin: toCoin == null ? void 0 : toCoin.ticker
13607
+ fromCoin: fromCoinTicker,
13608
+ toCoin: toCoinTicker
13086
13609
  })), loggerSource);
13087
13610
  if (!(result != null && result.result)) {
13088
13611
  if ((result == null ? void 0 : result.reason) === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) {
@@ -13100,21 +13623,21 @@ var PublicSwapService = /*#__PURE__*/function () {
13100
13623
  // };
13101
13624
  }
13102
13625
  }
13103
- var _temp5 = function () {
13626
+ var _temp4 = function () {
13104
13627
  if (result.result && result != null && result.swapId) {
13105
- var _temp4 = function _temp4() {
13628
+ var _temp3 = function _temp3() {
13106
13629
  return Promise.resolve(GoogleAnalyticsAdapter.sendEvent(PublicSwapService.PUBLIC_SWAP_CREATED_ANALYTICS_EVENT, {
13107
13630
  coin_amount: result.fromAmount,
13108
13631
  usd_amount: _fromAmountFiat,
13109
- fromCoin: fromCoin.ticker,
13110
- toCoin: toCoin.ticker
13632
+ fromCoin: fromCoinTicker,
13633
+ toCoin: toCoinTicker
13111
13634
  })).then(function () {
13112
13635
  var _result$fromCurrencyE;
13113
13636
  var toReturn = {
13114
13637
  result: true,
13115
13638
  swapId: result.swapId,
13116
- fromCoin: fromCoin,
13117
- toCoin: toCoin,
13639
+ fromCoinTicker: fromCoinTicker,
13640
+ toCoinTicker: toCoinTicker,
13118
13641
  fromAmount: result.fromAmount,
13119
13642
  toAmount: result.toAmount,
13120
13643
  fromAmountFiat: _fromAmountFiat,
@@ -13122,17 +13645,18 @@ var PublicSwapService = /*#__PURE__*/function () {
13122
13645
  fiatCurrencyCode: "USD",
13123
13646
  fiatCurrencyDecimals: PublicSwapService._fiatDecimalsCount,
13124
13647
  rate: result.rate,
13125
- durationMinutesRange: swapCreationInfo.durationMinutesRange,
13648
+ durationMinutesRange: null,
13649
+ // TODO: [feature, high] add duration. task_id=3f3d73d7cf44454282222901409149b5
13126
13650
  address: result.fromAddress,
13127
13651
  // CRITICAL: this is the address to send coins to swaps provider
13128
13652
  fromCurrencyExtraId: (_result$fromCurrencyE = result.fromCurrencyExtraId) != null ? _result$fromCurrencyE : "",
13129
13653
  // CRITICAL: this is the extra ID for address to send coins to swaps provider
13130
13654
  fixed: result.fixed
13131
13655
  };
13132
- _this8._savePublicSwapIdLocally(result.swapId);
13656
+ _this3._savePublicSwapIdLocally(result.swapId);
13133
13657
  Logger.log("Returning: " + safeStringify(_extends({}, toReturn, {
13134
- fromCoin: fromCoin == null ? void 0 : fromCoin.ticker,
13135
- toCoin: toCoin == null ? void 0 : toCoin.ticker
13658
+ fromCoin: fromCoinTicker,
13659
+ toCoin: toCoinTicker
13136
13660
  })), loggerSource);
13137
13661
  _exit = 1;
13138
13662
  return toReturn;
@@ -13140,67 +13664,28 @@ var PublicSwapService = /*#__PURE__*/function () {
13140
13664
  };
13141
13665
  var _fromAmountFiat = null,
13142
13666
  _toAmountFiat = null;
13143
- var _temp3 = _catch(function () {
13144
- return Promise.resolve(_this8._swapProvider.getCoinToUSDTRate(fromCoin)).then(function (_this8$_swapProvider$) {
13145
- var _this8$_swapProvider$3;
13146
- var fromCoinUsdtRate = (_this8$_swapProvider$3 = _this8$_swapProvider$ == null ? void 0 : _this8$_swapProvider$.rate) != null ? _this8$_swapProvider$3 : null;
13147
- return Promise.resolve(_this8._swapProvider.getCoinToUSDTRate(fromCoin)).then(function (_this8$_swapProvider$2) {
13148
- var _this8$_swapProvider$4;
13149
- var toCoinUsdtRate = (_this8$_swapProvider$4 = _this8$_swapProvider$2 == null ? void 0 : _this8$_swapProvider$2.rate) != null ? _this8$_swapProvider$4 : null;
13667
+ var _temp2 = _catch(function () {
13668
+ return Promise.resolve(provider.getCoinToUSDTRate(fromCoinTicker)).then(function (_provider$getCoinToUS) {
13669
+ var _provider$getCoinToUS3;
13670
+ var fromCoinUsdtRate = (_provider$getCoinToUS3 = _provider$getCoinToUS == null ? void 0 : _provider$getCoinToUS.rate) != null ? _provider$getCoinToUS3 : null;
13671
+ return Promise.resolve(provider.getCoinToUSDTRate(toCoinTicker)).then(function (_provider$getCoinToUS2) {
13672
+ var _provider$getCoinToUS4;
13673
+ var toCoinUsdtRate = (_provider$getCoinToUS4 = _provider$getCoinToUS2 == null ? void 0 : _provider$getCoinToUS2.rate) != null ? _provider$getCoinToUS4 : null;
13150
13674
  if (fromCoinUsdtRate != null && result.fromAmount != null) {
13151
- _fromAmountFiat = bignumber_js.BigNumber(result.fromAmount).times(fromCoinUsdtRate).toFixed(PublicSwapService._fiatDecimalsCount);
13675
+ _fromAmountFiat = BigNumber.BigNumber(result.fromAmount).times(fromCoinUsdtRate).toFixed(PublicSwapService._fiatDecimalsCount);
13152
13676
  }
13153
13677
  if (toCoinUsdtRate != null && result.toAmount != null) {
13154
- _toAmountFiat = bignumber_js.BigNumber(result.toAmount).times(toCoinUsdtRate).toFixed(PublicSwapService._fiatDecimalsCount);
13678
+ _toAmountFiat = BigNumber.BigNumber(result.toAmount).times(toCoinUsdtRate).toFixed(PublicSwapService._fiatDecimalsCount);
13155
13679
  }
13156
13680
  });
13157
13681
  });
13158
13682
  }, function (e) {
13159
13683
  Logger.logError(e, loggerSource, "Failed to calculate fiat amounts for result");
13160
13684
  });
13161
- return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
13685
+ return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2);
13162
13686
  }
13163
13687
  }();
13164
- return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5);
13165
- });
13166
- }, function (e) {
13167
- improveAndRethrow(e, loggerSource);
13168
- }));
13169
- } catch (e) {
13170
- return Promise.reject(e);
13171
- }
13172
- }
13173
- /**
13174
- * Retrieves swap details and status for existing swaps by their ids.
13175
- *
13176
- * @param swapIds {string[]}
13177
- * @return {Promise<{
13178
- * result: true,
13179
- * swaps: ExistingSwapWithFiatData[]
13180
- * }|{
13181
- * result: false,
13182
- * reason: string
13183
- * }>}
13184
- * error reason is one of PUBLIC_SWAPS_COMMON_ERRORS
13185
- */
13186
- ;
13187
- _proto.getPublicExistingSwapDetailsAndStatus = function getPublicExistingSwapDetailsAndStatus(swapIds) {
13188
- try {
13189
- var _this9 = this;
13190
- var loggerSource = "getPublicExistingSwapDetailsAndStatus";
13191
- return Promise.resolve(_catch(function () {
13192
- return Promise.resolve(SwapUtils.getExistingSwapsDetailsWithFiatAmounts([_this9._swapProvider, _this9._fixedSwapProvider], swapIds)).then(function (result) {
13193
- if (!(result != null && result.result)) {
13194
- if (result.reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) {
13195
- SwapUtils.safeHandleRequestsLimitExceeding();
13196
- return {
13197
- result: false,
13198
- reason: PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
13199
- };
13200
- }
13201
- throw new Error("Unknown reason: " + (result == null ? void 0 : result.reason));
13202
- }
13203
- return result;
13688
+ return _temp4 && _temp4.then ? _temp4.then(_temp5) : _temp5(_temp4);
13204
13689
  });
13205
13690
  }, function (e) {
13206
13691
  improveAndRethrow(e, loggerSource);
@@ -13208,47 +13693,29 @@ var PublicSwapService = /*#__PURE__*/function () {
13208
13693
  } catch (e) {
13209
13694
  return Promise.reject(e);
13210
13695
  }
13211
- }
13212
- /**
13213
- * Retrieves the whole available swaps history by ids saved locally.
13214
- *
13215
- * @return {Promise<{
13216
- * result: true,
13217
- * swaps: ExistingSwapWithFiatData[]
13218
- * }|{
13219
- * result: false,
13220
- * reason: string
13221
- * }>}
13222
- */
13223
- ;
13224
- _proto.getPublicSwapsHistory = function getPublicSwapsHistory() {
13225
- try {
13226
- var _exit2;
13227
- var _this10 = this;
13228
- return Promise.resolve(_catch(function () {
13229
- function _temp8(_result10) {
13230
- return _exit2 ? _result10 : {
13231
- result: true,
13232
- swaps: []
13233
- };
13234
- }
13235
- var swapIds = _this10._getPublicSwapIdsSavedLocally();
13236
- var _temp7 = function () {
13237
- if (swapIds.length) {
13238
- return Promise.resolve(_this10.getPublicExistingSwapDetailsAndStatus(swapIds)).then(function (_await$_this10$getPub) {
13239
- _exit2 = 1;
13240
- return _await$_this10$getPub;
13241
- });
13242
- }
13243
- }();
13244
- return _temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7);
13245
- }, function (e) {
13246
- improveAndRethrow(e, "getPublicSwapsHistory");
13247
- }));
13248
- } catch (e) {
13249
- return Promise.reject(e);
13250
- }
13251
- }
13696
+ } // TODO: [feature, moderate] move to client. task_id=de4b1ddc652b4a27a472341609fcb6e4
13697
+ // /**
13698
+ // * Retrieves the whole available swaps history by ids saved locally.
13699
+ // *
13700
+ // * @return {Promise<{
13701
+ // * result: true,
13702
+ // * swaps: ExistingSwapWithFiatData[]
13703
+ // * }|{
13704
+ // * result: false,
13705
+ // * reason: string
13706
+ // * }>}
13707
+ // */
13708
+ // async getPublicSwapsHistory() {
13709
+ // try {
13710
+ // const swapIds = this._getPublicSwapIdsSavedLocally();
13711
+ // if (swapIds.length) {
13712
+ // return await this.getPublicExistingSwapDetailsAndStatus(swapIds);
13713
+ // }
13714
+ // return { result: true, swaps: [] };
13715
+ // } catch (e) {
13716
+ // improveAndRethrow(e, "getPublicSwapsHistory");
13717
+ // }
13718
+ // }
13252
13719
  /**
13253
13720
  * @param swapId {string}
13254
13721
  * @private
@@ -13282,16 +13749,6 @@ var PublicSwapService = /*#__PURE__*/function () {
13282
13749
  }
13283
13750
  }
13284
13751
 
13285
- /**
13286
- * @param coinOrTicker {Coin|string}
13287
- * @param [isFixed=true] {boolean} rate type
13288
- * @return {string} icon URL (ready to use)
13289
- */;
13290
- _proto.getAssetIconUrl = function getAssetIconUrl(coinOrTicker, isFixed) {
13291
- // TODO: [feature, high] improve this logic - currently hacked to show better icons from fixed provider. task_id=3b6b8c2a9df04a86aaff2e070424b64f
13292
- return this._fixedSwapProvider.getIconUrl(coinOrTicker);
13293
- }
13294
-
13295
13752
  /**
13296
13753
  * @param ticker {string}
13297
13754
  * @return {Coin|null}
@@ -13302,133 +13759,19 @@ var PublicSwapService = /*#__PURE__*/function () {
13302
13759
  }
13303
13760
 
13304
13761
  /**
13305
- * TODO: [feature, moderate] add other fiat currencies support. task_id=5490e21b8b9c4f89a2247b28db3c9e0a
13306
- * @param asset {Coin}
13307
- * @return {Promise<string|null>}
13308
- */;
13309
- _proto.getAssetToUsdtRate = function getAssetToUsdtRate(asset) {
13310
- try {
13311
- var _temp13 = function _temp13() {
13312
- function _temp11() {
13313
- var _result$rate, _result12;
13314
- return (_result$rate = (_result12 = result) == null ? void 0 : _result12.rate) != null ? _result$rate : null;
13315
- }
13316
- var _temp10 = _catch(function () {
13317
- var _temp9 = function (_result13) {
13318
- if (((_result13 = result) == null ? void 0 : _result13.rate) == null) {
13319
- return Promise.resolve(_this11._fixedSwapProvider.getCoinToUSDTRate(asset)).then(function (_this11$_fixedSwapPro) {
13320
- result = _this11$_fixedSwapPro;
13321
- });
13322
- }
13323
- }();
13324
- if (_temp9 && _temp9.then) return _temp9.then(function () {});
13325
- }, function (e) {
13326
- Logger.logError(e, "getAssetToUsdtRate", "Failed via both fixed and floating providers");
13327
- });
13328
- return _temp10 && _temp10.then ? _temp10.then(_temp11) : _temp11(_temp10);
13329
- };
13330
- var _this11 = this;
13331
- var result = null;
13332
- var _temp12 = _catch(function () {
13333
- return Promise.resolve(_this11._swapProvider.getCoinToUSDTRate(asset)).then(function (_this11$_swapProvider) {
13334
- result = _this11$_swapProvider;
13335
- });
13336
- }, function (e) {
13337
- Logger.logError(e, "getAssetToUsdtRate");
13338
- });
13339
- return Promise.resolve(_temp12 && _temp12.then ? _temp12.then(_temp13) : _temp13(_temp12));
13340
- } catch (e) {
13341
- return Promise.reject(e);
13342
- }
13343
- }
13344
- /**
13345
- * @param asset {Coin}
13346
- * @param address {string}
13347
- * @param [fixed=false] {boolean}
13348
- * @return {boolean}
13349
- */
13350
- ;
13351
- _proto.isAddressValidForAsset = function isAddressValidForAsset(asset, address, fixed) {
13352
- if (fixed === void 0) {
13353
- fixed = false;
13354
- }
13355
- try {
13356
- return !fixed ? this._swapProvider.isAddressValidForAsset(asset, address) : this._fixedSwapProvider.isAddressValidForAsset(asset, address);
13357
- } catch (e) {
13358
- improveAndRethrow(e, "isAddressValidForAsset");
13359
- }
13360
- }
13361
-
13362
- /**
13363
- * Retrieves token by contract address.
13762
+ * Retrieves flat partners list across all supported providers (including aggregators).
13364
13763
  *
13365
- * @param addressString {string}
13366
- * @param [fixed=false] {boolean}
13367
- * @return {Promise<Coin|null>}
13368
- */;
13369
- _proto.getTokenByContractAddress = function getTokenByContractAddress(addressString, fixed) {
13370
- if (fixed === void 0) {
13371
- fixed = false;
13372
- }
13373
- try {
13374
- var _exit3;
13375
- var _this12 = this;
13376
- var _temp15 = _catch(function () {
13377
- if (!addressString) {
13378
- var _temp14 = null;
13379
- _exit3 = 1;
13380
- return _temp14;
13381
- }
13382
- var addressLowerCase = addressString.toLowerCase();
13383
- return Promise.resolve((fixed ? _this12._fixedSwapProvider : _this12._swapProvider).getAllSupportedCurrencies()).then(function (allCoins) {
13384
- if (allCoins.result) {
13385
- var _allCoins$coins$find = allCoins.coins.find(function (coin) {
13386
- return coin.tokenAddress && coin.tokenAddress.toLowerCase() === addressLowerCase;
13387
- });
13388
- _exit3 = 1;
13389
- return _allCoins$coins$find;
13390
- }
13391
- });
13392
- }, function (e) {
13393
- Logger.logError(e, "getTokenByContractAddress");
13394
- });
13395
- return Promise.resolve(_temp15 && _temp15.then ? _temp15.then(function (_result14) {
13396
- return _exit3 ? _result14 : null;
13397
- }) : _exit3 ? _temp15 : null);
13398
- } catch (e) {
13399
- return Promise.reject(e);
13400
- }
13401
- }
13402
- /**
13403
- * @param asset {Coin}
13404
- * @param [fixed=false] {boolean}
13405
- * @return {string|null}
13406
- */
13407
- ;
13408
- _proto.getExtraIdNameIfPresentForAsset = function getExtraIdNameIfPresentForAsset(asset, fixed) {
13409
- if (fixed === void 0) {
13410
- fixed = false;
13411
- }
13412
- try {
13413
- return (fixed ? this._fixedSwapProvider : this._swapProvider).getExtraIdNameIfPresent(asset);
13414
- } catch (e) {
13415
- improveAndRethrow(e, "getExtraIdNameIfPresentForAsset");
13416
- }
13417
- }
13418
-
13419
- /**
13420
- * Retrieves flat partners list across all supported providers (including aggregators)
13764
+ * @param providers {SwapProvider[]}
13421
13765
  * @return {Promise<Partner[]>}
13422
13766
  */;
13423
- _proto.getPartnersList = function getPartnersList() {
13767
+ _proto.getPartnersList = function getPartnersList(providers) {
13424
13768
  try {
13425
- var _temp17 = function _temp17(_result15) {
13426
- return _exit4 ? _result15 : [];
13769
+ var _temp7 = function _temp7(_result4) {
13770
+ return _exit2 ? _result4 : [];
13427
13771
  };
13428
- var _exit4;
13429
- var _this13 = this;
13430
- var _temp16 = _catch(function () {
13431
- var allPartners = [_this13._swapProvider, _this13._fixedSwapProvider].map(function (provider) {
13772
+ var _exit2;
13773
+ var _temp6 = _catch(function () {
13774
+ var allPartners = providers.map(function (provider) {
13432
13775
  return provider.getPartnersList();
13433
13776
  });
13434
13777
  return Promise.resolve(Promise.all(allPartners)).then(function (_Promise$all) {
@@ -13448,13 +13791,13 @@ var PublicSwapService = /*#__PURE__*/function () {
13448
13791
  }
13449
13792
  return prev;
13450
13793
  }, []);
13451
- _exit4 = 1;
13794
+ _exit2 = 1;
13452
13795
  return _allPartners$reduce;
13453
13796
  });
13454
13797
  }, function (e) {
13455
13798
  Logger.logError(e, "getPartnersList");
13456
13799
  });
13457
- return Promise.resolve(_temp16 && _temp16.then ? _temp16.then(_temp17) : _temp17(_temp16));
13800
+ return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(_temp7) : _temp7(_temp6));
13458
13801
  } catch (e) {
13459
13802
  return Promise.reject(e);
13460
13803
  }
@@ -13509,6 +13852,7 @@ exports.DialogStep = DialogStep;
13509
13852
  exports.EmailsApi = EmailsApi;
13510
13853
  exports.ExistingSwap = ExistingSwap;
13511
13854
  exports.ExistingSwapWithFiatData = ExistingSwapWithFiatData;
13855
+ exports.ExolixSwapProvider = ExolixSwapProvider;
13512
13856
  exports.ExternalApiProvider = ExternalApiProvider;
13513
13857
  exports.FALLBACK_ASSET_ICON_URL = FALLBACK_ASSET_ICON_URL;
13514
13858
  exports.FiatCurrenciesService = FiatCurrenciesService;