@rabbitio/ui-kit 1.0.0-beta.9 → 1.0.0-beta.91
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/.gitlab-ci.yml +29 -0
- package/.husky/commit-msg +19 -0
- package/.husky/pre-push +1 -0
- package/CHANGELOG.md +0 -0
- package/README.md +27 -18
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/clover.xml +16765 -0
- package/coverage/coverage-final.json +116 -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 +148 -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 +169 -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 +250 -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 +352 -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 +1162 -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 +208 -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 +376 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/cacheAndConcurrentRequestsResolver.js.html +1570 -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/exolixSwapProvider.js.html +1825 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/index.html +161 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/letsExchangeSwapProvider.js.html +1618 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/swapProvider.js.html +1819 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/swapspaceSwapProvider.js.html +1861 -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 +331 -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 +1555 -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 +670 -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 +217 -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 +712 -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 +421 -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 +211 -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 +496 -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 +4207 -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 +151 -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 +161 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/utils/inputValueProviders.js.html +235 -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 +12451 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +2339 -8491
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +9597 -26
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +12357 -27
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +12442 -29
- 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 +21 -0
- package/src/common-apis/adapters/analyticsAdapters/metrikaAdapter.js +28 -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 +55 -0
- package/src/common-apis/external-apis/emailAPI.js +16 -0
- package/src/common-apis/external-apis/ipAddressProviders.js +89 -0
- package/src/common-apis/globalConstants.jsx +3 -0
- package/src/common-apis/models/blockchain.js +10 -0
- package/src/common-apis/models/coin.js +248 -0
- package/src/common-apis/models/protocol.js +5 -0
- package/src/{common → common-apis/services}/fiatCurrenciesService.js +4 -12
- package/src/common-apis/tests/integration/external-apis/ipAddressProviders/getClientIpAddress.test.js +12 -0
- package/src/common-apis/tests/units/utils/amountUtils/composeRateText.test.js +152 -0
- package/src/{common → common-apis/utils}/amountUtils.js +72 -136
- package/src/common-apis/utils/cache.js +242 -0
- package/src/{common → common-apis/utils}/errorUtils.js +15 -0
- package/src/common-apis/utils/logging/logger.js +41 -0
- package/src/common-apis/utils/logging/logsStorage.js +61 -0
- package/src/common-apis/utils/postponeExecution.js +11 -0
- package/src/common-apis/utils/rabbitTicker.js +24 -0
- package/src/common-apis/utils/safeStringify.js +50 -0
- package/src/index.js +96 -9
- package/src/robust-api-caller/cacheAndConcurrentRequestsResolver.js +495 -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/exolixSwapProvider.js +580 -0
- package/src/swaps-lib/external-apis/letsExchangeSwapProvider.js +511 -0
- package/src/swaps-lib/external-apis/swapProvider.js +578 -0
- package/src/swaps-lib/external-apis/swapspaceSwapProvider.js +592 -0
- package/src/swaps-lib/models/baseSwapCreationInfo.js +78 -0
- package/src/swaps-lib/models/existingSwap.js +143 -0
- 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 +82 -0
- package/src/swaps-lib/services/publicSwapService.js +490 -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 +1043 -0
- package/src/swaps-lib/test/external-apis/exolixSwapProvider/getSwapInfo.test.js +611 -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 +1214 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getSwapInfo.test.js +1707 -0
- package/src/swaps-lib/test/utils/swapUtils/safeHandleRequestsLimitExceeding.test.js +80 -0
- package/src/swaps-lib/utils/swapUtils.js +195 -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/ui-kit/components/atoms/AssetIcon/AssetIcon.jsx +57 -0
- 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 +44 -0
- package/src/ui-kit/components/atoms/QrCode/qr-code.module.scss +15 -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 +24 -50
- 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 +112 -0
- package/src/ui-kit/components/atoms/buttons/LinkButton/link-button.module.scss +49 -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 +42 -0
- package/src/ui-kit/components/molecules/ColoredNotice/colored-notice.module.scss +20 -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 +137 -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 +381 -0
- package/src/ui-kit/components/organisms/Dialog/dialog.module.scss +226 -0
- package/src/ui-kit/components/organisms/SwapForm/SwapForm.jsx +1374 -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 +22 -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/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/src/components/atoms/AssetIcon/AssetIcon.jsx +0 -55
- 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/{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,592 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import { BigNumber } from "bignumber.js";
|
|
3
|
+
|
|
4
|
+
import { AmountUtils } from "../../common-apis/utils/amountUtils.js";
|
|
5
|
+
import { improveAndRethrow } from "../../common-apis/utils/errorUtils.js";
|
|
6
|
+
import { SwapProvider } from "./swapProvider.js";
|
|
7
|
+
import { ExistingSwap } from "../models/existingSwap.js";
|
|
8
|
+
import { Coin } from "../../common-apis/models/coin.js";
|
|
9
|
+
import { Protocol } from "../../common-apis/models/protocol.js";
|
|
10
|
+
import { safeStringify } from "../../common-apis/utils/safeStringify.js";
|
|
11
|
+
import { Logger } from "../../common-apis/utils/logging/logger.js";
|
|
12
|
+
import { FALLBACK_ASSET_ICON_URL } from "../../common-apis/globalConstants.jsx";
|
|
13
|
+
import { SwapProviderCoinInfo } from "../models/swapProviderCoinInfo.js";
|
|
14
|
+
import { KYC_LEVELS, Partner } from "../models/partner.js";
|
|
15
|
+
import { toRabbitTicker } from "../../common-apis/utils/rabbitTicker.js";
|
|
16
|
+
|
|
17
|
+
export const BANNED_PARTNERS = ["stealthex", "changee", "coincraddle", "easybit", "changelly"];
|
|
18
|
+
|
|
19
|
+
export class SwapspaceSwapProvider extends SwapProvider {
|
|
20
|
+
/**
|
|
21
|
+
* You should pass either proxy URL or the API key
|
|
22
|
+
*
|
|
23
|
+
* @param apiKeysProxyUrl {string|null}
|
|
24
|
+
* @param cache {Cache}
|
|
25
|
+
* @param [customCoinBuilder] {function}
|
|
26
|
+
* @param [useRestrictedCoinsSet=true] {boolean}
|
|
27
|
+
* @param [apiKey] {string|null}
|
|
28
|
+
*/
|
|
29
|
+
constructor(
|
|
30
|
+
apiKeysProxyUrl,
|
|
31
|
+
cache,
|
|
32
|
+
customCoinBuilder = (coin, network) => null,
|
|
33
|
+
useRestrictedCoinsSet = true,
|
|
34
|
+
apiKey = null
|
|
35
|
+
) {
|
|
36
|
+
super("swapspace", cache, customCoinBuilder, useRestrictedCoinsSet, true, false);
|
|
37
|
+
this._partners = [];
|
|
38
|
+
this._URL = apiKey ? `https://api.swapspace.co` : `${apiKeysProxyUrl}/${this.id}`;
|
|
39
|
+
this._headers = apiKey ? { Authorization: apiKey } : {};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
getSwapCreationInfoTtlMs() {
|
|
43
|
+
/* Actually 2 minutes and only relevant for some partners, but we use it
|
|
44
|
+
* (and even a bit smaller value) for better consistency */
|
|
45
|
+
return 110000;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async _fetchSupportedCurrenciesIfNeeded() {
|
|
49
|
+
const loggerSource = "_fetchSupportedCurrenciesIfNeeded";
|
|
50
|
+
try {
|
|
51
|
+
if (this._shouldCoinsListBeLoaded()) {
|
|
52
|
+
const rawResponse = await axios.get(`${this._URL}/api/v2/currencies`, { headers: this._headers });
|
|
53
|
+
Logger.log(`Retrieved ${rawResponse?.data?.length}`, loggerSource);
|
|
54
|
+
let allowedCoins = rawResponse?.data ?? [];
|
|
55
|
+
Logger.log(`Allowed cnt ${allowedCoins.length}`, loggerSource);
|
|
56
|
+
|
|
57
|
+
this._supportedCoins = allowedCoins
|
|
58
|
+
.map(item => {
|
|
59
|
+
let coin =
|
|
60
|
+
this._customCoinBuilder != null ? this._customCoinBuilder(item.code, item.network) : null;
|
|
61
|
+
if (!coin && !this.useRestrictedCoinsSet) {
|
|
62
|
+
/** Building coin object for coin that isn't supported OOB in Rabbit.
|
|
63
|
+
* We are doing this way to be able to use extended coins set for swaps.
|
|
64
|
+
* These temporary built coins are only for in-swap use, and we omit some usual
|
|
65
|
+
* coin details here.
|
|
66
|
+
* Ideally we should add some new abstractions e.g. BaseCoin:
|
|
67
|
+
* Coin will extend BaseCoin, SwapCoin will extend BaseCoin etc.
|
|
68
|
+
* But for now it is reasonable to use this simpler approach.
|
|
69
|
+
*/
|
|
70
|
+
const code = item.code.toUpperCase();
|
|
71
|
+
const network = item.network.toUpperCase();
|
|
72
|
+
/** Removing ticker and protocol name from coin name as we usually use them explicitly
|
|
73
|
+
* from coin object rather than counting on having it in the coin name itself.
|
|
74
|
+
* This processing is needed due to poor quality of swapspace coins names. */
|
|
75
|
+
let name = this.removeProtocolNameFromCoinName(item.name, code, network);
|
|
76
|
+
const ticker = toRabbitTicker(code, network);
|
|
77
|
+
const defaultDecimalPlacesForCoinNotSupportedOOB = 8;
|
|
78
|
+
const defaultMinConfirmationsForCoinNotSupportedOOB = 1;
|
|
79
|
+
coin = new Coin(
|
|
80
|
+
name,
|
|
81
|
+
ticker,
|
|
82
|
+
code,
|
|
83
|
+
defaultDecimalPlacesForCoinNotSupportedOOB,
|
|
84
|
+
null,
|
|
85
|
+
"",
|
|
86
|
+
null,
|
|
87
|
+
null,
|
|
88
|
+
defaultMinConfirmationsForCoinNotSupportedOOB,
|
|
89
|
+
null,
|
|
90
|
+
[],
|
|
91
|
+
60000,
|
|
92
|
+
null, // We cannot recognize blockchain from swapspace data
|
|
93
|
+
code !== network ? new Protocol(network) : null,
|
|
94
|
+
item.contractAddress || null,
|
|
95
|
+
false
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
if (coin) {
|
|
99
|
+
return new SwapProviderCoinInfo(
|
|
100
|
+
coin,
|
|
101
|
+
item.code,
|
|
102
|
+
item.network,
|
|
103
|
+
item.hasExtraId,
|
|
104
|
+
item.extraIdName,
|
|
105
|
+
item.popular ? 1 : 0,
|
|
106
|
+
item.icon ? `https://storage.swapspace.co${item.icon}` : FALLBACK_ASSET_ICON_URL,
|
|
107
|
+
item.deposit ?? false,
|
|
108
|
+
item.withdrawal ?? false,
|
|
109
|
+
item.validationRegexp ?? null,
|
|
110
|
+
true
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return [];
|
|
115
|
+
})
|
|
116
|
+
.flat();
|
|
117
|
+
this._supportedCoinsLastUpdateTimestamp = Date.now();
|
|
118
|
+
this._putPopularCoinsFirst();
|
|
119
|
+
await super._fetchSupportedCurrenciesIfNeeded();
|
|
120
|
+
}
|
|
121
|
+
} catch (e) {
|
|
122
|
+
improveAndRethrow(e, loggerSource);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
async _fetchPartnersListIfNeeded() {
|
|
127
|
+
const loggerSource = "_fetchPartnersListIfNeeded";
|
|
128
|
+
try {
|
|
129
|
+
if (this._partners?.length === 0) {
|
|
130
|
+
const rawResponse = await axios.get(`${this._URL}/api/v2/partners`, { headers: this._headers });
|
|
131
|
+
Logger.log(`Retrieved ${rawResponse?.data?.length} partners`, loggerSource);
|
|
132
|
+
this._partners = Array.isArray(rawResponse?.data) ? rawResponse?.data : [];
|
|
133
|
+
}
|
|
134
|
+
} catch (e) {
|
|
135
|
+
Logger.logError(e, loggerSource, "Failed to fetch partners list from swapspace");
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
async getSwapInfo(
|
|
140
|
+
fromCoin,
|
|
141
|
+
toCoin,
|
|
142
|
+
amountCoins,
|
|
143
|
+
fixed = false,
|
|
144
|
+
fromCoinToUsdRate = null,
|
|
145
|
+
amountIsToReceive = false,
|
|
146
|
+
bannedPartners = []
|
|
147
|
+
) {
|
|
148
|
+
const loggerSource = "getSwapInfo";
|
|
149
|
+
try {
|
|
150
|
+
if (amountIsToReceive)
|
|
151
|
+
throw new Error("Swapspace doesn't support exchanging to get the exact receiving amount");
|
|
152
|
+
if (
|
|
153
|
+
!(fromCoin instanceof Coin) ||
|
|
154
|
+
!(toCoin instanceof Coin) ||
|
|
155
|
+
typeof amountCoins !== "string" ||
|
|
156
|
+
BigNumber(amountCoins).lt("0") ||
|
|
157
|
+
(fixed !== null && typeof fixed !== "boolean")
|
|
158
|
+
) {
|
|
159
|
+
throw new Error(
|
|
160
|
+
`Wrong input params: ${amountCoins} ${fromCoin.ticker} -> ${toCoin.ticker}, ${
|
|
161
|
+
fromCoin instanceof Coin
|
|
162
|
+
}, ${toCoin instanceof Coin}, ${typeof fixed} ${fixed}`
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
await this._fetchSupportedCurrenciesIfNeeded();
|
|
166
|
+
|
|
167
|
+
const fromCoinSwapspaceDetails = this._supportedCoins.find(i => i.coin?.ticker === fromCoin?.ticker);
|
|
168
|
+
const toCoinSwapspaceDetails = this._supportedCoins.find(i => i.coin?.ticker === toCoin?.ticker);
|
|
169
|
+
if (
|
|
170
|
+
!fromCoinSwapspaceDetails ||
|
|
171
|
+
!toCoinSwapspaceDetails ||
|
|
172
|
+
!fromCoinSwapspaceDetails.deposit ||
|
|
173
|
+
!toCoinSwapspaceDetails.withdrawal ||
|
|
174
|
+
!fromCoinSwapspaceDetails.isAvailable ||
|
|
175
|
+
!toCoinSwapspaceDetails.isAvailable
|
|
176
|
+
) {
|
|
177
|
+
return {
|
|
178
|
+
result: false,
|
|
179
|
+
reason: SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
/* Here we use not documented parameter 'estimated=false'. This parameter controls whether we want to use
|
|
183
|
+
* cached rate values stored in swapspace cache. Their support says they store at most for 30 sec.
|
|
184
|
+
* But we are better off using the most actual rates.
|
|
185
|
+
*/
|
|
186
|
+
const response = await axios.get(
|
|
187
|
+
`${this._URL}/api/v2/amounts?fromCurrency=${fromCoinSwapspaceDetails.code}&fromNetwork=${fromCoinSwapspaceDetails.network}&toNetwork=${toCoinSwapspaceDetails.network}&toCurrency=${toCoinSwapspaceDetails.code}&amount=${amountCoins}&estimated=false`,
|
|
188
|
+
{ headers: this._headers }
|
|
189
|
+
);
|
|
190
|
+
Logger.log(`Retrieved ${response?.data?.length} options`, loggerSource);
|
|
191
|
+
const options = Array.isArray(response.data) ? response.data : [];
|
|
192
|
+
// TODO: [feature, high] remove if possible over-engineering about toAmount = 0 options treating as supported but not available. task_id=404ae30d9a7743238af3cc0d3bae9239
|
|
193
|
+
let exchangesSupportingThePairDespiteFixedOrFloating = options.filter(
|
|
194
|
+
exchange =>
|
|
195
|
+
exchange?.exists &&
|
|
196
|
+
!bannedPartners.find(bannedPartner => bannedPartner === exchange?.partner) &&
|
|
197
|
+
(exchange?.fixed === false || exchange?.fixed === true) &&
|
|
198
|
+
typeof exchange.toAmount === "number" &&
|
|
199
|
+
((typeof exchange.min === "number" && typeof exchange.max === "number") || exchange.toAmount > 0) &&
|
|
200
|
+
(exchange.min === 0 || exchange.max === 0 || exchange.max > exchange.min)
|
|
201
|
+
);
|
|
202
|
+
let exchangesSupportingThePair = exchangesSupportingThePairDespiteFixedOrFloating;
|
|
203
|
+
if (fixed != null) {
|
|
204
|
+
exchangesSupportingThePair = exchangesSupportingThePairDespiteFixedOrFloating.filter(
|
|
205
|
+
option => option.fixed === fixed
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
Logger.log(`${exchangesSupportingThePair?.length} of them have exist=true`, loggerSource);
|
|
209
|
+
if (exchangesSupportingThePair.length === 0) {
|
|
210
|
+
if (exchangesSupportingThePairDespiteFixedOrFloating.length > 0 && fixed !== null) {
|
|
211
|
+
return {
|
|
212
|
+
result: false,
|
|
213
|
+
reason: fixed
|
|
214
|
+
? SwapProvider.NO_SWAPS_REASONS.NO_FIXED_BUT_HAVE_FLOATING
|
|
215
|
+
: SwapProvider.NO_SWAPS_REASONS.NO_FLOATING_BUT_HAVE_FIXED,
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
return {
|
|
219
|
+
result: false,
|
|
220
|
+
reason: SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED,
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
const availableExchanges = exchangesSupportingThePair.filter(
|
|
224
|
+
exchange => typeof exchange?.toAmount === "number" && exchange.toAmount > 0
|
|
225
|
+
);
|
|
226
|
+
Logger.log(`Available (having amountTo): ${safeStringify(availableExchanges)}`, loggerSource);
|
|
227
|
+
// min=0 or max=0 means there is no limit for the partner
|
|
228
|
+
let smallestMin = null;
|
|
229
|
+
if (exchangesSupportingThePair.find(ex => BigNumber(ex.min).isZero()) == null) {
|
|
230
|
+
smallestMin = exchangesSupportingThePair.reduce((prev, cur) => {
|
|
231
|
+
if (typeof cur.min === "number" && (prev === null || BigNumber(cur.min).lt(prev)))
|
|
232
|
+
return BigNumber(cur.min);
|
|
233
|
+
return prev;
|
|
234
|
+
}, null);
|
|
235
|
+
}
|
|
236
|
+
let greatestMax = null;
|
|
237
|
+
if (exchangesSupportingThePair.find(ex => BigNumber(ex.max).isZero()) == null) {
|
|
238
|
+
greatestMax = exchangesSupportingThePair.reduce((prev, cur) => {
|
|
239
|
+
if (typeof cur.max === "number" && (prev === null || BigNumber(cur.max).gt(prev)))
|
|
240
|
+
return BigNumber(cur.max);
|
|
241
|
+
return prev;
|
|
242
|
+
}, null);
|
|
243
|
+
}
|
|
244
|
+
let extraCoinsToFitMinMax = "0";
|
|
245
|
+
if (typeof fromCoinToUsdRate === "string" && BigNumber(fromCoinToUsdRate).gt("0")) {
|
|
246
|
+
const extraUsdToFitMinMax = BigNumber("1"); // We correct the limits as the exact limit can fluctuate and cause failed swap creation
|
|
247
|
+
extraCoinsToFitMinMax = AmountUtils.trim(extraUsdToFitMinMax.div(fromCoinToUsdRate), fromCoin.digits);
|
|
248
|
+
}
|
|
249
|
+
if (smallestMin instanceof BigNumber) {
|
|
250
|
+
smallestMin = AmountUtils.trim(smallestMin.plus(extraCoinsToFitMinMax), fromCoin.digits);
|
|
251
|
+
}
|
|
252
|
+
if (greatestMax instanceof BigNumber) {
|
|
253
|
+
if (greatestMax > extraCoinsToFitMinMax) {
|
|
254
|
+
greatestMax = AmountUtils.trim(greatestMax.minus(extraCoinsToFitMinMax), fromCoin.digits);
|
|
255
|
+
} else {
|
|
256
|
+
greatestMax = "0";
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
if (availableExchanges.length) {
|
|
261
|
+
const sorted = availableExchanges.sort((op1, op2) => op2.toAmount - op1.toAmount);
|
|
262
|
+
const bestOpt = sorted[0];
|
|
263
|
+
Logger.log(`Returning first option after sorting: ${safeStringify(bestOpt)}`, loggerSource);
|
|
264
|
+
let max = null;
|
|
265
|
+
let min = null;
|
|
266
|
+
if (extraCoinsToFitMinMax != null) {
|
|
267
|
+
if (typeof bestOpt.max === "number" && bestOpt.max !== 0) {
|
|
268
|
+
max = BigNumber(bestOpt.max).minus(extraCoinsToFitMinMax);
|
|
269
|
+
max = AmountUtils.trim(max.lt(0) ? "0" : max, fromCoin.digits);
|
|
270
|
+
}
|
|
271
|
+
if (typeof bestOpt.min === "number" && bestOpt.min !== 0) {
|
|
272
|
+
min = AmountUtils.trim(BigNumber(bestOpt.min).plus(extraCoinsToFitMinMax), fromCoin.digits);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
const rate =
|
|
277
|
+
bestOpt.toAmount && bestOpt.fromAmount ? BigNumber(bestOpt.toAmount).div(bestOpt.fromAmount) : null;
|
|
278
|
+
|
|
279
|
+
await this._fetchPartnersListIfNeeded();
|
|
280
|
+
const partner = this._partners.find(p => bestOpt?.partner?.toLowerCase() === p.path.toLowerCase());
|
|
281
|
+
const isRefundAddressRequired =
|
|
282
|
+
partner == null ? true : bestOpt.fixed ? partner.reqFixedRefund : partner.reqFloatRefund;
|
|
283
|
+
return {
|
|
284
|
+
result: true,
|
|
285
|
+
min: min,
|
|
286
|
+
max: max,
|
|
287
|
+
smallestMin: smallestMin,
|
|
288
|
+
greatestMax: greatestMax,
|
|
289
|
+
rate: rate != null ? AmountUtils.trim(rate, this._maxRateDigits) : null,
|
|
290
|
+
durationMinutesRange: bestOpt.duration ?? null,
|
|
291
|
+
fixed: bestOpt.fixed,
|
|
292
|
+
rawSwapData: bestOpt,
|
|
293
|
+
isRefundAddressRequired: !!isRefundAddressRequired,
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
const result = {
|
|
297
|
+
result: false,
|
|
298
|
+
reason:
|
|
299
|
+
smallestMin && BigNumber(amountCoins).lt(smallestMin)
|
|
300
|
+
? SwapProvider.NO_SWAPS_REASONS.TOO_LOW
|
|
301
|
+
: greatestMax && BigNumber(amountCoins).gt(greatestMax)
|
|
302
|
+
? SwapProvider.NO_SWAPS_REASONS.TOO_HIGH
|
|
303
|
+
: SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED,
|
|
304
|
+
smallestMin: smallestMin,
|
|
305
|
+
greatestMax: greatestMax,
|
|
306
|
+
};
|
|
307
|
+
Logger.log(`Returning result ${safeStringify(result)}`, loggerSource);
|
|
308
|
+
return result;
|
|
309
|
+
} catch (e) {
|
|
310
|
+
if (e?.response?.status === 429) {
|
|
311
|
+
return {
|
|
312
|
+
result: false,
|
|
313
|
+
reason: SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED,
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
Logger.log(`Internal swapspace/rabbit error when getting swap options ${safeStringify(e)}`, loggerSource);
|
|
317
|
+
improveAndRethrow(e, loggerSource);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
async createSwap(
|
|
322
|
+
fromCoin,
|
|
323
|
+
toCoin,
|
|
324
|
+
amount,
|
|
325
|
+
toAddress,
|
|
326
|
+
refundAddress,
|
|
327
|
+
proprietarySwapEstimationData,
|
|
328
|
+
clientIpAddress,
|
|
329
|
+
fixed,
|
|
330
|
+
toCurrencyExtraId = "",
|
|
331
|
+
refundExtraId = "",
|
|
332
|
+
amountIsToReceive = false
|
|
333
|
+
) {
|
|
334
|
+
const loggerSource = "createSwap";
|
|
335
|
+
const partner = proprietarySwapEstimationData?.partner;
|
|
336
|
+
try {
|
|
337
|
+
if (amountIsToReceive)
|
|
338
|
+
throw new Error("Swapspace doesn't support exchanging to get the exact receiving amount");
|
|
339
|
+
if (
|
|
340
|
+
!(fromCoin instanceof Coin) ||
|
|
341
|
+
!(toCoin instanceof Coin) ||
|
|
342
|
+
typeof amount !== "string" ||
|
|
343
|
+
typeof toAddress !== "string" ||
|
|
344
|
+
typeof refundAddress !== "string" ||
|
|
345
|
+
typeof clientIpAddress != "string" ||
|
|
346
|
+
typeof fixed != "boolean" ||
|
|
347
|
+
clientIpAddress.length === 0
|
|
348
|
+
) {
|
|
349
|
+
throw new Error(
|
|
350
|
+
`Invalid input: ${fromCoin} ${toCoin} ${amount} ${toAddress} ${refundAddress} ${clientIpAddress?.length} ${fixed}`
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
const rateId = proprietarySwapEstimationData?.id;
|
|
354
|
+
if (typeof partner !== "string" || typeof rateId !== "string") {
|
|
355
|
+
throw new Error(`Invalid raw swap data: ${safeStringify(proprietarySwapEstimationData)}`);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
await this._fetchSupportedCurrenciesIfNeeded();
|
|
359
|
+
|
|
360
|
+
const [fromCoinData, toCoinData] = [fromCoin.ticker, toCoin.ticker].map(t =>
|
|
361
|
+
this._supportedCoins.find(coinData => coinData.coin.ticker === t)
|
|
362
|
+
);
|
|
363
|
+
const [fromCurrencyHasExtraId, toCurrencyHasExtraId] = [!!fromCoinData.hasExtraId, !!toCoinData.hasExtraId];
|
|
364
|
+
const requestData = {
|
|
365
|
+
partner: partner,
|
|
366
|
+
fromCurrency: fromCoinData.code,
|
|
367
|
+
fromNetwork: fromCoinData.network,
|
|
368
|
+
toCurrency: toCoinData.code,
|
|
369
|
+
toNetwork: toCoinData.network,
|
|
370
|
+
address: toAddress,
|
|
371
|
+
amount: amount,
|
|
372
|
+
fixed: fixed,
|
|
373
|
+
extraId: toCurrencyHasExtraId ? toCurrencyExtraId ?? "" : "",
|
|
374
|
+
// This param is not documented. But the refund is usually manual so this is not critical.
|
|
375
|
+
refundExtraId: fromCurrencyHasExtraId ? refundExtraId ?? "" : "",
|
|
376
|
+
rateId: rateId,
|
|
377
|
+
userIp: clientIpAddress,
|
|
378
|
+
refund: refundAddress,
|
|
379
|
+
};
|
|
380
|
+
|
|
381
|
+
Logger.log(`Sending create request: ${safeStringify(requestData)}`, loggerSource);
|
|
382
|
+
const response = await axios.post(`${this._URL}/api/v2/exchange`, requestData, { headers: this._headers });
|
|
383
|
+
const result = response.data;
|
|
384
|
+
Logger.log(`Creation result ${safeStringify(result)}`, loggerSource);
|
|
385
|
+
|
|
386
|
+
if (result?.id) {
|
|
387
|
+
if (
|
|
388
|
+
typeof result?.from?.amount !== "number" ||
|
|
389
|
+
typeof result?.from?.address !== "string" ||
|
|
390
|
+
typeof result?.fixed !== "boolean" ||
|
|
391
|
+
typeof result?.to?.amount !== "number" ||
|
|
392
|
+
typeof result?.to?.address !== "string"
|
|
393
|
+
)
|
|
394
|
+
throw new Error(`Wrong swap creation result ${result}`);
|
|
395
|
+
/* We use the returned rate preferably but if the retrieved
|
|
396
|
+
* rate 0/null/undefined we calculate it manually */
|
|
397
|
+
let rate = result.rate;
|
|
398
|
+
if (typeof rate !== "number" || BigNumber(rate).isZero()) {
|
|
399
|
+
rate = BigNumber(result?.to?.amount).div(result?.from?.amount);
|
|
400
|
+
} else {
|
|
401
|
+
rate = BigNumber(rate);
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
return {
|
|
405
|
+
result: true,
|
|
406
|
+
swapId: result?.id,
|
|
407
|
+
fromCoin: fromCoin,
|
|
408
|
+
fromAmount: AmountUtils.trim(result?.from?.amount, fromCoin.digits),
|
|
409
|
+
fromAddress: result?.from?.address,
|
|
410
|
+
toCoin: toCoin,
|
|
411
|
+
toAmount: AmountUtils.trim(result?.to?.amount, toCoin.digits),
|
|
412
|
+
toAddress: result?.to?.address,
|
|
413
|
+
fromCurrencyExtraId: result?.from?.extraId ?? "",
|
|
414
|
+
rate: AmountUtils.trim(rate, this._maxRateDigits),
|
|
415
|
+
fixed: result.fixed,
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
const errorMessage = `Swap creation succeeded but the response is wrong: ${safeStringify(response)}`;
|
|
419
|
+
Logger.log(errorMessage, loggerSource);
|
|
420
|
+
throw new Error(errorMessage);
|
|
421
|
+
} catch (e) {
|
|
422
|
+
Logger.logError(e, loggerSource, `Failed to create swap. Error is: ${safeStringify(e)}`);
|
|
423
|
+
const composeFailResult = reason => ({
|
|
424
|
+
result: false,
|
|
425
|
+
reason: reason,
|
|
426
|
+
partner: partner,
|
|
427
|
+
});
|
|
428
|
+
const status = e?.response?.status;
|
|
429
|
+
const data = e?.response?.data;
|
|
430
|
+
if (status === 429) {
|
|
431
|
+
Logger.log(`Returning fail - RPS limit exceeded ${data}`, loggerSource);
|
|
432
|
+
return composeFailResult(SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED);
|
|
433
|
+
}
|
|
434
|
+
const texts422 = [
|
|
435
|
+
"Pair cannot be processed by",
|
|
436
|
+
"Currency not found",
|
|
437
|
+
"Currencies not found",
|
|
438
|
+
"Amount maximum is",
|
|
439
|
+
"Amount minimum is",
|
|
440
|
+
];
|
|
441
|
+
const text403 = "IP address is forbidden";
|
|
442
|
+
if (
|
|
443
|
+
typeof data === "string" &&
|
|
444
|
+
((status === 403 && data.includes(text403)) ||
|
|
445
|
+
(status === 422 && texts422.find(text => data.includes(text))))
|
|
446
|
+
) {
|
|
447
|
+
Logger.log(`Returning retriable fail: ${status} - ${data}, ${partner}`, loggerSource);
|
|
448
|
+
return composeFailResult(SwapProvider.CREATION_FAIL_REASONS.RETRIABLE_FAIL);
|
|
449
|
+
}
|
|
450
|
+
Logger.log(`Internal swapspace/rabbit error for ${partner}: ${safeStringify(e)}`, loggerSource);
|
|
451
|
+
improveAndRethrow(e, loggerSource);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
_mapSwapspaceStatusToRabbitStatus(status, isExpiredByTime) {
|
|
456
|
+
switch (status) {
|
|
457
|
+
case "waiting":
|
|
458
|
+
if (isExpiredByTime) {
|
|
459
|
+
return SwapProvider.SWAP_STATUSES.EXPIRED;
|
|
460
|
+
}
|
|
461
|
+
return SwapProvider.SWAP_STATUSES.WAITING_FOR_PAYMENT;
|
|
462
|
+
case "confirming":
|
|
463
|
+
return SwapProvider.SWAP_STATUSES.CONFIRMING;
|
|
464
|
+
case "exchanging":
|
|
465
|
+
return SwapProvider.SWAP_STATUSES.EXCHANGING;
|
|
466
|
+
case "sending":
|
|
467
|
+
return SwapProvider.SWAP_STATUSES.PAYMENT_RECEIVED;
|
|
468
|
+
case "finished":
|
|
469
|
+
return SwapProvider.SWAP_STATUSES.COMPLETED;
|
|
470
|
+
case "verifying":
|
|
471
|
+
return SwapProvider.SWAP_STATUSES.VERIFYING;
|
|
472
|
+
case "refunded":
|
|
473
|
+
return SwapProvider.SWAP_STATUSES.REFUNDED;
|
|
474
|
+
case "expired":
|
|
475
|
+
return SwapProvider.SWAP_STATUSES.EXPIRED;
|
|
476
|
+
case "failed":
|
|
477
|
+
return SwapProvider.SWAP_STATUSES.FAILED;
|
|
478
|
+
default:
|
|
479
|
+
throw new Error(`Unknown swapspace status: ${status}`);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
async getExistingSwapsDetailsAndStatus(swapIds) {
|
|
484
|
+
const loggerSource = "getExistingSwapsDetailsAndStatus";
|
|
485
|
+
try {
|
|
486
|
+
if (swapIds.find(id => typeof id !== "string")) {
|
|
487
|
+
throw new Error("Swap id is not string: " + safeStringify(swapIds) + " " + this.id);
|
|
488
|
+
}
|
|
489
|
+
const getNotFailingOn404 = async swapId => {
|
|
490
|
+
try {
|
|
491
|
+
return await axios.get(`${this._URL}/api/v2/exchange/${swapId}`, { headers: this._headers });
|
|
492
|
+
} catch (error) {
|
|
493
|
+
if (error?.response?.status === 404) return [];
|
|
494
|
+
throw error;
|
|
495
|
+
}
|
|
496
|
+
};
|
|
497
|
+
const responses = await Promise.all(swapIds.map(swapId => getNotFailingOn404(swapId)));
|
|
498
|
+
const wo404 = responses.flat();
|
|
499
|
+
Logger.log("All swaps RAW: " + JSON.stringify(wo404.map(r => r.data)), loggerSource);
|
|
500
|
+
const swaps = wo404
|
|
501
|
+
.map(r => r.data)
|
|
502
|
+
.map((swap, index) => {
|
|
503
|
+
const fromCoin = this._supportedCoins.find(
|
|
504
|
+
i => i.code === swap.from.code && i.network === swap.from.network
|
|
505
|
+
)?.coin;
|
|
506
|
+
const toCoin = this._supportedCoins.find(
|
|
507
|
+
i => i.code === swap.to.code && i.network === swap.to.network
|
|
508
|
+
)?.coin;
|
|
509
|
+
if (!fromCoin || !toCoin) {
|
|
510
|
+
return []; // We skip swaps with not supported coins for now
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
const toUtcTimestamp = timeStr => Date.parse(timeStr.match(/.+[Zz]$/) ? timeStr : `${timeStr}Z`);
|
|
514
|
+
const expiresAt = toUtcTimestamp(swap.timestamps.expiresAt);
|
|
515
|
+
const isExpiredByTime = expiresAt < Date.now();
|
|
516
|
+
const status = this._mapSwapspaceStatusToRabbitStatus(swap.status, isExpiredByTime);
|
|
517
|
+
const toDigits = status === SwapProvider.SWAP_STATUSES.REFUNDED ? fromCoin.digits : toCoin.digits;
|
|
518
|
+
const addressToSendCoinsToSwapspace = swap.from.address;
|
|
519
|
+
const toUrl = (swap.blockExplorerTransactionUrl.to ?? "")
|
|
520
|
+
.replace(/from=swapspace&?/g, "")
|
|
521
|
+
.replaceAll(/&&+/g, "&")
|
|
522
|
+
.replace("?&", "?")
|
|
523
|
+
.replace(/&$/, "")
|
|
524
|
+
.replace(/\?$/, "");
|
|
525
|
+
return new ExistingSwap(
|
|
526
|
+
swapIds[index],
|
|
527
|
+
status,
|
|
528
|
+
toUtcTimestamp(swap.timestamps.createdAt),
|
|
529
|
+
expiresAt,
|
|
530
|
+
swap.confirmations,
|
|
531
|
+
AmountUtils.trim(swap.rate, this._maxRateDigits),
|
|
532
|
+
swap.fixed,
|
|
533
|
+
swap.refundAddress,
|
|
534
|
+
addressToSendCoinsToSwapspace,
|
|
535
|
+
fromCoin,
|
|
536
|
+
AmountUtils.trim(swap.from.amount, fromCoin.digits),
|
|
537
|
+
swap.from.transactionHash,
|
|
538
|
+
swap.blockExplorerTransactionUrl.from,
|
|
539
|
+
toCoin,
|
|
540
|
+
AmountUtils.trim(swap.to.amount, toDigits),
|
|
541
|
+
swap.to.transactionHash,
|
|
542
|
+
toUrl,
|
|
543
|
+
swap.to.address,
|
|
544
|
+
swap.partner,
|
|
545
|
+
swap.from.extraId ?? null,
|
|
546
|
+
swap.to.extraId ?? null,
|
|
547
|
+
swap.refundExtraId ?? null
|
|
548
|
+
);
|
|
549
|
+
})
|
|
550
|
+
.flat();
|
|
551
|
+
Logger.log(`Swap details result ${safeStringify(swaps)}`, loggerSource);
|
|
552
|
+
return { result: true, swaps: swaps };
|
|
553
|
+
} catch (e) {
|
|
554
|
+
Logger.logError(e, loggerSource, `Failed to get swap details. Error is: ${safeStringify(e)}`);
|
|
555
|
+
const composeFailResult = reason => ({
|
|
556
|
+
result: false,
|
|
557
|
+
reason: reason,
|
|
558
|
+
});
|
|
559
|
+
const status = e?.response?.status;
|
|
560
|
+
const data = e?.response?.data;
|
|
561
|
+
if (status === 429) {
|
|
562
|
+
Logger.log(`Returning fail - RPS limit exceeded ${data}`, loggerSource);
|
|
563
|
+
return composeFailResult(SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED);
|
|
564
|
+
}
|
|
565
|
+
improveAndRethrow(e, loggerSource);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
async getPartnersList() {
|
|
570
|
+
try {
|
|
571
|
+
await this._fetchPartnersListIfNeeded();
|
|
572
|
+
const swapspacePartners = this._partners.map(
|
|
573
|
+
p =>
|
|
574
|
+
new Partner(
|
|
575
|
+
p.path,
|
|
576
|
+
p.name,
|
|
577
|
+
p?.image?.default ? "https://storage.swapspace.co" + p.image.default : null,
|
|
578
|
+
p.kycLevel
|
|
579
|
+
)
|
|
580
|
+
);
|
|
581
|
+
const swapspaceItself = new Partner(
|
|
582
|
+
"swapspace",
|
|
583
|
+
"Swapspace",
|
|
584
|
+
"https://storage.swapspace.co/static/logo-vertical-black.svg",
|
|
585
|
+
KYC_LEVELS.LOW
|
|
586
|
+
);
|
|
587
|
+
return [swapspaceItself, ...swapspacePartners];
|
|
588
|
+
} catch (e) {
|
|
589
|
+
improveAndRethrow(e, "swapspace.getPartnersList");
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export class BaseSwapCreationInfo {
|
|
2
|
+
/** @type {Coin} */
|
|
3
|
+
fromCoin;
|
|
4
|
+
/** @type {Coin} */
|
|
5
|
+
toCoin;
|
|
6
|
+
/** @type {string} */
|
|
7
|
+
fromAmountCoins;
|
|
8
|
+
/** @type {string} */
|
|
9
|
+
toAmountCoins;
|
|
10
|
+
/** @type {string} */
|
|
11
|
+
rate;
|
|
12
|
+
/** @type {Object} */
|
|
13
|
+
rawSwapData;
|
|
14
|
+
/** @type {string} */
|
|
15
|
+
min;
|
|
16
|
+
/** @type {number} */
|
|
17
|
+
fiatMin;
|
|
18
|
+
/** @type {string} */
|
|
19
|
+
max;
|
|
20
|
+
/** @type {number} */
|
|
21
|
+
fiatMax;
|
|
22
|
+
/** @type {string} */
|
|
23
|
+
durationMinutesRange;
|
|
24
|
+
/** @type {boolean} */
|
|
25
|
+
fixed;
|
|
26
|
+
/** @type {string|null} */
|
|
27
|
+
partner;
|
|
28
|
+
/** @type {boolean} */
|
|
29
|
+
isRefundAddressRequired;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @param fromCoin {Coin}
|
|
33
|
+
* @param toCoin {Coin}
|
|
34
|
+
* @param fromAmountCoins {string}
|
|
35
|
+
* @param toAmountCoins {string}
|
|
36
|
+
* @param rate {string}
|
|
37
|
+
* @param rawSwapData {Object}
|
|
38
|
+
* @param min {string}
|
|
39
|
+
* @param fiatMin {number}
|
|
40
|
+
* @param max {string}
|
|
41
|
+
* @param fiatMax {number}
|
|
42
|
+
* @param durationMinutesRange {string}
|
|
43
|
+
* @param fixed {boolean}
|
|
44
|
+
* @param partner {string|null} rabbit partner id
|
|
45
|
+
* @param [isRefundAddressRequired=false] {boolean}
|
|
46
|
+
*/
|
|
47
|
+
constructor(
|
|
48
|
+
fromCoin,
|
|
49
|
+
toCoin,
|
|
50
|
+
fromAmountCoins,
|
|
51
|
+
toAmountCoins,
|
|
52
|
+
rate,
|
|
53
|
+
rawSwapData,
|
|
54
|
+
min,
|
|
55
|
+
fiatMin,
|
|
56
|
+
max,
|
|
57
|
+
fiatMax,
|
|
58
|
+
durationMinutesRange,
|
|
59
|
+
fixed,
|
|
60
|
+
partner = null,
|
|
61
|
+
isRefundAddressRequired = false
|
|
62
|
+
) {
|
|
63
|
+
this.fromCoin = fromCoin;
|
|
64
|
+
this.toCoin = toCoin;
|
|
65
|
+
this.fromAmountCoins = fromAmountCoins;
|
|
66
|
+
this.toAmountCoins = toAmountCoins;
|
|
67
|
+
this.rate = rate;
|
|
68
|
+
this.rawSwapData = rawSwapData;
|
|
69
|
+
this.min = min;
|
|
70
|
+
this.fiatMin = fiatMin;
|
|
71
|
+
this.max = max;
|
|
72
|
+
this.fiatMax = fiatMax;
|
|
73
|
+
this.durationMinutesRange = durationMinutesRange;
|
|
74
|
+
this.fixed = fixed;
|
|
75
|
+
this.partner = partner;
|
|
76
|
+
this.isRefundAddressRequired = isRefundAddressRequired;
|
|
77
|
+
}
|
|
78
|
+
}
|