@rabbitio/ui-kit 1.0.0-beta.64 → 1.0.0-beta.66

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 (255) hide show
  1. package/coverage/clover.xml +6325 -4201
  2. package/coverage/coverage-final.json +160 -99
  3. package/coverage/index.html +444 -189
  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/src/assets/wrappedImages/arrowTosca.jsx.html → ui-kit/src/assets/wrappedImages/arrowIcon.jsx.html} +8 -29
  7. package/coverage/{rabbit-ui-kit/src/assets/wrappedImages/arrowIcon.jsx.html → ui-kit/src/assets/wrappedImages/arrowTosca.jsx.html} +9 -24
  8. package/coverage/{rabbit-ui-kit → ui-kit}/src/assets/wrappedImages/arrowWhite.jsx.html +7 -25
  9. package/coverage/ui-kit/src/assets/wrappedImages/darkRectangle.jsx.html +106 -0
  10. package/coverage/{rabbit-ui-kit → ui-kit}/src/assets/wrappedImages/determinedError.jsx.html +9 -42
  11. package/coverage/{rabbit-ui-kit/src/assets/wrappedImages/successfulValidationIcon.jsx.html → ui-kit/src/assets/wrappedImages/failedValidationIcon.jsx.html} +28 -31
  12. package/coverage/{rabbit-ui-kit → ui-kit}/src/assets/wrappedImages/index.html +25 -25
  13. package/coverage/{rabbit-ui-kit/src/assets/wrappedImages/darkRectangle.jsx.html → ui-kit/src/assets/wrappedImages/infoIcon.jsx.html} +13 -19
  14. package/coverage/{rabbit-ui-kit → ui-kit}/src/assets/wrappedImages/noticeQuestionIcon.jsx.html +7 -25
  15. package/coverage/{rabbit-ui-kit/src/assets/wrappedImages/walletIcon.jsx.html → ui-kit/src/assets/wrappedImages/successfulValidationIcon.jsx.html} +23 -59
  16. package/coverage/{rabbit-ui-kit/src/assets/wrappedImages/infoIcon.jsx.html → ui-kit/src/assets/wrappedImages/walletIcon.jsx.html} +16 -16
  17. package/coverage/{rabbit-ui-kit → ui-kit}/src/common/adapters/axiosAdapter.js.html +3 -3
  18. package/coverage/{rabbit-ui-kit → ui-kit}/src/common/adapters/index.html +3 -3
  19. package/coverage/{rabbit-ui-kit → ui-kit}/src/common/adapters/qrUtils.js.html +3 -3
  20. package/coverage/{rabbit-ui-kit → ui-kit}/src/common/amountUtils.js.html +44 -308
  21. package/coverage/{rabbit-ui-kit → ui-kit}/src/common/errorUtils.js.html +3 -3
  22. package/coverage/{rabbit-ui-kit → ui-kit}/src/common/external-apis/apiGroups.js.html +3 -3
  23. package/coverage/{rabbit-ui-kit → ui-kit}/src/common/external-apis/index.html +14 -14
  24. package/coverage/{rabbit-ui-kit → ui-kit}/src/common/external-apis/ipAddressProviders.js.html +31 -178
  25. package/coverage/{rabbit-ui-kit → ui-kit}/src/common/fiatCurrenciesService.js.html +12 -36
  26. package/coverage/{rabbit-ui-kit → ui-kit}/src/common/index.html +20 -20
  27. package/coverage/{rabbit-ui-kit → ui-kit}/src/common/models/blockchain.js.html +3 -3
  28. package/coverage/{rabbit-ui-kit → ui-kit}/src/common/models/coin.js.html +10 -22
  29. package/coverage/{rabbit-ui-kit → ui-kit}/src/common/models/index.html +13 -13
  30. package/coverage/{rabbit-ui-kit → ui-kit}/src/common/models/protocol.js.html +3 -3
  31. package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/cache.js.html +23 -101
  32. package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/emailAPI.js.html +9 -15
  33. package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/index.html +19 -19
  34. package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/logging/index.html +9 -9
  35. package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/logging/logger.js.html +14 -35
  36. package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/logging/logsStorage.js.html +5 -5
  37. package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/postponeExecution.js.html +3 -3
  38. package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/safeStringify.js.html +29 -29
  39. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/AssetIcon/AssetIcon.jsx.html +11 -41
  40. package/coverage/ui-kit/src/components/atoms/AssetIcon/index.html +116 -0
  41. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/AssetSelection/AssetSelection.jsx.html +9 -33
  42. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/AssetSelection/index.html +7 -7
  43. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/BackgroundTitle/BackgroundTitle.jsx.html +8 -38
  44. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/BackgroundTitle/index.html +7 -7
  45. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/InformationMessage/InformationMessage.jsx.html +8 -38
  46. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/InformationMessage/index.html +7 -7
  47. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Input/Input.jsx.html +15 -63
  48. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Input/index.html +7 -7
  49. package/coverage/ui-kit/src/components/atoms/LoadingDots/LoadingDots.jsx.html +196 -0
  50. package/coverage/{rabbit-ui-kit/src/components/atoms/RateSelector → ui-kit/src/components/atoms/LoadingDots}/index.html +4 -4
  51. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/NoticeIcon/NoticeIcon.jsx.html +10 -40
  52. package/coverage/{rabbit-ui-kit/src/components/atoms/AssetIcon → ui-kit/src/components/atoms/NoticeIcon}/index.html +4 -4
  53. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/QrCode/QrCode.jsx.html +8 -26
  54. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/QrCode/index.html +7 -7
  55. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/RateSelector/RateSelector.jsx.html +10 -34
  56. package/coverage/ui-kit/src/components/atoms/RateSelector/index.html +116 -0
  57. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/SupportChat/SupportChat.jsx.html +7 -22
  58. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/SupportChat/index.html +7 -7
  59. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Textarea/Textarea.jsx.html +17 -53
  60. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Textarea/index.html +7 -7
  61. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/TitleBox/TitleBox.jsx.html +13 -82
  62. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/TitleBox/index.html +7 -7
  63. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Tooltip/Tooltip.jsx.html +12 -18
  64. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Tooltip/index.html +7 -7
  65. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/TwoLinesOfText/LinesOfText.jsx.html +12 -30
  66. package/coverage/{rabbit-ui-kit/src/components/atoms/NoticeIcon → ui-kit/src/components/atoms/TwoLinesOfText}/index.html +4 -4
  67. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Validation/Validation.jsx.html +19 -13
  68. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Validation/index.html +7 -7
  69. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/Button/Button.jsx.html +23 -113
  70. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/Button/index.html +7 -7
  71. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/Close/Close.jsx.html +9 -27
  72. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/Close/index.html +7 -7
  73. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/LinkButton/LinkButton.jsx.html +11 -38
  74. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/LinkButton/index.html +7 -7
  75. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx.html +13 -67
  76. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/RadioButtonWithText/index.html +7 -7
  77. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/hooks/index.html +7 -7
  78. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/hooks/useCallHandlingErrors.js.html +7 -19
  79. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/hooks/useReferredState.js.html +4 -4
  80. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/AmountInput/AmountInput.jsx.html +56 -407
  81. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/AmountInput/index.html +7 -7
  82. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/CoinPicker/CoinPicker.jsx.html +67 -466
  83. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/CoinPicker/index.html +7 -7
  84. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/LineWithIconLink/LineWithIconLink.jsx.html +7 -22
  85. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/LineWithIconLink/index.html +7 -7
  86. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx.html +3 -3
  87. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/TitledLineWithIconLink/index.html +3 -3
  88. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx.html +9 -15
  89. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/CoinPickerDialogStep/index.html +7 -7
  90. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/Dialog/Dialog.jsx.html +44 -194
  91. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/Dialog/DialogButtons/DialogButtons.jsx.html +3 -3
  92. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/Dialog/DialogButtons/index.html +3 -3
  93. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/Dialog/DialogStep/DialogStep.jsx.html +63 -525
  94. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/Dialog/DialogStep/index.html +7 -7
  95. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/Dialog/index.html +7 -7
  96. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/SwapForm/SwapForm.jsx.html +145 -670
  97. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/SwapForm/index.html +7 -7
  98. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx.html +3 -3
  99. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/templates/DeterminedErrorDialogStep/index.html +3 -3
  100. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/utils/index.html +20 -20
  101. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/utils/inputValueProviders.js.html +11 -35
  102. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/utils/textUtils.js.html +3 -3
  103. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/utils/uiUtils.js.html +7 -13
  104. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/utils/urlQueryUtils.js.html +18 -93
  105. package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/atoms/Close/close.jsx.html +3 -3
  106. package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/atoms/Close/index.html +3 -3
  107. package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/atoms/LinkButton/index.html +3 -3
  108. package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/atoms/LinkButton/linkButton.jsx.html +3 -3
  109. package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/atoms/Tooltip/index.html +3 -3
  110. package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/atoms/Tooltip/tooltip.jsx.html +3 -3
  111. package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/globalConstants.jsx.html +7 -10
  112. package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/index.html +7 -7
  113. package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/organisms/dialog/DialogStep/dialogStep.js.html +3 -3
  114. package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/organisms/dialog/DialogStep/index.html +3 -3
  115. package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/organisms/dialog/dialog.js.html +3 -3
  116. package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/organisms/dialog/index.html +3 -3
  117. package/coverage/{rabbit-ui-kit → ui-kit}/src/index.html +7 -7
  118. package/coverage/{rabbit-ui-kit → ui-kit}/src/index.js.html +8 -26
  119. package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/cacheAndConcurrentRequestsResolver.js.html +30 -222
  120. package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/cachedRobustExternalApiCallerService.js.html +24 -147
  121. package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/cancelProcessing.js.html +3 -3
  122. package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/concurrentCalculationsMetadataHolder.js.html +19 -103
  123. package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/externalApiProvider.js.html +3 -3
  124. package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/externalServicesStatsCollector.js.html +11 -23
  125. package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/index.html +38 -38
  126. package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/robustExternalAPICallerService.js.html +53 -305
  127. package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/external-apis/index.html +24 -24
  128. package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/external-apis/swapProvider.js.html +10 -28
  129. package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/external-apis/swapspaceSwapProvider.js.html +277 -1009
  130. package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/baseSwapCreationInfo.js.html +3 -3
  131. package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/existingSwap.js.html +3 -3
  132. package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/existingSwapWithFiatData.js.html +9 -27
  133. package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/index.html +13 -13
  134. package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/services/index.html +7 -7
  135. package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/services/publicSwapService.js.html +53 -374
  136. package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/utils/index.html +13 -13
  137. package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/utils/swapUtils.js.html +32 -179
  138. package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/BackgroundTitle.stories.jsx.html +3 -3
  139. package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/LinesOfText.stories.jsx.html +3 -3
  140. package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/LoadingDots.stories.jsx.html +3 -3
  141. package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/QrCode.stories.jsx.html +3 -3
  142. package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/RateSelector.stories.jsx.html +3 -3
  143. package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/Validation.stories.jsx.html +3 -3
  144. package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/buttons/Button.stories.jsx.html +3 -3
  145. package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/buttons/Close.stories.jsx.html +3 -3
  146. package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/buttons/LinkButton.stories.jsx.html +3 -3
  147. package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/buttons/index.html +3 -3
  148. package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/index.html +3 -3
  149. package/coverage/{rabbit-ui-kit → ui-kit}/stories/molecules/LineWithIconLink.stories.jsx.html +3 -3
  150. package/coverage/{rabbit-ui-kit → ui-kit}/stories/molecules/TitledLineWithIconLink.stories.jsx.html +3 -3
  151. package/coverage/{rabbit-ui-kit → ui-kit}/stories/molecules/index.html +3 -3
  152. package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/Dialog.stories.jsx.html +3 -3
  153. package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/DialogButtons/DialogButtons.stories.jsx.html +3 -3
  154. package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/DialogButtons/index.html +3 -3
  155. package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/DialogStep/DialogStep.stories.jsx.html +3 -3
  156. package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/DialogStep/index.html +3 -3
  157. package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/index.html +3 -3
  158. package/coverage/{rabbit-ui-kit → ui-kit}/stories/stubs/exampleContent.jsx.html +3 -3
  159. package/coverage/{rabbit-ui-kit → ui-kit}/stories/stubs/index.html +3 -3
  160. package/coverage/{rabbit-ui-kit → ui-kit}/stories/templates/DeterminedErrorDialogStep.stories.jsx.html +3 -3
  161. package/coverage/{rabbit-ui-kit → ui-kit}/stories/templates/index.html +3 -3
  162. package/dist/index.cjs +65 -49
  163. package/dist/index.cjs.map +1 -1
  164. package/dist/index.css +5 -2
  165. package/dist/index.css.map +1 -1
  166. package/dist/index.modern.js +43 -28
  167. package/dist/index.modern.js.map +1 -1
  168. package/dist/index.module.js +65 -49
  169. package/dist/index.module.js.map +1 -1
  170. package/dist/index.umd.js +65 -49
  171. package/dist/index.umd.js.map +1 -1
  172. package/package.json +5 -3
  173. package/src/assets/wrappedImages/arrowIcon.jsx +1 -7
  174. package/src/assets/wrappedImages/arrowTosca.jsx +1 -7
  175. package/src/assets/wrappedImages/arrowWhite.jsx +1 -7
  176. package/src/assets/wrappedImages/darkRectangle.jsx +2 -13
  177. package/src/assets/wrappedImages/determinedError.jsx +2 -13
  178. package/src/assets/wrappedImages/failedValidationIcon.jsx +2 -16
  179. package/src/assets/wrappedImages/infoIcon.jsx +1 -7
  180. package/src/assets/wrappedImages/noticeQuestionIcon.jsx +1 -7
  181. package/src/assets/wrappedImages/successfulValidationIcon.jsx +2 -16
  182. package/src/assets/wrappedImages/walletIcon.jsx +3 -19
  183. package/src/common/amountUtils.js +36 -124
  184. package/src/common/external-apis/ipAddressProviders.js +22 -71
  185. package/src/common/fiatCurrenciesService.js +4 -12
  186. package/src/common/models/coin.js +2 -6
  187. package/src/common/tests/amountUtils/composeRateText.test.js +12 -69
  188. package/src/common/tests/integration/external-apis/ipAddressProviders/getClientIpAddress.test.js +1 -3
  189. package/src/common/utils/cache.js +10 -36
  190. package/src/common/utils/emailAPI.js +1 -3
  191. package/src/common/utils/logging/logger.js +5 -12
  192. package/src/components/atoms/AssetIcon/AssetIcon.jsx +4 -14
  193. package/src/components/atoms/AssetSelection/AssetSelection.jsx +3 -11
  194. package/src/components/atoms/BackgroundTitle/BackgroundTitle.jsx +2 -12
  195. package/src/components/atoms/InformationMessage/InformationMessage.jsx +2 -12
  196. package/src/components/atoms/InformationMessage/information-message.module.scss +4 -2
  197. package/src/components/atoms/Input/Input.jsx +9 -25
  198. package/src/components/atoms/LoadingDots/LoadingDots.jsx +8 -28
  199. package/src/components/atoms/NoticeIcon/NoticeIcon.jsx +4 -14
  200. package/src/components/atoms/QrCode/QrCode.jsx +2 -8
  201. package/src/components/atoms/RateSelector/RateSelector.jsx +4 -12
  202. package/src/components/atoms/SupportChat/SupportChat.jsx +1 -6
  203. package/src/components/atoms/Textarea/Textarea.jsx +11 -23
  204. package/src/components/atoms/TitleBox/TitleBox.jsx +7 -30
  205. package/src/components/atoms/TitleBox/title-box.module.scss +2 -0
  206. package/src/components/atoms/Tooltip/Tooltip.jsx +6 -8
  207. package/src/components/atoms/TwoLinesOfText/LinesOfText.jsx +5 -11
  208. package/src/components/atoms/Validation/Validation.jsx +9 -7
  209. package/src/components/atoms/buttons/Button/Button.jsx +17 -47
  210. package/src/components/atoms/buttons/Close/Close.jsx +3 -9
  211. package/src/components/atoms/buttons/LinkButton/LinkButton.jsx +5 -14
  212. package/src/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx +7 -25
  213. package/src/components/hooks/useCallHandlingErrors.js +1 -5
  214. package/src/components/hooks/useReferredState.js +1 -1
  215. package/src/components/molecules/AmountInput/AmountInput.jsx +50 -167
  216. package/src/components/molecules/CoinPicker/CoinPicker.jsx +61 -194
  217. package/src/components/molecules/CoinPicker/coin-picker.module.scss +1 -4
  218. package/src/components/molecules/LineWithIconLink/LineWithIconLink.jsx +1 -6
  219. package/src/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx +3 -5
  220. package/src/components/organisms/Dialog/Dialog.jsx +38 -88
  221. package/src/components/organisms/Dialog/DialogStep/DialogStep.jsx +57 -211
  222. package/src/components/organisms/Dialog/DialogStep/dialog-step.module.scss +2 -4
  223. package/src/components/organisms/SwapForm/SwapForm.jsx +139 -314
  224. package/src/components/tests/utils/inputValueProviders/provideFormatOfFloatValueByInputString.test.js +5 -12
  225. package/src/components/tests/utils/urlQueryUtils/getQueryParameterValues.test.js +3 -9
  226. package/src/components/tests/utils/urlQueryUtils/saveQueryParameterAndValues.test.js +11 -51
  227. package/src/components/utils/inputValueProviders.js +3 -11
  228. package/src/components/utils/uiUtils.js +1 -3
  229. package/src/components/utils/urlQueryUtils.js +10 -35
  230. package/src/constants/globalConstants.jsx +1 -2
  231. package/src/index.js +2 -8
  232. package/src/robustExteranlApiCallerService/cacheAndConcurrentRequestsResolver.js +22 -86
  233. package/src/robustExteranlApiCallerService/cachedRobustExternalApiCallerService.js +15 -56
  234. package/src/robustExteranlApiCallerService/concurrentCalculationsMetadataHolder.js +11 -39
  235. package/src/robustExteranlApiCallerService/externalServicesStatsCollector.js +3 -7
  236. package/src/robustExteranlApiCallerService/robustExternalAPICallerService.js +45 -129
  237. package/src/robustExteranlApiCallerService/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/_performCallAttempt.test.js +76 -330
  238. package/src/robustExteranlApiCallerService/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/callExternalAPI.test.js +57 -270
  239. package/src/robustExteranlApiCallerService/tests/robustExternalAPICallerService/robustExternalAPICallerService/constructor.test.js +3 -15
  240. package/src/swaps-lib/external-apis/swapProvider.js +1 -7
  241. package/src/swaps-lib/external-apis/swapspaceSwapProvider.js +117 -361
  242. package/src/swaps-lib/models/existingSwapWithFiatData.js +1 -7
  243. package/src/swaps-lib/services/publicSwapService.js +47 -154
  244. package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +33 -118
  245. package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/createSwap.test.js +23 -85
  246. package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getAllSupportedCurrencies.test.js +4 -14
  247. package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getDepositCurrencies.test.js +3 -9
  248. package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getSwapInfo.test.js +148 -460
  249. package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getWithdrawalCurrencies.test.js +5 -11
  250. package/src/swaps-lib/test/utils/swapUtils/safeHandleRequestsLimitExceeding.test.js +2 -10
  251. package/src/swaps-lib/utils/swapUtils.js +24 -73
  252. package/coverage/rabbit-ui-kit/src/assets/wrappedImages/failedValidationIcon.jsx.html +0 -244
  253. package/coverage/rabbit-ui-kit/src/components/atoms/LoadingDots/LoadingDots.jsx.html +0 -256
  254. package/coverage/rabbit-ui-kit/src/components/atoms/LoadingDots/index.html +0 -116
  255. package/coverage/rabbit-ui-kit/src/components/atoms/TwoLinesOfText/index.html +0 -116
