@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
|
@@ -99,9 +99,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
99
99
|
axiosGetStub = sinon.stub(axios, "get");
|
|
100
100
|
|
|
101
101
|
trimCryptoAmountByCoinStub = sinon.stub(AmountUtils, "trim");
|
|
102
|
-
trimCryptoAmountByCoinStub.callsFake(
|
|
103
|
-
amount?.toString()
|
|
104
|
-
);
|
|
102
|
+
trimCryptoAmountByCoinStub.callsFake(amount => amount?.toString());
|
|
105
103
|
});
|
|
106
104
|
|
|
107
105
|
afterEach(() => {
|
|
@@ -126,11 +124,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
126
124
|
];
|
|
127
125
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
128
126
|
|
|
129
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
130
|
-
BTC,
|
|
131
|
-
ETH,
|
|
132
|
-
"1"
|
|
133
|
-
);
|
|
127
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
134
128
|
|
|
135
129
|
result.result.should.be.true();
|
|
136
130
|
result.min.should.be.String();
|
|
@@ -143,40 +137,32 @@ describe("swapspaceSwapProvider", function () {
|
|
|
143
137
|
result.fixed.should.be.Boolean();
|
|
144
138
|
});
|
|
145
139
|
|
|
146
|
-
it("should return a result of correct format when there are no available exchange options but some not relevant options have min/max amount", async () => {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
(
|
|
173
|
-
Object.values(SwapProvider.NO_SWAPS_REASONS).find(
|
|
174
|
-
(v) => result.reason === v
|
|
175
|
-
) == null
|
|
176
|
-
).should.be.false();
|
|
177
|
-
result.smallestMin.should.be.String();
|
|
178
|
-
result.greatestMax.should.be.String();
|
|
179
|
-
});
|
|
140
|
+
// it("should return a result of correct format when there are no available exchange options but some not relevant options have min/max amount", async () => {
|
|
141
|
+
// swapspaceSwapProvider._supportedCoins = [
|
|
142
|
+
// { coin: BTC, code: "btc", network: "btc", deposit: true },
|
|
143
|
+
// { coin: ETH, code: "eth", network: "eth", withdrawal: true },
|
|
144
|
+
// ];
|
|
145
|
+
// axiosGetStub.resolves({
|
|
146
|
+
// data: [
|
|
147
|
+
// {
|
|
148
|
+
// exists: true,
|
|
149
|
+
// fixed: false,
|
|
150
|
+
// toAmount: 0.1,
|
|
151
|
+
// fromAmount: 1,
|
|
152
|
+
// duration: "10-20",
|
|
153
|
+
// max: 5,
|
|
154
|
+
// min: 0.1,
|
|
155
|
+
// },
|
|
156
|
+
// ],
|
|
157
|
+
// });
|
|
158
|
+
//
|
|
159
|
+
// const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "0.01");
|
|
160
|
+
//
|
|
161
|
+
// result.result.should.be.false();
|
|
162
|
+
// (Object.values(SwapProvider.NO_SWAPS_REASONS).find(v => result.reason === v) == null).should.be.false();
|
|
163
|
+
// result.smallestMin.should.be.String();
|
|
164
|
+
// result.greatestMax.should.be.String();
|
|
165
|
+
// });
|
|
180
166
|
|
|
181
167
|
it("should use the exchange with the highest rate", async () => {
|
|
182
168
|
swapspaceSwapProvider._supportedCoins = [
|
|
@@ -205,11 +191,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
205
191
|
];
|
|
206
192
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
207
193
|
|
|
208
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
209
|
-
BTC,
|
|
210
|
-
ETH,
|
|
211
|
-
"1"
|
|
212
|
-
);
|
|
194
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
213
195
|
|
|
214
196
|
result.rawSwapData.should.be.deepEqual(mockData[1]);
|
|
215
197
|
});
|
|
@@ -232,11 +214,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
232
214
|
];
|
|
233
215
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
234
216
|
|
|
235
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
236
|
-
BTC,
|
|
237
|
-
ETH,
|
|
238
|
-
"1"
|
|
239
|
-
);
|
|
217
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
240
218
|
|
|
241
219
|
result.rate.should.be.equal("1.5"); // because 3 divided by 2 is 1.5
|
|
242
220
|
});
|
|
@@ -268,11 +246,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
268
246
|
];
|
|
269
247
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
270
248
|
|
|
271
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
272
|
-
BTC,
|
|
273
|
-
ETH,
|
|
274
|
-
"1"
|
|
275
|
-
);
|
|
249
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
276
250
|
|
|
277
251
|
result.durationMinutesRange.should.be.equal("11-21"); // Using the first one by order
|
|
278
252
|
});
|
|
@@ -295,11 +269,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
295
269
|
];
|
|
296
270
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
297
271
|
|
|
298
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
299
|
-
BTC,
|
|
300
|
-
ETH,
|
|
301
|
-
"1"
|
|
302
|
-
);
|
|
272
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
303
273
|
|
|
304
274
|
result.rawSwapData.should.be.deepEqual(mockData[0]);
|
|
305
275
|
});
|
|
@@ -311,94 +281,45 @@ describe("swapspaceSwapProvider", function () {
|
|
|
311
281
|
];
|
|
312
282
|
axiosGetStub.throws({ response: { status: 429 } });
|
|
313
283
|
|
|
314
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
BTC,
|
|
354
|
-
ETH,
|
|
355
|
-
"1"
|
|
356
|
-
);
|
|
357
|
-
|
|
358
|
-
result.result.should.be.false();
|
|
359
|
-
result.reason.should.be.equal(
|
|
360
|
-
SwapProvider.NO_SWAPS_REASONS.TOO_LOW
|
|
361
|
-
);
|
|
362
|
-
});
|
|
363
|
-
|
|
364
|
-
it("should return TOO_HIGH when amount is above the greatest max and there are no available exchange option", async () => {
|
|
365
|
-
swapspaceSwapProvider._supportedCoins = [
|
|
366
|
-
{ coin: BTC, code: "btc", network: "btc", deposit: true },
|
|
367
|
-
{ coin: ETH, code: "eth", network: "eth", withdrawal: true },
|
|
368
|
-
];
|
|
369
|
-
const mockData = [
|
|
370
|
-
{
|
|
371
|
-
exists: true,
|
|
372
|
-
fixed: false,
|
|
373
|
-
toAmount: 0,
|
|
374
|
-
fromAmount: 1,
|
|
375
|
-
duration: "10-20",
|
|
376
|
-
max: 4,
|
|
377
|
-
min: 0.1,
|
|
378
|
-
},
|
|
379
|
-
{
|
|
380
|
-
exists: true,
|
|
381
|
-
fixed: false,
|
|
382
|
-
toAmount: 0,
|
|
383
|
-
fromAmount: 1,
|
|
384
|
-
duration: "10-20",
|
|
385
|
-
max: 1.1,
|
|
386
|
-
min: 0.4,
|
|
387
|
-
},
|
|
388
|
-
];
|
|
389
|
-
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
390
|
-
|
|
391
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
392
|
-
BTC,
|
|
393
|
-
ETH,
|
|
394
|
-
"10"
|
|
395
|
-
);
|
|
396
|
-
|
|
397
|
-
result.result.should.be.false();
|
|
398
|
-
result.reason.should.be.equal(
|
|
399
|
-
SwapProvider.NO_SWAPS_REASONS.TOO_HIGH
|
|
400
|
-
);
|
|
401
|
-
});
|
|
284
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
285
|
+
|
|
286
|
+
result.reason.should.be.equal(SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED);
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
// it("should return TOO_LOW whы
|
|
290
|
+
|
|
291
|
+
// it("should return TOO_HIGH when amount is above the greatest max and there are no available exchange option", async () => {
|
|
292
|
+
// swapspaceSwapProvider._supportedCoins = [
|
|
293
|
+
// { coin: BTC, code: "btc", network: "btc", deposit: true },
|
|
294
|
+
// { coin: ETH, code: "eth", network: "eth", withdrawal: true },
|
|
295
|
+
// ];
|
|
296
|
+
// const mockData = [
|
|
297
|
+
// {
|
|
298
|
+
// exists: true,
|
|
299
|
+
// fixed: false,
|
|
300
|
+
// toAmount: 0,
|
|
301
|
+
// fromAmount: 1,
|
|
302
|
+
// duration: "10-20",
|
|
303
|
+
// max: 4,
|
|
304
|
+
// min: 0.1,
|
|
305
|
+
// },
|
|
306
|
+
// {
|
|
307
|
+
// exists: true,
|
|
308
|
+
// fixed: false,
|
|
309
|
+
// toAmount: 0,
|
|
310
|
+
// fromAmount: 1,
|
|
311
|
+
// duration: "10-20",
|
|
312
|
+
// max: 1.1,
|
|
313
|
+
// min: 0.4,
|
|
314
|
+
// },
|
|
315
|
+
// ];
|
|
316
|
+
// axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
317
|
+
//
|
|
318
|
+
// const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "10");
|
|
319
|
+
//
|
|
320
|
+
// result.result.should.be.false();
|
|
321
|
+
// result.reason.should.be.equal(SwapProvider.NO_SWAPS_REASONS.TOO_HIGH);
|
|
322
|
+
// });
|
|
402
323
|
|
|
403
324
|
it("should return NOT_SUPPORTED when no exchanges support the pair", async () => {
|
|
404
325
|
swapspaceSwapProvider._supportedCoins = [
|
|
@@ -407,16 +328,10 @@ describe("swapspaceSwapProvider", function () {
|
|
|
407
328
|
];
|
|
408
329
|
axiosGetStub.returns(Promise.resolve({ data: [] }));
|
|
409
330
|
|
|
410
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
411
|
-
BTC,
|
|
412
|
-
ETH,
|
|
413
|
-
"1"
|
|
414
|
-
);
|
|
331
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
415
332
|
|
|
416
333
|
result.result.should.be.false();
|
|
417
|
-
result.reason.should.be.equal(
|
|
418
|
-
SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED
|
|
419
|
-
);
|
|
334
|
+
result.reason.should.be.equal(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
|
|
420
335
|
});
|
|
421
336
|
|
|
422
337
|
it("should return NOT_SUPPORTED when deposit is false for from currency", async () => {
|
|
@@ -426,16 +341,10 @@ describe("swapspaceSwapProvider", function () {
|
|
|
426
341
|
];
|
|
427
342
|
axiosGetStub.returns(Promise.resolve({ data: [] }));
|
|
428
343
|
|
|
429
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
430
|
-
BTC,
|
|
431
|
-
ETH,
|
|
432
|
-
"1"
|
|
433
|
-
);
|
|
344
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
434
345
|
|
|
435
346
|
result.result.should.be.false();
|
|
436
|
-
result.reason.should.be.equal(
|
|
437
|
-
SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED
|
|
438
|
-
);
|
|
347
|
+
result.reason.should.be.equal(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
|
|
439
348
|
});
|
|
440
349
|
|
|
441
350
|
it("should return NOT_SUPPORTED when withdrawal is false for to currency", async () => {
|
|
@@ -445,16 +354,10 @@ describe("swapspaceSwapProvider", function () {
|
|
|
445
354
|
];
|
|
446
355
|
axiosGetStub.returns(Promise.resolve({ data: [] }));
|
|
447
356
|
|
|
448
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
449
|
-
BTC,
|
|
450
|
-
ETH,
|
|
451
|
-
"1"
|
|
452
|
-
);
|
|
357
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
453
358
|
|
|
454
359
|
result.result.should.be.false();
|
|
455
|
-
result.reason.should.be.equal(
|
|
456
|
-
SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED
|
|
457
|
-
);
|
|
360
|
+
result.reason.should.be.equal(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
|
|
458
361
|
});
|
|
459
362
|
|
|
460
363
|
it("should return NO_FIXED_BUT_HAVE_FLOATING when fixed passed is true and there is no fixed option but there is floating option", async () => {
|
|
@@ -478,17 +381,10 @@ describe("swapspaceSwapProvider", function () {
|
|
|
478
381
|
})
|
|
479
382
|
);
|
|
480
383
|
|
|
481
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
482
|
-
BTC,
|
|
483
|
-
ETH,
|
|
484
|
-
"1",
|
|
485
|
-
true
|
|
486
|
-
);
|
|
384
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1", true);
|
|
487
385
|
|
|
488
386
|
result.result.should.be.false();
|
|
489
|
-
result.reason.should.be.equal(
|
|
490
|
-
SwapProvider.NO_SWAPS_REASONS.NO_FIXED_BUT_HAVE_FLOATING
|
|
491
|
-
);
|
|
387
|
+
result.reason.should.be.equal(SwapProvider.NO_SWAPS_REASONS.NO_FIXED_BUT_HAVE_FLOATING);
|
|
492
388
|
});
|
|
493
389
|
|
|
494
390
|
it("should return NO_FLOATING_BUT_HAVE_FIXED when fixed passed is false and there is no floating option but there is fixed option", async () => {
|
|
@@ -512,17 +408,10 @@ describe("swapspaceSwapProvider", function () {
|
|
|
512
408
|
})
|
|
513
409
|
);
|
|
514
410
|
|
|
515
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
516
|
-
BTC,
|
|
517
|
-
ETH,
|
|
518
|
-
"1",
|
|
519
|
-
false
|
|
520
|
-
);
|
|
411
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1", false);
|
|
521
412
|
|
|
522
413
|
result.result.should.be.false();
|
|
523
|
-
result.reason.should.be.equal(
|
|
524
|
-
SwapProvider.NO_SWAPS_REASONS.NO_FLOATING_BUT_HAVE_FIXED
|
|
525
|
-
);
|
|
414
|
+
result.reason.should.be.equal(SwapProvider.NO_SWAPS_REASONS.NO_FLOATING_BUT_HAVE_FIXED);
|
|
526
415
|
});
|
|
527
416
|
|
|
528
417
|
it("should return best option across both fixed and floating when fixed passed is null", async () => {
|
|
@@ -556,18 +445,13 @@ describe("swapspaceSwapProvider", function () {
|
|
|
556
445
|
})
|
|
557
446
|
);
|
|
558
447
|
|
|
559
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
560
|
-
BTC,
|
|
561
|
-
ETH,
|
|
562
|
-
"1",
|
|
563
|
-
null
|
|
564
|
-
);
|
|
448
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1", null);
|
|
565
449
|
|
|
566
450
|
result.result.should.be.true();
|
|
567
451
|
result.rawSwapData.should.be.deepEqual(opts[1]);
|
|
568
452
|
});
|
|
569
453
|
|
|
570
|
-
it("should correctly handle when there are available exchange options and no
|
|
454
|
+
it("should correctly handle when there are available exchange options and no numeric min", async () => {
|
|
571
455
|
swapspaceSwapProvider._supportedCoins = [
|
|
572
456
|
{ coin: BTC, code: "btc", network: "btc", deposit: true },
|
|
573
457
|
{ coin: ETH, code: "eth", network: "eth", withdrawal: true },
|
|
@@ -586,17 +470,13 @@ describe("swapspaceSwapProvider", function () {
|
|
|
586
470
|
],
|
|
587
471
|
});
|
|
588
472
|
|
|
589
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
590
|
-
BTC,
|
|
591
|
-
ETH,
|
|
592
|
-
"6"
|
|
593
|
-
);
|
|
473
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "6");
|
|
594
474
|
|
|
595
|
-
result.result.should.be.
|
|
596
|
-
(result.smallestMin ===
|
|
475
|
+
result.result.should.be.false();
|
|
476
|
+
(result.smallestMin === undefined).should.be.true();
|
|
597
477
|
});
|
|
598
478
|
|
|
599
|
-
it("should correctly handle when there are available exchange options and no
|
|
479
|
+
it("should correctly handle when there are available exchange options and no numeric max", async () => {
|
|
600
480
|
swapspaceSwapProvider._supportedCoins = [
|
|
601
481
|
{ coin: BTC, code: "btc", network: "btc", deposit: true },
|
|
602
482
|
{ coin: ETH, code: "eth", network: "eth", withdrawal: true },
|
|
@@ -615,14 +495,10 @@ describe("swapspaceSwapProvider", function () {
|
|
|
615
495
|
],
|
|
616
496
|
});
|
|
617
497
|
|
|
618
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
619
|
-
BTC,
|
|
620
|
-
ETH,
|
|
621
|
-
"0.01"
|
|
622
|
-
);
|
|
498
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "0.01");
|
|
623
499
|
|
|
624
|
-
result.result.should.be.
|
|
625
|
-
(result.greatestMax ===
|
|
500
|
+
result.result.should.be.false();
|
|
501
|
+
(result.greatestMax === undefined).should.be.true();
|
|
626
502
|
});
|
|
627
503
|
|
|
628
504
|
it("should increase the min with coinAmountForMinMaxSafety", async () => {
|
|
@@ -643,13 +519,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
643
519
|
];
|
|
644
520
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
645
521
|
|
|
646
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
647
|
-
BTC,
|
|
648
|
-
ETH,
|
|
649
|
-
"10",
|
|
650
|
-
false,
|
|
651
|
-
"2"
|
|
652
|
-
);
|
|
522
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "10", false, "2");
|
|
653
523
|
|
|
654
524
|
result.result.should.be.true();
|
|
655
525
|
result.min.should.be.equal("0.6");
|
|
@@ -682,13 +552,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
682
552
|
];
|
|
683
553
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
684
554
|
|
|
685
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
686
|
-
BTC,
|
|
687
|
-
ETH,
|
|
688
|
-
"10",
|
|
689
|
-
false,
|
|
690
|
-
"2"
|
|
691
|
-
);
|
|
555
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "10", false, "2");
|
|
692
556
|
|
|
693
557
|
result.result.should.be.true();
|
|
694
558
|
result.smallestMin.should.be.equal("0.51");
|
|
@@ -721,13 +585,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
721
585
|
];
|
|
722
586
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
723
587
|
|
|
724
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
725
|
-
BTC,
|
|
726
|
-
ETH,
|
|
727
|
-
"10",
|
|
728
|
-
false,
|
|
729
|
-
"2"
|
|
730
|
-
);
|
|
588
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "10", false, "2");
|
|
731
589
|
|
|
732
590
|
result.result.should.be.true();
|
|
733
591
|
result.greatestMax.should.be.equal("0");
|
|
@@ -751,13 +609,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
751
609
|
];
|
|
752
610
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
753
611
|
|
|
754
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
755
|
-
BTC,
|
|
756
|
-
ETH,
|
|
757
|
-
"10",
|
|
758
|
-
false,
|
|
759
|
-
"2"
|
|
760
|
-
);
|
|
612
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "10", false, "2");
|
|
761
613
|
|
|
762
614
|
result.result.should.be.true();
|
|
763
615
|
result.max.should.be.equal("3.5");
|
|
@@ -790,13 +642,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
790
642
|
];
|
|
791
643
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
792
644
|
|
|
793
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
794
|
-
BTC,
|
|
795
|
-
ETH,
|
|
796
|
-
"10",
|
|
797
|
-
false,
|
|
798
|
-
"2"
|
|
799
|
-
);
|
|
645
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "10", false, "2");
|
|
800
646
|
|
|
801
647
|
result.result.should.be.true();
|
|
802
648
|
result.greatestMax.should.be.equal("5.5");
|
|
@@ -820,13 +666,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
820
666
|
];
|
|
821
667
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
822
668
|
|
|
823
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
824
|
-
BTC,
|
|
825
|
-
ETH,
|
|
826
|
-
"10",
|
|
827
|
-
false,
|
|
828
|
-
"2"
|
|
829
|
-
);
|
|
669
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "10", false, "2");
|
|
830
670
|
|
|
831
671
|
result.result.should.be.true();
|
|
832
672
|
result.max.should.be.equal("0");
|
|
@@ -848,16 +688,10 @@ describe("swapspaceSwapProvider", function () {
|
|
|
848
688
|
];
|
|
849
689
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
850
690
|
|
|
851
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
852
|
-
BTC,
|
|
853
|
-
ETH,
|
|
854
|
-
"1"
|
|
855
|
-
);
|
|
691
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
856
692
|
|
|
857
693
|
result.result.should.be.false();
|
|
858
|
-
result.reason.should.be.equal(
|
|
859
|
-
SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED
|
|
860
|
-
);
|
|
694
|
+
result.reason.should.be.equal(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
|
|
861
695
|
});
|
|
862
696
|
|
|
863
697
|
it("should filter out banned exchanges", async () => {
|
|
@@ -885,16 +719,10 @@ describe("swapspaceSwapProvider", function () {
|
|
|
885
719
|
];
|
|
886
720
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
887
721
|
|
|
888
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
889
|
-
BTC,
|
|
890
|
-
ETH,
|
|
891
|
-
"1"
|
|
892
|
-
);
|
|
722
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
893
723
|
|
|
894
724
|
result.result.should.be.false();
|
|
895
|
-
result.reason.should.be.equal(
|
|
896
|
-
SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED
|
|
897
|
-
);
|
|
725
|
+
result.reason.should.be.equal(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
|
|
898
726
|
});
|
|
899
727
|
|
|
900
728
|
it("should filter out exchanges where toAmount equals 0", async () => {
|
|
@@ -914,16 +742,10 @@ describe("swapspaceSwapProvider", function () {
|
|
|
914
742
|
];
|
|
915
743
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
916
744
|
|
|
917
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
918
|
-
BTC,
|
|
919
|
-
ETH,
|
|
920
|
-
"1"
|
|
921
|
-
);
|
|
745
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
922
746
|
|
|
923
747
|
result.result.should.be.false();
|
|
924
|
-
result.reason.should.be.equal(
|
|
925
|
-
SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED
|
|
926
|
-
);
|
|
748
|
+
result.reason.should.be.equal(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
|
|
927
749
|
});
|
|
928
750
|
|
|
929
751
|
it("should correctly compute smallestMin and greatestMax", async () => {
|
|
@@ -953,13 +775,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
953
775
|
];
|
|
954
776
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
955
777
|
|
|
956
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
957
|
-
BTC,
|
|
958
|
-
ETH,
|
|
959
|
-
"1",
|
|
960
|
-
false,
|
|
961
|
-
"2"
|
|
962
|
-
);
|
|
778
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1", false, "2");
|
|
963
779
|
|
|
964
780
|
result.smallestMin.should.be.above(0.5);
|
|
965
781
|
result.greatestMax.should.be.below(5);
|
|
@@ -988,16 +804,10 @@ describe("swapspaceSwapProvider", function () {
|
|
|
988
804
|
];
|
|
989
805
|
axiosGetStub.returns(Promise.resolve({}));
|
|
990
806
|
|
|
991
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
992
|
-
BTC,
|
|
993
|
-
ETH,
|
|
994
|
-
"1"
|
|
995
|
-
);
|
|
807
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
996
808
|
|
|
997
809
|
result.result.should.be.false();
|
|
998
|
-
result.reason.should.be.equal(
|
|
999
|
-
SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED
|
|
1000
|
-
);
|
|
810
|
+
result.reason.should.be.equal(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
|
|
1001
811
|
});
|
|
1002
812
|
|
|
1003
813
|
it("should handle non-array axios response data", async () => {
|
|
@@ -1007,16 +817,10 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1007
817
|
];
|
|
1008
818
|
axiosGetStub.returns(Promise.resolve({ data: {} }));
|
|
1009
819
|
|
|
1010
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
1011
|
-
BTC,
|
|
1012
|
-
ETH,
|
|
1013
|
-
"1"
|
|
1014
|
-
);
|
|
820
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
1015
821
|
|
|
1016
822
|
result.result.should.be.false();
|
|
1017
|
-
result.reason.should.be.equal(
|
|
1018
|
-
SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED
|
|
1019
|
-
);
|
|
823
|
+
result.reason.should.be.equal(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
|
|
1020
824
|
});
|
|
1021
825
|
|
|
1022
826
|
it("should handle missing exists property in exchange data", async () => {
|
|
@@ -1036,16 +840,10 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1036
840
|
];
|
|
1037
841
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
1038
842
|
|
|
1039
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
1040
|
-
BTC,
|
|
1041
|
-
ETH,
|
|
1042
|
-
"1"
|
|
1043
|
-
);
|
|
843
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
1044
844
|
|
|
1045
845
|
result.result.should.be.false();
|
|
1046
|
-
result.reason.should.be.equal(
|
|
1047
|
-
SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED
|
|
1048
|
-
);
|
|
846
|
+
result.reason.should.be.equal(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
|
|
1049
847
|
});
|
|
1050
848
|
|
|
1051
849
|
it("should handle missing fixed property in exchange data", async () => {
|
|
@@ -1065,16 +863,10 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1065
863
|
];
|
|
1066
864
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
1067
865
|
|
|
1068
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
1069
|
-
BTC,
|
|
1070
|
-
ETH,
|
|
1071
|
-
"1"
|
|
1072
|
-
);
|
|
866
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
1073
867
|
|
|
1074
868
|
result.result.should.be.false();
|
|
1075
|
-
result.reason.should.be.equal(
|
|
1076
|
-
SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED
|
|
1077
|
-
);
|
|
869
|
+
result.reason.should.be.equal(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
|
|
1078
870
|
});
|
|
1079
871
|
|
|
1080
872
|
it("should capture exchanges with exist=false as not supporting the pair", async () => {
|
|
@@ -1113,11 +905,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1113
905
|
];
|
|
1114
906
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
1115
907
|
|
|
1116
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
1117
|
-
BTC,
|
|
1118
|
-
ETH,
|
|
1119
|
-
"1"
|
|
1120
|
-
);
|
|
908
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
1121
909
|
|
|
1122
910
|
result.result.should.be.true();
|
|
1123
911
|
result.rawSwapData.should.be.equal(mockData[2]);
|
|
@@ -1140,16 +928,10 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1140
928
|
];
|
|
1141
929
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
1142
930
|
|
|
1143
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
1144
|
-
BTC,
|
|
1145
|
-
ETH,
|
|
1146
|
-
"1"
|
|
1147
|
-
);
|
|
931
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
1148
932
|
|
|
1149
933
|
result.result.should.be.false();
|
|
1150
|
-
result.reason.should.be.equal(
|
|
1151
|
-
SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED
|
|
1152
|
-
);
|
|
934
|
+
result.reason.should.be.equal(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
|
|
1153
935
|
});
|
|
1154
936
|
|
|
1155
937
|
it("should return null rate when fromAmount is not number greater than 0", async () => {
|
|
@@ -1170,11 +952,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1170
952
|
];
|
|
1171
953
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
1172
954
|
|
|
1173
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
1174
|
-
BTC,
|
|
1175
|
-
ETH,
|
|
1176
|
-
"1"
|
|
1177
|
-
);
|
|
955
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
1178
956
|
|
|
1179
957
|
(result.rate === null).should.be.true();
|
|
1180
958
|
});
|
|
@@ -1197,11 +975,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1197
975
|
];
|
|
1198
976
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
1199
977
|
|
|
1200
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
1201
|
-
BTC,
|
|
1202
|
-
ETH,
|
|
1203
|
-
"1"
|
|
1204
|
-
);
|
|
978
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
1205
979
|
|
|
1206
980
|
(result.rate === null).should.be.true();
|
|
1207
981
|
});
|
|
@@ -1224,11 +998,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1224
998
|
];
|
|
1225
999
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
1226
1000
|
|
|
1227
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
1228
|
-
BTC,
|
|
1229
|
-
ETH,
|
|
1230
|
-
"100"
|
|
1231
|
-
);
|
|
1001
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "100");
|
|
1232
1002
|
|
|
1233
1003
|
result.result.should.be.true();
|
|
1234
1004
|
(result.smallestMin === null).should.be.true();
|
|
@@ -1252,11 +1022,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1252
1022
|
];
|
|
1253
1023
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
1254
1024
|
|
|
1255
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
1256
|
-
BTC,
|
|
1257
|
-
ETH,
|
|
1258
|
-
"100"
|
|
1259
|
-
);
|
|
1025
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "100");
|
|
1260
1026
|
|
|
1261
1027
|
result.result.should.be.true();
|
|
1262
1028
|
(result.greatestMax === null).should.be.true();
|
|
@@ -1289,13 +1055,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1289
1055
|
];
|
|
1290
1056
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
1291
1057
|
|
|
1292
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
1293
|
-
BTC,
|
|
1294
|
-
ETH,
|
|
1295
|
-
"5",
|
|
1296
|
-
false,
|
|
1297
|
-
"2"
|
|
1298
|
-
);
|
|
1058
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "5", false, "2");
|
|
1299
1059
|
|
|
1300
1060
|
result.greatestMax.should.be.below(10);
|
|
1301
1061
|
});
|
|
@@ -1318,16 +1078,10 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1318
1078
|
];
|
|
1319
1079
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
1320
1080
|
|
|
1321
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
1322
|
-
BTC,
|
|
1323
|
-
ETH,
|
|
1324
|
-
"1"
|
|
1325
|
-
);
|
|
1081
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
1326
1082
|
|
|
1327
1083
|
result.result.should.be.false();
|
|
1328
|
-
result.reason.should.be.equal(
|
|
1329
|
-
SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED
|
|
1330
|
-
);
|
|
1084
|
+
result.reason.should.be.equal(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
|
|
1331
1085
|
});
|
|
1332
1086
|
|
|
1333
1087
|
it("should correct smallestMin and greatestMax using coinAmountForMinMaxSafety", async () => {
|
|
@@ -1348,13 +1102,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1348
1102
|
];
|
|
1349
1103
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
1350
1104
|
|
|
1351
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
1352
|
-
BTC,
|
|
1353
|
-
ETH,
|
|
1354
|
-
"1",
|
|
1355
|
-
false,
|
|
1356
|
-
"2"
|
|
1357
|
-
);
|
|
1105
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1", false, "2");
|
|
1358
1106
|
|
|
1359
1107
|
result.smallestMin.should.be.above(0.5);
|
|
1360
1108
|
result.greatestMax.should.be.below(5);
|
|
@@ -1378,11 +1126,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1378
1126
|
];
|
|
1379
1127
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
1380
1128
|
|
|
1381
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
1382
|
-
BTC,
|
|
1383
|
-
ETH,
|
|
1384
|
-
"1"
|
|
1385
|
-
);
|
|
1129
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
1386
1130
|
|
|
1387
1131
|
(result.min === null).should.be.true();
|
|
1388
1132
|
});
|
|
@@ -1405,11 +1149,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1405
1149
|
];
|
|
1406
1150
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
1407
1151
|
|
|
1408
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
1409
|
-
BTC,
|
|
1410
|
-
ETH,
|
|
1411
|
-
"1"
|
|
1412
|
-
);
|
|
1152
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
1413
1153
|
|
|
1414
1154
|
(result.max === null).should.be.true();
|
|
1415
1155
|
});
|
|
@@ -1432,16 +1172,10 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1432
1172
|
];
|
|
1433
1173
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
1434
1174
|
|
|
1435
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
1436
|
-
BTC,
|
|
1437
|
-
ETH,
|
|
1438
|
-
"3"
|
|
1439
|
-
);
|
|
1175
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "3");
|
|
1440
1176
|
|
|
1441
1177
|
result.result.should.be.false();
|
|
1442
|
-
result.reason.should.be.equal(
|
|
1443
|
-
SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED
|
|
1444
|
-
);
|
|
1178
|
+
result.reason.should.be.equal(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
|
|
1445
1179
|
});
|
|
1446
1180
|
|
|
1447
1181
|
it("should handle not null/undefined coin->usd rate - safety coin amount should be used as 0", async () => {
|
|
@@ -1462,13 +1196,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1462
1196
|
];
|
|
1463
1197
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
1464
1198
|
|
|
1465
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
1466
|
-
BTC,
|
|
1467
|
-
ETH,
|
|
1468
|
-
"1",
|
|
1469
|
-
false,
|
|
1470
|
-
"2"
|
|
1471
|
-
);
|
|
1199
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1", false, "2");
|
|
1472
1200
|
|
|
1473
1201
|
result.result.should.be.true();
|
|
1474
1202
|
result.min.should.be.equal("0.6");
|
|
@@ -1495,11 +1223,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1495
1223
|
];
|
|
1496
1224
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
1497
1225
|
|
|
1498
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
1499
|
-
BTC,
|
|
1500
|
-
ETH,
|
|
1501
|
-
"1"
|
|
1502
|
-
);
|
|
1226
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
1503
1227
|
|
|
1504
1228
|
result.result.should.be.true();
|
|
1505
1229
|
result.min.should.be.equal("0.1");
|
|
@@ -1526,16 +1250,10 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1526
1250
|
];
|
|
1527
1251
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
1528
1252
|
|
|
1529
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
1530
|
-
BTC,
|
|
1531
|
-
ETH,
|
|
1532
|
-
"1"
|
|
1533
|
-
);
|
|
1253
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
1534
1254
|
|
|
1535
1255
|
result.result.should.be.false();
|
|
1536
|
-
result.reason.should.be.equal(
|
|
1537
|
-
SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED
|
|
1538
|
-
);
|
|
1256
|
+
result.reason.should.be.equal(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
|
|
1539
1257
|
});
|
|
1540
1258
|
|
|
1541
1259
|
it("should correctly account for coinAmountForMinMaxSafety in rate calculation", async () => {
|
|
@@ -1556,13 +1274,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1556
1274
|
];
|
|
1557
1275
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
1558
1276
|
|
|
1559
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
1560
|
-
BTC,
|
|
1561
|
-
ETH,
|
|
1562
|
-
"0.9",
|
|
1563
|
-
false,
|
|
1564
|
-
"2"
|
|
1565
|
-
);
|
|
1277
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "0.9", false, "2");
|
|
1566
1278
|
|
|
1567
1279
|
result.min.should.be.above(0.1);
|
|
1568
1280
|
});
|
|
@@ -1594,16 +1306,10 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1594
1306
|
];
|
|
1595
1307
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
1596
1308
|
|
|
1597
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
1598
|
-
BTC,
|
|
1599
|
-
ETH,
|
|
1600
|
-
"1"
|
|
1601
|
-
);
|
|
1309
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
1602
1310
|
|
|
1603
1311
|
result.result.should.be.false();
|
|
1604
|
-
result.reason.should.be.equal(
|
|
1605
|
-
SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED
|
|
1606
|
-
);
|
|
1312
|
+
result.reason.should.be.equal(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
|
|
1607
1313
|
});
|
|
1608
1314
|
|
|
1609
1315
|
it("should use the best exchange option according to toAmount", async () => {
|
|
@@ -1633,11 +1339,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1633
1339
|
];
|
|
1634
1340
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
1635
1341
|
|
|
1636
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
1637
|
-
BTC,
|
|
1638
|
-
ETH,
|
|
1639
|
-
"1"
|
|
1640
|
-
);
|
|
1342
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
1641
1343
|
|
|
1642
1344
|
result.durationMinutesRange.should.be.equal("11-21");
|
|
1643
1345
|
});
|
|
@@ -1648,7 +1350,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1648
1350
|
{ coin: BTC, network: "btc" },
|
|
1649
1351
|
{ coin: ETH, network: expToNetwork },
|
|
1650
1352
|
];
|
|
1651
|
-
axiosGetStub.callsFake(
|
|
1353
|
+
axiosGetStub.callsFake(url => {
|
|
1652
1354
|
url.includes(`&toNetwork=${expToNetwork}&`).should.be.true();
|
|
1653
1355
|
return Promise.resolve({ data: [] });
|
|
1654
1356
|
});
|
|
@@ -1662,7 +1364,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1662
1364
|
{ coin: BTC, network: expNetwork },
|
|
1663
1365
|
{ coin: ETH, network: "eth" },
|
|
1664
1366
|
];
|
|
1665
|
-
axiosGetStub.callsFake(
|
|
1367
|
+
axiosGetStub.callsFake(url => {
|
|
1666
1368
|
url.includes(`&fromNetwork=${expNetwork}&`).should.be.true();
|
|
1667
1369
|
return Promise.resolve({ data: [] });
|
|
1668
1370
|
});
|
|
@@ -1675,7 +1377,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1675
1377
|
{ coin: BTC, code: "btc", network: "btc", deposit: true },
|
|
1676
1378
|
{ coin: ETH, code: "eth", network: "eth", withdrawal: true },
|
|
1677
1379
|
];
|
|
1678
|
-
axiosGetStub.callsFake(
|
|
1380
|
+
axiosGetStub.callsFake(url => {
|
|
1679
1381
|
url.includes("estimated=false").should.be.true();
|
|
1680
1382
|
return Promise.resolve({ data: [] });
|
|
1681
1383
|
});
|
|
@@ -1688,7 +1390,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1688
1390
|
{ coin: BTC, code: "btc", network: "btc", deposit: true },
|
|
1689
1391
|
{ coin: ETH, code: "eth", network: "eth", withdrawal: true },
|
|
1690
1392
|
];
|
|
1691
|
-
axiosGetStub.callsFake(
|
|
1393
|
+
axiosGetStub.callsFake(url => {
|
|
1692
1394
|
url.should.not.containEql("float=");
|
|
1693
1395
|
url.should.not.containEql("fixed=");
|
|
1694
1396
|
return Promise.resolve({ data: [] });
|
|
@@ -1702,7 +1404,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1702
1404
|
{ coin: BTC, code: "btc", network: "btc", deposit: true },
|
|
1703
1405
|
{ coin: ETH, code: "eth", network: "eth", withdrawal: true },
|
|
1704
1406
|
];
|
|
1705
|
-
axiosGetStub.callsFake(
|
|
1407
|
+
axiosGetStub.callsFake(url => {
|
|
1706
1408
|
url.should.containEql("amount=1");
|
|
1707
1409
|
return Promise.resolve({ data: [] });
|
|
1708
1410
|
});
|
|
@@ -1715,7 +1417,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1715
1417
|
{ coin: BTC, code: "aaa", network: "btc" },
|
|
1716
1418
|
{ coin: ETH, code: "eth", network: "eth" },
|
|
1717
1419
|
];
|
|
1718
|
-
axiosGetStub.callsFake(
|
|
1420
|
+
axiosGetStub.callsFake(url => {
|
|
1719
1421
|
url.should.containEql(`fromCurrency=aaa&`);
|
|
1720
1422
|
return Promise.resolve({ data: [] });
|
|
1721
1423
|
});
|
|
@@ -1728,7 +1430,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1728
1430
|
{ coin: BTC, code: "btc", network: "btc" },
|
|
1729
1431
|
{ coin: ETH, code: "aaa", network: "eth" },
|
|
1730
1432
|
];
|
|
1731
|
-
axiosGetStub.callsFake(
|
|
1433
|
+
axiosGetStub.callsFake(url => {
|
|
1732
1434
|
url.should.containEql(`toCurrency=aaa&`);
|
|
1733
1435
|
return Promise.resolve({ data: [] });
|
|
1734
1436
|
});
|
|
@@ -1741,7 +1443,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1741
1443
|
{ coin: TRX, code: "trx", network: "trx" },
|
|
1742
1444
|
{ coin: USDTERC20, code: "usdt", network: "erc20" },
|
|
1743
1445
|
];
|
|
1744
|
-
axiosGetStub.callsFake(
|
|
1446
|
+
axiosGetStub.callsFake(url => {
|
|
1745
1447
|
url.should.containEql(`/api/v2/amounts`);
|
|
1746
1448
|
url.should.containEql("fromCurrency=trx");
|
|
1747
1449
|
url.should.containEql("fromNetwork=trx");
|
|
@@ -1761,7 +1463,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1761
1463
|
{ coin: BTC, code: "btc", network: "btc", deposit: true },
|
|
1762
1464
|
{ coin: ETH, code: "eth", network: "eth", withdrawal: true },
|
|
1763
1465
|
];
|
|
1764
|
-
axiosGetStub.callsFake(
|
|
1466
|
+
axiosGetStub.callsFake(url => {
|
|
1765
1467
|
url.should.containEql(`/api/v2/amounts`);
|
|
1766
1468
|
url.should.containEql("fromCurrency=btc");
|
|
1767
1469
|
url.should.containEql("fromNetwork=btc");
|
|
@@ -1781,7 +1483,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1781
1483
|
{ coin: ETH, code: "eth", network: "eth", withdrawal: true },
|
|
1782
1484
|
{ coin: USDCTRC20, code: "usdc", network: "trc20" },
|
|
1783
1485
|
];
|
|
1784
|
-
axiosGetStub.callsFake(
|
|
1486
|
+
axiosGetStub.callsFake(url => {
|
|
1785
1487
|
url.should.containEql(`/api/v2/amounts`);
|
|
1786
1488
|
url.should.containEql("fromCurrency=usdc");
|
|
1787
1489
|
url.should.containEql("fromNetwork=trc20");
|
|
@@ -1813,22 +1515,14 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1813
1515
|
];
|
|
1814
1516
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
1815
1517
|
|
|
1816
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
1817
|
-
BTC,
|
|
1818
|
-
ETH,
|
|
1819
|
-
"1"
|
|
1820
|
-
);
|
|
1518
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
1821
1519
|
|
|
1822
1520
|
(result.durationMinutesRange === null).should.be.true();
|
|
1823
1521
|
});
|
|
1824
1522
|
|
|
1825
1523
|
it("should throw error when passing coins with unknown tickers or protocols", async () => {
|
|
1826
1524
|
try {
|
|
1827
|
-
await swapspaceSwapProvider.getSwapInfo(
|
|
1828
|
-
{ ticker: "unknownCoin" },
|
|
1829
|
-
ETH,
|
|
1830
|
-
"1"
|
|
1831
|
-
);
|
|
1525
|
+
await swapspaceSwapProvider.getSwapInfo({ ticker: "unknownCoin" }, ETH, "1");
|
|
1832
1526
|
} catch (error) {
|
|
1833
1527
|
error.should.be.an.instanceof(Error);
|
|
1834
1528
|
}
|
|
@@ -1877,16 +1571,10 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1877
1571
|
];
|
|
1878
1572
|
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
1879
1573
|
|
|
1880
|
-
const result = await swapspaceSwapProvider.getSwapInfo(
|
|
1881
|
-
BTC,
|
|
1882
|
-
ETH,
|
|
1883
|
-
"1"
|
|
1884
|
-
);
|
|
1574
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
1885
1575
|
|
|
1886
1576
|
result.result.should.be.false();
|
|
1887
|
-
result.reason.should.be.equal(
|
|
1888
|
-
SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED
|
|
1889
|
-
);
|
|
1577
|
+
result.reason.should.be.equal(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
|
|
1890
1578
|
});
|
|
1891
1579
|
});
|
|
1892
1580
|
});
|