@rabbitio/ui-kit 1.0.0-beta.72 → 1.0.0-beta.74

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 (253) hide show
  1. package/coverage/clover.xml +6441 -1864
  2. package/coverage/coverage-final.json +157 -95
  3. package/coverage/index.html +339 -84
  4. package/coverage/{rabbit-ui-kit → ui-kit}/index.html +3 -3
  5. package/coverage/{rabbit-ui-kit → ui-kit}/index.js.html +3 -3
  6. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/adapters/axiosAdapter.js.html +3 -3
  7. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/adapters/index.html +3 -3
  8. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/adapters/qrUtils.js.html +3 -3
  9. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/amountUtils.js.html +3 -3
  10. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/errorUtils.js.html +3 -3
  11. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/external-apis/apiGroups.js.html +3 -3
  12. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/external-apis/index.html +3 -3
  13. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/external-apis/ipAddressProviders.js.html +3 -3
  14. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/fiatCurrenciesService.js.html +3 -3
  15. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/globalConstants.jsx.html +3 -3
  16. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/index.html +3 -3
  17. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/models/blockchain.js.html +3 -3
  18. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/models/coin.js.html +3 -3
  19. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/models/index.html +3 -3
  20. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/models/protocol.js.html +3 -3
  21. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/cache.js.html +8 -8
  22. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/emailAPI.js.html +3 -3
  23. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/index.html +3 -3
  24. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/logging/index.html +3 -3
  25. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/logging/logger.js.html +3 -3
  26. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/logging/logsStorage.js.html +3 -3
  27. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/postponeExecution.js.html +3 -3
  28. package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/safeStringify.js.html +3 -3
  29. package/coverage/{rabbit-ui-kit → ui-kit}/src/index.html +3 -3
  30. package/coverage/{rabbit-ui-kit → ui-kit}/src/index.js.html +3 -3
  31. package/coverage/{rabbit-ui-kit → ui-kit}/src/robust-api-caller/cacheAndConcurrentRequestsResolver.js.html +3 -3
  32. package/coverage/{rabbit-ui-kit → ui-kit}/src/robust-api-caller/cachedRobustExternalApiCallerService.js.html +3 -3
  33. package/coverage/{rabbit-ui-kit → ui-kit}/src/robust-api-caller/cancelProcessing.js.html +3 -3
  34. package/coverage/{rabbit-ui-kit → ui-kit}/src/robust-api-caller/concurrentCalculationsMetadataHolder.js.html +3 -3
  35. package/coverage/{rabbit-ui-kit → ui-kit}/src/robust-api-caller/externalApiProvider.js.html +3 -3
  36. package/coverage/{rabbit-ui-kit → ui-kit}/src/robust-api-caller/externalServicesStatsCollector.js.html +3 -3
  37. package/coverage/{rabbit-ui-kit → ui-kit}/src/robust-api-caller/index.html +3 -3
  38. package/coverage/{rabbit-ui-kit → ui-kit}/src/robust-api-caller/robustExternalAPICallerService.js.html +3 -3
  39. package/coverage/ui-kit/src/swaps-lib/external-apis/index.html +146 -0
  40. package/coverage/ui-kit/src/swaps-lib/external-apis/letsExchangeSwapProvider.js.html +1456 -0
  41. package/coverage/ui-kit/src/swaps-lib/external-apis/swapProvider.js.html +1390 -0
  42. package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/external-apis/swapspaceSwapProvider.js.html +45 -585
  43. package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/baseSwapCreationInfo.js.html +3 -3
  44. package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/existingSwap.js.html +3 -3
  45. package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/existingSwapWithFiatData.js.html +3 -3
  46. package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/index.html +3 -3
  47. package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/services/index.html +7 -7
  48. package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/services/publicSwapService.js.html +233 -50
  49. package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/utils/index.html +13 -13
  50. package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/utils/swapUtils.js.html +121 -46
  51. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/arrowIcon.jsx.html +3 -3
  52. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/arrowTosca.jsx.html +3 -3
  53. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/arrowWhite.jsx.html +3 -3
  54. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/darkRectangle.jsx.html +3 -3
  55. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/determinedError.jsx.html +3 -3
  56. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/failedValidationIcon.jsx.html +3 -3
  57. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/index.html +3 -3
  58. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/infoIcon.jsx.html +3 -3
  59. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/noticeQuestionIcon.jsx.html +3 -3
  60. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/successfulValidationIcon.jsx.html +3 -3
  61. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/walletIcon.jsx.html +3 -3
  62. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/AssetIcon/AssetIcon.jsx.html +3 -3
  63. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/AssetIcon/index.html +3 -3
  64. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/AssetSelection/AssetSelection.jsx.html +3 -3
  65. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/AssetSelection/index.html +3 -3
  66. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/BackgroundTitle/BackgroundTitle.jsx.html +3 -3
  67. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/BackgroundTitle/index.html +3 -3
  68. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/InformationMessage/InformationMessage.jsx.html +3 -3
  69. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/InformationMessage/index.html +3 -3
  70. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/Input/Input.jsx.html +3 -3
  71. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/Input/index.html +3 -3
  72. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/LoadingDots/LoadingDots.jsx.html +3 -3
  73. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/LoadingDots/index.html +3 -3
  74. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/NoticeIcon/NoticeIcon.jsx.html +3 -3
  75. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/NoticeIcon/index.html +3 -3
  76. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/QrCode/QrCode.jsx.html +52 -7
  77. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/QrCode/index.html +7 -7
  78. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/RateSelector/RateSelector.jsx.html +3 -3
  79. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/RateSelector/index.html +3 -3
  80. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/SupportChat/SupportChat.jsx.html +3 -3
  81. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/SupportChat/index.html +3 -3
  82. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/Textarea/Textarea.jsx.html +3 -3
  83. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/Textarea/index.html +3 -3
  84. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/TitleBox/TitleBox.jsx.html +3 -3
  85. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/TitleBox/index.html +3 -3
  86. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/Tooltip/Tooltip.jsx.html +3 -3
  87. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/Tooltip/index.html +3 -3
  88. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/TwoLinesOfText/LinesOfText.jsx.html +3 -3
  89. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/TwoLinesOfText/index.html +3 -3
  90. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/Validation/Validation.jsx.html +3 -3
  91. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/Validation/index.html +3 -3
  92. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/buttons/Button/Button.jsx.html +3 -3
  93. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/buttons/Button/index.html +3 -3
  94. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/buttons/Close/Close.jsx.html +3 -3
  95. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/buttons/Close/index.html +3 -3
  96. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/buttons/LinkButton/LinkButton.jsx.html +3 -3
  97. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/buttons/LinkButton/index.html +3 -3
  98. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx.html +3 -3
  99. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/buttons/RadioButtonWithText/index.html +3 -3
  100. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/AmountInput/AmountInput.jsx.html +3 -3
  101. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/AmountInput/index.html +3 -3
  102. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/CoinPicker/CoinPicker.jsx.html +3 -3
  103. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/CoinPicker/index.html +3 -3
  104. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/LineWithIconLink/LineWithIconLink.jsx.html +3 -3
  105. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/LineWithIconLink/index.html +3 -3
  106. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx.html +3 -3
  107. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/TitledLineWithIconLink/index.html +3 -3
  108. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx.html +3 -3
  109. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/CoinPickerDialogStep/index.html +3 -3
  110. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/Dialog/Dialog.jsx.html +3 -3
  111. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/Dialog/DialogButtons/DialogButtons.jsx.html +3 -3
  112. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/Dialog/DialogButtons/index.html +3 -3
  113. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/Dialog/DialogStep/DialogStep.jsx.html +3 -3
  114. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/Dialog/DialogStep/index.html +3 -3
  115. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/Dialog/index.html +3 -3
  116. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/SwapForm/SwapForm.jsx.html +171 -39
  117. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/SwapForm/index.html +7 -7
  118. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx.html +3 -3
  119. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/templates/DeterminedErrorDialogStep/index.html +3 -3
  120. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/hooks/index.html +3 -3
  121. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/hooks/useCallHandlingErrors.js.html +3 -3
  122. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/hooks/useIsHydrated.js.html +3 -3
  123. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/hooks/useReferredState.js.html +3 -3
  124. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/utils/index.html +3 -3
  125. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/utils/inputValueProviders.js.html +3 -3
  126. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/utils/textUtils.js.html +3 -3
  127. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/utils/uiUtils.js.html +3 -3
  128. package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/utils/urlQueryUtils.js.html +3 -3
  129. package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/BackgroundTitle.stories.jsx.html +3 -3
  130. package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/LinesOfText.stories.jsx.html +3 -3
  131. package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/LoadingDots.stories.jsx.html +3 -3
  132. package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/QrCode.stories.jsx.html +3 -3
  133. package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/RateSelector.stories.jsx.html +3 -3
  134. package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/Validation.stories.jsx.html +3 -3
  135. package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/buttons/Button.stories.jsx.html +3 -3
  136. package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/buttons/Close.stories.jsx.html +3 -3
  137. package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/buttons/LinkButton.stories.jsx.html +3 -3
  138. package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/buttons/index.html +3 -3
  139. package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/index.html +3 -3
  140. package/coverage/{rabbit-ui-kit → ui-kit}/stories/molecules/LineWithIconLink.stories.jsx.html +3 -3
  141. package/coverage/{rabbit-ui-kit → ui-kit}/stories/molecules/TitledLineWithIconLink.stories.jsx.html +3 -3
  142. package/coverage/{rabbit-ui-kit → ui-kit}/stories/molecules/index.html +3 -3
  143. package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/Dialog.stories.jsx.html +3 -3
  144. package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/DialogButtons/DialogButtons.stories.jsx.html +3 -3
  145. package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/DialogButtons/index.html +3 -3
  146. package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/DialogStep/DialogStep.stories.jsx.html +3 -3
  147. package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/DialogStep/index.html +3 -3
  148. package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/index.html +3 -3
  149. package/coverage/{rabbit-ui-kit → ui-kit}/stories/stubs/exampleContent.jsx.html +3 -3
  150. package/coverage/{rabbit-ui-kit → ui-kit}/stories/stubs/index.html +3 -3
  151. package/coverage/{rabbit-ui-kit → ui-kit}/stories/templates/DeterminedErrorDialogStep.stories.jsx.html +3 -3
  152. package/coverage/{rabbit-ui-kit → ui-kit}/stories/templates/index.html +3 -3
  153. package/coverage/ui-kit/storybook-static/124.c2d01e5e.iframe.bundle.js.html +85 -0
  154. package/coverage/ui-kit/storybook-static/138.56b7edc4.iframe.bundle.js.html +85 -0
  155. package/coverage/ui-kit/storybook-static/312.6f62bbd9.iframe.bundle.js.html +85 -0
  156. package/coverage/ui-kit/storybook-static/341.57a15f57.iframe.bundle.js.html +85 -0
  157. package/coverage/ui-kit/storybook-static/370.73bb343e.iframe.bundle.js.html +85 -0
  158. package/coverage/ui-kit/storybook-static/595.2e40d981.iframe.bundle.js.html +85 -0
  159. package/coverage/ui-kit/storybook-static/607.3ea32459.iframe.bundle.js.html +85 -0
  160. package/coverage/ui-kit/storybook-static/609.8c79ec77.iframe.bundle.js.html +85 -0
  161. package/coverage/ui-kit/storybook-static/666.09fdc1d7.iframe.bundle.js.html +85 -0
  162. package/coverage/ui-kit/storybook-static/797.c87cdf19.iframe.bundle.js.html +85 -0
  163. package/coverage/ui-kit/storybook-static/822.4bc0ebce.iframe.bundle.js.html +85 -0
  164. package/coverage/ui-kit/storybook-static/833.08e3ebb6.iframe.bundle.js.html +85 -0
  165. package/coverage/ui-kit/storybook-static/862.bf6bfe62.iframe.bundle.js.html +85 -0
  166. package/coverage/ui-kit/storybook-static/87.0a1bfeb1.iframe.bundle.js.html +85 -0
  167. package/coverage/ui-kit/storybook-static/893.4b09f929.iframe.bundle.js.html +85 -0
  168. package/coverage/ui-kit/storybook-static/996.846a677b.iframe.bundle.js.html +85 -0
  169. package/coverage/ui-kit/storybook-static/atoms-BackgroundTitle-stories.1a5386a1.iframe.bundle.js.html +85 -0
  170. package/coverage/ui-kit/storybook-static/atoms-LinesOfText-stories.7043a48b.iframe.bundle.js.html +85 -0
  171. package/coverage/ui-kit/storybook-static/atoms-LoadingDots-stories.091245c7.iframe.bundle.js.html +85 -0
  172. package/coverage/ui-kit/storybook-static/atoms-QrCode-stories.e10363b6.iframe.bundle.js.html +85 -0
  173. package/coverage/ui-kit/storybook-static/atoms-RateSelector-stories.af208e9a.iframe.bundle.js.html +85 -0
  174. package/coverage/ui-kit/storybook-static/atoms-Validation-stories.d561b311.iframe.bundle.js.html +85 -0
  175. package/coverage/ui-kit/storybook-static/atoms-buttons-Button-stories.e8e6b930.iframe.bundle.js.html +85 -0
  176. package/coverage/ui-kit/storybook-static/atoms-buttons-Close-stories.0a902a7c.iframe.bundle.js.html +85 -0
  177. package/coverage/ui-kit/storybook-static/atoms-buttons-LinkButton-stories.ca93ab6b.iframe.bundle.js.html +85 -0
  178. package/coverage/ui-kit/storybook-static/index.html +596 -0
  179. package/coverage/ui-kit/storybook-static/main.41f410f2.iframe.bundle.js.html +85 -0
  180. package/coverage/ui-kit/storybook-static/molecules-LineWithIconLink-stories.9721a18c.iframe.bundle.js.html +85 -0
  181. package/coverage/ui-kit/storybook-static/molecules-TitledLineWithIconLink-stories.1383fe3f.iframe.bundle.js.html +85 -0
  182. package/coverage/ui-kit/storybook-static/organisms-Dialog-Dialog-stories.4e6da717.iframe.bundle.js.html +85 -0
  183. package/coverage/ui-kit/storybook-static/organisms-Dialog-DialogButtons-DialogButtons-stories.6f45ae6e.iframe.bundle.js.html +85 -0
  184. package/coverage/ui-kit/storybook-static/organisms-Dialog-DialogStep-DialogStep-stories.74896048.iframe.bundle.js.html +85 -0
  185. package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/@storybook/addon-backgrounds/dist/index.html +116 -0
  186. package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/@storybook/addon-backgrounds/dist/preview.js.html +118 -0
  187. package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/@storybook/components/dist/formatter-SWP5E3XI.mjs.html +118 -0
  188. package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/@storybook/components/dist/index.html +116 -0
  189. package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/buffer/index.html +116 -0
  190. package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/buffer/index.js.html +118 -0
  191. package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/markdown-to-jsx/dist/index.html +116 -0
  192. package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/markdown-to-jsx/dist/index.modern.js.html +118 -0
  193. package/coverage/ui-kit/storybook-static/runtime~main.ad918f38.iframe.bundle.js.html +85 -0
  194. package/coverage/ui-kit/storybook-static/sb-addons/actions-9/index.html +116 -0
  195. package/coverage/ui-kit/storybook-static/sb-addons/actions-9/manager-bundle.js.html +94 -0
  196. package/coverage/ui-kit/storybook-static/sb-addons/essentials-backgrounds-2/index.html +116 -0
  197. package/coverage/ui-kit/storybook-static/sb-addons/essentials-backgrounds-2/manager-bundle.js.html +121 -0
  198. package/coverage/ui-kit/storybook-static/sb-addons/essentials-controls-1/index.html +116 -0
  199. package/coverage/ui-kit/storybook-static/sb-addons/essentials-controls-1/manager-bundle.js.html +274 -0
  200. package/coverage/ui-kit/storybook-static/sb-addons/essentials-measure-4/index.html +116 -0
  201. package/coverage/ui-kit/storybook-static/sb-addons/essentials-measure-4/manager-bundle.js.html +94 -0
  202. package/coverage/ui-kit/storybook-static/sb-addons/essentials-outline-5/index.html +116 -0
  203. package/coverage/ui-kit/storybook-static/sb-addons/essentials-outline-5/manager-bundle.js.html +94 -0
  204. package/coverage/ui-kit/storybook-static/sb-addons/essentials-toolbars-3/index.html +116 -0
  205. package/coverage/ui-kit/storybook-static/sb-addons/essentials-toolbars-3/manager-bundle.js.html +94 -0
  206. package/coverage/ui-kit/storybook-static/sb-addons/interactions-7/index.html +116 -0
  207. package/coverage/ui-kit/storybook-static/sb-addons/interactions-7/manager-bundle.js.html +121 -0
  208. package/coverage/ui-kit/storybook-static/sb-addons/links-0/index.html +116 -0
  209. package/coverage/ui-kit/storybook-static/sb-addons/links-0/manager-bundle.js.html +94 -0
  210. package/coverage/ui-kit/storybook-static/sb-addons/onboarding-6/index.html +116 -0
  211. package/coverage/ui-kit/storybook-static/sb-addons/onboarding-6/manager-bundle.js.html +1588 -0
  212. package/coverage/ui-kit/storybook-static/sb-addons/viewport-8/index.html +116 -0
  213. package/coverage/ui-kit/storybook-static/sb-addons/viewport-8/manager-bundle.js.html +94 -0
  214. package/coverage/ui-kit/storybook-static/sb-manager/WithTooltip-V3YHNWJZ-LVYLGZW2.js.html +88 -0
  215. package/coverage/ui-kit/storybook-static/sb-manager/chunk-2IXBUOFS.js.html +106 -0
  216. package/coverage/ui-kit/storybook-static/sb-manager/chunk-INSKDKQB.js.html +1129 -0
  217. package/coverage/ui-kit/storybook-static/sb-manager/chunk-NGTUFCUO.js.html +112 -0
  218. package/coverage/ui-kit/storybook-static/sb-manager/chunk-UUEAOBSN.js.html +1303 -0
  219. package/coverage/ui-kit/storybook-static/sb-manager/chunk-ZEU7PDD3.js.html +88 -0
  220. package/coverage/ui-kit/storybook-static/sb-manager/formatter-SWP5E3XI-7BGIK6BL.js.html +553 -0
  221. package/coverage/ui-kit/storybook-static/sb-manager/globals-module-info.js.html +88 -0
  222. package/coverage/ui-kit/storybook-static/sb-manager/globals.js.html +88 -0
  223. package/coverage/ui-kit/storybook-static/sb-manager/index.html +281 -0
  224. package/coverage/ui-kit/storybook-static/sb-manager/index.js.html +88 -0
  225. package/coverage/ui-kit/storybook-static/sb-manager/runtime.js.html +88 -0
  226. package/coverage/ui-kit/storybook-static/sb-manager/syntaxhighlighter-V7JZZA35-DXZCI2WR.js.html +88 -0
  227. package/coverage/ui-kit/storybook-static/sb-preview/globals.js.html +88 -0
  228. package/coverage/ui-kit/storybook-static/sb-preview/index.html +131 -0
  229. package/coverage/ui-kit/storybook-static/sb-preview/runtime.js.html +421 -0
  230. package/coverage/ui-kit/storybook-static/templates-DeterminedErrorDialogStep-stories.3cc14214.iframe.bundle.js.html +85 -0
  231. package/dist/index.cjs +1201 -605
  232. package/dist/index.cjs.map +1 -1
  233. package/dist/index.css +1 -1
  234. package/dist/index.css.map +1 -1
  235. package/dist/index.modern.js +786 -330
  236. package/dist/index.modern.js.map +1 -1
  237. package/dist/index.module.js +1201 -605
  238. package/dist/index.module.js.map +1 -1
  239. package/dist/index.umd.js +1201 -605
  240. package/dist/index.umd.js.map +1 -1
  241. package/package.json +1 -1
  242. package/src/swaps-lib/external-apis/letsExchangeSwapProvider.js +457 -0
  243. package/src/swaps-lib/external-apis/swapProvider.js +246 -20
  244. package/src/swaps-lib/external-apis/swapspaceSwapProvider.js +20 -200
  245. package/src/swaps-lib/services/publicSwapService.js +105 -44
  246. package/src/swaps-lib/test/external-apis/swapProvider/removeProtocolNameFromCoinName.test.js +142 -0
  247. package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +2 -2
  248. package/src/swaps-lib/utils/swapUtils.js +63 -38
  249. package/src/ui-kit/components/atoms/QrCode/QrCode.jsx +16 -1
  250. package/src/ui-kit/components/organisms/SwapForm/SwapForm.jsx +77 -33
  251. package/src/ui-kit/components/organisms/SwapForm/swap-form.module.scss +1 -1
  252. package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/index.html +0 -131
  253. package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/swapProvider.js.html +0 -712
