@rabbitio/ui-kit 1.0.0-beta.12 → 1.0.0-beta.121
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/.env.example +1 -0
- package/.gitlab-ci.yml +29 -0
- package/.husky/commit-msg +19 -0
- package/.husky/pre-push +1 -0
- package/README.md +14 -4
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/clover.xml +19749 -0
- package/coverage/coverage-final.json +122 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +1001 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/rabbit-ui-kit/index.html +116 -0
- package/coverage/rabbit-ui-kit/index.js.html +88 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/analyticsAdapters/googleAnalyticsAdapter.js.html +151 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/analyticsAdapters/index.html +146 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/analyticsAdapters/metrikaAdapter.js.html +172 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/analyticsAdapters/mixpanelAdapter.js.html +199 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/axiosAdapter.js.html +190 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/index.html +131 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/qrUtils.js.html +139 -0
- package/coverage/rabbit-ui-kit/src/common-apis/external-apis/apiGroups.js.html +253 -0
- package/coverage/rabbit-ui-kit/src/common-apis/external-apis/emailAPI.js.html +133 -0
- package/coverage/rabbit-ui-kit/src/common-apis/external-apis/index.html +146 -0
- package/coverage/rabbit-ui-kit/src/common-apis/external-apis/ipAddressProviders.js.html +391 -0
- package/coverage/rabbit-ui-kit/src/common-apis/globalConstants.jsx.html +94 -0
- package/coverage/rabbit-ui-kit/src/common-apis/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/common-apis/models/blockchain.js.html +115 -0
- package/coverage/rabbit-ui-kit/src/common-apis/models/coin.js.html +829 -0
- package/coverage/rabbit-ui-kit/src/common-apis/models/index.html +146 -0
- package/coverage/rabbit-ui-kit/src/common-apis/models/protocol.js.html +100 -0
- package/coverage/rabbit-ui-kit/src/common-apis/services/fiatCurrenciesService.js.html +544 -0
- package/coverage/rabbit-ui-kit/src/common-apis/services/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/amountUtils.js.html +1234 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/cache.js.html +811 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/errorUtils.js.html +211 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/index.html +191 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/logging/index.html +131 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/logging/logger.js.html +211 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/logging/logsStorage.js.html +268 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/postponeExecution.js.html +118 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/rabbitTicker.js.html +157 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/safeStringify.js.html +235 -0
- package/coverage/rabbit-ui-kit/src/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/index.js.html +388 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/cacheAndConcurrentRequestsResolver.js.html +1660 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/cachedRobustExternalApiCallerService.js.html +526 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/cancelProcessing.js.html +172 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/concurrentCalculationsMetadataHolder.js.html +310 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/externalApiProvider.js.html +553 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/externalServicesStatsCollector.js.html +319 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/index.html +206 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/robustExternalAPICallerService.js.html +997 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/changeHeroSwapProvider.js.html +2800 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/changeNowSwapProvider.js.html +2644 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/exolixSwapProvider.js.html +1942 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/goexmeSwapProvider.js.html +2389 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/index.html +236 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/letsExchangeSwapProvider.js.html +1666 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/retriableErrorsUtils.js.html +274 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/swapProvider.js.html +1888 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/swapspaceSwapProvider.js.html +1981 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/utils.js.html +163 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/baseSwapCreationInfo.js.html +319 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/existingSwap.js.html +514 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/existingSwapWithFiatData.js.html +529 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/index.html +176 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/partner.js.html +166 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/swapProviderCoinInfo.js.html +337 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/services/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/services/publicSwapService.js.html +1654 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/utils/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/utils/swapUtils.js.html +706 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/arrowIcon.jsx.html +124 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/arrowTosca.jsx.html +127 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/arrowWhite.jsx.html +127 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/darkRectangle.jsx.html +106 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/determinedError.jsx.html +439 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/failedValidationIcon.jsx.html +202 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/index.html +281 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/infoIcon.jsx.html +133 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/messageIcon.jsx.html +346 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/noticeQuestionIcon.jsx.html +247 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/successfulValidationIcon.jsx.html +163 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/supportDialogImage.jsx.html +268 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/walletIcon.jsx.html +151 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/AssetIcon/AssetIcon.jsx.html +256 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/AssetIcon/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/AssetSelection/AssetSelection.jsx.html +289 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/AssetSelection/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/BackgroundTitle/BackgroundTitle.jsx.html +187 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/BackgroundTitle/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/InformationMessage/InformationMessage.jsx.html +238 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/InformationMessage/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Input/Input.jsx.html +634 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Input/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/LoadingDots/LoadingDots.jsx.html +196 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/LoadingDots/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/NoticeIcon/NoticeIcon.jsx.html +277 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/NoticeIcon/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/QrCode/QrCode.jsx.html +199 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/QrCode/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/RateSelector/RateSelector.jsx.html +175 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/RateSelector/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/SupportChat/SupportChat.jsx.html +217 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/SupportChat/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Textarea/Textarea.jsx.html +529 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Textarea/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TitleBox/TitleBox.jsx.html +508 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TitleBox/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Tooltip/Tooltip.jsx.html +316 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Tooltip/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TwoLinesOfText/LinesOfText.jsx.html +313 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TwoLinesOfText/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Validation/Validation.jsx.html +202 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Validation/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/Button/Button.jsx.html +733 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/Button/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/Close/Close.jsx.html +259 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/Close/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/LinkButton/LinkButton.jsx.html +433 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/LinkButton/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx.html +415 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/RadioButtonWithText/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/AmountInput/AmountInput.jsx.html +1429 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/AmountInput/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/CoinPicker/CoinPicker.jsx.html +1474 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/CoinPicker/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/ColoredNotice/ColoredNotice.jsx.html +241 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/ColoredNotice/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/LineWithIconLink/LineWithIconLink.jsx.html +190 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/LineWithIconLink/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/LogoCarousel/LogoCarousel.jsx.html +307 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/LogoCarousel/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/SearchableCoinsList/SearchableCoinsList.jsx.html +427 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/SearchableCoinsList/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx.html +181 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/TitledLineWithIconLink/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx.html +283 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/CoinPickerDialogStep/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/Dialog.jsx.html +1567 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/DialogButtons/DialogButtons.jsx.html +481 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/DialogButtons/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/DialogStep/DialogStep.jsx.html +1747 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/DialogStep/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/SwapForm/SwapForm.jsx.html +4375 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/SwapForm/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/WaitlistSubscription/WaitlistSubscription.jsx.html +559 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/WaitlistSubscription/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx.html +316 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/templates/DeterminedErrorDialogStep/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/hooks/index.html +146 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/hooks/useCallHandlingErrors.js.html +166 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/hooks/useIsHydrated.js.html +121 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/hooks/useReferredState.js.html +157 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/utils/index.html +176 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/utils/inputValueProviders.js.html +235 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/utils/searchCoins.js.html +259 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/utils/textUtils.js.html +139 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/utils/uiUtils.js.html +121 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/utils/urlQueryUtils.js.html +271 -0
- package/coverage/rabbit-ui-kit/stories/atoms/BackgroundTitle.stories.jsx.html +202 -0
- package/coverage/rabbit-ui-kit/stories/atoms/LinesOfText.stories.jsx.html +283 -0
- package/coverage/rabbit-ui-kit/stories/atoms/LoadingDots.stories.jsx.html +226 -0
- package/coverage/rabbit-ui-kit/stories/atoms/QrCode.stories.jsx.html +175 -0
- package/coverage/rabbit-ui-kit/stories/atoms/RateSelector.stories.jsx.html +136 -0
- package/coverage/rabbit-ui-kit/stories/atoms/Validation.stories.jsx.html +178 -0
- package/coverage/rabbit-ui-kit/stories/atoms/buttons/Button.stories.jsx.html +883 -0
- package/coverage/rabbit-ui-kit/stories/atoms/buttons/Close.stories.jsx.html +211 -0
- package/coverage/rabbit-ui-kit/stories/atoms/buttons/LinkButton.stories.jsx.html +301 -0
- package/coverage/rabbit-ui-kit/stories/atoms/buttons/index.html +146 -0
- package/coverage/rabbit-ui-kit/stories/atoms/index.html +191 -0
- package/coverage/rabbit-ui-kit/stories/molecules/AmountInput.stories.jsx.html +289 -0
- package/coverage/rabbit-ui-kit/stories/molecules/CoinPicker.stories.jsx.html +322 -0
- package/coverage/rabbit-ui-kit/stories/molecules/ColoredNotice.stories.jsx.html +178 -0
- package/coverage/rabbit-ui-kit/stories/molecules/LineWithIconLink.stories.jsx.html +154 -0
- package/coverage/rabbit-ui-kit/stories/molecules/LogoCarousel.stories.jsx.html +235 -0
- package/coverage/rabbit-ui-kit/stories/molecules/TitledLineWithIconLink.stories.jsx.html +160 -0
- package/coverage/rabbit-ui-kit/stories/molecules/index.html +191 -0
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/Dialog.stories.jsx.html +523 -0
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogButtons/DialogButtons.stories.jsx.html +328 -0
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogButtons/index.html +116 -0
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogStep/DialogStep.stories.jsx.html +337 -0
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogStep/index.html +116 -0
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/index.html +116 -0
- package/coverage/rabbit-ui-kit/stories/organisms/WaitlistSubscription.stories.jsx.html +151 -0
- package/coverage/rabbit-ui-kit/stories/organisms/index.html +116 -0
- package/coverage/rabbit-ui-kit/stories/stubs/coins.jsx.html +6880 -0
- package/coverage/rabbit-ui-kit/stories/stubs/exampleContent.jsx.html +145 -0
- package/coverage/rabbit-ui-kit/stories/stubs/index.html +131 -0
- package/coverage/rabbit-ui-kit/stories/templates/DeterminedErrorDialogStep.stories.jsx.html +190 -0
- package/coverage/rabbit-ui-kit/stories/templates/index.html +116 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +196 -0
- package/dist/global.css +197 -0
- package/dist/global.css.map +1 -0
- package/dist/index.cjs +15089 -1593
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +2352 -8493
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +11801 -1298
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +15003 -1594
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +15081 -1596
- package/dist/index.umd.js.map +1 -1
- package/package.json +35 -9
- package/raw +1000 -0
- package/src/common-apis/adapters/analyticsAdapters/googleAnalyticsAdapter.js +22 -0
- package/src/common-apis/adapters/analyticsAdapters/metrikaAdapter.js +29 -0
- package/src/common-apis/adapters/analyticsAdapters/mixpanelAdapter.js +38 -0
- package/src/common-apis/adapters/axiosAdapter.js +35 -0
- package/src/common-apis/adapters/qrUtils.js +18 -0
- package/src/common-apis/external-apis/apiGroups.js +56 -0
- package/src/common-apis/external-apis/emailAPI.js +16 -0
- package/src/common-apis/external-apis/ipAddressProviders.js +102 -0
- package/src/common-apis/globalConstants.jsx +3 -0
- package/src/{common → common-apis}/models/coin.js +98 -7
- package/src/{common → common-apis/services}/fiatCurrenciesService.js +4 -12
- package/src/common-apis/tests/integration/external-apis/ipAddressProviders/getClientIpAddress.test.js +18 -0
- package/src/common-apis/tests/units/utils/amountUtils/composeRateText.test.js +152 -0
- package/src/{common → common-apis/utils}/amountUtils.js +100 -140
- package/src/{common → common-apis}/utils/cache.js +15 -41
- package/src/{common → common-apis/utils}/errorUtils.js +15 -0
- package/src/{common → common-apis}/utils/logging/logger.js +7 -13
- package/src/common-apis/utils/postponeExecution.js +11 -0
- package/src/common-apis/utils/rabbitTicker.js +24 -0
- package/src/index.js +91 -14
- package/src/robust-api-caller/cacheAndConcurrentRequestsResolver.js +525 -0
- package/src/robust-api-caller/cachedRobustExternalApiCallerService.js +147 -0
- package/src/robust-api-caller/cancelProcessing.js +29 -0
- package/src/robust-api-caller/concurrentCalculationsMetadataHolder.js +75 -0
- package/src/robust-api-caller/externalApiProvider.js +156 -0
- package/src/robust-api-caller/externalServicesStatsCollector.js +78 -0
- package/src/robust-api-caller/robustExternalAPICallerService.js +304 -0
- package/src/robust-api-caller/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/_performCallAttempt.test.js +533 -0
- package/src/robust-api-caller/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/callExternalAPI.test.js +532 -0
- package/src/robust-api-caller/tests/robustExternalAPICallerService/robustExternalAPICallerService/constructor.test.js +19 -0
- package/src/swaps-lib/external-apis/changeHeroSwapProvider.js +905 -0
- package/src/swaps-lib/external-apis/changeNowSwapProvider.js +853 -0
- package/src/swaps-lib/external-apis/exolixSwapProvider.js +619 -0
- package/src/swaps-lib/external-apis/goexmeSwapProvider.js +768 -0
- package/src/swaps-lib/external-apis/letsExchangeSwapProvider.js +527 -0
- package/src/swaps-lib/external-apis/retriableErrorsUtils.js +63 -0
- package/src/swaps-lib/external-apis/swapProvider.js +457 -25
- package/src/swaps-lib/external-apis/swapspaceSwapProvider.js +320 -486
- package/src/swaps-lib/external-apis/utils.js +26 -0
- package/src/swaps-lib/models/baseSwapCreationInfo.js +78 -0
- package/src/swaps-lib/models/existingSwap.js +101 -16
- package/src/swaps-lib/models/existingSwapWithFiatData.js +148 -0
- package/src/swaps-lib/models/partner.js +27 -0
- package/src/swaps-lib/models/swapProviderCoinInfo.js +84 -0
- package/src/swaps-lib/services/publicSwapService.js +523 -0
- package/src/swaps-lib/test/external-apis/changeHeroSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +155 -0
- package/src/swaps-lib/test/external-apis/changeHeroSwapProvider/createSwap.test.js +702 -0
- package/src/swaps-lib/test/external-apis/changeHeroSwapProvider/getExistingSwapsDetailsAndStatus.test.js +501 -0
- package/src/swaps-lib/test/external-apis/changeHeroSwapProvider/getSwapInfo.test.js +425 -0
- package/src/swaps-lib/test/external-apis/changeNowSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +83 -0
- package/src/swaps-lib/test/external-apis/changeNowSwapProvider/_providerHelpers.test.js +54 -0
- package/src/swaps-lib/test/external-apis/changeNowSwapProvider/_validateAddressWithProvider.test.js +49 -0
- package/src/swaps-lib/test/external-apis/changeNowSwapProvider/createSwap.test.js +938 -0
- package/src/swaps-lib/test/external-apis/changeNowSwapProvider/getExistingSwapsDetailsAndStatus.test.js +353 -0
- package/src/swaps-lib/test/external-apis/changeNowSwapProvider/getSwapInfo.test.js +342 -0
- package/src/swaps-lib/test/external-apis/exolixSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +34 -0
- package/src/swaps-lib/test/external-apis/exolixSwapProvider/createSwap.test.js +1081 -0
- package/src/swaps-lib/test/external-apis/exolixSwapProvider/getSwapInfo.test.js +611 -0
- package/src/swaps-lib/test/external-apis/goexmeSwapProvider/_convertCurrencyMeta.test.js +95 -0
- package/src/swaps-lib/test/external-apis/goexmeSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +75 -0
- package/src/swaps-lib/test/external-apis/goexmeSwapProvider/createSwap.test.js +225 -0
- package/src/swaps-lib/test/external-apis/goexmeSwapProvider/getExistingSwapsDetailsAndStatus.test.js +175 -0
- package/src/swaps-lib/test/external-apis/goexmeSwapProvider/getSwapInfo.test.js +177 -0
- package/src/swaps-lib/test/external-apis/goexmeSwapProvider/helpers.test.js +26 -0
- package/src/swaps-lib/test/external-apis/goexmeSwapProvider/integration/PairSupport.int.test.js +69 -0
- package/src/swaps-lib/test/external-apis/goexmeSwapProvider/integration/_fetchSupportedCurrenciesIfNeeded.int.test.js +307 -0
- package/src/swaps-lib/test/external-apis/goexmeSwapProvider/integration/createSwap.int.test.js +335 -0
- package/src/swaps-lib/test/external-apis/goexmeSwapProvider/integration/getSwapInfo.int.test.js +154 -0
- package/src/swaps-lib/test/external-apis/swapProvider/getAllSupportedCurrencies.test.js +63 -0
- package/src/swaps-lib/test/external-apis/swapProvider/getDepositCurrencies.test.js +73 -0
- package/src/swaps-lib/test/external-apis/swapProvider/getWithdrawalCurrencies.test.js +102 -0
- package/src/swaps-lib/test/external-apis/swapProvider/removeProtocolNameFromCoinName.test.js +152 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +536 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/createSwap.test.js +1359 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getExistingSwapsDetailsAndStatus.test.js +136 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getSwapInfo.test.js +1743 -0
- package/src/swaps-lib/test/utils/swapUtils/isIpBannedProviderError.test.js +150 -0
- package/src/swaps-lib/test/utils/swapUtils/safeHandleRequestsLimitExceeding.test.js +80 -0
- package/src/swaps-lib/utils/swapUtils.js +207 -0
- package/{styles → src/ui-kit/assets/styles}/_functions.scss +5 -0
- package/{styles → src/ui-kit/assets/styles}/_mixins.scss +2 -2
- package/{styles → src/ui-kit/assets/styles}/_placeholder.scss +3 -3
- package/{styles → src/ui-kit/assets/styles}/_variables.scss +17 -15
- package/src/ui-kit/assets/styles/fonts/NunitoSans-Bold.ttf +0 -0
- package/src/ui-kit/assets/styles/fonts/NunitoSans-ExtraBold.ttf +0 -0
- package/src/ui-kit/assets/styles/fonts/NunitoSans-Light.ttf +0 -0
- package/src/ui-kit/assets/styles/fonts/NunitoSans-Regular.ttf +0 -0
- package/src/ui-kit/assets/styles/fonts/NunitoSans-SemiBold.ttf +0 -0
- package/src/ui-kit/assets/styles/global.scss +171 -0
- package/src/ui-kit/assets/styles/index.scss +10 -0
- package/src/ui-kit/assets/wrappedImages/arrowIcon.jsx +13 -0
- package/src/ui-kit/assets/wrappedImages/arrowTosca.jsx +14 -0
- package/src/ui-kit/assets/wrappedImages/arrowWhite.jsx +14 -0
- package/src/ui-kit/assets/wrappedImages/darkRectangle.jsx +7 -0
- package/src/ui-kit/assets/wrappedImages/determinedError.jsx +118 -0
- package/src/ui-kit/assets/wrappedImages/failedValidationIcon.jsx +39 -0
- package/src/ui-kit/assets/wrappedImages/infoIcon.jsx +16 -0
- package/src/ui-kit/assets/wrappedImages/messageIcon.jsx +87 -0
- package/src/ui-kit/assets/wrappedImages/noticeQuestionIcon.jsx +54 -0
- package/src/ui-kit/assets/wrappedImages/successfulValidationIcon.jsx +26 -0
- package/src/ui-kit/assets/wrappedImages/supportDialogImage.jsx +61 -0
- package/src/ui-kit/assets/wrappedImages/walletIcon.jsx +22 -0
- package/src/{components → ui-kit/components}/atoms/AssetIcon/AssetIcon.jsx +16 -14
- package/src/{components → ui-kit/components}/atoms/AssetIcon/asset-icon.module.scss +1 -1
- package/src/ui-kit/components/atoms/AssetSelection/AssetSelection.jsx +68 -0
- package/src/ui-kit/components/atoms/AssetSelection/asset-selection.module.scss +56 -0
- package/src/ui-kit/components/atoms/BackgroundTitle/BackgroundTitle.jsx +34 -0
- package/src/ui-kit/components/atoms/BackgroundTitle/background-title.module.scss +52 -0
- package/src/ui-kit/components/atoms/InformationMessage/InformationMessage.jsx +51 -0
- package/src/ui-kit/components/atoms/InformationMessage/information-message.module.scss +38 -0
- package/src/ui-kit/components/atoms/Input/Input.jsx +183 -0
- package/src/ui-kit/components/atoms/Input/input.module.scss +107 -0
- package/src/{components → ui-kit/components}/atoms/LoadingDots/LoadingDots.jsx +8 -28
- package/src/{components → ui-kit/components}/atoms/LoadingDots/LoadingDots.module.scss +3 -2
- package/src/ui-kit/components/atoms/NoticeIcon/NoticeIcon.jsx +64 -0
- package/src/ui-kit/components/atoms/NoticeIcon/notice-icon.module.scss +14 -0
- package/src/ui-kit/components/atoms/QrCode/QrCode.jsx +38 -0
- package/src/ui-kit/components/atoms/QrCode/qr-code.module.scss +8 -0
- package/src/ui-kit/components/atoms/RateSelector/RateSelector.jsx +30 -0
- package/src/ui-kit/components/atoms/RateSelector/rate-selector.module.scss +47 -0
- package/src/{components → ui-kit/components}/atoms/SupportChat/SupportChat.jsx +5 -1
- package/src/ui-kit/components/atoms/Textarea/Textarea.jsx +148 -0
- package/src/ui-kit/components/atoms/Textarea/textarea.module.scss +71 -0
- package/src/ui-kit/components/atoms/TitleBox/TitleBox.jsx +141 -0
- package/src/ui-kit/components/atoms/TitleBox/title-box.module.scss +32 -0
- package/src/ui-kit/components/atoms/Tooltip/Tooltip.jsx +77 -0
- package/src/ui-kit/components/atoms/Tooltip/tooltip.module.scss +237 -0
- package/src/ui-kit/components/atoms/TwoLinesOfText/LinesOfText.jsx +76 -0
- package/src/ui-kit/components/atoms/TwoLinesOfText/lines-of-text.module.scss +65 -0
- package/src/ui-kit/components/atoms/Validation/Validation.jsx +39 -0
- package/src/ui-kit/components/atoms/Validation/validation.module.scss +19 -0
- package/src/{components → ui-kit/components}/atoms/buttons/Button/Button.jsx +26 -45
- package/src/{components → ui-kit/components}/atoms/buttons/Button/Button.module.scss +1 -1
- package/src/ui-kit/components/atoms/buttons/Close/Close.jsx +58 -0
- package/src/ui-kit/components/atoms/buttons/Close/close.module.scss +75 -0
- package/src/ui-kit/components/atoms/buttons/LinkButton/LinkButton.jsx +116 -0
- package/src/ui-kit/components/atoms/buttons/LinkButton/link-button.module.scss +53 -0
- package/src/ui-kit/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx +110 -0
- package/src/ui-kit/components/atoms/buttons/RadioButtonWithText/radio-button-with-text.module.scss +86 -0
- package/src/ui-kit/components/molecules/AmountInput/AmountInput.jsx +448 -0
- package/src/ui-kit/components/molecules/AmountInput/amount-input.module.scss +233 -0
- package/src/ui-kit/components/molecules/CoinPicker/CoinPicker.jsx +463 -0
- package/src/ui-kit/components/molecules/CoinPicker/coin-picker.module.scss +207 -0
- package/src/ui-kit/components/molecules/ColoredNotice/ColoredNotice.jsx +52 -0
- package/src/ui-kit/components/molecules/ColoredNotice/colored-notice.module.scss +36 -0
- package/src/ui-kit/components/molecules/LineWithIconLink/LineWithIconLink.jsx +35 -0
- package/src/ui-kit/components/molecules/LineWithIconLink/line-with-icon-link.module.scss +25 -0
- package/src/ui-kit/components/molecules/LogoCarousel/LogoCarousel.jsx +74 -0
- package/src/ui-kit/components/molecules/LogoCarousel/logo-carousel.module.scss +106 -0
- package/src/ui-kit/components/molecules/SearchableCoinsList/SearchableCoinsList.jsx +114 -0
- package/src/ui-kit/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx +32 -0
- package/src/ui-kit/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx +66 -0
- package/src/ui-kit/components/organisms/Dialog/Dialog.jsx +494 -0
- package/src/ui-kit/components/organisms/Dialog/DialogButtons/DialogButtons.jsx +132 -0
- package/src/ui-kit/components/organisms/Dialog/DialogButtons/dialog-buttons.module.scss +25 -0
- package/src/ui-kit/components/organisms/Dialog/DialogStep/DialogStep.jsx +554 -0
- package/src/ui-kit/components/organisms/Dialog/DialogStep/dialog-step.module.scss +382 -0
- package/src/ui-kit/components/organisms/Dialog/dialog.module.scss +226 -0
- package/src/ui-kit/components/organisms/SwapForm/SwapForm.jsx +1430 -0
- package/src/ui-kit/components/organisms/SwapForm/swap-form.module.scss +134 -0
- package/src/ui-kit/components/organisms/WaitlistSubscription/WaitlistSubscription.jsx +158 -0
- package/src/ui-kit/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx +77 -0
- package/src/ui-kit/hooks/useCallHandlingErrors.js +27 -0
- package/src/ui-kit/hooks/useIsHydrated.js +12 -0
- package/src/ui-kit/hooks/useReferredState.js +24 -0
- package/src/ui-kit/tests/utils/inputValueProviders/provideFormatOfFloatValueByInputString.test.js +146 -0
- package/src/ui-kit/tests/utils/urlQueryUtils/getQueryParameterValues.test.js +65 -0
- package/src/ui-kit/tests/utils/urlQueryUtils/saveQueryParameterAndValues.test.js +104 -0
- package/src/ui-kit/utils/inputValueProviders.js +50 -0
- package/src/ui-kit/utils/searchCoins.js +58 -0
- package/src/ui-kit/utils/textUtils.js +18 -0
- package/src/ui-kit/utils/uiUtils.js +12 -0
- package/src/ui-kit/utils/urlQueryUtils.js +62 -0
- package/stories/font.scss +40 -0
- package/stories/stubs/coins.jsx +2266 -0
- package/stories/stubs/exampleContent.jsx +20 -0
- package/styles/_global-classes.scss +0 -433
- package/styles/fonts/NunitoSans-Bold.ttf +0 -0
- package/styles/fonts/NunitoSans-ExtraBold.ttf +0 -0
- package/styles/fonts/NunitoSans-Light.ttf +0 -0
- package/styles/fonts/NunitoSans-Regular.ttf +0 -0
- package/styles/fonts/NunitoSans-SemiBold.ttf +0 -0
- package/styles/global-styles-index.scss +0 -74
- package/styles/index.scss +0 -33
- /package/src/{common → common-apis}/models/blockchain.js +0 -0
- /package/src/{common → common-apis}/models/protocol.js +0 -0
- /package/src/{common → common-apis}/utils/logging/logsStorage.js +0 -0
- /package/src/{common → common-apis}/utils/safeStringify.js +0 -0
- /package/{styles → src/ui-kit/assets/styles}/colors/_light-colors.scss +0 -0
- /package/{styles → src/ui-kit/assets/styles}/colors/_solid-colors.scss +0 -0
- /package/{styles → src/ui-kit/assets/styles}/size/_margin-size.scss +0 -0
- /package/{styles → src/ui-kit/assets/styles}/size/_padding-size.scss +0 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import sinon from "sinon";
|
|
2
|
+
import axios from "axios";
|
|
3
|
+
import should from "should";
|
|
4
|
+
import { describe, it, beforeEach, afterEach } from "vitest";
|
|
5
|
+
import BigNumber from "bignumber.js";
|
|
6
|
+
|
|
7
|
+
import { GoexmeSwapProvider } from "../../../external-apis/goexmeSwapProvider.js";
|
|
8
|
+
import { Cache } from "../../../../common-apis/utils/cache.js";
|
|
9
|
+
import { Coin } from "../../../../common-apis/models/coin.js";
|
|
10
|
+
import { Blockchain } from "../../../../common-apis/models/blockchain.js";
|
|
11
|
+
import { SwapProvider } from "../../../external-apis/swapProvider.js";
|
|
12
|
+
|
|
13
|
+
const BTC = new Coin("Bitcoin", "BTC", "BTC", 8, null, "sat", null, null, 1, null, [], null, new Blockchain("Bitcoin"));
|
|
14
|
+
const ETH = new Coin(
|
|
15
|
+
"Ethereum",
|
|
16
|
+
"ETH",
|
|
17
|
+
"ETH",
|
|
18
|
+
18,
|
|
19
|
+
null,
|
|
20
|
+
"wei",
|
|
21
|
+
null,
|
|
22
|
+
null,
|
|
23
|
+
1,
|
|
24
|
+
null,
|
|
25
|
+
[],
|
|
26
|
+
null,
|
|
27
|
+
new Blockchain("Ethereum")
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
describe("goexmeSwapProvider", function () {
|
|
31
|
+
describe("getSwapInfo", function () {
|
|
32
|
+
const okRate = { result: true, rate: "15", minamount: "0.01", maxamount: "5" };
|
|
33
|
+
let provider, axiosStub;
|
|
34
|
+
|
|
35
|
+
beforeEach(() => {
|
|
36
|
+
provider = new GoexmeSwapProvider("/", new Cache(), () => null, false);
|
|
37
|
+
provider._supportedCoins = [
|
|
38
|
+
{ coin: BTC, code: "BTC", network: "BTC" },
|
|
39
|
+
{ coin: ETH, code: "ETH", network: "ETH" },
|
|
40
|
+
];
|
|
41
|
+
provider._supportedCoinsLastUpdateTimestamp = Date.now();
|
|
42
|
+
sinon.stub(provider, "_fetchSupportedCurrenciesIfNeeded").resolves();
|
|
43
|
+
axiosStub = sinon.stub(axios, "get").callsFake(url => {
|
|
44
|
+
if (url.includes("/pairs")) return Promise.resolve({ status: 200, data: { BTC: ["ETH"] } });
|
|
45
|
+
if (url.includes("/rate")) return Promise.resolve({ status: 200, data: okRate });
|
|
46
|
+
return Promise.resolve({ status: 200, data: {} });
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
afterEach(() => sinon.restore());
|
|
51
|
+
|
|
52
|
+
it("Should return TOO_LOW and TOO_HIGH against min/max", async () => {
|
|
53
|
+
let info = await provider.getSwapInfo(BTC, ETH, "0.001");
|
|
54
|
+
info.reason.should.equal(SwapProvider.NO_SWAPS_REASONS.TOO_LOW);
|
|
55
|
+
info = await provider.getSwapInfo(BTC, ETH, "10");
|
|
56
|
+
info.reason.should.equal(SwapProvider.NO_SWAPS_REASONS.TOO_HIGH);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("Should handle case with no min/max limits", async () => {
|
|
60
|
+
axiosStub.withArgs(sinon.match(/\/rate/)).resolves({ status: 200, data: { result: true, rate: "15" } });
|
|
61
|
+
const info = await provider.getSwapInfo(BTC, ETH, "1");
|
|
62
|
+
info.result.should.be.true();
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it("Should map HTTP 429 to REQUESTS_LIMIT_EXCEEDED", async () => {
|
|
66
|
+
axiosStub.withArgs(sinon.match(/\/rate/)).rejects({ response: { status: 429 } });
|
|
67
|
+
const info = await provider.getSwapInfo(BTC, ETH, "1");
|
|
68
|
+
info.reason.should.equal(SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it("Should return valid structure on success", async () => {
|
|
72
|
+
const info = await provider.getSwapInfo(BTC, ETH, "1");
|
|
73
|
+
info.result.should.be.true();
|
|
74
|
+
parseFloat(info.rate).should.be.greaterThan(0);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it("Should send proper params to /rate", async () => {
|
|
78
|
+
await provider.getSwapInfo(BTC, ETH, "1");
|
|
79
|
+
const call = axiosStub.args.find(a => a[0].includes("/rate"));
|
|
80
|
+
const params = call[1].params;
|
|
81
|
+
params.should.match({ from: "BTC", to: "ETH", amount: "1" });
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it("Should throw when amount ≤ 0", async () => {
|
|
85
|
+
await provider.getSwapInfo(BTC, ETH, "0").should.be.rejected();
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it("Should return valid result when amount is empty string", async () => {
|
|
89
|
+
const info = await provider.getSwapInfo(BTC, ETH, "");
|
|
90
|
+
info.result.should.be.true();
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it("Should return valid result when amount is non-string", async () => {
|
|
94
|
+
const info = await provider.getSwapInfo(BTC, ETH, 1);
|
|
95
|
+
info.result.should.be.true();
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it("Should propagate unexpected network error unchanged", async () => {
|
|
99
|
+
const boom = new Error("net-boom");
|
|
100
|
+
axiosStub.rejects(boom);
|
|
101
|
+
await provider.getSwapInfo(BTC, ETH, "1").should.be.rejectedWith(boom);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it("Should return NOT_SUPPORTED when provider responds { result:false } with 200", async () => {
|
|
105
|
+
axiosStub.withArgs(sinon.match(/\/rate/)).resolves({ status: 200, data: { result: false } });
|
|
106
|
+
const info = await provider.getSwapInfo(BTC, ETH, "1");
|
|
107
|
+
info.result.should.be.false();
|
|
108
|
+
info.reason.should.equal(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it("Should throw when fromCoin/toCoin are not Coin instances", async () => {
|
|
112
|
+
await provider.getSwapInfo({}, {}, "1").should.be.rejected();
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it("Should throw when amountIsToReceive = true", async () => {
|
|
116
|
+
await provider.getSwapInfo(BTC, ETH, "1", false, null, true).should.be.rejected();
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it("Should return NOT_SUPPORTED when either fromCoin or toCoin is unsupported", async () => {
|
|
120
|
+
const unsupported = new Coin(
|
|
121
|
+
"Unsupported",
|
|
122
|
+
"UNS",
|
|
123
|
+
"UNS",
|
|
124
|
+
8,
|
|
125
|
+
null,
|
|
126
|
+
"unit",
|
|
127
|
+
null,
|
|
128
|
+
null,
|
|
129
|
+
1,
|
|
130
|
+
null,
|
|
131
|
+
[],
|
|
132
|
+
null,
|
|
133
|
+
new Blockchain("Unsupported")
|
|
134
|
+
);
|
|
135
|
+
let info = await provider.getSwapInfo(unsupported, ETH, "1");
|
|
136
|
+
info.result.should.be.false();
|
|
137
|
+
info.reason.should.equal(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
|
|
138
|
+
|
|
139
|
+
info = await provider.getSwapInfo(BTC, unsupported, "1");
|
|
140
|
+
info.result.should.be.false();
|
|
141
|
+
info.reason.should.equal(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it("Should return NOT_SUPPORTED when /rate responds with unexpected data shape", async () => {
|
|
145
|
+
axiosStub.withArgs(sinon.match(/\/rate/)).resolves({ status: 200, data: {} });
|
|
146
|
+
const info = await provider.getSwapInfo(BTC, ETH, "1");
|
|
147
|
+
info.result.should.be.false();
|
|
148
|
+
info.reason.should.equal(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
it("Should copy provider .fix flag into info.fixed", async () => {
|
|
152
|
+
axiosStub.withArgs(sinon.match(/\/rate/)).resolves({
|
|
153
|
+
status: 200,
|
|
154
|
+
data: { result: true, rate: "15", minamount: "0.01", maxamount: "5", fix: true },
|
|
155
|
+
});
|
|
156
|
+
const info = await provider.getSwapInfo(BTC, ETH, "1");
|
|
157
|
+
info.result.should.be.true();
|
|
158
|
+
info.fixed.should.be.true();
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
it("Should return TOO_LOW and TOO_HIGH with correct smallestMin and greatestMax", async () => {
|
|
162
|
+
axiosStub.withArgs(sinon.match(/\/rate/)).resolves({
|
|
163
|
+
status: 200,
|
|
164
|
+
data: { result: true, rate: "15", minamount: "0.5", maxamount: "5" },
|
|
165
|
+
});
|
|
166
|
+
let info = await provider.getSwapInfo(BTC, ETH, "0.1");
|
|
167
|
+
info.result.should.be.false();
|
|
168
|
+
info.reason.should.equal(SwapProvider.NO_SWAPS_REASONS.TOO_LOW);
|
|
169
|
+
info.smallestMin.should.equal("0.50000000");
|
|
170
|
+
|
|
171
|
+
info = await provider.getSwapInfo(BTC, ETH, "10");
|
|
172
|
+
info.result.should.be.false();
|
|
173
|
+
info.reason.should.equal(SwapProvider.NO_SWAPS_REASONS.TOO_HIGH);
|
|
174
|
+
info.greatestMax.should.equal("5.00000000");
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import should from "should";
|
|
2
|
+
import { describe, it } from "vitest";
|
|
3
|
+
|
|
4
|
+
import { GoexmeSwapProvider } from "../../../external-apis/goexmeSwapProvider.js";
|
|
5
|
+
import { Cache } from "../../../../common-apis/utils/cache.js";
|
|
6
|
+
|
|
7
|
+
describe("goexmeSwapProvider", function () {
|
|
8
|
+
describe("helpers", function () {
|
|
9
|
+
it("getSwapCreationInfoTtlMs should return 110000 ms", () => {
|
|
10
|
+
const provider = new GoexmeSwapProvider("/", new Cache());
|
|
11
|
+
provider.getSwapCreationInfoTtlMs().should.equal(110000);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it("_parseGoexmeDate should convert date string to epoch", () => {
|
|
15
|
+
const timestamp = GoexmeSwapProvider._parseGoexmeDate("01.02.2024 03:04:05");
|
|
16
|
+
timestamp.should.equal(Date.parse("2024-02-01T03:04:05Z"));
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("getPartnersList should return single partner", async () => {
|
|
20
|
+
const provider = new GoexmeSwapProvider("/", new Cache());
|
|
21
|
+
const partners = await provider.getPartnersList();
|
|
22
|
+
partners.should.have.length(1);
|
|
23
|
+
partners[0].should.have.property("name", "GoExme");
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
});
|
package/src/swaps-lib/test/external-apis/goexmeSwapProvider/integration/PairSupport.int.test.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import "dotenv/config";
|
|
2
|
+
import sinon from "sinon";
|
|
3
|
+
import should from "should";
|
|
4
|
+
import { describe, it, beforeAll, afterEach } from "vitest";
|
|
5
|
+
import axios from "axios";
|
|
6
|
+
|
|
7
|
+
import { Cache } from "../../../../../common-apis/utils/cache.js";
|
|
8
|
+
import { GoexmeSwapProvider } from "../../../../external-apis/goexmeSwapProvider.js";
|
|
9
|
+
|
|
10
|
+
const GOEXME_API_KEY = process.env.GOEXME_API_KEY?.trim?.() || "";
|
|
11
|
+
const maybeDescribe = GOEXME_API_KEY ? describe : describe.skip;
|
|
12
|
+
|
|
13
|
+
const ALLOWED_RABBIT_TICKERS = [
|
|
14
|
+
"BNBBEP20",
|
|
15
|
+
"BTC",
|
|
16
|
+
"DOGE",
|
|
17
|
+
// DOT temporarily removed – Goexme API stopped exposing it as of 2025‑11‑11.
|
|
18
|
+
"ETH",
|
|
19
|
+
"LTC",
|
|
20
|
+
"SOL",
|
|
21
|
+
"TRX",
|
|
22
|
+
"USDCERC20",
|
|
23
|
+
"GMTSOL",
|
|
24
|
+
"USDTERC20",
|
|
25
|
+
"USDTSOL",
|
|
26
|
+
"USDTTRC20",
|
|
27
|
+
"XMR",
|
|
28
|
+
"XRP",
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
const FORBIDDEN_TICKERS = ["WELL", "VOXEL", "WOO"];
|
|
32
|
+
|
|
33
|
+
function checkPairSupported(response, providerInstance) {
|
|
34
|
+
const { TOO_LOW, TOO_HIGH } = providerInstance.constructor.NO_SWAPS_REASONS;
|
|
35
|
+
return response.result === true || [TOO_LOW, TOO_HIGH].includes(response.reason);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
maybeDescribe("external-apis/goexmeSwapProvider integration", function () {
|
|
39
|
+
describe("pair support (live)", function () {
|
|
40
|
+
let provider;
|
|
41
|
+
|
|
42
|
+
beforeAll(async function () {
|
|
43
|
+
provider = new GoexmeSwapProvider("/", new Cache(), () => null, false, GOEXME_API_KEY);
|
|
44
|
+
await provider._fetchSupportedCurrenciesIfNeeded();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
ALLOWED_RABBIT_TICKERS.forEach(fromTicker => {
|
|
48
|
+
const toTicker = fromTicker === "BTC" ? "USDTTRC20" : "BTC";
|
|
49
|
+
|
|
50
|
+
it(`Should support swaps for ${fromTicker}→${toTicker}`, async function () {
|
|
51
|
+
const fromCoin = provider.getCoinByTickerIfPresent(fromTicker);
|
|
52
|
+
const toCoin = provider.getCoinByTickerIfPresent(toTicker);
|
|
53
|
+
|
|
54
|
+
should.exist(fromCoin);
|
|
55
|
+
should.exist(toCoin);
|
|
56
|
+
|
|
57
|
+
const response = await provider.getSwapInfo(fromCoin, toCoin, "10000", false);
|
|
58
|
+
checkPairSupported(response, provider).should.be.true();
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
FORBIDDEN_TICKERS.forEach(ticker => {
|
|
63
|
+
it(`Should not support swaps involving forbidden token ${ticker}`, function () {
|
|
64
|
+
const coin = provider.getCoinByTickerIfPresent(ticker);
|
|
65
|
+
should(coin).be.null();
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
});
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import "dotenv/config";
|
|
2
|
+
import sinon from "sinon";
|
|
3
|
+
import should from "should";
|
|
4
|
+
import { describe, it, beforeEach, afterEach } from "vitest";
|
|
5
|
+
import axios from "axios";
|
|
6
|
+
|
|
7
|
+
import { Cache } from "../../../../../common-apis/utils/cache.js";
|
|
8
|
+
import { GoexmeSwapProvider } from "../../../../external-apis/goexmeSwapProvider.js";
|
|
9
|
+
import { FALLBACK_ASSET_ICON_URL } from "../../../../../common-apis/globalConstants.jsx";
|
|
10
|
+
|
|
11
|
+
const GOEXME_API_KEY = process.env.GOEXME_API_KEY?.trim?.() || "";
|
|
12
|
+
const maybeDescribe = GOEXME_API_KEY ? describe : describe.skip;
|
|
13
|
+
|
|
14
|
+
maybeDescribe("external-apis/goexmeSwapProvider integration", function () {
|
|
15
|
+
describe("_fetchSupportedCurrenciesIfNeeded", function () {
|
|
16
|
+
let provider;
|
|
17
|
+
let axiosGetOriginal;
|
|
18
|
+
|
|
19
|
+
beforeEach(() => {
|
|
20
|
+
provider = new GoexmeSwapProvider("/", new Cache(), () => null, false, GOEXME_API_KEY);
|
|
21
|
+
axiosGetOriginal = axios.get;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
afterEach(() => {
|
|
25
|
+
if (axios.get.restore) {
|
|
26
|
+
axios.get.restore();
|
|
27
|
+
} else {
|
|
28
|
+
axios.get = axiosGetOriginal;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const fetchRawCurrencies = async () => {
|
|
33
|
+
const { data } = await axiosGetOriginal(`${provider._URL}/currencies`, {
|
|
34
|
+
params: { key: GOEXME_API_KEY },
|
|
35
|
+
});
|
|
36
|
+
return data;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
it("Should filter out unavailable coins", async () => {
|
|
40
|
+
const raw = await fetchRawCurrencies();
|
|
41
|
+
await provider._fetchSupportedCurrenciesIfNeeded();
|
|
42
|
+
|
|
43
|
+
const providerCodes = new Set(provider._supportedCoins.map(c => c.code));
|
|
44
|
+
const unavailableCodes = Object.entries(raw)
|
|
45
|
+
.filter(([, meta]) => meta?.available === false)
|
|
46
|
+
.map(([code]) => code.toUpperCase());
|
|
47
|
+
|
|
48
|
+
unavailableCodes.forEach(code => providerCodes.has(code).should.be.false());
|
|
49
|
+
providerCodes.size.should.be.above(0);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it("Should set hasExtraId and extraIdName correctly", async () => {
|
|
53
|
+
const raw = await fetchRawCurrencies();
|
|
54
|
+
await provider._fetchSupportedCurrenciesIfNeeded();
|
|
55
|
+
|
|
56
|
+
const infoWithTag = provider._supportedCoins.find(i => i.hasExtraId);
|
|
57
|
+
should.exist(infoWithTag);
|
|
58
|
+
|
|
59
|
+
const meta =
|
|
60
|
+
raw[infoWithTag.code] ??
|
|
61
|
+
Object.values(raw).find(m => (m.code ?? m.ticker ?? "").toUpperCase() === infoWithTag.code);
|
|
62
|
+
should.exist(meta);
|
|
63
|
+
(meta.tagname ?? "").trim().should.not.be.empty();
|
|
64
|
+
|
|
65
|
+
infoWithTag.extraIdName.should.equal(meta.tagname);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it("Should handle duplicate tickers across networks", async () => {
|
|
69
|
+
await provider._fetchSupportedCurrenciesIfNeeded();
|
|
70
|
+
|
|
71
|
+
const suffixRx = /(ERC20|TRC20|BEP20|BSC|AVALANCHEC|OPTIMISM|SOLANA|ARBITRUM)$/i;
|
|
72
|
+
const grouped = {};
|
|
73
|
+
|
|
74
|
+
provider._supportedCoins.forEach(i => {
|
|
75
|
+
const base = i.code.toUpperCase().replace(suffixRx, "");
|
|
76
|
+
grouped[base] = grouped[base] || [];
|
|
77
|
+
grouped[base].push(i);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const entry = Object.entries(grouped).find(([, arr]) => arr.length >= 2);
|
|
81
|
+
if (!entry) return;
|
|
82
|
+
|
|
83
|
+
const [, infos] = entry;
|
|
84
|
+
infos.length.should.be.aboveOrEqual(2);
|
|
85
|
+
|
|
86
|
+
infos.forEach(info => {
|
|
87
|
+
provider._findInfoByTicker(info.coin.ticker).should.equal(info);
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it("Should skip HTTP call when cached list is fresh", async () => {
|
|
92
|
+
provider._supportedCoins = [{ dummy: true }];
|
|
93
|
+
provider._supportedCoinsLastUpdateTimestamp = Date.now();
|
|
94
|
+
|
|
95
|
+
let calls = 0;
|
|
96
|
+
sinon.stub(axios, "get").callsFake((url, opts) => {
|
|
97
|
+
if (url.includes("/currencies")) calls += 1;
|
|
98
|
+
return axiosGetOriginal(url, opts);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
await provider._fetchSupportedCurrenciesIfNeeded();
|
|
102
|
+
calls.should.equal(0);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it("Should make one HTTP call when cache empty, then reuse cache within TTL", async () => {
|
|
106
|
+
let calls = 0;
|
|
107
|
+
sinon.stub(axios, "get").callsFake((url, opts) => {
|
|
108
|
+
if (url.includes("/currencies")) calls += 1;
|
|
109
|
+
return axiosGetOriginal(url, opts);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
await provider._fetchSupportedCurrenciesIfNeeded();
|
|
113
|
+
provider._supportedCoinsLastUpdateTimestamp -= 4 * 60 * 1000;
|
|
114
|
+
await provider._fetchSupportedCurrenciesIfNeeded();
|
|
115
|
+
|
|
116
|
+
calls.should.equal(1);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it("Should refresh list after TTL expiry", async () => {
|
|
120
|
+
let calls = 0;
|
|
121
|
+
sinon.stub(axios, "get").callsFake((url, opts) => {
|
|
122
|
+
if (url.includes("/currencies")) calls += 1;
|
|
123
|
+
return axiosGetOriginal(url, opts);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
await provider._fetchSupportedCurrenciesIfNeeded();
|
|
127
|
+
provider._supportedCoinsLastUpdateTimestamp -= 10 * 60 * 1000;
|
|
128
|
+
await provider._fetchSupportedCurrenciesIfNeeded();
|
|
129
|
+
|
|
130
|
+
calls.should.equal(2);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it("Should return empty list for status 200 with empty object", async () => {
|
|
134
|
+
sinon.stub(axios, "get").callsFake((url, opts = {}) => {
|
|
135
|
+
if (url.endsWith("/currencies")) {
|
|
136
|
+
return Promise.resolve({ status: 200, data: {} });
|
|
137
|
+
}
|
|
138
|
+
return axiosGetOriginal(url, opts);
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
await provider._fetchSupportedCurrenciesIfNeeded();
|
|
142
|
+
|
|
143
|
+
Array.isArray(provider._supportedCoins).should.be.true();
|
|
144
|
+
provider._supportedCoins.length.should.equal(0);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
it("Should throw when status 200 with null data", async () => {
|
|
148
|
+
sinon.stub(axios, "get").callsFake((url, opts = {}) => {
|
|
149
|
+
if (url.endsWith("/currencies")) {
|
|
150
|
+
return Promise.resolve({ status: 200, data: null });
|
|
151
|
+
}
|
|
152
|
+
return axiosGetOriginal(url, opts);
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
await provider._fetchSupportedCurrenciesIfNeeded().should.be.rejected();
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
it("Should return empty list for status 200 with data array", async () => {
|
|
159
|
+
sinon.stub(axios, "get").callsFake((url, opts = {}) => {
|
|
160
|
+
if (url.endsWith("/currencies")) {
|
|
161
|
+
return Promise.resolve({ status: 200, data: [] });
|
|
162
|
+
}
|
|
163
|
+
return axiosGetOriginal(url, opts);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
await provider._fetchSupportedCurrenciesIfNeeded();
|
|
167
|
+
|
|
168
|
+
Array.isArray(provider._supportedCoins).should.be.true();
|
|
169
|
+
provider._supportedCoins.length.should.equal(0);
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
it("Should throw when /currencies responds with non-200 status", async () => {
|
|
173
|
+
sinon.stub(axios, "get").callsFake((url, opts = {}) => {
|
|
174
|
+
if (url.endsWith("/currencies")) {
|
|
175
|
+
return Promise.resolve({ status: 400, data: {} });
|
|
176
|
+
}
|
|
177
|
+
return axiosGetOriginal(url, opts);
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
await provider._fetchSupportedCurrenciesIfNeeded().should.be.rejected();
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it("Should ensure every coin has a non-empty icon URL", async () => {
|
|
184
|
+
await provider._fetchSupportedCurrenciesIfNeeded();
|
|
185
|
+
provider._supportedCoins.length.should.be.above(0);
|
|
186
|
+
provider._supportedCoins.every(i => typeof i.iconURL === "string" && i.iconURL.length > 0).should.be.true();
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
it("Should persist raw meta fields exactly (code as-is; network as-is)", async () => {
|
|
190
|
+
const raw = await fetchRawCurrencies();
|
|
191
|
+
await provider._fetchSupportedCurrenciesIfNeeded();
|
|
192
|
+
|
|
193
|
+
const info = provider._supportedCoins.find(i => raw[i.code]);
|
|
194
|
+
should.exist(info);
|
|
195
|
+
|
|
196
|
+
const meta = raw[info.code];
|
|
197
|
+
should.exist(meta);
|
|
198
|
+
|
|
199
|
+
raw.should.have.property(info.code);
|
|
200
|
+
|
|
201
|
+
should(info.network).be.eql(meta.network);
|
|
202
|
+
|
|
203
|
+
const tag = (meta.tagname ?? "").trim();
|
|
204
|
+
if (tag) {
|
|
205
|
+
info.hasExtraId.should.be.true();
|
|
206
|
+
info.extraIdName.should.equal(tag);
|
|
207
|
+
} else {
|
|
208
|
+
info.hasExtraId.should.be.false();
|
|
209
|
+
should(info.extraIdName).be.null();
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
it("Should mark isPopular and use fallback icon when icon is missing", async () => {
|
|
214
|
+
sinon.stub(axios, "get").callsFake((url, opts = {}) => {
|
|
215
|
+
if (url.endsWith("/currencies")) {
|
|
216
|
+
return Promise.resolve({
|
|
217
|
+
status: 200,
|
|
218
|
+
data: {
|
|
219
|
+
BTC: { coinName: "Bitcoin", available: true },
|
|
220
|
+
DOGE: { coinName: "Dogecoin", available: true },
|
|
221
|
+
},
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
return axiosGetOriginal(url, opts);
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
await provider._fetchSupportedCurrenciesIfNeeded();
|
|
228
|
+
const btc = provider._supportedCoins.find(i => i.code === "BTC");
|
|
229
|
+
const doge = provider._supportedCoins.find(i => i.code === "DOGE");
|
|
230
|
+
|
|
231
|
+
btc.iconURL.should.equal(FALLBACK_ASSET_ICON_URL);
|
|
232
|
+
should.exist(btc.isPopular);
|
|
233
|
+
should.exist(doge.isPopular);
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
it("Should sort _supportedCoins: popular first, then alphabetically by ticker", async () => {
|
|
237
|
+
await provider._fetchSupportedCurrenciesIfNeeded();
|
|
238
|
+
const popular = [
|
|
239
|
+
"HMSTRTON",
|
|
240
|
+
"BTC",
|
|
241
|
+
"ETH",
|
|
242
|
+
"USDTERC20",
|
|
243
|
+
"USDTTRC20",
|
|
244
|
+
"USDCERC20",
|
|
245
|
+
"XRP",
|
|
246
|
+
"TON",
|
|
247
|
+
"XMR",
|
|
248
|
+
"TRX",
|
|
249
|
+
"DAIERC20",
|
|
250
|
+
"DOGE",
|
|
251
|
+
"BNB",
|
|
252
|
+
"PEPEERC20",
|
|
253
|
+
"NOTTON",
|
|
254
|
+
"SOL",
|
|
255
|
+
"DOT",
|
|
256
|
+
"LTC",
|
|
257
|
+
"SHIBERC20",
|
|
258
|
+
"AVAX",
|
|
259
|
+
"UNIERC20",
|
|
260
|
+
"LINKERC20",
|
|
261
|
+
"MATIC",
|
|
262
|
+
"BUSDBEP20",
|
|
263
|
+
"AAVEERC20",
|
|
264
|
+
"ATOM",
|
|
265
|
+
"RUNE",
|
|
266
|
+
"ADA",
|
|
267
|
+
];
|
|
268
|
+
const list = provider._supportedCoins;
|
|
269
|
+
|
|
270
|
+
let reachedNonPopular = false;
|
|
271
|
+
for (const info of list) {
|
|
272
|
+
const isPop = popular.includes(info.coin.ticker);
|
|
273
|
+
if (!reachedNonPopular && !isPop) reachedNonPopular = true;
|
|
274
|
+
if (reachedNonPopular) isPop.should.be.false();
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
const nonPopularTickers = list.filter(i => !popular.includes(i.coin.ticker)).map(i => i.coin.ticker);
|
|
278
|
+
const sorted = [...nonPopularTickers].sort((a, b) => a.localeCompare(b));
|
|
279
|
+
nonPopularTickers.should.eql(sorted);
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
it("Should keep cache consistent under concurrent calls", async () => {
|
|
283
|
+
await Promise.all([
|
|
284
|
+
provider._fetchSupportedCurrenciesIfNeeded(),
|
|
285
|
+
provider._fetchSupportedCurrenciesIfNeeded(),
|
|
286
|
+
provider._fetchSupportedCurrenciesIfNeeded(),
|
|
287
|
+
]);
|
|
288
|
+
|
|
289
|
+
provider._supportedCoins.length.should.be.above(0);
|
|
290
|
+
provider._supportedCoinsLastUpdateTimestamp.should.be.above(0);
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
it("Should map all known provider statuses via _mapGoexmeStatus", () => {
|
|
294
|
+
const mapGoexmeStatus = provider._mapGoexmeStatus.bind(provider);
|
|
295
|
+
mapGoexmeStatus("new").should.equal(provider.constructor.SWAP_STATUSES.WAITING_FOR_PAYMENT);
|
|
296
|
+
mapGoexmeStatus("waiting_deposit").should.equal(provider.constructor.SWAP_STATUSES.CONFIRMING);
|
|
297
|
+
mapGoexmeStatus("deposit_received").should.equal(provider.constructor.SWAP_STATUSES.PAYMENT_RECEIVED);
|
|
298
|
+
mapGoexmeStatus("exchanging").should.equal(provider.constructor.SWAP_STATUSES.EXCHANGING);
|
|
299
|
+
mapGoexmeStatus("sending").should.equal(provider.constructor.SWAP_STATUSES.EXCHANGING);
|
|
300
|
+
mapGoexmeStatus("success").should.equal(provider.constructor.SWAP_STATUSES.COMPLETED);
|
|
301
|
+
mapGoexmeStatus("time_expired").should.equal(provider.constructor.SWAP_STATUSES.EXPIRED);
|
|
302
|
+
mapGoexmeStatus("failed").should.equal(provider.constructor.SWAP_STATUSES.FAILED);
|
|
303
|
+
mapGoexmeStatus("sending_failed").should.equal(provider.constructor.SWAP_STATUSES.FAILED);
|
|
304
|
+
mapGoexmeStatus("reverted").should.equal(provider.constructor.SWAP_STATUSES.REFUNDED);
|
|
305
|
+
});
|
|
306
|
+
});
|
|
307
|
+
});
|