@rabbitio/ui-kit 1.0.0-beta.11 → 1.0.0-beta.111

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 (381) 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 +17666 -0
  9. package/coverage/coverage-final.json +119 -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 +382 -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/exolixSwapProvider.js.html +1891 -0
  56. package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/goexmeSwapProvider.js.html +2077 -0
  57. package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/index.html +191 -0
  58. package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/letsExchangeSwapProvider.js.html +1633 -0
  59. package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/swapProvider.js.html +1825 -0
  60. package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/swapspaceSwapProvider.js.html +1924 -0
  61. package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/utils.js.html +163 -0
  62. package/coverage/rabbit-ui-kit/src/swaps-lib/models/baseSwapCreationInfo.js.html +319 -0
  63. package/coverage/rabbit-ui-kit/src/swaps-lib/models/existingSwap.js.html +514 -0
  64. package/coverage/rabbit-ui-kit/src/swaps-lib/models/existingSwapWithFiatData.js.html +529 -0
  65. package/coverage/rabbit-ui-kit/src/swaps-lib/models/index.html +176 -0
  66. package/coverage/rabbit-ui-kit/src/swaps-lib/models/partner.js.html +166 -0
  67. package/coverage/rabbit-ui-kit/src/swaps-lib/models/swapProviderCoinInfo.js.html +331 -0
  68. package/coverage/rabbit-ui-kit/src/swaps-lib/services/index.html +116 -0
  69. package/coverage/rabbit-ui-kit/src/swaps-lib/services/publicSwapService.js.html +1570 -0
  70. package/coverage/rabbit-ui-kit/src/swaps-lib/utils/index.html +116 -0
  71. package/coverage/rabbit-ui-kit/src/swaps-lib/utils/swapUtils.js.html +706 -0
  72. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/arrowIcon.jsx.html +124 -0
  73. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/arrowTosca.jsx.html +127 -0
  74. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/arrowWhite.jsx.html +127 -0
  75. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/darkRectangle.jsx.html +106 -0
  76. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/determinedError.jsx.html +439 -0
  77. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/failedValidationIcon.jsx.html +202 -0
  78. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/index.html +281 -0
  79. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/infoIcon.jsx.html +133 -0
  80. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/messageIcon.jsx.html +346 -0
  81. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/noticeQuestionIcon.jsx.html +247 -0
  82. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/successfulValidationIcon.jsx.html +163 -0
  83. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/supportDialogImage.jsx.html +268 -0
  84. package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/walletIcon.jsx.html +151 -0
  85. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/AssetIcon/AssetIcon.jsx.html +256 -0
  86. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/AssetIcon/index.html +116 -0
  87. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/AssetSelection/AssetSelection.jsx.html +289 -0
  88. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/AssetSelection/index.html +116 -0
  89. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/BackgroundTitle/BackgroundTitle.jsx.html +187 -0
  90. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/BackgroundTitle/index.html +116 -0
  91. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/InformationMessage/InformationMessage.jsx.html +238 -0
  92. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/InformationMessage/index.html +116 -0
  93. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Input/Input.jsx.html +634 -0
  94. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Input/index.html +116 -0
  95. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/LoadingDots/LoadingDots.jsx.html +196 -0
  96. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/LoadingDots/index.html +116 -0
  97. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/NoticeIcon/NoticeIcon.jsx.html +277 -0
  98. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/NoticeIcon/index.html +116 -0
  99. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/QrCode/QrCode.jsx.html +199 -0
  100. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/QrCode/index.html +116 -0
  101. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/RateSelector/RateSelector.jsx.html +175 -0
  102. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/RateSelector/index.html +116 -0
  103. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/SupportChat/SupportChat.jsx.html +217 -0
  104. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/SupportChat/index.html +116 -0
  105. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Textarea/Textarea.jsx.html +529 -0
  106. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Textarea/index.html +116 -0
  107. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TitleBox/TitleBox.jsx.html +508 -0
  108. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TitleBox/index.html +116 -0
  109. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Tooltip/Tooltip.jsx.html +316 -0
  110. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Tooltip/index.html +116 -0
  111. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TwoLinesOfText/LinesOfText.jsx.html +313 -0
  112. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TwoLinesOfText/index.html +116 -0
  113. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Validation/Validation.jsx.html +202 -0
  114. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Validation/index.html +116 -0
  115. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/Button/Button.jsx.html +733 -0
  116. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/Button/index.html +116 -0
  117. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/Close/Close.jsx.html +259 -0
  118. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/Close/index.html +116 -0
  119. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/LinkButton/LinkButton.jsx.html +433 -0
  120. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/LinkButton/index.html +116 -0
  121. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx.html +415 -0
  122. package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/RadioButtonWithText/index.html +116 -0
  123. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/AmountInput/AmountInput.jsx.html +1429 -0
  124. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/AmountInput/index.html +116 -0
  125. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/CoinPicker/CoinPicker.jsx.html +1474 -0
  126. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/CoinPicker/index.html +116 -0
  127. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/ColoredNotice/ColoredNotice.jsx.html +241 -0
  128. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/ColoredNotice/index.html +116 -0
  129. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/LineWithIconLink/LineWithIconLink.jsx.html +190 -0
  130. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/LineWithIconLink/index.html +116 -0
  131. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/LogoCarousel/LogoCarousel.jsx.html +307 -0
  132. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/LogoCarousel/index.html +116 -0
  133. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/SearchableCoinsList/SearchableCoinsList.jsx.html +427 -0
  134. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/SearchableCoinsList/index.html +116 -0
  135. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx.html +181 -0
  136. package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/TitledLineWithIconLink/index.html +116 -0
  137. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx.html +283 -0
  138. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/CoinPickerDialogStep/index.html +116 -0
  139. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/Dialog.jsx.html +1567 -0
  140. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/DialogButtons/DialogButtons.jsx.html +481 -0
  141. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/DialogButtons/index.html +116 -0
  142. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/DialogStep/DialogStep.jsx.html +1747 -0
  143. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/DialogStep/index.html +116 -0
  144. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/index.html +116 -0
  145. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/SwapForm/SwapForm.jsx.html +4228 -0
  146. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/SwapForm/index.html +116 -0
  147. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/WaitlistSubscription/WaitlistSubscription.jsx.html +559 -0
  148. package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/WaitlistSubscription/index.html +116 -0
  149. package/coverage/rabbit-ui-kit/src/ui-kit/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx.html +316 -0
  150. package/coverage/rabbit-ui-kit/src/ui-kit/components/templates/DeterminedErrorDialogStep/index.html +116 -0
  151. package/coverage/rabbit-ui-kit/src/ui-kit/hooks/index.html +146 -0
  152. package/coverage/rabbit-ui-kit/src/ui-kit/hooks/useCallHandlingErrors.js.html +166 -0
  153. package/coverage/rabbit-ui-kit/src/ui-kit/hooks/useIsHydrated.js.html +121 -0
  154. package/coverage/rabbit-ui-kit/src/ui-kit/hooks/useReferredState.js.html +157 -0
  155. package/coverage/rabbit-ui-kit/src/ui-kit/utils/index.html +176 -0
  156. package/coverage/rabbit-ui-kit/src/ui-kit/utils/inputValueProviders.js.html +235 -0
  157. package/coverage/rabbit-ui-kit/src/ui-kit/utils/searchCoins.js.html +259 -0
  158. package/coverage/rabbit-ui-kit/src/ui-kit/utils/textUtils.js.html +139 -0
  159. package/coverage/rabbit-ui-kit/src/ui-kit/utils/uiUtils.js.html +121 -0
  160. package/coverage/rabbit-ui-kit/src/ui-kit/utils/urlQueryUtils.js.html +271 -0
  161. package/coverage/rabbit-ui-kit/stories/atoms/BackgroundTitle.stories.jsx.html +202 -0
  162. package/coverage/rabbit-ui-kit/stories/atoms/LinesOfText.stories.jsx.html +283 -0
  163. package/coverage/rabbit-ui-kit/stories/atoms/LoadingDots.stories.jsx.html +226 -0
  164. package/coverage/rabbit-ui-kit/stories/atoms/QrCode.stories.jsx.html +175 -0
  165. package/coverage/rabbit-ui-kit/stories/atoms/RateSelector.stories.jsx.html +136 -0
  166. package/coverage/rabbit-ui-kit/stories/atoms/Validation.stories.jsx.html +178 -0
  167. package/coverage/rabbit-ui-kit/stories/atoms/buttons/Button.stories.jsx.html +883 -0
  168. package/coverage/rabbit-ui-kit/stories/atoms/buttons/Close.stories.jsx.html +211 -0
  169. package/coverage/rabbit-ui-kit/stories/atoms/buttons/LinkButton.stories.jsx.html +301 -0
  170. package/coverage/rabbit-ui-kit/stories/atoms/buttons/index.html +146 -0
  171. package/coverage/rabbit-ui-kit/stories/atoms/index.html +191 -0
  172. package/coverage/rabbit-ui-kit/stories/molecules/AmountInput.stories.jsx.html +289 -0
  173. package/coverage/rabbit-ui-kit/stories/molecules/CoinPicker.stories.jsx.html +322 -0
  174. package/coverage/rabbit-ui-kit/stories/molecules/ColoredNotice.stories.jsx.html +178 -0
  175. package/coverage/rabbit-ui-kit/stories/molecules/LineWithIconLink.stories.jsx.html +154 -0
  176. package/coverage/rabbit-ui-kit/stories/molecules/LogoCarousel.stories.jsx.html +235 -0
  177. package/coverage/rabbit-ui-kit/stories/molecules/TitledLineWithIconLink.stories.jsx.html +160 -0
  178. package/coverage/rabbit-ui-kit/stories/molecules/index.html +191 -0
  179. package/coverage/rabbit-ui-kit/stories/organisms/Dialog/Dialog.stories.jsx.html +523 -0
  180. package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogButtons/DialogButtons.stories.jsx.html +328 -0
  181. package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogButtons/index.html +116 -0
  182. package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogStep/DialogStep.stories.jsx.html +337 -0
  183. package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogStep/index.html +116 -0
  184. package/coverage/rabbit-ui-kit/stories/organisms/Dialog/index.html +116 -0
  185. package/coverage/rabbit-ui-kit/stories/organisms/WaitlistSubscription.stories.jsx.html +151 -0
  186. package/coverage/rabbit-ui-kit/stories/organisms/index.html +116 -0
  187. package/coverage/rabbit-ui-kit/stories/stubs/coins.jsx.html +6880 -0
  188. package/coverage/rabbit-ui-kit/stories/stubs/exampleContent.jsx.html +145 -0
  189. package/coverage/rabbit-ui-kit/stories/stubs/index.html +131 -0
  190. package/coverage/rabbit-ui-kit/stories/templates/DeterminedErrorDialogStep.stories.jsx.html +190 -0
  191. package/coverage/rabbit-ui-kit/stories/templates/index.html +116 -0
  192. package/coverage/sort-arrow-sprite.png +0 -0
  193. package/coverage/sorter.js +196 -0
  194. package/dist/global.css +197 -0
  195. package/dist/global.css.map +1 -0
  196. package/dist/index.cjs +13003 -1052
  197. package/dist/index.cjs.map +1 -1
  198. package/dist/index.css +2350 -8491
  199. package/dist/index.css.map +1 -1
  200. package/dist/index.modern.js +9951 -847
  201. package/dist/index.modern.js.map +1 -1
  202. package/dist/index.module.js +12930 -1066
  203. package/dist/index.module.js.map +1 -1
  204. package/dist/index.umd.js +12994 -1055
  205. package/dist/index.umd.js.map +1 -1
  206. package/package.json +35 -9
  207. package/raw +1000 -0
  208. package/src/common-apis/adapters/analyticsAdapters/googleAnalyticsAdapter.js +22 -0
  209. package/src/common-apis/adapters/analyticsAdapters/metrikaAdapter.js +29 -0
  210. package/src/common-apis/adapters/analyticsAdapters/mixpanelAdapter.js +38 -0
  211. package/src/common-apis/adapters/axiosAdapter.js +35 -0
  212. package/src/common-apis/adapters/qrUtils.js +18 -0
  213. package/src/common-apis/external-apis/apiGroups.js +56 -0
  214. package/src/common-apis/external-apis/emailAPI.js +16 -0
  215. package/src/common-apis/external-apis/ipAddressProviders.js +102 -0
  216. package/src/common-apis/globalConstants.jsx +3 -0
  217. package/src/{common → common-apis}/models/coin.js +98 -7
  218. package/src/{common → common-apis/services}/fiatCurrenciesService.js +4 -12
  219. package/src/common-apis/tests/integration/external-apis/ipAddressProviders/getClientIpAddress.test.js +18 -0
  220. package/src/common-apis/tests/units/utils/amountUtils/composeRateText.test.js +152 -0
  221. package/src/{common → common-apis/utils}/amountUtils.js +100 -140
  222. package/src/{common → common-apis}/utils/cache.js +15 -41
  223. package/src/{common → common-apis/utils}/errorUtils.js +15 -0
  224. package/src/{common → common-apis}/utils/logging/logger.js +7 -13
  225. package/src/common-apis/utils/postponeExecution.js +11 -0
  226. package/src/common-apis/utils/rabbitTicker.js +24 -0
  227. package/src/index.js +90 -14
  228. package/src/robust-api-caller/cacheAndConcurrentRequestsResolver.js +525 -0
  229. package/src/robust-api-caller/cachedRobustExternalApiCallerService.js +147 -0
  230. package/src/robust-api-caller/cancelProcessing.js +29 -0
  231. package/src/robust-api-caller/concurrentCalculationsMetadataHolder.js +75 -0
  232. package/src/robust-api-caller/externalApiProvider.js +156 -0
  233. package/src/robust-api-caller/externalServicesStatsCollector.js +78 -0
  234. package/src/robust-api-caller/robustExternalAPICallerService.js +304 -0
  235. package/src/robust-api-caller/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/_performCallAttempt.test.js +533 -0
  236. package/src/robust-api-caller/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/callExternalAPI.test.js +532 -0
  237. package/src/robust-api-caller/tests/robustExternalAPICallerService/robustExternalAPICallerService/constructor.test.js +19 -0
  238. package/src/swaps-lib/external-apis/exolixSwapProvider.js +602 -0
  239. package/src/swaps-lib/external-apis/goexmeSwapProvider.js +664 -0
  240. package/src/swaps-lib/external-apis/letsExchangeSwapProvider.js +516 -0
  241. package/src/swaps-lib/external-apis/swapProvider.js +435 -24
  242. package/src/swaps-lib/external-apis/swapspaceSwapProvider.js +613 -0
  243. package/src/swaps-lib/external-apis/utils.js +26 -0
  244. package/src/swaps-lib/models/baseSwapCreationInfo.js +78 -0
  245. package/src/swaps-lib/models/existingSwap.js +101 -16
  246. package/src/swaps-lib/models/existingSwapWithFiatData.js +148 -0
  247. package/src/swaps-lib/models/partner.js +27 -0
  248. package/src/swaps-lib/models/swapProviderCoinInfo.js +82 -0
  249. package/src/swaps-lib/services/publicSwapService.js +495 -0
  250. package/src/swaps-lib/test/external-apis/exolixSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +34 -0
  251. package/src/swaps-lib/test/external-apis/exolixSwapProvider/createSwap.test.js +1043 -0
  252. package/src/swaps-lib/test/external-apis/exolixSwapProvider/getSwapInfo.test.js +611 -0
  253. package/src/swaps-lib/test/external-apis/goexmeSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +148 -0
  254. package/src/swaps-lib/test/external-apis/goexmeSwapProvider/createSwap.test.js +115 -0
  255. package/src/swaps-lib/test/external-apis/goexmeSwapProvider/getSwapInfo.test.js +149 -0
  256. package/src/swaps-lib/test/external-apis/goexmeSwapProvider/integration/PairSupport.int.test.js +97 -0
  257. package/src/swaps-lib/test/external-apis/goexmeSwapProvider/integration/_fetchSupportedCurrenciesIfNeeded.int.test.js +171 -0
  258. package/src/swaps-lib/test/external-apis/goexmeSwapProvider/integration/createSwap.int.test.js +239 -0
  259. package/src/swaps-lib/test/external-apis/goexmeSwapProvider/integration/getSwapInfo.int.test.js +141 -0
  260. package/src/swaps-lib/test/external-apis/swapProvider/getAllSupportedCurrencies.test.js +63 -0
  261. package/src/swaps-lib/test/external-apis/swapProvider/getDepositCurrencies.test.js +73 -0
  262. package/src/swaps-lib/test/external-apis/swapProvider/getWithdrawalCurrencies.test.js +102 -0
  263. package/src/swaps-lib/test/external-apis/swapProvider/removeProtocolNameFromCoinName.test.js +152 -0
  264. package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +536 -0
  265. package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/createSwap.test.js +1214 -0
  266. package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getSwapInfo.test.js +1743 -0
  267. package/src/swaps-lib/test/utils/swapUtils/safeHandleRequestsLimitExceeding.test.js +80 -0
  268. package/src/swaps-lib/utils/swapUtils.js +207 -0
  269. package/{styles → src/ui-kit/assets/styles}/_functions.scss +5 -0
  270. package/{styles → src/ui-kit/assets/styles}/_mixins.scss +2 -2
  271. package/{styles → src/ui-kit/assets/styles}/_placeholder.scss +3 -3
  272. package/{styles → src/ui-kit/assets/styles}/_variables.scss +17 -15
  273. package/src/ui-kit/assets/styles/fonts/NunitoSans-Bold.ttf +0 -0
  274. package/src/ui-kit/assets/styles/fonts/NunitoSans-ExtraBold.ttf +0 -0
  275. package/src/ui-kit/assets/styles/fonts/NunitoSans-Light.ttf +0 -0
  276. package/src/ui-kit/assets/styles/fonts/NunitoSans-Regular.ttf +0 -0
  277. package/src/ui-kit/assets/styles/fonts/NunitoSans-SemiBold.ttf +0 -0
  278. package/src/ui-kit/assets/styles/global.scss +171 -0
  279. package/src/ui-kit/assets/styles/index.scss +10 -0
  280. package/src/ui-kit/assets/wrappedImages/arrowIcon.jsx +13 -0
  281. package/src/ui-kit/assets/wrappedImages/arrowTosca.jsx +14 -0
  282. package/src/ui-kit/assets/wrappedImages/arrowWhite.jsx +14 -0
  283. package/src/ui-kit/assets/wrappedImages/darkRectangle.jsx +7 -0
  284. package/src/ui-kit/assets/wrappedImages/determinedError.jsx +118 -0
  285. package/src/ui-kit/assets/wrappedImages/failedValidationIcon.jsx +39 -0
  286. package/src/ui-kit/assets/wrappedImages/infoIcon.jsx +16 -0
  287. package/src/ui-kit/assets/wrappedImages/messageIcon.jsx +87 -0
  288. package/src/ui-kit/assets/wrappedImages/noticeQuestionIcon.jsx +54 -0
  289. package/src/ui-kit/assets/wrappedImages/successfulValidationIcon.jsx +26 -0
  290. package/src/ui-kit/assets/wrappedImages/supportDialogImage.jsx +61 -0
  291. package/src/ui-kit/assets/wrappedImages/walletIcon.jsx +22 -0
  292. package/src/{components → ui-kit/components}/atoms/AssetIcon/AssetIcon.jsx +16 -14
  293. package/src/{components → ui-kit/components}/atoms/AssetIcon/asset-icon.module.scss +1 -1
  294. package/src/ui-kit/components/atoms/AssetSelection/AssetSelection.jsx +68 -0
  295. package/src/ui-kit/components/atoms/AssetSelection/asset-selection.module.scss +56 -0
  296. package/src/ui-kit/components/atoms/BackgroundTitle/BackgroundTitle.jsx +34 -0
  297. package/src/ui-kit/components/atoms/BackgroundTitle/background-title.module.scss +52 -0
  298. package/src/ui-kit/components/atoms/InformationMessage/InformationMessage.jsx +51 -0
  299. package/src/ui-kit/components/atoms/InformationMessage/information-message.module.scss +38 -0
  300. package/src/ui-kit/components/atoms/Input/Input.jsx +183 -0
  301. package/src/ui-kit/components/atoms/Input/input.module.scss +107 -0
  302. package/src/{components → ui-kit/components}/atoms/LoadingDots/LoadingDots.jsx +8 -28
  303. package/src/{components → ui-kit/components}/atoms/LoadingDots/LoadingDots.module.scss +3 -2
  304. package/src/ui-kit/components/atoms/NoticeIcon/NoticeIcon.jsx +64 -0
  305. package/src/ui-kit/components/atoms/NoticeIcon/notice-icon.module.scss +14 -0
  306. package/src/ui-kit/components/atoms/QrCode/QrCode.jsx +38 -0
  307. package/src/ui-kit/components/atoms/QrCode/qr-code.module.scss +8 -0
  308. package/src/ui-kit/components/atoms/RateSelector/RateSelector.jsx +30 -0
  309. package/src/ui-kit/components/atoms/RateSelector/rate-selector.module.scss +47 -0
  310. package/src/{components → ui-kit/components}/atoms/SupportChat/SupportChat.jsx +5 -1
  311. package/src/ui-kit/components/atoms/Textarea/Textarea.jsx +148 -0
  312. package/src/ui-kit/components/atoms/Textarea/textarea.module.scss +71 -0
  313. package/src/ui-kit/components/atoms/TitleBox/TitleBox.jsx +141 -0
  314. package/src/ui-kit/components/atoms/TitleBox/title-box.module.scss +32 -0
  315. package/src/ui-kit/components/atoms/Tooltip/Tooltip.jsx +77 -0
  316. package/src/ui-kit/components/atoms/Tooltip/tooltip.module.scss +237 -0
  317. package/src/ui-kit/components/atoms/TwoLinesOfText/LinesOfText.jsx +76 -0
  318. package/src/ui-kit/components/atoms/TwoLinesOfText/lines-of-text.module.scss +65 -0
  319. package/src/ui-kit/components/atoms/Validation/Validation.jsx +39 -0
  320. package/src/ui-kit/components/atoms/Validation/validation.module.scss +19 -0
  321. package/src/{components → ui-kit/components}/atoms/buttons/Button/Button.jsx +26 -45
  322. package/src/{components → ui-kit/components}/atoms/buttons/Button/Button.module.scss +1 -1
  323. package/src/ui-kit/components/atoms/buttons/Close/Close.jsx +58 -0
  324. package/src/ui-kit/components/atoms/buttons/Close/close.module.scss +75 -0
  325. package/src/ui-kit/components/atoms/buttons/LinkButton/LinkButton.jsx +116 -0
  326. package/src/ui-kit/components/atoms/buttons/LinkButton/link-button.module.scss +53 -0
  327. package/src/ui-kit/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx +110 -0
  328. package/src/ui-kit/components/atoms/buttons/RadioButtonWithText/radio-button-with-text.module.scss +86 -0
  329. package/src/ui-kit/components/molecules/AmountInput/AmountInput.jsx +448 -0
  330. package/src/ui-kit/components/molecules/AmountInput/amount-input.module.scss +233 -0
  331. package/src/ui-kit/components/molecules/CoinPicker/CoinPicker.jsx +463 -0
  332. package/src/ui-kit/components/molecules/CoinPicker/coin-picker.module.scss +207 -0
  333. package/src/ui-kit/components/molecules/ColoredNotice/ColoredNotice.jsx +52 -0
  334. package/src/ui-kit/components/molecules/ColoredNotice/colored-notice.module.scss +36 -0
  335. package/src/ui-kit/components/molecules/LineWithIconLink/LineWithIconLink.jsx +35 -0
  336. package/src/ui-kit/components/molecules/LineWithIconLink/line-with-icon-link.module.scss +25 -0
  337. package/src/ui-kit/components/molecules/LogoCarousel/LogoCarousel.jsx +74 -0
  338. package/src/ui-kit/components/molecules/LogoCarousel/logo-carousel.module.scss +106 -0
  339. package/src/ui-kit/components/molecules/SearchableCoinsList/SearchableCoinsList.jsx +114 -0
  340. package/src/ui-kit/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx +32 -0
  341. package/src/ui-kit/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx +66 -0
  342. package/src/ui-kit/components/organisms/Dialog/Dialog.jsx +494 -0
  343. package/src/ui-kit/components/organisms/Dialog/DialogButtons/DialogButtons.jsx +132 -0
  344. package/src/ui-kit/components/organisms/Dialog/DialogButtons/dialog-buttons.module.scss +25 -0
  345. package/src/ui-kit/components/organisms/Dialog/DialogStep/DialogStep.jsx +554 -0
  346. package/src/ui-kit/components/organisms/Dialog/DialogStep/dialog-step.module.scss +382 -0
  347. package/src/ui-kit/components/organisms/Dialog/dialog.module.scss +226 -0
  348. package/src/ui-kit/components/organisms/SwapForm/SwapForm.jsx +1381 -0
  349. package/src/ui-kit/components/organisms/SwapForm/swap-form.module.scss +134 -0
  350. package/src/ui-kit/components/organisms/WaitlistSubscription/WaitlistSubscription.jsx +158 -0
  351. package/src/ui-kit/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx +77 -0
  352. package/src/ui-kit/hooks/useCallHandlingErrors.js +27 -0
  353. package/src/ui-kit/hooks/useIsHydrated.js +12 -0
  354. package/src/ui-kit/hooks/useReferredState.js +24 -0
  355. package/src/ui-kit/tests/utils/inputValueProviders/provideFormatOfFloatValueByInputString.test.js +146 -0
  356. package/src/ui-kit/tests/utils/urlQueryUtils/getQueryParameterValues.test.js +65 -0
  357. package/src/ui-kit/tests/utils/urlQueryUtils/saveQueryParameterAndValues.test.js +104 -0
  358. package/src/ui-kit/utils/inputValueProviders.js +50 -0
  359. package/src/ui-kit/utils/searchCoins.js +58 -0
  360. package/src/ui-kit/utils/textUtils.js +18 -0
  361. package/src/ui-kit/utils/uiUtils.js +12 -0
  362. package/src/ui-kit/utils/urlQueryUtils.js +62 -0
  363. package/stories/font.scss +40 -0
  364. package/stories/stubs/coins.jsx +2266 -0
  365. package/stories/stubs/exampleContent.jsx +20 -0
  366. package/styles/_global-classes.scss +0 -433
  367. package/styles/fonts/NunitoSans-Bold.ttf +0 -0
  368. package/styles/fonts/NunitoSans-ExtraBold.ttf +0 -0
  369. package/styles/fonts/NunitoSans-Light.ttf +0 -0
  370. package/styles/fonts/NunitoSans-Regular.ttf +0 -0
  371. package/styles/fonts/NunitoSans-SemiBold.ttf +0 -0
  372. package/styles/global-styles-index.scss +0 -74
  373. package/styles/index.scss +0 -33
  374. /package/src/{common → common-apis}/models/blockchain.js +0 -0
  375. /package/src/{common → common-apis}/models/protocol.js +0 -0
  376. /package/src/{common → common-apis}/utils/logging/logsStorage.js +0 -0
  377. /package/src/{common → common-apis}/utils/safeStringify.js +0 -0
  378. /package/{styles → src/ui-kit/assets/styles}/colors/_light-colors.scss +0 -0
  379. /package/{styles → src/ui-kit/assets/styles}/colors/_solid-colors.scss +0 -0
  380. /package/{styles → src/ui-kit/assets/styles}/size/_margin-size.scss +0 -0
  381. /package/{styles → src/ui-kit/assets/styles}/size/_padding-size.scss +0 -0
