@rabbitio/ui-kit 1.0.0-beta.73 → 1.0.0-beta.75
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/.husky/commit-msg +5 -0
- package/coverage/clover.xml +713 -4535
- package/coverage/coverage-final.json +96 -157
- package/coverage/index.html +73 -328
- package/coverage/{ui-kit → rabbit-ui-kit}/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/index.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common-apis/adapters/axiosAdapter.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common-apis/adapters/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common-apis/adapters/qrUtils.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common-apis/amountUtils.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common-apis/errorUtils.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common-apis/external-apis/apiGroups.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common-apis/external-apis/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common-apis/external-apis/ipAddressProviders.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common-apis/fiatCurrenciesService.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common-apis/globalConstants.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common-apis/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common-apis/models/blockchain.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common-apis/models/coin.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common-apis/models/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common-apis/models/protocol.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common-apis/utils/cache.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common-apis/utils/emailAPI.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common-apis/utils/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common-apis/utils/logging/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common-apis/utils/logging/logger.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common-apis/utils/logging/logsStorage.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common-apis/utils/postponeExecution.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common-apis/utils/safeStringify.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/index.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/robust-api-caller/cacheAndConcurrentRequestsResolver.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/robust-api-caller/cachedRobustExternalApiCallerService.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/robust-api-caller/cancelProcessing.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/robust-api-caller/concurrentCalculationsMetadataHolder.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/robust-api-caller/externalApiProvider.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/robust-api-caller/externalServicesStatsCollector.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/robust-api-caller/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/robust-api-caller/robustExternalAPICallerService.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/swaps-lib/external-apis/index.html +25 -25
- package/coverage/{ui-kit → rabbit-ui-kit}/src/swaps-lib/external-apis/letsExchangeSwapProvider.js.html +82 -25
- package/coverage/{ui-kit → rabbit-ui-kit}/src/swaps-lib/external-apis/swapProvider.js.html +159 -12
- package/coverage/{ui-kit → rabbit-ui-kit}/src/swaps-lib/external-apis/swapspaceSwapProvider.js.html +27 -9
- package/coverage/{ui-kit → rabbit-ui-kit}/src/swaps-lib/models/baseSwapCreationInfo.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/swaps-lib/models/existingSwap.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/swaps-lib/models/existingSwapWithFiatData.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/swaps-lib/models/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/swaps-lib/services/index.html +7 -7
- package/coverage/{ui-kit → rabbit-ui-kit}/src/swaps-lib/services/publicSwapService.js.html +28 -13
- package/coverage/{ui-kit → rabbit-ui-kit}/src/swaps-lib/utils/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/swaps-lib/utils/swapUtils.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/assets/wrappedImages/arrowIcon.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/assets/wrappedImages/arrowTosca.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/assets/wrappedImages/arrowWhite.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/assets/wrappedImages/darkRectangle.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/assets/wrappedImages/determinedError.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/assets/wrappedImages/failedValidationIcon.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/assets/wrappedImages/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/assets/wrappedImages/infoIcon.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/assets/wrappedImages/noticeQuestionIcon.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/assets/wrappedImages/successfulValidationIcon.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/assets/wrappedImages/walletIcon.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/AssetIcon/AssetIcon.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/AssetIcon/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/AssetSelection/AssetSelection.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/AssetSelection/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/BackgroundTitle/BackgroundTitle.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/BackgroundTitle/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/InformationMessage/InformationMessage.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/InformationMessage/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/Input/Input.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/Input/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/LoadingDots/LoadingDots.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/LoadingDots/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/NoticeIcon/NoticeIcon.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/NoticeIcon/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/QrCode/QrCode.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/QrCode/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/RateSelector/RateSelector.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/RateSelector/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/SupportChat/SupportChat.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/SupportChat/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/Textarea/Textarea.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/Textarea/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/TitleBox/TitleBox.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/TitleBox/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/Tooltip/Tooltip.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/Tooltip/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/TwoLinesOfText/LinesOfText.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/TwoLinesOfText/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/Validation/Validation.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/Validation/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/buttons/Button/Button.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/buttons/Button/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/buttons/Close/Close.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/buttons/Close/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/buttons/LinkButton/LinkButton.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/buttons/LinkButton/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/atoms/buttons/RadioButtonWithText/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/molecules/AmountInput/AmountInput.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/molecules/AmountInput/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/molecules/CoinPicker/CoinPicker.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/molecules/CoinPicker/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/molecules/LineWithIconLink/LineWithIconLink.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/molecules/LineWithIconLink/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/molecules/TitledLineWithIconLink/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/organisms/CoinPickerDialogStep/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/organisms/Dialog/Dialog.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/organisms/Dialog/DialogButtons/DialogButtons.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/organisms/Dialog/DialogButtons/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/organisms/Dialog/DialogStep/DialogStep.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/organisms/Dialog/DialogStep/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/organisms/Dialog/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/organisms/SwapForm/SwapForm.jsx.html +99 -24
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/organisms/SwapForm/index.html +7 -7
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/components/templates/DeterminedErrorDialogStep/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/hooks/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/hooks/useCallHandlingErrors.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/hooks/useIsHydrated.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/hooks/useReferredState.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/utils/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/utils/inputValueProviders.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/utils/textUtils.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/utils/uiUtils.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/ui-kit/utils/urlQueryUtils.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/atoms/BackgroundTitle.stories.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/atoms/LinesOfText.stories.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/atoms/LoadingDots.stories.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/atoms/QrCode.stories.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/atoms/RateSelector.stories.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/atoms/Validation.stories.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/atoms/buttons/Button.stories.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/atoms/buttons/Close.stories.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/atoms/buttons/LinkButton.stories.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/atoms/buttons/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/atoms/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/molecules/LineWithIconLink.stories.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/molecules/TitledLineWithIconLink.stories.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/molecules/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/organisms/Dialog/Dialog.stories.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/organisms/Dialog/DialogButtons/DialogButtons.stories.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/organisms/Dialog/DialogButtons/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/organisms/Dialog/DialogStep/DialogStep.stories.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/organisms/Dialog/DialogStep/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/organisms/Dialog/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/stubs/exampleContent.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/stubs/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/templates/DeterminedErrorDialogStep.stories.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/templates/index.html +3 -3
- package/dist/index.cjs +139 -86
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +99 -51
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +139 -86
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +139 -86
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/swaps-lib/external-apis/letsExchangeSwapProvider.js +38 -19
- package/src/swaps-lib/external-apis/swapProvider.js +50 -1
- package/src/swaps-lib/external-apis/swapspaceSwapProvider.js +7 -1
- package/src/swaps-lib/services/publicSwapService.js +12 -7
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +1 -1
- package/src/ui-kit/components/organisms/SwapForm/SwapForm.jsx +43 -18
- package/coverage/ui-kit/storybook-static/124.c2d01e5e.iframe.bundle.js.html +0 -85
- package/coverage/ui-kit/storybook-static/138.56b7edc4.iframe.bundle.js.html +0 -85
- package/coverage/ui-kit/storybook-static/312.6f62bbd9.iframe.bundle.js.html +0 -85
- package/coverage/ui-kit/storybook-static/341.57a15f57.iframe.bundle.js.html +0 -85
- package/coverage/ui-kit/storybook-static/370.73bb343e.iframe.bundle.js.html +0 -85
- package/coverage/ui-kit/storybook-static/595.2e40d981.iframe.bundle.js.html +0 -85
- package/coverage/ui-kit/storybook-static/607.3ea32459.iframe.bundle.js.html +0 -85
- package/coverage/ui-kit/storybook-static/609.8c79ec77.iframe.bundle.js.html +0 -85
- package/coverage/ui-kit/storybook-static/666.09fdc1d7.iframe.bundle.js.html +0 -85
- package/coverage/ui-kit/storybook-static/797.c87cdf19.iframe.bundle.js.html +0 -85
- package/coverage/ui-kit/storybook-static/822.4bc0ebce.iframe.bundle.js.html +0 -85
- package/coverage/ui-kit/storybook-static/833.08e3ebb6.iframe.bundle.js.html +0 -85
- package/coverage/ui-kit/storybook-static/862.bf6bfe62.iframe.bundle.js.html +0 -85
- package/coverage/ui-kit/storybook-static/87.0a1bfeb1.iframe.bundle.js.html +0 -85
- package/coverage/ui-kit/storybook-static/893.4b09f929.iframe.bundle.js.html +0 -85
- package/coverage/ui-kit/storybook-static/996.846a677b.iframe.bundle.js.html +0 -85
- package/coverage/ui-kit/storybook-static/atoms-BackgroundTitle-stories.1a5386a1.iframe.bundle.js.html +0 -85
- package/coverage/ui-kit/storybook-static/atoms-LinesOfText-stories.7043a48b.iframe.bundle.js.html +0 -85
- package/coverage/ui-kit/storybook-static/atoms-LoadingDots-stories.091245c7.iframe.bundle.js.html +0 -85
- package/coverage/ui-kit/storybook-static/atoms-QrCode-stories.e10363b6.iframe.bundle.js.html +0 -85
- package/coverage/ui-kit/storybook-static/atoms-RateSelector-stories.af208e9a.iframe.bundle.js.html +0 -85
- package/coverage/ui-kit/storybook-static/atoms-Validation-stories.d561b311.iframe.bundle.js.html +0 -85
- package/coverage/ui-kit/storybook-static/atoms-buttons-Button-stories.e8e6b930.iframe.bundle.js.html +0 -85
- package/coverage/ui-kit/storybook-static/atoms-buttons-Close-stories.0a902a7c.iframe.bundle.js.html +0 -85
- package/coverage/ui-kit/storybook-static/atoms-buttons-LinkButton-stories.ca93ab6b.iframe.bundle.js.html +0 -85
- package/coverage/ui-kit/storybook-static/index.html +0 -596
- package/coverage/ui-kit/storybook-static/main.41f410f2.iframe.bundle.js.html +0 -85
- package/coverage/ui-kit/storybook-static/molecules-LineWithIconLink-stories.9721a18c.iframe.bundle.js.html +0 -85
- package/coverage/ui-kit/storybook-static/molecules-TitledLineWithIconLink-stories.1383fe3f.iframe.bundle.js.html +0 -85
- package/coverage/ui-kit/storybook-static/organisms-Dialog-Dialog-stories.4e6da717.iframe.bundle.js.html +0 -85
- package/coverage/ui-kit/storybook-static/organisms-Dialog-DialogButtons-DialogButtons-stories.6f45ae6e.iframe.bundle.js.html +0 -85
- package/coverage/ui-kit/storybook-static/organisms-Dialog-DialogStep-DialogStep-stories.74896048.iframe.bundle.js.html +0 -85
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/@storybook/addon-backgrounds/dist/index.html +0 -116
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/@storybook/addon-backgrounds/dist/preview.js.html +0 -118
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/@storybook/components/dist/formatter-SWP5E3XI.mjs.html +0 -118
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/@storybook/components/dist/index.html +0 -116
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/buffer/index.html +0 -116
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/buffer/index.js.html +0 -118
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/markdown-to-jsx/dist/index.html +0 -116
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/markdown-to-jsx/dist/index.modern.js.html +0 -118
- package/coverage/ui-kit/storybook-static/runtime~main.ad918f38.iframe.bundle.js.html +0 -85
- package/coverage/ui-kit/storybook-static/sb-addons/actions-9/index.html +0 -116
- package/coverage/ui-kit/storybook-static/sb-addons/actions-9/manager-bundle.js.html +0 -94
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-backgrounds-2/index.html +0 -116
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-backgrounds-2/manager-bundle.js.html +0 -121
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-controls-1/index.html +0 -116
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-controls-1/manager-bundle.js.html +0 -274
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-measure-4/index.html +0 -116
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-measure-4/manager-bundle.js.html +0 -94
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-outline-5/index.html +0 -116
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-outline-5/manager-bundle.js.html +0 -94
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-toolbars-3/index.html +0 -116
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-toolbars-3/manager-bundle.js.html +0 -94
- package/coverage/ui-kit/storybook-static/sb-addons/interactions-7/index.html +0 -116
- package/coverage/ui-kit/storybook-static/sb-addons/interactions-7/manager-bundle.js.html +0 -121
- package/coverage/ui-kit/storybook-static/sb-addons/links-0/index.html +0 -116
- package/coverage/ui-kit/storybook-static/sb-addons/links-0/manager-bundle.js.html +0 -94
- package/coverage/ui-kit/storybook-static/sb-addons/onboarding-6/index.html +0 -116
- package/coverage/ui-kit/storybook-static/sb-addons/onboarding-6/manager-bundle.js.html +0 -1588
- package/coverage/ui-kit/storybook-static/sb-addons/viewport-8/index.html +0 -116
- package/coverage/ui-kit/storybook-static/sb-addons/viewport-8/manager-bundle.js.html +0 -94
- package/coverage/ui-kit/storybook-static/sb-manager/WithTooltip-V3YHNWJZ-LVYLGZW2.js.html +0 -88
- package/coverage/ui-kit/storybook-static/sb-manager/chunk-2IXBUOFS.js.html +0 -106
- package/coverage/ui-kit/storybook-static/sb-manager/chunk-INSKDKQB.js.html +0 -1129
- package/coverage/ui-kit/storybook-static/sb-manager/chunk-NGTUFCUO.js.html +0 -112
- package/coverage/ui-kit/storybook-static/sb-manager/chunk-UUEAOBSN.js.html +0 -1303
- package/coverage/ui-kit/storybook-static/sb-manager/chunk-ZEU7PDD3.js.html +0 -88
- package/coverage/ui-kit/storybook-static/sb-manager/formatter-SWP5E3XI-7BGIK6BL.js.html +0 -553
- package/coverage/ui-kit/storybook-static/sb-manager/globals-module-info.js.html +0 -88
- package/coverage/ui-kit/storybook-static/sb-manager/globals.js.html +0 -88
- package/coverage/ui-kit/storybook-static/sb-manager/index.html +0 -281
- package/coverage/ui-kit/storybook-static/sb-manager/index.js.html +0 -88
- package/coverage/ui-kit/storybook-static/sb-manager/runtime.js.html +0 -88
- package/coverage/ui-kit/storybook-static/sb-manager/syntaxhighlighter-V7JZZA35-DXZCI2WR.js.html +0 -88
- package/coverage/ui-kit/storybook-static/sb-preview/globals.js.html +0 -88
- package/coverage/ui-kit/storybook-static/sb-preview/index.html +0 -131
- package/coverage/ui-kit/storybook-static/sb-preview/runtime.js.html +0 -421
- package/coverage/ui-kit/storybook-static/templates-DeterminedErrorDialogStep-stories.3cc14214.iframe.bundle.js.html +0 -85
package/package.json
CHANGED
|
@@ -112,6 +112,8 @@ export class LetsExchangeSwapProvider extends SwapProvider {
|
|
|
112
112
|
amountIsToReceive = false
|
|
113
113
|
) {
|
|
114
114
|
const loggerSource = "getSwapInfo";
|
|
115
|
+
let min = null;
|
|
116
|
+
let max = null;
|
|
115
117
|
try {
|
|
116
118
|
if (
|
|
117
119
|
!(fromCoin instanceof Coin) ||
|
|
@@ -164,11 +166,9 @@ export class LetsExchangeSwapProvider extends SwapProvider {
|
|
|
164
166
|
// const extraUsdToFitMinMax = BigNumber("1"); // We correct the limits as the exact limit can fluctuate and cause failed swap creation
|
|
165
167
|
// extraCoinsToFitMinMax = AmountUtils.trim(extraUsdToFitMinMax.div(fromCoinToUsdRate), fromCoin.digits);
|
|
166
168
|
// }
|
|
167
|
-
let min = null;
|
|
168
169
|
if (data?.min_amount) {
|
|
169
170
|
min = AmountUtils.trim(data?.min_amount, amountIsToReceive ? toCoin.digits : fromCoin.digits);
|
|
170
171
|
}
|
|
171
|
-
let max = null;
|
|
172
172
|
if (data?.max_amount) {
|
|
173
173
|
max = AmountUtils.trim(data?.max_amount, amountIsToReceive ? toCoin.digits : fromCoin.digits);
|
|
174
174
|
}
|
|
@@ -224,12 +224,21 @@ export class LetsExchangeSwapProvider extends SwapProvider {
|
|
|
224
224
|
isRefundAddressRequired: false,
|
|
225
225
|
};
|
|
226
226
|
} catch (e) {
|
|
227
|
+
if (e?.response?.status === 404) {
|
|
228
|
+
return {
|
|
229
|
+
result: false,
|
|
230
|
+
reason: SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED,
|
|
231
|
+
smallestMin: min,
|
|
232
|
+
greatestMax: max,
|
|
233
|
+
};
|
|
234
|
+
}
|
|
227
235
|
if (e?.response?.status === 429) {
|
|
228
236
|
return {
|
|
229
237
|
result: false,
|
|
230
238
|
reason: SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED,
|
|
231
239
|
};
|
|
232
240
|
}
|
|
241
|
+
|
|
233
242
|
Logger.log(`Internal error when getting swap options ${safeStringify(e)}`, loggerSource);
|
|
234
243
|
improveAndRethrow(e, loggerSource);
|
|
235
244
|
}
|
|
@@ -366,22 +375,31 @@ export class LetsExchangeSwapProvider extends SwapProvider {
|
|
|
366
375
|
const isExpiredByTime = expiresAt && expiresAt < Date.now();
|
|
367
376
|
const status = this._mapLetsExchangeStatusToRabbitStatus(swap.status, isExpiredByTime);
|
|
368
377
|
const toDigits = status === SwapProvider.SWAP_STATUSES.REFUNDED ? fromCoin.digits : toCoin.digits;
|
|
378
|
+
const deposit =
|
|
379
|
+
swap.real_deposit_amount && swap.real_deposit_amount !== ""
|
|
380
|
+
? swap.real_deposit_amount
|
|
381
|
+
: swap.deposit_amount;
|
|
382
|
+
const withdrawal =
|
|
383
|
+
swap.real_withdrawal_amount && swap.real_withdrawal_amount !== ""
|
|
384
|
+
? swap.real_withdrawal_amount
|
|
385
|
+
: swap.withdrawal_amount;
|
|
386
|
+
const rate = BigNumber(withdrawal).div(deposit).toFixed(this._maxRateDigits); // We don't use their rate as it excludes their fee
|
|
369
387
|
return new ExistingSwap(
|
|
370
388
|
swapIds[index],
|
|
371
389
|
status,
|
|
372
390
|
createdAt,
|
|
373
391
|
expiresAt,
|
|
374
392
|
swap.confirmations,
|
|
375
|
-
|
|
393
|
+
rate,
|
|
376
394
|
swap.is_float != null ? !swap.is_float : false,
|
|
377
395
|
swap.return,
|
|
378
396
|
swap.deposit,
|
|
379
397
|
fromCoin,
|
|
380
|
-
AmountUtils.trim(
|
|
398
|
+
AmountUtils.trim(deposit, fromCoin.digits),
|
|
381
399
|
swap.hash_in,
|
|
382
400
|
swap.hash_in ? `${swap.coin_from_explorer_url}${swap.hash_in}` : null,
|
|
383
401
|
toCoin,
|
|
384
|
-
AmountUtils.trim(
|
|
402
|
+
AmountUtils.trim(withdrawal, toDigits),
|
|
385
403
|
swap.hash_out,
|
|
386
404
|
swap.hash_out ? `${swap.coin_to_explorer_url}${swap.hash_out}` : null,
|
|
387
405
|
swap.withdrawal,
|
|
@@ -410,20 +428,21 @@ export class LetsExchangeSwapProvider extends SwapProvider {
|
|
|
410
428
|
}
|
|
411
429
|
}
|
|
412
430
|
|
|
413
|
-
// TODO: [dev] Serg, please check this during the review to make sure I did no mistakes in statuses mapping.
|
|
414
|
-
// I will remove these comments after the review. https://api.letsexchange.io/doc
|
|
415
|
-
// wait The exchange has just been created and it’s waiting for coins to reach the deposit wallet
|
|
416
|
-
// confirmation The transaction appears in mempool and now it is waiting for necessary network confirmations to start.
|
|
417
|
-
// confirmed The user’s payment is confirmed, the exchange process is about to start.
|
|
418
|
-
// exchanging The exchange process is running.
|
|
419
|
-
// sending Funds are being sent to the recipient`s address.
|
|
420
|
-
// sending_confirmation The outgoing transaction is waiting for network confirmations.
|
|
421
|
-
// success The exchange is completed and the funds are successfully sent to the recipient’s address.
|
|
422
|
-
// aml_check_failed The deposit was marked as risky by AML check service.
|
|
423
|
-
// overdue The deposit receiving time for this transaction has expired.
|
|
424
|
-
// error The transaction has failed. In most cases, the amount that was sent differs from the amount that was specified when creating the transaction.
|
|
425
|
-
// refund The exchange failed and the coins were refunded to the user's wallet.
|
|
426
431
|
_mapLetsExchangeStatusToRabbitStatus(status, isExpiredByTime) {
|
|
432
|
+
/**
|
|
433
|
+
* Lets exchange statuses description
|
|
434
|
+
* wait - The exchange has just been created and it’s waiting for coins to reach the deposit wallet
|
|
435
|
+
* confirmation - The transaction appears in mempool and now it is waiting for necessary network confirmations to start.
|
|
436
|
+
* confirmed - The user’s payment is confirmed, the exchange process is about to start.
|
|
437
|
+
* exchanging - The exchange process is running.
|
|
438
|
+
* sending - Funds are being sent to the recipient`s address.
|
|
439
|
+
* sending_confirmation - The outgoing transaction is waiting for network confirmations.
|
|
440
|
+
* success - The exchange is completed and the funds are successfully sent to the recipient’s address.
|
|
441
|
+
* aml_check_failed - The deposit was marked as risky by AML check service.
|
|
442
|
+
* overdue - The deposit receiving time for this transaction has expired.
|
|
443
|
+
* error - The transaction has failed. In most cases, the amount that was sent differs from the amount that was specified when creating the transaction.
|
|
444
|
+
* refund - The exchange failed and the coins were refunded to the user's wallet.
|
|
445
|
+
*/
|
|
427
446
|
switch (status) {
|
|
428
447
|
case "wait":
|
|
429
448
|
if (isExpiredByTime) {
|
|
@@ -437,7 +456,7 @@ export class LetsExchangeSwapProvider extends SwapProvider {
|
|
|
437
456
|
case "exchanging":
|
|
438
457
|
return SwapProvider.SWAP_STATUSES.EXCHANGING;
|
|
439
458
|
case "sending":
|
|
440
|
-
return SwapProvider.SWAP_STATUSES.
|
|
459
|
+
return SwapProvider.SWAP_STATUSES.EXCHANGING;
|
|
441
460
|
case "sending_confirmation":
|
|
442
461
|
return SwapProvider.SWAP_STATUSES.EXCHANGING;
|
|
443
462
|
case "success":
|
|
@@ -62,8 +62,57 @@ export class SwapProvider {
|
|
|
62
62
|
* @private
|
|
63
63
|
*/
|
|
64
64
|
_putPopularCoinsFirst() {
|
|
65
|
+
const popularCoinsList = [
|
|
66
|
+
"BTC",
|
|
67
|
+
"ETH",
|
|
68
|
+
"USDTERC20",
|
|
69
|
+
"USDTTRC20",
|
|
70
|
+
"USDCERC20",
|
|
71
|
+
"XRP",
|
|
72
|
+
"TON",
|
|
73
|
+
"XMR",
|
|
74
|
+
"TRX",
|
|
75
|
+
"DAIERC20",
|
|
76
|
+
"DOGE",
|
|
77
|
+
"BNB",
|
|
78
|
+
"PEPEERC20",
|
|
79
|
+
"NOTTON",
|
|
80
|
+
"SOL",
|
|
81
|
+
"DOT",
|
|
82
|
+
"LTC",
|
|
83
|
+
"SHIBERC20",
|
|
84
|
+
"AVAX",
|
|
85
|
+
"UNIERC20",
|
|
86
|
+
"LINKERC20",
|
|
87
|
+
"MATIC",
|
|
88
|
+
"BUSDBEP20",
|
|
89
|
+
"AAVEERC20",
|
|
90
|
+
"ATOM",
|
|
91
|
+
"RUNE",
|
|
92
|
+
"ADA",
|
|
93
|
+
];
|
|
94
|
+
|
|
65
95
|
this._supportedCoins.sort((i1, i2) => {
|
|
66
|
-
|
|
96
|
+
const isInPopularList1 = popularCoinsList.includes(i1.coin.ticker);
|
|
97
|
+
const isInPopularList2 = popularCoinsList.includes(i2.coin.ticker);
|
|
98
|
+
|
|
99
|
+
// If both are in the popularCoinsList, sort by their index in the list
|
|
100
|
+
if (isInPopularList1 && isInPopularList2) {
|
|
101
|
+
const index1 = popularCoinsList.indexOf(i1.coin.ticker);
|
|
102
|
+
const index2 = popularCoinsList.indexOf(i2.coin.ticker);
|
|
103
|
+
return index1 - index2;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Sort by whether the coin is in the popularCoinsList
|
|
107
|
+
if (isInPopularList1 && !isInPopularList2) return -1;
|
|
108
|
+
if (!isInPopularList1 && isInPopularList2) return 1;
|
|
109
|
+
|
|
110
|
+
// If both are not in the popularCoinsList, use the isPopular flag - partners can fill it
|
|
111
|
+
let p1 = i1.isPopular;
|
|
112
|
+
let p2 = i2.isPopular;
|
|
113
|
+
if (p1 !== p2) return p2 - p1;
|
|
114
|
+
|
|
115
|
+
// By default, sort by the coin ticker
|
|
67
116
|
return i1.coin.ticker.localeCompare(i2.coin.ticker);
|
|
68
117
|
});
|
|
69
118
|
}
|
|
@@ -498,6 +498,12 @@ export class SwapspaceSwapProvider extends SwapProvider {
|
|
|
498
498
|
const status = this._mapSwapspaceStatusToRabbitStatus(swap.status, isExpiredByTime);
|
|
499
499
|
const toDigits = status === SwapProvider.SWAP_STATUSES.REFUNDED ? fromCoin.digits : toCoin.digits;
|
|
500
500
|
const addressToSendCoinsToSwapspace = swap.from.address;
|
|
501
|
+
const toUrl = (swap.blockExplorerTransactionUrl.to ?? "")
|
|
502
|
+
.replace(/from=swapspace&?/g, "")
|
|
503
|
+
.replaceAll(/&&+/g, "&")
|
|
504
|
+
.replace("?&", "?")
|
|
505
|
+
.replace(/&$/, "")
|
|
506
|
+
.replace(/\?$/, "");
|
|
501
507
|
return new ExistingSwap(
|
|
502
508
|
swapIds[index],
|
|
503
509
|
status,
|
|
@@ -515,7 +521,7 @@ export class SwapspaceSwapProvider extends SwapProvider {
|
|
|
515
521
|
toCoin,
|
|
516
522
|
AmountUtils.trim(swap.to.amount, toDigits),
|
|
517
523
|
swap.to.transactionHash,
|
|
518
|
-
|
|
524
|
+
toUrl,
|
|
519
525
|
swap.to.address,
|
|
520
526
|
swap.partner,
|
|
521
527
|
swap.from.extraId ?? null,
|
|
@@ -169,7 +169,7 @@ export class PublicSwapService {
|
|
|
169
169
|
*
|
|
170
170
|
* @param fromCoin {Coin}
|
|
171
171
|
* @param toCoin {Coin}
|
|
172
|
-
* @param
|
|
172
|
+
* @param amountCoins {string}
|
|
173
173
|
* @param [fixed=false] {boolean|null} null means fixed or float doesn't matter
|
|
174
174
|
* @param [withoutFiat=false] {boolean} pass true if you don't need the fiat equivalent - this will diminish requests count
|
|
175
175
|
* @param [amountIsToReceive=false] {boolean} whether the given amount is receiving amount.
|
|
@@ -190,7 +190,7 @@ export class PublicSwapService {
|
|
|
190
190
|
async getPublicSwapDetails(
|
|
191
191
|
fromCoin,
|
|
192
192
|
toCoin,
|
|
193
|
-
|
|
193
|
+
amountCoins,
|
|
194
194
|
fixed = false,
|
|
195
195
|
withoutFiat = false,
|
|
196
196
|
amountIsToReceive = false
|
|
@@ -208,7 +208,7 @@ export class PublicSwapService {
|
|
|
208
208
|
const details = await (fixed ? this._fixedSwapProvider : this._swapProvider).getSwapInfo(
|
|
209
209
|
fromCoin,
|
|
210
210
|
toCoin,
|
|
211
|
-
|
|
211
|
+
amountCoins,
|
|
212
212
|
fixed,
|
|
213
213
|
coinUsdtRate,
|
|
214
214
|
amountIsToReceive
|
|
@@ -259,18 +259,23 @@ export class PublicSwapService {
|
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
-
const
|
|
263
|
-
if (typeof min === "string" &&
|
|
262
|
+
const amountBigNumber = BigNumber(amountCoins);
|
|
263
|
+
if (typeof min === "string" && amountBigNumber.lt(min)) {
|
|
264
264
|
return composeFailResult(
|
|
265
265
|
PublicSwapService.PUBLIC_SWAP_DETAILS_FAIL_REASONS.AMOUNT_LESS_THAN_MIN_SWAPPABLE
|
|
266
266
|
);
|
|
267
|
-
} else if (typeof max === "string" &&
|
|
267
|
+
} else if (typeof max === "string" && amountBigNumber.gt(max)) {
|
|
268
268
|
return composeFailResult(
|
|
269
269
|
PublicSwapService.PUBLIC_SWAP_DETAILS_FAIL_REASONS.AMOUNT_HIGHER_THAN_MAX_SWAPPABLE
|
|
270
270
|
);
|
|
271
271
|
}
|
|
272
272
|
|
|
273
|
-
const
|
|
273
|
+
const fromAmountCoins = amountIsToReceive
|
|
274
|
+
? AmountUtils.trim(amountBigNumber.div(details.rate), fromCoin.digits)
|
|
275
|
+
: amountCoins;
|
|
276
|
+
const toAmountCoins = amountIsToReceive
|
|
277
|
+
? amountCoins
|
|
278
|
+
: AmountUtils.trim(amountBigNumber.times(details.rate), toCoin.digits);
|
|
274
279
|
const result = {
|
|
275
280
|
result: true,
|
|
276
281
|
swapCreationInfo: new BaseSwapCreationInfo(
|
|
@@ -515,7 +515,7 @@ describe("swapspaceSwapProvider", function () {
|
|
|
515
515
|
|
|
516
516
|
swapspaceProvider._supportedCoins
|
|
517
517
|
.map(coin => coin.coin.ticker)
|
|
518
|
-
.should.be.deepEqual(["
|
|
518
|
+
.should.be.deepEqual(["ETH", "AAAXXX", "AAAEEE", "BAC", "BTCBBB"]);
|
|
519
519
|
});
|
|
520
520
|
|
|
521
521
|
it("should handle empty response data", async () => {
|
|
@@ -279,7 +279,8 @@ export const SwapForm = ({
|
|
|
279
279
|
receivingAssetTicker,
|
|
280
280
|
amount,
|
|
281
281
|
isSwapAll = false,
|
|
282
|
-
|
|
282
|
+
isFixed = false,
|
|
283
|
+
amountIsToReceive = false
|
|
283
284
|
) => {},
|
|
284
285
|
retrieveInitialSwapData = async (sendingAssetTicker, receivingAssetTicker) => {},
|
|
285
286
|
triggerDataUpdateResetting = 0,
|
|
@@ -297,8 +298,8 @@ export const SwapForm = ({
|
|
|
297
298
|
swapSeparatorIconSrc,
|
|
298
299
|
swapButtonAlwaysActive = false,
|
|
299
300
|
onIsFixedChange = () => {},
|
|
300
|
-
recipientAddressExtraIdName,
|
|
301
|
-
refundAddressExtraIdName,
|
|
301
|
+
// recipientAddressExtraIdName,
|
|
302
|
+
// refundAddressExtraIdName,
|
|
302
303
|
translations = {
|
|
303
304
|
swapAllButtonTitles: {
|
|
304
305
|
enable: "Swap all",
|
|
@@ -345,12 +346,14 @@ export const SwapForm = ({
|
|
|
345
346
|
const DETAIL_REFRESH_INTERVAL_MS = 1.5 * 60000;
|
|
346
347
|
const IS_FIXED_BY_DEFAULT = false;
|
|
347
348
|
|
|
349
|
+
// Updating the states below will insert the new value into the send or receive input field
|
|
348
350
|
const [updateSendInputTo, setUpdateSendInputTo] = useState(preservedAmount ?? null);
|
|
349
351
|
const [updateReceiveInputTo, setUpdateReceiveInputTo] = useState(null);
|
|
350
352
|
|
|
351
353
|
const [sendAssetAmount, setSendAssetAmount] = useReferredState(
|
|
352
354
|
preservedAmount == null || preservedAmount === "" ? null : preservedAmount
|
|
353
355
|
);
|
|
356
|
+
const [receiveAssetAmount, setReceiveAssetAmount] = useReferredState(null);
|
|
354
357
|
|
|
355
358
|
const [swapRate, setSwapRate] = useState();
|
|
356
359
|
const [minimalAmount, setMinimalAmount] = useReferredState(null);
|
|
@@ -363,6 +366,8 @@ export const SwapForm = ({
|
|
|
363
366
|
const [isSameCoins, setIsSameCoins] = useState(false);
|
|
364
367
|
const [isSwapCalculated, setIsSwapCalculated] = useState(false);
|
|
365
368
|
const [readyToSwap, setReadyToSwap] = useState(false); // Basically a param that enables/disables the "Next" button
|
|
369
|
+
// TODO: [refactoring, moderate] instead of handling preservedAmount at a lot of cases below, just
|
|
370
|
+
// write single useEffect setting sendAssetAmount to the=is passed value and simplify the logic below. task_id=6453251e49b04c5e88a3cc771479ffb5
|
|
366
371
|
const [isAmountZero, setIsAmountZero] = useState(preservedAmount == null || String(preservedAmount) === "0");
|
|
367
372
|
const [isLoading, setIsLoading] = useReferredState(false); // Whether the form is in the progress of loading some data (new rates, for example)
|
|
368
373
|
const [isFixedRate, setIsFixedRate] = useReferredState(null);
|
|
@@ -398,8 +403,10 @@ export const SwapForm = ({
|
|
|
398
403
|
|
|
399
404
|
const handleSendAssetAmountChange = amount => {
|
|
400
405
|
setIsLastEditedReceiving(false);
|
|
406
|
+
const receiveAmount = AmountUtils.trim(BigNumber(amount).times(swapRate), receivingAssetDecimalCount);
|
|
401
407
|
if (amount != null && amount !== "") {
|
|
402
|
-
|
|
408
|
+
setReceiveAssetAmount(receiveAmount);
|
|
409
|
+
setUpdateReceiveInputTo(receiveAmount);
|
|
403
410
|
} else {
|
|
404
411
|
setUpdateReceiveInputTo("");
|
|
405
412
|
}
|
|
@@ -407,6 +414,7 @@ export const SwapForm = ({
|
|
|
407
414
|
};
|
|
408
415
|
|
|
409
416
|
const handleReceiveAssetAmountChange = amount => {
|
|
417
|
+
setReceiveAssetAmount(amount);
|
|
410
418
|
setIsLastEditedReceiving(true);
|
|
411
419
|
let sendAssetAmount = "";
|
|
412
420
|
if (amount != null && amount !== "") {
|
|
@@ -536,7 +544,9 @@ export const SwapForm = ({
|
|
|
536
544
|
String(
|
|
537
545
|
isForPreserved && sendAssetAmount.current == null
|
|
538
546
|
? preservedAmount
|
|
539
|
-
:
|
|
547
|
+
: isFixedRate.current && isLastEditedReceiving
|
|
548
|
+
? receiveAssetAmount.current
|
|
549
|
+
: sendAssetAmount.current
|
|
540
550
|
)
|
|
541
551
|
) {
|
|
542
552
|
// Means amount changed and we no more need to do this exact calculation
|
|
@@ -546,9 +556,6 @@ export const SwapForm = ({
|
|
|
546
556
|
if (response.result) {
|
|
547
557
|
const swapCreationInfo = response.swapCreationInfo;
|
|
548
558
|
|
|
549
|
-
setUpdateSendInputTo(swapCreationInfo.fromAmountCoins);
|
|
550
|
-
setUpdateReceiveInputTo(swapCreationInfo.toAmountCoins);
|
|
551
|
-
|
|
552
559
|
if (isSwapAll.current) {
|
|
553
560
|
setIsAmountZero(BigNumber("0").eq(swapCreationInfo.fromAmountCoins));
|
|
554
561
|
}
|
|
@@ -558,6 +565,9 @@ export const SwapForm = ({
|
|
|
558
565
|
setIsRefundAddressRequired(swapCreationInfo?.isRefundAddressRequired);
|
|
559
566
|
processMinMaxAmounts(isSwapAll.current ? swapCreationInfo.fromAmountCoins : amount);
|
|
560
567
|
setIsSwapCalculated(true);
|
|
568
|
+
|
|
569
|
+
setUpdateSendInputTo(swapCreationInfo.fromAmountCoins);
|
|
570
|
+
setUpdateReceiveInputTo(swapCreationInfo.toAmountCoins);
|
|
561
571
|
} else {
|
|
562
572
|
handleSwapServiceError(
|
|
563
573
|
response.reason,
|
|
@@ -640,7 +650,7 @@ export const SwapForm = ({
|
|
|
640
650
|
|
|
641
651
|
const handleRateModeChanged = isFixed => {
|
|
642
652
|
setIsFixedRate(isFixed);
|
|
643
|
-
requestDataRefresh(sendAssetAmount.current, true);
|
|
653
|
+
requestDataRefresh(isLastEditedReceiving ? receiveAssetAmount.current : sendAssetAmount.current, true);
|
|
644
654
|
};
|
|
645
655
|
|
|
646
656
|
useEffect(() => {
|
|
@@ -674,7 +684,7 @@ export const SwapForm = ({
|
|
|
674
684
|
const isCurrentAmountNotZero = sendAssetAmount.current && !BigNumber("0").eq(sendAssetAmount.current);
|
|
675
685
|
const isPreservedAmountNotZero = preservedAmount && !BigNumber("0").eq(preservedAmount);
|
|
676
686
|
if (isCurrentAmountNotZero) {
|
|
677
|
-
loadFullEstimation(sendAssetAmount.current);
|
|
687
|
+
loadFullEstimation(isLastEditedReceiving ? receiveAssetAmount.current : sendAssetAmount.current);
|
|
678
688
|
} else if (isPreservedAmountNotZero) {
|
|
679
689
|
loadFullEstimation(preservedAmount, true);
|
|
680
690
|
} else {
|
|
@@ -761,7 +771,11 @@ export const SwapForm = ({
|
|
|
761
771
|
let timeoutId = null;
|
|
762
772
|
if (readyToSwap) {
|
|
763
773
|
timeoutId = setTimeout(
|
|
764
|
-
() =>
|
|
774
|
+
() =>
|
|
775
|
+
requestDataRefresh(
|
|
776
|
+
isLastEditedReceiving ? receiveAssetAmount.current : sendAssetAmount.current ?? preservedAmount,
|
|
777
|
+
true
|
|
778
|
+
),
|
|
765
779
|
DETAIL_REFRESH_INTERVAL_MS
|
|
766
780
|
);
|
|
767
781
|
setIdleDataUpdateTimeoutId(timeoutId);
|
|
@@ -794,9 +808,15 @@ export const SwapForm = ({
|
|
|
794
808
|
|
|
795
809
|
useEffect(() => {
|
|
796
810
|
if (swapRate != null && sendAssetAmount.current != null) {
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
811
|
+
if (isLastEditedReceiving) {
|
|
812
|
+
setUpdateSendInputTo(
|
|
813
|
+
AmountUtils.trim(BigNumber(receiveAssetAmount.current).div(swapRate), sendingAssetDecimalCount)
|
|
814
|
+
);
|
|
815
|
+
} else {
|
|
816
|
+
setUpdateReceiveInputTo(
|
|
817
|
+
AmountUtils.trim(BigNumber(sendAssetAmount.current).times(swapRate), receivingAssetDecimalCount)
|
|
818
|
+
);
|
|
819
|
+
}
|
|
800
820
|
}
|
|
801
821
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
802
822
|
}, [swapRate]);
|
|
@@ -814,13 +834,17 @@ export const SwapForm = ({
|
|
|
814
834
|
|
|
815
835
|
if (sendAssetAmount.current == null) return;
|
|
816
836
|
let processingAmount = sendAssetAmount.current === "" ? "0" : sendAssetAmount.current;
|
|
817
|
-
|
|
837
|
+
let processingReceivingAmount = receiveAssetAmount.current === "" ? "0" : receiveAssetAmount.current;
|
|
838
|
+
requestDataRefresh(isLastEditedReceiving ? processingReceivingAmount : processingAmount);
|
|
818
839
|
processMinMaxAmounts(processingAmount);
|
|
819
840
|
setIsAmountZero(BigNumber("0").eq(processingAmount));
|
|
820
841
|
setIsSwapCalculated(false);
|
|
821
842
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
822
843
|
}, [sendAssetAmount.current]);
|
|
823
844
|
|
|
845
|
+
const recipientAddressExtraIdName = getExtraIdNameByTicker(receivingAssetTicker);
|
|
846
|
+
const refundAddressExtraIdName = getExtraIdNameByTicker(sendingAssetTicker);
|
|
847
|
+
|
|
824
848
|
return (
|
|
825
849
|
<div className={s["swap-form"]}>
|
|
826
850
|
<TitleBox
|
|
@@ -876,7 +900,7 @@ export const SwapForm = ({
|
|
|
876
900
|
upperFormPosition
|
|
877
901
|
errorEncountered={!minimalAmountValid}
|
|
878
902
|
ref={fromAssetSelectionButtonRef}
|
|
879
|
-
isLoading={false}
|
|
903
|
+
isLoading={isLastEditedReceiving ? isLoading.current : false}
|
|
880
904
|
cryptoAssetToFiatRate={sendingAssetToFiatRate}
|
|
881
905
|
fiatCurrencyCode={formHasFiat ? fiatCurrencyCode : null}
|
|
882
906
|
fiatCurrencyDecimals={fiatCurrencyDecimals}
|
|
@@ -918,7 +942,7 @@ export const SwapForm = ({
|
|
|
918
942
|
lowerFormPosition
|
|
919
943
|
estimateAmount={!isFixedRate.current}
|
|
920
944
|
ref={toAssetSelectionButtonRef}
|
|
921
|
-
isLoading={isLoading.current}
|
|
945
|
+
isLoading={isLastEditedReceiving ? false : isLoading.current}
|
|
922
946
|
cryptoAssetToFiatRate={receivingAssetToFiatRate}
|
|
923
947
|
fiatCurrencyCode={formHasFiat ? fiatCurrencyCode : null}
|
|
924
948
|
fiatCurrencyDecimals={fiatCurrencyDecimals}
|
|
@@ -1119,7 +1143,8 @@ export const SwapForm = ({
|
|
|
1119
1143
|
recipientAddress.current,
|
|
1120
1144
|
recipientAddressExtraId.current,
|
|
1121
1145
|
refundAddress.current,
|
|
1122
|
-
refundAddressExtraId.current
|
|
1146
|
+
refundAddressExtraId.current,
|
|
1147
|
+
isLastEditedReceiving
|
|
1123
1148
|
)
|
|
1124
1149
|
}
|
|
1125
1150
|
fullWidthOnMobiles
|