@rabbitio/ui-kit 1.0.0-beta.89 → 1.0.0-beta.90
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 +7146 -2602
- package/coverage/coverage-final.json +181 -114
- package/coverage/index.html +374 -104
- 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 → ui-kit}/src/common-apis/adapters/analyticsAdapters/googleAnalyticsAdapter.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/adapters/analyticsAdapters/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/adapters/analyticsAdapters/metrikaAdapter.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/adapters/analyticsAdapters/mixpanelAdapter.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/adapters/axiosAdapter.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/adapters/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/adapters/qrUtils.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/external-apis/apiGroups.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/external-apis/emailAPI.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/external-apis/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/external-apis/ipAddressProviders.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/globalConstants.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/models/blockchain.js.html +6 -6
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/models/coin.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/models/index.html +20 -20
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/models/protocol.js.html +16 -16
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/services/fiatCurrenciesService.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/services/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/amountUtils.js.html +23 -23
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/cache.js.html +8 -8
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/errorUtils.js.html +15 -15
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/logging/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/logging/logger.js.html +23 -23
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/logging/logsStorage.js.html +5 -5
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/postponeExecution.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/rabbitTicker.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/safeStringify.js.html +36 -36
- package/coverage/{rabbit-ui-kit → ui-kit}/src/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/index.js.html +9 -6
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robust-api-caller/cacheAndConcurrentRequestsResolver.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robust-api-caller/cachedRobustExternalApiCallerService.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robust-api-caller/cancelProcessing.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robust-api-caller/concurrentCalculationsMetadataHolder.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robust-api-caller/externalApiProvider.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robust-api-caller/externalServicesStatsCollector.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robust-api-caller/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robust-api-caller/robustExternalAPICallerService.js.html +3 -3
- package/coverage/ui-kit/src/swaps-lib/external-apis/exolixSwapProvider.js.html +1813 -0
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/external-apis/index.html +41 -26
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/external-apis/letsExchangeSwapProvider.js.html +23 -14
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/external-apis/swapProvider.js.html +296 -392
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/external-apis/swapspaceSwapProvider.js.html +108 -138
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/baseSwapCreationInfo.js.html +21 -6
- package/coverage/ui-kit/src/swaps-lib/models/existingSwap.js.html +514 -0
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/existingSwapWithFiatData.js.html +147 -87
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/index.html +43 -43
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/partner.js.html +6 -6
- package/coverage/ui-kit/src/swaps-lib/models/swapProviderCoinInfo.js.html +331 -0
- 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 +76 -817
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/utils/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/utils/swapUtils.js.html +4 -4
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/arrowIcon.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/arrowTosca.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/arrowWhite.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/darkRectangle.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/determinedError.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/failedValidationIcon.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/infoIcon.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/messageIcon.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/noticeQuestionIcon.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/successfulValidationIcon.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/supportDialogImage.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/walletIcon.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/AssetIcon/AssetIcon.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/AssetIcon/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/AssetSelection/AssetSelection.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/AssetSelection/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/BackgroundTitle/BackgroundTitle.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/BackgroundTitle/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/InformationMessage/InformationMessage.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/InformationMessage/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/Input/Input.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/Input/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/LoadingDots/LoadingDots.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/LoadingDots/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/NoticeIcon/NoticeIcon.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/NoticeIcon/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/QrCode/QrCode.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/QrCode/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/RateSelector/RateSelector.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/RateSelector/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/SupportChat/SupportChat.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/SupportChat/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/Textarea/Textarea.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/Textarea/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/TitleBox/TitleBox.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/TitleBox/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/Tooltip/Tooltip.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/Tooltip/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/TwoLinesOfText/LinesOfText.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/TwoLinesOfText/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/Validation/Validation.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/Validation/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/buttons/Button/Button.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/buttons/Button/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/buttons/Close/Close.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/buttons/Close/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/buttons/LinkButton/LinkButton.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/buttons/LinkButton/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/buttons/RadioButtonWithText/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/AmountInput/AmountInput.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/AmountInput/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/CoinPicker/CoinPicker.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/CoinPicker/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/ColoredNotice/ColoredNotice.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/ColoredNotice/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/LineWithIconLink/LineWithIconLink.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/LineWithIconLink/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/LogoCarousel/LogoCarousel.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/LogoCarousel/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/SearchableCoinsList/SearchableCoinsList.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/SearchableCoinsList/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/TitledLineWithIconLink/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/CoinPickerDialogStep/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/Dialog/Dialog.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/Dialog/DialogButtons/DialogButtons.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/Dialog/DialogButtons/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/Dialog/DialogStep/DialogStep.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/Dialog/DialogStep/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/Dialog/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/SwapForm/SwapForm.jsx.html +13 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/SwapForm/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/WaitlistSubscription/WaitlistSubscription.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/WaitlistSubscription/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/templates/DeterminedErrorDialogStep/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/hooks/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/hooks/useCallHandlingErrors.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/hooks/useIsHydrated.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/hooks/useReferredState.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/utils/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/utils/inputValueProviders.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/utils/textUtils.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/utils/uiUtils.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/utils/urlQueryUtils.js.html +3 -3
- 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/AmountInput.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/molecules/CoinPicker.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/molecules/ColoredNotice.stories.jsx.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/LogoCarousel.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/organisms/WaitlistSubscription.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/stubs/coins.jsx.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/coverage/ui-kit/storybook-static/223.063dc770.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/230.7eace282.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/242.981bebe4.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/312.6f62bbd9.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/341.57a15f57.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/374.99dab897.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/506.c6cb656d.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/547.cc28f1fd.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/586.ec70f0e7.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/595.2e40d981.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/607.3ea32459.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/609.097df435.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/797.c87cdf19.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/889.a357fd2d.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/909.28bf3d7c.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/976.b5f1a5d4.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/996.07a638d5.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/atoms-BackgroundTitle-stories.1a5386a1.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/atoms-LinesOfText-stories.b7c8f08a.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/atoms-LoadingDots-stories.5180c2f1.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/atoms-QrCode-stories.006bd0cc.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/atoms-RateSelector-stories.19c65c98.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/atoms-Validation-stories.d561b311.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/atoms-buttons-Button-stories.e8e6b930.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/atoms-buttons-Close-stories.0a902a7c.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/atoms-buttons-LinkButton-stories.10813be5.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/index.html +656 -0
- package/coverage/ui-kit/storybook-static/main.54ca9836.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/molecules-ColoredNotice-stories.7a5d624e.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/molecules-LineWithIconLink-stories.b7f70ee2.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/molecules-LogoCarousel-stories.9be2ef69.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/molecules-TitledLineWithIconLink-stories.1383fe3f.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/organisms-Dialog-Dialog-stories.4e6da717.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/organisms-Dialog-DialogButtons-DialogButtons-stories.1d1f9803.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/organisms-Dialog-DialogStep-DialogStep-stories.74896048.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/organisms-WaitlistSubscription-stories.a7c49a29.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/dist/global.css.html +118 -0
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/dist/index.html +116 -0
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/@storybook/addon-backgrounds/dist/index.html +116 -0
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/@storybook/addon-backgrounds/dist/preview.js.html +118 -0
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/@storybook/components/dist/formatter-SWP5E3XI.mjs.html +118 -0
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/@storybook/components/dist/index.html +116 -0
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/buffer/index.html +116 -0
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/buffer/index.js.html +118 -0
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/markdown-to-jsx/dist/index.html +116 -0
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/markdown-to-jsx/dist/index.modern.js.html +118 -0
- package/coverage/ui-kit/storybook-static/runtime~main.bf0b2dcd.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/sb-addons/actions-9/index.html +116 -0
- package/coverage/ui-kit/storybook-static/sb-addons/actions-9/manager-bundle.js.html +94 -0
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-backgrounds-2/index.html +116 -0
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-backgrounds-2/manager-bundle.js.html +121 -0
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-controls-1/index.html +116 -0
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-controls-1/manager-bundle.js.html +274 -0
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-measure-4/index.html +116 -0
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-measure-4/manager-bundle.js.html +94 -0
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-outline-5/index.html +116 -0
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-outline-5/manager-bundle.js.html +94 -0
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-toolbars-3/index.html +116 -0
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-toolbars-3/manager-bundle.js.html +94 -0
- package/coverage/ui-kit/storybook-static/sb-addons/interactions-7/index.html +116 -0
- package/coverage/ui-kit/storybook-static/sb-addons/interactions-7/manager-bundle.js.html +121 -0
- package/coverage/ui-kit/storybook-static/sb-addons/links-0/index.html +116 -0
- package/coverage/ui-kit/storybook-static/sb-addons/links-0/manager-bundle.js.html +94 -0
- package/coverage/ui-kit/storybook-static/sb-addons/onboarding-6/index.html +116 -0
- package/coverage/ui-kit/storybook-static/sb-addons/onboarding-6/manager-bundle.js.html +1588 -0
- package/coverage/ui-kit/storybook-static/sb-addons/viewport-8/index.html +116 -0
- package/coverage/ui-kit/storybook-static/sb-addons/viewport-8/manager-bundle.js.html +94 -0
- package/coverage/ui-kit/storybook-static/sb-manager/WithTooltip-V3YHNWJZ-LVYLGZW2.js.html +88 -0
- package/coverage/ui-kit/storybook-static/sb-manager/chunk-2IXBUOFS.js.html +106 -0
- package/coverage/ui-kit/storybook-static/sb-manager/chunk-INSKDKQB.js.html +1129 -0
- package/coverage/ui-kit/storybook-static/sb-manager/chunk-NGTUFCUO.js.html +112 -0
- package/coverage/ui-kit/storybook-static/sb-manager/chunk-UUEAOBSN.js.html +1303 -0
- package/coverage/ui-kit/storybook-static/sb-manager/chunk-ZEU7PDD3.js.html +88 -0
- package/coverage/ui-kit/storybook-static/sb-manager/formatter-SWP5E3XI-7BGIK6BL.js.html +553 -0
- package/coverage/ui-kit/storybook-static/sb-manager/globals-module-info.js.html +88 -0
- package/coverage/ui-kit/storybook-static/sb-manager/globals.js.html +88 -0
- package/coverage/ui-kit/storybook-static/sb-manager/index.html +281 -0
- package/coverage/ui-kit/storybook-static/sb-manager/index.js.html +88 -0
- package/coverage/ui-kit/storybook-static/sb-manager/runtime.js.html +88 -0
- package/coverage/ui-kit/storybook-static/sb-manager/syntaxhighlighter-V7JZZA35-DXZCI2WR.js.html +88 -0
- package/coverage/ui-kit/storybook-static/sb-preview/globals.js.html +88 -0
- package/coverage/ui-kit/storybook-static/sb-preview/index.html +131 -0
- package/coverage/ui-kit/storybook-static/sb-preview/runtime.js.html +421 -0
- package/coverage/ui-kit/storybook-static/templates-DeterminedErrorDialogStep-stories.3cc14214.iframe.bundle.js.html +85 -0
- package/dist/index.cjs +1248 -904
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +577 -404
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +1172 -830
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +1249 -905
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/index.js +1 -0
- package/src/swaps-lib/external-apis/exolixSwapProvider.js +576 -0
- package/src/swaps-lib/external-apis/letsExchangeSwapProvider.js +11 -8
- package/src/swaps-lib/external-apis/swapProvider.js +16 -48
- package/src/swaps-lib/external-apis/swapspaceSwapProvider.js +15 -25
- package/src/swaps-lib/models/baseSwapCreationInfo.js +5 -0
- package/src/swaps-lib/models/existingSwap.js +92 -22
- package/src/swaps-lib/models/existingSwapWithFiatData.js +52 -32
- package/src/swaps-lib/models/swapProviderCoinInfo.js +6 -6
- package/src/swaps-lib/services/publicSwapService.js +70 -317
- package/src/swaps-lib/test/external-apis/exolixSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +34 -0
- package/src/swaps-lib/test/external-apis/exolixSwapProvider/createSwap.test.js +1043 -0
- package/src/swaps-lib/test/external-apis/exolixSwapProvider/getSwapInfo.test.js +611 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/createSwap.test.js +57 -92
- package/src/swaps-lib/utils/swapUtils.js +1 -1
- package/src/ui-kit/components/organisms/SwapForm/SwapForm.jsx +3 -1
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/existingSwap.js.html +0 -304
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/swapProviderCoinInfo.js.html +0 -331
|
@@ -0,0 +1,611 @@
|
|
|
1
|
+
import sinon from "sinon";
|
|
2
|
+
import axios from "axios";
|
|
3
|
+
import should from "should";
|
|
4
|
+
|
|
5
|
+
import { beforeEach, afterEach, describe, it } from "vitest";
|
|
6
|
+
|
|
7
|
+
import { SwapProvider } from "../../../external-apis/swapProvider.js";
|
|
8
|
+
import { ExolixSwapProvider } from "../../../external-apis/exolixSwapProvider.js";
|
|
9
|
+
import { Cache } from "../../../../common-apis/utils/cache.js";
|
|
10
|
+
import { AmountUtils } from "../../../../common-apis/utils/amountUtils.js";
|
|
11
|
+
import { Coin } from "../../../../common-apis/models/coin.js";
|
|
12
|
+
import { Blockchain } from "../../../../common-apis/models/blockchain.js";
|
|
13
|
+
|
|
14
|
+
describe("exolixSwapProvider", function () {
|
|
15
|
+
describe("getSwapInfo", function () {
|
|
16
|
+
const BTC = new Coin(
|
|
17
|
+
"Bitcoin",
|
|
18
|
+
"BTC",
|
|
19
|
+
"BTC",
|
|
20
|
+
8,
|
|
21
|
+
null,
|
|
22
|
+
"sat",
|
|
23
|
+
null,
|
|
24
|
+
null,
|
|
25
|
+
1,
|
|
26
|
+
null,
|
|
27
|
+
[],
|
|
28
|
+
null,
|
|
29
|
+
new Blockchain("Bitcoin")
|
|
30
|
+
);
|
|
31
|
+
const ETH = new Coin(
|
|
32
|
+
"Ethereum",
|
|
33
|
+
"ETH",
|
|
34
|
+
"ETH",
|
|
35
|
+
18,
|
|
36
|
+
null,
|
|
37
|
+
"wei",
|
|
38
|
+
null,
|
|
39
|
+
null,
|
|
40
|
+
1,
|
|
41
|
+
null,
|
|
42
|
+
[],
|
|
43
|
+
null,
|
|
44
|
+
new Blockchain("Ethereum")
|
|
45
|
+
);
|
|
46
|
+
const TRX = new Coin(
|
|
47
|
+
"Tron",
|
|
48
|
+
"TRX",
|
|
49
|
+
"TRX",
|
|
50
|
+
18,
|
|
51
|
+
null,
|
|
52
|
+
"sun",
|
|
53
|
+
null,
|
|
54
|
+
null,
|
|
55
|
+
1,
|
|
56
|
+
null,
|
|
57
|
+
[],
|
|
58
|
+
null,
|
|
59
|
+
new Blockchain("Tron")
|
|
60
|
+
);
|
|
61
|
+
const USDCTRC20 = new Coin(
|
|
62
|
+
"USDCTRC20",
|
|
63
|
+
"USDCTRC20",
|
|
64
|
+
"USDC",
|
|
65
|
+
6,
|
|
66
|
+
null,
|
|
67
|
+
"millicents",
|
|
68
|
+
null,
|
|
69
|
+
null,
|
|
70
|
+
1,
|
|
71
|
+
null,
|
|
72
|
+
[],
|
|
73
|
+
null,
|
|
74
|
+
new Blockchain("Tron")
|
|
75
|
+
);
|
|
76
|
+
const USDTERC20 = new Coin(
|
|
77
|
+
"USDTERC20",
|
|
78
|
+
"USDTERC20",
|
|
79
|
+
"USDT",
|
|
80
|
+
6,
|
|
81
|
+
null,
|
|
82
|
+
"millicents",
|
|
83
|
+
null,
|
|
84
|
+
null,
|
|
85
|
+
1,
|
|
86
|
+
null,
|
|
87
|
+
[],
|
|
88
|
+
null,
|
|
89
|
+
new Blockchain("Ethereum")
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
const mockResponse = {
|
|
93
|
+
fromAmount: 1,
|
|
94
|
+
toAmount: 2,
|
|
95
|
+
rate: 2,
|
|
96
|
+
message: null,
|
|
97
|
+
minAmount: 0.1,
|
|
98
|
+
withdrawMin: 0.001,
|
|
99
|
+
maxAmount: 1000,
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
let exolixSwapProvider;
|
|
103
|
+
let axiosGetStub;
|
|
104
|
+
let trimCryptoAmountByCoinStub;
|
|
105
|
+
let _fetchSupportedCurrenciesIfNeededStub;
|
|
106
|
+
let modifiedResponse;
|
|
107
|
+
|
|
108
|
+
beforeEach(() => {
|
|
109
|
+
exolixSwapProvider = new ExolixSwapProvider("", new Cache());
|
|
110
|
+
|
|
111
|
+
axiosGetStub = sinon.stub(axios, "get");
|
|
112
|
+
|
|
113
|
+
trimCryptoAmountByCoinStub = sinon.stub(AmountUtils, "trim");
|
|
114
|
+
trimCryptoAmountByCoinStub.callsFake(amount => amount?.toString());
|
|
115
|
+
|
|
116
|
+
_fetchSupportedCurrenciesIfNeededStub = sinon.stub(exolixSwapProvider, "_fetchSupportedCurrenciesIfNeeded");
|
|
117
|
+
_fetchSupportedCurrenciesIfNeededStub.resolves();
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
afterEach(() => {
|
|
121
|
+
sinon.restore();
|
|
122
|
+
modifiedResponse = undefined;
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it("should return a result of correct format when available exchanges are present", async () => {
|
|
126
|
+
exolixSwapProvider._supportedCoins = [
|
|
127
|
+
{ coin: BTC, code: "btc", network: "btc", deposit: true, isAvailable: true },
|
|
128
|
+
{ coin: ETH, code: "eth", network: "eth", withdrawal: true, isAvailable: true },
|
|
129
|
+
];
|
|
130
|
+
axiosGetStub.returns(Promise.resolve({ status: 200, data: mockResponse }));
|
|
131
|
+
|
|
132
|
+
const result = await exolixSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
133
|
+
|
|
134
|
+
result.result.should.be.true();
|
|
135
|
+
result.min.should.be.String();
|
|
136
|
+
result.max.should.be.String();
|
|
137
|
+
result.smallestMin.should.be.String();
|
|
138
|
+
result.greatestMax.should.be.String();
|
|
139
|
+
result.rate.should.be.String();
|
|
140
|
+
result.rawSwapData.should.be.Object();
|
|
141
|
+
result.fixed.should.be.Boolean();
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it("should return result with proper rate calculation if the selected exchange has toAmount, fromAmount and the coin usd rate is successfully retrieved", async () => {
|
|
145
|
+
exolixSwapProvider._supportedCoins = [
|
|
146
|
+
{ coin: BTC, code: "btc", network: "btc", deposit: true, isAvailable: true },
|
|
147
|
+
{ coin: ETH, code: "eth", network: "eth", withdrawal: true, isAvailable: true },
|
|
148
|
+
];
|
|
149
|
+
|
|
150
|
+
let modifiedResponse = { ...mockResponse };
|
|
151
|
+
delete modifiedResponse.rate;
|
|
152
|
+
|
|
153
|
+
axiosGetStub.returns(Promise.resolve({ status: 200, data: modifiedResponse }));
|
|
154
|
+
|
|
155
|
+
const result = await exolixSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
156
|
+
|
|
157
|
+
result.rate.should.be.equal("2");
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
it("should return a rawSwapData object for available exchanges", async () => {
|
|
161
|
+
exolixSwapProvider._supportedCoins = [
|
|
162
|
+
{ coin: BTC, code: "btc", network: "btc", deposit: true, isAvailable: true },
|
|
163
|
+
{ coin: ETH, code: "eth", network: "eth", withdrawal: true, isAvailable: true },
|
|
164
|
+
];
|
|
165
|
+
axiosGetStub.returns(Promise.resolve({ status: 200, data: mockResponse }));
|
|
166
|
+
|
|
167
|
+
const result = await exolixSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
168
|
+
|
|
169
|
+
result.rawSwapData.should.be.deepEqual(mockResponse);
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
it("should handle REQUESTS_LIMIT_EXCEEDED when axios returns a 429", async () => {
|
|
173
|
+
exolixSwapProvider._supportedCoins = [
|
|
174
|
+
{ coin: BTC, code: "btc", network: "btc", deposit: true, isAvailable: true },
|
|
175
|
+
{ coin: ETH, code: "eth", network: "eth", withdrawal: true, isAvailable: true },
|
|
176
|
+
];
|
|
177
|
+
axiosGetStub.returns(Promise.reject({ response: { status: 429 } }));
|
|
178
|
+
|
|
179
|
+
const result = await exolixSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
180
|
+
|
|
181
|
+
result.reason.should.be.equal(SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED);
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
it("should return TOO_HIGH when amount is above the maxAmount", async () => {
|
|
185
|
+
exolixSwapProvider._supportedCoins = [
|
|
186
|
+
{ coin: BTC, code: "btc", network: "btc", deposit: true, isAvailable: true },
|
|
187
|
+
{ coin: ETH, code: "eth", network: "eth", withdrawal: true, isAvailable: true },
|
|
188
|
+
];
|
|
189
|
+
|
|
190
|
+
axiosGetStub.returns(Promise.reject({ response: { status: 422, data: mockResponse } }));
|
|
191
|
+
|
|
192
|
+
const result = await exolixSwapProvider.getSwapInfo(BTC, ETH, "10000");
|
|
193
|
+
|
|
194
|
+
result.result.should.be.false();
|
|
195
|
+
result.reason.should.be.equal(SwapProvider.NO_SWAPS_REASONS.TOO_HIGH);
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
it("should return TOO_LOW when amount is below the minAmount", async () => {
|
|
199
|
+
exolixSwapProvider._supportedCoins = [
|
|
200
|
+
{ coin: BTC, code: "btc", network: "btc", deposit: true, isAvailable: true },
|
|
201
|
+
{ coin: ETH, code: "eth", network: "eth", withdrawal: true, isAvailable: true },
|
|
202
|
+
];
|
|
203
|
+
|
|
204
|
+
axiosGetStub.returns(Promise.reject({ response: { status: 422, data: mockResponse } }));
|
|
205
|
+
|
|
206
|
+
const result = await exolixSwapProvider.getSwapInfo(BTC, ETH, "0.001");
|
|
207
|
+
|
|
208
|
+
result.result.should.be.false();
|
|
209
|
+
result.reason.should.be.equal(SwapProvider.NO_SWAPS_REASONS.TOO_LOW);
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
it("should return NOT_SUPPORTED when the response is empty", async () => {
|
|
213
|
+
exolixSwapProvider._supportedCoins = [
|
|
214
|
+
{ coin: BTC, code: "btc", network: "btc", deposit: true, isAvailable: true },
|
|
215
|
+
{ coin: ETH, code: "eth", network: "eth", withdrawal: true, isAvailable: true },
|
|
216
|
+
];
|
|
217
|
+
axiosGetStub.returns(Promise.reject({ response: { status: 422, data: {} } }));
|
|
218
|
+
|
|
219
|
+
const result = await exolixSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
220
|
+
|
|
221
|
+
result.result.should.be.false();
|
|
222
|
+
result.reason.should.be.equal(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
it("should correctly handle when there is no numeric min", async () => {
|
|
226
|
+
exolixSwapProvider._supportedCoins = [
|
|
227
|
+
{ coin: BTC, code: "btc", network: "btc", deposit: true, isAvailable: true },
|
|
228
|
+
{ coin: ETH, code: "eth", network: "eth", withdrawal: true, isAvailable: true },
|
|
229
|
+
];
|
|
230
|
+
|
|
231
|
+
let modifiedResponse = { ...mockResponse };
|
|
232
|
+
modifiedResponse.minAmount = "SHOULDBENUMBER";
|
|
233
|
+
|
|
234
|
+
axiosGetStub.resolves({
|
|
235
|
+
status: 200,
|
|
236
|
+
data: modifiedResponse,
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
const result = await exolixSwapProvider.getSwapInfo(BTC, ETH, "10");
|
|
240
|
+
|
|
241
|
+
result.result.should.be.false();
|
|
242
|
+
(result.smallestMin === undefined).should.be.true();
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
it("should correctly handle when there is no numeric max", async () => {
|
|
246
|
+
exolixSwapProvider._supportedCoins = [
|
|
247
|
+
{ coin: BTC, code: "btc", network: "btc", deposit: true, isAvailable: true },
|
|
248
|
+
{ coin: ETH, code: "eth", network: "eth", withdrawal: true, isAvailable: true },
|
|
249
|
+
];
|
|
250
|
+
|
|
251
|
+
let modifiedResponse = { ...mockResponse };
|
|
252
|
+
modifiedResponse.maxAmount = "SHOULDBENUMBER";
|
|
253
|
+
|
|
254
|
+
axiosGetStub.resolves({
|
|
255
|
+
status: 200,
|
|
256
|
+
data: modifiedResponse,
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
const result = await exolixSwapProvider.getSwapInfo(BTC, ETH, "10");
|
|
260
|
+
|
|
261
|
+
result.result.should.be.false();
|
|
262
|
+
(result.greatestMax === undefined).should.be.true();
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
it("should handle general axios error", async () => {
|
|
266
|
+
exolixSwapProvider._supportedCoins = [
|
|
267
|
+
{ coin: BTC, code: "btc", network: "btc", deposit: true, isAvailable: true },
|
|
268
|
+
{ coin: ETH, code: "eth", network: "eth", withdrawal: true, isAvailable: true },
|
|
269
|
+
];
|
|
270
|
+
const error = new Error();
|
|
271
|
+
error.response = { status: 500 };
|
|
272
|
+
axiosGetStub.throws(error);
|
|
273
|
+
|
|
274
|
+
try {
|
|
275
|
+
await exolixSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
276
|
+
} catch (error) {
|
|
277
|
+
error.should.be.an.instanceof(Error);
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
it("should handle missing data in axios response", async () => {
|
|
282
|
+
exolixSwapProvider._supportedCoins = [
|
|
283
|
+
{ coin: BTC, code: "btc", network: "btc", deposit: true, isAvailable: true },
|
|
284
|
+
{ coin: ETH, code: "eth", network: "eth", withdrawal: true, isAvailable: true },
|
|
285
|
+
];
|
|
286
|
+
axiosGetStub.returns(Promise.resolve({}));
|
|
287
|
+
|
|
288
|
+
const result = await exolixSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
289
|
+
|
|
290
|
+
result.result.should.be.false();
|
|
291
|
+
result.reason.should.be.equal(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
it("should fail with not supported when fromAmount is not number greater than 0", async () => {
|
|
295
|
+
exolixSwapProvider._supportedCoins = [
|
|
296
|
+
{ coin: BTC, code: "btc", network: "btc", deposit: true, isAvailable: true },
|
|
297
|
+
{ coin: ETH, code: "eth", network: "eth", withdrawal: true, isAvailable: true },
|
|
298
|
+
];
|
|
299
|
+
|
|
300
|
+
let modifiedResponse = { ...mockResponse };
|
|
301
|
+
modifiedResponse.fromAmount = 0;
|
|
302
|
+
|
|
303
|
+
axiosGetStub.returns(Promise.resolve({ status: 200, data: modifiedResponse }));
|
|
304
|
+
|
|
305
|
+
const result = await exolixSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
306
|
+
|
|
307
|
+
result.result.should.be.false();
|
|
308
|
+
result.reason.should.be.equal(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
it("should fail with not supported when toAmount is not number greater than 0", async () => {
|
|
312
|
+
exolixSwapProvider._supportedCoins = [
|
|
313
|
+
{ coin: BTC, code: "btc", network: "btc", deposit: true, isAvailable: true },
|
|
314
|
+
{ coin: ETH, code: "eth", network: "eth", withdrawal: true, isAvailable: true },
|
|
315
|
+
];
|
|
316
|
+
|
|
317
|
+
let modifiedResponse = { ...mockResponse };
|
|
318
|
+
modifiedResponse.toAmount = 0;
|
|
319
|
+
|
|
320
|
+
axiosGetStub.returns(Promise.resolve({ status: 200, data: modifiedResponse }));
|
|
321
|
+
|
|
322
|
+
const result = await exolixSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
323
|
+
|
|
324
|
+
result.result.should.be.false();
|
|
325
|
+
result.reason.should.be.equal(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
it("should treat min=0 as unlimited and set to null", async () => {
|
|
329
|
+
exolixSwapProvider._supportedCoins = [
|
|
330
|
+
{ coin: BTC, code: "btc", network: "btc", deposit: true, isAvailable: true },
|
|
331
|
+
{ coin: ETH, code: "eth", network: "eth", withdrawal: true, isAvailable: true },
|
|
332
|
+
];
|
|
333
|
+
let modifiedResponse = { ...mockResponse };
|
|
334
|
+
modifiedResponse.minAmount = 0;
|
|
335
|
+
|
|
336
|
+
axiosGetStub.returns(Promise.resolve({ status: 200, data: modifiedResponse }));
|
|
337
|
+
|
|
338
|
+
const result = await exolixSwapProvider.getSwapInfo(BTC, ETH, "100");
|
|
339
|
+
|
|
340
|
+
result.result.should.be.true();
|
|
341
|
+
(result.smallestMin === null).should.be.true();
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
it("should treat max=0 as unlimited and set to null", async () => {
|
|
345
|
+
exolixSwapProvider._supportedCoins = [
|
|
346
|
+
{ coin: BTC, code: "btc", network: "btc", deposit: true, isAvailable: true },
|
|
347
|
+
{ coin: ETH, code: "eth", network: "eth", withdrawal: true, isAvailable: true },
|
|
348
|
+
];
|
|
349
|
+
let modifiedResponse = { ...mockResponse };
|
|
350
|
+
modifiedResponse.maxAmount = 0;
|
|
351
|
+
|
|
352
|
+
axiosGetStub.returns(Promise.resolve({ status: 200, data: modifiedResponse }));
|
|
353
|
+
|
|
354
|
+
const result = await exolixSwapProvider.getSwapInfo(BTC, ETH, "100");
|
|
355
|
+
|
|
356
|
+
result.result.should.be.true();
|
|
357
|
+
(result.greatestMax === null).should.be.true();
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
it("should handle exchanges with non-numeric toAmount", async () => {
|
|
361
|
+
exolixSwapProvider._supportedCoins = [
|
|
362
|
+
{ coin: BTC, code: "btc", network: "btc", deposit: true, isAvailable: true },
|
|
363
|
+
{ coin: ETH, code: "eth", network: "eth", withdrawal: true, isAvailable: true },
|
|
364
|
+
];
|
|
365
|
+
let modifiedResponse = { ...mockResponse };
|
|
366
|
+
modifiedResponse.toAmount = "SHOULDBENUMBER";
|
|
367
|
+
|
|
368
|
+
axiosGetStub.returns(Promise.resolve({ status: 200, data: modifiedResponse }));
|
|
369
|
+
|
|
370
|
+
const result = await exolixSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
371
|
+
|
|
372
|
+
result.result.should.be.false();
|
|
373
|
+
result.reason.should.be.equal(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
it("should consider min > max as an invalid exchange option", async () => {
|
|
377
|
+
exolixSwapProvider._supportedCoins = [
|
|
378
|
+
{ coin: BTC, code: "btc", network: "btc", deposit: true, isAvailable: true },
|
|
379
|
+
{ coin: ETH, code: "eth", network: "eth", withdrawal: true, isAvailable: true },
|
|
380
|
+
];
|
|
381
|
+
|
|
382
|
+
let modifiedResponse = { ...mockResponse };
|
|
383
|
+
modifiedResponse.minAmount = 5;
|
|
384
|
+
modifiedResponse.maxAmount = 1;
|
|
385
|
+
|
|
386
|
+
axiosGetStub.returns(Promise.resolve({ status: 200, data: modifiedResponse }));
|
|
387
|
+
|
|
388
|
+
const result = await exolixSwapProvider.getSwapInfo(BTC, ETH, "10");
|
|
389
|
+
|
|
390
|
+
result.result.should.be.false();
|
|
391
|
+
result.reason.should.be.equal(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
it("should consider an exchange with negative fromAmount as not supporting the pair", async () => {
|
|
395
|
+
exolixSwapProvider._supportedCoins = [
|
|
396
|
+
{ coin: BTC, code: "btc", network: "btc", deposit: true, isAvailable: true },
|
|
397
|
+
{ coin: ETH, code: "eth", network: "eth", withdrawal: true, isAvailable: true },
|
|
398
|
+
];
|
|
399
|
+
|
|
400
|
+
let modifiedResponse = { ...mockResponse };
|
|
401
|
+
modifiedResponse.fromAmount = -1;
|
|
402
|
+
|
|
403
|
+
axiosGetStub.returns(Promise.resolve({ status: 200, data: modifiedResponse }));
|
|
404
|
+
|
|
405
|
+
const result = await exolixSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
406
|
+
|
|
407
|
+
result.result.should.be.false();
|
|
408
|
+
result.reason.should.be.equal(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
|
|
409
|
+
});
|
|
410
|
+
|
|
411
|
+
it("should consider an exchange with negative toAmount as not supporting the pair", async () => {
|
|
412
|
+
exolixSwapProvider._supportedCoins = [
|
|
413
|
+
{ coin: BTC, code: "btc", network: "btc", deposit: true, isAvailable: true },
|
|
414
|
+
{ coin: ETH, code: "eth", network: "eth", withdrawal: true, isAvailable: true },
|
|
415
|
+
];
|
|
416
|
+
|
|
417
|
+
let modifiedResponse = { ...mockResponse };
|
|
418
|
+
modifiedResponse.toAmount = -1;
|
|
419
|
+
|
|
420
|
+
axiosGetStub.returns(Promise.resolve({ status: 200, data: modifiedResponse }));
|
|
421
|
+
|
|
422
|
+
const result = await exolixSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
423
|
+
|
|
424
|
+
result.result.should.be.false();
|
|
425
|
+
result.reason.should.be.equal(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
it(`should use toNetwork from _supportedCoins`, async () => {
|
|
429
|
+
const expToNetwork = "slkjfn2";
|
|
430
|
+
exolixSwapProvider._supportedCoins = [
|
|
431
|
+
{ coin: BTC, network: "btc" },
|
|
432
|
+
{ coin: ETH, network: expToNetwork },
|
|
433
|
+
];
|
|
434
|
+
|
|
435
|
+
// TODO: Not working, test and fix
|
|
436
|
+
axiosGetStub.callsFake((url, config) => {
|
|
437
|
+
(config.params?.networkTo === expToNetwork).should.be.false();
|
|
438
|
+
return Promise.resolve({ data: [] });
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
await exolixSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
it(`should use fromNetwork from _supportedCoins`, async () => {
|
|
445
|
+
const expNetwork = "slkjfn2";
|
|
446
|
+
exolixSwapProvider._supportedCoins = [
|
|
447
|
+
{ coin: BTC, network: expNetwork },
|
|
448
|
+
{ coin: ETH, network: "eth" },
|
|
449
|
+
];
|
|
450
|
+
|
|
451
|
+
// TODO: Not working, test and fix
|
|
452
|
+
axiosGetStub.callsFake((url, config) => {
|
|
453
|
+
(config.params?.networkFrom === expNetwork).should.be.true();
|
|
454
|
+
return Promise.resolve({ data: [] });
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
await exolixSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
458
|
+
});
|
|
459
|
+
|
|
460
|
+
it("should respect the fixed=false parameter in the axios request", async () => {
|
|
461
|
+
exolixSwapProvider._supportedCoins = [
|
|
462
|
+
{ coin: BTC, code: "btc", network: "btc", deposit: true, isAvailable: true },
|
|
463
|
+
{ coin: ETH, code: "eth", network: "eth", withdrawal: true, isAvailable: true },
|
|
464
|
+
];
|
|
465
|
+
axiosGetStub.callsFake((url, config) => {
|
|
466
|
+
(config.params?.rateType === "float").should.be.true();
|
|
467
|
+
return Promise.resolve({ data: [] });
|
|
468
|
+
});
|
|
469
|
+
|
|
470
|
+
await exolixSwapProvider.getSwapInfo(BTC, ETH, "1", false);
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
it("should respect the fixed=true parameter in the axios request", async () => {
|
|
474
|
+
exolixSwapProvider._supportedCoins = [
|
|
475
|
+
{ coin: BTC, code: "btc", network: "btc", deposit: true, isAvailable: true },
|
|
476
|
+
{ coin: ETH, code: "eth", network: "eth", withdrawal: true, isAvailable: true },
|
|
477
|
+
];
|
|
478
|
+
axiosGetStub.callsFake((url, config) => {
|
|
479
|
+
(config.params?.rateType === "fixed").should.be.true();
|
|
480
|
+
return Promise.resolve({ data: [] });
|
|
481
|
+
});
|
|
482
|
+
|
|
483
|
+
await exolixSwapProvider.getSwapInfo(BTC, ETH, "1", true);
|
|
484
|
+
});
|
|
485
|
+
|
|
486
|
+
it("should respect amount parameter in the axios request", async () => {
|
|
487
|
+
exolixSwapProvider._supportedCoins = [
|
|
488
|
+
{ coin: BTC, code: "btc", network: "btc", deposit: true, isAvailable: true },
|
|
489
|
+
{ coin: ETH, code: "eth", network: "eth", withdrawal: true, isAvailable: true },
|
|
490
|
+
];
|
|
491
|
+
axiosGetStub.callsFake((url, config) => {
|
|
492
|
+
(config.params?.amount === "1").should.be.true();
|
|
493
|
+
return Promise.resolve({ data: [] });
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
await exolixSwapProvider.getSwapInfo(BTC, ETH, "1", true);
|
|
497
|
+
});
|
|
498
|
+
|
|
499
|
+
it("should pass the from code from supportedCoins as parameter in the axios request", async () => {
|
|
500
|
+
exolixSwapProvider._supportedCoins = [
|
|
501
|
+
{ coin: BTC, code: "aaa", network: "btc" },
|
|
502
|
+
{ coin: ETH, code: "eth", network: "eth" },
|
|
503
|
+
];
|
|
504
|
+
// TODO: Not working, test and fix
|
|
505
|
+
axiosGetStub.callsFake((url, config) => {
|
|
506
|
+
(config.params?.coinFrom === "aaa").should.be.true();
|
|
507
|
+
return Promise.resolve({ data: [] });
|
|
508
|
+
});
|
|
509
|
+
|
|
510
|
+
await exolixSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
511
|
+
});
|
|
512
|
+
|
|
513
|
+
it("should pass the to code from supportedCoins as parameter in the axios request", async () => {
|
|
514
|
+
exolixSwapProvider._supportedCoins = [
|
|
515
|
+
{ coin: BTC, code: "btc", network: "btc" },
|
|
516
|
+
{ coin: ETH, code: "aaa", network: "eth" },
|
|
517
|
+
];
|
|
518
|
+
// TODO: Not working, test and fix
|
|
519
|
+
axiosGetStub.callsFake((url, config) => {
|
|
520
|
+
(config.params?.coinTo === "aaa").should.be.true();
|
|
521
|
+
return Promise.resolve({ data: [] });
|
|
522
|
+
});
|
|
523
|
+
|
|
524
|
+
await exolixSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
525
|
+
});
|
|
526
|
+
|
|
527
|
+
it("should generate correct URL for TRX to ERC20 USDT swap", async () => {
|
|
528
|
+
exolixSwapProvider._supportedCoins = [
|
|
529
|
+
{ coin: TRX, code: "trx", network: "trx" },
|
|
530
|
+
{ coin: USDTERC20, code: "usdt", network: "erc20" },
|
|
531
|
+
];
|
|
532
|
+
// TODO: Not working, test and fix
|
|
533
|
+
axiosGetStub.callsFake((url, config) => {
|
|
534
|
+
(config.params?.coinFrom === "trx").should.be.true();
|
|
535
|
+
(config.params?.networkFrom === "trx").should.be.true();
|
|
536
|
+
(config.params?.coinTo === "usdt").should.be.true();
|
|
537
|
+
(config.params?.networkTo === "erc20").should.be.true();
|
|
538
|
+
(config.params?.amount === "100").should.be.true();
|
|
539
|
+
(config.params?.rateType === "float").should.be.true();
|
|
540
|
+
return Promise.resolve({ data: [] });
|
|
541
|
+
});
|
|
542
|
+
|
|
543
|
+
await exolixSwapProvider.getSwapInfo(TRX, USDTERC20, "100");
|
|
544
|
+
});
|
|
545
|
+
|
|
546
|
+
it("should generate correct URL for BTC to ETH swap", async () => {
|
|
547
|
+
exolixSwapProvider._supportedCoins = [
|
|
548
|
+
{ coin: BTC, code: "btc", network: "btc", deposit: true, isAvailable: true },
|
|
549
|
+
{ coin: ETH, code: "eth", network: "eth", withdrawal: true, isAvailable: true },
|
|
550
|
+
];
|
|
551
|
+
axiosGetStub.callsFake((url, config) => {
|
|
552
|
+
url.should.containEql(`/api/v2/rate`);
|
|
553
|
+
(config.params?.coinFrom === "btc").should.be.true();
|
|
554
|
+
(config.params?.networkFrom === "btc").should.be.true();
|
|
555
|
+
(config.params?.coinTo === "eth").should.be.true();
|
|
556
|
+
(config.params?.networkTo === "eth").should.be.true();
|
|
557
|
+
(config.params?.amount === "1").should.be.true();
|
|
558
|
+
(config.params?.rateType === "float").should.be.true();
|
|
559
|
+
return Promise.resolve({ data: [] });
|
|
560
|
+
});
|
|
561
|
+
|
|
562
|
+
await exolixSwapProvider.getSwapInfo(BTC, ETH, "1", false);
|
|
563
|
+
});
|
|
564
|
+
|
|
565
|
+
it("should generate correct URL for TRC20 USDC to BTC swap", async () => {
|
|
566
|
+
exolixSwapProvider._supportedCoins = [
|
|
567
|
+
{ coin: BTC, code: "btc", network: "btc", deposit: true, isAvailable: true },
|
|
568
|
+
{ coin: ETH, code: "eth", network: "eth", withdrawal: true, isAvailable: true },
|
|
569
|
+
{ coin: USDCTRC20, code: "usdc", network: "trc20" },
|
|
570
|
+
];
|
|
571
|
+
// TODO: Not working, test and fix
|
|
572
|
+
axiosGetStub.callsFake(url => {
|
|
573
|
+
url.should.containEql(`/api/v2/rate`);
|
|
574
|
+
(config.params?.coinFrom === "usdc").should.be.true();
|
|
575
|
+
(config.params?.networkFrom === "trc20").should.be.true();
|
|
576
|
+
(config.params?.coinTo === "btc").should.be.true();
|
|
577
|
+
(config.params?.networkTo === "btc").should.be.true();
|
|
578
|
+
(config.params?.amount === "50.0235").should.be.true();
|
|
579
|
+
(config.params?.rateType === "float").should.be.true();
|
|
580
|
+
|
|
581
|
+
return Promise.resolve({ data: [] });
|
|
582
|
+
});
|
|
583
|
+
|
|
584
|
+
await exolixSwapProvider.getSwapInfo(USDCTRC20, BTC, "50.0235");
|
|
585
|
+
});
|
|
586
|
+
|
|
587
|
+
it("should throw error when passing coins with unknown tickers or protocols", async () => {
|
|
588
|
+
try {
|
|
589
|
+
await exolixSwapProvider.getSwapInfo({ ticker: "unknownCoin" }, ETH, "1");
|
|
590
|
+
} catch (error) {
|
|
591
|
+
error.should.be.an.instanceof(Error);
|
|
592
|
+
}
|
|
593
|
+
});
|
|
594
|
+
|
|
595
|
+
it("should throw error for non-string amountCoins input", async () => {
|
|
596
|
+
try {
|
|
597
|
+
await exolixSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
598
|
+
} catch (error) {
|
|
599
|
+
error.should.be.an.instanceof(Error);
|
|
600
|
+
}
|
|
601
|
+
});
|
|
602
|
+
|
|
603
|
+
it("should throw error for negative amountCoins input", async () => {
|
|
604
|
+
try {
|
|
605
|
+
await exolixSwapProvider.getSwapInfo(BTC, ETH, -1);
|
|
606
|
+
} catch (error) {
|
|
607
|
+
error.should.be.an.instanceof(Error);
|
|
608
|
+
}
|
|
609
|
+
});
|
|
610
|
+
});
|
|
611
|
+
});
|