@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rabbitio/ui-kit",
3
- "version": "1.0.0-beta.89",
3
+ "version": "1.0.0-beta.90",
4
4
  "description": "Rabbit.io react.js components kit",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
package/src/index.js CHANGED
@@ -91,6 +91,7 @@ export { SwapProviderCoinInfo } from "./swaps-lib/models/swapProviderCoinInfo.js
91
91
  export { SwapProvider } from "./swaps-lib/external-apis/swapProvider.js";
92
92
  export { SwapspaceSwapProvider } from "./swaps-lib/external-apis/swapspaceSwapProvider.js";
93
93
  export { LetsExchangeSwapProvider } from "./swaps-lib/external-apis/letsExchangeSwapProvider.js";
94
+ export { ExolixSwapProvider } from "./swaps-lib/external-apis/exolixSwapProvider.js";
94
95
  export { SwapUtils } from "./swaps-lib/utils/swapUtils.js";
95
96
  export { PublicSwapService } from "./swaps-lib/services/publicSwapService.js";
96
97
  export { Partner, KYC_LEVELS } from "./swaps-lib/models/partner.js";
@@ -0,0 +1,576 @@
1
+ import axios from "axios";
2
+ import BigNumber from "bignumber.js";
3
+
4
+ import { improveAndRethrow } from "../../common-apis/utils/errorUtils";
5
+ import { DEFAULT_CRYPTO_DECIMAL_COUNT, FALLBACK_ASSET_ICON_URL } from "../../common-apis/globalConstants";
6
+ import { Logger } from "../../common-apis/utils/logging/logger";
7
+ import { Coin } from "../../common-apis/models/coin";
8
+ import { Protocol } from "../../common-apis/models/protocol";
9
+ import { safeStringify } from "../../common-apis/utils/safeStringify";
10
+ import { AmountUtils } from "../../common-apis/utils/amountUtils";
11
+ import { toRabbitTicker } from "../../common-apis/utils/rabbitTicker";
12
+
13
+ import { SwapProvider } from "./swapProvider";
14
+ import { ExistingSwap } from "../models/existingSwap";
15
+ import { Partner } from "../models/partner";
16
+ import { SwapProviderCoinInfo } from "../models/swapProviderCoinInfo";
17
+
18
+ export class ExolixSwapProvider extends SwapProvider {
19
+ constructor(
20
+ apiKeysProxyUrl,
21
+ cache,
22
+ customCoinBuilder = (coin, network) => null,
23
+ useRestrictedCoinsSet = true,
24
+ apiKey = ""
25
+ ) {
26
+ super("exolix", cache, customCoinBuilder, useRestrictedCoinsSet, false, true);
27
+ this._partners = [];
28
+ this._URL = apiKey ? "https://exolix.com/api/v2" : `${apiKeysProxyUrl}/${this.id}`;
29
+ this.COINS_EXPIRATION_TIME_MS = 5 * 60 * 1000;
30
+ this.coinsLastUpdateTimestamp = null;
31
+ this.headers = apiKey ? { Authorization: "Bearer " + apiKey } : {};
32
+ }
33
+
34
+ axiosGetPreset = {
35
+ headers: this.headers,
36
+ validateStatus: responseCode => [200, 201, 404].find(code => code === responseCode),
37
+ };
38
+
39
+ getSwapCreationInfoTtlMs() {
40
+ return 110000;
41
+ }
42
+
43
+ async _fetchSupportedCurrenciesIfNeeded() {
44
+ const loggerSource = "_fetchSupportedCurrenciesIfNeeded";
45
+ const pageSize = 100;
46
+ try {
47
+ if (this._shouldCoinsListBeLoaded()) {
48
+ let page = 1;
49
+ let allCoins = [];
50
+
51
+ while (true) {
52
+ const responseRaw = await axios.get(this._URL + "/currencies", {
53
+ ...this.axiosGetPreset,
54
+ params: { withNetworks: true, page: page, size: pageSize },
55
+ });
56
+
57
+ const response = responseRaw?.data;
58
+
59
+ // Validating the response
60
+ if (
61
+ responseRaw.status !== 200 ||
62
+ !response ||
63
+ typeof response?.data !== "object" ||
64
+ typeof response?.count !== "number" ||
65
+ response?.count < 1 ||
66
+ response?.count > 1000 ||
67
+ typeof response?.errors === "object"
68
+ ) {
69
+ const errorMessages = response?.errors
70
+ ? ". Errors - " +
71
+ Object.keys(response?.errors)
72
+ .map(errorCode => errorCode + ": " + response?.errors[errorCode])
73
+ .join(", ")
74
+ : "";
75
+ throw new Error("Failed to load the currencies list for Exolix" + errorMessages);
76
+ }
77
+
78
+ allCoins.push(...response.data);
79
+
80
+ if (page >= Math.floor(response.count / pageSize)) break;
81
+ page++;
82
+ }
83
+
84
+ this._supportedCoins = allCoins
85
+ .map(item => {
86
+ const code = item.code.toUpperCase();
87
+
88
+ if (!Array.isArray(item.networks)) return [];
89
+
90
+ return item.networks.map(networkDetails => {
91
+ const network = networkDetails.network;
92
+ const networkShortAdaptive =
93
+ networkDetails.shortName === "" || !networkDetails?.shortName
94
+ ? networkDetails.network
95
+ : networkDetails.shortName;
96
+ let coin =
97
+ this._customCoinBuilder != null
98
+ ? this._customCoinBuilder(code, code !== network ? networkShortAdaptive : "")
99
+ : null;
100
+ if (!coin && !this.useRestrictedCoinsSet) {
101
+ const name = item.name;
102
+ const ticker = toRabbitTicker(code, code === network ? "" : networkShortAdaptive);
103
+ const defaultDecimalPlacesForCoinNotSupportedOOB = DEFAULT_CRYPTO_DECIMAL_COUNT;
104
+ const defaultMinConfirmationsForCoinNotSupportedOOB = 1;
105
+ coin = new Coin(
106
+ name,
107
+ ticker,
108
+ code,
109
+ defaultDecimalPlacesForCoinNotSupportedOOB,
110
+ null,
111
+ "",
112
+ null,
113
+ null,
114
+ defaultMinConfirmationsForCoinNotSupportedOOB,
115
+ null,
116
+ [],
117
+ 60000,
118
+ null,
119
+ code !== network ? new Protocol(networkShortAdaptive) : null,
120
+ null,
121
+ false
122
+ );
123
+ }
124
+ if (coin) {
125
+ return new SwapProviderCoinInfo(
126
+ coin,
127
+ item.code,
128
+ network,
129
+ !!networkDetails.memoNeeded,
130
+ networkDetails.memoName ?? null,
131
+ 0,
132
+ item.icon ? item.icon : FALLBACK_ASSET_ICON_URL,
133
+ true,
134
+ true,
135
+ networkDetails.addressRegex ?? null,
136
+ true
137
+ );
138
+ }
139
+ return [];
140
+ });
141
+ })
142
+ .flat();
143
+ this._supportedCoinsLastUpdateTimestamp = Date.now();
144
+ this._putPopularCoinsFirst();
145
+ await super._fetchSupportedCurrenciesIfNeeded();
146
+ }
147
+ } catch (e) {
148
+ improveAndRethrow(e, loggerSource);
149
+ }
150
+ }
151
+
152
+ async getSwapInfo(
153
+ fromCoin,
154
+ toCoin,
155
+ amountCoins,
156
+ fixed = false,
157
+ fromCoinToUsdRate = null,
158
+ amountIsToReceive = false,
159
+ bannedPartners = []
160
+ ) {
161
+ const loggerSource = "getSwapInfo";
162
+
163
+ const validateAndProcessLimits = (
164
+ fromAmount,
165
+ toAmount,
166
+ fromCoin,
167
+ toCoin,
168
+ amountCoins,
169
+ amountIsToReceive,
170
+ minAmount,
171
+ maxAmount,
172
+ rate,
173
+ status
174
+ ) => {
175
+ let min;
176
+ let max;
177
+ let returnObject;
178
+
179
+ if (typeof minAmount === "number" && minAmount > 0)
180
+ min = AmountUtils.trim(minAmount, amountIsToReceive ? toCoin.digits : fromCoin.digits);
181
+ if (typeof maxAmount === "number" && maxAmount > 0)
182
+ max = AmountUtils.trim(maxAmount, amountIsToReceive ? toCoin.digits : fromCoin.digits);
183
+
184
+ if (
185
+ status !== 200 ||
186
+ typeof fromAmount !== "number" ||
187
+ typeof toAmount !== "number" ||
188
+ typeof minAmount !== "number" ||
189
+ typeof maxAmount !== "number" ||
190
+ BigNumber(rate).lte("0") ||
191
+ BigNumber(fromAmount).lte("0") ||
192
+ BigNumber(toAmount).lte("0")
193
+ ) {
194
+ let reason = SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED;
195
+
196
+ if (min && BigNumber(amountCoins).lt(min)) {
197
+ reason = SwapProvider.NO_SWAPS_REASONS.TOO_LOW;
198
+ } else if (max && BigNumber(amountCoins).gt(max)) {
199
+ reason = SwapProvider.NO_SWAPS_REASONS.TOO_HIGH;
200
+ }
201
+
202
+ returnObject = {
203
+ result: false,
204
+ reason: reason,
205
+ smallestMin: min,
206
+ greatestMax: max,
207
+ };
208
+ }
209
+
210
+ return [returnObject, min, max];
211
+ };
212
+
213
+ try {
214
+ if (
215
+ !(fromCoin instanceof Coin) ||
216
+ !(toCoin instanceof Coin) ||
217
+ typeof amountCoins !== "string" ||
218
+ BigNumber(amountCoins).lt("0") ||
219
+ (fixed !== null && typeof fixed !== "boolean")
220
+ ) {
221
+ throw new Error(
222
+ `Wrong input params: ${amountCoins} ${fromCoin.ticker} -> ${toCoin.ticker}, ${
223
+ fromCoin instanceof Coin
224
+ }, ${toCoin instanceof Coin}, ${typeof fixed} ${fixed}, ${amountIsToReceive}`
225
+ );
226
+ }
227
+ const fromCoinDetails = this._supportedCoins.find(i => i.coin?.ticker === fromCoin?.ticker);
228
+ const toCoinDetails = this._supportedCoins.find(i => i.coin?.ticker === toCoin?.ticker);
229
+ if (
230
+ !fromCoinDetails ||
231
+ !toCoinDetails ||
232
+ !fromCoinDetails.deposit ||
233
+ !fromCoinDetails.isAvailable ||
234
+ !toCoinDetails.withdrawal ||
235
+ !toCoinDetails.isAvailable
236
+ ) {
237
+ return {
238
+ result: false,
239
+ reason: SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED,
240
+ };
241
+ }
242
+
243
+ const response = await axios.get(this._URL + "/rate", {
244
+ ...this.axiosGetPreset,
245
+ params: {
246
+ coinFrom: fromCoinDetails.code,
247
+ networkFrom: fromCoinDetails.network,
248
+ coinTo: toCoinDetails.code,
249
+ networkTo: toCoinDetails.network,
250
+ amount: amountIsToReceive ? undefined : amountCoins,
251
+ withdrawalAmount: amountIsToReceive ? amountCoins : undefined,
252
+ rateType: fixed ? "fixed" : "float",
253
+ },
254
+ });
255
+ Logger.log(`Retrieved ${response?.data}`, loggerSource);
256
+ if (typeof response?.data !== "object") {
257
+ Logger.log(`Swap response didn't include the data object ${safeStringify(e)}`, loggerSource);
258
+ return { result: false, reason: SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED };
259
+ }
260
+
261
+ const data = response?.data;
262
+ const [returnObject, min, max] = validateAndProcessLimits(
263
+ data?.fromAmount,
264
+ data?.toAmount,
265
+ fromCoin,
266
+ toCoin,
267
+ amountCoins,
268
+ amountIsToReceive,
269
+ data?.minAmount,
270
+ data?.maxAmount,
271
+ data?.rate,
272
+ response?.status
273
+ );
274
+ if (returnObject) return returnObject;
275
+
276
+ if (min && max & BigNumber(max).lt(min)) {
277
+ Logger.log(
278
+ `Exolix swap info failed, max limit is below the min one. ${safeStringify(response)}`,
279
+ loggerSource
280
+ );
281
+ return { result: false, reason: SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED };
282
+ }
283
+
284
+ const rate = amountIsToReceive
285
+ ? BigNumber(amountCoins).div(data.fromAmount)
286
+ : BigNumber(data.toAmount).div(amountCoins);
287
+
288
+ return {
289
+ result: true,
290
+ min: min ?? null,
291
+ max: max ?? null,
292
+ smallestMin: min ?? null,
293
+ greatestMax: max ?? null,
294
+ rate: AmountUtils.trim(rate, this._maxRateDigits),
295
+ durationMinutesRange: null,
296
+ fixed: fixed,
297
+ rawSwapData: data,
298
+ isRefundAddressRequired: false,
299
+ };
300
+ } catch (e) {
301
+ const status = e?.response?.status;
302
+ const data = e?.response?.data;
303
+ if (status === 429) {
304
+ return {
305
+ result: false,
306
+ reason: SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED,
307
+ };
308
+ }
309
+
310
+ const [returnObject, min, max] = validateAndProcessLimits(
311
+ data?.fromAmount,
312
+ data?.toAmount,
313
+ fromCoin,
314
+ toCoin,
315
+ amountCoins,
316
+ amountIsToReceive,
317
+ data?.minAmount,
318
+ data?.maxAmount,
319
+ data?.rate,
320
+ e?.response?.status
321
+ );
322
+ if (returnObject) return returnObject;
323
+
324
+ if (e?.response?.status === 400 || e?.response?.data?.error || e?.response?.data?.errors) {
325
+ const errorMessages = e?.response?.data?.errors
326
+ ? ". Errors - " +
327
+ Object.keys(e?.response?.data?.errors)
328
+ .map(errorCode => errorCode + ": " + e?.response?.data?.errors[errorCode])
329
+ .join(", ")
330
+ : "";
331
+ Logger.log(
332
+ "Failed to estimate swap for Exolix (" +
333
+ e?.response?.status +
334
+ ")" +
335
+ errorMessages +
336
+ ` ${safeStringify(e)}`,
337
+ loggerSource
338
+ );
339
+ } else {
340
+ Logger.log(`Internal error when getting swap options ${safeStringify(e)}`, loggerSource);
341
+ }
342
+ improveAndRethrow(e, loggerSource);
343
+ }
344
+ }
345
+
346
+ async createSwap(
347
+ fromCoin,
348
+ toCoin,
349
+ amount,
350
+ toAddress,
351
+ refundAddress,
352
+ proprietarySwapEstimationData,
353
+ clientIpAddress,
354
+ fixed,
355
+ toCurrencyExtraId = "",
356
+ refundExtraId = "",
357
+ amountIsToReceive = false
358
+ ) {
359
+ const loggerSource = "createSwap";
360
+
361
+ try {
362
+ if (
363
+ !(fromCoin instanceof Coin) ||
364
+ !(toCoin instanceof Coin) ||
365
+ typeof amount !== "string" ||
366
+ typeof toAddress !== "string" ||
367
+ typeof refundAddress !== "string" ||
368
+ typeof fixed != "boolean"
369
+ ) {
370
+ throw new Error(
371
+ `Invalid input: ${fromCoin} ${toCoin} ${amount} ${toAddress} ${refundAddress} ${fixed}`
372
+ );
373
+ }
374
+ await this._fetchSupportedCurrenciesIfNeeded();
375
+ const fromCoinExtended = this._supportedCoins.find(item => item.coin.ticker == fromCoin.ticker);
376
+ const toCoinExtended = this._supportedCoins.find(item => item.coin.ticker == toCoin.ticker);
377
+ if (!fromCoinExtended || !toCoinExtended) {
378
+ throw new Error("Failed to find coin details for: " + fromCoin.ticker + " -> " + toCoin.ticker);
379
+ }
380
+ const fromCurrencyHasExtraId = fromCoinExtended.hasExtraId;
381
+ const toCurrencyHasExtraId = toCoinExtended.hasExtraId;
382
+ const requestData = {
383
+ coinFrom: fromCoinExtended.code,
384
+ networkFrom: fromCoinExtended.network,
385
+ coinTo: toCoinExtended.code,
386
+ networkTo: toCoinExtended.network,
387
+ amount: amountIsToReceive ? undefined : amount,
388
+ withdrawalAmount: amountIsToReceive ? amount : undefined,
389
+ withdrawalAddress: toAddress,
390
+ withdrawalExtraId: toCurrencyHasExtraId ? toCurrencyExtraId ?? "" : "",
391
+ refundAddress: refundAddress,
392
+ refundExtraId: fromCurrencyHasExtraId ? refundExtraId ?? "" : "",
393
+ rateType: fixed ? "fixed" : "float",
394
+ };
395
+
396
+ Logger.log(`Sending create request: ${safeStringify(requestData)}`, loggerSource);
397
+ const response = await axios.post(this._URL + "/transactions", requestData, this.axiosGetPreset);
398
+ const result = response?.data;
399
+ Logger.log(`Creation result ${safeStringify(result)}`, loggerSource);
400
+
401
+ if (
402
+ !result?.id ||
403
+ typeof result?.id !== "string" ||
404
+ typeof result?.amount !== "number" ||
405
+ typeof result?.amountTo !== "number" ||
406
+ typeof result?.depositAddress !== "string" ||
407
+ typeof result?.withdrawalAddress !== "string" ||
408
+ !(result?.rateType === "fixed" || result?.rateType === "float")
409
+ ) {
410
+ let errorMessage;
411
+ errorMessage = result?.id
412
+ ? "Swap was created but the data was incorrect: " + safeStringify(response)
413
+ : "Swap creation failed, API response: " + safeStringify(response);
414
+
415
+ Logger.log(errorMessage, loggerSource);
416
+ throw new Error(errorMessage);
417
+ }
418
+
419
+ let rate;
420
+ if (typeof rate !== "number" || BigNumber(result?.rate).isZero()) {
421
+ rate = BigNumber(result?.amountTo).div(result?.amount);
422
+ } else {
423
+ rate = BigNumber(result?.rate);
424
+ }
425
+
426
+ return {
427
+ result: true,
428
+ swapId: result?.id,
429
+ fromCoin: fromCoin,
430
+ fromAmount: AmountUtils.trim(result?.amount, fromCoin.digits),
431
+ fromAddress: result?.depositAddress,
432
+ toCoin: toCoin,
433
+ toAmount: AmountUtils.trim(result?.amountTo, toCoin.digits),
434
+ toAddress: result?.withdrawalAddress,
435
+ fromCurrencyExtraId: result?.withdrawalExtraId ?? "",
436
+ rate: AmountUtils.trim(rate, this._maxRateDigits),
437
+ fixed: result?.rateType === "fixed",
438
+ };
439
+ } catch (e) {
440
+ const composeFailResult = reason => ({
441
+ result: false,
442
+ reason: reason,
443
+ });
444
+ if (
445
+ e?.response?.status === 400 ||
446
+ e?.response?.data?.message?.includes("Amount to exchange is higher") ||
447
+ e?.response?.data?.message?.includes("Amount to exchange is below")
448
+ ) {
449
+ return composeFailResult(SwapProvider.CREATION_FAIL_REASONS.RETRIABLE_FAIL);
450
+ }
451
+ if (e?.response?.status === 422 && e?.response?.data.error === "Such exchange pair is not available") {
452
+ Logger.log(`Unable to create a swap with a not available currency ${e?.response?.data}`, loggerSource);
453
+ return composeFailResult(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
454
+ }
455
+ if (e?.response?.status === 429) {
456
+ Logger.log(`Returning fail - RPS limit exceeded ${e?.response?.data}`, loggerSource);
457
+ return composeFailResult(SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED);
458
+ }
459
+ Logger.log(`Internal error for swap: ${safeStringify(e)}`, loggerSource);
460
+ improveAndRethrow(e, loggerSource);
461
+ }
462
+ }
463
+
464
+ async getExistingSwapsDetailsAndStatus(swapIds) {
465
+ const loggerSource = "getExistingSwapsDetailsAndStatus";
466
+ try {
467
+ if (swapIds.find(id => typeof id !== "string")) {
468
+ throw new Error("Swap id is not string: " + safeStringify(swapIds));
469
+ }
470
+ const getSwap = async swapId => {
471
+ try {
472
+ return await axios.get(this._URL + "/transactions/" + swapId, this.axiosGetPreset);
473
+ } catch (error) {
474
+ if (error?.response?.status === 404) return [];
475
+ throw error;
476
+ }
477
+ };
478
+ const responses = await Promise.all(swapIds.map(swapId => getSwap(swapId)));
479
+ const fetchedSwaps = responses.flat();
480
+ Logger.log("All swaps RAW: " + JSON.stringify(fetchedSwaps.map(r => r.data)), loggerSource);
481
+
482
+ const swaps = fetchedSwaps
483
+ .map(r => r.data)
484
+ .map((swap, index) => {
485
+ const fromCoin = this._supportedCoins.find(
486
+ i => i.code === swap.coinFrom.coinCode && i.network === swap.coinFrom.network
487
+ )?.coin;
488
+ const toCoin = this._supportedCoins.find(
489
+ i => i.code === swap.coinTo.coinCode && i.network === swap.coinTo.network
490
+ )?.coin;
491
+ if (!fromCoin || !toCoin) {
492
+ return []; // We skip swaps with not supported coins for now
493
+ }
494
+
495
+ const toUtcTimestamp = timeStr => Date.parse(timeStr.match(/.+[Zz]$/) ? timeStr : `${timeStr}Z`);
496
+ const createdAt = toUtcTimestamp(swap.createdAt);
497
+ const expiresAt = createdAt + 25 * 60 * 1000; // Hack with hard-coded 25 minutes
498
+ const isExpiredByTime = expiresAt < Date.now();
499
+ const status = this._mapExolixStatusToRabbitStatus(swap.status, isExpiredByTime);
500
+ const toDigits = status === SwapProvider.SWAP_STATUSES.REFUNDED ? fromCoin.digits : toCoin.digits;
501
+ return new ExistingSwap(
502
+ swapIds[index],
503
+ status,
504
+ createdAt,
505
+ expiresAt,
506
+ -1,
507
+ AmountUtils.trim(swap.rate, this._maxRateDigits),
508
+ swap?.rateType === "fixed",
509
+ swap.refundAddress,
510
+ swap.depositAddress,
511
+ fromCoin,
512
+ AmountUtils.trim(swap.amount, fromCoin.digits),
513
+ swap.hashIn.hash,
514
+ swap.hashIn.link,
515
+ toCoin,
516
+ AmountUtils.trim(swap.amountTo, toDigits),
517
+ swap.hashOut.hash,
518
+ swap.hashOut.link,
519
+ swap.withdrawalAddress,
520
+ this.id,
521
+ swap.depositExtraId ?? null,
522
+ swap.withdrawalExtraId ?? null,
523
+ swap.refundExtraId ?? null
524
+ );
525
+ })
526
+ .flat();
527
+ Logger.log(`Swap details result ${safeStringify(swaps)}`, loggerSource);
528
+ return { result: true, swaps: swaps };
529
+ } catch (e) {
530
+ Logger.logError(e, loggerSource, `Failed to get swap details. Error is: ${safeStringify(e)}`);
531
+ const composeFailResult = reason => ({
532
+ result: false,
533
+ reason: reason,
534
+ });
535
+ const status = e?.response?.status;
536
+ const data = e?.response?.data;
537
+ if (status === 429) {
538
+ Logger.log(`Returning fail - RPS limit exceeded ${data}`, loggerSource);
539
+ return composeFailResult(SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED);
540
+ }
541
+ improveAndRethrow(e, loggerSource);
542
+ }
543
+ }
544
+
545
+ _mapExolixStatusToRabbitStatus(status, isExpiredByTime) {
546
+ switch (status) {
547
+ case "wait":
548
+ if (isExpiredByTime) {
549
+ return SwapProvider.SWAP_STATUSES.EXPIRED;
550
+ }
551
+ return SwapProvider.SWAP_STATUSES.WAITING_FOR_PAYMENT;
552
+ case "confirmation":
553
+ return SwapProvider.SWAP_STATUSES.CONFIRMING;
554
+ case "confirmed":
555
+ return SwapProvider.SWAP_STATUSES.PAYMENT_RECEIVED;
556
+ case "exchanging":
557
+ return SwapProvider.SWAP_STATUSES.EXCHANGING;
558
+ case "sending":
559
+ return SwapProvider.SWAP_STATUSES.EXCHANGING;
560
+ case "success":
561
+ return SwapProvider.SWAP_STATUSES.COMPLETED;
562
+ case "overdue":
563
+ return SwapProvider.SWAP_STATUSES.EXPIRED;
564
+ case "refunded":
565
+ return SwapProvider.SWAP_STATUSES.REFUNDED;
566
+ default:
567
+ throw new Error(`Unknown Exolix status: ${status}`);
568
+ }
569
+ }
570
+
571
+ async getPartnersList() {
572
+ return [
573
+ new Partner(this.id, "Exolix", "https://storage.swapspace.co/static/9WRkfc_QCUUmOBTcvgC9p57l9.svg", null),
574
+ ];
575
+ }
576
+ }
@@ -21,10 +21,9 @@ export class LetsExchangeSwapProvider extends SwapProvider {
21
21
  useRestrictedCoinsSet = true,
22
22
  apiKey = null
23
23
  ) {
24
- super("letsexchange", cache, customCoinBuilder, useRestrictedCoinsSet);
24
+ super("letsexchange", cache, customCoinBuilder, useRestrictedCoinsSet, false, true);
25
25
  this._partners = [];
26
26
  this._URL = apiKey ? `https://api.letsexchange.io/api` : `${apiKeysProxyUrl}/${this.id}`;
27
- this.isAggregator = false;
28
27
  this._headers = apiKey
29
28
  ? {
30
29
  Authorization: `Bearer ${apiKey}`,
@@ -118,7 +117,8 @@ export class LetsExchangeSwapProvider extends SwapProvider {
118
117
  amountCoins,
119
118
  fixed = false,
120
119
  fromCoinToUsdRate = null,
121
- amountIsToReceive = false
120
+ amountIsToReceive = false,
121
+ bannedPartners = []
122
122
  ) {
123
123
  const loggerSource = "getSwapInfo";
124
124
  let min = null;
@@ -265,7 +265,7 @@ export class LetsExchangeSwapProvider extends SwapProvider {
265
265
  amount,
266
266
  toAddress,
267
267
  refundAddress,
268
- rawSwapData,
268
+ proprietarySwapEstimationData,
269
269
  clientIpAddress,
270
270
  fixed,
271
271
  toCurrencyExtraId = "",
@@ -287,8 +287,11 @@ export class LetsExchangeSwapProvider extends SwapProvider {
287
287
  `Invalid input: ${fromCoin} ${toCoin} ${amount} ${toAddress} ${refundAddress} ${fixed}`
288
288
  );
289
289
  }
290
- if (typeof rawSwapData !== "object" || (fixed && !rawSwapData.rate_id)) {
291
- throw new Error(`Invalid raw swap data: ${safeStringify(rawSwapData)}`);
290
+ if (
291
+ typeof proprietarySwapEstimationData !== "object" ||
292
+ (fixed && !proprietarySwapEstimationData.rate_id)
293
+ ) {
294
+ throw new Error(`Invalid raw swap data: ${safeStringify(proprietarySwapEstimationData)}`);
292
295
  }
293
296
 
294
297
  await this._fetchSupportedCurrenciesIfNeeded();
@@ -315,7 +318,7 @@ export class LetsExchangeSwapProvider extends SwapProvider {
315
318
  requestBody.deposit_amount = amount;
316
319
  }
317
320
  if (fixed) {
318
- requestBody.rate_id = rawSwapData.rate_id;
321
+ requestBody.rate_id = proprietarySwapEstimationData.rate_id;
319
322
  }
320
323
  const response = await axios.post(
321
324
  `${this._URL}/v1/transaction${amountIsToReceive ? "-revert" : `?float=${!fixed}`}`,
@@ -371,7 +374,7 @@ export class LetsExchangeSwapProvider extends SwapProvider {
371
374
  const loggerSource = "getExistingSwapsDetailsAndStatus";
372
375
  try {
373
376
  if (swapIds.find(id => typeof id !== "string")) {
374
- throw new Error("Swap id is not string: " + safeStringify(swapIds));
377
+ throw new Error("Swap id is not string: " + safeStringify(swapIds) + " " + this.id);
375
378
  }
376
379
  const response = await axios.get(`${this._URL}/v1/transactions-list?ids[]=${swapIds.join("&ids[]=")}`, {
377
380
  headers: this._headers,