@rabbitio/ui-kit 1.0.0-beta.12 → 1.0.0-beta.121

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 (402) hide show
  1. package/.env.example +1 -0
  2. package/.gitlab-ci.yml +29 -0
  3. package/.husky/commit-msg +19 -0
  4. package/.husky/pre-push +1 -0
  5. package/README.md +14 -4
  6. package/coverage/base.css +224 -0
  7. package/coverage/block-navigation.js +87 -0
  8. package/coverage/clover.xml +19749 -0
  9. package/coverage/coverage-final.json +122 -0
  10. package/coverage/favicon.png +0 -0
  11. package/coverage/index.html +1001 -0
  12. package/coverage/prettify.css +1 -0
  13. package/coverage/prettify.js +2 -0
  14. package/coverage/rabbit-ui-kit/index.html +116 -0
  15. package/coverage/rabbit-ui-kit/index.js.html +88 -0
  16. package/coverage/rabbit-ui-kit/src/common-apis/adapters/analyticsAdapters/googleAnalyticsAdapter.js.html +151 -0
  17. package/coverage/rabbit-ui-kit/src/common-apis/adapters/analyticsAdapters/index.html +146 -0
  18. package/coverage/rabbit-ui-kit/src/common-apis/adapters/analyticsAdapters/metrikaAdapter.js.html +172 -0
  19. package/coverage/rabbit-ui-kit/src/common-apis/adapters/analyticsAdapters/mixpanelAdapter.js.html +199 -0
  20. package/coverage/rabbit-ui-kit/src/common-apis/adapters/axiosAdapter.js.html +190 -0
  21. package/coverage/rabbit-ui-kit/src/common-apis/adapters/index.html +131 -0
  22. package/coverage/rabbit-ui-kit/src/common-apis/adapters/qrUtils.js.html +139 -0
  23. package/coverage/rabbit-ui-kit/src/common-apis/external-apis/apiGroups.js.html +253 -0
  24. package/coverage/rabbit-ui-kit/src/common-apis/external-apis/emailAPI.js.html +133 -0
  25. package/coverage/rabbit-ui-kit/src/common-apis/external-apis/index.html +146 -0
  26. package/coverage/rabbit-ui-kit/src/common-apis/external-apis/ipAddressProviders.js.html +391 -0
  27. package/coverage/rabbit-ui-kit/src/common-apis/globalConstants.jsx.html +94 -0
  28. package/coverage/rabbit-ui-kit/src/common-apis/index.html +116 -0
  29. package/coverage/rabbit-ui-kit/src/common-apis/models/blockchain.js.html +115 -0
  30. package/coverage/rabbit-ui-kit/src/common-apis/models/coin.js.html +829 -0
  31. package/coverage/rabbit-ui-kit/src/common-apis/models/index.html +146 -0
  32. package/coverage/rabbit-ui-kit/src/common-apis/models/protocol.js.html +100 -0
  33. package/coverage/rabbit-ui-kit/src/common-apis/services/fiatCurrenciesService.js.html +544 -0
  34. package/coverage/rabbit-ui-kit/src/common-apis/services/index.html +116 -0
  35. package/coverage/rabbit-ui-kit/src/common-apis/utils/amountUtils.js.html +1234 -0
  36. package/coverage/rabbit-ui-kit/src/common-apis/utils/cache.js.html +811 -0
  37. package/coverage/rabbit-ui-kit/src/common-apis/utils/errorUtils.js.html +211 -0
  38. package/coverage/rabbit-ui-kit/src/common-apis/utils/index.html +191 -0
  39. package/coverage/rabbit-ui-kit/src/common-apis/utils/logging/index.html +131 -0
  40. package/coverage/rabbit-ui-kit/src/common-apis/utils/logging/logger.js.html +211 -0
  41. package/coverage/rabbit-ui-kit/src/common-apis/utils/logging/logsStorage.js.html +268 -0
  42. package/coverage/rabbit-ui-kit/src/common-apis/utils/postponeExecution.js.html +118 -0
  43. package/coverage/rabbit-ui-kit/src/common-apis/utils/rabbitTicker.js.html +157 -0
  44. package/coverage/rabbit-ui-kit/src/common-apis/utils/safeStringify.js.html +235 -0
  45. package/coverage/rabbit-ui-kit/src/index.html +116 -0
  46. package/coverage/rabbit-ui-kit/src/index.js.html +388 -0
  47. package/coverage/rabbit-ui-kit/src/robust-api-caller/cacheAndConcurrentRequestsResolver.js.html +1660 -0
  48. package/coverage/rabbit-ui-kit/src/robust-api-caller/cachedRobustExternalApiCallerService.js.html +526 -0
  49. package/coverage/rabbit-ui-kit/src/robust-api-caller/cancelProcessing.js.html +172 -0
  50. package/coverage/rabbit-ui-kit/src/robust-api-caller/concurrentCalculationsMetadataHolder.js.html +310 -0
  51. package/coverage/rabbit-ui-kit/src/robust-api-caller/externalApiProvider.js.html +553 -0
  52. package/coverage/rabbit-ui-kit/src/robust-api-caller/externalServicesStatsCollector.js.html +319 -0
  53. package/coverage/rabbit-ui-kit/src/robust-api-caller/index.html +206 -0
  54. package/coverage/rabbit-ui-kit/src/robust-api-caller/robustExternalAPICallerService.js.html +997 -0
  55. package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/changeHeroSwapProvider.js.html +2800 -0
  56. package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/changeNowSwapProvider.js.html +2644 -0
  57. package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/exolixSwapProvider.js.html +1942 -0
  58. package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/goexmeSwapProvider.js.html +2389 -0
  59. package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/index.html +236 -0
  60. package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/letsExchangeSwapProvider.js.html +1666 -0
  61. package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/retriableErrorsUtils.js.html +274 -0
  62. package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/swapProvider.js.html +1888 -0
  63. package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/swapspaceSwapProvider.js.html +1981 -0
  64. package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/utils.js.html +163 -0
  65. package/coverage/rabbit-ui-kit/src/swaps-lib/models/baseSwapCreationInfo.js.html +319 -0
  66. package/coverage/rabbit-ui-kit/src/swaps-lib/models/existingSwap.js.html +514 -0
  67. package/coverage/rabbit-ui-kit/src/swaps-lib/models/existingSwapWithFiatData.js.html +529 -0
  68. package/coverage/rabbit-ui-kit/src/swaps-lib/models/index.html +176 -0
  69. package/coverage/rabbit-ui-kit/src/swaps-lib/models/partner.js.html +166 -0
  70. package/coverage/rabbit-ui-kit/src/swaps-lib/models/swapProviderCoinInfo.js.html +337 -0
  71. package/coverage/rabbit-ui-kit/src/swaps-lib/services/index.html +116 -0
  72. package/coverage/rabbit-ui-kit/src/swaps-lib/services/publicSwapService.js.html +1654 -0
  73. package/coverage/rabbit-ui-kit/src/swaps-lib/utils/index.html +116 -0
  74. package/coverage/rabbit-ui-kit/src/swaps-lib/utils/swapUtils.js.html +706 -0
  75. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/arrowIcon.jsx.html +124 -0
  76. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/arrowTosca.jsx.html +127 -0
  77. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/arrowWhite.jsx.html +127 -0
  78. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/darkRectangle.jsx.html +106 -0
  79. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/determinedError.jsx.html +439 -0
  80. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/failedValidationIcon.jsx.html +202 -0
  81. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/index.html +281 -0
  82. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/infoIcon.jsx.html +133 -0
  83. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/messageIcon.jsx.html +346 -0
  84. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/noticeQuestionIcon.jsx.html +247 -0
  85. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/successfulValidationIcon.jsx.html +163 -0
  86. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/supportDialogImage.jsx.html +268 -0
  87. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/walletIcon.jsx.html +151 -0
  88. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/AssetIcon/AssetIcon.jsx.html +256 -0
  89. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/AssetIcon/index.html +116 -0
  90. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/AssetSelection/AssetSelection.jsx.html +289 -0
  91. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/AssetSelection/index.html +116 -0
  92. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/BackgroundTitle/BackgroundTitle.jsx.html +187 -0
  93. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/BackgroundTitle/index.html +116 -0
  94. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/InformationMessage/InformationMessage.jsx.html +238 -0
  95. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/InformationMessage/index.html +116 -0
  96. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Input/Input.jsx.html +634 -0
  97. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Input/index.html +116 -0
  98. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/LoadingDots/LoadingDots.jsx.html +196 -0
  99. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/LoadingDots/index.html +116 -0
  100. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/NoticeIcon/NoticeIcon.jsx.html +277 -0
  101. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/NoticeIcon/index.html +116 -0
  102. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/QrCode/QrCode.jsx.html +199 -0
  103. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/QrCode/index.html +116 -0
  104. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/RateSelector/RateSelector.jsx.html +175 -0
  105. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/RateSelector/index.html +116 -0
  106. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/SupportChat/SupportChat.jsx.html +217 -0
  107. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/SupportChat/index.html +116 -0
  108. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Textarea/Textarea.jsx.html +529 -0
  109. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Textarea/index.html +116 -0
  110. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TitleBox/TitleBox.jsx.html +508 -0
  111. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TitleBox/index.html +116 -0
  112. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Tooltip/Tooltip.jsx.html +316 -0
  113. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Tooltip/index.html +116 -0
  114. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TwoLinesOfText/LinesOfText.jsx.html +313 -0
  115. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TwoLinesOfText/index.html +116 -0
  116. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Validation/Validation.jsx.html +202 -0
  117. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Validation/index.html +116 -0
  118. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/Button/Button.jsx.html +733 -0
  119. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/Button/index.html +116 -0
  120. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/Close/Close.jsx.html +259 -0
  121. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/Close/index.html +116 -0
  122. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/LinkButton/LinkButton.jsx.html +433 -0
  123. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/LinkButton/index.html +116 -0
  124. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx.html +415 -0
  125. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/RadioButtonWithText/index.html +116 -0
  126. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/AmountInput/AmountInput.jsx.html +1429 -0
  127. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/AmountInput/index.html +116 -0
  128. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/CoinPicker/CoinPicker.jsx.html +1474 -0
  129. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/CoinPicker/index.html +116 -0
  130. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/ColoredNotice/ColoredNotice.jsx.html +241 -0
  131. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/ColoredNotice/index.html +116 -0
  132. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/LineWithIconLink/LineWithIconLink.jsx.html +190 -0
  133. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/LineWithIconLink/index.html +116 -0
  134. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/LogoCarousel/LogoCarousel.jsx.html +307 -0
  135. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/LogoCarousel/index.html +116 -0
  136. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/SearchableCoinsList/SearchableCoinsList.jsx.html +427 -0
  137. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/SearchableCoinsList/index.html +116 -0
  138. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx.html +181 -0
  139. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/TitledLineWithIconLink/index.html +116 -0
  140. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx.html +283 -0
  141. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/CoinPickerDialogStep/index.html +116 -0
  142. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/Dialog.jsx.html +1567 -0
  143. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/DialogButtons/DialogButtons.jsx.html +481 -0
  144. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/DialogButtons/index.html +116 -0
  145. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/DialogStep/DialogStep.jsx.html +1747 -0
  146. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/DialogStep/index.html +116 -0
  147. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/index.html +116 -0
  148. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/SwapForm/SwapForm.jsx.html +4375 -0
  149. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/SwapForm/index.html +116 -0
  150. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/WaitlistSubscription/WaitlistSubscription.jsx.html +559 -0
  151. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/WaitlistSubscription/index.html +116 -0
  152. package/coverage/rabbit-ui-kit/src/ui-kit/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx.html +316 -0
  153. package/coverage/rabbit-ui-kit/src/ui-kit/components/templates/DeterminedErrorDialogStep/index.html +116 -0
  154. package/coverage/rabbit-ui-kit/src/ui-kit/hooks/index.html +146 -0
  155. package/coverage/rabbit-ui-kit/src/ui-kit/hooks/useCallHandlingErrors.js.html +166 -0
  156. package/coverage/rabbit-ui-kit/src/ui-kit/hooks/useIsHydrated.js.html +121 -0
  157. package/coverage/rabbit-ui-kit/src/ui-kit/hooks/useReferredState.js.html +157 -0
  158. package/coverage/rabbit-ui-kit/src/ui-kit/utils/index.html +176 -0
  159. package/coverage/rabbit-ui-kit/src/ui-kit/utils/inputValueProviders.js.html +235 -0
  160. package/coverage/rabbit-ui-kit/src/ui-kit/utils/searchCoins.js.html +259 -0
  161. package/coverage/rabbit-ui-kit/src/ui-kit/utils/textUtils.js.html +139 -0
  162. package/coverage/rabbit-ui-kit/src/ui-kit/utils/uiUtils.js.html +121 -0
  163. package/coverage/rabbit-ui-kit/src/ui-kit/utils/urlQueryUtils.js.html +271 -0
  164. package/coverage/rabbit-ui-kit/stories/atoms/BackgroundTitle.stories.jsx.html +202 -0
  165. package/coverage/rabbit-ui-kit/stories/atoms/LinesOfText.stories.jsx.html +283 -0
  166. package/coverage/rabbit-ui-kit/stories/atoms/LoadingDots.stories.jsx.html +226 -0
  167. package/coverage/rabbit-ui-kit/stories/atoms/QrCode.stories.jsx.html +175 -0
  168. package/coverage/rabbit-ui-kit/stories/atoms/RateSelector.stories.jsx.html +136 -0
  169. package/coverage/rabbit-ui-kit/stories/atoms/Validation.stories.jsx.html +178 -0
  170. package/coverage/rabbit-ui-kit/stories/atoms/buttons/Button.stories.jsx.html +883 -0
  171. package/coverage/rabbit-ui-kit/stories/atoms/buttons/Close.stories.jsx.html +211 -0
  172. package/coverage/rabbit-ui-kit/stories/atoms/buttons/LinkButton.stories.jsx.html +301 -0
  173. package/coverage/rabbit-ui-kit/stories/atoms/buttons/index.html +146 -0
  174. package/coverage/rabbit-ui-kit/stories/atoms/index.html +191 -0
  175. package/coverage/rabbit-ui-kit/stories/molecules/AmountInput.stories.jsx.html +289 -0
  176. package/coverage/rabbit-ui-kit/stories/molecules/CoinPicker.stories.jsx.html +322 -0
  177. package/coverage/rabbit-ui-kit/stories/molecules/ColoredNotice.stories.jsx.html +178 -0
  178. package/coverage/rabbit-ui-kit/stories/molecules/LineWithIconLink.stories.jsx.html +154 -0
  179. package/coverage/rabbit-ui-kit/stories/molecules/LogoCarousel.stories.jsx.html +235 -0
  180. package/coverage/rabbit-ui-kit/stories/molecules/TitledLineWithIconLink.stories.jsx.html +160 -0
  181. package/coverage/rabbit-ui-kit/stories/molecules/index.html +191 -0
  182. package/coverage/rabbit-ui-kit/stories/organisms/Dialog/Dialog.stories.jsx.html +523 -0
  183. package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogButtons/DialogButtons.stories.jsx.html +328 -0
  184. package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogButtons/index.html +116 -0
  185. package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogStep/DialogStep.stories.jsx.html +337 -0
  186. package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogStep/index.html +116 -0
  187. package/coverage/rabbit-ui-kit/stories/organisms/Dialog/index.html +116 -0
  188. package/coverage/rabbit-ui-kit/stories/organisms/WaitlistSubscription.stories.jsx.html +151 -0
  189. package/coverage/rabbit-ui-kit/stories/organisms/index.html +116 -0
  190. package/coverage/rabbit-ui-kit/stories/stubs/coins.jsx.html +6880 -0
  191. package/coverage/rabbit-ui-kit/stories/stubs/exampleContent.jsx.html +145 -0
  192. package/coverage/rabbit-ui-kit/stories/stubs/index.html +131 -0
  193. package/coverage/rabbit-ui-kit/stories/templates/DeterminedErrorDialogStep.stories.jsx.html +190 -0
  194. package/coverage/rabbit-ui-kit/stories/templates/index.html +116 -0
  195. package/coverage/sort-arrow-sprite.png +0 -0
  196. package/coverage/sorter.js +196 -0
  197. package/dist/global.css +197 -0
  198. package/dist/global.css.map +1 -0
  199. package/dist/index.cjs +15089 -1593
  200. package/dist/index.cjs.map +1 -1
  201. package/dist/index.css +2352 -8493
  202. package/dist/index.css.map +1 -1
  203. package/dist/index.modern.js +11801 -1298
  204. package/dist/index.modern.js.map +1 -1
  205. package/dist/index.module.js +15003 -1594
  206. package/dist/index.module.js.map +1 -1
  207. package/dist/index.umd.js +15081 -1596
  208. package/dist/index.umd.js.map +1 -1
  209. package/package.json +35 -9
  210. package/raw +1000 -0
  211. package/src/common-apis/adapters/analyticsAdapters/googleAnalyticsAdapter.js +22 -0
  212. package/src/common-apis/adapters/analyticsAdapters/metrikaAdapter.js +29 -0
  213. package/src/common-apis/adapters/analyticsAdapters/mixpanelAdapter.js +38 -0
  214. package/src/common-apis/adapters/axiosAdapter.js +35 -0
  215. package/src/common-apis/adapters/qrUtils.js +18 -0
  216. package/src/common-apis/external-apis/apiGroups.js +56 -0
  217. package/src/common-apis/external-apis/emailAPI.js +16 -0
  218. package/src/common-apis/external-apis/ipAddressProviders.js +102 -0
  219. package/src/common-apis/globalConstants.jsx +3 -0
  220. package/src/{common → common-apis}/models/coin.js +98 -7
  221. package/src/{common → common-apis/services}/fiatCurrenciesService.js +4 -12
  222. package/src/common-apis/tests/integration/external-apis/ipAddressProviders/getClientIpAddress.test.js +18 -0
  223. package/src/common-apis/tests/units/utils/amountUtils/composeRateText.test.js +152 -0
  224. package/src/{common → common-apis/utils}/amountUtils.js +100 -140
  225. package/src/{common → common-apis}/utils/cache.js +15 -41
  226. package/src/{common → common-apis/utils}/errorUtils.js +15 -0
  227. package/src/{common → common-apis}/utils/logging/logger.js +7 -13
  228. package/src/common-apis/utils/postponeExecution.js +11 -0
  229. package/src/common-apis/utils/rabbitTicker.js +24 -0
  230. package/src/index.js +91 -14
  231. package/src/robust-api-caller/cacheAndConcurrentRequestsResolver.js +525 -0
  232. package/src/robust-api-caller/cachedRobustExternalApiCallerService.js +147 -0
  233. package/src/robust-api-caller/cancelProcessing.js +29 -0
  234. package/src/robust-api-caller/concurrentCalculationsMetadataHolder.js +75 -0
  235. package/src/robust-api-caller/externalApiProvider.js +156 -0
  236. package/src/robust-api-caller/externalServicesStatsCollector.js +78 -0
  237. package/src/robust-api-caller/robustExternalAPICallerService.js +304 -0
  238. package/src/robust-api-caller/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/_performCallAttempt.test.js +533 -0
  239. package/src/robust-api-caller/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/callExternalAPI.test.js +532 -0
  240. package/src/robust-api-caller/tests/robustExternalAPICallerService/robustExternalAPICallerService/constructor.test.js +19 -0
  241. package/src/swaps-lib/external-apis/changeHeroSwapProvider.js +905 -0
  242. package/src/swaps-lib/external-apis/changeNowSwapProvider.js +853 -0
  243. package/src/swaps-lib/external-apis/exolixSwapProvider.js +619 -0
  244. package/src/swaps-lib/external-apis/goexmeSwapProvider.js +768 -0
  245. package/src/swaps-lib/external-apis/letsExchangeSwapProvider.js +527 -0
  246. package/src/swaps-lib/external-apis/retriableErrorsUtils.js +63 -0
  247. package/src/swaps-lib/external-apis/swapProvider.js +457 -25
  248. package/src/swaps-lib/external-apis/swapspaceSwapProvider.js +320 -486
  249. package/src/swaps-lib/external-apis/utils.js +26 -0
  250. package/src/swaps-lib/models/baseSwapCreationInfo.js +78 -0
  251. package/src/swaps-lib/models/existingSwap.js +101 -16
  252. package/src/swaps-lib/models/existingSwapWithFiatData.js +148 -0
  253. package/src/swaps-lib/models/partner.js +27 -0
  254. package/src/swaps-lib/models/swapProviderCoinInfo.js +84 -0
  255. package/src/swaps-lib/services/publicSwapService.js +523 -0
  256. package/src/swaps-lib/test/external-apis/changeHeroSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +155 -0
  257. package/src/swaps-lib/test/external-apis/changeHeroSwapProvider/createSwap.test.js +702 -0
  258. package/src/swaps-lib/test/external-apis/changeHeroSwapProvider/getExistingSwapsDetailsAndStatus.test.js +501 -0
  259. package/src/swaps-lib/test/external-apis/changeHeroSwapProvider/getSwapInfo.test.js +425 -0
  260. package/src/swaps-lib/test/external-apis/changeNowSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +83 -0
  261. package/src/swaps-lib/test/external-apis/changeNowSwapProvider/_providerHelpers.test.js +54 -0
  262. package/src/swaps-lib/test/external-apis/changeNowSwapProvider/_validateAddressWithProvider.test.js +49 -0
  263. package/src/swaps-lib/test/external-apis/changeNowSwapProvider/createSwap.test.js +938 -0
  264. package/src/swaps-lib/test/external-apis/changeNowSwapProvider/getExistingSwapsDetailsAndStatus.test.js +353 -0
  265. package/src/swaps-lib/test/external-apis/changeNowSwapProvider/getSwapInfo.test.js +342 -0
  266. package/src/swaps-lib/test/external-apis/exolixSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +34 -0
  267. package/src/swaps-lib/test/external-apis/exolixSwapProvider/createSwap.test.js +1081 -0
  268. package/src/swaps-lib/test/external-apis/exolixSwapProvider/getSwapInfo.test.js +611 -0
  269. package/src/swaps-lib/test/external-apis/goexmeSwapProvider/_convertCurrencyMeta.test.js +95 -0
  270. package/src/swaps-lib/test/external-apis/goexmeSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +75 -0
  271. package/src/swaps-lib/test/external-apis/goexmeSwapProvider/createSwap.test.js +225 -0
  272. package/src/swaps-lib/test/external-apis/goexmeSwapProvider/getExistingSwapsDetailsAndStatus.test.js +175 -0
  273. package/src/swaps-lib/test/external-apis/goexmeSwapProvider/getSwapInfo.test.js +177 -0
  274. package/src/swaps-lib/test/external-apis/goexmeSwapProvider/helpers.test.js +26 -0
  275. package/src/swaps-lib/test/external-apis/goexmeSwapProvider/integration/PairSupport.int.test.js +69 -0
  276. package/src/swaps-lib/test/external-apis/goexmeSwapProvider/integration/_fetchSupportedCurrenciesIfNeeded.int.test.js +307 -0
  277. package/src/swaps-lib/test/external-apis/goexmeSwapProvider/integration/createSwap.int.test.js +335 -0
  278. package/src/swaps-lib/test/external-apis/goexmeSwapProvider/integration/getSwapInfo.int.test.js +154 -0
  279. package/src/swaps-lib/test/external-apis/swapProvider/getAllSupportedCurrencies.test.js +63 -0
  280. package/src/swaps-lib/test/external-apis/swapProvider/getDepositCurrencies.test.js +73 -0
  281. package/src/swaps-lib/test/external-apis/swapProvider/getWithdrawalCurrencies.test.js +102 -0
  282. package/src/swaps-lib/test/external-apis/swapProvider/removeProtocolNameFromCoinName.test.js +152 -0
  283. package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +536 -0
  284. package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/createSwap.test.js +1359 -0
  285. package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getExistingSwapsDetailsAndStatus.test.js +136 -0
  286. package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getSwapInfo.test.js +1743 -0
  287. package/src/swaps-lib/test/utils/swapUtils/isIpBannedProviderError.test.js +150 -0
  288. package/src/swaps-lib/test/utils/swapUtils/safeHandleRequestsLimitExceeding.test.js +80 -0
  289. package/src/swaps-lib/utils/swapUtils.js +207 -0
  290. package/{styles → src/ui-kit/assets/styles}/_functions.scss +5 -0
  291. package/{styles → src/ui-kit/assets/styles}/_mixins.scss +2 -2
  292. package/{styles → src/ui-kit/assets/styles}/_placeholder.scss +3 -3
  293. package/{styles → src/ui-kit/assets/styles}/_variables.scss +17 -15
  294. package/src/ui-kit/assets/styles/fonts/NunitoSans-Bold.ttf +0 -0
  295. package/src/ui-kit/assets/styles/fonts/NunitoSans-ExtraBold.ttf +0 -0
  296. package/src/ui-kit/assets/styles/fonts/NunitoSans-Light.ttf +0 -0
  297. package/src/ui-kit/assets/styles/fonts/NunitoSans-Regular.ttf +0 -0
  298. package/src/ui-kit/assets/styles/fonts/NunitoSans-SemiBold.ttf +0 -0
  299. package/src/ui-kit/assets/styles/global.scss +171 -0
  300. package/src/ui-kit/assets/styles/index.scss +10 -0
  301. package/src/ui-kit/assets/wrappedImages/arrowIcon.jsx +13 -0
  302. package/src/ui-kit/assets/wrappedImages/arrowTosca.jsx +14 -0
  303. package/src/ui-kit/assets/wrappedImages/arrowWhite.jsx +14 -0
  304. package/src/ui-kit/assets/wrappedImages/darkRectangle.jsx +7 -0
  305. package/src/ui-kit/assets/wrappedImages/determinedError.jsx +118 -0
  306. package/src/ui-kit/assets/wrappedImages/failedValidationIcon.jsx +39 -0
  307. package/src/ui-kit/assets/wrappedImages/infoIcon.jsx +16 -0
  308. package/src/ui-kit/assets/wrappedImages/messageIcon.jsx +87 -0
  309. package/src/ui-kit/assets/wrappedImages/noticeQuestionIcon.jsx +54 -0
  310. package/src/ui-kit/assets/wrappedImages/successfulValidationIcon.jsx +26 -0
  311. package/src/ui-kit/assets/wrappedImages/supportDialogImage.jsx +61 -0
  312. package/src/ui-kit/assets/wrappedImages/walletIcon.jsx +22 -0
  313. package/src/{components → ui-kit/components}/atoms/AssetIcon/AssetIcon.jsx +16 -14
  314. package/src/{components → ui-kit/components}/atoms/AssetIcon/asset-icon.module.scss +1 -1
  315. package/src/ui-kit/components/atoms/AssetSelection/AssetSelection.jsx +68 -0
  316. package/src/ui-kit/components/atoms/AssetSelection/asset-selection.module.scss +56 -0
  317. package/src/ui-kit/components/atoms/BackgroundTitle/BackgroundTitle.jsx +34 -0
  318. package/src/ui-kit/components/atoms/BackgroundTitle/background-title.module.scss +52 -0
  319. package/src/ui-kit/components/atoms/InformationMessage/InformationMessage.jsx +51 -0
  320. package/src/ui-kit/components/atoms/InformationMessage/information-message.module.scss +38 -0
  321. package/src/ui-kit/components/atoms/Input/Input.jsx +183 -0
  322. package/src/ui-kit/components/atoms/Input/input.module.scss +107 -0
  323. package/src/{components → ui-kit/components}/atoms/LoadingDots/LoadingDots.jsx +8 -28
  324. package/src/{components → ui-kit/components}/atoms/LoadingDots/LoadingDots.module.scss +3 -2
  325. package/src/ui-kit/components/atoms/NoticeIcon/NoticeIcon.jsx +64 -0
  326. package/src/ui-kit/components/atoms/NoticeIcon/notice-icon.module.scss +14 -0
  327. package/src/ui-kit/components/atoms/QrCode/QrCode.jsx +38 -0
  328. package/src/ui-kit/components/atoms/QrCode/qr-code.module.scss +8 -0
  329. package/src/ui-kit/components/atoms/RateSelector/RateSelector.jsx +30 -0
  330. package/src/ui-kit/components/atoms/RateSelector/rate-selector.module.scss +47 -0
  331. package/src/{components → ui-kit/components}/atoms/SupportChat/SupportChat.jsx +5 -1
  332. package/src/ui-kit/components/atoms/Textarea/Textarea.jsx +148 -0
  333. package/src/ui-kit/components/atoms/Textarea/textarea.module.scss +71 -0
  334. package/src/ui-kit/components/atoms/TitleBox/TitleBox.jsx +141 -0
  335. package/src/ui-kit/components/atoms/TitleBox/title-box.module.scss +32 -0
  336. package/src/ui-kit/components/atoms/Tooltip/Tooltip.jsx +77 -0
  337. package/src/ui-kit/components/atoms/Tooltip/tooltip.module.scss +237 -0
  338. package/src/ui-kit/components/atoms/TwoLinesOfText/LinesOfText.jsx +76 -0
  339. package/src/ui-kit/components/atoms/TwoLinesOfText/lines-of-text.module.scss +65 -0
  340. package/src/ui-kit/components/atoms/Validation/Validation.jsx +39 -0
  341. package/src/ui-kit/components/atoms/Validation/validation.module.scss +19 -0
  342. package/src/{components → ui-kit/components}/atoms/buttons/Button/Button.jsx +26 -45
  343. package/src/{components → ui-kit/components}/atoms/buttons/Button/Button.module.scss +1 -1
  344. package/src/ui-kit/components/atoms/buttons/Close/Close.jsx +58 -0
  345. package/src/ui-kit/components/atoms/buttons/Close/close.module.scss +75 -0
  346. package/src/ui-kit/components/atoms/buttons/LinkButton/LinkButton.jsx +116 -0
  347. package/src/ui-kit/components/atoms/buttons/LinkButton/link-button.module.scss +53 -0
  348. package/src/ui-kit/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx +110 -0
  349. package/src/ui-kit/components/atoms/buttons/RadioButtonWithText/radio-button-with-text.module.scss +86 -0
  350. package/src/ui-kit/components/molecules/AmountInput/AmountInput.jsx +448 -0
  351. package/src/ui-kit/components/molecules/AmountInput/amount-input.module.scss +233 -0
  352. package/src/ui-kit/components/molecules/CoinPicker/CoinPicker.jsx +463 -0
  353. package/src/ui-kit/components/molecules/CoinPicker/coin-picker.module.scss +207 -0
  354. package/src/ui-kit/components/molecules/ColoredNotice/ColoredNotice.jsx +52 -0
  355. package/src/ui-kit/components/molecules/ColoredNotice/colored-notice.module.scss +36 -0
  356. package/src/ui-kit/components/molecules/LineWithIconLink/LineWithIconLink.jsx +35 -0
  357. package/src/ui-kit/components/molecules/LineWithIconLink/line-with-icon-link.module.scss +25 -0
  358. package/src/ui-kit/components/molecules/LogoCarousel/LogoCarousel.jsx +74 -0
  359. package/src/ui-kit/components/molecules/LogoCarousel/logo-carousel.module.scss +106 -0
  360. package/src/ui-kit/components/molecules/SearchableCoinsList/SearchableCoinsList.jsx +114 -0
  361. package/src/ui-kit/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx +32 -0
  362. package/src/ui-kit/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx +66 -0
  363. package/src/ui-kit/components/organisms/Dialog/Dialog.jsx +494 -0
  364. package/src/ui-kit/components/organisms/Dialog/DialogButtons/DialogButtons.jsx +132 -0
  365. package/src/ui-kit/components/organisms/Dialog/DialogButtons/dialog-buttons.module.scss +25 -0
  366. package/src/ui-kit/components/organisms/Dialog/DialogStep/DialogStep.jsx +554 -0
  367. package/src/ui-kit/components/organisms/Dialog/DialogStep/dialog-step.module.scss +382 -0
  368. package/src/ui-kit/components/organisms/Dialog/dialog.module.scss +226 -0
  369. package/src/ui-kit/components/organisms/SwapForm/SwapForm.jsx +1430 -0
  370. package/src/ui-kit/components/organisms/SwapForm/swap-form.module.scss +134 -0
  371. package/src/ui-kit/components/organisms/WaitlistSubscription/WaitlistSubscription.jsx +158 -0
  372. package/src/ui-kit/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx +77 -0
  373. package/src/ui-kit/hooks/useCallHandlingErrors.js +27 -0
  374. package/src/ui-kit/hooks/useIsHydrated.js +12 -0
  375. package/src/ui-kit/hooks/useReferredState.js +24 -0
  376. package/src/ui-kit/tests/utils/inputValueProviders/provideFormatOfFloatValueByInputString.test.js +146 -0
  377. package/src/ui-kit/tests/utils/urlQueryUtils/getQueryParameterValues.test.js +65 -0
  378. package/src/ui-kit/tests/utils/urlQueryUtils/saveQueryParameterAndValues.test.js +104 -0
  379. package/src/ui-kit/utils/inputValueProviders.js +50 -0
  380. package/src/ui-kit/utils/searchCoins.js +58 -0
  381. package/src/ui-kit/utils/textUtils.js +18 -0
  382. package/src/ui-kit/utils/uiUtils.js +12 -0
  383. package/src/ui-kit/utils/urlQueryUtils.js +62 -0
  384. package/stories/font.scss +40 -0
  385. package/stories/stubs/coins.jsx +2266 -0
  386. package/stories/stubs/exampleContent.jsx +20 -0
  387. package/styles/_global-classes.scss +0 -433
  388. package/styles/fonts/NunitoSans-Bold.ttf +0 -0
  389. package/styles/fonts/NunitoSans-ExtraBold.ttf +0 -0
  390. package/styles/fonts/NunitoSans-Light.ttf +0 -0
  391. package/styles/fonts/NunitoSans-Regular.ttf +0 -0
  392. package/styles/fonts/NunitoSans-SemiBold.ttf +0 -0
  393. package/styles/global-styles-index.scss +0 -74
  394. package/styles/index.scss +0 -33
  395. /package/src/{common → common-apis}/models/blockchain.js +0 -0
  396. /package/src/{common → common-apis}/models/protocol.js +0 -0
  397. /package/src/{common → common-apis}/utils/logging/logsStorage.js +0 -0
  398. /package/src/{common → common-apis}/utils/safeStringify.js +0 -0
  399. /package/{styles → src/ui-kit/assets/styles}/colors/_light-colors.scss +0 -0
  400. /package/{styles → src/ui-kit/assets/styles}/colors/_solid-colors.scss +0 -0
  401. /package/{styles → src/ui-kit/assets/styles}/size/_margin-size.scss +0 -0
  402. /package/{styles → src/ui-kit/assets/styles}/size/_padding-size.scss +0 -0
