@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.
- package/coverage/clover.xml +6325 -4201
- package/coverage/coverage-final.json +160 -99
- package/coverage/index.html +444 -189
- package/coverage/{rabbit-ui-kit → ui-kit}/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/index.js.html +3 -3
- package/coverage/{rabbit-ui-kit/src/assets/wrappedImages/arrowTosca.jsx.html → ui-kit/src/assets/wrappedImages/arrowIcon.jsx.html} +8 -29
- package/coverage/{rabbit-ui-kit/src/assets/wrappedImages/arrowIcon.jsx.html → ui-kit/src/assets/wrappedImages/arrowTosca.jsx.html} +9 -24
- package/coverage/{rabbit-ui-kit → ui-kit}/src/assets/wrappedImages/arrowWhite.jsx.html +7 -25
- package/coverage/ui-kit/src/assets/wrappedImages/darkRectangle.jsx.html +106 -0
- package/coverage/{rabbit-ui-kit → ui-kit}/src/assets/wrappedImages/determinedError.jsx.html +9 -42
- package/coverage/{rabbit-ui-kit/src/assets/wrappedImages/successfulValidationIcon.jsx.html → ui-kit/src/assets/wrappedImages/failedValidationIcon.jsx.html} +28 -31
- package/coverage/{rabbit-ui-kit → ui-kit}/src/assets/wrappedImages/index.html +25 -25
- package/coverage/{rabbit-ui-kit/src/assets/wrappedImages/darkRectangle.jsx.html → ui-kit/src/assets/wrappedImages/infoIcon.jsx.html} +13 -19
- package/coverage/{rabbit-ui-kit → ui-kit}/src/assets/wrappedImages/noticeQuestionIcon.jsx.html +7 -25
- package/coverage/{rabbit-ui-kit/src/assets/wrappedImages/walletIcon.jsx.html → ui-kit/src/assets/wrappedImages/successfulValidationIcon.jsx.html} +23 -59
- package/coverage/{rabbit-ui-kit/src/assets/wrappedImages/infoIcon.jsx.html → ui-kit/src/assets/wrappedImages/walletIcon.jsx.html} +16 -16
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/adapters/axiosAdapter.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/adapters/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/adapters/qrUtils.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/amountUtils.js.html +44 -308
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/errorUtils.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/external-apis/apiGroups.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/external-apis/index.html +14 -14
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/external-apis/ipAddressProviders.js.html +31 -178
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/fiatCurrenciesService.js.html +12 -36
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/index.html +20 -20
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/models/blockchain.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/models/coin.js.html +10 -22
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/models/index.html +13 -13
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/models/protocol.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/cache.js.html +23 -101
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/emailAPI.js.html +9 -15
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/index.html +19 -19
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/logging/index.html +9 -9
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/logging/logger.js.html +14 -35
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/logging/logsStorage.js.html +5 -5
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/postponeExecution.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/safeStringify.js.html +29 -29
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/AssetIcon/AssetIcon.jsx.html +11 -41
- package/coverage/ui-kit/src/components/atoms/AssetIcon/index.html +116 -0
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/AssetSelection/AssetSelection.jsx.html +9 -33
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/AssetSelection/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/BackgroundTitle/BackgroundTitle.jsx.html +8 -38
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/BackgroundTitle/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/InformationMessage/InformationMessage.jsx.html +8 -38
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/InformationMessage/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Input/Input.jsx.html +15 -63
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Input/index.html +7 -7
- package/coverage/ui-kit/src/components/atoms/LoadingDots/LoadingDots.jsx.html +196 -0
- package/coverage/{rabbit-ui-kit/src/components/atoms/RateSelector → ui-kit/src/components/atoms/LoadingDots}/index.html +4 -4
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/NoticeIcon/NoticeIcon.jsx.html +10 -40
- package/coverage/{rabbit-ui-kit/src/components/atoms/AssetIcon → ui-kit/src/components/atoms/NoticeIcon}/index.html +4 -4
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/QrCode/QrCode.jsx.html +8 -26
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/QrCode/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/RateSelector/RateSelector.jsx.html +10 -34
- package/coverage/ui-kit/src/components/atoms/RateSelector/index.html +116 -0
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/SupportChat/SupportChat.jsx.html +7 -22
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/SupportChat/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Textarea/Textarea.jsx.html +17 -53
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Textarea/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/TitleBox/TitleBox.jsx.html +13 -82
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/TitleBox/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Tooltip/Tooltip.jsx.html +12 -18
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Tooltip/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/TwoLinesOfText/LinesOfText.jsx.html +12 -30
- package/coverage/{rabbit-ui-kit/src/components/atoms/NoticeIcon → ui-kit/src/components/atoms/TwoLinesOfText}/index.html +4 -4
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Validation/Validation.jsx.html +19 -13
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Validation/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/Button/Button.jsx.html +23 -113
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/Button/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/Close/Close.jsx.html +9 -27
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/Close/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/LinkButton/LinkButton.jsx.html +11 -38
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/LinkButton/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx.html +13 -67
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/RadioButtonWithText/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/hooks/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/hooks/useCallHandlingErrors.js.html +7 -19
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/hooks/useReferredState.js.html +4 -4
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/AmountInput/AmountInput.jsx.html +56 -407
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/AmountInput/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/CoinPicker/CoinPicker.jsx.html +67 -466
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/CoinPicker/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/LineWithIconLink/LineWithIconLink.jsx.html +7 -22
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/LineWithIconLink/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/TitledLineWithIconLink/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx.html +9 -15
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/CoinPickerDialogStep/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/Dialog/Dialog.jsx.html +44 -194
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/Dialog/DialogButtons/DialogButtons.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/Dialog/DialogButtons/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/Dialog/DialogStep/DialogStep.jsx.html +63 -525
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/Dialog/DialogStep/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/Dialog/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/SwapForm/SwapForm.jsx.html +145 -670
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/SwapForm/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/templates/DeterminedErrorDialogStep/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/utils/index.html +20 -20
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/utils/inputValueProviders.js.html +11 -35
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/utils/textUtils.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/utils/uiUtils.js.html +7 -13
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/utils/urlQueryUtils.js.html +18 -93
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/atoms/Close/close.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/atoms/Close/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/atoms/LinkButton/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/atoms/LinkButton/linkButton.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/atoms/Tooltip/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/atoms/Tooltip/tooltip.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/globalConstants.jsx.html +7 -10
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/organisms/dialog/DialogStep/dialogStep.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/organisms/dialog/DialogStep/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/organisms/dialog/dialog.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/organisms/dialog/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/index.js.html +8 -26
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/cacheAndConcurrentRequestsResolver.js.html +30 -222
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/cachedRobustExternalApiCallerService.js.html +24 -147
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/cancelProcessing.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/concurrentCalculationsMetadataHolder.js.html +19 -103
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/externalApiProvider.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/externalServicesStatsCollector.js.html +11 -23
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/index.html +38 -38
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/robustExternalAPICallerService.js.html +53 -305
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/external-apis/index.html +24 -24
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/external-apis/swapProvider.js.html +10 -28
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/external-apis/swapspaceSwapProvider.js.html +277 -1009
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/baseSwapCreationInfo.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/existingSwap.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/existingSwapWithFiatData.js.html +9 -27
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/index.html +13 -13
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/services/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/services/publicSwapService.js.html +53 -374
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/utils/index.html +13 -13
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/utils/swapUtils.js.html +32 -179
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/BackgroundTitle.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/LinesOfText.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/LoadingDots.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/QrCode.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/RateSelector.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/Validation.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/buttons/Button.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/buttons/Close.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/buttons/LinkButton.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/buttons/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/molecules/LineWithIconLink.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/molecules/TitledLineWithIconLink.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/molecules/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/Dialog.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/DialogButtons/DialogButtons.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/DialogButtons/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/DialogStep/DialogStep.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/DialogStep/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/stubs/exampleContent.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/stubs/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/templates/DeterminedErrorDialogStep.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/templates/index.html +3 -3
- package/dist/index.cjs +65 -49
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +5 -2
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +43 -28
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +65 -49
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +65 -49
- package/dist/index.umd.js.map +1 -1
- package/package.json +5 -3
- package/src/assets/wrappedImages/arrowIcon.jsx +1 -7
- package/src/assets/wrappedImages/arrowTosca.jsx +1 -7
- package/src/assets/wrappedImages/arrowWhite.jsx +1 -7
- package/src/assets/wrappedImages/darkRectangle.jsx +2 -13
- package/src/assets/wrappedImages/determinedError.jsx +2 -13
- package/src/assets/wrappedImages/failedValidationIcon.jsx +2 -16
- package/src/assets/wrappedImages/infoIcon.jsx +1 -7
- package/src/assets/wrappedImages/noticeQuestionIcon.jsx +1 -7
- package/src/assets/wrappedImages/successfulValidationIcon.jsx +2 -16
- package/src/assets/wrappedImages/walletIcon.jsx +3 -19
- package/src/common/amountUtils.js +36 -124
- package/src/common/external-apis/ipAddressProviders.js +22 -71
- package/src/common/fiatCurrenciesService.js +4 -12
- package/src/common/models/coin.js +2 -6
- package/src/common/tests/amountUtils/composeRateText.test.js +12 -69
- package/src/common/tests/integration/external-apis/ipAddressProviders/getClientIpAddress.test.js +1 -3
- package/src/common/utils/cache.js +10 -36
- package/src/common/utils/emailAPI.js +1 -3
- package/src/common/utils/logging/logger.js +5 -12
- package/src/components/atoms/AssetIcon/AssetIcon.jsx +4 -14
- package/src/components/atoms/AssetSelection/AssetSelection.jsx +3 -11
- package/src/components/atoms/BackgroundTitle/BackgroundTitle.jsx +2 -12
- package/src/components/atoms/InformationMessage/InformationMessage.jsx +2 -12
- package/src/components/atoms/InformationMessage/information-message.module.scss +4 -2
- package/src/components/atoms/Input/Input.jsx +9 -25
- package/src/components/atoms/LoadingDots/LoadingDots.jsx +8 -28
- package/src/components/atoms/NoticeIcon/NoticeIcon.jsx +4 -14
- package/src/components/atoms/QrCode/QrCode.jsx +2 -8
- package/src/components/atoms/RateSelector/RateSelector.jsx +4 -12
- package/src/components/atoms/SupportChat/SupportChat.jsx +1 -6
- package/src/components/atoms/Textarea/Textarea.jsx +11 -23
- package/src/components/atoms/TitleBox/TitleBox.jsx +7 -30
- package/src/components/atoms/TitleBox/title-box.module.scss +2 -0
- package/src/components/atoms/Tooltip/Tooltip.jsx +6 -8
- package/src/components/atoms/TwoLinesOfText/LinesOfText.jsx +5 -11
- package/src/components/atoms/Validation/Validation.jsx +9 -7
- package/src/components/atoms/buttons/Button/Button.jsx +17 -47
- package/src/components/atoms/buttons/Close/Close.jsx +3 -9
- package/src/components/atoms/buttons/LinkButton/LinkButton.jsx +5 -14
- package/src/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx +7 -25
- package/src/components/hooks/useCallHandlingErrors.js +1 -5
- package/src/components/hooks/useReferredState.js +1 -1
- package/src/components/molecules/AmountInput/AmountInput.jsx +50 -167
- package/src/components/molecules/CoinPicker/CoinPicker.jsx +61 -194
- package/src/components/molecules/CoinPicker/coin-picker.module.scss +1 -4
- package/src/components/molecules/LineWithIconLink/LineWithIconLink.jsx +1 -6
- package/src/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx +3 -5
- package/src/components/organisms/Dialog/Dialog.jsx +38 -88
- package/src/components/organisms/Dialog/DialogStep/DialogStep.jsx +57 -211
- package/src/components/organisms/Dialog/DialogStep/dialog-step.module.scss +2 -4
- package/src/components/organisms/SwapForm/SwapForm.jsx +139 -314
- package/src/components/tests/utils/inputValueProviders/provideFormatOfFloatValueByInputString.test.js +5 -12
- package/src/components/tests/utils/urlQueryUtils/getQueryParameterValues.test.js +3 -9
- package/src/components/tests/utils/urlQueryUtils/saveQueryParameterAndValues.test.js +11 -51
- package/src/components/utils/inputValueProviders.js +3 -11
- package/src/components/utils/uiUtils.js +1 -3
- package/src/components/utils/urlQueryUtils.js +10 -35
- package/src/constants/globalConstants.jsx +1 -2
- package/src/index.js +2 -8
- package/src/robustExteranlApiCallerService/cacheAndConcurrentRequestsResolver.js +22 -86
- package/src/robustExteranlApiCallerService/cachedRobustExternalApiCallerService.js +15 -56
- package/src/robustExteranlApiCallerService/concurrentCalculationsMetadataHolder.js +11 -39
- package/src/robustExteranlApiCallerService/externalServicesStatsCollector.js +3 -7
- package/src/robustExteranlApiCallerService/robustExternalAPICallerService.js +45 -129
- package/src/robustExteranlApiCallerService/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/_performCallAttempt.test.js +76 -330
- package/src/robustExteranlApiCallerService/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/callExternalAPI.test.js +57 -270
- package/src/robustExteranlApiCallerService/tests/robustExternalAPICallerService/robustExternalAPICallerService/constructor.test.js +3 -15
- package/src/swaps-lib/external-apis/swapProvider.js +1 -7
- package/src/swaps-lib/external-apis/swapspaceSwapProvider.js +117 -361
- package/src/swaps-lib/models/existingSwapWithFiatData.js +1 -7
- package/src/swaps-lib/services/publicSwapService.js +47 -154
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +33 -118
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/createSwap.test.js +23 -85
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getAllSupportedCurrencies.test.js +4 -14
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getDepositCurrencies.test.js +3 -9
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getSwapInfo.test.js +148 -460
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getWithdrawalCurrencies.test.js +5 -11
- package/src/swaps-lib/test/utils/swapUtils/safeHandleRequestsLimitExceeding.test.js +2 -10
- package/src/swaps-lib/utils/swapUtils.js +24 -73
- package/coverage/rabbit-ui-kit/src/assets/wrappedImages/failedValidationIcon.jsx.html +0 -244
- package/coverage/rabbit-ui-kit/src/components/atoms/LoadingDots/LoadingDots.jsx.html +0 -256
- package/coverage/rabbit-ui-kit/src/components/atoms/LoadingDots/index.html +0 -116
- package/coverage/rabbit-ui-kit/src/components/atoms/TwoLinesOfText/index.html +0 -116
|
@@ -95,13 +95,7 @@ export class ExistingSwapWithFiatData extends ExistingSwap {
|
|
|
95
95
|
* @param fiatCurrencyDecimals {number}
|
|
96
96
|
* @return {ExistingSwapWithFiatData}
|
|
97
97
|
*/
|
|
98
|
-
static fromExistingSwap(
|
|
99
|
-
existingSwap,
|
|
100
|
-
fromAmountFiat,
|
|
101
|
-
toAmountFiat,
|
|
102
|
-
fiatCurrencyCode,
|
|
103
|
-
fiatCurrencyDecimals
|
|
104
|
-
) {
|
|
98
|
+
static fromExistingSwap(existingSwap, fromAmountFiat, toAmountFiat, fiatCurrencyCode, fiatCurrencyDecimals) {
|
|
105
99
|
return new ExistingSwapWithFiatData(
|
|
106
100
|
existingSwap.swapId,
|
|
107
101
|
existingSwap.status,
|
|
@@ -23,22 +23,14 @@ export class PublicSwapService {
|
|
|
23
23
|
AMOUNT_LESS_THAN_MIN_SWAPPABLE: "amountLessThanMinSwappable",
|
|
24
24
|
AMOUNT_HIGHER_THAN_MAX_SWAPPABLE: "amountHigherThanMaxSwappable",
|
|
25
25
|
PAIR_NOT_SUPPORTED: "pairNotSupported",
|
|
26
|
-
NO_FIXED_BUT_HAVE_FLOATING_PUBLIC_SWAP_OPTION:
|
|
27
|
-
|
|
28
|
-
NO_FLOATING_BUT_HAVE_FIXED_PUBLIC_SWAP_OPTION:
|
|
29
|
-
"noFloatingButHaveFixedPublicSwapOption",
|
|
26
|
+
NO_FIXED_BUT_HAVE_FLOATING_PUBLIC_SWAP_OPTION: "noFixedButHaveFloatingPublicSwapOption",
|
|
27
|
+
NO_FLOATING_BUT_HAVE_FIXED_PUBLIC_SWAP_OPTION: "noFloatingButHaveFixedPublicSwapOption",
|
|
30
28
|
};
|
|
31
29
|
|
|
32
|
-
static _fiatDecimalsCount =
|
|
33
|
-
FiatCurrenciesService.getCurrencyDecimalCountByCode("USD");
|
|
30
|
+
static _fiatDecimalsCount = FiatCurrenciesService.getCurrencyDecimalCountByCode("USD");
|
|
34
31
|
|
|
35
32
|
constructor(apiKeysProxyUrl, cache) {
|
|
36
|
-
this._swapProvider = new SwapspaceSwapProvider(
|
|
37
|
-
apiKeysProxyUrl,
|
|
38
|
-
cache,
|
|
39
|
-
() => null,
|
|
40
|
-
false
|
|
41
|
-
);
|
|
33
|
+
this._swapProvider = new SwapspaceSwapProvider(apiKeysProxyUrl, cache, () => null, false);
|
|
42
34
|
}
|
|
43
35
|
|
|
44
36
|
async initialize() {
|
|
@@ -53,21 +45,14 @@ export class PublicSwapService {
|
|
|
53
45
|
const loggerSource = "getAllSupportedCurrenciesListForPublicSwap";
|
|
54
46
|
try {
|
|
55
47
|
const result = await this._swapProvider.getAllSupportedCurrencies();
|
|
56
|
-
if (
|
|
57
|
-
result.reason ===
|
|
58
|
-
SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
59
|
-
) {
|
|
48
|
+
if (result.reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) {
|
|
60
49
|
SwapUtils.safeHandleRequestsLimitExceeding();
|
|
61
50
|
return {
|
|
62
51
|
result: false,
|
|
63
|
-
reason: PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS
|
|
64
|
-
.REQUESTS_LIMIT_EXCEEDED,
|
|
52
|
+
reason: PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED,
|
|
65
53
|
};
|
|
66
54
|
}
|
|
67
|
-
Logger.log(
|
|
68
|
-
`Retrieved ${result?.coins?.length} supported currencies for swap`,
|
|
69
|
-
loggerSource
|
|
70
|
-
);
|
|
55
|
+
Logger.log(`Retrieved ${result?.coins?.length} supported currencies for swap`, loggerSource);
|
|
71
56
|
return { result: true, coins: result.coins };
|
|
72
57
|
} catch (e) {
|
|
73
58
|
improveAndRethrow(e, "getDepositCurrenciesListForPublicSwap");
|
|
@@ -96,15 +81,11 @@ export class PublicSwapService {
|
|
|
96
81
|
const result = withdraw
|
|
97
82
|
? await this._swapProvider.getWithdrawalCurrencies()
|
|
98
83
|
: await this._swapProvider.getDepositCurrencies();
|
|
99
|
-
if (
|
|
100
|
-
result.reason ===
|
|
101
|
-
SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
102
|
-
) {
|
|
84
|
+
if (result.reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) {
|
|
103
85
|
SwapUtils.safeHandleRequestsLimitExceeding();
|
|
104
86
|
return {
|
|
105
87
|
result: false,
|
|
106
|
-
reason: PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS
|
|
107
|
-
.REQUESTS_LIMIT_EXCEEDED,
|
|
88
|
+
reason: PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED,
|
|
108
89
|
};
|
|
109
90
|
}
|
|
110
91
|
Logger.log(
|
|
@@ -136,32 +117,19 @@ export class PublicSwapService {
|
|
|
136
117
|
*/
|
|
137
118
|
async getInitialPublicSwapData(fromCoin, toCoin) {
|
|
138
119
|
try {
|
|
139
|
-
const result = await SwapUtils.getInitialSwapData(
|
|
140
|
-
this._swapProvider,
|
|
141
|
-
fromCoin,
|
|
142
|
-
toCoin
|
|
143
|
-
);
|
|
120
|
+
const result = await SwapUtils.getInitialSwapData(this._swapProvider, fromCoin, toCoin);
|
|
144
121
|
if (!result.result) {
|
|
145
|
-
if (
|
|
146
|
-
result.reason ===
|
|
147
|
-
SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
148
|
-
) {
|
|
122
|
+
if (result.reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) {
|
|
149
123
|
SwapUtils.safeHandleRequestsLimitExceeding();
|
|
150
124
|
return {
|
|
151
125
|
result: false,
|
|
152
|
-
reason: PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS
|
|
153
|
-
.REQUESTS_LIMIT_EXCEEDED,
|
|
126
|
+
reason: PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED,
|
|
154
127
|
};
|
|
155
128
|
}
|
|
156
|
-
if (
|
|
157
|
-
result.reason ===
|
|
158
|
-
SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED
|
|
159
|
-
) {
|
|
129
|
+
if (result.reason === SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED) {
|
|
160
130
|
return {
|
|
161
131
|
result: false,
|
|
162
|
-
reason: PublicSwapService
|
|
163
|
-
.PUBLIC_SWAP_DETAILS_FAIL_REASONS
|
|
164
|
-
.PAIR_NOT_SUPPORTED,
|
|
132
|
+
reason: PublicSwapService.PUBLIC_SWAP_DETAILS_FAIL_REASONS.PAIR_NOT_SUPPORTED,
|
|
165
133
|
};
|
|
166
134
|
}
|
|
167
135
|
}
|
|
@@ -192,19 +160,12 @@ export class PublicSwapService {
|
|
|
192
160
|
* swapCreationInfo: BaseSwapCreationInfo
|
|
193
161
|
* }>}
|
|
194
162
|
*/
|
|
195
|
-
async getPublicSwapDetails(
|
|
196
|
-
fromCoin,
|
|
197
|
-
toCoin,
|
|
198
|
-
fromAmountCoins,
|
|
199
|
-
fixed = false,
|
|
200
|
-
withoutFiat = false
|
|
201
|
-
) {
|
|
163
|
+
async getPublicSwapDetails(fromCoin, toCoin, fromAmountCoins, fixed = false, withoutFiat = false) {
|
|
202
164
|
const loggerSource = "getPublicSwapDetails";
|
|
203
165
|
try {
|
|
204
166
|
const coinUsdtRate = withoutFiat
|
|
205
167
|
? null
|
|
206
|
-
: (await this._swapProvider.getCoinToUSDTRate(fromCoin))
|
|
207
|
-
?.rate ?? null;
|
|
168
|
+
: (await this._swapProvider.getCoinToUSDTRate(fromCoin))?.rate ?? null;
|
|
208
169
|
const details = await this._swapProvider.getSwapInfo(
|
|
209
170
|
fromCoin,
|
|
210
171
|
toCoin,
|
|
@@ -218,18 +179,14 @@ export class PublicSwapService {
|
|
|
218
179
|
fiatMax = null;
|
|
219
180
|
if (coinUsdtRate != null) {
|
|
220
181
|
if (min != null) {
|
|
221
|
-
fiatMin = BigNumber(min)
|
|
222
|
-
.times(coinUsdtRate)
|
|
223
|
-
.toFixed(PublicSwapService._fiatDecimalsCount);
|
|
182
|
+
fiatMin = BigNumber(min).times(coinUsdtRate).toFixed(PublicSwapService._fiatDecimalsCount);
|
|
224
183
|
}
|
|
225
184
|
if (max != null) {
|
|
226
|
-
fiatMax = BigNumber(max)
|
|
227
|
-
.times(coinUsdtRate)
|
|
228
|
-
.toFixed(PublicSwapService._fiatDecimalsCount);
|
|
185
|
+
fiatMax = BigNumber(max).times(coinUsdtRate).toFixed(PublicSwapService._fiatDecimalsCount);
|
|
229
186
|
}
|
|
230
187
|
}
|
|
231
188
|
|
|
232
|
-
const composeFailResult =
|
|
189
|
+
const composeFailResult = reason => ({
|
|
233
190
|
result: false,
|
|
234
191
|
reason: reason,
|
|
235
192
|
min: min ?? null,
|
|
@@ -240,38 +197,18 @@ export class PublicSwapService {
|
|
|
240
197
|
});
|
|
241
198
|
|
|
242
199
|
if (!details.result) {
|
|
243
|
-
if (
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
) {
|
|
247
|
-
return composeFailResult(
|
|
248
|
-
PublicSwapService.PUBLIC_SWAP_DETAILS_FAIL_REASONS
|
|
249
|
-
.PAIR_NOT_SUPPORTED
|
|
250
|
-
);
|
|
251
|
-
} else if (
|
|
252
|
-
details?.reason ===
|
|
253
|
-
SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
254
|
-
) {
|
|
200
|
+
if (details?.reason === SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED) {
|
|
201
|
+
return composeFailResult(PublicSwapService.PUBLIC_SWAP_DETAILS_FAIL_REASONS.PAIR_NOT_SUPPORTED);
|
|
202
|
+
} else if (details?.reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) {
|
|
255
203
|
SwapUtils.safeHandleRequestsLimitExceeding();
|
|
204
|
+
return composeFailResult(PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED);
|
|
205
|
+
} else if (details?.reason === SwapProvider.NO_SWAPS_REASONS.NO_FLOATING_BUT_HAVE_FIXED) {
|
|
256
206
|
return composeFailResult(
|
|
257
|
-
PublicSwapService.
|
|
258
|
-
.REQUESTS_LIMIT_EXCEEDED
|
|
207
|
+
PublicSwapService.PUBLIC_SWAP_DETAILS_FAIL_REASONS.NO_FLOATING_BUT_HAVE_FIXED_PUBLIC_SWAP_OPTION
|
|
259
208
|
);
|
|
260
|
-
} else if (
|
|
261
|
-
details?.reason ===
|
|
262
|
-
SwapProvider.NO_SWAPS_REASONS.NO_FLOATING_BUT_HAVE_FIXED
|
|
263
|
-
) {
|
|
209
|
+
} else if (details?.reason === SwapProvider.NO_SWAPS_REASONS.NO_FIXED_BUT_HAVE_FLOATING) {
|
|
264
210
|
return composeFailResult(
|
|
265
|
-
PublicSwapService.PUBLIC_SWAP_DETAILS_FAIL_REASONS
|
|
266
|
-
.NO_FLOATING_BUT_HAVE_FIXED_PUBLIC_SWAP_OPTION
|
|
267
|
-
);
|
|
268
|
-
} else if (
|
|
269
|
-
details?.reason ===
|
|
270
|
-
SwapProvider.NO_SWAPS_REASONS.NO_FIXED_BUT_HAVE_FLOATING
|
|
271
|
-
) {
|
|
272
|
-
return composeFailResult(
|
|
273
|
-
PublicSwapService.PUBLIC_SWAP_DETAILS_FAIL_REASONS
|
|
274
|
-
.NO_FIXED_BUT_HAVE_FLOATING_PUBLIC_SWAP_OPTION
|
|
211
|
+
PublicSwapService.PUBLIC_SWAP_DETAILS_FAIL_REASONS.NO_FIXED_BUT_HAVE_FLOATING_PUBLIC_SWAP_OPTION
|
|
275
212
|
);
|
|
276
213
|
}
|
|
277
214
|
}
|
|
@@ -279,20 +216,15 @@ export class PublicSwapService {
|
|
|
279
216
|
const fromAmountBigNumber = BigNumber(fromAmountCoins);
|
|
280
217
|
if (typeof min === "string" && fromAmountBigNumber.lt(min)) {
|
|
281
218
|
return composeFailResult(
|
|
282
|
-
PublicSwapService.PUBLIC_SWAP_DETAILS_FAIL_REASONS
|
|
283
|
-
.AMOUNT_LESS_THAN_MIN_SWAPPABLE
|
|
219
|
+
PublicSwapService.PUBLIC_SWAP_DETAILS_FAIL_REASONS.AMOUNT_LESS_THAN_MIN_SWAPPABLE
|
|
284
220
|
);
|
|
285
221
|
} else if (typeof max === "string" && fromAmountBigNumber.gt(max)) {
|
|
286
222
|
return composeFailResult(
|
|
287
|
-
PublicSwapService.PUBLIC_SWAP_DETAILS_FAIL_REASONS
|
|
288
|
-
.AMOUNT_HIGHER_THAN_MAX_SWAPPABLE
|
|
223
|
+
PublicSwapService.PUBLIC_SWAP_DETAILS_FAIL_REASONS.AMOUNT_HIGHER_THAN_MAX_SWAPPABLE
|
|
289
224
|
);
|
|
290
225
|
}
|
|
291
226
|
|
|
292
|
-
const toAmountCoins = AmountUtils.trim(
|
|
293
|
-
fromAmountBigNumber.times(details.rate),
|
|
294
|
-
fromCoin.digits
|
|
295
|
-
);
|
|
227
|
+
const toAmountCoins = AmountUtils.trim(fromAmountBigNumber.times(details.rate), fromCoin.digits);
|
|
296
228
|
const result = {
|
|
297
229
|
result: true,
|
|
298
230
|
swapCreationInfo: new BaseSwapCreationInfo(
|
|
@@ -382,14 +314,10 @@ export class PublicSwapService {
|
|
|
382
314
|
typeof refundAddress !== "string" ||
|
|
383
315
|
!(swapCreationInfo instanceof BaseSwapCreationInfo)
|
|
384
316
|
) {
|
|
385
|
-
throw new Error(
|
|
386
|
-
`Wrong input: ${fromCoin.ticker} ${toCoin.ticker} ${fromAmount} ${swapCreationInfo}`
|
|
387
|
-
);
|
|
317
|
+
throw new Error(`Wrong input: ${fromCoin.ticker} ${toCoin.ticker} ${fromAmount} ${swapCreationInfo}`);
|
|
388
318
|
}
|
|
389
319
|
Logger.log(
|
|
390
|
-
`Start: ${fromAmount} ${fromCoin.ticker} -> ${
|
|
391
|
-
toCoin.ticker
|
|
392
|
-
}. Details: ${safeStringify({
|
|
320
|
+
`Start: ${fromAmount} ${fromCoin.ticker} -> ${toCoin.ticker}. Details: ${safeStringify({
|
|
393
321
|
...swapCreationInfo,
|
|
394
322
|
fromCoin: swapCreationInfo?.fromCoin?.ticker,
|
|
395
323
|
toCoin: swapCreationInfo?.toCoin?.ticker,
|
|
@@ -418,21 +346,14 @@ export class PublicSwapService {
|
|
|
418
346
|
loggerSource
|
|
419
347
|
);
|
|
420
348
|
if (!result?.result) {
|
|
421
|
-
if (
|
|
422
|
-
result?.reason ===
|
|
423
|
-
SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
424
|
-
) {
|
|
349
|
+
if (result?.reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) {
|
|
425
350
|
SwapUtils.safeHandleRequestsLimitExceeding();
|
|
426
351
|
return {
|
|
427
352
|
result: false,
|
|
428
|
-
reason: PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS
|
|
429
|
-
.REQUESTS_LIMIT_EXCEEDED,
|
|
353
|
+
reason: PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED,
|
|
430
354
|
};
|
|
431
355
|
}
|
|
432
|
-
if (
|
|
433
|
-
result?.reason ===
|
|
434
|
-
SwapProvider.CREATION_FAIL_REASONS.RETRIABLE_FAIL
|
|
435
|
-
) {
|
|
356
|
+
if (result?.reason === SwapProvider.CREATION_FAIL_REASONS.RETRIABLE_FAIL) {
|
|
436
357
|
// TODO: [feature, high] implement retrying if one partner fail and we have another partners task_id=a07e367e488f4a4899613ac9056fa359
|
|
437
358
|
// return {
|
|
438
359
|
// result: false,
|
|
@@ -444,12 +365,8 @@ export class PublicSwapService {
|
|
|
444
365
|
let fromAmountFiat = null,
|
|
445
366
|
toAmountFiat = null;
|
|
446
367
|
try {
|
|
447
|
-
const fromCoinUsdtRate =
|
|
448
|
-
|
|
449
|
-
?.rate ?? null;
|
|
450
|
-
const toCoinUsdtRate =
|
|
451
|
-
(await this._swapProvider.getCoinToUSDTRate(fromCoin))
|
|
452
|
-
?.rate ?? null;
|
|
368
|
+
const fromCoinUsdtRate = (await this._swapProvider.getCoinToUSDTRate(fromCoin))?.rate ?? null;
|
|
369
|
+
const toCoinUsdtRate = (await this._swapProvider.getCoinToUSDTRate(fromCoin))?.rate ?? null;
|
|
453
370
|
if (fromCoinUsdtRate != null && result.fromAmount != null) {
|
|
454
371
|
fromAmountFiat = BigNumber(result.fromAmount)
|
|
455
372
|
.times(fromCoinUsdtRate)
|
|
@@ -461,11 +378,7 @@ export class PublicSwapService {
|
|
|
461
378
|
.toFixed(PublicSwapService._fiatDecimalsCount);
|
|
462
379
|
}
|
|
463
380
|
} catch (e) {
|
|
464
|
-
Logger.logError(
|
|
465
|
-
e,
|
|
466
|
-
loggerSource,
|
|
467
|
-
"Failed to calculate fiat amounts for result"
|
|
468
|
-
);
|
|
381
|
+
Logger.logError(e, loggerSource, "Failed to calculate fiat amounts for result");
|
|
469
382
|
}
|
|
470
383
|
|
|
471
384
|
// TODO: feature, cirtical] add GA event. task_id=tbd
|
|
@@ -508,9 +421,7 @@ export class PublicSwapService {
|
|
|
508
421
|
return toReturn;
|
|
509
422
|
}
|
|
510
423
|
|
|
511
|
-
throw new Error(
|
|
512
|
-
`Unexpected result from provider ${safeStringify(result)}`
|
|
513
|
-
);
|
|
424
|
+
throw new Error(`Unexpected result from provider ${safeStringify(result)}`);
|
|
514
425
|
} catch (e) {
|
|
515
426
|
improveAndRethrow(e, loggerSource);
|
|
516
427
|
}
|
|
@@ -532,21 +443,13 @@ export class PublicSwapService {
|
|
|
532
443
|
async getPublicExistingSwapDetailsAndStatus(swapIds) {
|
|
533
444
|
const loggerSource = "getPublicExistingSwapDetailsAndStatus";
|
|
534
445
|
try {
|
|
535
|
-
const result =
|
|
536
|
-
await SwapUtils.getExistingSwapsDetailsWithFiatAmounts(
|
|
537
|
-
this._swapProvider,
|
|
538
|
-
swapIds
|
|
539
|
-
);
|
|
446
|
+
const result = await SwapUtils.getExistingSwapsDetailsWithFiatAmounts(this._swapProvider, swapIds);
|
|
540
447
|
if (!result?.result) {
|
|
541
|
-
if (
|
|
542
|
-
result.reason ===
|
|
543
|
-
SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
544
|
-
) {
|
|
448
|
+
if (result.reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) {
|
|
545
449
|
SwapUtils.safeHandleRequestsLimitExceeding();
|
|
546
450
|
return {
|
|
547
451
|
result: false,
|
|
548
|
-
reason: PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS
|
|
549
|
-
.REQUESTS_LIMIT_EXCEEDED,
|
|
452
|
+
reason: PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED,
|
|
550
453
|
};
|
|
551
454
|
}
|
|
552
455
|
throw new Error("Unknown reason: " + result?.reason);
|
|
@@ -573,9 +476,7 @@ export class PublicSwapService {
|
|
|
573
476
|
try {
|
|
574
477
|
const swapIds = this._getPublicSwapIdsSavedLocally();
|
|
575
478
|
if (swapIds.length) {
|
|
576
|
-
return await this.getPublicExistingSwapDetailsAndStatus(
|
|
577
|
-
swapIds
|
|
578
|
-
);
|
|
479
|
+
return await this.getPublicExistingSwapDetailsAndStatus(swapIds);
|
|
579
480
|
}
|
|
580
481
|
return { result: true, swaps: [] };
|
|
581
482
|
} catch (e) {
|
|
@@ -591,10 +492,7 @@ export class PublicSwapService {
|
|
|
591
492
|
if (typeof window !== "undefined") {
|
|
592
493
|
try {
|
|
593
494
|
const saved = localStorage.getItem("publicSwapIds");
|
|
594
|
-
const ids =
|
|
595
|
-
typeof saved === "string" && saved.length > 0
|
|
596
|
-
? saved.split(",")
|
|
597
|
-
: [];
|
|
495
|
+
const ids = typeof saved === "string" && saved.length > 0 ? saved.split(",") : [];
|
|
598
496
|
ids.push(swapId);
|
|
599
497
|
localStorage.setItem("publicSwapIds", ids.join(","));
|
|
600
498
|
} catch (e) {
|
|
@@ -611,9 +509,7 @@ export class PublicSwapService {
|
|
|
611
509
|
if (typeof window !== "undefined") {
|
|
612
510
|
try {
|
|
613
511
|
const saved = localStorage.getItem("publicSwapIds");
|
|
614
|
-
return typeof saved === "string" && saved.length > 0
|
|
615
|
-
? saved.split(",")
|
|
616
|
-
: [];
|
|
512
|
+
return typeof saved === "string" && saved.length > 0 ? saved.split(",") : [];
|
|
617
513
|
} catch (e) {
|
|
618
514
|
improveAndRethrow(e, "_getPublicSwapIdsSavedLocally");
|
|
619
515
|
}
|
|
@@ -673,13 +569,10 @@ export class PublicSwapService {
|
|
|
673
569
|
try {
|
|
674
570
|
if (!addressString) return null;
|
|
675
571
|
const addressLowerCase = addressString.toLowerCase();
|
|
676
|
-
const allCoins =
|
|
677
|
-
await this._swapProvider.getAllSupportedCurrencies();
|
|
572
|
+
const allCoins = await this._swapProvider.getAllSupportedCurrencies();
|
|
678
573
|
if (allCoins.result) {
|
|
679
574
|
return allCoins.coins.find(
|
|
680
|
-
(
|
|
681
|
-
coin.tokenAddress &&
|
|
682
|
-
coin.tokenAddress.toLowerCase() === addressLowerCase
|
|
575
|
+
coin => coin.tokenAddress && coin.tokenAddress.toLowerCase() === addressLowerCase
|
|
683
576
|
);
|
|
684
577
|
}
|
|
685
578
|
} catch (e) {
|