@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
@@ -56,138 +56,18 @@ export class PublicSwapService {
56
56
  }
57
57
  }
58
58
 
59
- /**
60
- * Gets all currencies across all partners. Useful for sitemap or supported currencies count/list.
61
- *
62
- * @return {Promise<{result: boolean, coins: Coin[]}|{result: boolean, reason: string}>}
63
- */
64
- async getAllSupportedCurrenciesListForPublicSwap() {
65
- const loggerSource = "getAllSupportedCurrenciesListForPublicSwap";
66
- try {
67
- await this.initialize();
68
- const result = await Promise.all([
69
- this._fixedSwapProvider.getAllSupportedCurrencies(),
70
- this._swapProvider.getAllSupportedCurrencies(),
71
- ]);
72
- const allCoins = [...(result[0].coins ?? [])];
73
- (result[1].coins ?? []).forEach(c => {
74
- if (!allCoins.find(existingCoin => existingCoin.ticker === c.ticker)) {
75
- allCoins.push(c);
76
- }
77
- });
78
- if (
79
- result[0].reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED ||
80
- result[1].reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
81
- ) {
82
- SwapUtils.safeHandleRequestsLimitExceeding();
83
- // TODO: [dev] improve this during the whitebit integration. task_id=20e7e41211b540d081bf98f392a34b2c
84
- // return {
85
- // result: false,
86
- // reason: PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED,
87
- // };
88
- } else if (result[0].reason || result[1].reason) {
89
- console.log("Failed to get all supported coins", result[0].reason, result[1].reason);
90
- }
91
- Logger.log(`Retrieved ${result?.coins?.length} supported currencies for swap`, loggerSource);
92
- return { result: true, coins: allCoins };
93
- } catch (e) {
94
- improveAndRethrow(e, "getAllSupportedCurrenciesListForPublicSwap");
95
- }
96
- }
97
-
98
- async getDepositCurrenciesListForPublicSwap(fixed = false) {
99
- try {
100
- return await this._getCurrenciesListForPublicSwap(false, fixed);
101
- } catch (e) {
102
- improveAndRethrow(e, "getDepositCurrenciesListForPublicSwap");
103
- }
104
- }
105
-
106
- async getWithdrawCurrenciesListForPublicSwap(fixed = false) {
107
- try {
108
- return await this._getCurrenciesListForPublicSwap(true, fixed);
109
- } catch (e) {
110
- improveAndRethrow(e, "getWithdrawCurrenciesListForPublicSwap");
111
- }
112
- }
113
-
114
- async _getCurrenciesListForPublicSwap(withdraw = false, fixed = false) {
115
- const loggerSource = "getCurrenciesListForPublicSwap";
116
- try {
117
- const provider = fixed ? this._fixedSwapProvider : this._swapProvider;
118
- const result = withdraw ? await provider.getWithdrawalCurrencies() : await provider.getDepositCurrencies();
119
- if (result.reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) {
120
- SwapUtils.safeHandleRequestsLimitExceeding();
121
- return {
122
- result: false,
123
- reason: PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED,
124
- };
125
- }
126
- Logger.log(
127
- `Retrieved ${result?.coins?.length} supported currencies for swap (withdraw=${withdraw})`,
128
- loggerSource
129
- );
130
- return { result: true, coins: result.coins };
131
- } catch (e) {
132
- improveAndRethrow(e, loggerSource);
133
- }
134
- }
135
-
136
- /**
137
- * Retrieves initial data for swapping two coins.
138
- *
139
- * Always FLOATING rate, FIXED is not supported - if you want to change it the default rate - all
140
- * the swaps code logic should be verified to align with this change.
141
- *
142
- * @param fromCoin {Coin}
143
- * @param toCoin {Coin}
144
- * @return {Promise<{
145
- * result: true,
146
- * min: string,
147
- * fiatMin: (number|null),
148
- * max: string,
149
- * fiatMax: (number|null),
150
- * rate: (string|null)
151
- * }|{
152
- * result: false,
153
- * reason: string
154
- * }>}
155
- */
156
- async getInitialPublicSwapData(fromCoin, toCoin) {
157
- try {
158
- const result = await SwapUtils.getInitialSwapData(this._swapProvider, fromCoin, toCoin);
159
- if (!result.result) {
160
- if (result.reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) {
161
- SwapUtils.safeHandleRequestsLimitExceeding();
162
- return {
163
- result: false,
164
- reason: PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED,
165
- };
166
- }
167
- if (result.reason === SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED) {
168
- return {
169
- result: false,
170
- reason: PublicSwapService.PUBLIC_SWAP_DETAILS_FAIL_REASONS.PAIR_NOT_SUPPORTED,
171
- };
172
- }
173
- }
174
- return result;
175
- } catch (e) {
176
- improveAndRethrow(e, "getInitialPublicSwapData");
177
- }
178
- }
179
-
180
59
  /**
181
60
  * Retrieves swap details that can be used to create swap.
182
61
  *
62
+ * @param provider {SwapProvider}
183
63
  * @param fromCoinOrTicker {Coin|string}
184
64
  * @param toCoinOrTicker {Coin|string}
185
65
  * @param amountCoins {string}
186
66
  * @param [fixed=false] {boolean|null} null means fixed or float doesn't matter
187
- * @param [withoutFiat=false] {boolean} pass true if you don't need the fiat equivalent - this will diminish requests count
67
+ * @param [coinUsdtRate=null] {number|null} rate of amount coin to USDT
188
68
  * @param [amountIsToReceive=false] {boolean} whether the given amount is receiving amount.
189
69
  * False means the amount is the sending amount.
190
- * @param bannedPartners {string[]} array of banned swap partners (providers) ids
70
+ * @param bannedPartners {string[]} array of banned swap partners (providers) ids (rabbit ids)
191
71
  * @return {Promise<{
192
72
  * result: false,
193
73
  * reason: string,
@@ -202,11 +82,12 @@ export class PublicSwapService {
202
82
  * }>}
203
83
  */
