@rabbitio/ui-kit 1.0.0-beta.70 → 1.0.0-beta.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/coverage/clover.xml +7803 -7729
- package/coverage/coverage-final.json +91 -95
- package/coverage/index.html +182 -272
- package/coverage/rabbit-ui-kit/index.html +1 -1
- package/coverage/rabbit-ui-kit/index.js.html +1 -1
- package/coverage/rabbit-ui-kit/src/{common → common-apis}/adapters/axiosAdapter.js.html +3 -3
- package/coverage/rabbit-ui-kit/src/{common → common-apis}/adapters/index.html +3 -3
- package/coverage/rabbit-ui-kit/src/{common → common-apis}/adapters/qrUtils.js.html +3 -3
- package/coverage/rabbit-ui-kit/src/{common → common-apis}/amountUtils.js.html +3 -3
- package/coverage/rabbit-ui-kit/src/{common → common-apis}/errorUtils.js.html +3 -3
- package/coverage/rabbit-ui-kit/src/{common → common-apis}/external-apis/apiGroups.js.html +3 -3
- package/coverage/rabbit-ui-kit/src/{common → common-apis}/external-apis/index.html +3 -3
- package/coverage/rabbit-ui-kit/src/{common → common-apis}/external-apis/ipAddressProviders.js.html +5 -5
- package/coverage/rabbit-ui-kit/src/{common → common-apis}/fiatCurrenciesService.js.html +3 -3
- package/coverage/rabbit-ui-kit/src/{constants → common-apis}/globalConstants.jsx.html +3 -3
- package/coverage/rabbit-ui-kit/src/{common → common-apis}/index.html +22 -7
- package/coverage/rabbit-ui-kit/src/{common → common-apis}/models/blockchain.js.html +3 -3
- package/coverage/rabbit-ui-kit/src/{common → common-apis}/models/coin.js.html +3 -3
- package/coverage/rabbit-ui-kit/src/{common → common-apis}/models/index.html +3 -3
- package/coverage/rabbit-ui-kit/src/{common → common-apis}/models/protocol.js.html +3 -3
- package/coverage/rabbit-ui-kit/src/{common → common-apis}/utils/cache.js.html +8 -8
- package/coverage/rabbit-ui-kit/src/{common → common-apis}/utils/emailAPI.js.html +3 -3
- package/coverage/rabbit-ui-kit/src/{common → common-apis}/utils/index.html +3 -3
- package/coverage/rabbit-ui-kit/src/{common → common-apis}/utils/logging/index.html +3 -3
- package/coverage/rabbit-ui-kit/src/{common → common-apis}/utils/logging/logger.js.html +6 -6
- package/coverage/rabbit-ui-kit/src/{common → common-apis}/utils/logging/logsStorage.js.html +5 -5
- package/coverage/rabbit-ui-kit/src/{common → common-apis}/utils/postponeExecution.js.html +3 -3
- package/coverage/rabbit-ui-kit/src/{common → common-apis}/utils/safeStringify.js.html +29 -29
- package/coverage/rabbit-ui-kit/src/index.html +5 -5
- package/coverage/rabbit-ui-kit/src/index.js.html +66 -78
- package/coverage/rabbit-ui-kit/src/{robustExteranlApiCallerService → robust-api-caller}/cacheAndConcurrentRequestsResolver.js.html +5 -5
- package/coverage/rabbit-ui-kit/src/{robustExteranlApiCallerService → robust-api-caller}/cachedRobustExternalApiCallerService.js.html +6 -6
- package/coverage/rabbit-ui-kit/src/{robustExteranlApiCallerService → robust-api-caller}/cancelProcessing.js.html +3 -3
- package/coverage/rabbit-ui-kit/src/{robustExteranlApiCallerService → robust-api-caller}/concurrentCalculationsMetadataHolder.js.html +4 -4
- package/coverage/rabbit-ui-kit/src/{robustExteranlApiCallerService → robust-api-caller}/externalApiProvider.js.html +3 -3
- package/coverage/rabbit-ui-kit/src/{robustExteranlApiCallerService → robust-api-caller}/externalServicesStatsCollector.js.html +5 -5
- package/coverage/rabbit-ui-kit/src/{robustExteranlApiCallerService → robust-api-caller}/index.html +3 -3
- package/coverage/rabbit-ui-kit/src/{robustExteranlApiCallerService → robust-api-caller}/robustExternalAPICallerService.js.html +8 -8
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/index.html +24 -24
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/swapProvider.js.html +9 -6
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/swapspaceSwapProvider.js.html +190 -130
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/baseSwapCreationInfo.js.html +14 -5
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/existingSwap.js.html +1 -1
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/existingSwapWithFiatData.js.html +1 -1
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/index.html +7 -7
- package/coverage/rabbit-ui-kit/src/swaps-lib/services/index.html +5 -5
- package/coverage/rabbit-ui-kit/src/swaps-lib/services/publicSwapService.js.html +14 -11
- package/coverage/rabbit-ui-kit/src/swaps-lib/utils/index.html +1 -1
- package/coverage/rabbit-ui-kit/src/swaps-lib/utils/swapUtils.js.html +7 -7
- package/coverage/rabbit-ui-kit/src/{assets → ui-kit/assets}/wrappedImages/arrowIcon.jsx.html +10 -10
- package/coverage/rabbit-ui-kit/src/{assets → ui-kit/assets}/wrappedImages/arrowTosca.jsx.html +10 -10
- package/coverage/rabbit-ui-kit/src/{assets → ui-kit/assets}/wrappedImages/arrowWhite.jsx.html +11 -11
- package/coverage/rabbit-ui-kit/src/{assets → ui-kit/assets}/wrappedImages/darkRectangle.jsx.html +10 -10
- package/coverage/rabbit-ui-kit/src/{assets → ui-kit/assets}/wrappedImages/determinedError.jsx.html +10 -10
- package/coverage/rabbit-ui-kit/src/{assets → ui-kit/assets}/wrappedImages/failedValidationIcon.jsx.html +10 -10
- package/coverage/rabbit-ui-kit/src/{assets → ui-kit/assets}/wrappedImages/index.html +10 -10
- package/coverage/rabbit-ui-kit/src/{assets → ui-kit/assets}/wrappedImages/infoIcon.jsx.html +10 -10
- package/coverage/rabbit-ui-kit/src/{assets → ui-kit/assets}/wrappedImages/noticeQuestionIcon.jsx.html +10 -10
- package/coverage/rabbit-ui-kit/src/{assets → ui-kit/assets}/wrappedImages/successfulValidationIcon.jsx.html +10 -10
- package/coverage/rabbit-ui-kit/src/{assets → ui-kit/assets}/wrappedImages/walletIcon.jsx.html +10 -10
- package/coverage/rabbit-ui-kit/src/{components → ui-kit/components}/atoms/AssetIcon/AssetIcon.jsx.html +20 -17
- package/coverage/rabbit-ui-kit/src/{constants/organisms/dialog/DialogStep → ui-kit/components/atoms/AssetIcon}/index.html +8 -8
- package/coverage/rabbit-ui-kit/src/{components → ui-kit/components}/atoms/AssetSelection/AssetSelection.jsx.html +23 -20
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/AssetSelection/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/{components → ui-kit/components}/atoms/BackgroundTitle/BackgroundTitle.jsx.html +10 -10
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/BackgroundTitle/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/{components → ui-kit/components}/atoms/InformationMessage/InformationMessage.jsx.html +21 -18
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/InformationMessage/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/{components → ui-kit/components}/atoms/Input/Input.jsx.html +38 -35
- package/coverage/rabbit-ui-kit/src/{components/atoms/buttons/Button → ui-kit/components/atoms/Input}/index.html +8 -8
- package/coverage/rabbit-ui-kit/src/{components → ui-kit/components}/atoms/LoadingDots/LoadingDots.jsx.html +10 -10
- package/coverage/rabbit-ui-kit/src/{components/atoms/buttons/LinkButton → ui-kit/components/atoms/LoadingDots}/index.html +8 -8
- package/coverage/rabbit-ui-kit/src/{components → ui-kit/components}/atoms/NoticeIcon/NoticeIcon.jsx.html +19 -22
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/NoticeIcon/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/{components → ui-kit/components}/atoms/QrCode/QrCode.jsx.html +18 -15
- package/coverage/rabbit-ui-kit/src/{components/atoms/buttons/Close → ui-kit/components/atoms/QrCode}/index.html +8 -8
- package/coverage/rabbit-ui-kit/src/{components → ui-kit/components}/atoms/RateSelector/RateSelector.jsx.html +16 -13
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/RateSelector/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/{components → ui-kit/components}/atoms/SupportChat/SupportChat.jsx.html +16 -13
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/SupportChat/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/{components → ui-kit/components}/atoms/Textarea/Textarea.jsx.html +36 -30
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Textarea/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/{components → ui-kit/components}/atoms/TitleBox/TitleBox.jsx.html +29 -29
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TitleBox/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/{components → ui-kit/components}/atoms/Tooltip/Tooltip.jsx.html +48 -21
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Tooltip/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/{components → ui-kit/components}/atoms/TwoLinesOfText/LinesOfText.jsx.html +29 -23
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TwoLinesOfText/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/{components → ui-kit/components}/atoms/Validation/Validation.jsx.html +13 -13
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Validation/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/{components → ui-kit/components}/atoms/buttons/Button/Button.jsx.html +10 -10
- package/coverage/rabbit-ui-kit/src/{components/atoms/AssetSelection → ui-kit/components/atoms/buttons/Button}/index.html +15 -15
- package/coverage/rabbit-ui-kit/src/{components → ui-kit/components}/atoms/buttons/Close/Close.jsx.html +30 -15
- package/coverage/rabbit-ui-kit/src/{components/atoms/InformationMessage → ui-kit/components/atoms/buttons/Close}/index.html +15 -15
- package/coverage/rabbit-ui-kit/src/{components → ui-kit/components}/atoms/buttons/LinkButton/LinkButton.jsx.html +34 -16
- package/coverage/rabbit-ui-kit/src/{components/atoms/BackgroundTitle → ui-kit/components/atoms/buttons/LinkButton}/index.html +15 -15
- package/coverage/rabbit-ui-kit/src/{components → ui-kit/components}/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx.html +11 -11
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/RadioButtonWithText/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/{components → ui-kit/components}/molecules/AmountInput/AmountInput.jsx.html +20 -17
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/AmountInput/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/{components → ui-kit/components}/molecules/CoinPicker/CoinPicker.jsx.html +44 -38
- package/coverage/rabbit-ui-kit/src/{components/organisms/Dialog/DialogStep → ui-kit/components/molecules/CoinPicker}/index.html +8 -8
- package/coverage/rabbit-ui-kit/src/{components → ui-kit/components}/molecules/LineWithIconLink/LineWithIconLink.jsx.html +10 -10
- package/coverage/rabbit-ui-kit/src/{components/organisms/Dialog/DialogButtons → ui-kit/components/molecules/LineWithIconLink}/index.html +8 -8
- package/coverage/rabbit-ui-kit/src/{components → ui-kit/components}/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx.html +25 -19
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/TitledLineWithIconLink/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/{components → ui-kit/components}/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx.html +20 -14
- package/coverage/rabbit-ui-kit/src/{components/atoms/buttons/RadioButtonWithText → ui-kit/components/organisms/CoinPickerDialogStep}/index.html +8 -8
- package/coverage/rabbit-ui-kit/src/{components → ui-kit/components}/organisms/Dialog/Dialog.jsx.html +106 -19
- package/coverage/rabbit-ui-kit/src/{components → ui-kit/components}/organisms/Dialog/DialogButtons/DialogButtons.jsx.html +13 -13
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/DialogButtons/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/{components → ui-kit/components}/organisms/Dialog/DialogStep/DialogStep.jsx.html +66 -60
- 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/{components → ui-kit/components}/organisms/SwapForm/SwapForm.jsx.html +361 -76
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/SwapForm/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/{components → ui-kit/components}/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx.html +12 -12
- package/coverage/rabbit-ui-kit/src/ui-kit/components/templates/DeterminedErrorDialogStep/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/{components → ui-kit}/hooks/index.html +22 -7
- package/coverage/rabbit-ui-kit/src/{components → ui-kit}/hooks/useCallHandlingErrors.js.html +4 -4
- package/coverage/rabbit-ui-kit/src/ui-kit/hooks/useIsHydrated.js.html +121 -0
- package/coverage/rabbit-ui-kit/src/{components → ui-kit}/hooks/useReferredState.js.html +3 -3
- package/coverage/rabbit-ui-kit/src/{components → ui-kit}/utils/index.html +3 -3
- package/coverage/rabbit-ui-kit/src/{components → ui-kit}/utils/inputValueProviders.js.html +3 -3
- package/coverage/rabbit-ui-kit/src/{components → ui-kit}/utils/textUtils.js.html +4 -4
- package/coverage/rabbit-ui-kit/src/{components → ui-kit}/utils/uiUtils.js.html +3 -3
- package/coverage/rabbit-ui-kit/src/{components → ui-kit}/utils/urlQueryUtils.js.html +3 -3
- package/coverage/rabbit-ui-kit/stories/atoms/BackgroundTitle.stories.jsx.html +2 -2
- package/coverage/rabbit-ui-kit/stories/atoms/LinesOfText.stories.jsx.html +4 -4
- package/coverage/rabbit-ui-kit/stories/atoms/LoadingDots.stories.jsx.html +3 -3
- package/coverage/rabbit-ui-kit/stories/atoms/QrCode.stories.jsx.html +3 -3
- package/coverage/rabbit-ui-kit/stories/atoms/RateSelector.stories.jsx.html +2 -2
- package/coverage/rabbit-ui-kit/stories/atoms/Validation.stories.jsx.html +2 -2
- package/coverage/rabbit-ui-kit/stories/atoms/buttons/Button.stories.jsx.html +27 -90
- package/coverage/rabbit-ui-kit/stories/atoms/buttons/Close.stories.jsx.html +7 -10
- package/coverage/rabbit-ui-kit/stories/atoms/buttons/LinkButton.stories.jsx.html +13 -7
- package/coverage/rabbit-ui-kit/stories/atoms/buttons/index.html +9 -9
- package/coverage/rabbit-ui-kit/stories/atoms/index.html +1 -1
- package/coverage/rabbit-ui-kit/stories/molecules/LineWithIconLink.stories.jsx.html +3 -3
- package/coverage/rabbit-ui-kit/stories/molecules/TitledLineWithIconLink.stories.jsx.html +2 -2
- package/coverage/rabbit-ui-kit/stories/molecules/index.html +1 -1
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/Dialog.stories.jsx.html +13 -79
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogButtons/DialogButtons.stories.jsx.html +3 -3
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogButtons/index.html +1 -1
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogStep/DialogStep.stories.jsx.html +4 -4
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogStep/index.html +1 -1
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/index.html +5 -5
- package/coverage/rabbit-ui-kit/stories/stubs/exampleContent.jsx.html +1 -1
- package/coverage/rabbit-ui-kit/stories/stubs/index.html +1 -1
- package/coverage/rabbit-ui-kit/stories/templates/DeterminedErrorDialogStep.stories.jsx.html +7 -10
- package/coverage/rabbit-ui-kit/stories/templates/index.html +5 -5
- package/dist/index.cjs +488 -301
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +21029 -21029
- package/dist/index.modern.js +346 -219
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +487 -302
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +488 -301
- package/dist/index.umd.js.map +1 -1
- package/package.json +3 -3
- package/src/{common → common-apis}/external-apis/ipAddressProviders.js +2 -2
- package/src/index.js +62 -66
- package/src/{robustExteranlApiCallerService → robust-api-caller}/cacheAndConcurrentRequestsResolver.js +2 -2
- package/src/{robustExteranlApiCallerService → robust-api-caller}/cachedRobustExternalApiCallerService.js +3 -3
- package/src/{robustExteranlApiCallerService → robust-api-caller}/concurrentCalculationsMetadataHolder.js +1 -1
- package/src/{robustExteranlApiCallerService → robust-api-caller}/externalServicesStatsCollector.js +2 -2
- package/src/{robustExteranlApiCallerService → robust-api-caller}/robustExternalAPICallerService.js +5 -5
- package/src/{robustExteranlApiCallerService → robust-api-caller}/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/_performCallAttempt.test.js +2 -2
- package/src/{robustExteranlApiCallerService → robust-api-caller}/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/callExternalAPI.test.js +1 -1
- package/src/{robustExteranlApiCallerService → robust-api-caller}/tests/robustExternalAPICallerService/robustExternalAPICallerService/constructor.test.js +1 -1
- package/src/swaps-lib/external-apis/swapProvider.js +1 -0
- package/src/swaps-lib/external-apis/swapspaceSwapProvider.js +27 -7
- package/src/swaps-lib/models/baseSwapCreationInfo.js +4 -1
- package/src/swaps-lib/services/publicSwapService.js +8 -7
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +3 -3
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/createSwap.test.js +3 -3
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getAllSupportedCurrencies.test.js +1 -1
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getDepositCurrencies.test.js +1 -1
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getSwapInfo.test.js +124 -4
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getWithdrawalCurrencies.test.js +1 -1
- package/src/swaps-lib/test/utils/swapUtils/safeHandleRequestsLimitExceeding.test.js +2 -2
- package/src/swaps-lib/utils/swapUtils.js +6 -6
- package/{styles → src/ui-kit/assets/styles}/index.scss +1 -1
- package/src/{assets → ui-kit/assets}/wrappedImages/arrowWhite.jsx +1 -1
- package/src/{components → ui-kit/components}/atoms/AssetIcon/AssetIcon.jsx +5 -4
- package/src/{components → ui-kit/components}/atoms/AssetIcon/asset-icon.module.scss +1 -1
- package/src/{components → ui-kit/components}/atoms/AssetSelection/AssetSelection.jsx +8 -7
- package/src/{components → ui-kit/components}/atoms/AssetSelection/asset-selection.module.scss +1 -1
- package/src/{components → ui-kit/components}/atoms/BackgroundTitle/background-title.module.scss +1 -1
- package/src/{components → ui-kit/components}/atoms/InformationMessage/InformationMessage.jsx +6 -5
- package/src/{components → ui-kit/components}/atoms/InformationMessage/information-message.module.scss +1 -1
- package/src/{components → ui-kit/components}/atoms/Input/Input.jsx +23 -22
- package/src/{components → ui-kit/components}/atoms/Input/input.module.scss +1 -1
- package/src/{components → ui-kit/components}/atoms/LoadingDots/LoadingDots.module.scss +1 -1
- package/src/{components → ui-kit/components}/atoms/NoticeIcon/NoticeIcon.jsx +6 -7
- package/src/{components → ui-kit/components}/atoms/NoticeIcon/notice-icon.module.scss +1 -1
- package/src/{components → ui-kit/components}/atoms/QrCode/QrCode.jsx +3 -2
- package/src/{components → ui-kit/components}/atoms/QrCode/qr-code.module.scss +1 -1
- package/src/{components → ui-kit/components}/atoms/RateSelector/RateSelector.jsx +1 -0
- package/src/{components → ui-kit/components}/atoms/RateSelector/rate-selector.module.scss +1 -1
- package/src/{components → ui-kit/components}/atoms/SupportChat/SupportChat.jsx +1 -0
- package/src/{components → ui-kit/components}/atoms/Textarea/Textarea.jsx +19 -17
- package/src/{components → ui-kit/components}/atoms/Textarea/textarea.module.scss +1 -1
- package/src/{components → ui-kit/components}/atoms/TitleBox/TitleBox.jsx +19 -19
- package/src/{components → ui-kit/components}/atoms/TitleBox/title-box.module.scss +1 -1
- package/src/{components → ui-kit/components}/atoms/Tooltip/Tooltip.jsx +17 -8
- package/src/{components → ui-kit/components}/atoms/Tooltip/tooltip.module.scss +1 -1
- package/src/{components → ui-kit/components}/atoms/TwoLinesOfText/LinesOfText.jsx +11 -9
- package/src/{components → ui-kit/components}/atoms/TwoLinesOfText/lines-of-text.module.scss +1 -1
- package/src/{components → ui-kit/components}/atoms/Validation/Validation.jsx +2 -2
- package/src/{components → ui-kit/components}/atoms/Validation/validation.module.scss +1 -1
- package/src/{components → ui-kit/components}/atoms/buttons/Button/Button.module.scss +1 -1
- package/src/{components → ui-kit/components}/atoms/buttons/Close/Close.jsx +7 -2
- package/src/{components → ui-kit/components}/atoms/buttons/Close/close.module.scss +1 -1
- package/src/{components → ui-kit/components}/atoms/buttons/LinkButton/LinkButton.jsx +9 -3
- package/src/{components → ui-kit/components}/atoms/buttons/LinkButton/link-button.module.scss +1 -1
- package/src/{components → ui-kit/components}/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx +1 -1
- package/src/{components → ui-kit/components}/atoms/buttons/RadioButtonWithText/radio-button-with-text.module.scss +1 -1
- package/src/{components → ui-kit/components}/molecules/AmountInput/AmountInput.jsx +5 -4
- package/src/{components → ui-kit/components}/molecules/AmountInput/amount-input.module.scss +1 -1
- package/src/{components → ui-kit/components}/molecules/CoinPicker/CoinPicker.jsx +27 -25
- package/src/{components → ui-kit/components}/molecules/CoinPicker/coin-picker.module.scss +1 -1
- package/src/{components → ui-kit/components}/molecules/LineWithIconLink/line-with-icon-link.module.scss +1 -1
- package/src/{components → ui-kit/components}/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx +8 -6
- package/src/{components → ui-kit/components}/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx +3 -1
- package/src/{components → ui-kit/components}/organisms/Dialog/Dialog.jsx +35 -6
- package/src/{components → ui-kit/components}/organisms/Dialog/DialogButtons/DialogButtons.jsx +3 -3
- package/src/{components → ui-kit/components}/organisms/Dialog/DialogButtons/dialog-buttons.module.scss +1 -1
- package/src/{components → ui-kit/components}/organisms/Dialog/DialogStep/DialogStep.jsx +49 -47
- package/src/{components → ui-kit/components}/organisms/Dialog/DialogStep/dialog-step.module.scss +1 -1
- package/src/{components → ui-kit/components}/organisms/Dialog/dialog.module.scss +1 -1
- package/src/{components → ui-kit/components}/organisms/SwapForm/SwapForm.jsx +158 -63
- package/src/{components → ui-kit/components}/organisms/SwapForm/swap-form.module.scss +1 -1
- package/src/{components → ui-kit/components}/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx +2 -2
- package/src/{components → ui-kit}/hooks/useCallHandlingErrors.js +1 -1
- package/src/ui-kit/hooks/useIsHydrated.js +12 -0
- package/src/{components → ui-kit}/utils/textUtils.js +1 -1
- package/coverage/rabbit-ui-kit/src/components/atoms/AssetIcon/index.html +0 -116
- package/coverage/rabbit-ui-kit/src/components/atoms/Input/index.html +0 -116
- package/coverage/rabbit-ui-kit/src/components/atoms/LoadingDots/index.html +0 -116
- package/coverage/rabbit-ui-kit/src/components/atoms/NoticeIcon/index.html +0 -116
- package/coverage/rabbit-ui-kit/src/components/atoms/QrCode/index.html +0 -116
- package/coverage/rabbit-ui-kit/src/components/atoms/RateSelector/index.html +0 -116
- package/coverage/rabbit-ui-kit/src/components/atoms/SupportChat/index.html +0 -116
- package/coverage/rabbit-ui-kit/src/components/atoms/Textarea/index.html +0 -116
- package/coverage/rabbit-ui-kit/src/components/atoms/TitleBox/index.html +0 -116
- package/coverage/rabbit-ui-kit/src/components/atoms/Tooltip/index.html +0 -116
- package/coverage/rabbit-ui-kit/src/components/atoms/TwoLinesOfText/index.html +0 -116
- package/coverage/rabbit-ui-kit/src/components/atoms/Validation/index.html +0 -116
- package/coverage/rabbit-ui-kit/src/components/molecules/AmountInput/index.html +0 -116
- package/coverage/rabbit-ui-kit/src/components/molecules/CoinPicker/index.html +0 -116
- package/coverage/rabbit-ui-kit/src/components/molecules/LineWithIconLink/index.html +0 -116
- package/coverage/rabbit-ui-kit/src/components/molecules/TitledLineWithIconLink/index.html +0 -116
- package/coverage/rabbit-ui-kit/src/components/organisms/CoinPickerDialogStep/index.html +0 -116
- package/coverage/rabbit-ui-kit/src/components/organisms/Dialog/index.html +0 -116
- package/coverage/rabbit-ui-kit/src/components/organisms/SwapForm/index.html +0 -116
- package/coverage/rabbit-ui-kit/src/components/templates/DeterminedErrorDialogStep/index.html +0 -116
- package/coverage/rabbit-ui-kit/src/constants/atoms/Close/close.jsx.html +0 -100
- package/coverage/rabbit-ui-kit/src/constants/atoms/Close/index.html +0 -116
- package/coverage/rabbit-ui-kit/src/constants/atoms/LinkButton/index.html +0 -116
- package/coverage/rabbit-ui-kit/src/constants/atoms/LinkButton/linkButton.jsx.html +0 -103
- package/coverage/rabbit-ui-kit/src/constants/atoms/Tooltip/index.html +0 -116
- package/coverage/rabbit-ui-kit/src/constants/atoms/Tooltip/tooltip.jsx.html +0 -109
- package/coverage/rabbit-ui-kit/src/constants/index.html +0 -116
- package/coverage/rabbit-ui-kit/src/constants/organisms/dialog/DialogStep/dialogStep.js.html +0 -88
- package/coverage/rabbit-ui-kit/src/constants/organisms/dialog/dialog.js.html +0 -172
- package/coverage/rabbit-ui-kit/src/constants/organisms/dialog/index.html +0 -116
- package/src/assets/image/icons/arrow-tosca.svg +0 -3
- package/src/constants/atoms/Close/close.jsx +0 -5
- package/src/constants/atoms/LinkButton/linkButton.jsx +0 -6
- package/src/constants/atoms/Tooltip/tooltip.jsx +0 -8
- package/src/constants/organisms/dialog/DialogStep/dialogStep.js +0 -1
- package/src/constants/organisms/dialog/dialog.js +0 -29
- /package/src/{common → common-apis}/adapters/axiosAdapter.js +0 -0
- /package/src/{common → common-apis}/adapters/qrUtils.js +0 -0
- /package/src/{common → common-apis}/amountUtils.js +0 -0
- /package/src/{common → common-apis}/errorUtils.js +0 -0
- /package/src/{common → common-apis}/external-apis/apiGroups.js +0 -0
- /package/src/{common → common-apis}/fiatCurrenciesService.js +0 -0
- /package/src/{constants → common-apis}/globalConstants.jsx +0 -0
- /package/src/{common → common-apis}/models/blockchain.js +0 -0
- /package/src/{common → common-apis}/models/coin.js +0 -0
- /package/src/{common → common-apis}/models/protocol.js +0 -0
- /package/src/{common → common-apis}/tests/amountUtils/composeRateText.test.js +0 -0
- /package/src/{common → common-apis}/tests/integration/external-apis/ipAddressProviders/getClientIpAddress.test.js +0 -0
- /package/src/{common → common-apis}/utils/cache.js +0 -0
- /package/src/{common → common-apis}/utils/emailAPI.js +0 -0
- /package/src/{common → common-apis}/utils/logging/logger.js +0 -0
- /package/src/{common → common-apis}/utils/logging/logsStorage.js +0 -0
- /package/src/{common → common-apis}/utils/postponeExecution.js +0 -0
- /package/src/{common → common-apis}/utils/safeStringify.js +0 -0
- /package/src/{robustExteranlApiCallerService → robust-api-caller}/cancelProcessing.js +0 -0
- /package/src/{robustExteranlApiCallerService → robust-api-caller}/externalApiProvider.js +0 -0
- /package/{styles → src/ui-kit/assets/styles}/_functions.scss +0 -0
- /package/{styles → src/ui-kit/assets/styles}/_global-classes.scss +0 -0
- /package/{styles → src/ui-kit/assets/styles}/_mixins.scss +0 -0
- /package/{styles → src/ui-kit/assets/styles}/_placeholder.scss +0 -0
- /package/{styles → src/ui-kit/assets/styles}/_variables.scss +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}/fonts/NunitoSans-Bold.ttf +0 -0
- /package/{styles → src/ui-kit/assets/styles}/fonts/NunitoSans-ExtraBold.ttf +0 -0
- /package/{styles → src/ui-kit/assets/styles}/fonts/NunitoSans-Light.ttf +0 -0
- /package/{styles → src/ui-kit/assets/styles}/fonts/NunitoSans-Regular.ttf +0 -0
- /package/{styles → src/ui-kit/assets/styles}/fonts/NunitoSans-SemiBold.ttf +0 -0
- /package/{styles → src/ui-kit/assets/styles}/global-styles-index.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
- /package/src/{assets → ui-kit/assets}/wrappedImages/arrowIcon.jsx +0 -0
- /package/src/{assets → ui-kit/assets}/wrappedImages/arrowTosca.jsx +0 -0
- /package/src/{assets → ui-kit/assets}/wrappedImages/darkRectangle.jsx +0 -0
- /package/src/{assets → ui-kit/assets}/wrappedImages/determinedError.jsx +0 -0
- /package/src/{assets → ui-kit/assets}/wrappedImages/failedValidationIcon.jsx +0 -0
- /package/src/{assets → ui-kit/assets}/wrappedImages/infoIcon.jsx +0 -0
- /package/src/{assets → ui-kit/assets}/wrappedImages/noticeQuestionIcon.jsx +0 -0
- /package/src/{assets → ui-kit/assets}/wrappedImages/successfulValidationIcon.jsx +0 -0
- /package/src/{assets → ui-kit/assets}/wrappedImages/walletIcon.jsx +0 -0
- /package/src/{components → ui-kit/components}/atoms/BackgroundTitle/BackgroundTitle.jsx +0 -0
- /package/src/{components → ui-kit/components}/atoms/LoadingDots/LoadingDots.jsx +0 -0
- /package/src/{components → ui-kit/components}/atoms/buttons/Button/Button.jsx +0 -0
- /package/src/{components → ui-kit/components}/molecules/LineWithIconLink/LineWithIconLink.jsx +0 -0
- /package/src/{components → ui-kit}/hooks/useReferredState.js +0 -0
- /package/src/{components → ui-kit}/tests/utils/inputValueProviders/provideFormatOfFloatValueByInputString.test.js +0 -0
- /package/src/{components → ui-kit}/tests/utils/urlQueryUtils/getQueryParameterValues.test.js +0 -0
- /package/src/{components → ui-kit}/tests/utils/urlQueryUtils/saveQueryParameterAndValues.test.js +0 -0
- /package/src/{components → ui-kit}/utils/inputValueProviders.js +0 -0
- /package/src/{components → ui-kit}/utils/uiUtils.js +0 -0
- /package/src/{components → ui-kit}/utils/urlQueryUtils.js +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rabbitio/ui-kit",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.72",
|
|
4
4
|
"description": "Rabbit.io react.js components kit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -50,9 +50,7 @@
|
|
|
50
50
|
"eventbusjs": "0.2.0",
|
|
51
51
|
"jshashes": "1.0.8",
|
|
52
52
|
"qrcode": "1.4.4",
|
|
53
|
-
"react": ">=18.2.0",
|
|
54
53
|
"react-animate-height": "3.2.3",
|
|
55
|
-
"react-dom": ">=18.2.0",
|
|
56
54
|
"react-textarea-autosize": "^8.5.3",
|
|
57
55
|
"react-transition-group": "4.4.5",
|
|
58
56
|
"resize-observer-polyfill": "1.5.1",
|
|
@@ -76,6 +74,8 @@
|
|
|
76
74
|
"microbundle": "^0.15.1",
|
|
77
75
|
"prettier": "^3.1.1",
|
|
78
76
|
"prop-types": "^15.8.1",
|
|
77
|
+
"react": "18.2.0",
|
|
78
|
+
"react-dom": "18.2.0",
|
|
79
79
|
"resolve-url-loader": "^5.0.0",
|
|
80
80
|
"sass": "^1.70.0",
|
|
81
81
|
"sass-loader": "^14.1.0",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import EventBusInstance from "eventbusjs";
|
|
2
|
-
import { ExternalApiProvider } from "../../
|
|
2
|
+
import { ExternalApiProvider } from "../../robust-api-caller/externalApiProvider.js";
|
|
3
3
|
import { ApiGroups } from "./apiGroups.js";
|
|
4
|
-
import { CachedRobustExternalApiCallerService } from "../../
|
|
4
|
+
import { CachedRobustExternalApiCallerService } from "../../robust-api-caller/cachedRobustExternalApiCallerService.js";
|
|
5
5
|
import { Cache } from "../utils/cache.js";
|
|
6
6
|
import { improveAndRethrow } from "../errorUtils.js";
|
|
7
7
|
|
package/src/index.js
CHANGED
|
@@ -1,82 +1,78 @@
|
|
|
1
1
|
// UI-KIT components
|
|
2
|
-
export { Button } from "./components/atoms/buttons/Button/Button.jsx";
|
|
3
|
-
export { LoadingDots } from "./components/atoms/LoadingDots/LoadingDots.jsx";
|
|
4
|
-
export { SupportChat } from "./components/atoms/SupportChat/SupportChat.jsx";
|
|
5
|
-
export { AssetIcon } from "./components/atoms/AssetIcon/AssetIcon.jsx";
|
|
6
|
-
export { LinkButton } from "./components/atoms/buttons/LinkButton/LinkButton.jsx";
|
|
7
|
-
export { DialogButtons } from "./components/organisms/Dialog/DialogButtons/DialogButtons.jsx";
|
|
8
|
-
export { BackgroundTitle } from "./components/atoms/BackgroundTitle/BackgroundTitle.jsx";
|
|
9
|
-
export { Close } from "./components/atoms/buttons/Close/Close.jsx";
|
|
10
|
-
export { Validation } from "./components/atoms/Validation/Validation.jsx";
|
|
11
|
-
export { Dialog } from "./components/organisms/Dialog/Dialog.jsx";
|
|
12
|
-
export { DialogStep } from "./components/organisms/Dialog/DialogStep/DialogStep.jsx";
|
|
13
|
-
export { AssetSelection } from "./components/atoms/AssetSelection/AssetSelection.jsx";
|
|
14
|
-
export { Tooltip } from "./components/atoms/Tooltip/Tooltip.jsx";
|
|
15
|
-
export { NoticeIcon } from "./components/atoms/NoticeIcon/NoticeIcon.jsx";
|
|
16
|
-
export { TitleBox } from "./components/atoms/TitleBox/TitleBox.jsx";
|
|
17
|
-
export { AmountInput } from "./components/molecules/AmountInput/AmountInput.jsx";
|
|
18
|
-
export { SwapForm } from "./components/organisms/SwapForm/SwapForm.jsx";
|
|
19
|
-
export { Textarea } from "./components/atoms/Textarea/Textarea.jsx";
|
|
20
|
-
export { QrCode } from "./components/atoms/QrCode/QrCode.jsx";
|
|
21
|
-
export { LinesOfText } from "./components/atoms/TwoLinesOfText/LinesOfText.jsx";
|
|
22
|
-
export { LineWithIconLink } from "./components/molecules/LineWithIconLink/LineWithIconLink.jsx";
|
|
23
|
-
export { DeterminedErrorDialogStep } from "./components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx";
|
|
24
|
-
export { TitledLineWithIconLink } from "./components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx";
|
|
25
|
-
export { RadioButtonWithText } from "./components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx";
|
|
26
|
-
export { InformationMessage } from "./components/atoms/InformationMessage/InformationMessage.jsx";
|
|
27
|
-
export { Input } from "./components/atoms/Input/Input.jsx";
|
|
28
|
-
export { COIN_PICKER_MODES, CoinPicker } from "./components/molecules/CoinPicker/CoinPicker.jsx";
|
|
29
|
-
export { CoinPickerDialogStep } from "./components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx";
|
|
2
|
+
export { Button } from "./ui-kit/components/atoms/buttons/Button/Button.jsx";
|
|
3
|
+
export { LoadingDots } from "./ui-kit/components/atoms/LoadingDots/LoadingDots.jsx";
|
|
4
|
+
export { SupportChat } from "./ui-kit/components/atoms/SupportChat/SupportChat.jsx";
|
|
5
|
+
export { AssetIcon } from "./ui-kit/components/atoms/AssetIcon/AssetIcon.jsx";
|
|
6
|
+
export { LinkButton, ICON_ROTATE_OPTIONS } from "./ui-kit/components/atoms/buttons/LinkButton/LinkButton.jsx";
|
|
7
|
+
export { DialogButtons } from "./ui-kit/components/organisms/Dialog/DialogButtons/DialogButtons.jsx";
|
|
8
|
+
export { BackgroundTitle } from "./ui-kit/components/atoms/BackgroundTitle/BackgroundTitle.jsx";
|
|
9
|
+
export { Close, CLOSE_COLORS } from "./ui-kit/components/atoms/buttons/Close/Close.jsx";
|
|
10
|
+
export { Validation } from "./ui-kit/components/atoms/Validation/Validation.jsx";
|
|
11
|
+
export { Dialog, DIALOG_SIZES, DIALOG_TRANSITION_STEP_DURATION } from "./ui-kit/components/organisms/Dialog/Dialog.jsx";
|
|
12
|
+
export { DialogStep, DIALOG_STEP_CLASS } from "./ui-kit/components/organisms/Dialog/DialogStep/DialogStep.jsx";
|
|
13
|
+
export { AssetSelection } from "./ui-kit/components/atoms/AssetSelection/AssetSelection.jsx";
|
|
14
|
+
export { Tooltip, TOOLTIP_POSITIONS } from "./ui-kit/components/atoms/Tooltip/Tooltip.jsx";
|
|
15
|
+
export { NoticeIcon } from "./ui-kit/components/atoms/NoticeIcon/NoticeIcon.jsx";
|
|
16
|
+
export { TitleBox } from "./ui-kit/components/atoms/TitleBox/TitleBox.jsx";
|
|
17
|
+
export { AmountInput } from "./ui-kit/components/molecules/AmountInput/AmountInput.jsx";
|
|
18
|
+
export { SwapForm } from "./ui-kit/components/organisms/SwapForm/SwapForm.jsx";
|
|
19
|
+
export { Textarea } from "./ui-kit/components/atoms/Textarea/Textarea.jsx";
|
|
20
|
+
export { QrCode } from "./ui-kit/components/atoms/QrCode/QrCode.jsx";
|
|
21
|
+
export { LinesOfText } from "./ui-kit/components/atoms/TwoLinesOfText/LinesOfText.jsx";
|
|
22
|
+
export { LineWithIconLink } from "./ui-kit/components/molecules/LineWithIconLink/LineWithIconLink.jsx";
|
|
23
|
+
export { DeterminedErrorDialogStep } from "./ui-kit/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx";
|
|
24
|
+
export { TitledLineWithIconLink } from "./ui-kit/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx";
|
|
25
|
+
export { RadioButtonWithText } from "./ui-kit/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx";
|
|
26
|
+
export { InformationMessage } from "./ui-kit/components/atoms/InformationMessage/InformationMessage.jsx";
|
|
27
|
+
export { Input } from "./ui-kit/components/atoms/Input/Input.jsx";
|
|
28
|
+
export { COIN_PICKER_MODES, CoinPicker } from "./ui-kit/components/molecules/CoinPicker/CoinPicker.jsx";
|
|
29
|
+
export { CoinPickerDialogStep } from "./ui-kit/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx";
|
|
30
30
|
|
|
31
31
|
// UI-KIT constants
|
|
32
|
-
export {
|
|
33
|
-
export { DIALOG_STEP_CLASS } from "./constants/organisms/dialog/DialogStep/dialogStep.js";
|
|
34
|
-
export { ICON_ROTATE_OPTIONS } from "./constants/atoms/LinkButton/linkButton.jsx";
|
|
35
|
-
export { TOOLTIP_POSITIONS } from "./constants/atoms/Tooltip/tooltip.jsx";
|
|
36
|
-
export { CLOSE_COLORS } from "./constants/atoms/Close/close.jsx";
|
|
37
|
-
export { FALLBACK_ASSET_ICON_URL, DEFAULT_CRYPTO_DECIMAL_COUNT } from "./constants/globalConstants.jsx";
|
|
32
|
+
export { FALLBACK_ASSET_ICON_URL, DEFAULT_CRYPTO_DECIMAL_COUNT } from "./common-apis/globalConstants.jsx";
|
|
38
33
|
|
|
39
|
-
export { useCallHandlingErrors } from "./
|
|
40
|
-
export { useReferredState } from "./
|
|
41
|
-
export { handleClickOutside } from "./
|
|
42
|
-
export { InputValuesProviders } from "./
|
|
43
|
-
export { copyBrowserTextToClipboard } from "./
|
|
34
|
+
export { useCallHandlingErrors } from "./ui-kit/hooks/useCallHandlingErrors.js";
|
|
35
|
+
export { useReferredState } from "./ui-kit/hooks/useReferredState.js";
|
|
36
|
+
export { handleClickOutside } from "./ui-kit/utils/uiUtils.js";
|
|
37
|
+
export { InputValuesProviders } from "./ui-kit/utils/inputValueProviders.js";
|
|
38
|
+
export { copyBrowserTextToClipboard } from "./ui-kit/utils/textUtils.js";
|
|
39
|
+
export { useIsHydrated } from "./ui-kit/hooks/useIsHydrated.js";
|
|
44
40
|
|
|
45
|
-
export { saveQueryParameterAndValues } from "./
|
|
46
|
-
export { removeQueryParameterAndValues } from "./
|
|
47
|
-
export { getQueryParameterSingleValue } from "./
|
|
48
|
-
export { getQueryParameterValues } from "./
|
|
41
|
+
export { saveQueryParameterAndValues } from "./ui-kit/utils/urlQueryUtils.js";
|
|
42
|
+
export { removeQueryParameterAndValues } from "./ui-kit/utils/urlQueryUtils.js";
|
|
43
|
+
export { getQueryParameterSingleValue } from "./ui-kit/utils/urlQueryUtils.js";
|
|
44
|
+
export { getQueryParameterValues } from "./ui-kit/utils/urlQueryUtils.js";
|
|
49
45
|
|
|
50
46
|
// Common code lib (to be extracted later to dedicated lib)
|
|
51
|
-
export { improveAndRethrow } from "./common/errorUtils.js";
|
|
52
|
-
export { logErrorOrOutputToConsole } from "./common/errorUtils.js";
|
|
53
|
-
export { FiatCurrenciesService } from "./common/fiatCurrenciesService.js";
|
|
54
|
-
export { AmountUtils } from "./common/amountUtils.js";
|
|
47
|
+
export { improveAndRethrow } from "./common-apis/errorUtils.js";
|
|
48
|
+
export { logErrorOrOutputToConsole } from "./common-apis/errorUtils.js";
|
|
49
|
+
export { FiatCurrenciesService } from "./common-apis/fiatCurrenciesService.js";
|
|
50
|
+
export { AmountUtils } from "./common-apis/amountUtils.js";
|
|
55
51
|
|
|
56
|
-
export { Blockchain } from "./common/models/blockchain.js";
|
|
57
|
-
export { Protocol } from "./common/models/protocol.js";
|
|
58
|
-
export { Coin } from "./common/models/coin.js";
|
|
52
|
+
export { Blockchain } from "./common-apis/models/blockchain.js";
|
|
53
|
+
export { Protocol } from "./common-apis/models/protocol.js";
|
|
54
|
+
export { Coin } from "./common-apis/models/coin.js";
|
|
59
55
|
|
|
60
|
-
export { Cache } from "./common/utils/cache.js";
|
|
61
|
-
export { safeStringify } from "./common/utils/safeStringify.js";
|
|
62
|
-
export { LogsStorage } from "./common/utils/logging/logsStorage.js";
|
|
63
|
-
export { Logger } from "./common/utils/logging/logger.js";
|
|
64
|
-
export { postponeExecution } from "./common/utils/postponeExecution.js";
|
|
65
|
-
export { AxiosAdapter } from "./common/adapters/axiosAdapter.js";
|
|
56
|
+
export { Cache } from "./common-apis/utils/cache.js";
|
|
57
|
+
export { safeStringify } from "./common-apis/utils/safeStringify.js";
|
|
58
|
+
export { LogsStorage } from "./common-apis/utils/logging/logsStorage.js";
|
|
59
|
+
export { Logger } from "./common-apis/utils/logging/logger.js";
|
|
60
|
+
export { postponeExecution } from "./common-apis/utils/postponeExecution.js";
|
|
61
|
+
export { AxiosAdapter } from "./common-apis/adapters/axiosAdapter.js";
|
|
66
62
|
|
|
67
|
-
export { EmailsApi } from "./common/utils/emailAPI.js";
|
|
68
|
-
export { IpAddressProvider } from "./common/external-apis/ipAddressProviders.js";
|
|
63
|
+
export { EmailsApi } from "./common-apis/utils/emailAPI.js";
|
|
64
|
+
export { IpAddressProvider } from "./common-apis/external-apis/ipAddressProviders.js";
|
|
69
65
|
|
|
70
66
|
// Robust data retriever service and related APIs (to be extracted later to dedicated lib)
|
|
71
|
-
export { CacheAndConcurrentRequestsResolver } from "./
|
|
72
|
-
export { CachedRobustExternalApiCallerService } from "./
|
|
73
|
-
export { CancelProcessing } from "./
|
|
74
|
-
export { ExternalApiProvider } from "./
|
|
75
|
-
export { RobustExternalAPICallerService } from "./
|
|
76
|
-
export { ConcurrentCalculationsMetadataHolder } from "./
|
|
67
|
+
export { CacheAndConcurrentRequestsResolver } from "./robust-api-caller/cacheAndConcurrentRequestsResolver.js";
|
|
68
|
+
export { CachedRobustExternalApiCallerService } from "./robust-api-caller/cachedRobustExternalApiCallerService.js";
|
|
69
|
+
export { CancelProcessing } from "./robust-api-caller/cancelProcessing.js";
|
|
70
|
+
export { ExternalApiProvider } from "./robust-api-caller/externalApiProvider.js";
|
|
71
|
+
export { RobustExternalAPICallerService } from "./robust-api-caller/robustExternalAPICallerService.js";
|
|
72
|
+
export { ConcurrentCalculationsMetadataHolder } from "./robust-api-caller/concurrentCalculationsMetadataHolder.js";
|
|
77
73
|
|
|
78
|
-
export { ApiGroups } from "./common/external-apis/apiGroups.js";
|
|
79
|
-
export { ApiGroup } from "./common/external-apis/apiGroups.js";
|
|
74
|
+
export { ApiGroups } from "./common-apis/external-apis/apiGroups.js";
|
|
75
|
+
export { ApiGroup } from "./common-apis/external-apis/apiGroups.js";
|
|
80
76
|
|
|
81
77
|
// Swaps lib (to be extracted later to dedicated lib)
|
|
82
78
|
export { ExistingSwap } from "./swaps-lib/models/existingSwap.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { v4 } from "uuid";
|
|
2
2
|
|
|
3
|
-
import { improveAndRethrow } from "../common/errorUtils.js";
|
|
4
|
-
import { Logger } from "../common/utils/logging/logger.js";
|
|
3
|
+
import { improveAndRethrow } from "../common-apis/errorUtils.js";
|
|
4
|
+
import { Logger } from "../common-apis/utils/logging/logger.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* This util helps to avoid duplicated calls to a shared resource.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import Hashes from "jshashes";
|
|
2
2
|
|
|
3
|
-
import { improveAndRethrow } from "../common/errorUtils.js";
|
|
4
|
-
import { safeStringify } from "../common/utils/safeStringify.js";
|
|
5
|
-
import { Logger } from "../common/utils/logging/logger.js";
|
|
3
|
+
import { improveAndRethrow } from "../common-apis/errorUtils.js";
|
|
4
|
+
import { safeStringify } from "../common-apis/utils/safeStringify.js";
|
|
5
|
+
import { Logger } from "../common-apis/utils/logging/logger.js";
|
|
6
6
|
|
|
7
7
|
import { RobustExternalAPICallerService } from "./robustExternalAPICallerService.js";
|
|
8
8
|
import { CacheAndConcurrentRequestsResolver } from "./cacheAndConcurrentRequestsResolver.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { v4 } from "uuid";
|
|
2
2
|
|
|
3
|
-
import { Logger } from "../common/utils/logging/logger.js";
|
|
3
|
+
import { Logger } from "../common-apis/utils/logging/logger.js";
|
|
4
4
|
|
|
5
5
|
// TODO: [refactoring, low] Consider removing this logic task_id=c360f2af75764bde8badd9ff1cc00d48
|
|
6
6
|
export class ConcurrentCalculationsMetadataHolder {
|
package/src/{robustExteranlApiCallerService → robust-api-caller}/externalServicesStatsCollector.js
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { improveAndRethrow } from "../common/errorUtils.js";
|
|
2
|
-
import { Logger } from "../common/utils/logging/logger.js";
|
|
1
|
+
import { improveAndRethrow } from "../common-apis/errorUtils.js";
|
|
2
|
+
import { Logger } from "../common-apis/utils/logging/logger.js";
|
|
3
3
|
|
|
4
4
|
export class ExternalServicesStatsCollector {
|
|
5
5
|
constructor() {
|
package/src/{robustExteranlApiCallerService → robust-api-caller}/robustExternalAPICallerService.js
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { improveAndRethrow } from "../common/errorUtils.js";
|
|
2
|
-
import { safeStringify } from "../common/utils/safeStringify.js";
|
|
3
|
-
import { Logger } from "../common/utils/logging/logger.js";
|
|
4
|
-
import { postponeExecution } from "../common/utils/postponeExecution.js";
|
|
5
|
-
import { AxiosAdapter } from "../common/adapters/axiosAdapter.js";
|
|
1
|
+
import { improveAndRethrow } from "../common-apis/errorUtils.js";
|
|
2
|
+
import { safeStringify } from "../common-apis/utils/safeStringify.js";
|
|
3
|
+
import { Logger } from "../common-apis/utils/logging/logger.js";
|
|
4
|
+
import { postponeExecution } from "../common-apis/utils/postponeExecution.js";
|
|
5
|
+
import { AxiosAdapter } from "../common-apis/adapters/axiosAdapter.js";
|
|
6
6
|
|
|
7
7
|
import { concurrentCalculationsMetadataHolder } from "./concurrentCalculationsMetadataHolder.js";
|
|
8
8
|
import { ExternalServicesStatsCollector } from "./externalServicesStatsCollector.js";
|
|
@@ -4,8 +4,8 @@ import should from "should";
|
|
|
4
4
|
import { beforeEach, afterEach, describe, it } from "vitest";
|
|
5
5
|
import { v4 } from "uuid";
|
|
6
6
|
import { ExternalApiProvider } from "../../../../externalApiProvider.js";
|
|
7
|
-
import { ApiGroup } from "../../../../../common/external-apis/apiGroups.js";
|
|
8
|
-
import { AxiosAdapter } from "../../../../../common/adapters/axiosAdapter.js";
|
|
7
|
+
import { ApiGroup } from "../../../../../common-apis/external-apis/apiGroups.js";
|
|
8
|
+
import { AxiosAdapter } from "../../../../../common-apis/adapters/axiosAdapter.js";
|
|
9
9
|
import { RobustExternalAPICallerService } from "../../../../robustExternalAPICallerService.js";
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -5,7 +5,7 @@ import { beforeEach, afterEach, describe, it } from "vitest";
|
|
|
5
5
|
|
|
6
6
|
import { v4 } from "uuid";
|
|
7
7
|
import { ExternalApiProvider } from "../../../../externalApiProvider.js";
|
|
8
|
-
import { ApiGroup } from "../../../../../common/external-apis/apiGroups.js";
|
|
8
|
+
import { ApiGroup } from "../../../../../common-apis/external-apis/apiGroups.js";
|
|
9
9
|
import { RobustExternalAPICallerService } from "../../../../robustExternalAPICallerService.js";
|
|
10
10
|
|
|
11
11
|
describe("RobustExternalAPICallerService", function () {
|
|
@@ -4,7 +4,7 @@ import { describe, it } from "vitest";
|
|
|
4
4
|
|
|
5
5
|
import { ExternalApiProvider } from "../../../externalApiProvider.js";
|
|
6
6
|
import { RobustExternalAPICallerService } from "../../../robustExternalAPICallerService.js";
|
|
7
|
-
import { ApiGroup } from "../../../../common/external-apis/apiGroups.js";
|
|
7
|
+
import { ApiGroup } from "../../../../common-apis/external-apis/apiGroups.js";
|
|
8
8
|
|
|
9
9
|
describe("RobustExternalAPICallerService", function () {
|
|
10
10
|
describe("#constructor", function () {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
2
|
import { BigNumber } from "bignumber.js";
|
|
3
3
|
|
|
4
|
-
import { AmountUtils } from "../../common/amountUtils.js";
|
|
5
|
-
import { improveAndRethrow } from "../../common/errorUtils.js";
|
|
4
|
+
import { AmountUtils } from "../../common-apis/amountUtils.js";
|
|
5
|
+
import { improveAndRethrow } from "../../common-apis/errorUtils.js";
|
|
6
6
|
import { SwapProvider } from "./swapProvider.js";
|
|
7
7
|
import { ExistingSwap } from "../models/existingSwap.js";
|
|
8
|
-
import { Coin } from "../../common/models/coin.js";
|
|
9
|
-
import { Protocol } from "../../common/models/protocol.js";
|
|
10
|
-
import { safeStringify } from "../../common/utils/safeStringify.js";
|
|
11
|
-
import { Logger } from "../../common/utils/logging/logger.js";
|
|
12
|
-
import { FALLBACK_ASSET_ICON_URL } from "../../
|
|
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
13
|
|
|
14
14
|
export const BANNED_PARTNERS = ["stealthex", "changee", "coincraddle"];
|
|
15
15
|
|
|
@@ -17,6 +17,7 @@ export class SwapspaceSwapProvider extends SwapProvider {
|
|
|
17
17
|
constructor(apiKeysProxyUrl, cache, customCoinBuilder = (coin, network) => null, useRestrictedCoinsSet = true) {
|
|
18
18
|
super();
|
|
19
19
|
this._supportedCoins = [];
|
|
20
|
+
this._partners = [];
|
|
20
21
|
this._URL = `${apiKeysProxyUrl}`;
|
|
21
22
|
this._maxRateDigits = 20;
|
|
22
23
|
this.useRestrictedCoinsSet = useRestrictedCoinsSet;
|
|
@@ -198,6 +199,19 @@ export class SwapspaceSwapProvider extends SwapProvider {
|
|
|
198
199
|
}
|
|
199
200
|
}
|
|
200
201
|
|
|
202
|
+
async _fetchPartnersListIfNeeded() {
|
|
203
|
+
const loggerSource = "_fetchPartnersListIfNeeded";
|
|
204
|
+
try {
|
|
205
|
+
if (this._partners?.length === 0) {
|
|
206
|
+
const rawResponse = await axios.get(`${this._URL}/api/v2/partners`);
|
|
207
|
+
Logger.log(`Retrieved ${rawResponse?.data?.length} partners`, loggerSource);
|
|
208
|
+
this._partners = Array.isArray(rawResponse?.data) ? rawResponse?.data : [];
|
|
209
|
+
}
|
|
210
|
+
} catch (e) {
|
|
211
|
+
Logger.logError(e, loggerSource, "Failed to fetch partners list from swapspace");
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
201
215
|
/**
|
|
202
216
|
* This method sort internal list putting popular (as swapspace thinks) coins to the top.
|
|
203
217
|
* This is just for users of this API if they don't care about the sorting - we just improve a list a bit this way.
|
|
@@ -387,6 +401,11 @@ export class SwapspaceSwapProvider extends SwapProvider {
|
|
|
387
401
|
|
|
388
402
|
const rate =
|
|
389
403
|
bestOpt.toAmount && bestOpt.fromAmount ? BigNumber(bestOpt.toAmount).div(bestOpt.fromAmount) : null;
|
|
404
|
+
|
|
405
|
+
await this._fetchPartnersListIfNeeded();
|
|
406
|
+
const partner = this._partners.find(p => bestOpt?.partner?.toLowerCase() === p.path.toLowerCase());
|
|
407
|
+
const isRefundAddressRequired =
|
|
408
|
+
partner == null ? true : bestOpt.fixed ? partner.reqFixedRefund : partner.reqFloatRefund;
|
|
390
409
|
return {
|
|
391
410
|
result: true,
|
|
392
411
|
min: min,
|
|
@@ -397,6 +416,7 @@ export class SwapspaceSwapProvider extends SwapProvider {
|
|
|
397
416
|
durationMinutesRange: bestOpt.duration ?? null,
|
|
398
417
|
fixed: bestOpt.fixed,
|
|
399
418
|
rawSwapData: bestOpt,
|
|
419
|
+
isRefundAddressRequired: !!isRefundAddressRequired,
|
|
400
420
|
};
|
|
401
421
|
}
|
|
402
422
|
const result = {
|
|
@@ -12,6 +12,7 @@ export class BaseSwapCreationInfo {
|
|
|
12
12
|
* @param fiatMax {number}
|
|
13
13
|
* @param durationMinutesRange {string}
|
|
14
14
|
* @param fixed {boolean}
|
|
15
|
+
* @param [isRefundAddressRequired=false] {boolean}
|
|
15
16
|
*/
|
|
16
17
|
constructor(
|
|
17
18
|
fromCoin,
|
|
@@ -25,7 +26,8 @@ export class BaseSwapCreationInfo {
|
|
|
25
26
|
max,
|
|
26
27
|
fiatMax,
|
|
27
28
|
durationMinutesRange,
|
|
28
|
-
fixed
|
|
29
|
+
fixed,
|
|
30
|
+
isRefundAddressRequired = false
|
|
29
31
|
) {
|
|
30
32
|
this.fromCoin = fromCoin;
|
|
31
33
|
this.toCoin = toCoin;
|
|
@@ -39,5 +41,6 @@ export class BaseSwapCreationInfo {
|
|
|
39
41
|
this.fiatMax = fiatMax;
|
|
40
42
|
this.durationMinutesRange = durationMinutesRange;
|
|
41
43
|
this.fixed = fixed;
|
|
44
|
+
this.isRefundAddressRequired = isRefundAddressRequired;
|
|
42
45
|
}
|
|
43
46
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { BigNumber } from "bignumber.js";
|
|
2
2
|
import EventBusInstance from "eventbusjs";
|
|
3
3
|
|
|
4
|
-
import { FiatCurrenciesService } from "../../common/fiatCurrenciesService.js";
|
|
5
|
-
import { improveAndRethrow } from "../../common/errorUtils.js";
|
|
6
|
-
import { safeStringify } from "../../common/utils/safeStringify.js";
|
|
7
|
-
import { Logger } from "../../common/utils/logging/logger.js";
|
|
8
|
-
import { Coin } from "../../common/models/coin.js";
|
|
9
|
-
import { AmountUtils } from "../../common/amountUtils.js";
|
|
4
|
+
import { FiatCurrenciesService } from "../../common-apis/fiatCurrenciesService.js";
|
|
5
|
+
import { improveAndRethrow } from "../../common-apis/errorUtils.js";
|
|
6
|
+
import { safeStringify } from "../../common-apis/utils/safeStringify.js";
|
|
7
|
+
import { Logger } from "../../common-apis/utils/logging/logger.js";
|
|
8
|
+
import { Coin } from "../../common-apis/models/coin.js";
|
|
9
|
+
import { AmountUtils } from "../../common-apis/amountUtils.js";
|
|
10
10
|
import { BaseSwapCreationInfo } from "../models/baseSwapCreationInfo.js";
|
|
11
11
|
import { SwapUtils } from "../utils/swapUtils.js";
|
|
12
12
|
import { SwapspaceSwapProvider } from "../external-apis/swapspaceSwapProvider.js";
|
|
@@ -245,7 +245,8 @@ export class PublicSwapService {
|
|
|
245
245
|
max,
|
|
246
246
|
fiatMax,
|
|
247
247
|
details.durationMinutesRange,
|
|
248
|
-
details.fixed
|
|
248
|
+
details.fixed,
|
|
249
|
+
details.isRefundAddressRequired
|
|
249
250
|
),
|
|
250
251
|
};
|
|
251
252
|
Logger.log(
|
|
@@ -5,9 +5,9 @@ import should from "should";
|
|
|
5
5
|
import { beforeEach, afterEach, describe, it } from "vitest";
|
|
6
6
|
|
|
7
7
|
import { SwapspaceSwapProvider } from "../../../external-apis/swapspaceSwapProvider.js";
|
|
8
|
-
import { Coin } from "../../../../common/models/coin.js";
|
|
9
|
-
import { Cache } from "../../../../common/utils/cache.js";
|
|
10
|
-
import { Protocol } from "../../../../common/models/protocol.js";
|
|
8
|
+
import { Coin } from "../../../../common-apis/models/coin.js";
|
|
9
|
+
import { Cache } from "../../../../common-apis/utils/cache.js";
|
|
10
|
+
import { Protocol } from "../../../../common-apis/models/protocol.js";
|
|
11
11
|
|
|
12
12
|
describe("swapspaceSwapProvider", function () {
|
|
13
13
|
describe("_fetchSupportedCurrenciesIfNeeded", function () {
|
|
@@ -6,9 +6,9 @@ import { beforeEach, afterEach, describe, it } from "vitest";
|
|
|
6
6
|
|
|
7
7
|
import { SwapProvider } from "../../../external-apis/swapProvider.js";
|
|
8
8
|
import { SwapspaceSwapProvider } from "../../../external-apis/swapspaceSwapProvider.js";
|
|
9
|
-
import { Coin } from "../../../../common/models/coin.js";
|
|
10
|
-
import { Blockchain } from "../../../../common/models/blockchain.js";
|
|
11
|
-
import { Cache } from "../../../../common/utils/cache.js";
|
|
9
|
+
import { Coin } from "../../../../common-apis/models/coin.js";
|
|
10
|
+
import { Blockchain } from "../../../../common-apis/models/blockchain.js";
|
|
11
|
+
import { Cache } from "../../../../common-apis/utils/cache.js";
|
|
12
12
|
|
|
13
13
|
describe("swapspaceSwapProvider", function () {
|
|
14
14
|
describe("createSwap", function () {
|
package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getAllSupportedCurrencies.test.js
CHANGED
|
@@ -6,7 +6,7 @@ import { beforeEach, afterEach, describe, it } from "vitest";
|
|
|
6
6
|
|
|
7
7
|
import { SwapProvider } from "../../../external-apis/swapProvider.js";
|
|
8
8
|
import { SwapspaceSwapProvider } from "../../../external-apis/swapspaceSwapProvider.js";
|
|
9
|
-
import { Cache } from "../../../../common/utils/cache.js";
|
|
9
|
+
import { Cache } from "../../../../common-apis/utils/cache.js";
|
|
10
10
|
|
|
11
11
|
describe("swapspaceSwapProvider", function () {
|
|
12
12
|
describe("getAllSupportedCurrencies", function () {
|
|
@@ -6,7 +6,7 @@ import { beforeEach, afterEach, describe, it } from "vitest";
|
|
|
6
6
|
|
|
7
7
|
import { SwapProvider } from "../../../external-apis/swapProvider.js";
|
|
8
8
|
import { SwapspaceSwapProvider } from "../../../external-apis/swapspaceSwapProvider.js";
|
|
9
|
-
import { Cache } from "../../../../common/utils/cache.js";
|
|
9
|
+
import { Cache } from "../../../../common-apis/utils/cache.js";
|
|
10
10
|
|
|
11
11
|
describe("swapspaceSwapProvider", function () {
|
|
12
12
|
describe("getDepositCurrencies", function () {
|
|
@@ -6,10 +6,10 @@ import { beforeEach, afterEach, describe, it } from "vitest";
|
|
|
6
6
|
|
|
7
7
|
import { SwapProvider } from "../../../external-apis/swapProvider.js";
|
|
8
8
|
import { SwapspaceSwapProvider } from "../../../external-apis/swapspaceSwapProvider.js";
|
|
9
|
-
import { Cache } from "../../../../common/utils/cache.js";
|
|
10
|
-
import { AmountUtils } from "../../../../common/amountUtils.js";
|
|
11
|
-
import { Coin } from "../../../../common/models/coin.js";
|
|
12
|
-
import { Blockchain } from "../../../../common/models/blockchain.js";
|
|
9
|
+
import { Cache } from "../../../../common-apis/utils/cache.js";
|
|
10
|
+
import { AmountUtils } from "../../../../common-apis/amountUtils.js";
|
|
11
|
+
import { Coin } from "../../../../common-apis/models/coin.js";
|
|
12
|
+
import { Blockchain } from "../../../../common-apis/models/blockchain.js";
|
|
13
13
|
|
|
14
14
|
describe("swapspaceSwapProvider", function () {
|
|
15
15
|
describe("getSwapInfo", function () {
|
|
@@ -92,6 +92,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
92
92
|
let swapspaceSwapProvider;
|
|
93
93
|
let axiosGetStub;
|
|
94
94
|
let trimCryptoAmountByCoinStub;
|
|
95
|
+
let _fetchPartnersListIfNeededStub;
|
|
95
96
|
|
|
96
97
|
beforeEach(() => {
|
|
97
98
|
swapspaceSwapProvider = new SwapspaceSwapProvider("", new Cache());
|
|
@@ -100,6 +101,9 @@ describe("swapspaceSwapProvider", function () {
|
|
|
100
101
|
|
|
101
102
|
trimCryptoAmountByCoinStub = sinon.stub(AmountUtils, "trim");
|
|
102
103
|
trimCryptoAmountByCoinStub.callsFake(amount => amount?.toString());
|
|
104
|
+
|
|
105
|
+
_fetchPartnersListIfNeededStub = sinon.stub(swapspaceSwapProvider, "_fetchPartnersListIfNeeded");
|
|
106
|
+
_fetchPartnersListIfNeededStub.resolves();
|
|
103
107
|
});
|
|
104
108
|
|
|
105
109
|
afterEach(() => {
|
|
@@ -1576,5 +1580,121 @@ describe("swapspaceSwapProvider", function () {
|
|
|
1576
1580
|
result.result.should.be.false();
|
|
1577
1581
|
result.reason.should.be.equal(SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED);
|
|
1578
1582
|
});
|
|
1583
|
+
|
|
1584
|
+
[
|
|
1585
|
+
{
|
|
1586
|
+
description: "should return a result with isRefundAddressRequired true when partner is not found",
|
|
1587
|
+
supportedCoins: [
|
|
1588
|
+
{ coin: BTC, code: "btc", network: "btc", deposit: true },
|
|
1589
|
+
{ coin: ETH, code: "eth", network: "eth", withdrawal: true },
|
|
1590
|
+
],
|
|
1591
|
+
mockData: [
|
|
1592
|
+
{
|
|
1593
|
+
exists: true,
|
|
1594
|
+
fixed: false,
|
|
1595
|
+
toAmount: 2,
|
|
1596
|
+
fromAmount: 1,
|
|
1597
|
+
duration: "10-20",
|
|
1598
|
+
max: 5,
|
|
1599
|
+
min: 0.1,
|
|
1600
|
+
partner: "partner1",
|
|
1601
|
+
},
|
|
1602
|
+
],
|
|
1603
|
+
partners: [],
|
|
1604
|
+
expected: {
|
|
1605
|
+
result: true,
|
|
1606
|
+
isRefundAddressRequired: true,
|
|
1607
|
+
},
|
|
1608
|
+
},
|
|
1609
|
+
{
|
|
1610
|
+
description:
|
|
1611
|
+
"should return a result with isRefundAddressRequired false for a fixed option with reqFixedRefund as false",
|
|
1612
|
+
isFixed: true,
|
|
1613
|
+
supportedCoins: [
|
|
1614
|
+
{ coin: BTC, code: "btc", network: "btc", deposit: true },
|
|
1615
|
+
{ coin: ETH, code: "eth", network: "eth", withdrawal: true },
|
|
1616
|
+
],
|
|
1617
|
+
mockData: [
|
|
1618
|
+
{
|
|
1619
|
+
exists: true,
|
|
1620
|
+
fixed: true,
|
|
1621
|
+
toAmount: 2,
|
|
1622
|
+
fromAmount: 1,
|
|
1623
|
+
duration: "10-20",
|
|
1624
|
+
max: 5,
|
|
1625
|
+
min: 0.1,
|
|
1626
|
+
partner: "partner1",
|
|
1627
|
+
},
|
|
1628
|
+
],
|
|
1629
|
+
partners: [{ path: "partner1", reqFixedRefund: false, reqFloatRefund: true }],
|
|
1630
|
+
expected: {
|
|
1631
|
+
result: true,
|
|
1632
|
+
isRefundAddressRequired: false,
|
|
1633
|
+
},
|
|
1634
|
+
},
|
|
1635
|
+
{
|
|
1636
|
+
description:
|
|
1637
|
+
"should return a result with isRefundAddressRequired true for a floating option with reqFloatRefund as true",
|
|
1638
|
+
supportedCoins: [
|
|
1639
|
+
{ coin: BTC, code: "btc", network: "btc", deposit: true },
|
|
1640
|
+
{ coin: ETH, code: "eth", network: "eth", withdrawal: true },
|
|
1641
|
+
],
|
|
1642
|
+
mockData: [
|
|
1643
|
+
{
|
|
1644
|
+
exists: true,
|
|
1645
|
+
fixed: false,
|
|
1646
|
+
toAmount: 2,
|
|
1647
|
+
fromAmount: 1,
|
|
1648
|
+
duration: "10-20",
|
|
1649
|
+
max: 5,
|
|
1650
|
+
min: 0.1,
|
|
1651
|
+
partner: "partner1",
|
|
1652
|
+
},
|
|
1653
|
+
],
|
|
1654
|
+
partners: [{ path: "partner1", reqFixedRefund: false, reqFloatRefund: true }],
|
|
1655
|
+
expected: {
|
|
1656
|
+
result: true,
|
|
1657
|
+
isRefundAddressRequired: true,
|
|
1658
|
+
},
|
|
1659
|
+
},
|
|
1660
|
+
].forEach(({ description, isFixed, supportedCoins, mockData, partners, expected }) => {
|
|
1661
|
+
it(description, async () => {
|
|
1662
|
+
swapspaceSwapProvider._supportedCoins = supportedCoins;
|
|
1663
|
+
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
1664
|
+
|
|
1665
|
+
_fetchPartnersListIfNeededStub.resolves();
|
|
1666
|
+
swapspaceSwapProvider._partners = partners;
|
|
1667
|
+
|
|
1668
|
+
const result = await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1", !!isFixed);
|
|
1669
|
+
|
|
1670
|
+
result.result.should.be.equal(expected.result);
|
|
1671
|
+
result.isRefundAddressRequired.should.be.equal(expected.isRefundAddressRequired);
|
|
1672
|
+
});
|
|
1673
|
+
});
|
|
1674
|
+
it("should call _fetchPartnersListIfNeeded ones", async () => {
|
|
1675
|
+
swapspaceSwapProvider._supportedCoins = [
|
|
1676
|
+
{ coin: BTC, code: "btc", network: "btc", deposit: true },
|
|
1677
|
+
{ coin: ETH, code: "eth", network: "eth", withdrawal: true },
|
|
1678
|
+
];
|
|
1679
|
+
const mockData = [
|
|
1680
|
+
{
|
|
1681
|
+
exists: true,
|
|
1682
|
+
fixed: false,
|
|
1683
|
+
toAmount: 2,
|
|
1684
|
+
fromAmount: 1,
|
|
1685
|
+
duration: "10-20",
|
|
1686
|
+
max: 5,
|
|
1687
|
+
min: 0.1,
|
|
1688
|
+
partner: "partner1",
|
|
1689
|
+
},
|
|
1690
|
+
];
|
|
1691
|
+
axiosGetStub.returns(Promise.resolve({ data: mockData }));
|
|
1692
|
+
|
|
1693
|
+
swapspaceSwapProvider._partners = [{ path: "partner1", reqFixedRefund: false, reqFloatRefund: true }];
|
|
1694
|
+
|
|
1695
|
+
await swapspaceSwapProvider.getSwapInfo(BTC, ETH, "1");
|
|
1696
|
+
|
|
1697
|
+
_fetchPartnersListIfNeededStub.callCount.should.be.equal(1);
|
|
1698
|
+
});
|
|
1579
1699
|
});
|
|
1580
1700
|
});
|
package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getWithdrawalCurrencies.test.js
CHANGED
|
@@ -6,7 +6,7 @@ import { beforeEach, afterEach, describe, it } from "vitest";
|
|
|
6
6
|
|
|
7
7
|
import { SwapProvider } from "../../../external-apis/swapProvider.js";
|
|
8
8
|
import { SwapspaceSwapProvider } from "../../../external-apis/swapspaceSwapProvider.js";
|
|
9
|
-
import { Cache } from "../../../../common/utils/cache.js";
|
|
9
|
+
import { Cache } from "../../../../common-apis/utils/cache.js";
|
|
10
10
|
|
|
11
11
|
describe("swapspaceSwapProvider", function () {
|
|
12
12
|
describe("getWithdrawalCurrencies", function () {
|