@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.
- package/coverage/clover.xml +6311 -4236
- package/coverage/coverage-final.json +160 -99
- package/coverage/index.html +442 -187
- 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 +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Validation/index.html +3 -3
- 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 +61 -523
- 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 +96 -762
- 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 +12 -14
- 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 +12 -13
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +12 -14
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +12 -14
- 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/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 +55 -209
- package/src/components/organisms/Dialog/DialogStep/dialog-step.module.scss +2 -4
- package/src/components/organisms/SwapForm/SwapForm.jsx +90 -312
- 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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rabbitio/ui-kit",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.66",
|
|
4
4
|
"description": "Rabbit.io react.js components kit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
"storybook": "storybook dev -p 6006",
|
|
22
22
|
"build-storybook": "storybook build",
|
|
23
23
|
"test-watching": "vitest",
|
|
24
|
-
"test": "vitest run --coverage"
|
|
24
|
+
"test": "vitest run --coverage",
|
|
25
|
+
"format": "prettier --write 'src/**/*.{js,jsx,ts,tsx,json,css,scss,sass,txt,md}'"
|
|
25
26
|
},
|
|
26
27
|
"keywords": [
|
|
27
28
|
"rabbit.io",
|
|
@@ -88,6 +89,7 @@
|
|
|
88
89
|
"trailingComma": "es5",
|
|
89
90
|
"tabWidth": 4,
|
|
90
91
|
"singleQuote": false,
|
|
91
|
-
"printWidth":
|
|
92
|
+
"printWidth": 120,
|
|
93
|
+
"arrowParens": "avoid"
|
|
92
94
|
}
|
|
93
95
|
}
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
export default () => (
|
|
4
|
-
<svg
|
|
5
|
-
width="16"
|
|
6
|
-
height="16"
|
|
7
|
-
viewBox="0 0 16 16"
|
|
8
|
-
fill="none"
|
|
9
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
10
|
-
>
|
|
4
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
11
5
|
<path
|
|
12
6
|
d="M12.2431 6L8.00045 10.2426L3.75781 6"
|
|
13
7
|
stroke="#232d42"
|
|
@@ -2,13 +2,7 @@ import React from "react";
|
|
|
2
2
|
|
|
3
3
|
// Originally: arrow-tosca.svg
|
|
4
4
|
export default () => (
|
|
5
|
-
<svg
|
|
6
|
-
width="16"
|
|
7
|
-
height="16"
|
|
8
|
-
viewBox="0 0 16 16"
|
|
9
|
-
fill="none"
|
|
10
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
-
>
|
|
5
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
12
6
|
<path
|
|
13
7
|
d="M12.2431 6L8.00045 10.2426L3.75781 6"
|
|
14
8
|
stroke="#16CDD6"
|
|
@@ -2,13 +2,7 @@ import React from "react";
|
|
|
2
2
|
|
|
3
3
|
// Originally: arrow-tosca.svg
|
|
4
4
|
export default () => (
|
|
5
|
-
<svg
|
|
6
|
-
width="16"
|
|
7
|
-
height="16"
|
|
8
|
-
viewBox="0 0 16 16"
|
|
9
|
-
fill="none"
|
|
10
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
-
>
|
|
5
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
12
6
|
<path
|
|
13
7
|
d="M12.2431 6L8.00045 10.2426L3.75781 6"
|
|
14
8
|
stroke="#fff"
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
export default () => (
|
|
4
|
-
<svg
|
|
5
|
-
|
|
6
|
-
height="13"
|
|
7
|
-
viewBox="0 0 25 13"
|
|
8
|
-
fill="none"
|
|
9
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
10
|
-
>
|
|
11
|
-
<path
|
|
12
|
-
fill-rule="evenodd"
|
|
13
|
-
clip-rule="evenodd"
|
|
14
|
-
d="M12.5 13L25 0H0L12.5 13Z"
|
|
15
|
-
fill="#232D42"
|
|
16
|
-
/>
|
|
4
|
+
<svg width="25" height="13" viewBox="0 0 25 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
5
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.5 13L25 0H0L12.5 13Z" fill="#232D42" />
|
|
17
6
|
</svg>
|
|
18
7
|
);
|
|
@@ -16,20 +16,9 @@ export default () => (
|
|
|
16
16
|
</clipPath>
|
|
17
17
|
</defs>
|
|
18
18
|
<g id="Group_2" data-name="Group 2">
|
|
19
|
-
<circle
|
|
20
|
-
id="Oval-2"
|
|
21
|
-
data-name="Oval"
|
|
22
|
-
cx="86.5"
|
|
23
|
-
cy="86.5"
|
|
24
|
-
r="86.5"
|
|
25
|
-
fill="#ffa799"
|
|
26
|
-
/>
|
|
19
|
+
<circle id="Oval-2" data-name="Oval" cx="86.5" cy="86.5" r="86.5" fill="#ffa799" />
|
|
27
20
|
<g id="Group_2-2" data-name="Group 2" clip-path="url(#clip-path)">
|
|
28
|
-
<g
|
|
29
|
-
id="Group_232"
|
|
30
|
-
data-name="Group 232"
|
|
31
|
-
transform="translate(-5 -4)"
|
|
32
|
-
>
|
|
21
|
+
<g id="Group_232" data-name="Group 232" transform="translate(-5 -4)">
|
|
33
22
|
<rect
|
|
34
23
|
id="Rectangle"
|
|
35
24
|
width="30"
|
|
@@ -1,22 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
export default () => (
|
|
4
|
-
<svg
|
|
5
|
-
width="
|
|
6
|
-
height="27"
|
|
7
|
-
viewBox="0 0 27 27"
|
|
8
|
-
fill="none"
|
|
9
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
10
|
-
>
|
|
11
|
-
<rect
|
|
12
|
-
opacity="0.8"
|
|
13
|
-
x="1.5"
|
|
14
|
-
y="1.5"
|
|
15
|
-
width="24"
|
|
16
|
-
height="24"
|
|
17
|
-
rx="12"
|
|
18
|
-
fill="#DAF1FE"
|
|
19
|
-
/>
|
|
4
|
+
<svg width="27" height="27" viewBox="0 0 27 27" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
5
|
+
<rect opacity="0.8" x="1.5" y="1.5" width="24" height="24" rx="12" fill="#DAF1FE" />
|
|
20
6
|
<path
|
|
21
7
|
d="M12.3259 10.5855C12.2575 9.8896 12.8063 9.28745 13.5055 9.29121C14.2008 9.29495 14.7418 9.8964 14.6722 10.5881L14.1937 15.3431C14.1575 15.7026 13.855 15.9762 13.4937 15.9762C13.1319 15.9762 12.829 15.7017 12.7936 15.3415L12.3259 10.5855Z"
|
|
22
8
|
fill="url(#paint0_linear)"
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
export default () => (
|
|
4
|
-
<svg
|
|
5
|
-
width="24"
|
|
6
|
-
height="24"
|
|
7
|
-
viewBox="0 0 24 24"
|
|
8
|
-
fill="none"
|
|
9
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
10
|
-
>
|
|
4
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
11
5
|
<path
|
|
12
6
|
fill-rule="evenodd"
|
|
13
7
|
clip-rule="evenodd"
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
export default () => (
|
|
4
|
-
<svg
|
|
5
|
-
width="17"
|
|
6
|
-
height="17"
|
|
7
|
-
viewBox="0 0 17 17"
|
|
8
|
-
fill="none"
|
|
9
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
10
|
-
>
|
|
4
|
+
<svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
11
5
|
<rect x="0.5" y="0.25" width="16" height="16" rx="8" fill="#DAF1FE" />
|
|
12
6
|
<path
|
|
13
7
|
fill-rule="evenodd"
|
|
@@ -1,22 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
export default () => (
|
|
4
|
-
<svg
|
|
5
|
-
width="
|
|
6
|
-
height="27"
|
|
7
|
-
viewBox="0 0 27 27"
|
|
8
|
-
fill="none"
|
|
9
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
10
|
-
>
|
|
11
|
-
<rect
|
|
12
|
-
opacity="0.8"
|
|
13
|
-
x="1.5"
|
|
14
|
-
y="1.5"
|
|
15
|
-
width="24"
|
|
16
|
-
height="24"
|
|
17
|
-
rx="12"
|
|
18
|
-
fill="#DAF1FE"
|
|
19
|
-
/>
|
|
4
|
+
<svg width="27" height="27" viewBox="0 0 27 27" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
5
|
+
<rect opacity="0.8" x="1.5" y="1.5" width="24" height="24" rx="12" fill="#DAF1FE" />
|
|
20
6
|
<path
|
|
21
7
|
fill-rule="evenodd"
|
|
22
8
|
clip-rule="evenodd"
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
export default () => (
|
|
4
|
-
<svg
|
|
5
|
-
width="16"
|
|
6
|
-
height="16"
|
|
7
|
-
viewBox="0 0 16 16"
|
|
8
|
-
fill="none"
|
|
9
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
10
|
-
>
|
|
4
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
11
5
|
<path
|
|
12
6
|
d="M12.6265 10.4119V12.2379C12.6265 12.7338 12.193 13.1356 11.6583 13.1356H3.26825C2.73352 13.1356 2.29999 12.7338 2.29999 12.2379V3.79771C2.29999 3.30178 2.73352 2.89999 3.26825 2.89999H11.6583C12.193 2.89999 12.6265 3.30178 12.6265 3.79771V5.84996"
|
|
13
7
|
stroke="#8F95A2"
|
|
@@ -22,17 +16,7 @@ export default () => (
|
|
|
22
16
|
stroke-linecap="round"
|
|
23
17
|
stroke-linejoin="round"
|
|
24
18
|
/>
|
|
25
|
-
<path
|
|
26
|
-
|
|
27
|
-
stroke="#8F95A2"
|
|
28
|
-
stroke-linecap="round"
|
|
29
|
-
stroke-linejoin="round"
|
|
30
|
-
/>
|
|
31
|
-
<path
|
|
32
|
-
d="M2.29999 11.3122H4.99884"
|
|
33
|
-
stroke="#8F95A2"
|
|
34
|
-
stroke-linecap="round"
|
|
35
|
-
stroke-linejoin="round"
|
|
36
|
-
/>
|
|
19
|
+
<path d="M2.29999 4.73721H4.99884" stroke="#8F95A2" stroke-linecap="round" stroke-linejoin="round" />
|
|
20
|
+
<path d="M2.29999 11.3122H4.99884" stroke="#8F95A2" stroke-linecap="round" stroke-linejoin="round" />
|
|
37
21
|
</svg>
|
|
38
22
|
);
|
|
@@ -38,54 +38,29 @@ export class AmountUtils {
|
|
|
38
38
|
try {
|
|
39
39
|
const params = { ...this.defaultFiatParams, ...passedParams };
|
|
40
40
|
|
|
41
|
-
if (
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
)
|
|
45
|
-
return "NULL";
|
|
46
|
-
|
|
47
|
-
const currencySymbol =
|
|
48
|
-
FiatCurrenciesService.getCurrencySymbolByCode(currencyCode);
|
|
49
|
-
const currencyDecimalCount =
|
|
50
|
-
FiatCurrenciesService.getCurrencyDecimalCountByCode(
|
|
51
|
-
currencyCode
|
|
52
|
-
);
|
|
41
|
+
if (this._checkIfAmountInvalid(amount, true) || typeof currencyCode !== "string") return "NULL";
|
|
42
|
+
|
|
43
|
+
const currencySymbol = FiatCurrenciesService.getCurrencySymbolByCode(currencyCode);
|
|
44
|
+
const currencyDecimalCount = FiatCurrenciesService.getCurrencyDecimalCountByCode(currencyCode);
|
|
53
45
|
|
|
54
|
-
const trimmedByMaxDigits = BigNumber(amount).toFixed(
|
|
55
|
-
currencyDecimalCount,
|
|
56
|
-
BigNumber.ROUND_FLOOR
|
|
57
|
-
);
|
|
46
|
+
const trimmedByMaxDigits = BigNumber(amount).toFixed(currencyDecimalCount, BigNumber.ROUND_FLOOR);
|
|
58
47
|
|
|
59
48
|
let processedAmount = BigNumber(trimmedByMaxDigits);
|
|
60
|
-
if (
|
|
61
|
-
params.collapsible &&
|
|
62
|
-
processedAmount.gte(BigNumber("1000000"))
|
|
63
|
-
) {
|
|
49
|
+
if (params.collapsible && processedAmount.gte(BigNumber("1000000"))) {
|
|
64
50
|
processedAmount = this._collapseToMillionsAndFormat(
|
|
65
51
|
processedAmount,
|
|
66
52
|
this.collapsedDecimalCount,
|
|
67
53
|
params
|
|
68
54
|
);
|
|
69
55
|
} else {
|
|
70
|
-
const limitResult = this._limitTotalAmountLengthIfNeeded(
|
|
71
|
-
|
|
72
|
-
params
|
|
73
|
-
);
|
|
74
|
-
processedAmount = BigNumber(
|
|
75
|
-
limitResult.processedAmount
|
|
76
|
-
).toFormat(); // Adds commas to integer part
|
|
56
|
+
const limitResult = this._limitTotalAmountLengthIfNeeded(trimmedByMaxDigits, params);
|
|
57
|
+
processedAmount = BigNumber(limitResult.processedAmount).toFormat(); // Adds commas to integer part
|
|
77
58
|
}
|
|
78
59
|
|
|
79
60
|
// Add the currency code or currency symbol, if symbol is enabled and available
|
|
80
61
|
if (params.ticker) {
|
|
81
|
-
if (
|
|
82
|
-
|
|
83
|
-
params.enableCurrencySymbols
|
|
84
|
-
) {
|
|
85
|
-
processedAmount =
|
|
86
|
-
currencySymbol +
|
|
87
|
-
(currencySymbol.length > 1 ? " " : "") +
|
|
88
|
-
processedAmount;
|
|
62
|
+
if (typeof currencySymbol === "string" && params.enableCurrencySymbols) {
|
|
63
|
+
processedAmount = currencySymbol + (currencySymbol.length > 1 ? " " : "") + processedAmount;
|
|
89
64
|
} else {
|
|
90
65
|
processedAmount = processedAmount + " " + currencyCode;
|
|
91
66
|
}
|
|
@@ -154,33 +129,19 @@ export class AmountUtils {
|
|
|
154
129
|
* @param passedParams {object} Formatting parameters
|
|
155
130
|
* @return {string} Formatted crypto amount string
|
|
156
131
|
*/
|
|
157
|
-
static crypto(
|
|
158
|
-
amount,
|
|
159
|
-
ticker,
|
|
160
|
-
digits = this.significantDecimalCount,
|
|
161
|
-
passedParams
|
|
162
|
-
) {
|
|
132
|
+
static crypto(amount, ticker, digits = this.significantDecimalCount, passedParams) {
|
|
163
133
|
try {
|
|
164
134
|
const params = { ...this.defaultCryptoParams, ...passedParams };
|
|
165
135
|
|
|
166
|
-
if (
|
|
167
|
-
this._checkIfAmountInvalid(amount) ||
|
|
168
|
-
(typeof ticker !== "string" && params.ticker)
|
|
169
|
-
)
|
|
170
|
-
return "NULL";
|
|
136
|
+
if (this._checkIfAmountInvalid(amount) || (typeof ticker !== "string" && params.ticker)) return "NULL";
|
|
171
137
|
|
|
172
138
|
let addPeriods = false;
|
|
173
139
|
|
|
174
140
|
const amountBigNumber = BigNumber(amount);
|
|
175
141
|
|
|
176
|
-
let processedAmount = amountBigNumber.toFixed(
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
);
|
|
180
|
-
processedAmount =
|
|
181
|
-
this.removeRedundantRightZerosFromNumberString(processedAmount);
|
|
182
|
-
const originalAmountDecimalPlaces =
|
|
183
|
-
BigNumber(processedAmount).decimalPlaces();
|
|
142
|
+
let processedAmount = amountBigNumber.toFixed(digits, BigNumber.ROUND_FLOOR);
|
|
143
|
+
processedAmount = this.removeRedundantRightZerosFromNumberString(processedAmount);
|
|
144
|
+
const originalAmountDecimalPlaces = BigNumber(processedAmount).decimalPlaces();
|
|
184
145
|
// Check decimal count and throw an error, if the amount has more decimal digits than supported by the asset
|
|
185
146
|
if (originalAmountDecimalPlaces > digits) {
|
|
186
147
|
const errorMessage = `An attempt to render a crypto value with too many digits after period was made: ${amount}, allowed digits: ${digits}. This is a no-op, since the logical and visually rendered values would differ, which is not acceptable for crypto amounts. Please trim the amount before rendering, using the trimCryptoAmountByCoin(amount, coin) method.`;
|
|
@@ -191,21 +152,13 @@ export class AmountUtils {
|
|
|
191
152
|
|
|
192
153
|
// Shortening the value to general significant number of digits after period
|
|
193
154
|
if (params.trim) {
|
|
194
|
-
processedAmount =
|
|
195
|
-
this.
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
BigNumber.ROUND_FLOOR
|
|
199
|
-
)
|
|
200
|
-
);
|
|
201
|
-
addPeriods =
|
|
202
|
-
originalAmountDecimalPlaces > this.significantDecimalCount;
|
|
155
|
+
processedAmount = this.removeRedundantRightZerosFromNumberString(
|
|
156
|
+
amountBigNumber.toFixed(this.significantDecimalCount, BigNumber.ROUND_FLOOR)
|
|
157
|
+
);
|
|
158
|
+
addPeriods = originalAmountDecimalPlaces > this.significantDecimalCount;
|
|
203
159
|
}
|
|
204
160
|
|
|
205
|
-
const limitResult = this._limitTotalAmountLengthIfNeeded(
|
|
206
|
-
processedAmount,
|
|
207
|
-
params
|
|
208
|
-
);
|
|
161
|
+
const limitResult = this._limitTotalAmountLengthIfNeeded(processedAmount, params);
|
|
209
162
|
processedAmount = limitResult.processedAmount;
|
|
210
163
|
addPeriods ||= limitResult.addPeriods;
|
|
211
164
|
|
|
@@ -235,11 +188,7 @@ export class AmountUtils {
|
|
|
235
188
|
|
|
236
189
|
return processedAmount;
|
|
237
190
|
} catch (e) {
|
|
238
|
-
improveAndRethrow(
|
|
239
|
-
e,
|
|
240
|
-
"crypto",
|
|
241
|
-
`Passed: ${amount}, ${ticker}, ${digits}`
|
|
242
|
-
);
|
|
191
|
+
improveAndRethrow(e, "crypto", `Passed: ${amount}, ${ticker}, ${digits}`);
|
|
243
192
|
}
|
|
244
193
|
}
|
|
245
194
|
|
|
@@ -291,32 +240,17 @@ export class AmountUtils {
|
|
|
291
240
|
* @param params {object} params object
|
|
292
241
|
* @return {string} A shortened string, converted into "millions" format, if the amount exceeds 1 million
|
|
293
242
|
*/
|
|
294
|
-
static _collapseToMillionsAndFormat(
|
|
295
|
-
amountBigNumber,
|
|
296
|
-
decimalCount,
|
|
297
|
-
params = {}
|
|
298
|
-
) {
|
|
243
|
+
static _collapseToMillionsAndFormat(amountBigNumber, decimalCount, params = {}) {
|
|
299
244
|
try {
|
|
300
245
|
// TODO: [feature, moderate] use local format here - take from JS locales (comma/dot etc.)
|
|
301
246
|
const millionBigNumber = BigNumber("1000000");
|
|
302
|
-
const millions = amountBigNumber
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
const limitedResult = this._limitTotalAmountLengthIfNeeded(
|
|
306
|
-
millions,
|
|
307
|
-
params
|
|
308
|
-
);
|
|
309
|
-
const formatted = BigNumber(
|
|
310
|
-
limitedResult.processedAmount
|
|
311
|
-
).toFormat();
|
|
247
|
+
const millions = amountBigNumber.div(millionBigNumber).toFixed(decimalCount, BigNumber.ROUND_FLOOR);
|
|
248
|
+
const limitedResult = this._limitTotalAmountLengthIfNeeded(millions, params);
|
|
249
|
+
const formatted = BigNumber(limitedResult.processedAmount).toFormat();
|
|
312
250
|
|
|
313
251
|
return formatted + "M";
|
|
314
252
|
} catch (e) {
|
|
315
|
-
improveAndRethrow(
|
|
316
|
-
e,
|
|
317
|
-
"_collapseAmountAndFormat",
|
|
318
|
-
`Passed: ${amountBigNumber.toFixed()}, ${decimalCount}`
|
|
319
|
-
);
|
|
253
|
+
improveAndRethrow(e, "_collapseAmountAndFormat", `Passed: ${amountBigNumber.toFixed()}, ${decimalCount}`);
|
|
320
254
|
}
|
|
321
255
|
}
|
|
322
256
|
|
|
@@ -329,13 +263,10 @@ export class AmountUtils {
|
|
|
329
263
|
try {
|
|
330
264
|
let addPeriods = false;
|
|
331
265
|
if (params.limitTotalLength || params.extraSmallLength) {
|
|
332
|
-
const maxLength = params.extraSmallLength
|
|
333
|
-
? this.extraSmallMaxTotalLength
|
|
334
|
-
: this.maxTotalLength;
|
|
266
|
+
const maxLength = params.extraSmallLength ? this.extraSmallMaxTotalLength : this.maxTotalLength;
|
|
335
267
|
if (amountString.length > maxLength) {
|
|
336
268
|
const delta = amountString.length - maxLength;
|
|
337
|
-
const currentDecimalsCount =
|
|
338
|
-
BigNumber(amountString).decimalPlaces();
|
|
269
|
+
const currentDecimalsCount = BigNumber(amountString).decimalPlaces();
|
|
339
270
|
const newDecimalCount = currentDecimalsCount - delta;
|
|
340
271
|
amountString = BigNumber(amountString).toFixed(
|
|
341
272
|
newDecimalCount > 2 ? newDecimalCount : 2,
|
|
@@ -347,11 +278,7 @@ export class AmountUtils {
|
|
|
347
278
|
|
|
348
279
|
return { addPeriods: addPeriods, processedAmount: amountString };
|
|
349
280
|
} catch (e) {
|
|
350
|
-
improveAndRethrow(
|
|
351
|
-
e,
|
|
352
|
-
"_limitTotalAmountLengthIfNeeded",
|
|
353
|
-
`Passed: ${amountString}, ${params}`
|
|
354
|
-
);
|
|
281
|
+
improveAndRethrow(e, "_limitTotalAmountLengthIfNeeded", `Passed: ${amountString}, ${params}`);
|
|
355
282
|
}
|
|
356
283
|
}
|
|
357
284
|
|
|
@@ -386,17 +313,11 @@ export class AmountUtils {
|
|
|
386
313
|
const rateBigNumber = BigNumber(rate);
|
|
387
314
|
if (BigNumber(rate).eq("0")) {
|
|
388
315
|
right = BigNumber("0");
|
|
389
|
-
} else if (
|
|
390
|
-
rate &&
|
|
391
|
-
(BigNumber.isBigNumber(rate) || !Number.isNaN(+rate))
|
|
392
|
-
) {
|
|
316
|
+
} else if (rate && (BigNumber.isBigNumber(rate) || !Number.isNaN(+rate))) {
|
|
393
317
|
for (let i = 0; i < maxAttemptsToGetRate; ++i) {
|
|
394
318
|
const rightNumberAttempt = rateBigNumber
|
|
395
319
|
.times(leftNumber)
|
|
396
|
-
.toFixed(
|
|
397
|
-
rightCurrencyDigitsAfterDots,
|
|
398
|
-
BigNumber.ROUND_FLOOR
|
|
399
|
-
);
|
|
320
|
+
.toFixed(rightCurrencyDigitsAfterDots, BigNumber.ROUND_FLOOR);
|
|
400
321
|
if (!BigNumber(rightNumberAttempt).eq(BigNumber("0"))) {
|
|
401
322
|
right = BigNumber(rightNumberAttempt);
|
|
402
323
|
break;
|
|
@@ -407,15 +328,10 @@ export class AmountUtils {
|
|
|
407
328
|
}
|
|
408
329
|
const leftAmountString = AmountUtils.toIntegerString(leftNumber);
|
|
409
330
|
const rightAmountString =
|
|
410
|
-
right != null
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
)
|
|
415
|
-
: null;
|
|
416
|
-
return `${leftAmountString} ${leftTicker} ${
|
|
417
|
-
strictRate ? "=" : "~"
|
|
418
|
-
} ${rightAmountString ?? "?"} ${rightTicker}`;
|
|
331
|
+
right != null ? right.toFixed(rightCurrencyDigitsAfterDots, BigNumber.ROUND_FLOOR) : null;
|
|
332
|
+
return `${leftAmountString} ${leftTicker} ${strictRate ? "=" : "~"} ${
|
|
333
|
+
rightAmountString ?? "?"
|
|
334
|
+
} ${rightTicker}`;
|
|
419
335
|
} catch (e) {
|
|
420
336
|
// eslint-disable-next-line no-console
|
|
421
337
|
console.log("composeRateText", e);
|
|
@@ -437,11 +353,7 @@ export class AmountUtils {
|
|
|
437
353
|
|
|
438
354
|
return `${parts[0]}${right?.length ? `.${right}` : ""}`;
|
|
439
355
|
} catch (e) {
|
|
440
|
-
improveAndRethrow(
|
|
441
|
-
e,
|
|
442
|
-
"removeRedundantRightZerosFromNumberString",
|
|
443
|
-
`Passed: ${numberAsAString}`
|
|
444
|
-
);
|
|
356
|
+
improveAndRethrow(e, "removeRedundantRightZerosFromNumberString", `Passed: ${numberAsAString}`);
|
|
445
357
|
}
|
|
446
358
|
}
|
|
447
359
|
}
|
|
@@ -7,20 +7,10 @@ import { improveAndRethrow } from "../errorUtils.js";
|
|
|
7
7
|
|
|
8
8
|
class BigdatacloudIpAddressProvider extends ExternalApiProvider {
|
|
9
9
|
constructor() {
|
|
10
|
-
super(
|
|
11
|
-
"https://api.bigdatacloud.net/data/client-ip",
|
|
12
|
-
"get",
|
|
13
|
-
15000,
|
|
14
|
-
ApiGroups.BIGDATACLOUD
|
|
15
|
-
);
|
|
10
|
+
super("https://api.bigdatacloud.net/data/client-ip", "get", 15000, ApiGroups.BIGDATACLOUD);
|
|
16
11
|
}
|
|
17
12
|
|
|
18
|
-
getDataByResponse(
|
|
19
|
-
response,
|
|
20
|
-
params = [],
|
|
21
|
-
subRequestIndex = 0,
|
|
22
|
-
iterationsData = []
|
|
23
|
-
) {
|
|
13
|
+
getDataByResponse(response, params = [], subRequestIndex = 0, iterationsData = []) {
|
|
24
14
|
return response?.data && response.data?.ipString;
|
|
25
15
|
}
|
|
26
16
|
}
|
|
@@ -30,90 +20,54 @@ class TrackipIpAddressProvider extends ExternalApiProvider {
|
|
|
30
20
|
super("https://www.trackip.net/ip", "get", 15000, ApiGroups.TRACKIP);
|
|
31
21
|
}
|
|
32
22
|
|
|
33
|
-
getDataByResponse(
|
|
34
|
-
response,
|
|
35
|
-
params = [],
|
|
36
|
-
subRequestIndex = 0,
|
|
37
|
-
iterationsData = []
|
|
38
|
-
) {
|
|
23
|
+
getDataByResponse(response, params = [], subRequestIndex = 0, iterationsData = []) {
|
|
39
24
|
return response?.data;
|
|
40
25
|
}
|
|
41
26
|
}
|
|
42
27
|
|
|
43
28
|
class IpifyV6IpAddressProvider extends ExternalApiProvider {
|
|
44
29
|
constructor() {
|
|
45
|
-
super(
|
|
46
|
-
"https://api6.ipify.org/?format=json",
|
|
47
|
-
"get",
|
|
48
|
-
15000,
|
|
49
|
-
ApiGroups.IPIFY
|
|
50
|
-
);
|
|
30
|
+
super("https://api6.ipify.org/?format=json", "get", 15000, ApiGroups.IPIFY);
|
|
51
31
|
}
|
|
52
32
|
|
|
53
|
-
getDataByResponse(
|
|
54
|
-
response,
|
|
55
|
-
params = [],
|
|
56
|
-
subRequestIndex = 0,
|
|
57
|
-
iterationsData = []
|
|
58
|
-
) {
|
|
33
|
+
getDataByResponse(response, params = [], subRequestIndex = 0, iterationsData = []) {
|
|
59
34
|
return response?.data && response.data?.ip;
|
|
60
35
|
}
|
|
61
36
|
}
|
|
62
37
|
|
|
63
38
|
class IpifyIpAddressProvider extends ExternalApiProvider {
|
|
64
39
|
constructor() {
|
|
65
|
-
super(
|
|
66
|
-
"https://api.ipify.org/?format=json",
|
|
67
|
-
"get",
|
|
68
|
-
15000,
|
|
69
|
-
ApiGroups.IPIFY
|
|
70
|
-
);
|
|
40
|
+
super("https://api.ipify.org/?format=json", "get", 15000, ApiGroups.IPIFY);
|
|
71
41
|
}
|
|
72
42
|
|
|
73
|
-
getDataByResponse(
|
|
74
|
-
response,
|
|
75
|
-
params = [],
|
|
76
|
-
subRequestIndex = 0,
|
|
77
|
-
iterationsData = []
|
|
78
|
-
) {
|
|
43
|
+
getDataByResponse(response, params = [], subRequestIndex = 0, iterationsData = []) {
|
|
79
44
|
return response?.data && response.data?.ip;
|
|
80
45
|
}
|
|
81
46
|
}
|
|
82
47
|
|
|
83
48
|
class WhatismyipaddressIpAddressProvider extends ExternalApiProvider {
|
|
84
49
|
constructor() {
|
|
85
|
-
super(
|
|
86
|
-
"http://bot.whatismyipaddress.com/",
|
|
87
|
-
"get",
|
|
88
|
-
15000,
|
|
89
|
-
ApiGroups.WHATISMYIPADDRESS
|
|
90
|
-
);
|
|
50
|
+
super("http://bot.whatismyipaddress.com/", "get", 15000, ApiGroups.WHATISMYIPADDRESS);
|
|
91
51
|
}
|
|
92
52
|
|
|
93
|
-
getDataByResponse(
|
|
94
|
-
response,
|
|
95
|
-
params = [],
|
|
96
|
-
subRequestIndex = 0,
|
|
97
|
-
iterationsData = []
|
|
98
|
-
) {
|
|
53
|
+
getDataByResponse(response, params = [], subRequestIndex = 0, iterationsData = []) {
|
|
99
54
|
return response?.data;
|
|
100
55
|
}
|
|
101
56
|
}
|
|
102
57
|
|
|
103
58
|
export class IpAddressProvider {
|
|
104
|
-
static externalIPAddressAPICaller =
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
);
|
|
59
|
+
static externalIPAddressAPICaller = new CachedRobustExternalApiCallerService(
|
|
60
|
+
"externalIPAddressAPICaller",
|
|
61
|
+
new Cache(EventBusInstance),
|
|
62
|
+
[
|
|
63
|
+
new BigdatacloudIpAddressProvider(),
|
|
64
|
+
new TrackipIpAddressProvider(),
|
|
65
|
+
new IpifyV6IpAddressProvider(),
|
|
66
|
+
new IpifyIpAddressProvider(),
|
|
67
|
+
new WhatismyipaddressIpAddressProvider(),
|
|
68
|
+
],
|
|
69
|
+
300_000
|
|
70
|
+
);
|
|
117
71
|
|
|
118
72
|
/**
|
|
119
73
|
* Returns current public IP address identified by one of external services.
|
|
@@ -127,10 +81,7 @@ export class IpAddressProvider {
|
|
|
127
81
|
*/
|
|
128
82
|
static async getClientIpAddress() {
|
|
129
83
|
try {
|
|
130
|
-
return await this.externalIPAddressAPICaller.callExternalAPICached(
|
|
131
|
-
[],
|
|
132
|
-
7000
|
|
133
|
-
);
|
|
84
|
+
return await this.externalIPAddressAPICaller.callExternalAPICached([], 7000);
|
|
134
85
|
} catch (e) {
|
|
135
86
|
improveAndRethrow(e, "getClientIpAddress");
|
|
136
87
|
}
|