@@ -78,6 +78,21 @@ import { RateSelector } from "../../atoms/RateSelector/RateSelector.jsx";
78
78
  * @return {void}
79
79
  */
80
80
 
81
+ /**
82
+ * Handler for the confirm button click. You should implement errors handling inside it.
83
+ *
84
+ * @function
85
+ * @name handleConfirmButtonClick
86
+ * @param {function} resetButtonLoader - callback resetting the confirm button loader
87
+ * @param {function} setValidationContent - Function to set the validation error message on the form.
88
+ * @param {function} setBalanceValid - Function to set the balance validity, accepts a boolean.
89
+ * @param {function} setMinimalAmountValid - Function to set the minimal amount validity, accepts a boolean.
90
+ * @param {function} setMaximumAmountValid - Function to set the maximum amount validity, accepts a boolean.
91
+ * @param {function} setIsPairSupported - Function to set the pair support status, accepts a boolean.
92
+ * @param {function} setIsSameCoins - Function to set the status if the same coins are used, accepts a boolean.
93
+ * @return {void}
94
+ */
95
+
81
96
  /**
82
97
  * Async function that retrieves swap creation info by given params.
83
98
  *
@@ -145,7 +160,7 @@ import { RateSelector } from "../../atoms/RateSelector/RateSelector.jsx";
145
160
  * @param {string} [props.receivingAssetBalance] - Balance of the receiving asset.
146
161
  * @param {handleClick} props.handleChangeSendingAssetClick - Function to handle clicking on the change sending asset button.
147
162
  * @param {handleClick} props.handleChangeReceivingAssetClick - Function to handle clicking on the change receiving asset button.
148
- * @param {handleClick} props.handleConfirmButtonClick - Function to handle clicking on the confirm button.
163
+ * @param {handleConfirmButtonClick} props.handleConfirmButtonClick - Function to handle clicking on the confirm button.
149
164
  * @param {composeConfirmButtonTo} props.composeConfirmButtonTo - Function to compose the URL for the confirm button.
150
165
  * @param {setSwapCreationEstimation} props.setSwapCreationEstimation - Function to set the swap creation estimation.
151
166
  * @param {handleUnexpectedError} props.handleUnexpectedError - Function to handle unexpected errors.
@@ -190,10 +205,18 @@ export const SwapForm = ({
190
205
  receivingAssetBalance,
191
206
  handleChangeSendingAssetClick,
192
207
  handleChangeReceivingAssetClick,
193
- handleConfirmButtonClick = () => {},
208
+ handleConfirmButtonClick = (
209
+ resetButtonLoader,
210
+ setValidationContent,
211
+ setBalanceValid,
212
+ setMinimalAmountValid,
213
+ setMaximumAmountValid,
214
+ setIsPairSupported,
215
+ setIsSameCoins
216
+ ) => {},
194
217
  composeConfirmButtonTo = (fromTicker, toTicker, fromAmount) => "",
195
- setSwapCreationEstimation = (details) => {},
196
- handleUnexpectedError = (error) => {},
218
+ setSwapCreationEstimation = details => {},
219
+ handleUnexpectedError = error => {},
197
220
  rotateAssets = (fromTicker, toTicker) => {},
198
221
  preservedAmount = null,
199
222
  handleSwapServiceError = (
@@ -206,16 +229,8 @@ export const SwapForm = ({
206
229
  setIsSameCoins
207
230
  ) => {},
208
231
  formHasBalance = false,
209
- retrieveSwapDetails = async (
210
- sendingAssetTicker,
211
- receivingAssetTicker,
212
- amount,
213
- isSwapAll = false
214
- ) => {},
215
- retrieveInitialSwapData = async (
216
- sendingAssetTicker,
217
- receivingAssetTicker
218
- ) => {},
232
+ retrieveSwapDetails = async (sendingAssetTicker, receivingAssetTicker, amount, isSwapAll = false) => {},
233
+ retrieveInitialSwapData = async (sendingAssetTicker, receivingAssetTicker) => {},
219
234
  triggerDataUpdateResetting = 0,
220
235
  fromAssetSelectionButtonRef = null,
221
236
  toAssetSelectionButtonRef = null,
@@ -249,12 +264,10 @@ export const SwapForm = ({
249
264
  loadingMinimalAmount: "Loading minimal amount..",
250
265
  swapRate: "Rate: ",
251
266
  calculatingSwapRates: "Calculating swap rates..",
252
- pairNotAvailable:
253
- "Pair is not available now. Please, try again later or choose another pair.",
267
+ pairNotAvailable: "Pair is not available now. Please, try again later or choose another pair.",
254
268
  },
255
269
  addressFields: {
256
270
  addressTitle: "Recepient address",
257
- addressPlaceholder: "Example: 1XPTgDRh...",
258
271
  extraIdTitle: "Extra ID (optional)",
259
272
  extraIdPlaceholder: "Example: ABC123",
260
273
  extraIdNotice:
@@ -276,20 +289,16 @@ export const SwapForm = ({
276
289
  setRecepientAddressExtraId,
277
290
  recepientAddressExtraIdAvailable = false,
278
291
  displayRateSelector = false,
279
- dispatchRateModeChanged = (isFixed) => {},
280
292
  }) => {
281
293
  const DETAIL_REFRESH_INTERVAL_MS = 1.5 * 60000;
294
+ const IS_FIXED_BY_DEFAULT = false;
282
295
 
283
296
  // Updating the states below will insert the new value into the send or receive input field
284
- const [updateSendInputTo, setUpdateSendInputTo] = useState(
285
- preservedAmount ?? null
286
- );
297
+ const [updateSendInputTo, setUpdateSendInputTo] = useState(preservedAmount ?? null);
287
298
  const [updateReceiveInputTo, setUpdateReceiveInputTo] = useState(null);
288
299
 
289
300
  const [sendAssetAmount, setSendAssetAmount] = useReferredState(
290
- preservedAmount == null || preservedAmount === ""
291
- ? null
292
- : preservedAmount
301
+ preservedAmount == null || preservedAmount === "" ? null : preservedAmount
293
302
  );
294
303
 
295
304
  const [swapRate, setSwapRate] = useState();
@@ -305,57 +314,40 @@ export const SwapForm = ({
305
314
  const [readyToSwap, setReadyToSwap] = useState(false); // Basically a param that enables/disables the "Next" button
306
315
  // TODO: [refactoring, moderate] instead of handling preservedAmount at a lot of cases below, just
307
316
  // write single useEffect setting sendAssetAmount to the=is passed value and simplify the logic below. task_id=6453251e49b04c5e88a3cc771479ffb5
308
- const [isAmountZero, setIsAmountZero] = useState(
309
- preservedAmount == null || String(preservedAmount) === "0"
310
- );
317
+ const [isAmountZero, setIsAmountZero] = useState(preservedAmount == null || String(preservedAmount) === "0");
311
318
  const [isLoading, setIsLoading] = useReferredState(false); // Whether the form is in the progress of loading some data (new rates, for example)
312
319
  const [isAddressFieldEnabled, setIsAddressFieldEnabled] = useState(false);
313
- const [isFixedRate, setIsFixedRate] = useState(null);
320
+ const [isFixedRate, setIsFixedRate] = useReferredState(null);
314
321
 
315
322
  const [confirmButtonTo, setConfirmButtonTo] = useState(
316
- composeConfirmButtonTo(
317
- sendingAssetTicker,
318
- receivingAssetTicker,
319
- preservedAmount
320
- )
323
+ composeConfirmButtonTo(sendingAssetTicker, receivingAssetTicker, preservedAmount)
321
324
  );
322
325
 
323
326
  const [transactionFee, setTransactionFee] = useState();
324
327
  const [balanceValid, setBalanceValid] = useState(true); // Whether the amount is less than total balance
325
328
  const [isSwapAll, setIsSwapAll] = useReferredState(null);
326
- const [swapAllButtonLoaderReSetter, setSwapAllButtonLoaderReSetter] =
327
- useState([]);
329
+ const [swapAllButtonLoaderReSetter, setSwapAllButtonLoaderReSetter] = useState([]);
328
330
 
329
- const [dataUpdateTimeoutId, setDataUpdateTimeoutId] =
330
- useReferredState(null);
331
- const [idleDataUpdateTimeoutId, setIdleDataUpdateTimeoutId] =
332
- useReferredState(null);
331
+ const [dataUpdateTimeoutId, setDataUpdateTimeoutId] = useReferredState(null);
332
+ const [idleDataUpdateTimeoutId, setIdleDataUpdateTimeoutId] = useReferredState(null);
333
333
 
334
334
  const callHandlingErrors = useCallHandlingErrors();
335
335
 
336
336
  const recalculationDelayOnTyping = 1000;
337
337
 
338
- const handleSendAssetAmountChange = (amount) => {
338
+ const handleSendAssetAmountChange = amount => {
339
339
  if (amount != null && amount !== "") {
340
- setUpdateReceiveInputTo(
341
- AmountUtils.trim(
342
- BigNumber(amount).times(swapRate),
343
- receivingAssetDecimalCount
344
- )
345
- );
340
+ setUpdateReceiveInputTo(AmountUtils.trim(BigNumber(amount).times(swapRate), receivingAssetDecimalCount));
346
341
  } else {
347
342
  setUpdateReceiveInputTo("");
348
343
  }
349
344
  setSendAssetAmount(amount);
350
345
  };
351
346
 
352
- const handleReceiveAssetAmountChange = (amount) => {
347
+ const handleReceiveAssetAmountChange = amount => {
353
348
  let sendAssetAmount = "";
354
349
  if (amount != null && amount !== "") {
355
- sendAssetAmount = AmountUtils.trim(
356
- BigNumber(amount).div(swapRate),
357
- sendingAssetDecimalCount
358
- );
350
+ sendAssetAmount = AmountUtils.trim(BigNumber(amount).div(swapRate), sendingAssetDecimalCount);
359
351
  }
360
352
  setUpdateSendInputTo(sendAssetAmount);
361
353
  setSendAssetAmount(sendAssetAmount);
@@ -375,8 +367,8 @@ export const SwapForm = ({
375
367
  handleSendAssetAmountChange(maximumAmount.current?.crypto);
376
368
  };
377
369
 
378
- const handleSwapAllClick = (resetButtonLoader) => {
379
- setIsSwapAll((prev) => {
370
+ const handleSwapAllClick = resetButtonLoader => {
371
+ setIsSwapAll(prev => {
380
372
  if (prev) {
381
373
  // Setting amount inputs to empty string if we are handling the disabling of previously enabled swap all
382
374
  setUpdateSendInputTo("");
@@ -388,26 +380,18 @@ export const SwapForm = ({
388
380
  setSwapAllButtonLoaderReSetter([resetButtonLoader]);
389
381
  };
390
382
 
391
- const processMinMaxAmounts = (amount) => {
383
+ const processMinMaxAmounts = amount => {
392
384
  if (amount === null) return;
393
385
 
394
386
  setMaximumAmountValid(
395
- !maximumAmount.current ||
396
- BigNumber(amount).eq("0") ||
397
- BigNumber(amount).lte(maximumAmount.current.crypto)
387
+ !maximumAmount.current || BigNumber(amount).eq("0") || BigNumber(amount).lte(maximumAmount.current.crypto)
398
388
  );
399
389
  setMinimalAmountValid(
400
- !minimalAmount.current ||
401
- BigNumber(amount).eq("0") ||
402
- BigNumber(amount).gte(minimalAmount.current?.crypto)
390
+ !minimalAmount.current || BigNumber(amount).eq("0") || BigNumber(amount).gte(minimalAmount.current?.crypto)
403
391
  );
404
392
  };
405
393
 
406
- const requestDataRefresh = (
407
- amount,
408
- immediately = false,
409
- isSwapAll = false
410
- ) => {
394
+ const requestDataRefresh = (amount, immediately = false, isSwapAll = false) => {
411
395
  try {
412
396
  clearTimeout(dataUpdateTimeoutId.current);
413
397
 
@@ -425,27 +409,14 @@ export const SwapForm = ({
425
409
  loadMinimalAmountAndSwapRate(true);
426
410
  } else {
427
411
  setDataUpdateTimeoutId(
428
- setTimeout(
429
- () => loadMinimalAmountAndSwapRate(true),
430
- recalculationDelayOnTyping
431
- )
412
+ setTimeout(() => loadMinimalAmountAndSwapRate(true), recalculationDelayOnTyping)
432
413
  );
433
414
  }
434
415
  } else {
435
416
  if (immediately) {
436
- loadFullEstimation(
437
- amount,
438
- preservedAmount && String(preservedAmount) !== "0"
439
- ? true
440
- : undefined
441
- );
417
+ loadFullEstimation(amount, preservedAmount && String(preservedAmount) !== "0" ? true : undefined);
442
418
  } else {
443
- setDataUpdateTimeoutId(
444
- setTimeout(
445
- () => loadFullEstimation(amount),
446
- recalculationDelayOnTyping
447
- )
448
- );
419
+ setDataUpdateTimeoutId(setTimeout(() => loadFullEstimation(amount), recalculationDelayOnTyping));
449
420
  }
450
421
  }
451
422
  } catch (e) {
@@ -453,18 +424,10 @@ export const SwapForm = ({
453
424
  }
454
425
  };
455
426
 
456
- const setAmountLimitsAndRate = (details) => {
427
+ const setAmountLimitsAndRate = details => {
457
428
  setSwapRate(details?.rate ?? null);
458
- setMinimalAmount(
459
- details.min == null
460
- ? null
461
- : { crypto: details.min, fiat: details.fiatMin }
462
- );
463
- setMaximumAmount(
464
- details.max == null
465
- ? null
466
- : { crypto: details.max, fiat: details.fiatMax }
467
- );
429
+ setMinimalAmount(details.min == null ? null : { crypto: details.min, fiat: details.fiatMin });
430
+ setMaximumAmount(details.max == null ? null : { crypto: details.max, fiat: details.fiatMax });
468
431
  if (details.feeCoins != null) {
469
432
  setTransactionFee({
470
433
  crypto: details.feeCoins,
@@ -500,7 +463,7 @@ export const SwapForm = ({
500
463
  receivingAssetTicker,
501
464
  amount,
502
465
  isSwapAll.current,
503
- isFixedRate
466
+ isFixedRate.current ?? IS_FIXED_BY_DEFAULT
504
467
  );
505
468
 
506
469
  if (
@@ -523,18 +486,12 @@ export const SwapForm = ({
523
486
  setUpdateReceiveInputTo(swapCreationInfo.toAmountCoins);
524
487
 
525
488
  if (isSwapAll.current) {
526
- setIsAmountZero(
527
- BigNumber("0").eq(swapCreationInfo.fromAmountCoins)
528
- );
489
+ setIsAmountZero(BigNumber("0").eq(swapCreationInfo.fromAmountCoins));
529
490
  }
530
491
 
531
492
  setAmountLimitsAndRate(swapCreationInfo);
532
493
  setSwapCreationEstimation(swapCreationInfo);
533
- processMinMaxAmounts(
534
- isSwapAll.current
535
- ? swapCreationInfo.fromAmountCoins
536
- : amount
537
- );
494
+ processMinMaxAmounts(isSwapAll.current ? swapCreationInfo.fromAmountCoins : amount);
538
495
  setIsSwapCalculated(true);
539
496
  } else {
540
497
  handleSwapServiceError(
@@ -576,15 +533,9 @@ export const SwapForm = ({
576
533
  setValidationContent(null);
577
534
  setIsSwapCalculated(false);
578
535
 
579
- const swapData = await retrieveInitialSwapData(
580
- sendingAssetTicker,
581
- receivingAssetTicker
582
- );
536
+ const swapData = await retrieveInitialSwapData(sendingAssetTicker, receivingAssetTicker);
583
537
 
584
- if (
585
- sendAssetAmount.current != null &&
586
- !isCalledForClearedInput
587
- ) {
538
+ if (sendAssetAmount.current != null && !isCalledForClearedInput) {
588
539
  // Means user already entered amount after starting the form initialization
589
540
  return;
590
541
  }
@@ -610,7 +561,7 @@ export const SwapForm = ({
610
561
  })();
611
562
  };
612
563
 
613
- const handleChangeAssetsIconClick = (e) => {
564
+ const handleChangeAssetsIconClick = e => {
614
565
  callHandlingErrors(() => {
615
566
  if (!isLoading.current) {
616
567
  setIsSwapAll(null);
@@ -621,9 +572,8 @@ export const SwapForm = ({
621
572
  }, e);
622
573
  };
623
574
 
624
- const handleRateModeChanged = (isFixed) => {
575
+ const handleRateModeChanged = isFixed => {
625
576
  setIsFixedRate(isFixed);
626
- dispatchRateModeChanged(isFixed);
627
577
  requestDataRefresh(sendAssetAmount.current, true);
628
578
  };
629
579
 
@@ -650,11 +600,8 @@ export const SwapForm = ({
650
600
  useEffect(() => {
651
601
  if (!sendingAssetTicker || !receivingAssetTicker) return;
652
602
 
653
- const isCurrentAmountNotZero =
654
- sendAssetAmount.current &&
655
- !BigNumber("0").eq(sendAssetAmount.current);
656
- const isPreservedAmountNotZero =
657
- preservedAmount && !BigNumber("0").eq(preservedAmount);
603
+ const isCurrentAmountNotZero = sendAssetAmount.current && !BigNumber("0").eq(sendAssetAmount.current);
604
+ const isPreservedAmountNotZero = preservedAmount && !BigNumber("0").eq(preservedAmount);
658
605
  if (isCurrentAmountNotZero) {
659
606
  loadFullEstimation(sendAssetAmount.current);
660
607
  } else if (isPreservedAmountNotZero) {
@@ -703,11 +650,7 @@ export const SwapForm = ({
703
650
  let timeoutId = null;
704
651
  if (readyToSwap) {
705
652
  timeoutId = setTimeout(
706
- () =>
707
- requestDataRefresh(
708
- sendAssetAmount.current ?? preservedAmount,
709
- true
710
- ),
653
+ () => requestDataRefresh(sendAssetAmount.current ?? preservedAmount, true),
711
654
  DETAIL_REFRESH_INTERVAL_MS
712
655
  );
713
656
  setIdleDataUpdateTimeoutId(timeoutId);
@@ -743,20 +686,14 @@ export const SwapForm = ({
743
686
  useEffect(() => {
744
687
  if (swapRate != null && sendAssetAmount.current != null) {
745
688
  setUpdateReceiveInputTo(
746
- AmountUtils.trim(
747
- BigNumber(sendAssetAmount.current).times(swapRate),
748
- receivingAssetDecimalCount
749
- )
689
+ AmountUtils.trim(BigNumber(sendAssetAmount.current).times(swapRate), receivingAssetDecimalCount)
750
690
  );
751
691
  }
752
692
  // eslint-disable-next-line react-hooks/exhaustive-deps
753
693
  }, [swapRate]);
754
694
 
755
695
  useEffect(() => {
756
- if (
757
- isLoading.current === false &&
758
- swapAllButtonLoaderReSetter?.length
759
- ) {
696
+ if (isLoading.current === false && swapAllButtonLoaderReSetter?.length) {
760
697
  swapAllButtonLoaderReSetter[0]();
761
698
  setSwapAllButtonLoaderReSetter([]);
762
699
  }
@@ -765,17 +702,10 @@ export const SwapForm = ({
765
702
 
766
703
  // Handlers upon changing the asset amount
767
704
  useEffect(() => {
768
- setConfirmButtonTo(
769
- composeConfirmButtonTo(
770
- sendingAssetTicker,
771
- receivingAssetTicker,
772
- sendAssetAmount.current
773
- )
774
- );
705
+ setConfirmButtonTo(composeConfirmButtonTo(sendingAssetTicker, receivingAssetTicker, sendAssetAmount.current));
775
706
 
776
707
  if (sendAssetAmount.current == null) return;
777
- let processingAmount =
778
- sendAssetAmount.current === "" ? "0" : sendAssetAmount.current;
708
+ let processingAmount = sendAssetAmount.current === "" ? "0" : sendAssetAmount.current;
779
709
  requestDataRefresh(processingAmount);
780
710
  processMinMaxAmounts(processingAmount);
781
711
  setIsAmountZero(BigNumber("0").eq(processingAmount));
@@ -810,8 +740,7 @@ export const SwapForm = ({
810
740
  linkButtonClick={
811
741
  BigNumber(sendingAssetBalance?.assetAmount).eq(0)
812
742
  ? null
813
- : (resetButtonLoader) =>
814
- handleSwapAllClick(resetButtonLoader)
743
+ : resetButtonLoader => handleSwapAllClick(resetButtonLoader)
815
744
  }
816
745
  linkText={
817
746
  !formHasBalance
@@ -836,16 +765,10 @@ export const SwapForm = ({
836
765
  assetIconSrc={sendingAssetIconSrc}
837
766
  assetIconProtocolSrc={sendingAssetProtocolIconSrc}
838
767
  fallbackAssetIconSrc={fallBackAssetIconSrc}
839
- disabled={
840
- isSwapAll.current ||
841
- sendingAssetTicker === null ||
842
- receivingAssetTicker === null
843
- }
768
+ disabled={isSwapAll.current || sendingAssetTicker === null || receivingAssetTicker === null}
844
769
  handleCoinAmountChange={handleSendAssetAmountChange}
845
770
  handleChangeAssetClick={handleChangeSendingAssetClick}
846
- handleBalanceValidationChange={(isValid) =>
847
- setBalanceValid(!isValid)
848
- }
771
+ handleBalanceValidationChange={isValid => setBalanceValid(!isValid)}
849
772
  updateAssetInputTo={updateSendInputTo}
850
773
  showBalance={formHasBalance}
851
774
  showBalanceValidation={formHasBalance}
@@ -859,17 +782,13 @@ export const SwapForm = ({
859
782
  fiatCurrencyCode={formHasFiat ? fiatCurrencyCode : null}
860
783
  fiatCurrencyDecimals={fiatCurrencyDecimals}
861
784
  balanceLoaderText={translations.input.balanceLoaderText}
862
- fiatInputPlaceholderText={
863
- translations.input.fiatPlaceholder
864
- }
785
+ fiatInputPlaceholderText={translations.input.fiatPlaceholder}
865
786
  />
866
787
  <div
867
788
  className={
868
789
  s["swap-form-inputs-separator"] +
869
790
  " " +
870
- (isLoading.current ||
871
- sendingAssetTicker === null ||
872
- receivingAssetTicker === null
791
+ (isLoading.current || sendingAssetTicker === null || receivingAssetTicker === null
873
792
  ? s["disabled"]
874
793
  : "")
875
794
  }
@@ -878,12 +797,7 @@ export const SwapForm = ({
878
797
  src={swapSeparatorIconSrc}
879
798
  alt="swap icon"
880
799
  draggable={false}
881
- onClick={(e) =>
882
- callHandlingErrors(
883
- handleChangeAssetsIconClick,
884
- e
885
- )
886
- }
800
+ onClick={e => callHandlingErrors(handleChangeAssetsIconClick, e)}
887
801
  />
888
802
  </div>
889
803
  <AmountInput
@@ -894,11 +808,8 @@ export const SwapForm = ({
894
808
  assetIconSrc={receivingAssetIconSrc}
895
809
  assetIconProtocolSrc={receivingAssetProtocolIconSrc}
896
810
  fallbackAssetIconSrc={fallBackAssetIconSrc}
897
- disabled={
898
- isSwapAll.current ||
899
- sendingAssetTicker === null ||
900
- receivingAssetTicker === null
901
- }
811
+ disabled={isSwapAll.current || sendingAssetTicker === null || receivingAssetTicker === null}
812
+ locked={!formHasBalance}
902
813
  handleCoinAmountChange={handleReceiveAssetAmountChange}
903
814
  handleChangeAssetClick={handleChangeReceivingAssetClick}
904
815
  updateAssetInputTo={updateReceiveInputTo}
@@ -906,16 +817,14 @@ export const SwapForm = ({
906
817
  changeAssetButtonProtocol={receivingAssetProtocol}
907
818
  showBalance={formHasBalance}
908
819
  lowerFormPosition
909
- estimateAmount
820
+ estimateAmount={!isFixedRate}
910
821
  ref={toAssetSelectionButtonRef}
911
822
  isLoading={isLoading.current}
912
823
  cryptoAssetToFiatRate={receivingAssetToFiatRate}
913
824
  fiatCurrencyCode={formHasFiat ? fiatCurrencyCode : null}
914
825
  fiatCurrencyDecimals={fiatCurrencyDecimals}
915
826
  balanceLoaderText={translations.input.balanceLoaderText}
916
- fiatInputPlaceholderText={
917
- translations.input.fiatPlaceholder
918
- }
827
+ fiatInputPlaceholderText={translations.input.fiatPlaceholder}
919
828
  />
920
829
  </div>
921
830
  <div className={s["swap-form-information-field"]}>
@@ -926,25 +835,17 @@ export const SwapForm = ({
926
835
  <>
927
836
  {translations.informationBlock.transactionFee}
928
837
  <span>
929
- {AmountUtils.crypto(
930
- transactionFee?.crypto,
931
- sendingAssetFeeCoinTickerPrintable
932
- )}
838
+ {AmountUtils.crypto(transactionFee?.crypto, sendingAssetFeeCoinTickerPrintable)}
933
839
  </span>
934
- {transactionFee?.fiat != null &&
935
- transactionFee?.fiat !== "" ? (
840
+ {transactionFee?.fiat != null && transactionFee?.fiat !== "" ? (
936
841
  <span className={s["semi-transparent"]}>
937
- {" ~ " +
938
- AmountUtils.fiat(
939
- transactionFee?.fiat,
940
- fiatCurrencyCode
941
- )}
842
+ {" ~ " + AmountUtils.fiat(transactionFee?.fiat, fiatCurrencyCode)}
942
843
  </span>
943
844
  ) : (
944
845
  ""
945
846
  )}
946
847
  </>
947
- ) : isSwapCalculated ? (
848
+ ) : isSwapCalculated || (!minimalAmount.current && swapRate) ? (
948
849
  <>
949
850
  {translations.informationBlock.swapRate}
950
851
  <span>
@@ -953,45 +854,27 @@ export const SwapForm = ({
953
854
  receivingAssetTickerPrintable,
954
855
  swapRate,
955
856
  receivingAssetDecimalCount,
956
- isFixedRate
857
+ isFixedRate.current ?? IS_FIXED_BY_DEFAULT
957
858
  )}
958
859
  </span>
959
860
  </>
960
- ) : minimalAmount.current ? (
961
- !maximumAmountValid &&
962
- maximumAmount.current != null ? (
861
+ ) : minimalAmount.current || maximumAmount.current ? (
862
+ !maximumAmountValid && maximumAmount.current != null ? (
963
863
  <>
964
- {
965
- translations.informationBlock
966
- .maximumAmount
967
- }
864
+ {translations.informationBlock.maximumAmount}
968
865
  <span
969
- className={
970
- s["interactable"] + " " + s["red"]
971
- }
866
+ className={s["interactable"] + " " + s["red"]}
972
867
  onClick={
973
868
  isLoading.current
974
869
  ? () => {}
975
- : (e) =>
976
- callHandlingErrors(
977
- handleMaximumAmountClick,
978
- e
979
- )
870
+ : e => callHandlingErrors(handleMaximumAmountClick, e)
980
871
  }
981
872
  >
982
- {AmountUtils.crypto(
983
- maximumAmount.current?.crypto,
984
- sendingAssetTickerPrintable
985
- )}
873
+ {AmountUtils.crypto(maximumAmount.current?.crypto, sendingAssetTickerPrintable)}
986
874
  </span>
987
- {maximumAmount.current?.fiat != null &&
988
- maximumAmount.current?.fiat !== "" ? (
875
+ {maximumAmount.current?.fiat != null && maximumAmount.current?.fiat !== "" ? (
989
876
  <span className={s["semi-transparent"]}>
990
- {" ~ " +
991
- AmountUtils.fiat(
992
- maximumAmount.current.fiat,
993
- fiatCurrencyCode
994
- )}
877
+ {" ~ " + AmountUtils.fiat(maximumAmount.current.fiat, fiatCurrencyCode)}
995
878
  </span>
996
879
  ) : (
997
880
  ""
@@ -999,41 +882,20 @@ export const SwapForm = ({
999
882
  </>
1000
883
  ) : (
1001
884
  <>
1002
- {
1003
- translations.informationBlock
1004
- .minimumAmount
1005
- }
885
+ {translations.informationBlock.minimumAmount}
1006
886
  <span
1007
- className={
1008
- s["interactable"] +
1009
- " " +
1010
- (!minimalAmountValid
1011
- ? s["red"]
1012
- : "")
1013
- }
887
+ className={s["interactable"] + " " + (!minimalAmountValid ? s["red"] : "")}
1014
888
  onClick={
1015
889
  isLoading.current
1016
890
  ? () => {}
1017
- : (e) =>
1018
- callHandlingErrors(
1019
- handleMinimalAmountClick,
1020
- e
1021
- )
891
+ : e => callHandlingErrors(handleMinimalAmountClick, e)
1022
892
  }
1023
893
  >
1024
- {AmountUtils.crypto(
1025
- minimalAmount.current.crypto,
1026
- sendingAssetTickerPrintable
1027
- )}
894
+ {AmountUtils.crypto(minimalAmount.current.crypto, sendingAssetTickerPrintable)}
1028
895
  </span>
1029
- {minimalAmount.current?.fiat != null &&
1030
- minimalAmount.current.fiat !== "" ? (
896
+ {minimalAmount.current?.fiat != null && minimalAmount.current.fiat !== "" ? (
1031
897
  <span className={s["semi-transparent"]}>
1032
- {" ~ " +
1033
- AmountUtils.fiat(
1034
- minimalAmount.current.fiat,
1035
- fiatCurrencyCode
1036
- )}
898
+ {" ~ " + AmountUtils.fiat(minimalAmount.current.fiat, fiatCurrencyCode)}
1037
899
  </span>
1038
900
  ) : (
1039
901
  ""
@@ -1042,9 +904,7 @@ export const SwapForm = ({
1042
904
  )
1043
905
  ) : sendAssetAmount.current || isSwapAll.current ? (
1044
906
  translations.informationBlock[
1045
- formHasBalance
1046
- ? "calculatingNetworkFee"
1047
- : "calculatingSwapRates"
907
+ formHasBalance ? "calculatingNetworkFee" : "calculatingSwapRates"
1048
908
  ]
1049
909
  ) : (
1050
910
  translations.informationBlock.loadingMinimalAmount
@@ -1054,50 +914,28 @@ export const SwapForm = ({
1054
914
 
1055
915
  {isAddressFieldEnabled ? (
1056
916
  <div className={s["swap-form-address-field"]}>
1057
- <TitleBox
1058
- title={translations.addressFields.addressTitle}
1059
- >
917
+ <TitleBox title={translations.addressFields.addressTitle}>
1060
918
  <Textarea
1061
919
  type={"text"}
1062
- onChange={(e) =>
1063
- setRecepientAddress(e.target.value)
1064
- }
920
+ onChange={e => setRecepientAddress(e.target.value)}
1065
921
  value={recepientAddress}
1066
922
  adaptiveHeight={true}
1067
- errorEncountered={
1068
- !recepientAddressValid &&
1069
- recepientAddress !== ""
1070
- }
1071
- placeholder={
1072
- translations.addressFields
1073
- .addressPlaceholder
1074
- }
923
+ errorEncountered={!recepientAddressValid && recepientAddress !== ""}
1075
924
  />
1076
925
  </TitleBox>
1077
926
  {recepientAddressExtraIdAvailable ? (
1078
927
  <TitleBox
1079
928
  title={translations.addressFields.extraIdTitle}
1080
- titleNoticeText={
1081
- translations.addressFields.extraIdNotice
1082
- }
929
+ titleNoticeText={translations.addressFields.extraIdNotice}
1083
930
  titleNoticePosition={TOOLTIP_POSITIONS.TOP_LEFT}
1084
931
  >
1085
932
  <Textarea
1086
933
  type={"text"}
1087
- onChange={(e) =>
1088
- setRecepientAddressExtraId(
1089
- e.target.value
1090
- )
1091
- }
934
+ onChange={e => setRecepientAddressExtraId(e.target.value)}
1092
935
  value={recepientAddressExtraId}
1093
936
  adaptiveHeight={true}
1094
- errorEncountered={
1095
- !recepientAddressExtraIdValid
1096
- }
1097
- placeholder={
1098
- translations.addressFields
1099
- .extraIdPlaceholder
1100
- }
937
+ errorEncountered={!recepientAddressExtraIdValid}
938
+ placeholder={translations.addressFields.extraIdPlaceholder}
1101
939
  />
1102
940
  </TitleBox>
1103
941
  ) : (
@@ -1111,8 +949,8 @@ export const SwapForm = ({
1111
949
  {displayRateSelector ? (
1112
950
  <div className={s["swap-form-rate-selector"]}>
1113
951
  <RateSelector
1114
- isFixed={isFixedRate}
1115
- setIsFixed={handleRateModeChanged}
952
+ isFixed={isFixedRate.current ?? IS_FIXED_BY_DEFAULT}
953
+ setIsFixed={!isLoading.current ? handleRateModeChanged : () => {}}
1116
954
  translations={translations.rateSelector}
1117
955
  />
1118
956
  </div>
@@ -1129,19 +967,11 @@ export const SwapForm = ({
1129
967
  )}
1130
968
  <div className={s["swap-form-button-container"]}>
1131
969
  {!termsOfUseUrl || !privacyPolicyUrl ? null : (
1132
- <p
1133
- className={
1134
- s["swap-form-button-container-consent-text"]
1135
- }
1136
- >
970
+ <p className={s["swap-form-button-container-consent-text"]}>
1137
971
  {translations.consents.consentText + " "}
1138
972
  <a
1139
973
  href={termsOfUseUrl}
1140
- className={
1141
- s[
1142
- "swap-form-button-container-consent-text-link"
1143
- ]
1144
- }
974
+ className={s["swap-form-button-container-consent-text-link"]}
1145
975
  target="_blank"
1146
976
  >
1147
977
  {translations.consents.termsOfUse}
@@ -1149,11 +979,7 @@ export const SwapForm = ({
1149
979
  {" " + translations.consents.and + " "}
1150
980
  <a
1151
981
  href={privacyPolicyUrl}
1152
- className={
1153
- s[
1154
- "swap-form-button-container-consent-text-link"
1155
- ]
1156
- }
982
+ className={s["swap-form-button-container-consent-text-link"]}
1157
983
  target="_blank"
1158
984
  >
1159
985
  {translations.consents.privacyPolicy}
@@ -1165,11 +991,21 @@ export const SwapForm = ({
1165
991
  size="lg"
1166
992
  mode="primary"
1167
993
  content={translations.confirmButtonText}
1168
- onClick={handleConfirmButtonClick}
994
+ onClick={resetButtonLoader =>
995
+ handleConfirmButtonClick(
996
+ resetButtonLoader,
997
+ setValidationContent,
998
+ setBalanceValid,
999
+ setMinimalAmountValid,
1000
+ setMaximumAmountValid,
1001
+ setIsPairSupported,
1002
+ setIsSameCoins
1003
+ )
1004
+ }
1169
1005
  fullWidthOnMobiles
1170
1006
  isDisabled={!readyToSwap}
1171
1007
  to={formHasBalance ? "" : confirmButtonTo}
1172
- loader={formHasBalance}
1008
+ loader
1173
1009
  handleError={callHandlingErrors}
1174
1010
  />
1175
1011
  </div>
@@ -1190,10 +1026,7 @@ SwapForm.propTypes = {
1190
1026
  sendingAssetIconSrc: PropTypes.string.isRequired,
1191
1027
  sendingAssetProtocolIconSrc: PropTypes.oneOfType([PropTypes.string, null]),
1192
1028
  receivingAssetIconSrc: PropTypes.string.isRequired,
1193
- receivingAssetProtocolIconSrc: PropTypes.oneOfType([
1194
- PropTypes.string,
1195
- null,
1196
- ]),
1029
+ receivingAssetProtocolIconSrc: PropTypes.oneOfType([PropTypes.string, null]),
1197
1030
  fallBackAssetIconSrc: PropTypes.oneOfType([PropTypes.string, null]),
1198
1031
  sendingAssetFeeCoinTickerPrintable: PropTypes.string,
1199
1032
  sendingAssetBalance: PropTypes.string,
@@ -1213,16 +1046,8 @@ SwapForm.propTypes = {
1213
1046
  triggerDataUpdateResetting: PropTypes.number,
1214
1047
  fromAssetSelectionButtonRef: PropTypes.any,
1215
1048
  toAssetSelectionButtonRef: PropTypes.any,
1216
- sendingAssetToFiatRate: PropTypes.oneOfType([
1217
- PropTypes.number,
1218
- PropTypes.string,
1219
- null,
1220
- ]),
1221
- receivingAssetToFiatRate: PropTypes.oneOfType([
1222
- PropTypes.number,
1223
- PropTypes.string,
1224
- null,
1225
- ]),
1049
+ sendingAssetToFiatRate: PropTypes.oneOfType([PropTypes.number, PropTypes.string, null]),
1050
+ receivingAssetToFiatRate: PropTypes.oneOfType([PropTypes.number, PropTypes.string, null]),
1226
1051
  fiatCurrencyCode: PropTypes.oneOfType([PropTypes.string, null]),
1227
1052
  fiatCurrencyDecimals: PropTypes.oneOfType([PropTypes.number, null]),
1228
1053
  formHasFiat: PropTypes.bool,
@@ -1237,10 +1062,18 @@ SwapForm.defaultProps = {
1237
1062
  sendingAssetProtocolIconSrc: null,
1238
1063
  receivingAssetProtocolIconSrc: null,
1239
1064
  fallBackAssetIconSrc: null,
1240
- handleConfirmButtonClick: () => {},
1065
+ handleConfirmButtonClick: (
1066
+ resetButtonLoader,
1067
+ setValidationContent,
1068
+ setBalanceValid,
1069
+ setMinimalAmountValid,
1070
+ setMaximumAmountValid,
1071
+ setIsPairSupported,
1072
+ setIsSameCoins
1073
+ ) => {},
1241
1074
  composeConfirmButtonTo: (fromTicker, toTicker, fromAmount) => "",
1242
- setSwapCreationEstimation: (details) => {},
1243
- handleUnexpectedError: (error) => {},
1075
+ setSwapCreationEstimation: details => {},
1076
+ handleUnexpectedError: error => {},
1244
1077
  rotateAssets: (fromTicker, toTicker) => {},
1245
1078
  preservedAmount: null,
1246
1079
  handleSwapServiceError: (
@@ -1252,16 +1085,8 @@ SwapForm.defaultProps = {
1252
1085
  setIsPairSupported,
1253
1086
  setIsSameCoins
1254
1087
  ) => {},
1255
- retrieveSwapDetails: async (
1256
- sendingAssetTicker,
1257
- receivingAssetTicker,
1258
- amount,
1259
- isSwapAll = false
1260
- ) => {},
1261
- retrieveInitialSwapData: async (
1262
- sendingAssetTicker,
1263
- receivingAssetTicker
1264
- ) => {},
1088
+ retrieveSwapDetails: async (sendingAssetTicker, receivingAssetTicker, amount, isSwapAll = false) => {},
1089
+ retrieveInitialSwapData: async (sendingAssetTicker, receivingAssetTicker) => {},
1265
1090
  triggerDataUpdateResetting: 0,
1266
1091
  fromAssetSelectionButtonRef: null,
1267
1092
  toAssetSelectionButtonRef: null,