@@ -0,0 +1,239 @@
1
+ import "dotenv/config";
2
+ import { describe, it, beforeEach, afterEach, expect, vi } from "vitest";
3
+ import axios from "axios";
4
+ import BigNumber from "bignumber.js";
5
+
6
+ import { Cache } from "../../../../../common-apis/utils/cache.js";
7
+ import { GoexmeSwapProvider } from "../../../../external-apis/goexmeSwapProvider.js";
8
+
9
+ const GOEXME_API_KEY = process.env.GOEXME_API_KEY?.trim?.() || "";
10
+ const maybeDescribe = GOEXME_API_KEY ? describe : describe.skip;
11
+
12
+ maybeDescribe("GoexmeSwapProvider#createSwap – live integration", () => {
13
+ let provider;
14
+ const axiosOriginalGet = axios.get;
15
+
16
+ beforeEach(async () => {
17
+ provider = new GoexmeSwapProvider("/", new Cache(), () => null, false, GOEXME_API_KEY);
18
+ await provider._fetchSupportedCurrenciesIfNeeded();
19
+ await provider._ensurePairsLoaded();
20
+ });
21
+
22
+ afterEach(() => {
23
+ axios.get = axiosOriginalGet;
24
+ });
25
+
26
+ const byCode = code => provider._supportedCoins.find(c => c.code === code)?.coin || null;
27
+ const hasPair = (from, to) =>
28
+ provider._pairsCache?.[from.code]?.has(to.code) || provider._pairsCache?.[from]?.has(to);
29
+
30
+ const pickAmount = async (from, to, fallback) => {
31
+ const info = await provider.getSwapInfo(from, to, fallback);
32
+ if (info.result) return fallback;
33
+ if (info.reason === provider.constructor.NO_SWAPS_REASONS.TOO_LOW && info.smallestMin) {
34
+ return new BigNumber(info.smallestMin).times(1.1).toFixed(from.digits);
35
+ }
36
+ throw new Error(`Unable to pick viable amount for ${from.ticker} → ${to.ticker}`);
37
+ };
38
+
39
+ it("creates FLOAT BTC → ETH swap", async () => {
40
+ const BTC = byCode("BTC");
41
+ const ETH = byCode("ETH");
42
+ if (!BTC || !ETH || !hasPair(BTC, ETH)) return;
43
+
44
+ const amount = await pickAmount(BTC, ETH, "0.001");
45
+ const dto = await provider.createSwap(
46
+ BTC,
47
+ ETH,
48
+ amount,
49
+ "bc1qw508d6qejxtdg4y5r3zarvaryvaxxpcs",
50
+ "",
51
+ null,
52
+ null,
53
+ false
54
+ );
55
+
56
+ expect(dto.result).toBe(true);
57
+ expect(dto.fixed).toBe(false);
58
+ expect(dto.swapId).toBeTruthy();
59
+ });
60
+
61
+ it("creates FIXED BTC → ETH swap", async () => {
62
+ const BTC = byCode("BTC");
63
+ const ETH = byCode("ETH");
64
+ if (!BTC || !ETH || !hasPair(BTC, ETH)) return;
65
+
66
+ const amount = await pickAmount(BTC, ETH, "0.002");
67
+ const dto = await provider.createSwap(
68
+ BTC,
69
+ ETH,
70
+ amount,
71
+ "bc1qw508d6qejxtdg4y5r3zarvaryvaxxpcs",
72
+ "",
73
+ null,
74
+ null,
75
+ true
76
+ );
77
+
78
+ expect(dto.fixed).toBe(true);
79
+ expect(provider._cache.get(`goexme_fixed_ttl_${dto.swapId}`)).toBe(true);
80
+ });
81
+
82
+ it("creates ETH → TRX swap", async () => {
83
+ const ETH = byCode("ETH");
84
+ const TRX = byCode("TRX");
85
+ if (!ETH || !TRX || !hasPair(ETH, TRX)) return;
86
+
87
+ const amount = await pickAmount(ETH, TRX, "0.05");
88
+ const dto = await provider.createSwap(
89
+ ETH,
90
+ TRX,
91
+ amount,
92
+ "T123456789012345678901234567890123",
93
+ "",
94
+ null,
95
+ null,
96
+ false
97
+ );
98
+
99
+ expect(dto.result).toBe(true);
100
+ expect(dto.fromCoin.ticker).toBe("ETH");
101
+ expect(dto.toCoin.ticker).toBe("TRX");
102
+ });
103
+
104
+ it("creates XMR → BTC swap", async () => {
105
+ const XMR = byCode("XMR");
106
+ const BTC = byCode("BTC");
107
+ if (!XMR || !BTC || !hasPair(XMR, BTC)) return;
108
+
109
+ const amount = await pickAmount(XMR, BTC, "1");
110
+ const dto = await provider.createSwap(
111
+ XMR,
112
+ BTC,
113
+ amount,
114
+ "bc1qw508d6qejxtdg4y5r3zarvaryvaxxpcs",
115
+ "",
116
+ null,
117
+ null,
118
+ false
119
+ );
120
+
121
+ expect(dto.result).toBe(true);
122
+ expect(dto.fromCoin.ticker).toBe("XMR");
123
+ expect(dto.toCoin.ticker).toBe("BTC");
124
+ });
125
+
126
+ it("creates USDT(TRC20) → ETH swap", async () => {
127
+ const USDTTRC20 = byCode("USDTTRC20");
128
+ const ETH = byCode("ETH");
129
+ if (!USDTTRC20 || !ETH || !hasPair(USDTTRC20, ETH)) return;
130
+
131
+ const amount = await pickAmount(USDTTRC20, ETH, "400");
132
+ const dto = await provider.createSwap(
133
+ USDTTRC20,
134
+ ETH,
135
+ amount,
136
+ "0xAb5801a7D398351b8bE11C439e05C5b3259aec9B",
137
+ "",
138
+ null,
139
+ null,
140
+ false
141
+ );
142
+
143
+ expect(dto.result).toBe(true);
144
+ expect(dto.fromCoin.ticker.toUpperCase()).toMatch(/USDT.*TRC20/);
145
+ expect(dto.toCoin.ticker).toBe("ETH");
146
+ });
147
+
148
+ it("passes refund address to exchange-create call", async () => {
149
+ const USDT = byCode("USDT");
150
+ const BTC = byCode("BTC");
151
+ if (!USDT || !BTC || !hasPair(USDT, BTC)) return;
152
+
153
+ const refundAddr = "0xebb97aa373adec59b33959d2dd67da54dcc0ae00";
154
+ let capturedParams = null;
155
+
156
+ axios.get = async (url, cfg = {}) => {
157
+ if (url.endsWith("/exchange-create")) capturedParams = cfg.params;
158
+ return axiosOriginalGet(url, cfg);
159
+ };
160
+
161
+ const amount = await pickAmount(USDT, BTC, "1000");
162
+ await provider.createSwap(
163
+ USDT,
164
+ BTC,
165
+ amount,
166
+ "bc1qw508d6qejxtdg4y5r3zarvaryvaxxpcs",
167
+ refundAddr,
168
+ null,
169
+ null,
170
+ false
171
+ );
172
+
173
+ expect(capturedParams?.refundAddress).toBe(refundAddr);
174
+ });
175
+
176
+ it("adds destinationTag when target coin requires it", async () => {
177
+ const BTC = byCode("BTC");
178
+ const XRP = byCode("XRP");
179
+ if (!BTC || !XRP || !hasPair(BTC, XRP)) return;
180
+
181
+ let capturedParams = null;
182
+ axios.get = async (url, cfg = {}) => {
183
+ if (url.endsWith("/exchange-create")) capturedParams = cfg.params;
184
+ return axiosOriginalGet(url, cfg);
185
+ };
186
+
187
+ const amount = await pickAmount(BTC, XRP, "0.002");
188
+ await provider.createSwap(
189
+ BTC,
190
+ XRP,
191
+ amount,
192
+ "rUpy3eEg8rqjqfUoLeBnZkscbKbfsPrgd",
193
+ "",
194
+ null,
195
+ null,
196
+ false,
197
+ "MEMO123"
198
+ );
199
+
200
+ expect(capturedParams?.destinationTag).toBe("MEMO123");
201
+ });
202
+
203
+ it("omits destinationTag when target coin has no extraId", async () => {
204
+ const BTC = byCode("BTC");
205
+ const ETH = byCode("ETH");
206
+ if (!BTC || !ETH || !hasPair(BTC, ETH)) return;
207
+
208
+ let capturedParams = null;
209
+ axios.get = async (url, cfg = {}) => {
210
+ if (url.endsWith("/exchange-create")) capturedParams = cfg.params;
211
+ return axiosOriginalGet(url, cfg);
212
+ };
213
+
214
+ const amount = await pickAmount(BTC, ETH, "0.001");
215
+ await provider.createSwap(
216
+ BTC,
217
+ ETH,
218
+ amount,
219
+ "0xAb5801a7D398351b8bE11C439e05C5b3259aec9B",
220
+ "",
221
+ null,
222
+ null,
223
+ false
224
+ );
225
+
226
+ expect(capturedParams).not.toHaveProperty("destinationTag");
227
+ });
228
+
229
+ it("returns pairNotSupported for JOE → TRX", async () => {
230
+ const JOE = byCode("JOE");
231
+ const TRX = byCode("TRX");
232
+ if (!JOE || !TRX) return;
233
+
234
+ const info = await provider.getSwapInfo(JOE, TRX, "50");
235
+
236
+ expect(info.result).toBe(false);
237
+ expect(info.reason).toBe(provider.constructor.NO_SWAPS_REASONS.NOT_SUPPORTED);
238
+ });
239
+ });
@@ -0,0 +1,141 @@
1
+ import "dotenv/config";
2
+ import { describe, it, beforeEach, afterEach, expect, vi } from "vitest";
3
+ import axios from "axios";
4
+ import BigNumber from "bignumber.js";
5
+ import { Cache } from "../../../../../common-apis/utils/cache.js";
6
+ import { GoexmeSwapProvider } from "../../../../external-apis/goexmeSwapProvider.js";
7
+
8
+ const GOEXME_API_KEY = process.env.GOEXME_API_KEY?.trim?.() || "";
9
+ const maybeDescribe = GOEXME_API_KEY ? describe : describe.skip;
10
+
11
+ maybeDescribe("GoexmeSwapProvider#getSwapInfo – live integration", () => {
12
+ let provider;
13
+ const axiosOriginalGet = axios.get;
14
+
15
+ beforeEach(async () => {
16
+ provider = new GoexmeSwapProvider("/", new Cache(), () => null, false, GOEXME_API_KEY);
17
+ await provider._fetchSupportedCurrenciesIfNeeded();
18
+ await provider._ensurePairsLoaded();
19
+ });
20
+
21
+ afterEach(() => {
22
+ axios.get = axiosOriginalGet;
23
+ });
24
+
25
+ const byCode = code => provider._supportedCoins.find(c => c.code === code)?.coin || null;
26
+ const pickAmount = async (from, to, fallback) => {
27
+ const info = await provider.getSwapInfo(from, to, fallback);
28
+ if (info.result) return fallback;
29
+ if (info.reason === provider.constructor.NO_SWAPS_REASONS.TOO_LOW && info.smallestMin) {
30
+ return new BigNumber(info.smallestMin).times(1.1).toFixed(from.digits);
31
+ }
32
+ throw new Error();
33
+ };
34
+
35
+ it("happy path BTC → ETH", async () => {
36
+ const BTC = byCode("BTC");
37
+ const ETH = byCode("ETH");
38
+ const amount = await pickAmount(BTC, ETH, "0.001");
39
+ const info = await provider.getSwapInfo(BTC, ETH, amount);
40
+ expect(info.result).toBe(true);
41
+ expect(parseFloat(info.rate)).toBeGreaterThan(0);
42
+ expect(Number(info.min)).toBeLessThanOrEqual(Number(amount));
43
+ expect(Number(info.max)).toBeGreaterThan(Number(amount));
44
+ });
45
+
46
+ it("pair not supported JOE → TRX", async () => {
47
+ const JOE = byCode("JOE");
48
+ const TRX = byCode("TRX");
49
+ if (!JOE || !TRX) return;
50
+ const info = await provider.getSwapInfo(JOE, TRX, "50");
51
+ expect(info.result).toBe(false);
52
+ expect(info.reason).toBe(provider.constructor.NO_SWAPS_REASONS.NOT_SUPPORTED);
53
+ });
54
+
55
+ it("too low amount", async () => {
56
+ const BTC = byCode("BTC");
57
+ const ETH = byCode("ETH");
58
+ const minInfo = await provider.getSwapInfo(BTC, ETH, "0.001");
59
+ const low = new BigNumber(minInfo.min || "0.0001").div(10).toFixed(BTC.digits);
60
+ const info = await provider.getSwapInfo(BTC, ETH, low);
61
+ expect(info.result).toBe(false);
62
+ expect(info.reason).toBe(provider.constructor.NO_SWAPS_REASONS.TOO_LOW);
63
+ });
64
+
65
+ it("too high amount", async () => {
66
+ const BTC = byCode("BTC");
67
+ const ETH = byCode("ETH");
68
+ const base = await provider.getSwapInfo(BTC, ETH, "0.001");
69
+ const high = new BigNumber(base.max || "1").times(50).toFixed(BTC.digits);
70
+ const info = await provider.getSwapInfo(BTC, ETH, high);
71
+ expect(info.result).toBe(false);
72
+ expect(info.reason).toBe(provider.constructor.NO_SWAPS_REASONS.TOO_HIGH);
73
+ });
74
+
75
+ it("rate limit", async () => {
76
+ axios.get = vi.fn((url, cfg) =>
77
+ url.endsWith("/rate") ? Promise.reject({ response: { status: 429 } }) : axiosOriginalGet(url, cfg)
78
+ );
79
+ const BTC = byCode("BTC");
80
+ const ETH = byCode("ETH");
81
+ const info = await provider.getSwapInfo(BTC, ETH, "0.1");
82
+ expect(info.result).toBe(false);
83
+ expect(info.reason).toBe(provider.constructor.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED);
84
+ });
85
+
86
+ it("amount param equals passed amount when amountIsToReceive=false", async () => {
87
+ let captured = null;
88
+ axios.get = async (url, cfg = {}) => {
89
+ if (url.endsWith("/rate")) captured = cfg.params.amount;
90
+ return axiosOriginalGet(url, cfg);
91
+ };
92
+ const BTC = byCode("BTC");
93
+ const ETH = byCode("ETH");
94
+ await provider.getSwapInfo(BTC, ETH, "0.5");
95
+ expect(captured).toBe("0.5");
96
+ });
97
+
98
+ it("includes fix=true when fixed quote requested", async () => {
99
+ let captured = null;
100
+ axios.get = async (url, cfg = {}) => {
101
+ if (url.endsWith("/rate")) captured = cfg.params.fix;
102
+ return axiosOriginalGet(url, cfg);
103
+ };
104
+ const BTC = byCode("BTC");
105
+ const ETH = byCode("ETH");
106
+ await provider.getSwapInfo(BTC, ETH, "0.2", true);
107
+ expect(captured).toBe(true);
108
+ });
109
+
110
+ it("handles duplicated tickers", async () => {
111
+ const DUP = byCode("USDTTRC20TRC20");
112
+ const BTC = byCode("BTC");
113
+ if (!DUP) return;
114
+ const info = await provider.getSwapInfo(DUP, BTC, "50");
115
+ expect(info.result).toBe(true);
116
+ });
117
+
118
+ it("validates hasExtraId and extraIdName for every allowed coin", async () => {
119
+ // Fetch raw currencies directly from GoExme to compare against adapter output
120
+ const raw = await axiosOriginalGet(`${provider._URL}/currencies`, {
121
+ params: { key: GOEXME_API_KEY },
122
+ }).then(r => r.data);
123
+
124
+ await provider._fetchSupportedCurrenciesIfNeeded();
125
+
126
+ Object.entries(raw)
127
+ .filter(([, meta]) => meta?.available === true)
128
+ .forEach(([code, meta]) => {
129
+ const info = provider._supportedCoins.find(c => c.code === code.toUpperCase());
130
+ if (!info) return; // Coin might be filtered out by allow‑list
131
+ const tagRaw = (meta.tagname ?? "").trim();
132
+ const expectsExtra = tagRaw.length > 0;
133
+ expect(info.hasExtraId).toBe(expectsExtra);
134
+ if (expectsExtra) {
135
+ expect(info.extraIdName).toBe(tagRaw);
136
+ } else {
137
+ expect(info.extraIdName).toBeNull();
138
+ }
139
+ });
140
+ });
141
+ });
@@ -0,0 +1,63 @@
1
+ import sinon from "sinon";
2
+ import should from "should";
3
+
4
+ import { beforeEach, afterEach, describe, it } from "vitest";
5
+
6
+ import { SwapProvider } from "../../../external-apis/swapProvider.js";
7
+ import { Cache } from "../../../../common-apis/utils/cache.js";
8
+
9
+ describe("swapProvider", function () {
10
+ describe("getAllSupportedCurrencies", function () {
11
+ const swapProvider = new SwapProvider(new Cache());
12
+
13
+ let _fetchSupportedCurrenciesIfNeededStub;
14
+ beforeEach(() => {
15
+ _fetchSupportedCurrenciesIfNeededStub = sinon.stub(swapProvider, "_fetchSupportedCurrenciesIfNeeded");
16
+ });
17
+
18
+ afterEach(() => {
19
+ _fetchSupportedCurrenciesIfNeededStub.restore();
20
+ swapProvider._supportedCoins = [];
21
+ });
22
+
23
+ it("Should return an error if the response status is 429", async () => {
24
+ _fetchSupportedCurrenciesIfNeededStub.resetBehavior();
25
+ _fetchSupportedCurrenciesIfNeededStub.rejects({
26
+ response: { status: 429 },
27
+ });
28
+
29
+ const result = await swapProvider.getAllSupportedCurrencies();
30
+ result.should.deepEqual({
31
+ result: false,
32
+ reason: SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED,
33
+ });
34
+ });
35
+
36
+ it("Should return an object with 'result' set to true and an array of supported coins if there is initialized list", async () => {
37
+ swapProvider._supportedCoins = [{ coin: { t: "BTC" }, extraId: "" }, { coin: 1 }, { coin: "4" }];
38
+ const expectedCoins = swapProvider._supportedCoins.map(item => item.coin);
39
+
40
+ const result = await swapProvider.getAllSupportedCurrencies();
41
+
42
+ result.should.deepEqual({ result: true, coins: expectedCoins });
43
+ });
44
+
45
+ it("Should always call _fetchSupportedCurrenciesIfNeeded ones", async () => {
46
+ await swapProvider.getAllSupportedCurrencies();
47
+
48
+ _fetchSupportedCurrenciesIfNeededStub.calledOnce.should.be.true();
49
+ });
50
+
51
+ it("Should throw an error if an error occurs while fetching supported currencies", async () => {
52
+ _fetchSupportedCurrenciesIfNeededStub.throws(new Error("Error fetching supported currencies"));
53
+
54
+ try {
55
+ await swapProvider.getAllSupportedCurrencies();
56
+ should.fail("Expected an error to be thrown");
57
+ } catch (error) {
58
+ error.should.be.instanceOf(Error);
59
+ error.message.should.containEql("Error fetching supported currencies");
60
+ }
61
+ });
62
+ });
63
+ });
@@ -0,0 +1,73 @@
1
+ import sinon from "sinon";
2
+ import should from "should";
3
+
4
+ import { beforeEach, afterEach, describe, it } from "vitest";
5
+
6
+ import { SwapProvider } from "../../../external-apis/swapProvider.js";
7
+ import { Cache } from "../../../../common-apis/utils/cache.js";
8
+
9
+ describe("swapProvider", function () {
10
+ describe("getDepositCurrencies", function () {
11
+ const swapProvider = new SwapProvider(new Cache());
12
+
13
+ let _fetchSupportedCurrenciesIfNeededStub;
14
+ beforeEach(() => {
15
+ _fetchSupportedCurrenciesIfNeededStub = sinon.stub(swapProvider, "_fetchSupportedCurrenciesIfNeeded");
16
+ });
17
+
18
+ afterEach(() => {
19
+ _fetchSupportedCurrenciesIfNeededStub.restore();
20
+ swapProvider._supportedCoins = [];
21
+ });
22
+
23
+ it("Should return an error if the response status is 429", async () => {
24
+ _fetchSupportedCurrenciesIfNeededStub.resetBehavior();
25
+ _fetchSupportedCurrenciesIfNeededStub.rejects({
26
+ response: { status: 429 },
27
+ });
28
+
29
+ const result = await swapProvider.getDepositCurrencies();
30
+ result.should.deepEqual({
31
+ result: false,
32
+ reason: SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED,
33
+ });
34
+ });
35
+
36
+ it("Should return an object with 'result' set to true and an array of supported coins having deposit == true", async () => {
37
+ swapProvider._supportedCoins = [
38
+ {
39
+ coin: { t: "BTC" },
40
+ extraId: "",
41
+ withdrawal: true,
42
+ deposit: true,
43
+ },
44
+ { coin: 1, withdrawal: false, deposit: true },
45
+ { coin: "4", withdrawal: true, deposit: null },
46
+ { coin: "-12312", withdrawal: null, deposit: false },
47
+ ];
48
+ const expectedCoins = swapProvider._supportedCoins.filter(i => i.deposit).map(item => item.coin);
49
+
50
+ const result = await swapProvider.getDepositCurrencies();
51
+
52
+ result.should.deepEqual({ result: true, coins: expectedCoins });
53
+ });
54
+
55
+ it("Should always call _fetchSupportedCurrenciesIfNeeded ones", async () => {
56
+ await swapProvider.getDepositCurrencies();
57
+
58
+ _fetchSupportedCurrenciesIfNeededStub.calledOnce.should.be.true();
59
+ });
60
+
61
+ it("Should throw an error if an error occurs while fetching supported currencies", async () => {
62
+ _fetchSupportedCurrenciesIfNeededStub.throws(new Error("Error fetching supported currencies"));
63
+
64
+ try {
65
+ await swapProvider.getDepositCurrencies();
66
+ should.fail("Expected an error to be thrown");
67
+ } catch (error) {
68
+ error.should.be.instanceOf(Error);
69
+ error.message.should.containEql("Error fetching supported currencies");
70
+ }
71
+ });
72
+ });
73
+ });
@@ -0,0 +1,102 @@
1
+ import sinon from "sinon";
2
+ import should from "should";
3
+
4
+ import { beforeEach, afterEach, describe, it } from "vitest";
5
+
6
+ import { SwapProvider } from "../../../external-apis/swapProvider.js";
7
+ import { Cache } from "../../../../common-apis/utils/cache.js";
8
+
9
+ describe("swapProvider", function () {
10
+ describe("getWithdrawalCurrencies", function () {
11
+ const swapProvider = new SwapProvider(new Cache());
12
+
13
+ let _fetchSupportedCurrenciesIfNeededStub;
14
+ beforeEach(() => {
15
+ _fetchSupportedCurrenciesIfNeededStub = sinon.stub(swapProvider, "_fetchSupportedCurrenciesIfNeeded");
16
+ });
17
+
18
+ afterEach(() => {
19
+ _fetchSupportedCurrenciesIfNeededStub.restore();
20
+ swapProvider._supportedCoins = [];
21
+ });
22
+
23
+ it("Should return an error if the response status is 429", async () => {
24
+ _fetchSupportedCurrenciesIfNeededStub.resetBehavior();
25
+ _fetchSupportedCurrenciesIfNeededStub.rejects({
26
+ response: { status: 429 },
27
+ });
28
+
29
+ const result = await swapProvider.getWithdrawalCurrencies();
30
+ result.should.deepEqual({
31
+ result: false,
32
+ reason: SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED,
33
+ });
34
+ });
35
+
36
+ it("Should return an object with 'result' set to true and an array of supported coins having withdrawal == true", async () => {
37
+ swapProvider._supportedCoins = [
38
+ {
39
+ coin: { t: "BTC" },
40
+ extraId: "",
41
+ withdrawal: true,
42
+ deposit: true,
43
+ },
44
+ { coin: 1, withdrawal: false, deposit: true },
45
+ { coin: "4", withdrawal: true, deposit: null },
46
+ { coin: "-12312", withdrawal: null, deposit: false },
47
+ ];
48
+ const expectedCoins = swapProvider._supportedCoins.filter(i => i.withdrawal).map(item => item.coin);
49
+
50
+ const result = await swapProvider.getWithdrawalCurrencies();
51
+
52
+ result.should.deepEqual({ result: true, coins: expectedCoins });
53
+ });
54
+
55
+ it("Should return an object with 'result' set to true and an array of supported coins having withdrawal == true except the passed coin ticker", async () => {
56
+ swapProvider._supportedCoins = [
57
+ {
58
+ coin: { ticker: "BTC" },
59
+ extraId: "",
60
+ withdrawal: true,
61
+ deposit: true,
62
+ },
63
+ {
64
+ coin: { ticker: "ALGO" },
65
+ extraId: "",
66
+ withdrawal: true,
67
+ deposit: true,
68
+ },
69
+ { coin: 1, withdrawal: false, deposit: null },
70
+ { coin: "4", withdrawal: true, deposit: true },
71
+ { coin: "-12312", withdrawal: null, deposit: false },
72
+ ];
73
+ const expectedCoins = swapProvider._supportedCoins
74
+ .filter(i => i.withdrawal && i.coin.ticker !== "ALGO")
75
+ .map(item => item.coin);
76
+
77
+ const result = await swapProvider.getWithdrawalCurrencies({
78
+ ticker: "ALGO",
79
+ });
80
+
81
+ result.should.deepEqual({ result: true, coins: expectedCoins });
82
+ });
83
+
84
+ it("Should always call _fetchSupportedCurrenciesIfNeeded ones", async () => {
85
+ await swapProvider.getWithdrawalCurrencies();
86
+
87
+ _fetchSupportedCurrenciesIfNeededStub.calledOnce.should.be.true();
88
+ });
89
+
90
+ it("Should throw an error if an error occurs while fetching supported currencies", async () => {
91
+ _fetchSupportedCurrenciesIfNeededStub.rejects(new Error("Error fetching supported currencies"));
92
+
93
+ try {
94
+ await swapProvider.getWithdrawalCurrencies();
95
+ should.fail("Expected an error to be thrown");
96
+ } catch (error) {
97
+ error.should.be.instanceOf(Error);
98
+ error.message.should.containEql("Error fetching supported currencies");
99
+ }
100
+ });
101
+ });
102
+ });