@rabbitio/ui-kit 1.0.0-beta.65 → 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 (254) hide show
  1. package/coverage/clover.xml +6311 -4236
  2. package/coverage/coverage-final.json +160 -99
  3. package/coverage/index.html +442 -187
  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 +3 -3
  68. package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Validation/index.html +3 -3
  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 +61 -523
  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 +96 -762
  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 +12 -14
  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 +12 -13
  167. package/dist/index.modern.js.map +1 -1
  168. package/dist/index.module.js +12 -14
  169. package/dist/index.module.js.map +1 -1
  170. package/dist/index.umd.js +12 -14
  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/buttons/Button/Button.jsx +17 -47
  209. package/src/components/atoms/buttons/Close/Close.jsx +3 -9
  210. package/src/components/atoms/buttons/LinkButton/LinkButton.jsx +5 -14
  211. package/src/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx +7 -25
  212. package/src/components/hooks/useCallHandlingErrors.js +1 -5
  213. package/src/components/hooks/useReferredState.js +1 -1
  214. package/src/components/molecules/AmountInput/AmountInput.jsx +50 -167
  215. package/src/components/molecules/CoinPicker/CoinPicker.jsx +61 -194
  216. package/src/components/molecules/CoinPicker/coin-picker.module.scss +1 -4
  217. package/src/components/molecules/LineWithIconLink/LineWithIconLink.jsx +1 -6
  218. package/src/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx +3 -5
  219. package/src/components/organisms/Dialog/Dialog.jsx +38 -88
  220. package/src/components/organisms/Dialog/DialogStep/DialogStep.jsx +55 -209
  221. package/src/components/organisms/Dialog/DialogStep/dialog-step.module.scss +2 -4
  222. package/src/components/organisms/SwapForm/SwapForm.jsx +90 -312
  223. package/src/components/tests/utils/inputValueProviders/provideFormatOfFloatValueByInputString.test.js +5 -12
  224. package/src/components/tests/utils/urlQueryUtils/getQueryParameterValues.test.js +3 -9
  225. package/src/components/tests/utils/urlQueryUtils/saveQueryParameterAndValues.test.js +11 -51
  226. package/src/components/utils/inputValueProviders.js +3 -11
  227. package/src/components/utils/uiUtils.js +1 -3
  228. package/src/components/utils/urlQueryUtils.js +10 -35
  229. package/src/constants/globalConstants.jsx +1 -2
  230. package/src/index.js +2 -8
  231. package/src/robustExteranlApiCallerService/cacheAndConcurrentRequestsResolver.js +22 -86
  232. package/src/robustExteranlApiCallerService/cachedRobustExternalApiCallerService.js +15 -56
  233. package/src/robustExteranlApiCallerService/concurrentCalculationsMetadataHolder.js +11 -39
  234. package/src/robustExteranlApiCallerService/externalServicesStatsCollector.js +3 -7
  235. package/src/robustExteranlApiCallerService/robustExternalAPICallerService.js +45 -129
  236. package/src/robustExteranlApiCallerService/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/_performCallAttempt.test.js +76 -330
  237. package/src/robustExteranlApiCallerService/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/callExternalAPI.test.js +57 -270
  238. package/src/robustExteranlApiCallerService/tests/robustExternalAPICallerService/robustExternalAPICallerService/constructor.test.js +3 -15
  239. package/src/swaps-lib/external-apis/swapProvider.js +1 -7
  240. package/src/swaps-lib/external-apis/swapspaceSwapProvider.js +117 -361
  241. package/src/swaps-lib/models/existingSwapWithFiatData.js +1 -7
  242. package/src/swaps-lib/services/publicSwapService.js +47 -154
  243. package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +33 -118
  244. package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/createSwap.test.js +23 -85
  245. package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getAllSupportedCurrencies.test.js +4 -14
  246. package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getDepositCurrencies.test.js +3 -9
  247. package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getSwapInfo.test.js +148 -460
  248. package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getWithdrawalCurrencies.test.js +5 -11
  249. package/src/swaps-lib/test/utils/swapUtils/safeHandleRequestsLimitExceeding.test.js +2 -10
  250. package/src/swaps-lib/utils/swapUtils.js +24 -73
  251. package/coverage/rabbit-ui-kit/src/assets/wrappedImages/failedValidationIcon.jsx.html +0 -244
  252. package/coverage/rabbit-ui-kit/src/components/atoms/LoadingDots/LoadingDots.jsx.html +0 -256
  253. package/coverage/rabbit-ui-kit/src/components/atoms/LoadingDots/index.html +0 -116
  254. package/coverage/rabbit-ui-kit/src/components/atoms/TwoLinesOfText/index.html +0 -116