@@ -11,6 +11,7 @@ import { BaseSwapCreationInfo } from "../models/baseSwapCreationInfo.js";
11
11
  import { SwapUtils } from "../utils/swapUtils.js";
12
12
  import { SwapspaceSwapProvider } from "../external-apis/swapspaceSwapProvider.js";
13
13
  import { SwapProvider } from "../external-apis/swapProvider.js";
14
+ import { LetsExchangeSwapProvider } from "../external-apis/letsExchangeSwapProvider.js";
14
15
 
15
16
  export class PublicSwapService {
16
17
  static PUBLIC_SWAP_CREATED_EVENT = "publicSwapCreatedEvent";
@@ -31,56 +32,77 @@ export class PublicSwapService {
31
32
 
32
33
  constructor(apiKeysProxyUrl, cache) {
33
34
  this._swapProvider = new SwapspaceSwapProvider(apiKeysProxyUrl, cache, () => null, false);
35
+ this._fixedSwapProvider = new LetsExchangeSwapProvider(apiKeysProxyUrl, cache, () => null, false);
34
36
  }
35
37
 
36
38
  async initialize() {
37
39
  try {
38
- await this._swapProvider.initialize();
40
+ await Promise.all([this._swapProvider.initialize(), this._fixedSwapProvider.initialize()]);
39
41
  } catch (e) {
40
42
  Logger.logError(e, "PublicSwapService.initialize");
41
43
  }
42
44
  }
43
45
 
46
+ /**
47
+ * Gets all currencies across all partners. Useful for sitemap or supported currencies count/list.
48
+ *
49
+ * @return {Promise<{result: boolean, coins: Coin[]}|{result: boolean, reason: string}>}
50
+ */
44
51
  async getAllSupportedCurrenciesListForPublicSwap() {
45
52
  const loggerSource = "getAllSupportedCurrenciesListForPublicSwap";
46
53
  try {
47
- const result = await this._swapProvider.getAllSupportedCurrencies();
48
- if (result.reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) {
54
+ await this.initialize();
55
+ const result = await Promise.all([
56
+ this._fixedSwapProvider.getAllSupportedCurrencies(),
57
+ this._swapProvider.getAllSupportedCurrencies(),
58
+ ]);
59
+ const allCoins = [...(result[0].coins ?? [])];
60
+ (result[1].coins ?? []).forEach(c => {
61
+ if (!allCoins.find(existingCoin => existingCoin.ticker === c.ticker)) {
62
+ allCoins.push(c);
63
+ }
64
+ });
65
+ if (
66
+ result[0].reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED ||
67
+ result[1].reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
68
+ ) {
49
69
  SwapUtils.safeHandleRequestsLimitExceeding();
50
- return {
51
- result: false,
52
- reason: PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED,
53
- };
70
+ // TODO: [dev] improve this during the whitebit integration. task_id=20e7e41211b540d081bf98f392a34b2c
71
+ // return {
72
+ // result: false,
73
+ // reason: PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED,
74
+ // };
75
+ } else if (result[0].reason || result[1].reason) {
76
+ console.log("Failed to get all supported coins", result[0].reason, result[1].reason);
54
77
  }
55
78
  Logger.log(`Retrieved ${result?.coins?.length} supported currencies for swap`, loggerSource);
56
- return { result: true, coins: result.coins };
79
+ return { result: true, coins: allCoins };
57
80
  } catch (e) {
58
- improveAndRethrow(e, "getDepositCurrenciesListForPublicSwap");
81
+ improveAndRethrow(e, "getAllSupportedCurrenciesListForPublicSwap");
59
82
  }
60
83
  }
61
84
 
62
- async getDepositCurrenciesListForPublicSwap() {
85
+ async getDepositCurrenciesListForPublicSwap(fixed = false) {
63
86
  try {
64
- return await this._getCurrenciesListForPublicSwap(false);
87
+ return await this._getCurrenciesListForPublicSwap(false, fixed);
65
88
  } catch (e) {
66
89
  improveAndRethrow(e, "getDepositCurrenciesListForPublicSwap");
67
90
  }
68
91
  }
69
92
 
70
- async getWithdrawCurrenciesListForPublicSwap() {
93
+ async getWithdrawCurrenciesListForPublicSwap(fixed = false) {
71
94
  try {
72
- return await this._getCurrenciesListForPublicSwap(true);
95
+ return await this._getCurrenciesListForPublicSwap(true, fixed);
73
96
  } catch (e) {
74
97
  improveAndRethrow(e, "getWithdrawCurrenciesListForPublicSwap");
75
98
  }
76
99
  }
77
100
 
78
- async _getCurrenciesListForPublicSwap(withdraw = false) {
101
+ async _getCurrenciesListForPublicSwap(withdraw = false, fixed = false) {
79
102
  const loggerSource = "getCurrenciesListForPublicSwap";
80
103
  try {
81
- const result = withdraw
82
- ? await this._swapProvider.getWithdrawalCurrencies()
83
- : await this._swapProvider.getDepositCurrencies();
104
+ const provider = fixed ? this._fixedSwapProvider : this._swapProvider;
105
+ const result = withdraw ? await provider.getWithdrawalCurrencies() : await provider.getDepositCurrencies();
84
106
  if (result.reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) {
85
107
  SwapUtils.safeHandleRequestsLimitExceeding();
86
108
  return {
@@ -101,6 +123,9 @@ export class PublicSwapService {
101
123
  /**
102
124
  * Retrieves initial data for swapping two coins.
103
125
  *
126
+ * Always FLOATING rate, FIXED is not supported - if you want to change it the default rate - all
127
+ * the swaps code logic should be verified to align with this change.
128
+ *
104
129
  * @param fromCoin {Coin}
105
130
  * @param toCoin {Coin}
106
131
  * @return {Promise<{
@@ -147,6 +172,8 @@ export class PublicSwapService {
147
172
  * @param fromAmountCoins {string}
148
173
  * @param [fixed=false] {boolean|null} null means fixed or float doesn't matter
149
174
  * @param [withoutFiat=false] {boolean} pass true if you don't need the fiat equivalent - this will diminish requests count
175
+ * @param [amountIsToReceive=false] {boolean} whether the given amount is receiving amount.
176
+ * False means the amount is the sending amount.
150
177
  * @return {Promise<{
151
178
  * result: false,
152
179
  * reason: string,
@@ -160,18 +187,31 @@ export class PublicSwapService {
160
187
  * swapCreationInfo: BaseSwapCreationInfo
161
188
  * }>}
162
189
  */
163
- async getPublicSwapDetails(fromCoin, toCoin, fromAmountCoins, fixed = false, withoutFiat = false) {
190
+ async getPublicSwapDetails(
191
+ fromCoin,
192
+ toCoin,
193
+ fromAmountCoins,
194
+ fixed = false,
195
+ withoutFiat = false,
196
+ amountIsToReceive = false
197
+ ) {
164
198
  const loggerSource = "getPublicSwapDetails";
165
199
  try {
200
+ if (amountIsToReceive && !fixed) {
201
+ throw new Error("Estimating allowed only for fixed rate.");
202
+ }
203
+
166
204
  const coinUsdtRate = withoutFiat
167
205
  ? null
168
- : (await this._swapProvider.getCoinToUSDTRate(fromCoin))?.rate ?? null;
169
- const details = await this._swapProvider.getSwapInfo(
206
+ : (await (fixed ? this._fixedSwapProvider : this._swapProvider).getCoinToUSDTRate(fromCoin))?.rate ??
207
+ null;
208
+ const details = await (fixed ? this._fixedSwapProvider : this._swapProvider).getSwapInfo(
170
209
  fromCoin,
171
210
  toCoin,
172
211
  fromAmountCoins,
173
212
  fixed,
174
- coinUsdtRate
213
+ coinUsdtRate,
214
+ amountIsToReceive
175
215
  );
176
216
 
177
217
  // eslint-disable-next-line no-console
@@ -272,13 +312,15 @@ export class PublicSwapService {
272
312
  *
273
313
  * @param fromCoin {Coin}
274
314
  * @param toCoin {Coin}
275
- * @param fromAmount {string}
315
+ * @param amount {string}
276
316
  * @param swapCreationInfo {BaseSwapCreationInfo}
277
317
  * @param toAddress {string}
278
318
  * @param refundAddress {string}
279
319
  * @param clientIp {string}
280
320
  * @param [toCurrencyExtraId] {string}
281
321
  * @param [refundExtraId] {string}
322
+ * @param [amountIsToReceive=false] {boolean} whether the given amount is receiving amount.
323
+ * False means the amount is the sending amount.
282
324
  * @return {Promise<{
283
325
  * result: true,
284
326
  * fiatCurrencyCode: string,
@@ -303,28 +345,30 @@ export class PublicSwapService {
303
345
  async createPublicSwap(
304
346
  fromCoin,
305
347
  toCoin,
306
- fromAmount,
348
+ amount,
307
349
  swapCreationInfo,
308
350
  toAddress,
309
351
  refundAddress,
310
352
  clientIp,
311
353
  toCurrencyExtraId,
312
- refundExtraId
354
+ refundExtraId,
355
+ amountIsToReceive = false
313
356
  ) {
314
357
  const loggerSource = "createPublicSwap";
315
358
  try {
316
359
  if (
317
360
  !(fromCoin instanceof Coin) ||
318
361
  !(toCoin instanceof Coin) ||
319
- typeof fromAmount !== "string" ||
362
+ typeof amount !== "string" ||
320
363
  typeof toAddress !== "string" ||
321
- typeof refundAddress !== "string" ||
364
+ (swapCreationInfo.isRefundAddressRequired &&
365
+ (typeof refundAddress !== "string" || refundAddress.length === 0)) ||
322
366
  !(swapCreationInfo instanceof BaseSwapCreationInfo)
323
367
  ) {
324
- throw new Error(`Wrong input: ${fromCoin.ticker} ${toCoin.ticker} ${fromAmount} ${swapCreationInfo}`);
368
+ throw new Error(`Wrong input: ${fromCoin.ticker} ${toCoin.ticker} ${amount} ${swapCreationInfo}`);
325
369
  }
326
370
  Logger.log(
327
- `Start: ${fromAmount} ${fromCoin.ticker} -> ${toCoin.ticker}. Details: ${safeStringify({
371
+ `Start: ${amount} ${fromCoin.ticker} -> ${toCoin.ticker}. Details: ${safeStringify({
328
372
  ...swapCreationInfo,
329
373
  fromCoin: swapCreationInfo?.fromCoin?.ticker,
330
374
  toCoin: swapCreationInfo?.toCoin?.ticker,
@@ -332,17 +376,18 @@ export class PublicSwapService {
332
376
  loggerSource
333
377
  );
334
378
 
335
- const result = await this._swapProvider.createSwap(
379
+ const result = await (swapCreationInfo.fixed ? this._fixedSwapProvider : this._swapProvider).createSwap(
336
380
  fromCoin,
337
381
  toCoin,
338
- fromAmount,
382
+ amount,
339
383
  toAddress,
340
384
  refundAddress,
341
385
  swapCreationInfo.rawSwapData,
342
386
  clientIp,
343
387
  swapCreationInfo.fixed,
344
388
  toCurrencyExtraId,
345
- refundExtraId
389
+ refundExtraId,
390
+ amountIsToReceive
346
391
  );
347
392
  Logger.log(
348
393
  `Created:${safeStringify({
@@ -388,7 +433,7 @@ export class PublicSwapService {
388
433
  Logger.logError(e, loggerSource, "Failed to calculate fiat amounts for result");
389
434
  }
390
435
 
391
- // TODO: feature, cirtical] add GA event. task_id=tbd
436
+ // TODO: feature, cirtical] add GA event. task_id=091004f1b6b748b29ddece6a130df904
392
437
  EventBusInstance.dispatch(
393
438
  PublicSwapService.PUBLIC_SWAP_CREATED_EVENT,
394
439
  null,
@@ -450,7 +495,10 @@ export class PublicSwapService {
450
495
  async getPublicExistingSwapDetailsAndStatus(swapIds) {
451
496
  const loggerSource = "getPublicExistingSwapDetailsAndStatus";
452
497
  try {
453
- const result = await SwapUtils.getExistingSwapsDetailsWithFiatAmounts(this._swapProvider, swapIds);
498
+ const result = await SwapUtils.getExistingSwapsDetailsWithFiatAmounts(
499
+ [this._swapProvider, this._fixedSwapProvider],
500
+ swapIds
501
+ );
454
502
  if (!result?.result) {
455
503
  if (result.reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) {
456
504
  SwapUtils.safeHandleRequestsLimitExceeding();
@@ -525,18 +573,23 @@ export class PublicSwapService {
525
573
 
526
574
  /**
527
575
  * @param coinOrTicker {Coin|string}
576
+ * @param [isFixed=true] {boolean} rate type
528
577
  * @return {string} icon URL (ready to use)
529
578
  */
530
- getAssetIconUrl(coinOrTicker) {
531
- return this._swapProvider.getIconUrl(coinOrTicker);
579
+ getAssetIconUrl(coinOrTicker, isFixed = false) {
580
+ // TODO: [feature, high] improve this logic - currently hacked to show better icons from fixed provider. task_id=3b6b8c2a9df04a86aaff2e070424b64f
581
+ return this._fixedSwapProvider.getIconUrl(coinOrTicker);
532
582
  }
533
583
 
534
584
  /**
535
585
  * @param ticker {string}
586
+ * @param [fixed=false] {boolean}
536
587
  * @return {Coin|null}
537
588
  */
538
- getCoinByTickerIfPresent(ticker) {
539
- return this._swapProvider.getCoinByTickerIfPresent(ticker);
589
+ getCoinByTickerIfPresent(ticker, fixed = false) {
590
+ return !fixed
591
+ ? this._swapProvider.getCoinByTickerIfPresent(ticker)
592
+ : this._fixedSwapProvider.getCoinByTickerIfPresent(ticker);
540
593
  }
541
594
 
542
595
  /**
@@ -546,7 +599,10 @@ export class PublicSwapService {
546
599
  */
547
600
  async getAssetToUsdtRate(asset) {
548
601
  try {
549
- const result = await this._swapProvider.getCoinToUSDTRate(asset);
602
+ let result = await this._swapProvider.getCoinToUSDTRate(asset);
603
+ if (result?.rate == null) {
604
+ result = await this._fixedSwapProvider.getCoinToUSDTRate(asset);
605
+ }
550
606
  return result?.rate ?? null;
551
607
  } catch (e) {
552
608
  improveAndRethrow(e, "getAssetToUsdtRate");
@@ -556,11 +612,14 @@ export class PublicSwapService {
556
612
  /**
557
613
  * @param asset {Coin}
558
614
  * @param address {string}
615
+ * @param [fixed=false] {boolean}
559
616
  * @return {boolean}
560
617
  */
561
- isAddressValidForAsset(asset, address) {
618
+ isAddressValidForAsset(asset, address, fixed = false) {
562
619
  try {
563
- return this._swapProvider.isAddressValidForAsset(asset, address);
620
+ return !fixed
621
+ ? this._swapProvider.isAddressValidForAsset(asset, address)
622
+ : this._fixedSwapProvider.isAddressValidForAsset(asset, address);
564
623
  } catch (e) {
565
624
  improveAndRethrow(e, "isAddressValidForAsset");
566
625
  }
@@ -570,13 +629,14 @@ export class PublicSwapService {
570
629
  * Retrieves token by contract address.
571
630
  *
572
631
  * @param addressString {string}
632
+ * @param [fixed=false] {boolean}
573
633
  * @return {Promise<Coin|null>}
574
634
  */
575
- async getTokenByContractAddress(addressString) {
635
+ async getTokenByContractAddress(addressString, fixed = false) {
576
636
  try {
577
637
  if (!addressString) return null;
578
638
  const addressLowerCase = addressString.toLowerCase();
579
- const allCoins = await this._swapProvider.getAllSupportedCurrencies();
639
+ const allCoins = await (fixed ? this._fixedSwapProvider : this._swapProvider).getAllSupportedCurrencies();
580
640
  if (allCoins.result) {
581
641
  return allCoins.coins.find(
582
642
  coin => coin.tokenAddress && coin.tokenAddress.toLowerCase() === addressLowerCase
@@ -590,11 +650,12 @@ export class PublicSwapService {
590
650
 
591
651
  /**
592
652
  * @param asset {Coin}
653
+ * @param [fixed=false] {boolean}
593
654
  * @return {string|null}
594
655
  */
595
- getExtraIdNameIfPresentForAsset(asset) {
656
+ getExtraIdNameIfPresentForAsset(asset, fixed = false) {
596
657
  try {
597
- return this._swapProvider.getExtraIdNameIfPresent(asset);
658
+ return (fixed ? this._fixedSwapProvider : this._swapProvider).getExtraIdNameIfPresent(asset);
598
659
  } catch (e) {
599
660
  improveAndRethrow(e, "getExtraIdNameIfPresentForAsset");
600
661
  }
@@ -0,0 +1,142 @@
1
+ import should from "should";
2
+ import { describe, it } from "vitest";
3
+ import { Cache } from "../../../../common-apis/utils/cache.js";
4
+ import { SwapProvider } from "../../../external-apis/swapProvider.js";
5
+
6
+ describe("provider.removeProtocolNameFromCoinName", function () {
7
+ const provider = new SwapProvider(new Cache());
8
+
9
+ it("Should remove braced ticker and protocol from coin name", function () {
10
+ const result = provider.removeProtocolNameFromCoinName("ExampleCoin (BTC)", "BTC", "Protocol");
11
+ result.should.equal("ExampleCoin");
12
+ });
13
+
14
+ it("Should handle case insensitivity", function () {
15
+ const result = provider.removeProtocolNameFromCoinName("ExampleCoin (btc) protocol", "BTC", "Protocol");
16
+ result.should.equal("ExampleCoin");
17
+ });
18
+
19
+ it("Should trim spaces and collapse multiple spaces", function () {
20
+ const result = provider.removeProtocolNameFromCoinName("ExampleCoin Protocol ", "BTC", "Protocol");
21
+ result.should.equal("ExampleCoin");
22
+ });
23
+
24
+ it("Should not modify coin name if ticker or protocol are not present", function () {
25
+ const result = provider.removeProtocolNameFromCoinName("ExampleCoin", "BTC", "Protocol");
26
+ result.should.equal("ExampleCoin");
27
+ });
28
+
29
+ it("Should handle empty coin name gracefully", function () {
30
+ const result = provider.removeProtocolNameFromCoinName("", "BTC", "Protocol");
31
+ result.should.equal("");
32
+ });
33
+
34
+ it("Should handle null or undefined inputs", function () {
35
+ const result = provider.removeProtocolNameFromCoinName(null, "BTC", "Protocol");
36
+ should.not.exist(result);
37
+ });
38
+
39
+ it("Should revert to original name if result is a default name", function () {
40
+ const result = provider.removeProtocolNameFromCoinName("Token Protocol", "BTC", "Protocol");
41
+ result.should.equal("Token Protocol");
42
+ });
43
+
44
+ it("Should correctly remove only the specified protocol and ticker", function () {
45
+ const result = provider.removeProtocolNameFromCoinName("ExampleCoin Protocol Token", "BTC", "Protocol");
46
+ result.should.equal("ExampleCoin Token");
47
+ });
48
+
49
+ it("Should handle multiple occurrences of ticker and protocol", function () {
50
+ const result = provider.removeProtocolNameFromCoinName("ExampleCoin (BTC) Protocol BTC", "BTC", "Protocol");
51
+ result.should.equal("ExampleCoin BTC");
52
+ });
53
+
54
+ it("Should remove ticker in uppercase when protocol is lowercase", function () {
55
+ const result = provider.removeProtocolNameFromCoinName("ExampleCoin (BTC)", "BTC", "protocol");
56
+ result.should.equal("ExampleCoin");
57
+ });
58
+
59
+ it("Should remove ticker in lowercase when protocol is uppercase", function () {
60
+ const result = provider.removeProtocolNameFromCoinName("ExampleCoin (btc)", "BTC", "PROTOCOL");
61
+ result.should.equal("ExampleCoin");
62
+ });
63
+
64
+ it("Should remove protocol and ticker when they are part of the name", function () {
65
+ const result = provider.removeProtocolNameFromCoinName("protocol ExampleCoin (BTC)", "BTC", "protocol");
66
+ result.should.equal("ExampleCoin");
67
+ });
68
+
69
+ it("Should handle coin name with special characters when protocol is not space-wrapped", function () {
70
+ const result = provider.removeProtocolNameFromCoinName("ExampleCoin-Protocol (BTC)!", "BTC", "Protocol");
71
+ result.should.equal("ExampleCoin-Protocol !");
72
+ });
73
+
74
+ it("Should handle coin name with numbers", function () {
75
+ const result = provider.removeProtocolNameFromCoinName("ExampleCoin123 (BTC) Protocol 456", "BTC", "Protocol");
76
+ result.should.equal("ExampleCoin123 456");
77
+ });
78
+
79
+ it("Should handle multiple spaces between words", function () {
80
+ const result = provider.removeProtocolNameFromCoinName("ExampleCoin (BTC) Protocol", "BTC", "Protocol");
81
+ result.should.equal("ExampleCoin");
82
+ });
83
+
84
+ it("Should handle coin name that is entirely braced ticker and protocol", function () {
85
+ const result = provider.removeProtocolNameFromCoinName("(BTC) Protocol", "BTC", "Protocol");
86
+ result.should.equal("(BTC) Protocol");
87
+ });
88
+
89
+ it("Should correctly remove ticker and protocol when they appear multiple times", function () {
90
+ const result = provider.removeProtocolNameFromCoinName(
91
+ "Protocol BTC(BTC) ExampleCoin Protocol (BTC)",
92
+ "BTC",
93
+ "Protocol"
94
+ );
95
+ result.should.equal("BTC ExampleCoin");
96
+ });
97
+
98
+ it("Should handle ticker appearing in the middle of the name", function () {
99
+ const result = provider.removeProtocolNameFromCoinName("Example (BTC) Coin", "BTC", "Protocol");
100
+ result.should.equal("Example Coin");
101
+ });
102
+
103
+ it("Should handle protocol appearing in the middle of the name", function () {
104
+ const result = provider.removeProtocolNameFromCoinName("Example Protocol Coin", "BTC", "Protocol");
105
+ result.should.equal("Example Coin");
106
+ });
107
+
108
+ it("Should not change the name if protocol is part of another word", function () {
109
+ const result = provider.removeProtocolNameFromCoinName("ExampleCoinPro (BTC)", "BTC", "Protocol");
110
+ result.should.equal("ExampleCoinPro");
111
+ });
112
+
113
+ it("Should not change the name if ticker is part of another word", function () {
114
+ const result = provider.removeProtocolNameFromCoinName("BTCoin Protocol", "BTC", "Protocol");
115
+ result.should.equal("BTCoin");
116
+ });
117
+
118
+ it("Should handle ticker with special characters", function () {
119
+ const result = provider.removeProtocolNameFromCoinName("ExampleCoin (#BTC)", "#BTC", "Protocol");
120
+ result.should.equal("ExampleCoin");
121
+ });
122
+
123
+ it("Should handle protocol with special characters", function () {
124
+ const result = provider.removeProtocolNameFromCoinName("ExampleCoin (BTC) @Protocol", "BTC", "@Protocol");
125
+ result.should.equal("ExampleCoin");
126
+ });
127
+
128
+ it("Should handle names with underscores", function () {
129
+ const result = provider.removeProtocolNameFromCoinName("Example_Coin (BTC) Protocol", "BTC", "Protocol");
130
+ result.should.equal("Example_Coin");
131
+ });
132
+
133
+ it("Should handle names with hyphens", function () {
134
+ const result = provider.removeProtocolNameFromCoinName("Example-Coin (BTC) Protocol", "BTC", "Protocol");
135
+ result.should.equal("Example-Coin");
136
+ });
137
+
138
+ it("Should handle names with periods", function () {
139
+ const result = provider.removeProtocolNameFromCoinName("Example.Coin (BTC) Protocol", "BTC", "Protocol");
140
+ result.should.equal("Example.Coin");
141
+ });
142
+ });
@@ -201,7 +201,7 @@ describe("swapspaceSwapProvider", function () {
201
201
  },
202
202
  {
203
203
  item: { code: "BTC", network: "BTC", name: "BTC (BTC)" },
204
- expectedName: "BTC",
204
+ expectedName: "BTC (BTC)",
205
205
  },
206
206
  {
207
207
  item: { code: "BTC", network: "BTC", name: "(BTC) (BTC)" },
@@ -438,7 +438,7 @@ describe("swapspaceSwapProvider", function () {
438
438
  const { provider, data } = await setupAndExecstoreCoinDataFormatTest();
439
439
 
440
440
  provider._supportedCoins.forEach((dataItem, i) => {
441
- dataItem.isPopular.should.be.equal(!!data[i].popular);
441
+ dataItem.isPopular.should.be.equal(data[i].popular ? 1 : 0);
442
442
  });
443
443
  });
444
444
 
@@ -112,8 +112,8 @@ export class SwapUtils {
112
112
  /**
113
113
  * If some swap is not found by id then there is no item in return list.
114
114
  *
115
- * @param swapProvider {SwapProvider}
116
- * @param swapIds {string[]}
115
+ * @param swapProviders {SwapProvider[]} - Array of swap providers
116
+ * @param swapIds {string[]} - Array of swap IDs
117
117
  * @return {Promise<{
118
118
  * result: true,
119
119
  * swaps: ExistingSwapWithFiatData[]
@@ -122,47 +122,72 @@ export class SwapUtils {
122
122
  * reason: string
123
123
  * }>}
124
124
  */
125
- static async getExistingSwapsDetailsWithFiatAmounts(swapProvider, swapIds) {
125
+ static async getExistingSwapsDetailsWithFiatAmounts(swapProviders, swapIds) {
126
126
  try {
127
- const result = await swapProvider.getExistingSwapsDetailsAndStatus(swapIds);
128
- if (result.result) {
129
- const extendedSwaps = [];
130
- for (let swap of result.swaps) {
131
- if (swap.status === SwapProvider.SWAP_STATUSES.REFUNDED) {
132
- const rate = await swapProvider.getCoinToUSDTRate(swap.fromCoin);
133
- extendedSwaps.push(
134
- ExistingSwapWithFiatData.fromExistingSwap(
135
- swap,
136
- rate?.rate != null ? BigNumber(swap.fromAmount).times(rate.rate).toNumber() : null,
137
- rate?.rate != null ? BigNumber(swap.toAmount).times(rate.rate).toNumber() : null,
138
- "USD",
139
- FiatCurrenciesService.getCurrencyDecimalCountByCode("USD")
140
- )
141
- );
142
- } else {
143
- const [fromCoinFiatRate, toConFiatRate] = await Promise.all([
144
- swapProvider.getCoinToUSDTRate(swap.fromCoin),
145
- swapProvider.getCoinToUSDTRate(swap.toCoin),
146
- ]);
147
- extendedSwaps.push(
148
- ExistingSwapWithFiatData.fromExistingSwap(
149
- swap,
150
- fromCoinFiatRate?.rate != null
151
- ? BigNumber(swap.fromAmount).times(fromCoinFiatRate.rate).toNumber()
152
- : null,
153
- toConFiatRate?.rate != null
154
- ? BigNumber(swap.toAmount).times(toConFiatRate.rate).toNumber()
155
- : null,
156
- "USD",
157
- FiatCurrenciesService.getCurrencyDecimalCountByCode("USD")
158
- )
159
- );
127
+ let allSwaps = [];
128
+ let remainingSwapIds = new Set(swapIds);
129
+ const failResults = [];
130
+ for (let provider of swapProviders) {
131
+ const result = await provider.getExistingSwapsDetailsAndStatus([...remainingSwapIds]);
132
+ if (result.result) {
133
+ const extendedSwaps = [];
134
+ for (let swap of result.swaps) {
135
+ if (swap.status === SwapProvider.SWAP_STATUSES.REFUNDED) {
136
+ const rate = await provider.getCoinToUSDTRate(swap.fromCoin);
137
+ extendedSwaps.push(
138
+ ExistingSwapWithFiatData.fromExistingSwap(
139
+ swap,
140
+ rate?.rate != null ? BigNumber(swap.fromAmount).times(rate.rate).toNumber() : null,
141
+ rate?.rate != null ? BigNumber(swap.toAmount).times(rate.rate).toNumber() : null,
142
+ "USD",
143
+ FiatCurrenciesService.getCurrencyDecimalCountByCode("USD")
144
+ )
145
+ );
146
+ } else {
147
+ const [fromCoinFiatRate, toCoinFiatRate] = await Promise.all([
148
+ provider.getCoinToUSDTRate(swap.fromCoin),
149
+ provider.getCoinToUSDTRate(swap.toCoin),
150
+ ]);
151
+ extendedSwaps.push(
152
+ ExistingSwapWithFiatData.fromExistingSwap(
153
+ swap,
154
+ fromCoinFiatRate?.rate != null
155
+ ? BigNumber(swap.fromAmount).times(fromCoinFiatRate.rate).toNumber()
156
+ : null,
157
+ toCoinFiatRate?.rate != null
158
+ ? BigNumber(swap.toAmount).times(toCoinFiatRate.rate).toNumber()
159
+ : null,
160
+ "USD",
161
+ FiatCurrenciesService.getCurrencyDecimalCountByCode("USD")
162
+ )
163
+ );
164
+ }
165
+ remainingSwapIds.delete(swap.id);
166
+ }
167
+ allSwaps = allSwaps.concat(extendedSwaps);
168
+
169
+ // Stop if we have retrieved all swaps
170
+ if (allSwaps.length >= swapIds.length) {
171
+ break;
160
172
  }
173
+ } else {
174
+ failResults.push(result);
161
175
  }
162
- result.swaps = extendedSwaps;
163
176
  }
164
177
 
165
- return result;
178
+ if (swapIds.length > 0 && allSwaps.length === 0 && failResults.length > 0) {
179
+ const failReasons = failResults.map(r => r.reason);
180
+ return {
181
+ result: false,
182
+ reason: failReasons.find(r => r !== SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED)
183
+ ? failReasons.join("\n")
184
+ : SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED,
185
+ };
186
+ }
187
+ return {
188
+ result: true,
189
+ swaps: allSwaps,
190
+ };
166
191
  } catch (e) {
167
192
  improveAndRethrow(e, "getExistingSwapsDetailsWithFiatAmounts");
168
193
  }
@@ -6,7 +6,21 @@ import { generateQrAndShowInCanvas } from "../../../../common-apis/adapters/qrUt
6
6
 
7
7
  import s from "./qr-code.module.scss";
8
8
 
9
- // TODO: [dev] add JSDoc
9
+ /**
10
+ * QrCode component renders a QR code for a provided crypto address.
11
+ *
12
+ * @component
13
+ * @example
14
+ * const address = "0x123456789abcdef";
15
+ * const fill = true;
16
+ * return <QrCode address={address} fill={fill} />;
17
+ *
18
+ * @param {Object} props - The props for the component.
19
+ * @param {string} props.address - The crypto address to generate the QR code for.
20
+ * @param {boolean} [props.fill=false] - If true, applies additional CSS class to fill the container.
21
+ *
22
+ * @returns {JSX.Element} A div containing the generated QR code.
23
+ */
10
24
  export const QrCode = ({ address, fill = false }) => {
11
25
  const canvasRef = useRef();
12
26
 
@@ -32,4 +46,5 @@ QrCode.propTypes = {
32
46
 
33
47
  QrCode.defaultProps = {
34
48
  address: "",
49
+ fill: false,
35
50
  };