@@ -0,0 +1,177 @@
1
+ import sinon from "sinon";
2
+ import axios from "axios";
3
+ import should from "should";
4
+ import { describe, it, beforeEach, afterEach } from "vitest";
5
+ import BigNumber from "bignumber.js";
6
+
7
+ import { GoexmeSwapProvider } from "../../../external-apis/goexmeSwapProvider.js";
8
+ import { Cache } from "../../../../common-apis/utils/cache.js";
9
+ import { Coin } from "../../../../common-apis/models/coin.js";
10
+ import { Blockchain } from "../../../../common-apis/models/blockchain.js";
11
+ import { SwapProvider } from "../../../external-apis/swapProvider.js";
12
+
13
+ const BTC = new Coin("Bitcoin", "BTC", "BTC", 8, null, "sat", null, null, 1, null, [], null, new Blockchain("Bitcoin"));
14
+ const ETH = new Coin(
15
+ "Ethereum",
16
+ "ETH",
17
+ "ETH",
18
+ 18,
19
+ null,
20
+ "wei",
21
+ null,
22
+ null,
23
+ 1,
24
+ null,
25
+ [],
26
+ null,
27
+ new Blockchain("Ethereum")
28
+ );
29
+
30
+ describe("goexmeSwapProvider", function () {
31
+ describe("getSwapInfo", function () {
32
+ const okRate = { result: true, rate: "15", minamount: "0.01", maxamount: "5" };
33
+ let provider, axiosStub;
34
+
35
+ beforeEach(() => {
36
+ provider = new GoexmeSwapProvider("/", new Cache(), () => null, false);
37
+ provider._supportedCoins = [
38
+ { coin: BTC, code: "BTC", network: "BTC" },
39
+ { coin: ETH, code: "ETH", network: "ETH" },
40
+ ];
41
+ provider._supportedCoinsLastUpdateTimestamp = Date.now();
42
+ sinon.stub(provider, "_fetchSupportedCurrenciesIfNeeded").resolves();
43
+ axiosStub = sinon.stub(axios, "get").callsFake(url => {
44
+ if (url.includes("/pairs")) return Promise.resolve({ status: 200, data: { BTC: ["ETH"] } });
45
+ if (url.includes("/rate")) return Promise.resolve({ status: 200, data: okRate });
46
+ return Promise.resolve({ status: 200, data: {} });
47
+ });
48
+ });
49
+
50
+ afterEach(() => sinon.restore());
51
+
52
+ it("Should return TOO_LOW and TOO_HIGH against min/max", async () => {
53
+ let info = await provider.getSwapInfo(BTC, ETH, "0.001");
54
+ info.reason.should.equal(SwapProvider.NO_SWAPS_REASONS.TOO_LOW);
55
+ info = await provider.getSwapInfo(BTC, ETH, "10");
56
+ info.reason.should.equal(SwapProvider.NO_SWAPS_REASONS.TOO_HIGH);
57
+ });
58
+
59
+ it("Should handle case with no min/max limits", async () => {
60
+ axiosStub.withArgs(sinon.match(/\/rate/)).resolves({ status: 200, data: { result: true, rate: "15" } });
61
+ const info = await provider.getSwapInfo(BTC, ETH, "1");
62
+ info.result.should.be.true();
63
+ });
64
+
65
+ it("Should map HTTP 429 to REQUESTS_LIMIT_EXCEEDED", async () => {
66
+ axiosStub.withArgs(sinon.match(/\/rate/)).rejects({ response: { status: 429 } });
67
+ const info = await provider.getSwapInfo(BTC, ETH, "1");
68
+ info.reason.should.equal(SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED);
69
+ });
70
+
71
+ it("Should return valid structure on success", async () => {
72
+ const info = await provider.getSwapInfo(BTC, ETH, "1");
73
+ info.result.should.be.true();
74
+ parseFloat(info.rate).should.be.greaterThan(0);
75
+ });
76
+
77
+ it("Should send proper params to /rate", async () => {
78
+ await provider.getSwapInfo(BTC, ETH, "1");
79
+ const call = axiosStub.args.find(a => a[0].includes("/rate"));
80
+ const params = call[1].params;
81
+ params.should.match({ from: "BTC", to: "ETH", amount: "1" });
82
+ });
83
+
84
+ it("Should throw when amount ≤ 0", async () => {
85
+ await provider.getSwapInfo(BTC, ETH, "0").should.be.rejected();
86
+ });
87
+
88
+ it("Should return valid result when amount is empty string", async () => {
89
+ const info = await provider.getSwapInfo(BTC, ETH, "");
90
+ info.result.should.be.true();
91
+ });
92
+
93
+ it("Should return valid result when amount is non-string", async () => {
94
+ const info = await provider.getSwapInfo(BTC, ETH, 1);
95
+ info.result.should.be.true();
96
+ });
97
+
98
+ it("Should propagate unexpected network error unchanged", async () => {
99
+ const boom = new Error("net-boom");
100
+ axiosStub.rejects(boom);
101
+ await provider.getSwapInfo(BTC, ETH, "1").should.be.rejectedWith(boom);
102
+ });
103
+
104
+ it("Should return NOT_SUPPORTED when provider responds { result:false } with 200", async () => {
105
+ axiosStub.withArgs(sinon.match(/\/rate/)).resolves({ status: 200, data: { result: false } });
106
+ const info = await provider.getSwapInfo(BTC, ETH, "1");
107
+ info.result.should.be.false();
108
+ info.reason.should.equal(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
109
+ });
110
+
111
+ it("Should throw when fromCoin/toCoin are not Coin instances", async () => {
112
+ await provider.getSwapInfo({}, {}, "1").should.be.rejected();
113
+ });
114
+
115
+ it("Should throw when amountIsToReceive = true", async () => {
116
+ await provider.getSwapInfo(BTC, ETH, "1", false, null, true).should.be.rejected();
117
+ });
118
+
119
+ it("Should return NOT_SUPPORTED when either fromCoin or toCoin is unsupported", async () => {
120
+ const unsupported = new Coin(
121
+ "Unsupported",
122
+ "UNS",
123
+ "UNS",
124
+ 8,
125
+ null,
126
+ "unit",
127
+ null,
128
+ null,
129
+ 1,
130
+ null,
131
+ [],
132
+ null,
133
+ new Blockchain("Unsupported")
134
+ );
135
+ let info = await provider.getSwapInfo(unsupported, ETH, "1");
136
+ info.result.should.be.false();
137
+ info.reason.should.equal(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
138
+
139
+ info = await provider.getSwapInfo(BTC, unsupported, "1");
140
+ info.result.should.be.false();
141
+ info.reason.should.equal(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
142
+ });
143
+
144
+ it("Should return NOT_SUPPORTED when /rate responds with unexpected data shape", async () => {
145
+ axiosStub.withArgs(sinon.match(/\/rate/)).resolves({ status: 200, data: {} });
146
+ const info = await provider.getSwapInfo(BTC, ETH, "1");
147
+ info.result.should.be.false();
148
+ info.reason.should.equal(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
149
+ });
150
+
151
+ it("Should copy provider .fix flag into info.fixed", async () => {
152
+ axiosStub.withArgs(sinon.match(/\/rate/)).resolves({
153
+ status: 200,
154
+ data: { result: true, rate: "15", minamount: "0.01", maxamount: "5", fix: true },
155
+ });
156
+ const info = await provider.getSwapInfo(BTC, ETH, "1");
157
+ info.result.should.be.true();
158
+ info.fixed.should.be.true();
159
+ });
160
+
161
+ it("Should return TOO_LOW and TOO_HIGH with correct smallestMin and greatestMax", async () => {
162
+ axiosStub.withArgs(sinon.match(/\/rate/)).resolves({
163
+ status: 200,
164
+ data: { result: true, rate: "15", minamount: "0.5", maxamount: "5" },
165
+ });
166
+ let info = await provider.getSwapInfo(BTC, ETH, "0.1");
167
+ info.result.should.be.false();
168
+ info.reason.should.equal(SwapProvider.NO_SWAPS_REASONS.TOO_LOW);
169
+ info.smallestMin.should.equal("0.50000000");
170
+
171
+ info = await provider.getSwapInfo(BTC, ETH, "10");
172
+ info.result.should.be.false();
173
+ info.reason.should.equal(SwapProvider.NO_SWAPS_REASONS.TOO_HIGH);
174
+ info.greatestMax.should.equal("5.00000000");
175
+ });
176
+ });
177
+ });
@@ -0,0 +1,26 @@
1
+ import should from "should";
2
+ import { describe, it } from "vitest";
3
+
4
+ import { GoexmeSwapProvider } from "../../../external-apis/goexmeSwapProvider.js";
5
+ import { Cache } from "../../../../common-apis/utils/cache.js";
6
+
7
+ describe("goexmeSwapProvider", function () {
8
+ describe("helpers", function () {
9
+ it("getSwapCreationInfoTtlMs should return 110000 ms", () => {
10
+ const provider = new GoexmeSwapProvider("/", new Cache());
11
+ provider.getSwapCreationInfoTtlMs().should.equal(110000);
12
+ });
13
+
14
+ it("_parseGoexmeDate should convert date string to epoch", () => {
15
+ const timestamp = GoexmeSwapProvider._parseGoexmeDate("01.02.2024 03:04:05");
16
+ timestamp.should.equal(Date.parse("2024-02-01T03:04:05Z"));
17
+ });
18
+
19
+ it("getPartnersList should return single partner", async () => {
20
+ const provider = new GoexmeSwapProvider("/", new Cache());
21
+ const partners = await provider.getPartnersList();
22
+ partners.should.have.length(1);
23
+ partners[0].should.have.property("name", "GoExme");
24
+ });
25
+ });
26
+ });
@@ -0,0 +1,69 @@
1
+ import "dotenv/config";
2
+ import sinon from "sinon";
3
+ import should from "should";
4
+ import { describe, it, beforeAll, afterEach } from "vitest";
5
+ import axios from "axios";
6
+
7
+ import { Cache } from "../../../../../common-apis/utils/cache.js";
8
+ import { GoexmeSwapProvider } from "../../../../external-apis/goexmeSwapProvider.js";
9
+
10
+ const GOEXME_API_KEY = process.env.GOEXME_API_KEY?.trim?.() || "";
11
+ const maybeDescribe = GOEXME_API_KEY ? describe : describe.skip;
12
+
13
+ const ALLOWED_RABBIT_TICKERS = [
14
+ "BNBBEP20",
15
+ "BTC",
16
+ "DOGE",
17
+ // DOT temporarily removed – Goexme API stopped exposing it as of 2025‑11‑11.
18
+ "ETH",
19
+ "LTC",
20
+ "SOL",
21
+ "TRX",
22
+ "USDCERC20",
23
+ "GMTSOL",
24
+ "USDTERC20",
25
+ "USDTSOL",
26
+ "USDTTRC20",
27
+ "XMR",
28
+ "XRP",
29
+ ];
30
+
31
+ const FORBIDDEN_TICKERS = ["WELL", "VOXEL", "WOO"];
32
+
33
+ function checkPairSupported(response, providerInstance) {
34
+ const { TOO_LOW, TOO_HIGH } = providerInstance.constructor.NO_SWAPS_REASONS;
35
+ return response.result === true || [TOO_LOW, TOO_HIGH].includes(response.reason);
36
+ }
37
+
38
+ maybeDescribe("external-apis/goexmeSwapProvider integration", function () {
39
+ describe("pair support (live)", function () {
40
+ let provider;
41
+
42
+ beforeAll(async function () {
43
+ provider = new GoexmeSwapProvider("/", new Cache(), () => null, false, GOEXME_API_KEY);
44
+ await provider._fetchSupportedCurrenciesIfNeeded();
45
+ });
46
+
47
+ ALLOWED_RABBIT_TICKERS.forEach(fromTicker => {
48
+ const toTicker = fromTicker === "BTC" ? "USDTTRC20" : "BTC";
49
+
50
+ it(`Should support swaps for ${fromTicker}→${toTicker}`, async function () {
51
+ const fromCoin = provider.getCoinByTickerIfPresent(fromTicker);
52
+ const toCoin = provider.getCoinByTickerIfPresent(toTicker);
53
+
54
+ should.exist(fromCoin);
55
+ should.exist(toCoin);
56
+
57
+ const response = await provider.getSwapInfo(fromCoin, toCoin, "10000", false);
58
+ checkPairSupported(response, provider).should.be.true();
59
+ });
60
+ });
61
+
62
+ FORBIDDEN_TICKERS.forEach(ticker => {
63
+ it(`Should not support swaps involving forbidden token ${ticker}`, function () {
64
+ const coin = provider.getCoinByTickerIfPresent(ticker);
65
+ should(coin).be.null();
66
+ });
67
+ });
68
+ });
69
+ });
@@ -0,0 +1,307 @@
1
+ import "dotenv/config";
2
+ import sinon from "sinon";
3
+ import should from "should";
4
+ import { describe, it, beforeEach, afterEach } from "vitest";
5
+ import axios from "axios";
6
+
7
+ import { Cache } from "../../../../../common-apis/utils/cache.js";
8
+ import { GoexmeSwapProvider } from "../../../../external-apis/goexmeSwapProvider.js";
9
+ import { FALLBACK_ASSET_ICON_URL } from "../../../../../common-apis/globalConstants.jsx";
10
+
11
+ const GOEXME_API_KEY = process.env.GOEXME_API_KEY?.trim?.() || "";
12
+ const maybeDescribe = GOEXME_API_KEY ? describe : describe.skip;
13
+
14
+ maybeDescribe("external-apis/goexmeSwapProvider integration", function () {
15
+ describe("_fetchSupportedCurrenciesIfNeeded", function () {
16
+ let provider;
17
+ let axiosGetOriginal;
18
+
19
+ beforeEach(() => {
20
+ provider = new GoexmeSwapProvider("/", new Cache(), () => null, false, GOEXME_API_KEY);
21
+ axiosGetOriginal = axios.get;
22
+ });
23
+
24
+ afterEach(() => {
25
+ if (axios.get.restore) {
26
+ axios.get.restore();
27
+ } else {
28
+ axios.get = axiosGetOriginal;
29
+ }
30
+ });
31
+
32
+ const fetchRawCurrencies = async () => {
33
+ const { data } = await axiosGetOriginal(`${provider._URL}/currencies`, {
34
+ params: { key: GOEXME_API_KEY },
35
+ });
36
+ return data;
37
+ };
38
+
39
+ it("Should filter out unavailable coins", async () => {
40
+ const raw = await fetchRawCurrencies();
41
+ await provider._fetchSupportedCurrenciesIfNeeded();
42
+
43
+ const providerCodes = new Set(provider._supportedCoins.map(c => c.code));
44
+ const unavailableCodes = Object.entries(raw)
45
+ .filter(([, meta]) => meta?.available === false)
46
+ .map(([code]) => code.toUpperCase());
47
+
48
+ unavailableCodes.forEach(code => providerCodes.has(code).should.be.false());
49
+ providerCodes.size.should.be.above(0);
50
+ });
51
+
52
+ it("Should set hasExtraId and extraIdName correctly", async () => {
53
+ const raw = await fetchRawCurrencies();
54
+ await provider._fetchSupportedCurrenciesIfNeeded();
55
+
56
+ const infoWithTag = provider._supportedCoins.find(i => i.hasExtraId);
57
+ should.exist(infoWithTag);
58
+
59
+ const meta =
60
+ raw[infoWithTag.code] ??
61
+ Object.values(raw).find(m => (m.code ?? m.ticker ?? "").toUpperCase() === infoWithTag.code);
62
+ should.exist(meta);
63
+ (meta.tagname ?? "").trim().should.not.be.empty();
64
+
65
+ infoWithTag.extraIdName.should.equal(meta.tagname);
66
+ });
67
+
68
+ it("Should handle duplicate tickers across networks", async () => {
69
+ await provider._fetchSupportedCurrenciesIfNeeded();
70
+
71
+ const suffixRx = /(ERC20|TRC20|BEP20|BSC|AVALANCHEC|OPTIMISM|SOLANA|ARBITRUM)$/i;
72
+ const grouped = {};
73
+
74
+ provider._supportedCoins.forEach(i => {
75
+ const base = i.code.toUpperCase().replace(suffixRx, "");
76
+ grouped[base] = grouped[base] || [];
77
+ grouped[base].push(i);
78
+ });
79
+
80
+ const entry = Object.entries(grouped).find(([, arr]) => arr.length >= 2);
81
+ if (!entry) return;
82
+
83
+ const [, infos] = entry;
84
+ infos.length.should.be.aboveOrEqual(2);
85
+
86
+ infos.forEach(info => {
87
+ provider._findInfoByTicker(info.coin.ticker).should.equal(info);
88
+ });
89
+ });
90
+
91
+ it("Should skip HTTP call when cached list is fresh", async () => {
92
+ provider._supportedCoins = [{ dummy: true }];
93
+ provider._supportedCoinsLastUpdateTimestamp = Date.now();
94
+
95
+ let calls = 0;
96
+ sinon.stub(axios, "get").callsFake((url, opts) => {
97
+ if (url.includes("/currencies")) calls += 1;
98
+ return axiosGetOriginal(url, opts);
99
+ });
100
+
101
+ await provider._fetchSupportedCurrenciesIfNeeded();
102
+ calls.should.equal(0);
103
+ });
104
+
105
+ it("Should make one HTTP call when cache empty, then reuse cache within TTL", async () => {
106
+ let calls = 0;
107
+ sinon.stub(axios, "get").callsFake((url, opts) => {
108
+ if (url.includes("/currencies")) calls += 1;
109
+ return axiosGetOriginal(url, opts);
110
+ });
111
+
112
+ await provider._fetchSupportedCurrenciesIfNeeded();
113
+ provider._supportedCoinsLastUpdateTimestamp -= 4 * 60 * 1000;
114
+ await provider._fetchSupportedCurrenciesIfNeeded();
115
+
116
+ calls.should.equal(1);
117
+ });
118
+
119
+ it("Should refresh list after TTL expiry", async () => {
120
+ let calls = 0;
121
+ sinon.stub(axios, "get").callsFake((url, opts) => {
122
+ if (url.includes("/currencies")) calls += 1;
123
+ return axiosGetOriginal(url, opts);
124
+ });
125
+
126
+ await provider._fetchSupportedCurrenciesIfNeeded();
127
+ provider._supportedCoinsLastUpdateTimestamp -= 10 * 60 * 1000;
128
+ await provider._fetchSupportedCurrenciesIfNeeded();
129
+
130
+ calls.should.equal(2);
131
+ });
132
+
133
+ it("Should return empty list for status 200 with empty object", async () => {
134
+ sinon.stub(axios, "get").callsFake((url, opts = {}) => {
135
+ if (url.endsWith("/currencies")) {
136
+ return Promise.resolve({ status: 200, data: {} });
137
+ }
138
+ return axiosGetOriginal(url, opts);
139
+ });
140
+
141
+ await provider._fetchSupportedCurrenciesIfNeeded();
142
+
143
+ Array.isArray(provider._supportedCoins).should.be.true();
144
+ provider._supportedCoins.length.should.equal(0);
145
+ });
146
+
147
+ it("Should throw when status 200 with null data", async () => {
148
+ sinon.stub(axios, "get").callsFake((url, opts = {}) => {
149
+ if (url.endsWith("/currencies")) {
150
+ return Promise.resolve({ status: 200, data: null });
151
+ }
152
+ return axiosGetOriginal(url, opts);
153
+ });
154
+
155
+ await provider._fetchSupportedCurrenciesIfNeeded().should.be.rejected();
156
+ });
157
+
158
+ it("Should return empty list for status 200 with data array", async () => {
159
+ sinon.stub(axios, "get").callsFake((url, opts = {}) => {
160
+ if (url.endsWith("/currencies")) {
161
+ return Promise.resolve({ status: 200, data: [] });
162
+ }
163
+ return axiosGetOriginal(url, opts);
164
+ });
165
+
166
+ await provider._fetchSupportedCurrenciesIfNeeded();
167
+
168
+ Array.isArray(provider._supportedCoins).should.be.true();
169
+ provider._supportedCoins.length.should.equal(0);
170
+ });
171
+
172
+ it("Should throw when /currencies responds with non-200 status", async () => {
173
+ sinon.stub(axios, "get").callsFake((url, opts = {}) => {
174
+ if (url.endsWith("/currencies")) {
175
+ return Promise.resolve({ status: 400, data: {} });
176
+ }
177
+ return axiosGetOriginal(url, opts);
178
+ });
179
+
180
+ await provider._fetchSupportedCurrenciesIfNeeded().should.be.rejected();
181
+ });
182
+
183
+ it("Should ensure every coin has a non-empty icon URL", async () => {
184
+ await provider._fetchSupportedCurrenciesIfNeeded();
185
+ provider._supportedCoins.length.should.be.above(0);
186
+ provider._supportedCoins.every(i => typeof i.iconURL === "string" && i.iconURL.length > 0).should.be.true();
187
+ });
188
+
189
+ it("Should persist raw meta fields exactly (code as-is; network as-is)", async () => {
190
+ const raw = await fetchRawCurrencies();
191
+ await provider._fetchSupportedCurrenciesIfNeeded();
192
+
193
+ const info = provider._supportedCoins.find(i => raw[i.code]);
194
+ should.exist(info);
195
+
196
+ const meta = raw[info.code];
197
+ should.exist(meta);
198
+
199
+ raw.should.have.property(info.code);
200
+
201
+ should(info.network).be.eql(meta.network);
202
+
203
+ const tag = (meta.tagname ?? "").trim();
204
+ if (tag) {
205
+ info.hasExtraId.should.be.true();
206
+ info.extraIdName.should.equal(tag);
207
+ } else {
208
+ info.hasExtraId.should.be.false();
209
+ should(info.extraIdName).be.null();
210
+ }
211
+ });
212
+
213
+ it("Should mark isPopular and use fallback icon when icon is missing", async () => {
214
+ sinon.stub(axios, "get").callsFake((url, opts = {}) => {
215
+ if (url.endsWith("/currencies")) {
216
+ return Promise.resolve({
217
+ status: 200,
218
+ data: {
219
+ BTC: { coinName: "Bitcoin", available: true },
220
+ DOGE: { coinName: "Dogecoin", available: true },
221
+ },
222
+ });
223
+ }
224
+ return axiosGetOriginal(url, opts);
225
+ });
226
+
227
+ await provider._fetchSupportedCurrenciesIfNeeded();
228
+ const btc = provider._supportedCoins.find(i => i.code === "BTC");
229
+ const doge = provider._supportedCoins.find(i => i.code === "DOGE");
230
+
231
+ btc.iconURL.should.equal(FALLBACK_ASSET_ICON_URL);
232
+ should.exist(btc.isPopular);
233
+ should.exist(doge.isPopular);
234
+ });
235
+
236
+ it("Should sort _supportedCoins: popular first, then alphabetically by ticker", async () => {
237
+ await provider._fetchSupportedCurrenciesIfNeeded();
238
+ const popular = [
239
+ "HMSTRTON",
240
+ "BTC",
241
+ "ETH",
242
+ "USDTERC20",
243
+ "USDTTRC20",
244
+ "USDCERC20",
245
+ "XRP",
246
+ "TON",
247
+ "XMR",
248
+ "TRX",
249
+ "DAIERC20",
250
+ "DOGE",
251
+ "BNB",
252
+ "PEPEERC20",
253
+ "NOTTON",
254
+ "SOL",
255
+ "DOT",
256
+ "LTC",
257
+ "SHIBERC20",
258
+ "AVAX",
259
+ "UNIERC20",
260
+ "LINKERC20",
261
+ "MATIC",
262
+ "BUSDBEP20",
263
+ "AAVEERC20",
264
+ "ATOM",
265
+ "RUNE",
266
+ "ADA",
267
+ ];
268
+ const list = provider._supportedCoins;
269
+
270
+ let reachedNonPopular = false;
271
+ for (const info of list) {
272
+ const isPop = popular.includes(info.coin.ticker);
273
+ if (!reachedNonPopular && !isPop) reachedNonPopular = true;
274
+ if (reachedNonPopular) isPop.should.be.false();
275
+ }
276
+
277
+ const nonPopularTickers = list.filter(i => !popular.includes(i.coin.ticker)).map(i => i.coin.ticker);
278
+ const sorted = [...nonPopularTickers].sort((a, b) => a.localeCompare(b));
279
+ nonPopularTickers.should.eql(sorted);
280
+ });
281
+
282
+ it("Should keep cache consistent under concurrent calls", async () => {
283
+ await Promise.all([
284
+ provider._fetchSupportedCurrenciesIfNeeded(),
285
+ provider._fetchSupportedCurrenciesIfNeeded(),
286
+ provider._fetchSupportedCurrenciesIfNeeded(),
287
+ ]);
288
+
289
+ provider._supportedCoins.length.should.be.above(0);
290
+ provider._supportedCoinsLastUpdateTimestamp.should.be.above(0);
291
+ });
292
+
293
+ it("Should map all known provider statuses via _mapGoexmeStatus", () => {
294
+ const mapGoexmeStatus = provider._mapGoexmeStatus.bind(provider);
295
+ mapGoexmeStatus("new").should.equal(provider.constructor.SWAP_STATUSES.WAITING_FOR_PAYMENT);
296
+ mapGoexmeStatus("waiting_deposit").should.equal(provider.constructor.SWAP_STATUSES.CONFIRMING);
297
+ mapGoexmeStatus("deposit_received").should.equal(provider.constructor.SWAP_STATUSES.PAYMENT_RECEIVED);
298
+ mapGoexmeStatus("exchanging").should.equal(provider.constructor.SWAP_STATUSES.EXCHANGING);
299
+ mapGoexmeStatus("sending").should.equal(provider.constructor.SWAP_STATUSES.EXCHANGING);
300
+ mapGoexmeStatus("success").should.equal(provider.constructor.SWAP_STATUSES.COMPLETED);
301
+ mapGoexmeStatus("time_expired").should.equal(provider.constructor.SWAP_STATUSES.EXPIRED);
302
+ mapGoexmeStatus("failed").should.equal(provider.constructor.SWAP_STATUSES.FAILED);
303
+ mapGoexmeStatus("sending_failed").should.equal(provider.constructor.SWAP_STATUSES.FAILED);
304
+ mapGoexmeStatus("reverted").should.equal(provider.constructor.SWAP_STATUSES.REFUNDED);
305
+ });
306
+ });
307
+ });