@@ -215,8 +215,8 @@ export const SwapForm = ({
215
215
  setIsSameCoins
216
216
  ) => {},
217
217
  composeConfirmButtonTo = (fromTicker, toTicker, fromAmount) => "",
218
- setSwapCreationEstimation = (details) => {},
219
- handleUnexpectedError = (error) => {},
218
+ setSwapCreationEstimation = details => {},
219
+ handleUnexpectedError = error => {},
220
220
  rotateAssets = (fromTicker, toTicker) => {},
221
221
  preservedAmount = null,
222
222
  handleSwapServiceError = (
@@ -229,16 +229,8 @@ export const SwapForm = ({
229
229
  setIsSameCoins
230
230
  ) => {},
231
231
  formHasBalance = false,
232
- retrieveSwapDetails = async (
233
- sendingAssetTicker,
234
- receivingAssetTicker,
235
- amount,
236
- isSwapAll = false
237
- ) => {},
238
- retrieveInitialSwapData = async (
239
- sendingAssetTicker,
240
- receivingAssetTicker
241
- ) => {},
232
+ retrieveSwapDetails = async (sendingAssetTicker, receivingAssetTicker, amount, isSwapAll = false) => {},
233
+ retrieveInitialSwapData = async (sendingAssetTicker, receivingAssetTicker) => {},
242
234
  triggerDataUpdateResetting = 0,
243
235
  fromAssetSelectionButtonRef = null,
244
236
  toAssetSelectionButtonRef = null,
@@ -272,12 +264,10 @@ export const SwapForm = ({
272
264
  loadingMinimalAmount: "Loading minimal amount..",
273
265
  swapRate: "Rate: ",
274
266
  calculatingSwapRates: "Calculating swap rates..",
275
- pairNotAvailable:
276
- "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.",
277
268
  },
278
269
  addressFields: {
279
270
  addressTitle: "Recepient address",
280
- addressPlaceholder: "Example: 1XPTgDRh...",
281
271
  extraIdTitle: "Extra ID (optional)",
282
272
  extraIdPlaceholder: "Example: ABC123",
283
273
  extraIdNotice:
@@ -299,21 +289,16 @@ export const SwapForm = ({
299
289
  setRecepientAddressExtraId,
300
290
  recepientAddressExtraIdAvailable = false,
301
291
  displayRateSelector = false,
302
- dispatchRateModeChanged = (isFixed) => {},
303
292
  }) => {
304
293
  const DETAIL_REFRESH_INTERVAL_MS = 1.5 * 60000;
305
294
  const IS_FIXED_BY_DEFAULT = false;
306
295
 
307
296
  // Updating the states below will insert the new value into the send or receive input field
308
- const [updateSendInputTo, setUpdateSendInputTo] = useState(
309
- preservedAmount ?? null
310
- );
297
+ const [updateSendInputTo, setUpdateSendInputTo] = useState(preservedAmount ?? null);
311
298
  const [updateReceiveInputTo, setUpdateReceiveInputTo] = useState(null);
312
299
 
313
300
  const [sendAssetAmount, setSendAssetAmount] = useReferredState(
314
- preservedAmount == null || preservedAmount === ""
315
- ? null
316
- : preservedAmount
301
+ preservedAmount == null || preservedAmount === "" ? null : preservedAmount
317
302
  );
318
303
 
319
304
  const [swapRate, setSwapRate] = useState();
@@ -329,57 +314,40 @@ export const SwapForm = ({
329
314
  const [readyToSwap, setReadyToSwap] = useState(false); // Basically a param that enables/disables the "Next" button
330
315
  // TODO: [refactoring, moderate] instead of handling preservedAmount at a lot of cases below, just
331
316
  // write single useEffect setting sendAssetAmount to the=is passed value and simplify the logic below. task_id=6453251e49b04c5e88a3cc771479ffb5
332
- const [isAmountZero, setIsAmountZero] = useState(
333
- preservedAmount == null || String(preservedAmount) === "0"
334
- );
317
+ const [isAmountZero, setIsAmountZero] = useState(preservedAmount == null || String(preservedAmount) === "0");
335
318
  const [isLoading, setIsLoading] = useReferredState(false); // Whether the form is in the progress of loading some data (new rates, for example)
336
319
  const [isAddressFieldEnabled, setIsAddressFieldEnabled] = useState(false);
337
320
  const [isFixedRate, setIsFixedRate] = useReferredState(null);
338
321
 
339
322
  const [confirmButtonTo, setConfirmButtonTo] = useState(
340
- composeConfirmButtonTo(
341
- sendingAssetTicker,
342
- receivingAssetTicker,
343
- preservedAmount
344
- )
323
+ composeConfirmButtonTo(sendingAssetTicker, receivingAssetTicker, preservedAmount)
345
324
  );
346
325
 
347
326
  const [transactionFee, setTransactionFee] = useState();
348
327
  const [balanceValid, setBalanceValid] = useState(true); // Whether the amount is less than total balance
349
328
  const [isSwapAll, setIsSwapAll] = useReferredState(null);
350
- const [swapAllButtonLoaderReSetter, setSwapAllButtonLoaderReSetter] =
351
- useState([]);
329
+ const [swapAllButtonLoaderReSetter, setSwapAllButtonLoaderReSetter] = useState([]);
352
330
 
353
- const [dataUpdateTimeoutId, setDataUpdateTimeoutId] =
354
- useReferredState(null);
355
- const [idleDataUpdateTimeoutId, setIdleDataUpdateTimeoutId] =
356
- useReferredState(null);
331
+ const [dataUpdateTimeoutId, setDataUpdateTimeoutId] = useReferredState(null);
332
+ const [idleDataUpdateTimeoutId, setIdleDataUpdateTimeoutId] = useReferredState(null);
357
333
 
358
334
  const callHandlingErrors = useCallHandlingErrors();
359
335
 
360
336
  const recalculationDelayOnTyping = 1000;
361
337
 
362
- const handleSendAssetAmountChange = (amount) => {
338
+ const handleSendAssetAmountChange = amount => {
363
339
  if (amount != null && amount !== "") {
364
- setUpdateReceiveInputTo(
365
- AmountUtils.trim(
366
- BigNumber(amount).times(swapRate),
367
- receivingAssetDecimalCount
368
- )
369
- );
340
+ setUpdateReceiveInputTo(AmountUtils.trim(BigNumber(amount).times(swapRate), receivingAssetDecimalCount));
370
341
  } else {
371
342
  setUpdateReceiveInputTo("");
372
343
  }
373
344
  setSendAssetAmount(amount);
374
345
  };
375
346
 
376
- const handleReceiveAssetAmountChange = (amount) => {
347
+ const handleReceiveAssetAmountChange = amount => {
377
348
  let sendAssetAmount = "";
378
349
  if (amount != null && amount !== "") {
379
- sendAssetAmount = AmountUtils.trim(
380
- BigNumber(amount).div(swapRate),
381
- sendingAssetDecimalCount
382
- );
350
+ sendAssetAmount = AmountUtils.trim(BigNumber(amount).div(swapRate), sendingAssetDecimalCount);
383
351
  }
384
352
  setUpdateSendInputTo(sendAssetAmount);
385
353
  setSendAssetAmount(sendAssetAmount);
@@ -399,8 +367,8 @@ export const SwapForm = ({
399
367
  handleSendAssetAmountChange(maximumAmount.current?.crypto);
400
368
  };
401
369
 
402
- const handleSwapAllClick = (resetButtonLoader) => {
403
- setIsSwapAll((prev) => {
370
+ const handleSwapAllClick = resetButtonLoader => {
371
+ setIsSwapAll(prev => {
404
372
  if (prev) {
405
373
  // Setting amount inputs to empty string if we are handling the disabling of previously enabled swap all
406
374
  setUpdateSendInputTo("");
@@ -412,26 +380,18 @@ export const SwapForm = ({
412
380
  setSwapAllButtonLoaderReSetter([resetButtonLoader]);
413
381
  };
414
382
 
415
- const processMinMaxAmounts = (amount) => {
383
+ const processMinMaxAmounts = amount => {
416
384
  if (amount === null) return;
417
385
 
418
386
  setMaximumAmountValid(
419
- !maximumAmount.current ||
420
- BigNumber(amount).eq("0") ||
421
- BigNumber(amount).lte(maximumAmount.current.crypto)
387
+ !maximumAmount.current || BigNumber(amount).eq("0") || BigNumber(amount).lte(maximumAmount.current.crypto)
422
388
  );
423
389
  setMinimalAmountValid(
424
- !minimalAmount.current ||
425
- BigNumber(amount).eq("0") ||
426
- BigNumber(amount).gte(minimalAmount.current?.crypto)
390
+ !minimalAmount.current || BigNumber(amount).eq("0") || BigNumber(amount).gte(minimalAmount.current?.crypto)
427
391
  );
428
392
  };
429
393
 
430
- const requestDataRefresh = (
431
- amount,
432
- immediately = false,
433
- isSwapAll = false
434
- ) => {
394
+ const requestDataRefresh = (amount, immediately = false, isSwapAll = false) => {
435
395
  try {
436
396
  clearTimeout(dataUpdateTimeoutId.current);
437
397
 
@@ -449,27 +409,14 @@ export const SwapForm = ({
449
409
  loadMinimalAmountAndSwapRate(true);
450
410
  } else {
451
411
  setDataUpdateTimeoutId(
452
- setTimeout(
453
- () => loadMinimalAmountAndSwapRate(true),
454
- recalculationDelayOnTyping
455
- )
412
+ setTimeout(() => loadMinimalAmountAndSwapRate(true), recalculationDelayOnTyping)
456
413
  );
457
414
  }
458
415
  } else {
459
416
  if (immediately) {
460
- loadFullEstimation(
461
- amount,
462
- preservedAmount && String(preservedAmount) !== "0"
463
- ? true
464
- : undefined
465
- );
417
+ loadFullEstimation(amount, preservedAmount && String(preservedAmount) !== "0" ? true : undefined);
466
418
  } else {
467
- setDataUpdateTimeoutId(
468
- setTimeout(
469
- () => loadFullEstimation(amount),
470
- recalculationDelayOnTyping
471
- )
472
- );
419
+ setDataUpdateTimeoutId(setTimeout(() => loadFullEstimation(amount), recalculationDelayOnTyping));
473
420
  }
474
421
  }
475
422
  } catch (e) {
@@ -477,18 +424,10 @@ export const SwapForm = ({
477
424
  }
478
425
  };
479
426
 
480
- const setAmountLimitsAndRate = (details) => {
427
+ const setAmountLimitsAndRate = details => {
481
428
  setSwapRate(details?.rate ?? null);
482
- setMinimalAmount(
483
- details.min == null
484
- ? null
485
- : { crypto: details.min, fiat: details.fiatMin }
486
- );
487
- setMaximumAmount(
488
- details.max == null
489
- ? null
490
- : { crypto: details.max, fiat: details.fiatMax }
491
- );
429
+ setMinimalAmount(details.min == null ? null : { crypto: details.min, fiat: details.fiatMin });
430
+ setMaximumAmount(details.max == null ? null : { crypto: details.max, fiat: details.fiatMax });
492
431
  if (details.feeCoins != null) {
493
432
  setTransactionFee({
494
433
  crypto: details.feeCoins,
@@ -547,18 +486,12 @@ export const SwapForm = ({
547
486
  setUpdateReceiveInputTo(swapCreationInfo.toAmountCoins);
548
487
 
549
488
  if (isSwapAll.current) {
550
- setIsAmountZero(
551
- BigNumber("0").eq(swapCreationInfo.fromAmountCoins)
552
- );
489
+ setIsAmountZero(BigNumber("0").eq(swapCreationInfo.fromAmountCoins));
553
490
  }
554
491
 
555
492
  setAmountLimitsAndRate(swapCreationInfo);
556
493
  setSwapCreationEstimation(swapCreationInfo);
557
- processMinMaxAmounts(
558
- isSwapAll.current
559
- ? swapCreationInfo.fromAmountCoins
560
- : amount
561
- );
494
+ processMinMaxAmounts(isSwapAll.current ? swapCreationInfo.fromAmountCoins : amount);
562
495
  setIsSwapCalculated(true);
563
496
  } else {
564
497
  handleSwapServiceError(
@@ -600,15 +533,9 @@ export const SwapForm = ({
600
533
  setValidationContent(null);
601
534
  setIsSwapCalculated(false);
602
535
 
603
- const swapData = await retrieveInitialSwapData(
604
- sendingAssetTicker,
605
- receivingAssetTicker
606
- );
536
+ const swapData = await retrieveInitialSwapData(sendingAssetTicker, receivingAssetTicker);
607
537
 
608
- if (
609
- sendAssetAmount.current != null &&
610
- !isCalledForClearedInput
611
- ) {
538
+ if (sendAssetAmount.current != null && !isCalledForClearedInput) {
612
539
  // Means user already entered amount after starting the form initialization
613
540
  return;
614
541
  }
@@ -634,7 +561,7 @@ export const SwapForm = ({
634
561
  })();
635
562
  };
636
563
 
637
- const handleChangeAssetsIconClick = (e) => {
564
+ const handleChangeAssetsIconClick = e => {
638
565
  callHandlingErrors(() => {
639
566
  if (!isLoading.current) {
640
567
  setIsSwapAll(null);
@@ -645,9 +572,8 @@ export const SwapForm = ({
645
572
  }, e);
646
573
  };
647
574
 
648
- const handleRateModeChanged = (isFixed) => {
575
+ const handleRateModeChanged = isFixed => {
649
576
  setIsFixedRate(isFixed);
650
- dispatchRateModeChanged(isFixed);
651
577
  requestDataRefresh(sendAssetAmount.current, true);
652
578
  };
653
579
 
@@ -674,11 +600,8 @@ export const SwapForm = ({
674
600
  useEffect(() => {
675
601
  if (!sendingAssetTicker || !receivingAssetTicker) return;
676
602
 
677
- const isCurrentAmountNotZero =
678
- sendAssetAmount.current &&
679
- !BigNumber("0").eq(sendAssetAmount.current);
680
- const isPreservedAmountNotZero =
681
- preservedAmount && !BigNumber("0").eq(preservedAmount);
603
+ const isCurrentAmountNotZero = sendAssetAmount.current && !BigNumber("0").eq(sendAssetAmount.current);
604
+ const isPreservedAmountNotZero = preservedAmount && !BigNumber("0").eq(preservedAmount);
682
605
  if (isCurrentAmountNotZero) {
683
606
  loadFullEstimation(sendAssetAmount.current);
684
607
  } else if (isPreservedAmountNotZero) {
@@ -727,11 +650,7 @@ export const SwapForm = ({
727
650
  let timeoutId = null;
728
651
  if (readyToSwap) {
729
652
  timeoutId = setTimeout(
730
- () =>
731
- requestDataRefresh(
732
- sendAssetAmount.current ?? preservedAmount,
733
- true
734
- ),
653
+ () => requestDataRefresh(sendAssetAmount.current ?? preservedAmount, true),
735
654
  DETAIL_REFRESH_INTERVAL_MS
736
655
  );
737
656
  setIdleDataUpdateTimeoutId(timeoutId);
@@ -767,20 +686,14 @@ export const SwapForm = ({
767
686
  useEffect(() => {
768
687
  if (swapRate != null && sendAssetAmount.current != null) {
769
688
  setUpdateReceiveInputTo(
770
- AmountUtils.trim(
771
- BigNumber(sendAssetAmount.current).times(swapRate),
772
- receivingAssetDecimalCount
773
- )
689
+ AmountUtils.trim(BigNumber(sendAssetAmount.current).times(swapRate), receivingAssetDecimalCount)
774
690
  );
775
691
  }
776
692
  // eslint-disable-next-line react-hooks/exhaustive-deps
777
693
  }, [swapRate]);
778
694
 
779
695
  useEffect(() => {
780
- if (
781
- isLoading.current === false &&
782
- swapAllButtonLoaderReSetter?.length
783
- ) {
696
+ if (isLoading.current === false && swapAllButtonLoaderReSetter?.length) {
784
697
  swapAllButtonLoaderReSetter[0]();
785
698
  setSwapAllButtonLoaderReSetter([]);
786
699
  }
@@ -789,17 +702,10 @@ export const SwapForm = ({
789
702
 
790
703
  // Handlers upon changing the asset amount
791
704
  useEffect(() => {
792
- setConfirmButtonTo(
793
- composeConfirmButtonTo(
794
- sendingAssetTicker,
795
- receivingAssetTicker,
796
- sendAssetAmount.current
797
- )
798
- );
705
+ setConfirmButtonTo(composeConfirmButtonTo(sendingAssetTicker, receivingAssetTicker, sendAssetAmount.current));
799
706
 
800
707
  if (sendAssetAmount.current == null) return;
801
- let processingAmount =
802
- sendAssetAmount.current === "" ? "0" : sendAssetAmount.current;
708
+ let processingAmount = sendAssetAmount.current === "" ? "0" : sendAssetAmount.current;
803
709
  requestDataRefresh(processingAmount);
804
710
  processMinMaxAmounts(processingAmount);
805
711
  setIsAmountZero(BigNumber("0").eq(processingAmount));
@@ -834,8 +740,7 @@ export const SwapForm = ({
834
740
  linkButtonClick={
835
741
  BigNumber(sendingAssetBalance?.assetAmount).eq(0)
836
742
  ? null
837
- : (resetButtonLoader) =>
838
- handleSwapAllClick(resetButtonLoader)
743
+ : resetButtonLoader => handleSwapAllClick(resetButtonLoader)
839
744
  }
840
745
  linkText={
841
746
  !formHasBalance
@@ -860,16 +765,10 @@ export const SwapForm = ({
860
765
  assetIconSrc={sendingAssetIconSrc}
861
766
  assetIconProtocolSrc={sendingAssetProtocolIconSrc}
862
767
  fallbackAssetIconSrc={fallBackAssetIconSrc}
863
- disabled={
864
- isSwapAll.current ||
865
- sendingAssetTicker === null ||
866
- receivingAssetTicker === null
867
- }
768
+ disabled={isSwapAll.current || sendingAssetTicker === null || receivingAssetTicker === null}
868
769
  handleCoinAmountChange={handleSendAssetAmountChange}
869
770
  handleChangeAssetClick={handleChangeSendingAssetClick}
870
- handleBalanceValidationChange={(isValid) =>
871
- setBalanceValid(!isValid)
872
- }
771
+ handleBalanceValidationChange={isValid => setBalanceValid(!isValid)}
873
772
  updateAssetInputTo={updateSendInputTo}
874
773
  showBalance={formHasBalance}
875
774
  showBalanceValidation={formHasBalance}
@@ -883,17 +782,13 @@ export const SwapForm = ({
883
782
  fiatCurrencyCode={formHasFiat ? fiatCurrencyCode : null}
884
783
  fiatCurrencyDecimals={fiatCurrencyDecimals}
885
784
  balanceLoaderText={translations.input.balanceLoaderText}
886
- fiatInputPlaceholderText={
887
- translations.input.fiatPlaceholder
888
- }
785
+ fiatInputPlaceholderText={translations.input.fiatPlaceholder}
889
786
  />
890
787
  <div
891
788
  className={
892
789
  s["swap-form-inputs-separator"] +
893
790
  " " +
894
- (isLoading.current ||
895
- sendingAssetTicker === null ||
896
- receivingAssetTicker === null
791
+ (isLoading.current || sendingAssetTicker === null || receivingAssetTicker === null
897
792
  ? s["disabled"]
898
793
  : "")
899
794
  }
@@ -902,12 +797,7 @@ export const SwapForm = ({
902
797
  src={swapSeparatorIconSrc}
903
798
  alt="swap icon"
904
799
  draggable={false}
905
- onClick={(e) =>
906
- callHandlingErrors(
907
- handleChangeAssetsIconClick,
908
- e
909
- )
910
- }
800
+ onClick={e => callHandlingErrors(handleChangeAssetsIconClick, e)}
911
801
  />
912
802
  </div>
913
803
  <AmountInput
@@ -918,11 +808,8 @@ export const SwapForm = ({
918
808
  assetIconSrc={receivingAssetIconSrc}
919
809
  assetIconProtocolSrc={receivingAssetProtocolIconSrc}
920
810
  fallbackAssetIconSrc={fallBackAssetIconSrc}
921
- disabled={
922
- isSwapAll.current ||
923
- sendingAssetTicker === null ||
924
- receivingAssetTicker === null
925
- }
811
+ disabled={isSwapAll.current || sendingAssetTicker === null || receivingAssetTicker === null}
812
+ locked={!formHasBalance}
926
813
  handleCoinAmountChange={handleReceiveAssetAmountChange}
927
814
  handleChangeAssetClick={handleChangeReceivingAssetClick}
928
815
  updateAssetInputTo={updateReceiveInputTo}
@@ -930,16 +817,14 @@ export const SwapForm = ({
930
817
  changeAssetButtonProtocol={receivingAssetProtocol}
931
818
  showBalance={formHasBalance}
932
819
  lowerFormPosition
933
- estimateAmount
820
+ estimateAmount={!isFixedRate}
934
821
  ref={toAssetSelectionButtonRef}
935
822
  isLoading={isLoading.current}
936
823
  cryptoAssetToFiatRate={receivingAssetToFiatRate}
937
824
  fiatCurrencyCode={formHasFiat ? fiatCurrencyCode : null}
938
825
  fiatCurrencyDecimals={fiatCurrencyDecimals}
939
826
  balanceLoaderText={translations.input.balanceLoaderText}
940
- fiatInputPlaceholderText={
941
- translations.input.fiatPlaceholder
942
- }
827
+ fiatInputPlaceholderText={translations.input.fiatPlaceholder}
943
828
  />
944
829
  </div>
945
830
  <div className={s["swap-form-information-field"]}>
@@ -950,25 +835,17 @@ export const SwapForm = ({
950
835
  <>
951
836
  {translations.informationBlock.transactionFee}
952
837
  <span>
953
- {AmountUtils.crypto(
954
- transactionFee?.crypto,
955
- sendingAssetFeeCoinTickerPrintable
956
- )}
838
+ {AmountUtils.crypto(transactionFee?.crypto, sendingAssetFeeCoinTickerPrintable)}
957
839
  </span>
958
- {transactionFee?.fiat != null &&
959
- transactionFee?.fiat !== "" ? (
840
+ {transactionFee?.fiat != null && transactionFee?.fiat !== "" ? (
960
841
  <span className={s["semi-transparent"]}>
961
- {" ~ " +
962
- AmountUtils.fiat(
963
- transactionFee?.fiat,
964
- fiatCurrencyCode
965
- )}
842
+ {" ~ " + AmountUtils.fiat(transactionFee?.fiat, fiatCurrencyCode)}
966
843
  </span>
967
844
  ) : (
968
845
  ""
969
846
  )}
970
847
  </>
971
- ) : isSwapCalculated ? (
848
+ ) : isSwapCalculated || (!minimalAmount.current && swapRate) ? (
972
849
  <>
973
850
  {translations.informationBlock.swapRate}
974
851
  <span>
@@ -977,46 +854,27 @@ export const SwapForm = ({
977
854
  receivingAssetTickerPrintable,
978
855
  swapRate,
979
856
  receivingAssetDecimalCount,
980
- isFixedRate.current ??
981
- IS_FIXED_BY_DEFAULT
857
+ isFixedRate.current ?? IS_FIXED_BY_DEFAULT
982
858
  )}
983
859
  </span>
984
860
  </>
985
- ) : minimalAmount.current ? (
986
- !maximumAmountValid &&
987
- maximumAmount.current != null ? (
861
+ ) : minimalAmount.current || maximumAmount.current ? (
862
+ !maximumAmountValid && maximumAmount.current != null ? (
988
863
  <>
989
- {
990
- translations.informationBlock
991
- .maximumAmount
992
- }
864
+ {translations.informationBlock.maximumAmount}
993
865
  <span
994
- className={
995
- s["interactable"] + " " + s["red"]
996
- }
866
+ className={s["interactable"] + " " + s["red"]}
997
867
  onClick={
998
868
  isLoading.current
999
869
  ? () => {}
1000
- : (e) =>
1001
- callHandlingErrors(
1002
- handleMaximumAmountClick,
1003
- e
1004
- )
870
+ : e => callHandlingErrors(handleMaximumAmountClick, e)
1005
871
  }
1006
872
  >
1007
- {AmountUtils.crypto(
1008
- maximumAmount.current?.crypto,
1009
- sendingAssetTickerPrintable
1010
- )}
873
+ {AmountUtils.crypto(maximumAmount.current?.crypto, sendingAssetTickerPrintable)}
1011
874
  </span>
1012
- {maximumAmount.current?.fiat != null &&
1013
- maximumAmount.current?.fiat !== "" ? (
875
+ {maximumAmount.current?.fiat != null && maximumAmount.current?.fiat !== "" ? (
1014
876
  <span className={s["semi-transparent"]}>
1015
- {" ~ " +
1016
- AmountUtils.fiat(
1017
- maximumAmount.current.fiat,
1018
- fiatCurrencyCode
1019
- )}
877
+ {" ~ " + AmountUtils.fiat(maximumAmount.current.fiat, fiatCurrencyCode)}
1020
878
  </span>
1021
879
  ) : (
1022
880
  ""
@@ -1024,41 +882,20 @@ export const SwapForm = ({
1024
882
  </>
1025
883
  ) : (
1026
884
  <>
1027
- {
1028
- translations.informationBlock
1029
- .minimumAmount
1030
- }
885
+ {translations.informationBlock.minimumAmount}
1031
886
  <span
1032
- className={
1033
- s["interactable"] +
1034
- " " +
1035
- (!minimalAmountValid
1036
- ? s["red"]
1037
- : "")
1038
- }
887
+ className={s["interactable"] + " " + (!minimalAmountValid ? s["red"] : "")}
1039
888
  onClick={
1040
889
  isLoading.current
1041
890
  ? () => {}
1042
- : (e) =>
1043
- callHandlingErrors(
1044
- handleMinimalAmountClick,
1045
- e
1046
- )
891
+ : e => callHandlingErrors(handleMinimalAmountClick, e)
1047
892
  }
1048
893
  >
1049
- {AmountUtils.crypto(
1050
- minimalAmount.current.crypto,
1051
- sendingAssetTickerPrintable
1052
- )}
894
+ {AmountUtils.crypto(minimalAmount.current.crypto, sendingAssetTickerPrintable)}
1053
895
  </span>
1054
- {minimalAmount.current?.fiat != null &&
1055
- minimalAmount.current.fiat !== "" ? (
896
+ {minimalAmount.current?.fiat != null && minimalAmount.current.fiat !== "" ? (
1056
897
  <span className={s["semi-transparent"]}>
1057
- {" ~ " +
1058
- AmountUtils.fiat(
1059
- minimalAmount.current.fiat,
1060
- fiatCurrencyCode
1061
- )}
898
+ {" ~ " + AmountUtils.fiat(minimalAmount.current.fiat, fiatCurrencyCode)}
1062
899
  </span>
1063
900
  ) : (
1064
901
  ""
@@ -1067,9 +904,7 @@ export const SwapForm = ({
1067
904
  )
1068
905
  ) : sendAssetAmount.current || isSwapAll.current ? (
1069
906
  translations.informationBlock[
1070
- formHasBalance
1071
- ? "calculatingNetworkFee"
1072
- : "calculatingSwapRates"
907
+ formHasBalance ? "calculatingNetworkFee" : "calculatingSwapRates"
1073
908
  ]
1074
909
  ) : (
1075
910
  translations.informationBlock.loadingMinimalAmount
@@ -1079,50 +914,28 @@ export const SwapForm = ({
1079
914
 
1080
915
  {isAddressFieldEnabled ? (
1081
916
  <div className={s["swap-form-address-field"]}>
1082
- <TitleBox
1083
- title={translations.addressFields.addressTitle}
1084
- >
917
+ <TitleBox title={translations.addressFields.addressTitle}>
1085
918
  <Textarea
1086
919
  type={"text"}
1087
- onChange={(e) =>
1088
- setRecepientAddress(e.target.value)
1089
- }
920
+ onChange={e => setRecepientAddress(e.target.value)}
1090
921
  value={recepientAddress}
1091
922
  adaptiveHeight={true}
1092
- errorEncountered={
1093
- !recepientAddressValid &&
1094
- recepientAddress !== ""
1095
- }
1096
- placeholder={
1097
- translations.addressFields
1098
- .addressPlaceholder
1099
- }
923
+ errorEncountered={!recepientAddressValid && recepientAddress !== ""}
1100
924
  />
1101
925
  </TitleBox>
1102
926
  {recepientAddressExtraIdAvailable ? (
1103
927
  <TitleBox
1104
928
  title={translations.addressFields.extraIdTitle}
1105
- titleNoticeText={
1106
- translations.addressFields.extraIdNotice
1107
- }
929
+ titleNoticeText={translations.addressFields.extraIdNotice}
1108
930
  titleNoticePosition={TOOLTIP_POSITIONS.TOP_LEFT}
1109
931
  >
1110
932
  <Textarea
1111
933
  type={"text"}
1112
- onChange={(e) =>
1113
- setRecepientAddressExtraId(
1114
- e.target.value
1115
- )
1116
- }
934
+ onChange={e => setRecepientAddressExtraId(e.target.value)}
1117
935
  value={recepientAddressExtraId}
1118
936
  adaptiveHeight={true}
1119
- errorEncountered={
1120
- !recepientAddressExtraIdValid
1121
- }
1122
- placeholder={
1123
- translations.addressFields
1124
- .extraIdPlaceholder
1125
- }
937
+ errorEncountered={!recepientAddressExtraIdValid}
938
+ placeholder={translations.addressFields.extraIdPlaceholder}
1126
939
  />
1127
940
  </TitleBox>
1128
941
  ) : (
@@ -1137,11 +950,7 @@ export const SwapForm = ({
1137
950
  <div className={s["swap-form-rate-selector"]}>
1138
951
  <RateSelector
1139
952
  isFixed={isFixedRate.current ?? IS_FIXED_BY_DEFAULT}
1140
- setIsFixed={
1141
- !isLoading.current
1142
- ? handleRateModeChanged
1143
- : () => {}
1144
- }
953
+ setIsFixed={!isLoading.current ? handleRateModeChanged : () => {}}
1145
954
  translations={translations.rateSelector}
1146
955
  />
1147
956
  </div>
@@ -1158,19 +967,11 @@ export const SwapForm = ({
1158
967
  )}
1159
968
  <div className={s["swap-form-button-container"]}>
1160
969
  {!termsOfUseUrl || !privacyPolicyUrl ? null : (
1161
- <p
1162
- className={
1163
- s["swap-form-button-container-consent-text"]
1164
- }
1165
- >
970
+ <p className={s["swap-form-button-container-consent-text"]}>
1166
971
  {translations.consents.consentText + " "}
1167
972
  <a
1168
973
  href={termsOfUseUrl}
1169
- className={
1170
- s[
1171
- "swap-form-button-container-consent-text-link"
1172
- ]
1173
- }
974
+ className={s["swap-form-button-container-consent-text-link"]}
1174
975
  target="_blank"
1175
976
  >
1176
977
  {translations.consents.termsOfUse}
@@ -1178,11 +979,7 @@ export const SwapForm = ({
1178
979
  {" " + translations.consents.and + " "}
1179
980
  <a
1180
981
  href={privacyPolicyUrl}
1181
- className={
1182
- s[
1183
- "swap-form-button-container-consent-text-link"
1184
- ]
1185
- }
982
+ className={s["swap-form-button-container-consent-text-link"]}
1186
983
  target="_blank"
1187
984
  >
1188
985
  {translations.consents.privacyPolicy}
@@ -1194,7 +991,7 @@ export const SwapForm = ({
1194
991
  size="lg"
1195
992
  mode="primary"
1196
993
  content={translations.confirmButtonText}
1197
- onClick={(resetButtonLoader) =>
994
+ onClick={resetButtonLoader =>
1198
995
  handleConfirmButtonClick(
1199
996
  resetButtonLoader,
1200
997
  setValidationContent,
@@ -1229,10 +1026,7 @@ SwapForm.propTypes = {
1229
1026
  sendingAssetIconSrc: PropTypes.string.isRequired,
1230
1027
  sendingAssetProtocolIconSrc: PropTypes.oneOfType([PropTypes.string, null]),
1231
1028
  receivingAssetIconSrc: PropTypes.string.isRequired,
1232
- receivingAssetProtocolIconSrc: PropTypes.oneOfType([
1233
- PropTypes.string,
1234
- null,
1235
- ]),
1029
+ receivingAssetProtocolIconSrc: PropTypes.oneOfType([PropTypes.string, null]),
1236
1030
  fallBackAssetIconSrc: PropTypes.oneOfType([PropTypes.string, null]),
1237
1031
  sendingAssetFeeCoinTickerPrintable: PropTypes.string,
1238
1032
  sendingAssetBalance: PropTypes.string,
@@ -1252,16 +1046,8 @@ SwapForm.propTypes = {
1252
1046
  triggerDataUpdateResetting: PropTypes.number,
1253
1047
  fromAssetSelectionButtonRef: PropTypes.any,
1254
1048
  toAssetSelectionButtonRef: PropTypes.any,
1255
- sendingAssetToFiatRate: PropTypes.oneOfType([
1256
- PropTypes.number,
1257
- PropTypes.string,
1258
- null,
1259
- ]),
1260
- receivingAssetToFiatRate: PropTypes.oneOfType([
1261
- PropTypes.number,
1262
- PropTypes.string,
1263
- null,
1264
- ]),
1049
+ sendingAssetToFiatRate: PropTypes.oneOfType([PropTypes.number, PropTypes.string, null]),
1050
+ receivingAssetToFiatRate: PropTypes.oneOfType([PropTypes.number, PropTypes.string, null]),
1265
1051
  fiatCurrencyCode: PropTypes.oneOfType([PropTypes.string, null]),
1266
1052
  fiatCurrencyDecimals: PropTypes.oneOfType([PropTypes.number, null]),
1267
1053
  formHasFiat: PropTypes.bool,
@@ -1286,8 +1072,8 @@ SwapForm.defaultProps = {
1286
1072
  setIsSameCoins
1287
1073
  ) => {},
1288
1074
  composeConfirmButtonTo: (fromTicker, toTicker, fromAmount) => "",
1289
- setSwapCreationEstimation: (details) => {},
1290
- handleUnexpectedError: (error) => {},
1075
+ setSwapCreationEstimation: details => {},
1076
+ handleUnexpectedError: error => {},
1291
1077
  rotateAssets: (fromTicker, toTicker) => {},
1292
1078
  preservedAmount: null,
1293
1079
  handleSwapServiceError: (
@@ -1299,16 +1085,8 @@ SwapForm.defaultProps = {
1299
1085
  setIsPairSupported,
1300
1086
  setIsSameCoins
1301
1087
  ) => {},
1302
- retrieveSwapDetails: async (
1303
- sendingAssetTicker,
1304
- receivingAssetTicker,
1305
- amount,
1306
- isSwapAll = false
1307
- ) => {},
1308
- retrieveInitialSwapData: async (
1309
- sendingAssetTicker,
1310
- receivingAssetTicker
1311
- ) => {},
1088
+ retrieveSwapDetails: async (sendingAssetTicker, receivingAssetTicker, amount, isSwapAll = false) => {},
1089
+ retrieveInitialSwapData: async (sendingAssetTicker, receivingAssetTicker) => {},
1312
1090
  triggerDataUpdateResetting: 0,
1313
1091
  fromAssetSelectionButtonRef: null,
1314
1092
  toAssetSelectionButtonRef: null,