@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
|
@@ -27,38 +27,26 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
27
27
|
endpoints === "any" ? "any" : endpoints[i],
|
|
28
28
|
httpMethods === "any" ? "get" : httpMethods[i],
|
|
29
29
|
timeouts ? timeouts[i] : null,
|
|
30
|
-
RPSes === null
|
|
31
|
-
? new ApiGroup(v4(), 10)
|
|
32
|
-
: new ApiGroup(v4(), RPSes[i])
|
|
30
|
+
RPSes === null ? new ApiGroup(v4(), 10) : new ApiGroup(v4(), RPSes[i])
|
|
33
31
|
);
|
|
34
32
|
}
|
|
35
|
-
getDataByResponse(
|
|
36
|
-
response,
|
|
37
|
-
params = [],
|
|
38
|
-
subRequestIndex = 0,
|
|
39
|
-
iterationsData = []
|
|
40
|
-
) {
|
|
33
|
+
getDataByResponse(response, params = [], subRequestIndex = 0, iterationsData = []) {
|
|
41
34
|
const func =
|
|
42
35
|
getDataByResponseFunctions === "any"
|
|
43
36
|
? "any"
|
|
44
37
|
: Array.isArray(getDataByResponseFunctions[i])
|
|
45
|
-
? getDataByResponseFunctions[i][
|
|
46
|
-
subRequestIndex
|
|
47
|
-
]
|
|
38
|
+
? getDataByResponseFunctions[i][subRequestIndex]
|
|
48
39
|
: getDataByResponseFunctions[i];
|
|
49
40
|
return func();
|
|
50
41
|
}
|
|
51
42
|
}
|
|
52
43
|
const provider = new TempProvider();
|
|
53
44
|
providers.push(provider);
|
|
54
|
-
const composeQueryStringStub = sinon.stub(
|
|
55
|
-
provider,
|
|
56
|
-
"composeQueryString"
|
|
57
|
-
);
|
|
45
|
+
const composeQueryStringStub = sinon.stub(provider, "composeQueryString");
|
|
58
46
|
composeQueryStringStubs.push(composeQueryStringStub);
|
|
59
47
|
}
|
|
60
48
|
const isRpsExceededStubs = [];
|
|
61
|
-
providers.forEach(
|
|
49
|
+
providers.forEach(provider => {
|
|
62
50
|
if (
|
|
63
51
|
provider.httpMethod === "post" ||
|
|
64
52
|
provider.httpMethod === "put" ||
|
|
@@ -96,10 +84,7 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
96
84
|
);
|
|
97
85
|
const attemptsCount = 6;
|
|
98
86
|
const failingAttemptsCount = Math.floor(attemptsCount * 0.6);
|
|
99
|
-
const _performCallAttemptStub = sinon.stub(
|
|
100
|
-
retrieverService,
|
|
101
|
-
"_performCallAttempt"
|
|
102
|
-
);
|
|
87
|
+
const _performCallAttemptStub = sinon.stub(retrieverService, "_performCallAttempt");
|
|
103
88
|
for (let i = 0; i < failingAttemptsCount; ++i) {
|
|
104
89
|
_performCallAttemptStub.onCall(i).resolves({
|
|
105
90
|
data: null,
|
|
@@ -115,16 +100,9 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
115
100
|
rpsFactor: RobustExternalAPICallerService.defaultRPSFactor,
|
|
116
101
|
});
|
|
117
102
|
|
|
118
|
-
await retrieverService.callExternalAPI(
|
|
119
|
-
[],
|
|
120
|
-
anyTimeout,
|
|
121
|
-
null,
|
|
122
|
-
attemptsCount
|
|
123
|
-
);
|
|
103
|
+
await retrieverService.callExternalAPI([], anyTimeout, null, attemptsCount);
|
|
124
104
|
|
|
125
|
-
_performCallAttemptStub.callCount.should.be.equal(
|
|
126
|
-
failingAttemptsCount + 1
|
|
127
|
-
);
|
|
105
|
+
_performCallAttemptStub.callCount.should.be.equal(failingAttemptsCount + 1);
|
|
128
106
|
});
|
|
129
107
|
|
|
130
108
|
it("Should perform max_attempts_count due to null data and shouldBeForceRetried is false for the last call", async function () {
|
|
@@ -135,10 +113,7 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
135
113
|
console.log
|
|
136
114
|
);
|
|
137
115
|
const attemptsCount = 5;
|
|
138
|
-
const _performCallAttemptStub = sinon.stub(
|
|
139
|
-
retrieverService,
|
|
140
|
-
"_performCallAttempt"
|
|
141
|
-
);
|
|
116
|
+
const _performCallAttemptStub = sinon.stub(retrieverService, "_performCallAttempt");
|
|
142
117
|
for (let i = 0; i < attemptsCount; ++i) {
|
|
143
118
|
_performCallAttemptStub.onCall(i).resolves({
|
|
144
119
|
data: null,
|
|
@@ -149,12 +124,7 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
149
124
|
}
|
|
150
125
|
|
|
151
126
|
try {
|
|
152
|
-
await retrieverService.callExternalAPI(
|
|
153
|
-
[],
|
|
154
|
-
anyTimeout,
|
|
155
|
-
null,
|
|
156
|
-
attemptsCount
|
|
157
|
-
);
|
|
127
|
+
await retrieverService.callExternalAPI([], anyTimeout, null, attemptsCount);
|
|
158
128
|
} catch (e) {
|
|
159
129
|
// We expect an error here
|
|
160
130
|
}
|
|
@@ -171,36 +141,20 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
171
141
|
);
|
|
172
142
|
const attemptsCount = 5;
|
|
173
143
|
const countOfAdditionalRequestsDueToForceRetryNeed = 3;
|
|
174
|
-
const _performCallAttemptStub = sinon.stub(
|
|
175
|
-
|
|
176
|
-
"_performCallAttempt"
|
|
177
|
-
);
|
|
178
|
-
for (
|
|
179
|
-
let i = 0;
|
|
180
|
-
i <
|
|
181
|
-
attemptsCount + countOfAdditionalRequestsDueToForceRetryNeed;
|
|
182
|
-
++i
|
|
183
|
-
) {
|
|
144
|
+
const _performCallAttemptStub = sinon.stub(retrieverService, "_performCallAttempt");
|
|
145
|
+
for (let i = 0; i < attemptsCount + countOfAdditionalRequestsDueToForceRetryNeed; ++i) {
|
|
184
146
|
_performCallAttemptStub.onCall(i).resolves({
|
|
185
147
|
data: null,
|
|
186
148
|
shouldBeForceRetried:
|
|
187
149
|
i >= attemptsCount - 1 &&
|
|
188
|
-
i !==
|
|
189
|
-
attemptsCount +
|
|
190
|
-
countOfAdditionalRequestsDueToForceRetryNeed -
|
|
191
|
-
1,
|
|
150
|
+
i !== attemptsCount + countOfAdditionalRequestsDueToForceRetryNeed - 1,
|
|
192
151
|
errors: [],
|
|
193
152
|
rpsFactor: RobustExternalAPICallerService.defaultRPSFactor,
|
|
194
153
|
});
|
|
195
154
|
}
|
|
196
155
|
|
|
197
156
|
try {
|
|
198
|
-
await retrieverService.callExternalAPI(
|
|
199
|
-
[],
|
|
200
|
-
anyTimeout,
|
|
201
|
-
null,
|
|
202
|
-
attemptsCount
|
|
203
|
-
);
|
|
157
|
+
await retrieverService.callExternalAPI([], anyTimeout, null, attemptsCount);
|
|
204
158
|
} catch (e) {
|
|
205
159
|
// We expect an error here
|
|
206
160
|
}
|
|
@@ -218,10 +172,7 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
218
172
|
console.log
|
|
219
173
|
);
|
|
220
174
|
const attemptsCount = 5;
|
|
221
|
-
const _performCallAttemptStub = sinon.stub(
|
|
222
|
-
retrieverService,
|
|
223
|
-
"_performCallAttempt"
|
|
224
|
-
);
|
|
175
|
+
const _performCallAttemptStub = sinon.stub(retrieverService, "_performCallAttempt");
|
|
225
176
|
for (let i = 0; i < attemptsCount; ++i) {
|
|
226
177
|
_performCallAttemptStub.onCall(i).resolves({
|
|
227
178
|
data: null,
|
|
@@ -231,13 +182,7 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
231
182
|
});
|
|
232
183
|
}
|
|
233
184
|
|
|
234
|
-
const result = await retrieverService.callExternalAPI(
|
|
235
|
-
[],
|
|
236
|
-
anyTimeout,
|
|
237
|
-
null,
|
|
238
|
-
attemptsCount,
|
|
239
|
-
true
|
|
240
|
-
);
|
|
185
|
+
const result = await retrieverService.callExternalAPI([], anyTimeout, null, attemptsCount, true);
|
|
241
186
|
|
|
242
187
|
(result == null).should.be.true();
|
|
243
188
|
});
|
|
@@ -250,10 +195,7 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
250
195
|
console.log
|
|
251
196
|
);
|
|
252
197
|
const attemptsCount = 5;
|
|
253
|
-
const _performCallAttemptStub = sinon.stub(
|
|
254
|
-
retrieverService,
|
|
255
|
-
"_performCallAttempt"
|
|
256
|
-
);
|
|
198
|
+
const _performCallAttemptStub = sinon.stub(retrieverService, "_performCallAttempt");
|
|
257
199
|
for (let i = 0; i < attemptsCount; ++i) {
|
|
258
200
|
_performCallAttemptStub.onCall(i).resolves({
|
|
259
201
|
data: null,
|
|
@@ -264,16 +206,9 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
264
206
|
}
|
|
265
207
|
|
|
266
208
|
try {
|
|
267
|
-
await retrieverService.callExternalAPI(
|
|
268
|
-
[],
|
|
269
|
-
anyTimeout,
|
|
270
|
-
null,
|
|
271
|
-
attemptsCount
|
|
272
|
-
);
|
|
209
|
+
await retrieverService.callExternalAPI([], anyTimeout, null, attemptsCount);
|
|
273
210
|
} catch (e) {
|
|
274
|
-
e.message.should.match(
|
|
275
|
-
/.*Failed to retrieve data. It means all attempts have been failed.*/
|
|
276
|
-
);
|
|
211
|
+
e.message.should.match(/.*Failed to retrieve data. It means all attempts have been failed.*/);
|
|
277
212
|
}
|
|
278
213
|
});
|
|
279
214
|
|
|
@@ -285,10 +220,7 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
285
220
|
console.log
|
|
286
221
|
);
|
|
287
222
|
const attemptsCount = 1;
|
|
288
|
-
const _performCallAttemptStub = sinon.stub(
|
|
289
|
-
retrieverService,
|
|
290
|
-
"_performCallAttempt"
|
|
291
|
-
);
|
|
223
|
+
const _performCallAttemptStub = sinon.stub(retrieverService, "_performCallAttempt");
|
|
292
224
|
_performCallAttemptStub.onCall(0).resolves({
|
|
293
225
|
data: anyData,
|
|
294
226
|
shouldBeForceRetried: false,
|
|
@@ -296,12 +228,7 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
296
228
|
rpsFactor: RobustExternalAPICallerService.defaultRPSFactor,
|
|
297
229
|
});
|
|
298
230
|
|
|
299
|
-
await retrieverService.callExternalAPI(
|
|
300
|
-
[],
|
|
301
|
-
anyTimeout,
|
|
302
|
-
null,
|
|
303
|
-
attemptsCount
|
|
304
|
-
);
|
|
231
|
+
await retrieverService.callExternalAPI([], anyTimeout, null, attemptsCount);
|
|
305
232
|
|
|
306
233
|
_performCallAttemptStub.args[0][3].should.be.equal(1);
|
|
307
234
|
});
|
|
@@ -317,10 +244,7 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
317
244
|
global.setTimeout = sinon.stub();
|
|
318
245
|
|
|
319
246
|
const attemptsCount = 1;
|
|
320
|
-
const _performCallAttemptStub = sinon.stub(
|
|
321
|
-
retrieverService,
|
|
322
|
-
"_performCallAttempt"
|
|
323
|
-
);
|
|
247
|
+
const _performCallAttemptStub = sinon.stub(retrieverService, "_performCallAttempt");
|
|
324
248
|
_performCallAttemptStub.onCall(0).resolves({
|
|
325
249
|
data: anyData,
|
|
326
250
|
shouldBeForceRetried: false,
|
|
@@ -328,12 +252,7 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
328
252
|
rpsFactor: RobustExternalAPICallerService.defaultRPSFactor,
|
|
329
253
|
});
|
|
330
254
|
|
|
331
|
-
await retrieverService.callExternalAPI(
|
|
332
|
-
[],
|
|
333
|
-
anyTimeout,
|
|
334
|
-
null,
|
|
335
|
-
attemptsCount
|
|
336
|
-
);
|
|
255
|
+
await retrieverService.callExternalAPI([], anyTimeout, null, attemptsCount);
|
|
337
256
|
|
|
338
257
|
setTimeout.callCount.should.be.equal(0);
|
|
339
258
|
});
|
|
@@ -350,10 +269,7 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
350
269
|
|
|
351
270
|
const attemptsCount = 4;
|
|
352
271
|
const failingAttemptsCount = 2;
|
|
353
|
-
const _performCallAttemptStub = sinon.stub(
|
|
354
|
-
retrieverService,
|
|
355
|
-
"_performCallAttempt"
|
|
356
|
-
);
|
|
272
|
+
const _performCallAttemptStub = sinon.stub(retrieverService, "_performCallAttempt");
|
|
357
273
|
for (let i = 0; i <= failingAttemptsCount; ++i) {
|
|
358
274
|
_performCallAttemptStub.onCall(i).resolves({
|
|
359
275
|
data: i === failingAttemptsCount ? anyData : null,
|
|
@@ -363,12 +279,7 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
363
279
|
});
|
|
364
280
|
}
|
|
365
281
|
|
|
366
|
-
await retrieverService.callExternalAPI(
|
|
367
|
-
[],
|
|
368
|
-
anyTimeout,
|
|
369
|
-
null,
|
|
370
|
-
attemptsCount
|
|
371
|
-
);
|
|
282
|
+
await retrieverService.callExternalAPI([], anyTimeout, null, attemptsCount);
|
|
372
283
|
|
|
373
284
|
setTimeout.callCount.should.be.equal(failingAttemptsCount);
|
|
374
285
|
});
|
|
@@ -386,10 +297,7 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
386
297
|
|
|
387
298
|
const attemptsCount = 5;
|
|
388
299
|
const failingAttemptsCount = 3;
|
|
389
|
-
const _performCallAttemptStub = sinon.stub(
|
|
390
|
-
retrieverService,
|
|
391
|
-
"_performCallAttempt"
|
|
392
|
-
);
|
|
300
|
+
const _performCallAttemptStub = sinon.stub(retrieverService, "_performCallAttempt");
|
|
393
301
|
for (let i = 0; i <= failingAttemptsCount; ++i) {
|
|
394
302
|
_performCallAttemptStub.onCall(i).resolves({
|
|
395
303
|
data: i === failingAttemptsCount ? anyData : null,
|
|
@@ -399,18 +307,11 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
399
307
|
});
|
|
400
308
|
}
|
|
401
309
|
|
|
402
|
-
await retrieverService.callExternalAPI(
|
|
403
|
-
[],
|
|
404
|
-
anyTimeout,
|
|
405
|
-
null,
|
|
406
|
-
attemptsCount
|
|
407
|
-
);
|
|
310
|
+
await retrieverService.callExternalAPI([], anyTimeout, null, attemptsCount);
|
|
408
311
|
|
|
409
312
|
for (let j = 0; j < failingAttemptsCount; ++j) {
|
|
410
313
|
setTimeout.args[j][1].should.be.equal(
|
|
411
|
-
1000 /
|
|
412
|
-
(Math.max(...RPSes) /
|
|
413
|
-
RobustExternalAPICallerService.defaultRPSFactor)
|
|
314
|
+
1000 / (Math.max(...RPSes) / RobustExternalAPICallerService.defaultRPSFactor)
|
|
414
315
|
);
|
|
415
316
|
}
|
|
416
317
|
});
|
|
@@ -428,20 +329,10 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
428
329
|
|
|
429
330
|
const attemptsCount = 5;
|
|
430
331
|
const failingAttemptsCount = 3;
|
|
431
|
-
const _performCallAttemptStub = sinon.stub(
|
|
432
|
-
retrieverService,
|
|
433
|
-
"_performCallAttempt"
|
|
434
|
-
);
|
|
332
|
+
const _performCallAttemptStub = sinon.stub(retrieverService, "_performCallAttempt");
|
|
435
333
|
const rpsFactors = new Array(4)
|
|
436
334
|
.fill(RobustExternalAPICallerService.defaultRPSFactor)
|
|
437
|
-
.map(
|
|
438
|
-
(factor, index) =>
|
|
439
|
-
factor *
|
|
440
|
-
Math.pow(
|
|
441
|
-
RobustExternalAPICallerService.rpsMultiplier,
|
|
442
|
-
index
|
|
443
|
-
)
|
|
444
|
-
);
|
|
335
|
+
.map((factor, index) => factor * Math.pow(RobustExternalAPICallerService.rpsMultiplier, index));
|
|
445
336
|
|
|
446
337
|
for (let i = 0; i <= failingAttemptsCount; ++i) {
|
|
447
338
|
_performCallAttemptStub.onCall(i).resolves({
|
|
@@ -452,12 +343,7 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
452
343
|
});
|
|
453
344
|
}
|
|
454
345
|
|
|
455
|
-
await retrieverService.callExternalAPI(
|
|
456
|
-
[],
|
|
457
|
-
anyTimeout,
|
|
458
|
-
null,
|
|
459
|
-
attemptsCount
|
|
460
|
-
);
|
|
346
|
+
await retrieverService.callExternalAPI([], anyTimeout, null, attemptsCount);
|
|
461
347
|
|
|
462
348
|
for (let j = 0; j < failingAttemptsCount; ++j) {
|
|
463
349
|
setTimeout.args[j][1].should.be.equal(
|
|
@@ -468,86 +354,49 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
468
354
|
});
|
|
469
355
|
|
|
470
356
|
it("Should log the errors array returned by _performCallAttempt", async function () {
|
|
471
|
-
const retrieverService = new RobustExternalAPICallerService(
|
|
472
|
-
"testService",
|
|
473
|
-
generateProviders(4).providers
|
|
474
|
-
);
|
|
357
|
+
const retrieverService = new RobustExternalAPICallerService("testService", generateProviders(4).providers);
|
|
475
358
|
|
|
476
359
|
const spy = sinon.spy(retrieverService, "_logger");
|
|
477
360
|
|
|
478
361
|
const attemptsCount = 3;
|
|
479
362
|
const failingAttemptsCount = 2;
|
|
480
|
-
const _performCallAttemptStub = sinon.stub(
|
|
481
|
-
retrieverService,
|
|
482
|
-
"_performCallAttempt"
|
|
483
|
-
);
|
|
363
|
+
const _performCallAttemptStub = sinon.stub(retrieverService, "_performCallAttempt");
|
|
484
364
|
for (let i = 0; i <= failingAttemptsCount; ++i) {
|
|
485
365
|
_performCallAttemptStub.onCall(i).resolves({
|
|
486
366
|
data: i === failingAttemptsCount ? anyData : null,
|
|
487
367
|
shouldBeForceRetried: false,
|
|
488
|
-
errors:
|
|
489
|
-
i !== failingAttemptsCount
|
|
490
|
-
? [`aaa${i}${i}${i}`, `bbb${i}${i}${i}`]
|
|
491
|
-
: [],
|
|
368
|
+
errors: i !== failingAttemptsCount ? [`aaa${i}${i}${i}`, `bbb${i}${i}${i}`] : [],
|
|
492
369
|
rpsFactor: RobustExternalAPICallerService.defaultRPSFactor,
|
|
493
370
|
});
|
|
494
371
|
}
|
|
495
372
|
|
|
496
|
-
await retrieverService.callExternalAPI(
|
|
497
|
-
[],
|
|
498
|
-
anyTimeout,
|
|
499
|
-
null,
|
|
500
|
-
attemptsCount,
|
|
501
|
-
true
|
|
502
|
-
);
|
|
373
|
+
await retrieverService.callExternalAPI([], anyTimeout, null, attemptsCount, true);
|
|
503
374
|
|
|
504
375
|
for (let j = 0; j < failingAttemptsCount; ++j) {
|
|
505
|
-
spy.args[j][0].message
|
|
506
|
-
|
|
507
|
-
.should.be.true();
|
|
508
|
-
spy.args[j][0].message
|
|
509
|
-
.includes(`bbb${j}${j}${j}`)
|
|
510
|
-
.should.be.true();
|
|
376
|
+
spy.args[j][0].message.includes(`aaa${j}${j}${j}`).should.be.true();
|
|
377
|
+
spy.args[j][0].message.includes(`bbb${j}${j}${j}`).should.be.true();
|
|
511
378
|
}
|
|
512
379
|
});
|
|
513
380
|
|
|
514
381
|
it("Should log an unexpected error occurred during the _performCallAttempt call", async function () {
|
|
515
|
-
const retrieverService = new RobustExternalAPICallerService(
|
|
516
|
-
"testService",
|
|
517
|
-
generateProviders(4).providers
|
|
518
|
-
);
|
|
382
|
+
const retrieverService = new RobustExternalAPICallerService("testService", generateProviders(4).providers);
|
|
519
383
|
|
|
520
384
|
const spy = sinon.spy(retrieverService, "_logger");
|
|
521
385
|
|
|
522
386
|
const someError = new Error("Failed ### in tests");
|
|
523
387
|
const attemptsCount = 1;
|
|
524
|
-
const _performCallAttemptStub = sinon.stub(
|
|
525
|
-
retrieverService,
|
|
526
|
-
"_performCallAttempt"
|
|
527
|
-
);
|
|
388
|
+
const _performCallAttemptStub = sinon.stub(retrieverService, "_performCallAttempt");
|
|
528
389
|
_performCallAttemptStub.onCall(0).rejects(someError);
|
|
529
390
|
|
|
530
|
-
await retrieverService.callExternalAPI(
|
|
531
|
-
[],
|
|
532
|
-
anyTimeout,
|
|
533
|
-
null,
|
|
534
|
-
attemptsCount,
|
|
535
|
-
true
|
|
536
|
-
);
|
|
391
|
+
await retrieverService.callExternalAPI([], anyTimeout, null, attemptsCount, true);
|
|
537
392
|
spy.args[0][0].should.be.equal(someError);
|
|
538
393
|
});
|
|
539
394
|
|
|
540
395
|
it("Should pass correct parameters to _performCallAttempt - case default rpsFactor", async function () {
|
|
541
|
-
const retrieverService = new RobustExternalAPICallerService(
|
|
542
|
-
"testService",
|
|
543
|
-
generateProviders(4).providers
|
|
544
|
-
);
|
|
396
|
+
const retrieverService = new RobustExternalAPICallerService("testService", generateProviders(4).providers);
|
|
545
397
|
|
|
546
398
|
const attemptsCount = 2;
|
|
547
|
-
const _performCallAttemptStub = sinon.stub(
|
|
548
|
-
retrieverService,
|
|
549
|
-
"_performCallAttempt"
|
|
550
|
-
);
|
|
399
|
+
const _performCallAttemptStub = sinon.stub(retrieverService, "_performCallAttempt");
|
|
551
400
|
for (let i = 0; i < attemptsCount; ++i) {
|
|
552
401
|
_performCallAttemptStub.onCall(i).resolves({
|
|
553
402
|
data: null,
|
|
@@ -559,13 +408,7 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
559
408
|
|
|
560
409
|
const someParamsValues = [1, "aaa", { c: "1w2" }];
|
|
561
410
|
const someCancelToken = "some token";
|
|
562
|
-
await retrieverService.callExternalAPI(
|
|
563
|
-
someParamsValues,
|
|
564
|
-
anyTimeout,
|
|
565
|
-
someCancelToken,
|
|
566
|
-
attemptsCount,
|
|
567
|
-
true
|
|
568
|
-
);
|
|
411
|
+
await retrieverService.callExternalAPI(someParamsValues, anyTimeout, someCancelToken, attemptsCount, true);
|
|
569
412
|
|
|
570
413
|
for (let i = 0; i < attemptsCount; ++i) {
|
|
571
414
|
_performCallAttemptStub.args[i].should.be.deepEqual([
|
|
@@ -579,27 +422,14 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
579
422
|
});
|
|
580
423
|
|
|
581
424
|
it("Should pass correct parameters to _performCallAttempt - case increasing rpsFactor", async function () {
|
|
582
|
-
const retrieverService = new RobustExternalAPICallerService(
|
|
583
|
-
"testService",
|
|
584
|
-
generateProviders(4).providers
|
|
585
|
-
);
|
|
425
|
+
const retrieverService = new RobustExternalAPICallerService("testService", generateProviders(4).providers);
|
|
586
426
|
|
|
587
427
|
const attemptsCount = 5;
|
|
588
428
|
const failingAttemptsCount = 3;
|
|
589
|
-
const _performCallAttemptStub = sinon.stub(
|
|
590
|
-
retrieverService,
|
|
591
|
-
"_performCallAttempt"
|
|
592
|
-
);
|
|
429
|
+
const _performCallAttemptStub = sinon.stub(retrieverService, "_performCallAttempt");
|
|
593
430
|
const rpsFactors = new Array(failingAttemptsCount + 1)
|
|
594
431
|
.fill(RobustExternalAPICallerService.defaultRPSFactor)
|
|
595
|
-
.map(
|
|
596
|
-
(factor, index) =>
|
|
597
|
-
factor *
|
|
598
|
-
Math.pow(
|
|
599
|
-
RobustExternalAPICallerService.rpsMultiplier,
|
|
600
|
-
index
|
|
601
|
-
)
|
|
602
|
-
);
|
|
432
|
+
.map((factor, index) => factor * Math.pow(RobustExternalAPICallerService.rpsMultiplier, index));
|
|
603
433
|
|
|
604
434
|
for (let i = 0; i <= failingAttemptsCount; ++i) {
|
|
605
435
|
_performCallAttemptStub.onCall(i).resolves({
|
|
@@ -611,13 +441,7 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
611
441
|
}
|
|
612
442
|
const someParamsValues = [1, "aaa", { c: "1w2" }];
|
|
613
443
|
const someCancelToken = "some token";
|
|
614
|
-
await retrieverService.callExternalAPI(
|
|
615
|
-
someParamsValues,
|
|
616
|
-
anyTimeout,
|
|
617
|
-
someCancelToken,
|
|
618
|
-
attemptsCount,
|
|
619
|
-
true
|
|
620
|
-
);
|
|
444
|
+
await retrieverService.callExternalAPI(someParamsValues, anyTimeout, someCancelToken, attemptsCount, true);
|
|
621
445
|
|
|
622
446
|
for (let i = 0; i < failingAttemptsCount + 1; ++i) {
|
|
623
447
|
_performCallAttemptStub.args[i].should.be.deepEqual(
|
|
@@ -625,9 +449,7 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
625
449
|
someParamsValues,
|
|
626
450
|
anyTimeout,
|
|
627
451
|
someCancelToken,
|
|
628
|
-
i === 0
|
|
629
|
-
? RobustExternalAPICallerService.defaultRPSFactor
|
|
630
|
-
: rpsFactors[i - 1],
|
|
452
|
+
i === 0 ? RobustExternalAPICallerService.defaultRPSFactor : rpsFactors[i - 1],
|
|
631
453
|
true,
|
|
632
454
|
],
|
|
633
455
|
`Attempt ${i} check`
|
|
@@ -636,18 +458,12 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
636
458
|
});
|
|
637
459
|
|
|
638
460
|
it("Should log the 'not enough attempts' error when after all attempts data is null and doNotFailForNowData is true", async function () {
|
|
639
|
-
const retrieverService = new RobustExternalAPICallerService(
|
|
640
|
-
"testService",
|
|
641
|
-
generateProviders(4).providers
|
|
642
|
-
);
|
|
461
|
+
const retrieverService = new RobustExternalAPICallerService("testService", generateProviders(4).providers);
|
|
643
462
|
|
|
644
463
|
const spy = sinon.spy(retrieverService, "_logger");
|
|
645
464
|
|
|
646
465
|
const attemptsCount = 3;
|
|
647
|
-
const _performCallAttemptStub = sinon.stub(
|
|
648
|
-
retrieverService,
|
|
649
|
-
"_performCallAttempt"
|
|
650
|
-
);
|
|
466
|
+
const _performCallAttemptStub = sinon.stub(retrieverService, "_performCallAttempt");
|
|
651
467
|
for (let i = 0; i < attemptsCount; ++i) {
|
|
652
468
|
_performCallAttemptStub.onCall(i).resolves({
|
|
653
469
|
data: null,
|
|
@@ -657,13 +473,7 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
657
473
|
});
|
|
658
474
|
}
|
|
659
475
|
|
|
660
|
-
await retrieverService.callExternalAPI(
|
|
661
|
-
[],
|
|
662
|
-
anyTimeout,
|
|
663
|
-
null,
|
|
664
|
-
attemptsCount,
|
|
665
|
-
true
|
|
666
|
-
);
|
|
476
|
+
await retrieverService.callExternalAPI([], anyTimeout, null, attemptsCount, true);
|
|
667
477
|
|
|
668
478
|
spy.args[0][0].message.should.be.equal(
|
|
669
479
|
"Failed to retrieve data. It means all attempts have been failed. DEV: add more attempts to this data retrieval"
|
|
@@ -671,18 +481,12 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
671
481
|
});
|
|
672
482
|
|
|
673
483
|
it("Should throw the 'not enough attempts' error when after all attempts data is null and doNotFailForNowData is false", async function () {
|
|
674
|
-
const retrieverService = new RobustExternalAPICallerService(
|
|
675
|
-
"testService",
|
|
676
|
-
generateProviders(4).providers
|
|
677
|
-
);
|
|
484
|
+
const retrieverService = new RobustExternalAPICallerService("testService", generateProviders(4).providers);
|
|
678
485
|
|
|
679
486
|
const spy = sinon.spy(retrieverService, "_logger");
|
|
680
487
|
|
|
681
488
|
const attemptsCount = 3;
|
|
682
|
-
const _performCallAttemptStub = sinon.stub(
|
|
683
|
-
retrieverService,
|
|
684
|
-
"_performCallAttempt"
|
|
685
|
-
);
|
|
489
|
+
const _performCallAttemptStub = sinon.stub(retrieverService, "_performCallAttempt");
|
|
686
490
|
for (let i = 0; i < attemptsCount; ++i) {
|
|
687
491
|
_performCallAttemptStub.onCall(i).resolves({
|
|
688
492
|
data: null,
|
|
@@ -694,12 +498,7 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
694
498
|
|
|
695
499
|
let error = null;
|
|
696
500
|
try {
|
|
697
|
-
await retrieverService.callExternalAPI(
|
|
698
|
-
[],
|
|
699
|
-
anyTimeout,
|
|
700
|
-
null,
|
|
701
|
-
attemptsCount
|
|
702
|
-
);
|
|
501
|
+
await retrieverService.callExternalAPI([], anyTimeout, null, attemptsCount);
|
|
703
502
|
} catch (e) {
|
|
704
503
|
error = e;
|
|
705
504
|
}
|
|
@@ -711,17 +510,11 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
711
510
|
});
|
|
712
511
|
|
|
713
512
|
it("Should return the not null data returned by the _performCallAttempt", async function () {
|
|
714
|
-
const retrieverService = new RobustExternalAPICallerService(
|
|
715
|
-
"testService",
|
|
716
|
-
generateProviders(4).providers
|
|
717
|
-
);
|
|
513
|
+
const retrieverService = new RobustExternalAPICallerService("testService", generateProviders(4).providers);
|
|
718
514
|
|
|
719
515
|
const attemptsCount = 4;
|
|
720
516
|
const failingAttemptsCount = 2;
|
|
721
|
-
const _performCallAttemptStub = sinon.stub(
|
|
722
|
-
retrieverService,
|
|
723
|
-
"_performCallAttempt"
|
|
724
|
-
);
|
|
517
|
+
const _performCallAttemptStub = sinon.stub(retrieverService, "_performCallAttempt");
|
|
725
518
|
for (let i = 0; i <= failingAttemptsCount; ++i) {
|
|
726
519
|
_performCallAttemptStub.onCall(i).resolves({
|
|
727
520
|
data: i === failingAttemptsCount ? anyData : null,
|
|
@@ -731,13 +524,7 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
731
524
|
});
|
|
732
525
|
}
|
|
733
526
|
|
|
734
|
-
const result = await retrieverService.callExternalAPI(
|
|
735
|
-
[],
|
|
736
|
-
anyTimeout,
|
|
737
|
-
null,
|
|
738
|
-
attemptsCount,
|
|
739
|
-
true
|
|
740
|
-
);
|
|
527
|
+
const result = await retrieverService.callExternalAPI([], anyTimeout, null, attemptsCount, true);
|
|
741
528
|
|
|
742
529
|
result.should.be.deepEqual(anyData);
|
|
743
530
|
});
|
|
@@ -8,24 +8,12 @@ import { ApiGroup } from "../../../../common/external-apis/apiGroups.js";
|
|
|
8
8
|
|
|
9
9
|
describe("RobustExternalAPICallerService", function () {
|
|
10
10
|
describe("#constructor", function () {
|
|
11
|
-
const someProviders = [
|
|
12
|
-
new ExternalApiProvider(
|
|
13
|
-
"ggee.com",
|
|
14
|
-
"get",
|
|
15
|
-
10000,
|
|
16
|
-
new ApiGroup("aaa2141r1f", 1)
|
|
17
|
-
),
|
|
18
|
-
];
|
|
11
|
+
const someProviders = [new ExternalApiProvider("ggee.com", "get", 10000, new ApiGroup("aaa2141r1f", 1))];
|
|
19
12
|
|
|
20
13
|
it("Should set niceFactor field to 1 for given providers Array", async function () {
|
|
21
|
-
const instance = new RobustExternalAPICallerService(
|
|
22
|
-
"someBio",
|
|
23
|
-
someProviders
|
|
24
|
-
);
|
|
14
|
+
const instance = new RobustExternalAPICallerService("someBio", someProviders);
|
|
25
15
|
|
|
26
|
-
instance.providers.forEach(
|
|
27
|
-
provider.niceFactor.should.be.equal(1)
|
|
28
|
-
);
|
|
16
|
+
instance.providers.forEach(provider => provider.niceFactor.should.be.equal(1));
|
|
29
17
|
});
|
|
30
18
|
});
|
|
31
19
|
});
|
|
@@ -120,13 +120,7 @@ export class SwapProvider {
|
|
|
120
120
|
* [rawSwapData]: Object
|
|
121
121
|
* })>}
|
|
122
122
|
*/
|
|
123
|
-
async getSwapInfo(
|
|
124
|
-
fromCoin,
|
|
125
|
-
toCoin,
|
|
126
|
-
amountCoins,
|
|
127
|
-
fixed = false,
|
|
128
|
-
fromCoinToUsdRate = null
|
|
129
|
-
) {
|
|
123
|
+
async getSwapInfo(fromCoin, toCoin, amountCoins, fixed = false, fromCoinToUsdRate = null) {
|
|
130
124
|
throw new Error("Not implemented in base");
|
|
131
125
|
}
|
|
132
126
|
|