@rabbitio/ui-kit 1.0.0-beta.7 → 1.0.0-beta.70
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 +14 -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 +11536 -0
- package/coverage/coverage-final.json +100 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +986 -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/assets/wrappedImages/arrowIcon.jsx.html +124 -0
- package/coverage/rabbit-ui-kit/src/assets/wrappedImages/arrowTosca.jsx.html +127 -0
- package/coverage/rabbit-ui-kit/src/assets/wrappedImages/arrowWhite.jsx.html +127 -0
- package/coverage/rabbit-ui-kit/src/assets/wrappedImages/darkRectangle.jsx.html +106 -0
- package/coverage/rabbit-ui-kit/src/assets/wrappedImages/determinedError.jsx.html +439 -0
- package/coverage/rabbit-ui-kit/src/assets/wrappedImages/failedValidationIcon.jsx.html +202 -0
- package/coverage/rabbit-ui-kit/src/assets/wrappedImages/index.html +251 -0
- package/coverage/rabbit-ui-kit/src/assets/wrappedImages/infoIcon.jsx.html +133 -0
- package/coverage/rabbit-ui-kit/src/assets/wrappedImages/noticeQuestionIcon.jsx.html +247 -0
- package/coverage/rabbit-ui-kit/src/assets/wrappedImages/successfulValidationIcon.jsx.html +163 -0
- package/coverage/rabbit-ui-kit/src/assets/wrappedImages/walletIcon.jsx.html +151 -0
- package/coverage/rabbit-ui-kit/src/common/adapters/axiosAdapter.js.html +190 -0
- package/coverage/rabbit-ui-kit/src/common/adapters/index.html +131 -0
- package/coverage/rabbit-ui-kit/src/common/adapters/qrUtils.js.html +139 -0
- package/coverage/rabbit-ui-kit/src/common/amountUtils.js.html +1162 -0
- package/coverage/rabbit-ui-kit/src/common/errorUtils.js.html +211 -0
- package/coverage/rabbit-ui-kit/src/common/external-apis/apiGroups.js.html +250 -0
- package/coverage/rabbit-ui-kit/src/common/external-apis/index.html +131 -0
- package/coverage/rabbit-ui-kit/src/common/external-apis/ipAddressProviders.js.html +352 -0
- package/coverage/rabbit-ui-kit/src/common/fiatCurrenciesService.js.html +544 -0
- package/coverage/rabbit-ui-kit/src/common/index.html +146 -0
- package/coverage/rabbit-ui-kit/src/common/models/blockchain.js.html +115 -0
- package/coverage/rabbit-ui-kit/src/common/models/coin.js.html +544 -0
- package/coverage/rabbit-ui-kit/src/common/models/index.html +146 -0
- package/coverage/rabbit-ui-kit/src/common/models/protocol.js.html +100 -0
- package/coverage/rabbit-ui-kit/src/common/utils/cache.js.html +811 -0
- package/coverage/rabbit-ui-kit/src/common/utils/emailAPI.js.html +133 -0
- package/coverage/rabbit-ui-kit/src/common/utils/index.html +161 -0
- package/coverage/rabbit-ui-kit/src/common/utils/logging/index.html +131 -0
- package/coverage/rabbit-ui-kit/src/common/utils/logging/logger.js.html +208 -0
- package/coverage/rabbit-ui-kit/src/common/utils/logging/logsStorage.js.html +268 -0
- package/coverage/rabbit-ui-kit/src/common/utils/postponeExecution.js.html +118 -0
- package/coverage/rabbit-ui-kit/src/common/utils/safeStringify.js.html +235 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/AssetIcon/AssetIcon.jsx.html +247 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/AssetIcon/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/AssetSelection/AssetSelection.jsx.html +286 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/AssetSelection/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/BackgroundTitle/BackgroundTitle.jsx.html +187 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/BackgroundTitle/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/InformationMessage/InformationMessage.jsx.html +235 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/InformationMessage/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/Input/Input.jsx.html +631 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/Input/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/LoadingDots/LoadingDots.jsx.html +196 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/LoadingDots/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/NoticeIcon/NoticeIcon.jsx.html +277 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/NoticeIcon/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/QrCode/QrCode.jsx.html +187 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/QrCode/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/RateSelector/RateSelector.jsx.html +172 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/RateSelector/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/SupportChat/SupportChat.jsx.html +214 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/SupportChat/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/Textarea/Textarea.jsx.html +523 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/Textarea/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/TitleBox/TitleBox.jsx.html +508 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/TitleBox/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/Tooltip/Tooltip.jsx.html +289 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/Tooltip/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/TwoLinesOfText/LinesOfText.jsx.html +307 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/TwoLinesOfText/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/Validation/Validation.jsx.html +208 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/Validation/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/buttons/Button/Button.jsx.html +712 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/buttons/Button/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/buttons/Close/Close.jsx.html +244 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/buttons/Close/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/buttons/LinkButton/LinkButton.jsx.html +403 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/buttons/LinkButton/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx.html +415 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/buttons/RadioButtonWithText/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/hooks/index.html +131 -0
- package/coverage/rabbit-ui-kit/src/components/hooks/useCallHandlingErrors.js.html +151 -0
- package/coverage/rabbit-ui-kit/src/components/hooks/useReferredState.js.html +157 -0
- package/coverage/rabbit-ui-kit/src/components/molecules/AmountInput/AmountInput.jsx.html +997 -0
- package/coverage/rabbit-ui-kit/src/components/molecules/AmountInput/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/molecules/CoinPicker/CoinPicker.jsx.html +1612 -0
- package/coverage/rabbit-ui-kit/src/components/molecules/CoinPicker/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/molecules/LineWithIconLink/LineWithIconLink.jsx.html +190 -0
- package/coverage/rabbit-ui-kit/src/components/molecules/LineWithIconLink/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx.html +175 -0
- package/coverage/rabbit-ui-kit/src/components/molecules/TitledLineWithIconLink/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx.html +277 -0
- package/coverage/rabbit-ui-kit/src/components/organisms/CoinPickerDialogStep/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/organisms/Dialog/Dialog.jsx.html +1480 -0
- package/coverage/rabbit-ui-kit/src/components/organisms/Dialog/DialogButtons/DialogButtons.jsx.html +451 -0
- package/coverage/rabbit-ui-kit/src/components/organisms/Dialog/DialogButtons/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/organisms/Dialog/DialogStep/DialogStep.jsx.html +1684 -0
- package/coverage/rabbit-ui-kit/src/components/organisms/Dialog/DialogStep/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/organisms/Dialog/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/organisms/SwapForm/SwapForm.jsx.html +3400 -0
- package/coverage/rabbit-ui-kit/src/components/organisms/SwapForm/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx.html +316 -0
- package/coverage/rabbit-ui-kit/src/components/templates/DeterminedErrorDialogStep/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/utils/index.html +161 -0
- package/coverage/rabbit-ui-kit/src/components/utils/inputValueProviders.js.html +235 -0
- package/coverage/rabbit-ui-kit/src/components/utils/textUtils.js.html +139 -0
- package/coverage/rabbit-ui-kit/src/components/utils/uiUtils.js.html +121 -0
- package/coverage/rabbit-ui-kit/src/components/utils/urlQueryUtils.js.html +271 -0
- package/coverage/rabbit-ui-kit/src/constants/atoms/Close/close.jsx.html +100 -0
- package/coverage/rabbit-ui-kit/src/constants/atoms/Close/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/constants/atoms/LinkButton/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/constants/atoms/LinkButton/linkButton.jsx.html +103 -0
- package/coverage/rabbit-ui-kit/src/constants/atoms/Tooltip/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/constants/atoms/Tooltip/tooltip.jsx.html +109 -0
- package/coverage/rabbit-ui-kit/src/constants/globalConstants.jsx.html +94 -0
- package/coverage/rabbit-ui-kit/src/constants/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/constants/organisms/dialog/DialogStep/dialogStep.js.html +88 -0
- package/coverage/rabbit-ui-kit/src/constants/organisms/dialog/DialogStep/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/constants/organisms/dialog/dialog.js.html +172 -0
- package/coverage/rabbit-ui-kit/src/constants/organisms/dialog/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/index.js.html +349 -0
- package/coverage/rabbit-ui-kit/src/robustExteranlApiCallerService/cacheAndConcurrentRequestsResolver.js.html +1570 -0
- package/coverage/rabbit-ui-kit/src/robustExteranlApiCallerService/cachedRobustExternalApiCallerService.js.html +526 -0
- package/coverage/rabbit-ui-kit/src/robustExteranlApiCallerService/cancelProcessing.js.html +172 -0
- package/coverage/rabbit-ui-kit/src/robustExteranlApiCallerService/concurrentCalculationsMetadataHolder.js.html +310 -0
- package/coverage/rabbit-ui-kit/src/robustExteranlApiCallerService/externalApiProvider.js.html +553 -0
- package/coverage/rabbit-ui-kit/src/robustExteranlApiCallerService/externalServicesStatsCollector.js.html +319 -0
- package/coverage/rabbit-ui-kit/src/robustExteranlApiCallerService/index.html +206 -0
- package/coverage/rabbit-ui-kit/src/robustExteranlApiCallerService/robustExternalAPICallerService.js.html +997 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/index.html +131 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/swapProvider.js.html +709 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/swapspaceSwapProvider.js.html +2197 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/baseSwapCreationInfo.js.html +214 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/existingSwap.js.html +304 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/existingSwapWithFiatData.js.html +469 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/index.html +146 -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 +1888 -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 +595 -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 +946 -0
- package/coverage/rabbit-ui-kit/stories/atoms/buttons/Close.stories.jsx.html +214 -0
- package/coverage/rabbit-ui-kit/stories/atoms/buttons/LinkButton.stories.jsx.html +295 -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/LineWithIconLink.stories.jsx.html +154 -0
- package/coverage/rabbit-ui-kit/stories/molecules/TitledLineWithIconLink.stories.jsx.html +160 -0
- package/coverage/rabbit-ui-kit/stories/molecules/index.html +131 -0
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/Dialog.stories.jsx.html +589 -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/stubs/exampleContent.jsx.html +145 -0
- package/coverage/rabbit-ui-kit/stories/stubs/index.html +116 -0
- package/coverage/rabbit-ui-kit/stories/templates/DeterminedErrorDialogStep.stories.jsx.html +193 -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/index.cjs +10019 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +71418 -1641
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +7716 -11
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +9939 -11
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +10010 -12
- package/dist/index.umd.js.map +1 -1
- package/index.js +1 -1
- package/package.json +29 -5
- package/src/assets/image/icons/arrow-tosca.svg +3 -0
- package/src/assets/wrappedImages/arrowIcon.jsx +13 -0
- package/src/assets/wrappedImages/arrowTosca.jsx +14 -0
- package/src/assets/wrappedImages/arrowWhite.jsx +14 -0
- package/src/assets/wrappedImages/darkRectangle.jsx +7 -0
- package/src/assets/wrappedImages/determinedError.jsx +118 -0
- package/src/assets/wrappedImages/failedValidationIcon.jsx +39 -0
- package/src/assets/wrappedImages/infoIcon.jsx +16 -0
- package/src/assets/wrappedImages/noticeQuestionIcon.jsx +54 -0
- package/src/assets/wrappedImages/successfulValidationIcon.jsx +26 -0
- package/src/assets/wrappedImages/walletIcon.jsx +22 -0
- package/src/common/adapters/axiosAdapter.js +35 -0
- package/src/common/adapters/qrUtils.js +18 -0
- package/src/common/amountUtils.js +359 -0
- package/src/common/errorUtils.js +42 -0
- package/src/common/external-apis/apiGroups.js +55 -0
- package/src/common/external-apis/ipAddressProviders.js +89 -0
- package/src/common/fiatCurrenciesService.js +153 -0
- package/src/common/models/blockchain.js +10 -0
- package/src/common/models/coin.js +153 -0
- package/src/common/models/protocol.js +5 -0
- package/src/common/tests/amountUtils/composeRateText.test.js +152 -0
- package/src/common/tests/integration/external-apis/ipAddressProviders/getClientIpAddress.test.js +12 -0
- package/src/common/utils/cache.js +242 -0
- package/src/common/utils/emailAPI.js +16 -0
- package/src/common/utils/logging/logger.js +41 -0
- package/src/common/utils/logging/logsStorage.js +61 -0
- package/src/common/utils/postponeExecution.js +11 -0
- package/src/common/utils/safeStringify.js +50 -0
- package/src/components/atoms/AssetIcon/AssetIcon.jsx +54 -0
- package/{stories → src/components}/atoms/AssetIcon/asset-icon.module.scss +1 -1
- package/src/components/atoms/AssetSelection/AssetSelection.jsx +67 -0
- package/src/components/atoms/AssetSelection/asset-selection.module.scss +56 -0
- package/src/components/atoms/BackgroundTitle/BackgroundTitle.jsx +34 -0
- package/src/components/atoms/BackgroundTitle/background-title.module.scss +52 -0
- package/src/components/atoms/InformationMessage/InformationMessage.jsx +50 -0
- package/src/components/atoms/InformationMessage/information-message.module.scss +38 -0
- package/src/components/atoms/Input/Input.jsx +182 -0
- package/src/components/atoms/Input/input.module.scss +107 -0
- package/{stories → src/components}/atoms/LoadingDots/LoadingDots.jsx +8 -28
- package/{stories → src/components}/atoms/LoadingDots/LoadingDots.module.scss +1 -1
- package/src/components/atoms/NoticeIcon/NoticeIcon.jsx +64 -0
- package/src/components/atoms/NoticeIcon/notice-icon.module.scss +14 -0
- package/src/components/atoms/QrCode/QrCode.jsx +34 -0
- package/src/components/atoms/QrCode/qr-code.module.scss +15 -0
- package/src/components/atoms/RateSelector/RateSelector.jsx +29 -0
- package/src/components/atoms/RateSelector/rate-selector.module.scss +47 -0
- package/{stories/atoms/SupportChat/SupportChat.js → src/components/atoms/SupportChat/SupportChat.jsx} +4 -1
- package/src/components/atoms/Textarea/Textarea.jsx +146 -0
- package/src/components/atoms/Textarea/textarea.module.scss +71 -0
- package/src/components/atoms/TitleBox/TitleBox.jsx +141 -0
- package/src/components/atoms/TitleBox/title-box.module.scss +32 -0
- package/src/components/atoms/Tooltip/Tooltip.jsx +68 -0
- package/src/components/atoms/Tooltip/tooltip.module.scss +237 -0
- package/src/components/atoms/TwoLinesOfText/LinesOfText.jsx +74 -0
- package/src/components/atoms/TwoLinesOfText/lines-of-text.module.scss +65 -0
- package/src/components/atoms/Validation/Validation.jsx +41 -0
- package/src/components/atoms/Validation/validation.module.scss +15 -0
- package/{stories → src/components}/atoms/buttons/Button/Button.jsx +22 -48
- package/{stories → src/components}/atoms/buttons/Button/Button.module.scss +1 -1
- package/src/components/atoms/buttons/Close/Close.jsx +53 -0
- package/src/components/atoms/buttons/Close/close.module.scss +75 -0
- package/src/components/atoms/buttons/LinkButton/LinkButton.jsx +106 -0
- package/src/components/atoms/buttons/LinkButton/link-button.module.scss +49 -0
- package/src/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx +110 -0
- package/src/components/atoms/buttons/RadioButtonWithText/radio-button-with-text.module.scss +86 -0
- package/src/components/hooks/useCallHandlingErrors.js +22 -0
- package/src/components/hooks/useReferredState.js +24 -0
- package/src/components/molecules/AmountInput/AmountInput.jsx +304 -0
- package/src/components/molecules/AmountInput/amount-input.module.scss +189 -0
- package/src/components/molecules/CoinPicker/CoinPicker.jsx +509 -0
- package/src/components/molecules/CoinPicker/coin-picker.module.scss +207 -0
- package/src/components/molecules/LineWithIconLink/LineWithIconLink.jsx +35 -0
- package/src/components/molecules/LineWithIconLink/line-with-icon-link.module.scss +25 -0
- package/src/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx +30 -0
- package/src/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx +64 -0
- package/src/components/organisms/Dialog/Dialog.jsx +465 -0
- package/src/components/organisms/Dialog/DialogButtons/DialogButtons.jsx +122 -0
- package/src/components/organisms/Dialog/DialogButtons/dialog-buttons.module.scss +25 -0
- package/src/components/organisms/Dialog/DialogStep/DialogStep.jsx +533 -0
- package/src/components/organisms/Dialog/DialogStep/dialog-step.module.scss +381 -0
- package/src/components/organisms/Dialog/dialog.module.scss +226 -0
- package/src/components/organisms/SwapForm/SwapForm.jsx +1105 -0
- package/src/components/organisms/SwapForm/swap-form.module.scss +134 -0
- package/src/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx +77 -0
- package/src/components/tests/utils/inputValueProviders/provideFormatOfFloatValueByInputString.test.js +132 -0
- package/src/components/tests/utils/urlQueryUtils/getQueryParameterValues.test.js +65 -0
- package/src/components/tests/utils/urlQueryUtils/saveQueryParameterAndValues.test.js +104 -0
- package/src/components/utils/inputValueProviders.js +50 -0
- package/src/components/utils/textUtils.js +18 -0
- package/src/components/utils/uiUtils.js +12 -0
- package/src/components/utils/urlQueryUtils.js +62 -0
- package/src/constants/atoms/Close/close.jsx +5 -0
- package/src/constants/atoms/LinkButton/linkButton.jsx +6 -0
- package/src/constants/atoms/Tooltip/tooltip.jsx +8 -0
- package/src/constants/globalConstants.jsx +3 -0
- package/src/constants/organisms/dialog/DialogStep/dialogStep.js +1 -0
- package/src/constants/organisms/dialog/dialog.js +29 -0
- package/src/index.js +88 -0
- package/src/robustExteranlApiCallerService/cacheAndConcurrentRequestsResolver.js +495 -0
- package/src/robustExteranlApiCallerService/cachedRobustExternalApiCallerService.js +147 -0
- package/src/robustExteranlApiCallerService/cancelProcessing.js +29 -0
- package/src/robustExteranlApiCallerService/concurrentCalculationsMetadataHolder.js +75 -0
- package/src/robustExteranlApiCallerService/externalApiProvider.js +156 -0
- package/src/robustExteranlApiCallerService/externalServicesStatsCollector.js +78 -0
- package/src/robustExteranlApiCallerService/robustExternalAPICallerService.js +304 -0
- package/src/robustExteranlApiCallerService/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/_performCallAttempt.test.js +533 -0
- package/src/robustExteranlApiCallerService/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/callExternalAPI.test.js +532 -0
- package/src/robustExteranlApiCallerService/tests/robustExternalAPICallerService/robustExternalAPICallerService/constructor.test.js +19 -0
- package/src/swaps-lib/external-apis/swapProvider.js +208 -0
- package/src/swaps-lib/external-apis/swapspaceSwapProvider.js +704 -0
- package/src/swaps-lib/models/baseSwapCreationInfo.js +43 -0
- package/src/swaps-lib/models/existingSwap.js +73 -0
- package/src/swaps-lib/models/existingSwapWithFiatData.js +128 -0
- package/src/swaps-lib/services/publicSwapService.js +601 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +538 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/createSwap.test.js +1249 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getAllSupportedCurrencies.test.js +66 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getDepositCurrencies.test.js +76 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getSwapInfo.test.js +1580 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getWithdrawalCurrencies.test.js +105 -0
- package/src/swaps-lib/test/utils/swapUtils/safeHandleRequestsLimitExceeding.test.js +80 -0
- package/src/swaps-lib/utils/swapUtils.js +170 -0
- package/stories/stubs/exampleContent.jsx +20 -0
- package/styles/_placeholder.scss +1 -1
- 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 +1 -1
- package/styles/index.scss +5 -3
- package/stories/atoms/AssetIcon/AssetIcon.js +0 -55
- package/stories/index.js +0 -4
package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getWithdrawalCurrencies.test.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import sinon from "sinon";
|
|
2
|
+
import axios from "axios";
|
|
3
|
+
import should from "should";
|
|
4
|
+
|
|
5
|
+
import { beforeEach, afterEach, describe, it } from "vitest";
|
|
6
|
+
|
|
7
|
+
import { SwapProvider } from "../../../external-apis/swapProvider.js";
|
|
8
|
+
import { SwapspaceSwapProvider } from "../../../external-apis/swapspaceSwapProvider.js";
|
|
9
|
+
import { Cache } from "../../../../common/utils/cache.js";
|
|
10
|
+
|
|
11
|
+
describe("swapspaceSwapProvider", function () {
|
|
12
|
+
describe("getWithdrawalCurrencies", function () {
|
|
13
|
+
const swapspaceProvider = new SwapspaceSwapProvider("/", new Cache());
|
|
14
|
+
|
|
15
|
+
let _fetchSupportedCurrenciesIfNeededStub;
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
_fetchSupportedCurrenciesIfNeededStub = sinon.stub(axios, "get");
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
afterEach(() => {
|
|
21
|
+
_fetchSupportedCurrenciesIfNeededStub.restore();
|
|
22
|
+
swapspaceProvider._supportedCoins = [];
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("Should return an error if the response status is 429", async () => {
|
|
26
|
+
_fetchSupportedCurrenciesIfNeededStub.resetBehavior();
|
|
27
|
+
_fetchSupportedCurrenciesIfNeededStub.rejects({
|
|
28
|
+
response: { status: 429 },
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const swapProvider = new SwapspaceSwapProvider("/", new Cache());
|
|
32
|
+
const result = await swapProvider.getWithdrawalCurrencies();
|
|
33
|
+
result.should.deepEqual({
|
|
34
|
+
result: false,
|
|
35
|
+
reason: SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED,
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("Should return an object with 'result' set to true and an array of supported coins having withdrawal == true", async () => {
|
|
40
|
+
swapspaceProvider._supportedCoins = [
|
|
41
|
+
{
|
|
42
|
+
coin: { t: "BTC" },
|
|
43
|
+
extraId: "",
|
|
44
|
+
withdrawal: true,
|
|
45
|
+
deposit: true,
|
|
46
|
+
},
|
|
47
|
+
{ coin: 1, withdrawal: false, deposit: true },
|
|
48
|
+
{ coin: "4", withdrawal: true, deposit: null },
|
|
49
|
+
{ coin: "-12312", withdrawal: null, deposit: false },
|
|
50
|
+
];
|
|
51
|
+
const expectedCoins = swapspaceProvider._supportedCoins.filter(i => i.withdrawal).map(item => item.coin);
|
|
52
|
+
|
|
53
|
+
const result = await swapspaceProvider.getWithdrawalCurrencies();
|
|
54
|
+
|
|
55
|
+
result.should.deepEqual({ result: true, coins: expectedCoins });
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("Should return an object with 'result' set to true and an array of supported coins having withdrawal == true except the passed coin ticker", async () => {
|
|
59
|
+
swapspaceProvider._supportedCoins = [
|
|
60
|
+
{
|
|
61
|
+
coin: { ticker: "BTC" },
|
|
62
|
+
extraId: "",
|
|
63
|
+
withdrawal: true,
|
|
64
|
+
deposit: true,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
coin: { ticker: "ALGO" },
|
|
68
|
+
extraId: "",
|
|
69
|
+
withdrawal: true,
|
|
70
|
+
deposit: true,
|
|
71
|
+
},
|
|
72
|
+
{ coin: 1, withdrawal: false, deposit: null },
|
|
73
|
+
{ coin: "4", withdrawal: true, deposit: true },
|
|
74
|
+
{ coin: "-12312", withdrawal: null, deposit: false },
|
|
75
|
+
];
|
|
76
|
+
const expectedCoins = swapspaceProvider._supportedCoins
|
|
77
|
+
.filter(i => i.withdrawal && i.coin.ticker !== "ALGO")
|
|
78
|
+
.map(item => item.coin);
|
|
79
|
+
|
|
80
|
+
const result = await swapspaceProvider.getWithdrawalCurrencies({
|
|
81
|
+
ticker: "ALGO",
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
result.should.deepEqual({ result: true, coins: expectedCoins });
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it("Should always call _fetchSupportedCurrenciesIfNeeded ones", async () => {
|
|
88
|
+
await swapspaceProvider.getWithdrawalCurrencies();
|
|
89
|
+
|
|
90
|
+
_fetchSupportedCurrenciesIfNeededStub.calledOnce.should.be.true();
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it("Should throw an error if an error occurs while fetching supported currencies", async () => {
|
|
94
|
+
_fetchSupportedCurrenciesIfNeededStub.throws(new Error("Error fetching supported currencies"));
|
|
95
|
+
|
|
96
|
+
try {
|
|
97
|
+
await swapspaceProvider.getWithdrawalCurrencies();
|
|
98
|
+
should.fail("Expected an error to be thrown");
|
|
99
|
+
} catch (error) {
|
|
100
|
+
error.should.be.instanceOf(Error);
|
|
101
|
+
error.message.should.containEql("Error fetching supported currencies");
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
});
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import sinon from "sinon";
|
|
2
|
+
import should from "should";
|
|
3
|
+
|
|
4
|
+
import { beforeEach, afterEach, describe, it } from "vitest";
|
|
5
|
+
import { Logger } from "../../../../common/utils/logging/logger.js";
|
|
6
|
+
import { EmailsApi } from "../../../../common/utils/emailAPI.js";
|
|
7
|
+
import { SwapUtils } from "../../../utils/swapUtils.js";
|
|
8
|
+
|
|
9
|
+
describe("SwapUtils", function () {
|
|
10
|
+
let sendEmailStub;
|
|
11
|
+
|
|
12
|
+
beforeEach(function () {
|
|
13
|
+
sendEmailStub = sinon.stub(EmailsApi, "sendEmail").resolves();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
afterEach(function () {
|
|
17
|
+
sendEmailStub.restore();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
describe("safeHandleRequestsLimitExceeding", function () {
|
|
21
|
+
it("Should ensure that sendEmail is called when safeHandleRequestsLimitExceeding is invoked", function () {
|
|
22
|
+
SwapUtils.safeHandleRequestsLimitExceeding();
|
|
23
|
+
|
|
24
|
+
sendEmailStub.called.should.be.true();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("Should verify that sendEmail is called once", function () {
|
|
28
|
+
SwapUtils.safeHandleRequestsLimitExceeding();
|
|
29
|
+
|
|
30
|
+
sendEmailStub.callCount.should.equal(1);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('Should ensure that sendEmail is called with the correct subject: "AUTOMATIC EMAIL - SWAPSPACE REQUESTS LIMIT EXCEEDED"', function () {
|
|
34
|
+
SwapUtils.safeHandleRequestsLimitExceeding();
|
|
35
|
+
|
|
36
|
+
sendEmailStub.calledWith("AUTOMATIC EMAIL - SWAPSPACE REQUESTS LIMIT EXCEEDED").should.be.true();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('Should ensure that sendEmail is called with the correct body: "Requests limit exceeded. Urgently ask swapspace support for limit increasing"', function () {
|
|
40
|
+
SwapUtils.safeHandleRequestsLimitExceeding();
|
|
41
|
+
|
|
42
|
+
sendEmailStub
|
|
43
|
+
.calledWith(
|
|
44
|
+
sinon.match.any,
|
|
45
|
+
"Requests limit exceeded. Urgently ask swaps provider support for limit increasing"
|
|
46
|
+
)
|
|
47
|
+
.should.be.true();
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it("Should handle an error thrown by the sendEmail function without crashing", function (done) {
|
|
51
|
+
sendEmailStub.rejects(new Error("Fake error for testing purposes"));
|
|
52
|
+
|
|
53
|
+
let error;
|
|
54
|
+
try {
|
|
55
|
+
SwapUtils.safeHandleRequestsLimitExceeding();
|
|
56
|
+
} catch (e) {
|
|
57
|
+
error = e;
|
|
58
|
+
}
|
|
59
|
+
(error === undefined).should.be.true();
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("Should ensure that safeHandleRequestsLimitExceeding does not return a value", function () {
|
|
63
|
+
const result = SwapUtils.safeHandleRequestsLimitExceeding();
|
|
64
|
+
|
|
65
|
+
(!result).should.be.true();
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it("Should log a descriptive error message when a failure occurs", function (done) {
|
|
69
|
+
sendEmailStub.rejects(new Error("Fake error for testing purposes"));
|
|
70
|
+
const logStub = sinon.stub(Logger, "log");
|
|
71
|
+
|
|
72
|
+
SwapUtils.safeHandleRequestsLimitExceeding();
|
|
73
|
+
|
|
74
|
+
setTimeout(() => {
|
|
75
|
+
logStub.calledWithMatch(sinon.match("Failed to handle limit exceeding")).should.be.true();
|
|
76
|
+
logStub.restore();
|
|
77
|
+
}, 10);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
});
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { BigNumber } from "bignumber.js";
|
|
2
|
+
|
|
3
|
+
import { AmountUtils } from "../../common/amountUtils.js";
|
|
4
|
+
import { FiatCurrenciesService } from "../../common/fiatCurrenciesService.js";
|
|
5
|
+
import { improveAndRethrow } from "../../common/errorUtils.js";
|
|
6
|
+
import { ExistingSwapWithFiatData } from "../models/existingSwapWithFiatData.js";
|
|
7
|
+
import { EmailsApi } from "../../common/utils/emailAPI.js";
|
|
8
|
+
import { SwapProvider } from "../external-apis/swapProvider.js";
|
|
9
|
+
import { Logger } from "../../common/utils/logging/logger.js";
|
|
10
|
+
import { safeStringify } from "../../common/utils/safeStringify.js";
|
|
11
|
+
|
|
12
|
+
export class SwapUtils {
|
|
13
|
+
/**
|
|
14
|
+
* Retrieves min and max limits for swapping giving currencies.
|
|
15
|
+
* Returns also conversion rate if possible with predefined amount logic.
|
|
16
|
+
* Rate is how many "to" coins does 1 "from" coin contain.
|
|
17
|
+
*
|
|
18
|
+
* In case of errors returns one of reasons
|
|
19
|
+
* - SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED
|
|
20
|
+
* - one of SwapProvider.COMMON_ERRORS.*
|
|
21
|
+
*
|
|
22
|
+
* @param swapProvider {SwapProvider}
|
|
23
|
+
* @param fromCoin {Coin} enabled coin (to swap amount from)
|
|
24
|
+
* @param toCoin {Coin}
|
|
25
|
+
* @param coinToCurrentFiatRate {string|null}
|
|
26
|
+
* @param fiatCurrencyDecimals {number|null}
|
|
27
|
+
* @return {Promise<{
|
|
28
|
+
* result: true,
|
|
29
|
+
* min: string,
|
|
30
|
+
* fiatMin: (number|null),
|
|
31
|
+
* max: string,
|
|
32
|
+
* fiatMax: (number|null),
|
|
33
|
+
* rate: (string|null),
|
|
34
|
+
* }|{
|
|
35
|
+
* result: false,
|
|
36
|
+
* reason: string
|
|
37
|
+
* }>}
|
|
38
|
+
*/
|
|
39
|
+
static async getInitialSwapData(
|
|
40
|
+
swapProvider,
|
|
41
|
+
fromCoin,
|
|
42
|
+
toCoin,
|
|
43
|
+
coinToCurrentFiatRate = null,
|
|
44
|
+
fiatCurrencyDecimals = null
|
|
45
|
+
) {
|
|
46
|
+
const loggerSource = "getInitialSwapData";
|
|
47
|
+
try {
|
|
48
|
+
/* We use some amount here that should fit at least some of the limits of the swap providers.
|
|
49
|
+
* So we are going to get some rate to be used as the default for the on-flight calculations before we get
|
|
50
|
+
* the exact rate (that should be retrieved by getSwapCreationInfo method) for a specific amount.
|
|
51
|
+
*/
|
|
52
|
+
const defaultAmountUsd = BigNumber("300");
|
|
53
|
+
const coinUsdRate = await swapProvider.getCoinToUSDTRate(fromCoin);
|
|
54
|
+
const coinAmountForDefaultUsdAmount = AmountUtils.trim(
|
|
55
|
+
coinUsdRate.result ? defaultAmountUsd.div(coinUsdRate?.rate) : defaultAmountUsd,
|
|
56
|
+
fromCoin.digits
|
|
57
|
+
);
|
|
58
|
+
Logger.log(`Init: ${coinAmountForDefaultUsdAmount} ${fromCoin.ticker}->${toCoin.ticker}`, loggerSource);
|
|
59
|
+
const details = await swapProvider.getSwapInfo(fromCoin, toCoin, coinAmountForDefaultUsdAmount);
|
|
60
|
+
if (!details) {
|
|
61
|
+
throw new Error("The details are empty: " + safeStringify(details));
|
|
62
|
+
}
|
|
63
|
+
if (!details.result) {
|
|
64
|
+
Logger.log(`Failed with reason: ${details.reason}. ${fromCoin.ticker}->${toCoin.ticker}`, loggerSource);
|
|
65
|
+
if (
|
|
66
|
+
details?.reason === SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED ||
|
|
67
|
+
details?.reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
68
|
+
) {
|
|
69
|
+
return { result: false, reason: details.reason };
|
|
70
|
+
} else {
|
|
71
|
+
throw new Error("Unhandled error case: " + details?.reason);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
let fiatMin = null;
|
|
75
|
+
let fiatMax = null;
|
|
76
|
+
const fiatRate = coinToCurrentFiatRate ?? coinUsdRate?.rate;
|
|
77
|
+
const fiatDecimals = fiatCurrencyDecimals ?? FiatCurrenciesService.getCurrencyDecimalCountByCode("USD");
|
|
78
|
+
if (fiatRate != null) {
|
|
79
|
+
fiatMin = BigNumber(details?.smallestMin).times(fiatRate).toFixed(fiatDecimals);
|
|
80
|
+
fiatMax = BigNumber(details?.greatestMax).times(fiatRate).toFixed(fiatDecimals);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const result = {
|
|
84
|
+
result: true,
|
|
85
|
+
min: details?.smallestMin,
|
|
86
|
+
fiatMin: fiatMin,
|
|
87
|
+
max: details?.greatestMax,
|
|
88
|
+
fiatMax: fiatMax,
|
|
89
|
+
rate: AmountUtils.trim(details.rate, 30),
|
|
90
|
+
};
|
|
91
|
+
Logger.log(`Returning: ${safeStringify(result)}`, loggerSource);
|
|
92
|
+
return result;
|
|
93
|
+
} catch (e) {
|
|
94
|
+
Logger.logError(e, loggerSource, `Failed to init swap: ${safeStringify(e)}`);
|
|
95
|
+
improveAndRethrow(e, loggerSource);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
static safeHandleRequestsLimitExceeding() {
|
|
100
|
+
(async () => {
|
|
101
|
+
try {
|
|
102
|
+
await EmailsApi.sendEmail(
|
|
103
|
+
"AUTOMATIC EMAIL - SWAPSPACE REQUESTS LIMIT EXCEEDED",
|
|
104
|
+
"Requests limit exceeded. Urgently ask swaps provider support for limit increasing"
|
|
105
|
+
);
|
|
106
|
+
} catch (e) {
|
|
107
|
+
Logger.log(`Failed to handle limit exceeding ${safeStringify(e)}`, "_safeHandleRequestsLimitExceeding");
|
|
108
|
+
}
|
|
109
|
+
})();
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* If some swap is not found by id then there is no item in return list.
|
|
114
|
+
*
|
|
115
|
+
* @param swapProvider {SwapProvider}
|
|
116
|
+
* @param swapIds {string[]}
|
|
117
|
+
* @return {Promise<{
|
|
118
|
+
* result: true,
|
|
119
|
+
* swaps: ExistingSwapWithFiatData[]
|
|
120
|
+
* }|{
|
|
121
|
+
* result: false,
|
|
122
|
+
* reason: string
|
|
123
|
+
* }>}
|
|
124
|
+
*/
|
|
125
|
+
static async getExistingSwapsDetailsWithFiatAmounts(swapProvider, swapIds) {
|
|
126
|
+
try {
|
|
127
|
+
const result = await swapProvider.getExistingSwapsDetailsAndStatus(swapIds);
|
|
128
|
+
if (result.result) {
|
|
129
|
+
const extendedSwaps = [];
|
|
130
|
+
for (let swap of result.swaps) {
|
|
131
|
+
if (swap.status === SwapProvider.SWAP_STATUSES.REFUNDED) {
|
|
132
|
+
const rate = await swapProvider.getCoinToUSDTRate(swap.fromCoin);
|
|
133
|
+
extendedSwaps.push(
|
|
134
|
+
ExistingSwapWithFiatData.fromExistingSwap(
|
|
135
|
+
swap,
|
|
136
|
+
rate?.rate != null ? BigNumber(swap.fromAmount).times(rate.rate).toNumber() : null,
|
|
137
|
+
rate?.rate != null ? BigNumber(swap.toAmount).times(rate.rate).toNumber() : null,
|
|
138
|
+
"USD",
|
|
139
|
+
FiatCurrenciesService.getCurrencyDecimalCountByCode("USD")
|
|
140
|
+
)
|
|
141
|
+
);
|
|
142
|
+
} else {
|
|
143
|
+
const [fromCoinFiatRate, toConFiatRate] = await Promise.all([
|
|
144
|
+
swapProvider.getCoinToUSDTRate(swap.fromCoin),
|
|
145
|
+
swapProvider.getCoinToUSDTRate(swap.toCoin),
|
|
146
|
+
]);
|
|
147
|
+
extendedSwaps.push(
|
|
148
|
+
ExistingSwapWithFiatData.fromExistingSwap(
|
|
149
|
+
swap,
|
|
150
|
+
fromCoinFiatRate?.rate != null
|
|
151
|
+
? BigNumber(swap.fromAmount).times(fromCoinFiatRate.rate).toNumber()
|
|
152
|
+
: null,
|
|
153
|
+
toConFiatRate?.rate != null
|
|
154
|
+
? BigNumber(swap.toAmount).times(toConFiatRate.rate).toNumber()
|
|
155
|
+
: null,
|
|
156
|
+
"USD",
|
|
157
|
+
FiatCurrenciesService.getCurrencyDecimalCountByCode("USD")
|
|
158
|
+
)
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
result.swaps = extendedSwaps;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return result;
|
|
166
|
+
} catch (e) {
|
|
167
|
+
improveAndRethrow(e, "getExistingSwapsDetailsWithFiatAmounts");
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
export const exampleContent = (
|
|
4
|
+
<div
|
|
5
|
+
style={{
|
|
6
|
+
width: "100%",
|
|
7
|
+
height: "300px",
|
|
8
|
+
borderRadius: "16px",
|
|
9
|
+
background: "#eee",
|
|
10
|
+
color: "#bbb",
|
|
11
|
+
display: "flex",
|
|
12
|
+
justifyContent: "center",
|
|
13
|
+
alignItems: "center",
|
|
14
|
+
fontSize: "12px",
|
|
15
|
+
fontFamily: "monospace",
|
|
16
|
+
}}
|
|
17
|
+
>
|
|
18
|
+
Example content
|
|
19
|
+
</div>
|
|
20
|
+
);
|
package/styles/_placeholder.scss
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/styles/index.scss
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
@import "variables";
|
|
2
2
|
@import "global-classes";
|
|
3
3
|
@import "placeholder";
|
|
4
|
+
@import "_mixins";
|
|
4
5
|
|
|
6
|
+
// TODO: [feature, high] Uncomment fonts after adding a new packaging tool. task_id=7375fa84ccab4d66b9e3a177a41f7e26
|
|
5
7
|
@font-face {
|
|
6
8
|
//src: url("fonts/NunitoSans-ExtraBold.ttf");
|
|
7
9
|
//font-family: "NunitoSans";
|
|
@@ -17,17 +19,17 @@
|
|
|
17
19
|
@font-face {
|
|
18
20
|
//src: url("fonts/NunitoSans-SemiBold.ttf");
|
|
19
21
|
//font-family: "NunitoSans";
|
|
20
|
-
font-weight:
|
|
22
|
+
font-weight: $semi-bold;
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
@font-face {
|
|
24
26
|
//src: url("fonts/NunitoSans-Regular.ttf");
|
|
25
27
|
//font-family: "NunitoSans";
|
|
26
|
-
font-weight:
|
|
28
|
+
font-weight: $medium;
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
@font-face {
|
|
30
32
|
//src: url("fonts/NunitoSans-Light.ttf");
|
|
31
33
|
//font-family: "NunitoSans";
|
|
32
|
-
font-weight:
|
|
34
|
+
font-weight: $regular;
|
|
33
35
|
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
import s from "./asset-icon.module.scss";
|
|
4
|
-
import PropTypes from "prop-types";
|
|
5
|
-
|
|
6
|
-
export const AssetIcon = ({
|
|
7
|
-
assetIconSrc,
|
|
8
|
-
assetIconProtocolScr = null,
|
|
9
|
-
fallbackSrc = null,
|
|
10
|
-
small = false,
|
|
11
|
-
}) => {
|
|
12
|
-
const handleFailedLoad = (e) => {
|
|
13
|
-
e.target.onerror = null;
|
|
14
|
-
e.target.src = fallbackSrc;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<div className={s["asset-icon"] + (small ? " " + s["small"] : "")}>
|
|
19
|
-
<img
|
|
20
|
-
src={assetIconSrc}
|
|
21
|
-
className={
|
|
22
|
-
s["asset-icon-primary"] + (small ? " " + s["small"] : "")
|
|
23
|
-
}
|
|
24
|
-
alt={" "}
|
|
25
|
-
onError={handleFailedLoad}
|
|
26
|
-
/>
|
|
27
|
-
{assetIconProtocolScr ? (
|
|
28
|
-
<img
|
|
29
|
-
src={assetIconProtocolScr}
|
|
30
|
-
className={
|
|
31
|
-
s["asset-icon-secondary"] +
|
|
32
|
-
(small ? " " + s["small"] : "")
|
|
33
|
-
}
|
|
34
|
-
alt={" "}
|
|
35
|
-
onError={handleFailedLoad}
|
|
36
|
-
/>
|
|
37
|
-
) : (
|
|
38
|
-
""
|
|
39
|
-
)}
|
|
40
|
-
</div>
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
AssetIcon.propTypes = {
|
|
45
|
-
assetIconSrc: PropTypes.string.isRequired,
|
|
46
|
-
assetIconProtocolScr: PropTypes.string,
|
|
47
|
-
fallbackSrc: PropTypes.string,
|
|
48
|
-
small: PropTypes.bool,
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
AssetIcon.defaultProps = {
|
|
52
|
-
assetIconProtocolScr: null,
|
|
53
|
-
fallbackSrc: null,
|
|
54
|
-
small: false,
|
|
55
|
-
};
|
package/stories/index.js
DELETED