204
84
  async getPublicSwapDetails(
85
+ provider,
205
86
  fromCoinOrTicker,
206
87
  toCoinOrTicker,
207
88
  amountCoins,
208
89
  fixed = false,
209
- withoutFiat = false,
90
+ coinUsdtRate = null,
210
91
  amountIsToReceive = false,
211
92
  bannedPartners = []
212
93
  ) {
@@ -224,8 +105,7 @@ export class PublicSwapService {
224
105
  if (typeof toCoin === "string") {
225
106
  toCoin = this.getCoinByTickerIfPresent(toCoin);
226
107
  }
227
- const operatingPartner = fixed ? this._fixedSwapProvider : this._swapProvider;
228
- const isPartnerBanned = !!bannedPartners.find(banned => banned === operatingPartner.id);
108
+ const isPartnerBanned = !!bannedPartners.find(banned => banned === provider.id);
229
109
  if (!fromCoin || !toCoin || isPartnerBanned) {
230
110
  return {
231
111
  result: false,
@@ -238,13 +118,7 @@ export class PublicSwapService {
238
118
  };
239
119
  }
240
120
 
241
- const coinUsdtRate = withoutFiat
242
- ? null
243
- : (await operatingPartner.getCoinToUSDTRate(amountIsToReceive ? toCoin : fromCoin))?.rate ?? null;
244
-
245
- // 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
246
-
247
- const details = await operatingPartner.getSwapInfo(
121
+ const details = await provider.getSwapInfo(
248
122
  fromCoin,
249
123
  toCoin,
250
124
  amountCoins,
@@ -255,7 +129,7 @@ export class PublicSwapService {
255
129
  );
256
130
 
257
131
  // eslint-disable-next-line no-console
258
- console.log("getSwapInfo result: ", details);
132
+ console.log("getSwapInfo raw result: ", details, loggerSource);
259
133
 
260
134
  const min =
261
135
  details.smallestMin != null && BigNumber(details.smallestMin).gt("0") ? details.smallestMin : null;
@@ -331,6 +205,7 @@ export class PublicSwapService {
331
205
  fiatMax,
332
206
  details.durationMinutesRange,
333
207
  details.fixed,
208
+ provider.id,
334
209
  details.isRefundAddressRequired
335
210
  ),
336
211
  };
@@ -355,10 +230,11 @@ export class PublicSwapService {
355
230
  /**
356
231
  * Creates swap by given params.
357
232
  *
358
- * @param fromCoin {Coin}
359
- * @param toCoin {Coin}
233
+ * @param provider {SwapProvider}
234
+ * @param fromCoinTicker {string}
235
+ * @param toCoinTicker {string}
360
236
  * @param amount {string}
361
- * @param swapCreationInfo {BaseSwapCreationInfo}
237
+ * @param proprietarySwapEstimationData {Object|null}
362
238
  * @param toAddress {string}
363
239
  * @param refundAddress {string}
364
240
  * @param clientIp {string}
@@ -366,10 +242,11 @@ export class PublicSwapService {
366
242
  * @param [refundExtraId] {string}
367
243
  * @param [amountIsToReceive=false] {boolean} whether the given amount is receiving amount.
368
244
  * False means the amount is the sending amount.
245
+ * @param isFixed {boolean}
369
246
  * @return {Promise<{
370
247
  * result: true,
371
248
  * fiatCurrencyCode: string,
372
- * toCoin: Coin,
249
+ * toCoinTicker: string,
373
250
  * fromAmountFiat: (number|null),
374
251
  * address: string,
375
252
  * durationMinutesRange: string,
@@ -377,7 +254,7 @@ export class PublicSwapService {
377
254
  * toAmount: string,
378
255
  * toAmountFiat: (number|null),
379
256
  * fiatCurrencyDecimals: number,
380
- * fromCoin: Coin,
257
+ * fromCoinTicker: string,
381
258
  * rate: string,
382
259
  * swapId: string,
383
260
  * fromCurrencyExtraId: string,
@@ -388,58 +265,52 @@ export class PublicSwapService {
388
265
  * }>}
389
266
  */
390
267
  async createPublicSwap(
391
- fromCoin,
392
- toCoin,
268
+ provider,
269
+ fromCoinTicker,
270
+ toCoinTicker,
393
271
  amount,
394
- swapCreationInfo,
272
+ proprietarySwapEstimationData,
395
273
  toAddress,
396
274
  refundAddress,
397
275
  clientIp,
398
276
  toCurrencyExtraId,
399
277
  refundExtraId,
400
- amountIsToReceive = false
278
+ amountIsToReceive = false,
279
+ isFixed = false
401
280
  ) {
402
281
  const loggerSource = "createPublicSwap";
403
282
  try {
404
283
  if (
405
- !(fromCoin instanceof Coin) ||
406
- !(toCoin instanceof Coin) ||
284
+ !(provider instanceof SwapProvider) ||
285
+ typeof fromCoinTicker !== "string" ||
286
+ typeof toCoinTicker !== "string" ||
407
287
  typeof amount !== "string" ||
408
- typeof toAddress !== "string" ||
409
- (swapCreationInfo.isRefundAddressRequired &&
410
- (typeof refundAddress !== "string" || refundAddress.length === 0)) ||
411
- !(swapCreationInfo instanceof BaseSwapCreationInfo)
288
+ typeof toAddress !== "string"
412
289
  ) {
413
- throw new Error(`Wrong input: ${fromCoin.ticker} ${toCoin.ticker} ${amount} ${swapCreationInfo}`);
290
+ throw new Error(`Wrong input: ${provider} ${fromCoinTicker} ${toCoinTicker} ${amount} ${isFixed}`);
414
291
  }
292
+
415
293
  Logger.log(
416
- `Start: ${amount} ${fromCoin.ticker} -> ${toCoin.ticker}. Details: ${safeStringify({
417
- ...swapCreationInfo,
418
- fromCoin: swapCreationInfo?.fromCoin?.ticker,
419
- toCoin: swapCreationInfo?.toCoin?.ticker,
420
- })}`,
294
+ `Start: ${provider.id} ${amount} ${fromCoinTicker} -> ${toCoinTicker}. raw data: ${proprietarySwapEstimationData}`,
421
295
  loggerSource
422
296
  );
423
297
 
424
- const result = await (swapCreationInfo.fixed ? this._fixedSwapProvider : this._swapProvider).createSwap(
298
+ const [fromCoin, toCoin] = [fromCoinTicker, toCoinTicker].map(t => this.getCoinByTickerIfPresent(t));
299
+ const result = await provider.createSwap(
425
300
  fromCoin,
426
301
  toCoin,
427
302
  amount,
428
303
  toAddress,
429
304
  refundAddress,
430
- swapCreationInfo.rawSwapData,
305
+ proprietarySwapEstimationData,
431
306
  clientIp,
432
- swapCreationInfo.fixed,
307
+ isFixed,
433
308
  toCurrencyExtraId,
434
309
  refundExtraId,
435
310
  amountIsToReceive
436
311
  );
437
312
  Logger.log(
438
- `Created:${safeStringify({
439
- ...result,
440
- fromCoin: fromCoin?.ticker,
441
- toCoin: toCoin?.ticker,
442
- })}`,
313
+ `Created:${safeStringify({ ...result, fromCoin: fromCoinTicker, toCoin: toCoinTicker })}`,
443
314
  loggerSource
444
315
  );
445
316
  if (!result?.result) {
@@ -462,8 +333,8 @@ export class PublicSwapService {
462
333
  let fromAmountFiat = null,
463
334
  toAmountFiat = null;
464
335
  try {
465
- const fromCoinUsdtRate = (await this._swapProvider.getCoinToUSDTRate(fromCoin))?.rate ?? null;
466
- const toCoinUsdtRate = (await this._swapProvider.getCoinToUSDTRate(fromCoin))?.rate ?? null;
336
+ const fromCoinUsdtRate = (await provider.getCoinToUSDTRate(fromCoinTicker))?.rate ?? null;
337
+ const toCoinUsdtRate = (await provider.getCoinToUSDTRate(toCoinTicker))?.rate ?? null;
467
338
  if (fromCoinUsdtRate != null && result.fromAmount != null) {
468
339
  fromAmountFiat = BigNumber(result.fromAmount)
469
340
  .times(fromCoinUsdtRate)
@@ -481,15 +352,15 @@ export class PublicSwapService {
481
352
  await GoogleAnalyticsAdapter.sendEvent(PublicSwapService.PUBLIC_SWAP_CREATED_ANALYTICS_EVENT, {
482
353
  coin_amount: result.fromAmount,
483
354
  usd_amount: fromAmountFiat,
484
- fromCoin: fromCoin.ticker,
485
- toCoin: toCoin.ticker,
355
+ fromCoin: fromCoinTicker,
356
+ toCoin: toCoinTicker,
486
357
  });
487
358
 
488
359
  const toReturn = {
489
360
  result: true,
490
361
  swapId: result.swapId,
491
- fromCoin: fromCoin,
492
- toCoin: toCoin,
362
+ fromCoinTicker: fromCoinTicker,
363
+ toCoinTicker: toCoinTicker,
493
364
  fromAmount: result.fromAmount,
494
365
  toAmount: result.toAmount,
495
366
  fromAmountFiat: fromAmountFiat,
@@ -497,7 +368,7 @@ export class PublicSwapService {
497
368
  fiatCurrencyCode: "USD",
498
369
  fiatCurrencyDecimals: PublicSwapService._fiatDecimalsCount,
499
370
  rate: result.rate,
500
- durationMinutesRange: swapCreationInfo.durationMinutesRange,
371
+ durationMinutesRange: null, // TODO: [feature, high] add duration. task_id=3f3d73d7cf44454282222901409149b5
501
372
  address: result.fromAddress, // CRITICAL: this is the address to send coins to swaps provider
502
373
  fromCurrencyExtraId: result.fromCurrencyExtraId ?? "", // CRITICAL: this is the extra ID for address to send coins to swaps provider
503
374
  fixed: result.fixed,
@@ -508,8 +379,8 @@ export class PublicSwapService {
508
379
  Logger.log(
509
380
  `Returning: ${safeStringify({
510
381
  ...toReturn,
511
- fromCoin: fromCoin?.ticker,
512
- toCoin: toCoin?.ticker,
382
+ fromCoin: fromCoinTicker,
383
+ toCoin: toCoinTicker,
513
384
  })}`,
514
385
  loggerSource
515
386
  );
@@ -522,65 +393,29 @@ export class PublicSwapService {
522
393
  }
523
394
  }
524
395
 
525
- /**
526
- * Retrieves swap details and status for existing swaps by their ids.
527
- *
528
- * @param swapIds {string[]}
529
- * @return {Promise<{
530
- * result: true,
531
- * swaps: ExistingSwapWithFiatData[]
532
- * }|{
533
- * result: false,
534
- * reason: string
535
- * }>}
536
- * error reason is one of PUBLIC_SWAPS_COMMON_ERRORS
537
- */
538
- async getPublicExistingSwapDetailsAndStatus(swapIds) {
539
- const loggerSource = "getPublicExistingSwapDetailsAndStatus";
540
- try {
541
- const result = await SwapUtils.getExistingSwapsDetailsWithFiatAmounts(
542
- [this._swapProvider, this._fixedSwapProvider],
543
- swapIds
544
- );
545
- if (!result?.result) {
546
- if (result.reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) {
547
- SwapUtils.safeHandleRequestsLimitExceeding();
548
- return {
549
- result: false,
550
- reason: PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED,
551
- };
552
- }
553
- throw new Error("Unknown reason: " + result?.reason);
554
- }
555
-
556
- return result;
557
- } catch (e) {
558
- improveAndRethrow(e, loggerSource);
559
- }
560
- }
561
-
562
- /**
563
- * Retrieves the whole available swaps history by ids saved locally.
564
- *
565
- * @return {Promise<{
566
- * result: true,
567
- * swaps: ExistingSwapWithFiatData[]
568
- * }|{
569
- * result: false,
570
- * reason: string
571
- * }>}
572
- */
573
- async getPublicSwapsHistory() {
574
- try {
575
- const swapIds = this._getPublicSwapIdsSavedLocally();
576
- if (swapIds.length) {
577
- return await this.getPublicExistingSwapDetailsAndStatus(swapIds);
578
- }
579
- return { result: true, swaps: [] };
580
- } catch (e) {
581
- improveAndRethrow(e, "getPublicSwapsHistory");
582
- }
583
- }
396
+ // TODO: [feature, moderate] move to client. task_id=de4b1ddc652b4a27a472341609fcb6e4
397
+ // /**
398
+ // * Retrieves the whole available swaps history by ids saved locally.
399
+ // *
400
+ // * @return {Promise<{
401
+ // * result: true,
402
+ // * swaps: ExistingSwapWithFiatData[]
403
+ // * }|{
404
+ // * result: false,
405
+ // * reason: string
406
+ // * }>}
407
+ // */
408
+ // async getPublicSwapsHistory() {
409
+ // try {
410
+ // const swapIds = this._getPublicSwapIdsSavedLocally();
411
+ // if (swapIds.length) {
412
+ // return await this.getPublicExistingSwapDetailsAndStatus(swapIds);
413
+ // }
414
+ // return { result: true, swaps: [] };
415
+ // } catch (e) {
416
+ // improveAndRethrow(e, "getPublicSwapsHistory");
417
+ // }
418
+ // }
584
419
 
585
420
  /**
586
421
  * @param swapId {string}
@@ -614,16 +449,6 @@ export class PublicSwapService {
614
449
  }
615
450
  }
616
451
 
617
- /**
618
- * @param coinOrTicker {Coin|string}
619
- * @param [isFixed=true] {boolean} rate type
620
- * @return {string} icon URL (ready to use)
621
- */
622
- getAssetIconUrl(coinOrTicker, isFixed = false) {
623
- // TODO: [feature, high] improve this logic - currently hacked to show better icons from fixed provider. task_id=3b6b8c2a9df04a86aaff2e070424b64f
624
- return this._fixedSwapProvider.getIconUrl(coinOrTicker);
625
- }
626
-
627
452
  /**
628
453
  * @param ticker {string}
629
454
  * @return {Coin|null}
@@ -636,86 +461,14 @@ export class PublicSwapService {
636
461
  }
637
462
 
638
463
  /**
639
- * TODO: [feature, moderate] add other fiat currencies support. task_id=5490e21b8b9c4f89a2247b28db3c9e0a
640
- * @param asset {Coin}
641
- * @return {Promise<string|null>}
642
- */
643
- async getAssetToUsdtRate(asset) {
644
- let result = null;
645
- try {
646
- result = await this._swapProvider.getCoinToUSDTRate(asset);
647
- } catch (e) {
648
- Logger.logError(e, "getAssetToUsdtRate");
649
- }
650
- try {
651
- if (result?.rate == null) {
652
- result = await this._fixedSwapProvider.getCoinToUSDTRate(asset);
653
- }
654
- } catch (e) {
655
- Logger.logError(e, "getAssetToUsdtRate", "Failed via both fixed and floating providers");
656
- }
657
- return result?.rate ?? null;
658
- }
659
-
660
- /**
661
- * @param asset {Coin}
662
- * @param address {string}
663
- * @param [fixed=false] {boolean}
664
- * @return {boolean}
665
- */
666
- isAddressValidForAsset(asset, address, fixed = false) {
667
- try {
668
- return !fixed
669
- ? this._swapProvider.isAddressValidForAsset(asset, address)
670
- : this._fixedSwapProvider.isAddressValidForAsset(asset, address);
671
- } catch (e) {
672
- improveAndRethrow(e, "isAddressValidForAsset");
673
- }
674
- }
675
-
676
- /**
677
- * Retrieves token by contract address.
464
+ * Retrieves flat partners list across all supported providers (including aggregators).
678
465
  *
679
- * @param addressString {string}
680
- * @param [fixed=false] {boolean}
681
- * @return {Promise<Coin|null>}
682
- */
683
- async getTokenByContractAddress(addressString, fixed = false) {
684
- try {
685
- if (!addressString) return null;
686
- const addressLowerCase = addressString.toLowerCase();
687
- const allCoins = await (fixed ? this._fixedSwapProvider : this._swapProvider).getAllSupportedCurrencies();
688
- if (allCoins.result) {
689
- return allCoins.coins.find(
690
- coin => coin.tokenAddress && coin.tokenAddress.toLowerCase() === addressLowerCase
691
- );
692
- }
693
- } catch (e) {
694
- Logger.logError(e, "getTokenByContractAddress");
695
- }
696
- return null;
697
- }
698
-
699
- /**
700
- * @param asset {Coin}
701
- * @param [fixed=false] {boolean}
702
- * @return {string|null}
703
- */
704
- getExtraIdNameIfPresentForAsset(asset, fixed = false) {
705
- try {
706
- return (fixed ? this._fixedSwapProvider : this._swapProvider).getExtraIdNameIfPresent(asset);
707
- } catch (e) {
708
- improveAndRethrow(e, "getExtraIdNameIfPresentForAsset");
709
- }
710
- }
711
-
712
- /**
713
- * Retrieves flat partners list across all supported providers (including aggregators)
466
+ * @param providers {SwapProvider[]}
714
467
  * @return {Promise<Partner[]>}
715
468
  */
716
- async getPartnersList() {
469
+ async getPartnersList(providers) {
717
470
  try {
718
- let allPartners = [this._swapProvider, this._fixedSwapProvider].map(provider => provider.getPartnersList());
471
+ let allPartners = providers.map(provider => provider.getPartnersList());
719
472
  allPartners = await Promise.all(allPartners);
720
473
  allPartners = allPartners.flat().flat();
721
474
  return allPartners.reduce((prev, cur) => {
@@ -0,0 +1,34 @@
1
+ import sinon from "sinon";
2
+ import axios from "axios";
3
+ import should from "should";
4
+
5
+ import { beforeEach, afterEach, describe, it } from "vitest";
6
+
7
+ import { ExolixSwapProvider } from "../../../external-apis/exolixSwapProvider.js";
8
+ import { Cache } from "../../../../common-apis/utils/cache.js";
9
+
10
+ describe("exolixSwapProvider", function () {
11
+ describe("_fetchSupportedCurrenciesIfNeeded", function () {
12
+ const exolixSwapProvider = new ExolixSwapProvider("/", new Cache());
13
+ const anyError = new Error("Any error");
14
+
15
+ let axiosGetStub;
16
+ beforeEach(() => {
17
+ axiosGetStub = sinon.stub(axios, "get");
18
+ });
19
+
20
+ afterEach(() => {
21
+ axiosGetStub.restore();
22
+ exolixSwapProvider._supportedCoins = [];
23
+ });
24
+
25
+ it("Should throw an error if axios throws error", async () => {
26
+ axiosGetStub.resetBehavior();
27
+ axiosGetStub.rejects(anyError);
28
+
29
+ const swapProvider = new ExolixSwapProvider("/", new Cache());
30
+
31
+ return swapProvider._fetchSupportedCurrenciesIfNeeded().should.be.rejectedWith(anyError);
32
+ });
33
+ });
34
+ });