@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
|
@@ -30,9 +30,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
30
30
|
|
|
31
31
|
const swapProvider = new SwapspaceSwapProvider("/", new Cache());
|
|
32
32
|
|
|
33
|
-
return swapProvider
|
|
34
|
-
._fetchSupportedCurrenciesIfNeeded()
|
|
35
|
-
.should.be.rejectedWith(anyError);
|
|
33
|
+
return swapProvider._fetchSupportedCurrenciesIfNeeded().should.be.rejectedWith(anyError);
|
|
36
34
|
});
|
|
37
35
|
|
|
38
36
|
it("Should not call axios if there is _supportedCoins", async () => {
|
|
@@ -64,17 +62,11 @@ describe("swapspaceSwapProvider", function () {
|
|
|
64
62
|
};
|
|
65
63
|
axiosGetStub.resetBehavior();
|
|
66
64
|
axiosGetStub.resolves(someResp);
|
|
67
|
-
const p = new SwapspaceSwapProvider(
|
|
68
|
-
"/",
|
|
69
|
-
new Cache(),
|
|
70
|
-
_customCoinBuilderStub
|
|
71
|
-
);
|
|
65
|
+
const p = new SwapspaceSwapProvider("/", new Cache(), _customCoinBuilderStub);
|
|
72
66
|
|
|
73
67
|
await p._fetchSupportedCurrenciesIfNeeded();
|
|
74
68
|
|
|
75
|
-
_customCoinBuilderStub.callCount.should.be.equal(
|
|
76
|
-
someResp.data.length
|
|
77
|
-
);
|
|
69
|
+
_customCoinBuilderStub.callCount.should.be.equal(someResp.data.length);
|
|
78
70
|
});
|
|
79
71
|
|
|
80
72
|
it("Should call _customCoinBuilder with proper params", async () => {
|
|
@@ -89,19 +81,12 @@ describe("swapspaceSwapProvider", function () {
|
|
|
89
81
|
};
|
|
90
82
|
axiosGetStub.resetBehavior();
|
|
91
83
|
axiosGetStub.resolves(someResp);
|
|
92
|
-
const p = new SwapspaceSwapProvider(
|
|
93
|
-
"/",
|
|
94
|
-
new Cache(),
|
|
95
|
-
_customCoinBuilderStub
|
|
96
|
-
);
|
|
84
|
+
const p = new SwapspaceSwapProvider("/", new Cache(), _customCoinBuilderStub);
|
|
97
85
|
|
|
98
86
|
await p._fetchSupportedCurrenciesIfNeeded();
|
|
99
87
|
|
|
100
88
|
_customCoinBuilderStub.args.forEach((args, i) =>
|
|
101
|
-
args.should.be.deepEqual([
|
|
102
|
-
someResp.data[i].code,
|
|
103
|
-
someResp.data[i].network,
|
|
104
|
-
])
|
|
89
|
+
args.should.be.deepEqual([someResp.data[i].code, someResp.data[i].network])
|
|
105
90
|
);
|
|
106
91
|
});
|
|
107
92
|
|
|
@@ -120,22 +105,13 @@ describe("swapspaceSwapProvider", function () {
|
|
|
120
105
|
|
|
121
106
|
axiosGetStub.resetBehavior();
|
|
122
107
|
axiosGetStub.resolves(someResp);
|
|
123
|
-
const p = new SwapspaceSwapProvider(
|
|
124
|
-
"/",
|
|
125
|
-
new Cache(),
|
|
126
|
-
_customCoinBuilderStub,
|
|
127
|
-
true
|
|
128
|
-
);
|
|
108
|
+
const p = new SwapspaceSwapProvider("/", new Cache(), _customCoinBuilderStub, true);
|
|
129
109
|
|
|
130
110
|
await p._fetchSupportedCurrenciesIfNeeded();
|
|
131
111
|
|
|
132
112
|
p._supportedCoins.length.should.be.equal(2);
|
|
133
|
-
(
|
|
134
|
-
|
|
135
|
-
).should.be.true();
|
|
136
|
-
(
|
|
137
|
-
p._supportedCoins.find((i) => i.coin.ticker === "3") != null
|
|
138
|
-
).should.be.true();
|
|
113
|
+
(p._supportedCoins.find(i => i.coin.ticker === "1") != null).should.be.true();
|
|
114
|
+
(p._supportedCoins.find(i => i.coin.ticker === "3") != null).should.be.true();
|
|
139
115
|
});
|
|
140
116
|
|
|
141
117
|
it("Should construct coins with default params if _customCoinBuilder return null for some and useRestrictedCoinsSet is false", async () => {
|
|
@@ -158,20 +134,13 @@ describe("swapspaceSwapProvider", function () {
|
|
|
158
134
|
|
|
159
135
|
axiosGetStub.resetBehavior();
|
|
160
136
|
axiosGetStub.resolves(someResp);
|
|
161
|
-
const p = new SwapspaceSwapProvider(
|
|
162
|
-
"/",
|
|
163
|
-
new Cache(),
|
|
164
|
-
_customCoinBuilderStub,
|
|
165
|
-
false
|
|
166
|
-
);
|
|
137
|
+
const p = new SwapspaceSwapProvider("/", new Cache(), _customCoinBuilderStub, false);
|
|
167
138
|
|
|
168
139
|
await p._fetchSupportedCurrenciesIfNeeded();
|
|
169
140
|
|
|
170
141
|
p._supportedCoins.length.should.be.equal(3);
|
|
171
142
|
|
|
172
|
-
const newCoin = p._supportedCoins.find(
|
|
173
|
-
(i) => i.coin.ticker === "BBBN2"
|
|
174
|
-
)?.coin;
|
|
143
|
+
const newCoin = p._supportedCoins.find(i => i.coin.ticker === "BBBN2")?.coin;
|
|
175
144
|
(newCoin instanceof Coin).should.be.true();
|
|
176
145
|
newCoin.tickerPrintable.should.be.equal("BBB");
|
|
177
146
|
newCoin.latinName.should.be.equal("some");
|
|
@@ -286,25 +255,18 @@ describe("swapspaceSwapProvider", function () {
|
|
|
286
255
|
},
|
|
287
256
|
expectedName: "(USDT) (ERC20)",
|
|
288
257
|
},
|
|
289
|
-
].forEach(
|
|
258
|
+
].forEach(testCase => {
|
|
290
259
|
it("Should construct coins with default params if _customCoinBuilder return null for some and useRestrictedCoinsSet is false", async () => {
|
|
291
260
|
const someResp = {
|
|
292
261
|
data: [testCase.item],
|
|
293
262
|
};
|
|
294
263
|
axiosGetStub.resetBehavior();
|
|
295
264
|
axiosGetStub.resolves(someResp);
|
|
296
|
-
const p = new SwapspaceSwapProvider(
|
|
297
|
-
"/",
|
|
298
|
-
new Cache(),
|
|
299
|
-
() => null,
|
|
300
|
-
false
|
|
301
|
-
);
|
|
265
|
+
const p = new SwapspaceSwapProvider("/", new Cache(), () => null, false);
|
|
302
266
|
|
|
303
267
|
await p._fetchSupportedCurrenciesIfNeeded();
|
|
304
268
|
|
|
305
|
-
p._supportedCoins[0].coin.latinName.should.be.equal(
|
|
306
|
-
testCase.expectedName
|
|
307
|
-
);
|
|
269
|
+
p._supportedCoins[0].coin.latinName.should.be.equal(testCase.expectedName);
|
|
308
270
|
});
|
|
309
271
|
});
|
|
310
272
|
});
|
|
@@ -323,12 +285,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
323
285
|
|
|
324
286
|
axiosGetStub.resetBehavior();
|
|
325
287
|
axiosGetStub.resolves(someResp);
|
|
326
|
-
const p = new SwapspaceSwapProvider(
|
|
327
|
-
"/",
|
|
328
|
-
new Cache(),
|
|
329
|
-
_customCoinBuilderStub,
|
|
330
|
-
false
|
|
331
|
-
);
|
|
288
|
+
const p = new SwapspaceSwapProvider("/", new Cache(), _customCoinBuilderStub, false);
|
|
332
289
|
|
|
333
290
|
await p._fetchSupportedCurrenciesIfNeeded();
|
|
334
291
|
|
|
@@ -350,19 +307,12 @@ describe("swapspaceSwapProvider", function () {
|
|
|
350
307
|
|
|
351
308
|
axiosGetStub.resetBehavior();
|
|
352
309
|
axiosGetStub.resolves(someResp);
|
|
353
|
-
const p = new SwapspaceSwapProvider(
|
|
354
|
-
"/",
|
|
355
|
-
new Cache(),
|
|
356
|
-
_customCoinBuilderStub,
|
|
357
|
-
false
|
|
358
|
-
);
|
|
310
|
+
const p = new SwapspaceSwapProvider("/", new Cache(), _customCoinBuilderStub, false);
|
|
359
311
|
|
|
360
312
|
await p._fetchSupportedCurrenciesIfNeeded();
|
|
361
313
|
|
|
362
314
|
p._supportedCoins[0].coin.ticker.should.be.equal("BBBBBB1");
|
|
363
|
-
p._supportedCoins[0].coin.protocol.should.be.deepEqual(
|
|
364
|
-
new Protocol("BBB1")
|
|
365
|
-
);
|
|
315
|
+
p._supportedCoins[0].coin.protocol.should.be.deepEqual(new Protocol("BBB1"));
|
|
366
316
|
});
|
|
367
317
|
|
|
368
318
|
it("Should construct coins with tokenAddress === null if _customCoinBuilder return null for item and useRestrictedCoinsSet is false and contractAddress is nullish for item", async () => {
|
|
@@ -379,19 +329,14 @@ describe("swapspaceSwapProvider", function () {
|
|
|
379
329
|
|
|
380
330
|
axiosGetStub.resetBehavior();
|
|
381
331
|
axiosGetStub.resolves(someResp);
|
|
382
|
-
const p = new SwapspaceSwapProvider(
|
|
383
|
-
"/",
|
|
384
|
-
new Cache(),
|
|
385
|
-
_customCoinBuilderStub,
|
|
386
|
-
false
|
|
387
|
-
);
|
|
332
|
+
const p = new SwapspaceSwapProvider("/", new Cache(), _customCoinBuilderStub, false);
|
|
388
333
|
|
|
389
334
|
await p._fetchSupportedCurrenciesIfNeeded();
|
|
390
335
|
|
|
391
336
|
(p._supportedCoins[0].coin.tokenAddress === null).should.be.true();
|
|
392
337
|
});
|
|
393
338
|
|
|
394
|
-
const setupAndExecstoreCoinDataFormatTest = async
|
|
339
|
+
const setupAndExecstoreCoinDataFormatTest = async attribute => {
|
|
395
340
|
const someResp = {
|
|
396
341
|
data: [
|
|
397
342
|
{
|
|
@@ -444,12 +389,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
444
389
|
|
|
445
390
|
axiosGetStub.resetBehavior();
|
|
446
391
|
axiosGetStub.resolves(someResp);
|
|
447
|
-
const p = new SwapspaceSwapProvider(
|
|
448
|
-
"/",
|
|
449
|
-
new Cache(),
|
|
450
|
-
_customCoinBuilderStub,
|
|
451
|
-
false
|
|
452
|
-
);
|
|
392
|
+
const p = new SwapspaceSwapProvider("/", new Cache(), _customCoinBuilderStub, false);
|
|
453
393
|
|
|
454
394
|
await p._fetchSupportedCurrenciesIfNeeded();
|
|
455
395
|
|
|
@@ -459,14 +399,11 @@ describe("swapspaceSwapProvider", function () {
|
|
|
459
399
|
it("Should save constructed coin as a coin list item", async () => {
|
|
460
400
|
const { provider } = await setupAndExecstoreCoinDataFormatTest();
|
|
461
401
|
|
|
462
|
-
provider._supportedCoins.forEach(
|
|
463
|
-
i.coin.should.be.instanceof(Coin)
|
|
464
|
-
);
|
|
402
|
+
provider._supportedCoins.forEach(i => i.coin.should.be.instanceof(Coin));
|
|
465
403
|
});
|
|
466
404
|
|
|
467
405
|
it("Should save code as is", async () => {
|
|
468
|
-
const { provider, data } =
|
|
469
|
-
await setupAndExecstoreCoinDataFormatTest();
|
|
406
|
+
const { provider, data } = await setupAndExecstoreCoinDataFormatTest();
|
|
470
407
|
|
|
471
408
|
provider._supportedCoins.forEach((dataItem, i) => {
|
|
472
409
|
dataItem.code.should.be.equal(data[i].code);
|
|
@@ -474,8 +411,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
474
411
|
});
|
|
475
412
|
|
|
476
413
|
it("Should save network as is", async () => {
|
|
477
|
-
const { provider, data } =
|
|
478
|
-
await setupAndExecstoreCoinDataFormatTest();
|
|
414
|
+
const { provider, data } = await setupAndExecstoreCoinDataFormatTest();
|
|
479
415
|
|
|
480
416
|
provider._supportedCoins.forEach((dataItem, i) => {
|
|
481
417
|
dataItem.network.should.be.equal(data[i].network);
|
|
@@ -483,8 +419,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
483
419
|
});
|
|
484
420
|
|
|
485
421
|
it("Should save hasExtraId as is", async () => {
|
|
486
|
-
const { provider, data } =
|
|
487
|
-
await setupAndExecstoreCoinDataFormatTest();
|
|
422
|
+
const { provider, data } = await setupAndExecstoreCoinDataFormatTest();
|
|
488
423
|
|
|
489
424
|
provider._supportedCoins.forEach((dataItem, i) => {
|
|
490
425
|
dataItem.hasExtraId.should.be.equal(data[i].hasExtraId);
|
|
@@ -492,8 +427,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
492
427
|
});
|
|
493
428
|
|
|
494
429
|
it("Should save extraIdName as is", async () => {
|
|
495
|
-
const { provider, data } =
|
|
496
|
-
await setupAndExecstoreCoinDataFormatTest();
|
|
430
|
+
const { provider, data } = await setupAndExecstoreCoinDataFormatTest();
|
|
497
431
|
|
|
498
432
|
provider._supportedCoins.forEach((dataItem, i) => {
|
|
499
433
|
dataItem.extraIdName.should.be.equal(data[i].extraIdName);
|
|
@@ -501,8 +435,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
501
435
|
});
|
|
502
436
|
|
|
503
437
|
it("Should save popular to isPopular as boolean", async () => {
|
|
504
|
-
const { provider, data } =
|
|
505
|
-
await setupAndExecstoreCoinDataFormatTest();
|
|
438
|
+
const { provider, data } = await setupAndExecstoreCoinDataFormatTest();
|
|
506
439
|
|
|
507
440
|
provider._supportedCoins.forEach((dataItem, i) => {
|
|
508
441
|
dataItem.isPopular.should.be.equal(!!data[i].popular);
|
|
@@ -510,8 +443,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
510
443
|
});
|
|
511
444
|
|
|
512
445
|
it("Should save icon or default URL to iconURL", async () => {
|
|
513
|
-
const { provider, data } =
|
|
514
|
-
await setupAndExecstoreCoinDataFormatTest();
|
|
446
|
+
const { provider, data } = await setupAndExecstoreCoinDataFormatTest();
|
|
515
447
|
|
|
516
448
|
provider._supportedCoins.forEach((dataItem, i) => {
|
|
517
449
|
dataItem.iconURL.should.be.equal(
|
|
@@ -523,8 +455,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
523
455
|
});
|
|
524
456
|
|
|
525
457
|
it("Should save deposit as is", async () => {
|
|
526
|
-
const { provider, data } =
|
|
527
|
-
await setupAndExecstoreCoinDataFormatTest();
|
|
458
|
+
const { provider, data } = await setupAndExecstoreCoinDataFormatTest();
|
|
528
459
|
|
|
529
460
|
provider._supportedCoins.forEach((dataItem, i) => {
|
|
530
461
|
dataItem.deposit.should.be.equal(data[i].deposit);
|
|
@@ -532,8 +463,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
532
463
|
});
|
|
533
464
|
|
|
534
465
|
it("Should save withdrawal as is", async () => {
|
|
535
|
-
const { provider, data } =
|
|
536
|
-
await setupAndExecstoreCoinDataFormatTest();
|
|
466
|
+
const { provider, data } = await setupAndExecstoreCoinDataFormatTest();
|
|
537
467
|
|
|
538
468
|
provider._supportedCoins.forEach((dataItem, i) => {
|
|
539
469
|
dataItem.withdrawal.should.be.equal(data[i].withdrawal);
|
|
@@ -541,24 +471,15 @@ describe("swapspaceSwapProvider", function () {
|
|
|
541
471
|
});
|
|
542
472
|
|
|
543
473
|
it("Should save validationRegexp or null if it is nullish", async () => {
|
|
544
|
-
const { provider, data } =
|
|
545
|
-
await setupAndExecstoreCoinDataFormatTest();
|
|
474
|
+
const { provider, data } = await setupAndExecstoreCoinDataFormatTest();
|
|
546
475
|
|
|
547
476
|
provider._supportedCoins.forEach((dataItem, i) => {
|
|
548
|
-
(
|
|
549
|
-
dataItem.validationRegexp ===
|
|
550
|
-
(data[i].validationRegexp ?? null)
|
|
551
|
-
).should.be.true();
|
|
477
|
+
(dataItem.validationRegexp === (data[i].validationRegexp ?? null)).should.be.true();
|
|
552
478
|
});
|
|
553
479
|
});
|
|
554
480
|
|
|
555
481
|
it("should sort list by isPopular and alphabetically by ticker", async () => {
|
|
556
|
-
const swapspaceProvider = new SwapspaceSwapProvider(
|
|
557
|
-
"/",
|
|
558
|
-
new Cache(),
|
|
559
|
-
() => null,
|
|
560
|
-
false
|
|
561
|
-
);
|
|
482
|
+
const swapspaceProvider = new SwapspaceSwapProvider("/", new Cache(), () => null, false);
|
|
562
483
|
const fakeResponse = {
|
|
563
484
|
data: [
|
|
564
485
|
{
|
|
@@ -593,14 +514,8 @@ describe("swapspaceSwapProvider", function () {
|
|
|
593
514
|
await swapspaceProvider._fetchSupportedCurrenciesIfNeeded();
|
|
594
515
|
|
|
595
516
|
swapspaceProvider._supportedCoins
|
|
596
|
-
.map(
|
|
597
|
-
.should.be.deepEqual([
|
|
598
|
-
"AAAXXX",
|
|
599
|
-
"ETH",
|
|
600
|
-
"AAAEEE",
|
|
601
|
-
"BAC",
|
|
602
|
-
"BTCBBB",
|
|
603
|
-
]);
|
|
517
|
+
.map(coin => coin.coin.ticker)
|
|
518
|
+
.should.be.deepEqual(["AAAXXX", "ETH", "AAAEEE", "BAC", "BTCBBB"]);
|
|
604
519
|
});
|
|
605
520
|
|
|
606
521
|
it("should handle empty response data", async () => {
|
|
@@ -81,10 +81,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
81
81
|
{ coin: ETH, extraId: "" },
|
|
82
82
|
];
|
|
83
83
|
|
|
84
|
-
fetchSupportedCurrenciesStub = sinon.stub(
|
|
85
|
-
swapspaceSwapProvider,
|
|
86
|
-
"_fetchSupportedCurrenciesIfNeeded"
|
|
87
|
-
);
|
|
84
|
+
fetchSupportedCurrenciesStub = sinon.stub(swapspaceSwapProvider, "_fetchSupportedCurrenciesIfNeeded");
|
|
88
85
|
fetchSupportedCurrenciesStub.resolves();
|
|
89
86
|
|
|
90
87
|
axiosPostStub = sinon.stub(axios, "post");
|
|
@@ -143,9 +140,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
143
140
|
anyIp,
|
|
144
141
|
false
|
|
145
142
|
);
|
|
146
|
-
axiosPostStub.args[0][0].should.equal(
|
|
147
|
-
`${swapspaceSwapProvider._URL}/api/v2/exchange`
|
|
148
|
-
);
|
|
143
|
+
axiosPostStub.args[0][0].should.equal(`${swapspaceSwapProvider._URL}/api/v2/exchange`);
|
|
149
144
|
});
|
|
150
145
|
|
|
151
146
|
it("Should pass client IP address in request data", async () => {
|
|
@@ -160,10 +155,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
160
155
|
false
|
|
161
156
|
);
|
|
162
157
|
|
|
163
|
-
axiosPostStub.args[0][1].should.have.property(
|
|
164
|
-
"userIp",
|
|
165
|
-
"123.123.123.123"
|
|
166
|
-
);
|
|
158
|
+
axiosPostStub.args[0][1].should.have.property("userIp", "123.123.123.123");
|
|
167
159
|
});
|
|
168
160
|
|
|
169
161
|
it("Should pass provided refund address in request data", async () => {
|
|
@@ -178,10 +170,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
178
170
|
false
|
|
179
171
|
);
|
|
180
172
|
|
|
181
|
-
axiosPostStub.args[0][1].should.have.property(
|
|
182
|
-
"refund",
|
|
183
|
-
anyRefundAddress
|
|
184
|
-
);
|
|
173
|
+
axiosPostStub.args[0][1].should.have.property("refund", anyRefundAddress);
|
|
185
174
|
});
|
|
186
175
|
|
|
187
176
|
it("Should use rateId from rawSwapData in request data", async () => {
|
|
@@ -196,18 +185,12 @@ describe("swapspaceSwapProvider", function () {
|
|
|
196
185
|
false
|
|
197
186
|
);
|
|
198
187
|
|
|
199
|
-
axiosPostStub.args[0][1].should.have.property(
|
|
200
|
-
"rateId",
|
|
201
|
-
"test-rateId"
|
|
202
|
-
);
|
|
188
|
+
axiosPostStub.args[0][1].should.have.property("rateId", "test-rateId");
|
|
203
189
|
});
|
|
204
190
|
|
|
205
191
|
it('Should send the correct "extraId" passed if toCoin has hasExtraId===true', async () => {
|
|
206
192
|
const someExtraId = "extra123";
|
|
207
|
-
swapspaceSwapProvider._supportedCoins = [
|
|
208
|
-
{ coin: USDCTRC20 },
|
|
209
|
-
{ coin: ETH, hasExtraId: true },
|
|
210
|
-
];
|
|
193
|
+
swapspaceSwapProvider._supportedCoins = [{ coin: USDCTRC20 }, { coin: ETH, hasExtraId: true }];
|
|
211
194
|
|
|
212
195
|
await swapspaceSwapProvider.createSwap(
|
|
213
196
|
USDCTRC20,
|
|
@@ -221,10 +204,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
221
204
|
someExtraId
|
|
222
205
|
);
|
|
223
206
|
|
|
224
|
-
axiosPostStub.args[0][1].should.have.property(
|
|
225
|
-
"extraId",
|
|
226
|
-
someExtraId
|
|
227
|
-
);
|
|
207
|
+
axiosPostStub.args[0][1].should.have.property("extraId", someExtraId);
|
|
228
208
|
});
|
|
229
209
|
|
|
230
210
|
it('Should send the correct "refundExtraId" when refund extraId passed and fromCoin has hasExtraId===true ', async () => {
|
|
@@ -252,10 +232,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
252
232
|
someExtraId
|
|
253
233
|
);
|
|
254
234
|
|
|
255
|
-
axiosPostStub.args[0][1].should.have.property(
|
|
256
|
-
"refundExtraId",
|
|
257
|
-
someExtraId
|
|
258
|
-
);
|
|
235
|
+
axiosPostStub.args[0][1].should.have.property("refundExtraId", someExtraId);
|
|
259
236
|
});
|
|
260
237
|
|
|
261
238
|
it('Should omit passed "extraId" or "refundExtraId" when matching coins have hasExtraId false', async () => {
|
|
@@ -300,32 +277,13 @@ describe("swapspaceSwapProvider", function () {
|
|
|
300
277
|
false
|
|
301
278
|
);
|
|
302
279
|
|
|
303
|
-
axiosPostStub.args[0][1].should.have.property(
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
);
|
|
307
|
-
axiosPostStub.args[0][1].should.have.property(
|
|
308
|
-
"fromNetwork",
|
|
309
|
-
"from-network-test"
|
|
310
|
-
);
|
|
311
|
-
axiosPostStub.args[0][1].should.have.property(
|
|
312
|
-
"toCurrency",
|
|
313
|
-
"to-test"
|
|
314
|
-
);
|
|
315
|
-
axiosPostStub.args[0][1].should.have.property(
|
|
316
|
-
"toNetwork",
|
|
317
|
-
"to-network-test"
|
|
318
|
-
);
|
|
280
|
+
axiosPostStub.args[0][1].should.have.property("fromCurrency", "from-test");
|
|
281
|
+
axiosPostStub.args[0][1].should.have.property("fromNetwork", "from-network-test");
|
|
282
|
+
axiosPostStub.args[0][1].should.have.property("toCurrency", "to-test");
|
|
283
|
+
axiosPostStub.args[0][1].should.have.property("toNetwork", "to-network-test");
|
|
319
284
|
});
|
|
320
285
|
|
|
321
|
-
[
|
|
322
|
-
"fromCurrency",
|
|
323
|
-
"fromNetwork",
|
|
324
|
-
"toCurrency",
|
|
325
|
-
"toNetwork",
|
|
326
|
-
"id",
|
|
327
|
-
"partner",
|
|
328
|
-
].forEach((rawSwapDataProperty) => {
|
|
286
|
+
["fromCurrency", "fromNetwork", "toCurrency", "toNetwork", "id", "partner"].forEach(rawSwapDataProperty => {
|
|
329
287
|
it(`Should reject if raw swap data contains wrong ${rawSwapDataProperty}`, async () => {
|
|
330
288
|
const rawSwapData = {
|
|
331
289
|
...anyValidRawSwapData,
|
|
@@ -359,13 +317,10 @@ describe("swapspaceSwapProvider", function () {
|
|
|
359
317
|
false
|
|
360
318
|
);
|
|
361
319
|
|
|
362
|
-
axiosPostStub.args[0][1].should.have.property(
|
|
363
|
-
"partner",
|
|
364
|
-
"testPartner"
|
|
365
|
-
);
|
|
320
|
+
axiosPostStub.args[0][1].should.have.property("partner", "testPartner");
|
|
366
321
|
});
|
|
367
322
|
|
|
368
|
-
[false, true].forEach(
|
|
323
|
+
[false, true].forEach(fixed => {
|
|
369
324
|
it("Should ensure that fixed is always set to passed fixed value in the request data", async () => {
|
|
370
325
|
await swapspaceSwapProvider.createSwap(
|
|
371
326
|
USDCTRC20,
|
|
@@ -413,10 +368,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
413
368
|
});
|
|
414
369
|
|
|
415
370
|
it("Should handle cases where toCurrencyExtraId is not found for the coin", async () => {
|
|
416
|
-
swapspaceSwapProvider._supportedCoins = [
|
|
417
|
-
{ coin: USDCTRC20, extraId: "" },
|
|
418
|
-
{ coin: ETH },
|
|
419
|
-
];
|
|
371
|
+
swapspaceSwapProvider._supportedCoins = [{ coin: USDCTRC20, extraId: "" }, { coin: ETH }];
|
|
420
372
|
await swapspaceSwapProvider.createSwap(
|
|
421
373
|
USDCTRC20,
|
|
422
374
|
ETH,
|
|
@@ -461,9 +413,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
461
413
|
false
|
|
462
414
|
);
|
|
463
415
|
|
|
464
|
-
result.reason.should.equal(
|
|
465
|
-
SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
466
|
-
);
|
|
416
|
+
result.reason.should.equal(SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED);
|
|
467
417
|
});
|
|
468
418
|
|
|
469
419
|
it("Should return retriable fail for status 422 and specific 'Pair cannot be processed by' error text", async () => {
|
|
@@ -482,9 +432,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
482
432
|
false
|
|
483
433
|
);
|
|
484
434
|
|
|
485
|
-
result.reason.should.equal(
|
|
486
|
-
SwapProvider.CREATION_FAIL_REASONS.RETRIABLE_FAIL
|
|
487
|
-
);
|
|
435
|
+
result.reason.should.equal(SwapProvider.CREATION_FAIL_REASONS.RETRIABLE_FAIL);
|
|
488
436
|
});
|
|
489
437
|
|
|
490
438
|
it("Should return retriable fail for status 403 and specific 'IP address is forbidden' error text", async () => {
|
|
@@ -503,9 +451,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
503
451
|
false
|
|
504
452
|
);
|
|
505
453
|
|
|
506
|
-
result.reason.should.equal(
|
|
507
|
-
SwapProvider.CREATION_FAIL_REASONS.RETRIABLE_FAIL
|
|
508
|
-
);
|
|
454
|
+
result.reason.should.equal(SwapProvider.CREATION_FAIL_REASONS.RETRIABLE_FAIL);
|
|
509
455
|
});
|
|
510
456
|
|
|
511
457
|
it('Should return retriable fail for status 422 and specific "Amount maximum is" error text', async () => {
|
|
@@ -524,9 +470,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
524
470
|
false
|
|
525
471
|
);
|
|
526
472
|
|
|
527
|
-
result.reason.should.equal(
|
|
528
|
-
SwapProvider.CREATION_FAIL_REASONS.RETRIABLE_FAIL
|
|
529
|
-
);
|
|
473
|
+
result.reason.should.equal(SwapProvider.CREATION_FAIL_REASONS.RETRIABLE_FAIL);
|
|
530
474
|
});
|
|
531
475
|
|
|
532
476
|
it('Should return retriable fail for status 422 and specific "Amount minimum is" error text', async () => {
|
|
@@ -545,9 +489,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
545
489
|
false
|
|
546
490
|
);
|
|
547
491
|
|
|
548
|
-
result.reason.should.equal(
|
|
549
|
-
SwapProvider.CREATION_FAIL_REASONS.RETRIABLE_FAIL
|
|
550
|
-
);
|
|
492
|
+
result.reason.should.equal(SwapProvider.CREATION_FAIL_REASONS.RETRIABLE_FAIL);
|
|
551
493
|
});
|
|
552
494
|
|
|
553
495
|
it('Should return retriable fail for status 422 and specific "Currency not found" error text', async () => {
|
|
@@ -566,9 +508,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
566
508
|
false
|
|
567
509
|
);
|
|
568
510
|
|
|
569
|
-
result.reason.should.equal(
|
|
570
|
-
SwapProvider.CREATION_FAIL_REASONS.RETRIABLE_FAIL
|
|
571
|
-
);
|
|
511
|
+
result.reason.should.equal(SwapProvider.CREATION_FAIL_REASONS.RETRIABLE_FAIL);
|
|
572
512
|
});
|
|
573
513
|
|
|
574
514
|
it("Should return the correct swap details if response is valid", async () => {
|
|
@@ -1178,9 +1118,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1178
1118
|
anyIp,
|
|
1179
1119
|
false
|
|
1180
1120
|
)
|
|
1181
|
-
.should.be.rejectedWith(
|
|
1182
|
-
/.*Swap creation succeeded but the response is wrong:.*/
|
|
1183
|
-
);
|
|
1121
|
+
.should.be.rejectedWith(/.*Swap creation succeeded but the response is wrong:.*/);
|
|
1184
1122
|
});
|
|
1185
1123
|
|
|
1186
1124
|
it("Should handle axios.post returning a response with no from amount or invalid", async () => {
|
package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getAllSupportedCurrencies.test.js
CHANGED
|
@@ -37,14 +37,8 @@ describe("swapspaceSwapProvider", function () {
|
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
it("Should return an object with 'result' set to true and an array of supported coins if there is initialized list", async () => {
|
|
40
|
-
swapspaceProvider._supportedCoins = [
|
|
41
|
-
|
|
42
|
-
{ coin: 1 },
|
|
43
|
-
{ coin: "4" },
|
|
44
|
-
];
|
|
45
|
-
const expectedCoins = swapspaceProvider._supportedCoins.map(
|
|
46
|
-
(item) => item.coin
|
|
47
|
-
);
|
|
40
|
+
swapspaceProvider._supportedCoins = [{ coin: { t: "BTC" }, extraId: "" }, { coin: 1 }, { coin: "4" }];
|
|
41
|
+
const expectedCoins = swapspaceProvider._supportedCoins.map(item => item.coin);
|
|
48
42
|
|
|
49
43
|
const result = await swapspaceProvider.getAllSupportedCurrencies();
|
|
50
44
|
|
|
@@ -58,18 +52,14 @@ describe("swapspaceSwapProvider", function () {
|
|
|
58
52
|
});
|
|
59
53
|
|
|
60
54
|
it("Should throw an error if an error occurs while fetching supported currencies", async () => {
|
|
61
|
-
_fetchSupportedCurrenciesIfNeededStub.throws(
|
|
62
|
-
new Error("Error fetching supported currencies")
|
|
63
|
-
);
|
|
55
|
+
_fetchSupportedCurrenciesIfNeededStub.throws(new Error("Error fetching supported currencies"));
|
|
64
56
|
|
|
65
57
|
try {
|
|
66
58
|
await swapspaceProvider.getAllSupportedCurrencies();
|
|
67
59
|
should.fail("Expected an error to be thrown");
|
|
68
60
|
} catch (error) {
|
|
69
61
|
error.should.be.instanceOf(Error);
|
|
70
|
-
error.message.should.containEql(
|
|
71
|
-
"Error fetching supported currencies"
|
|
72
|
-
);
|
|
62
|
+
error.message.should.containEql("Error fetching supported currencies");
|
|
73
63
|
}
|
|
74
64
|
});
|
|
75
65
|
});
|
|
@@ -48,9 +48,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
48
48
|
{ coin: "4", withdrawal: true, deposit: null },
|
|
49
49
|
{ coin: "-12312", withdrawal: null, deposit: false },
|
|
50
50
|
];
|
|
51
|
-
const expectedCoins = swapspaceProvider._supportedCoins
|
|
52
|
-
.filter((i) => i.deposit)
|
|
53
|
-
.map((item) => item.coin);
|
|
51
|
+
const expectedCoins = swapspaceProvider._supportedCoins.filter(i => i.deposit).map(item => item.coin);
|
|
54
52
|
|
|
55
53
|
const result = await swapspaceProvider.getDepositCurrencies();
|
|
56
54
|
|
|
@@ -64,18 +62,14 @@ describe("swapspaceSwapProvider", function () {
|
|
|
64
62
|
});
|
|
65
63
|
|
|
66
64
|
it("Should throw an error if an error occurs while fetching supported currencies", async () => {
|
|
67
|
-
_fetchSupportedCurrenciesIfNeededStub.throws(
|
|
68
|
-
new Error("Error fetching supported currencies")
|
|
69
|
-
);
|
|
65
|
+
_fetchSupportedCurrenciesIfNeededStub.throws(new Error("Error fetching supported currencies"));
|
|
70
66
|
|
|
71
67
|
try {
|
|
72
68
|
await swapspaceProvider.getDepositCurrencies();
|
|
73
69
|
should.fail("Expected an error to be thrown");
|
|
74
70
|
} catch (error) {
|
|
75
71
|
error.should.be.instanceOf(Error);
|
|
76
|
-
error.message.should.containEql(
|
|
77
|
-
"Error fetching supported currencies"
|
|
78
|
-
);
|
|
72
|
+
error.message.should.containEql("Error fetching supported currencies");
|
|
79
73
|
}
|
|
80
74
|
});
|
|
81
75
|
});
|