@rabbitio/ui-kit 1.0.0-beta.72 → 1.0.0-beta.74
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 +6441 -1864
- package/coverage/coverage-final.json +157 -95
- package/coverage/index.html +339 -84
- package/coverage/{rabbit-ui-kit → ui-kit}/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/index.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/adapters/axiosAdapter.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/adapters/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/adapters/qrUtils.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/amountUtils.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/errorUtils.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/external-apis/apiGroups.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/external-apis/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/external-apis/ipAddressProviders.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/fiatCurrenciesService.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/globalConstants.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/models/blockchain.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/models/coin.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/models/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/models/protocol.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/cache.js.html +8 -8
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/emailAPI.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/logging/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/logging/logger.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/logging/logsStorage.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/postponeExecution.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/safeStringify.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/index.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robust-api-caller/cacheAndConcurrentRequestsResolver.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robust-api-caller/cachedRobustExternalApiCallerService.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robust-api-caller/cancelProcessing.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robust-api-caller/concurrentCalculationsMetadataHolder.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robust-api-caller/externalApiProvider.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robust-api-caller/externalServicesStatsCollector.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robust-api-caller/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robust-api-caller/robustExternalAPICallerService.js.html +3 -3
- package/coverage/ui-kit/src/swaps-lib/external-apis/index.html +146 -0
- package/coverage/ui-kit/src/swaps-lib/external-apis/letsExchangeSwapProvider.js.html +1456 -0
- package/coverage/ui-kit/src/swaps-lib/external-apis/swapProvider.js.html +1390 -0
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/external-apis/swapspaceSwapProvider.js.html +45 -585
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/baseSwapCreationInfo.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/existingSwap.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/existingSwapWithFiatData.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/services/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/services/publicSwapService.js.html +233 -50
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/utils/index.html +13 -13
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/utils/swapUtils.js.html +121 -46
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/arrowIcon.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/arrowTosca.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/arrowWhite.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/darkRectangle.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/determinedError.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/failedValidationIcon.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/infoIcon.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/noticeQuestionIcon.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/successfulValidationIcon.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/assets/wrappedImages/walletIcon.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/AssetIcon/AssetIcon.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/AssetIcon/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/AssetSelection/AssetSelection.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/AssetSelection/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/BackgroundTitle/BackgroundTitle.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/BackgroundTitle/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/InformationMessage/InformationMessage.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/InformationMessage/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/Input/Input.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/Input/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/LoadingDots/LoadingDots.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/LoadingDots/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/NoticeIcon/NoticeIcon.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/NoticeIcon/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/QrCode/QrCode.jsx.html +52 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/QrCode/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/RateSelector/RateSelector.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/RateSelector/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/SupportChat/SupportChat.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/SupportChat/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/Textarea/Textarea.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/Textarea/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/TitleBox/TitleBox.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/TitleBox/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/Tooltip/Tooltip.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/Tooltip/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/TwoLinesOfText/LinesOfText.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/TwoLinesOfText/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/Validation/Validation.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/Validation/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/buttons/Button/Button.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/buttons/Button/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/buttons/Close/Close.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/buttons/Close/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/buttons/LinkButton/LinkButton.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/buttons/LinkButton/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/buttons/RadioButtonWithText/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/AmountInput/AmountInput.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/AmountInput/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/CoinPicker/CoinPicker.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/CoinPicker/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/LineWithIconLink/LineWithIconLink.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/LineWithIconLink/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/TitledLineWithIconLink/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/CoinPickerDialogStep/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/Dialog/Dialog.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/Dialog/DialogButtons/DialogButtons.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/Dialog/DialogButtons/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/Dialog/DialogStep/DialogStep.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/Dialog/DialogStep/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/Dialog/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/SwapForm/SwapForm.jsx.html +171 -39
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/SwapForm/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/templates/DeterminedErrorDialogStep/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/hooks/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/hooks/useCallHandlingErrors.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/hooks/useIsHydrated.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/hooks/useReferredState.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/utils/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/utils/inputValueProviders.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/utils/textUtils.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/utils/uiUtils.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/utils/urlQueryUtils.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/BackgroundTitle.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/LinesOfText.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/LoadingDots.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/QrCode.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/RateSelector.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/Validation.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/buttons/Button.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/buttons/Close.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/buttons/LinkButton.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/buttons/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/molecules/LineWithIconLink.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/molecules/TitledLineWithIconLink.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/molecules/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/Dialog.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/DialogButtons/DialogButtons.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/DialogButtons/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/DialogStep/DialogStep.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/DialogStep/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/stubs/exampleContent.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/stubs/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/templates/DeterminedErrorDialogStep.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/templates/index.html +3 -3
- package/coverage/ui-kit/storybook-static/124.c2d01e5e.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/138.56b7edc4.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/312.6f62bbd9.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/341.57a15f57.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/370.73bb343e.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/595.2e40d981.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/607.3ea32459.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/609.8c79ec77.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/666.09fdc1d7.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/797.c87cdf19.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/822.4bc0ebce.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/833.08e3ebb6.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/862.bf6bfe62.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/87.0a1bfeb1.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/893.4b09f929.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/996.846a677b.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/atoms-BackgroundTitle-stories.1a5386a1.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/atoms-LinesOfText-stories.7043a48b.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/atoms-LoadingDots-stories.091245c7.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/atoms-QrCode-stories.e10363b6.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/atoms-RateSelector-stories.af208e9a.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/atoms-Validation-stories.d561b311.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/atoms-buttons-Button-stories.e8e6b930.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/atoms-buttons-Close-stories.0a902a7c.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/atoms-buttons-LinkButton-stories.ca93ab6b.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/index.html +596 -0
- package/coverage/ui-kit/storybook-static/main.41f410f2.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/molecules-LineWithIconLink-stories.9721a18c.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/molecules-TitledLineWithIconLink-stories.1383fe3f.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/organisms-Dialog-Dialog-stories.4e6da717.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/organisms-Dialog-DialogButtons-DialogButtons-stories.6f45ae6e.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/organisms-Dialog-DialogStep-DialogStep-stories.74896048.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/@storybook/addon-backgrounds/dist/index.html +116 -0
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/@storybook/addon-backgrounds/dist/preview.js.html +118 -0
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/@storybook/components/dist/formatter-SWP5E3XI.mjs.html +118 -0
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/@storybook/components/dist/index.html +116 -0
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/buffer/index.html +116 -0
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/buffer/index.js.html +118 -0
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/markdown-to-jsx/dist/index.html +116 -0
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/markdown-to-jsx/dist/index.modern.js.html +118 -0
- package/coverage/ui-kit/storybook-static/runtime~main.ad918f38.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/sb-addons/actions-9/index.html +116 -0
- package/coverage/ui-kit/storybook-static/sb-addons/actions-9/manager-bundle.js.html +94 -0
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-backgrounds-2/index.html +116 -0
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-backgrounds-2/manager-bundle.js.html +121 -0
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-controls-1/index.html +116 -0
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-controls-1/manager-bundle.js.html +274 -0
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-measure-4/index.html +116 -0
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-measure-4/manager-bundle.js.html +94 -0
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-outline-5/index.html +116 -0
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-outline-5/manager-bundle.js.html +94 -0
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-toolbars-3/index.html +116 -0
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-toolbars-3/manager-bundle.js.html +94 -0
- package/coverage/ui-kit/storybook-static/sb-addons/interactions-7/index.html +116 -0
- package/coverage/ui-kit/storybook-static/sb-addons/interactions-7/manager-bundle.js.html +121 -0
- package/coverage/ui-kit/storybook-static/sb-addons/links-0/index.html +116 -0
- package/coverage/ui-kit/storybook-static/sb-addons/links-0/manager-bundle.js.html +94 -0
- package/coverage/ui-kit/storybook-static/sb-addons/onboarding-6/index.html +116 -0
- package/coverage/ui-kit/storybook-static/sb-addons/onboarding-6/manager-bundle.js.html +1588 -0
- package/coverage/ui-kit/storybook-static/sb-addons/viewport-8/index.html +116 -0
- package/coverage/ui-kit/storybook-static/sb-addons/viewport-8/manager-bundle.js.html +94 -0
- package/coverage/ui-kit/storybook-static/sb-manager/WithTooltip-V3YHNWJZ-LVYLGZW2.js.html +88 -0
- package/coverage/ui-kit/storybook-static/sb-manager/chunk-2IXBUOFS.js.html +106 -0
- package/coverage/ui-kit/storybook-static/sb-manager/chunk-INSKDKQB.js.html +1129 -0
- package/coverage/ui-kit/storybook-static/sb-manager/chunk-NGTUFCUO.js.html +112 -0
- package/coverage/ui-kit/storybook-static/sb-manager/chunk-UUEAOBSN.js.html +1303 -0
- package/coverage/ui-kit/storybook-static/sb-manager/chunk-ZEU7PDD3.js.html +88 -0
- package/coverage/ui-kit/storybook-static/sb-manager/formatter-SWP5E3XI-7BGIK6BL.js.html +553 -0
- package/coverage/ui-kit/storybook-static/sb-manager/globals-module-info.js.html +88 -0
- package/coverage/ui-kit/storybook-static/sb-manager/globals.js.html +88 -0
- package/coverage/ui-kit/storybook-static/sb-manager/index.html +281 -0
- package/coverage/ui-kit/storybook-static/sb-manager/index.js.html +88 -0
- package/coverage/ui-kit/storybook-static/sb-manager/runtime.js.html +88 -0
- package/coverage/ui-kit/storybook-static/sb-manager/syntaxhighlighter-V7JZZA35-DXZCI2WR.js.html +88 -0
- package/coverage/ui-kit/storybook-static/sb-preview/globals.js.html +88 -0
- package/coverage/ui-kit/storybook-static/sb-preview/index.html +131 -0
- package/coverage/ui-kit/storybook-static/sb-preview/runtime.js.html +421 -0
- package/coverage/ui-kit/storybook-static/templates-DeterminedErrorDialogStep-stories.3cc14214.iframe.bundle.js.html +85 -0
- package/dist/index.cjs +1201 -605
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +786 -330
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +1201 -605
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +1201 -605
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/swaps-lib/external-apis/letsExchangeSwapProvider.js +457 -0
- package/src/swaps-lib/external-apis/swapProvider.js +246 -20
- package/src/swaps-lib/external-apis/swapspaceSwapProvider.js +20 -200
- package/src/swaps-lib/services/publicSwapService.js +105 -44
- package/src/swaps-lib/test/external-apis/swapProvider/removeProtocolNameFromCoinName.test.js +142 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +2 -2
- package/src/swaps-lib/utils/swapUtils.js +63 -38
- package/src/ui-kit/components/atoms/QrCode/QrCode.jsx +16 -1
- package/src/ui-kit/components/organisms/SwapForm/SwapForm.jsx +77 -33
- package/src/ui-kit/components/organisms/SwapForm/swap-form.module.scss +1 -1
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/index.html +0 -131
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/swapProvider.js.html +0 -712
package/dist/index.modern.js
CHANGED
|
@@ -4122,6 +4122,15 @@ function useIsHydrated() {
|
|
|
4122
4122
|
* @return {string|null}
|
|
4123
4123
|
*/
|
|
4124
4124
|
|
|
4125
|
+
/**
|
|
4126
|
+
* Callback to handle isFixed flag change.
|
|
4127
|
+
*
|
|
4128
|
+
* @function
|
|
4129
|
+
* @name onIsFixedChange
|
|
4130
|
+
* @param {boolean} isFixedNewValue - new value
|
|
4131
|
+
* @return {void}
|
|
4132
|
+
*/
|
|
4133
|
+
|
|
4125
4134
|
/**
|
|
4126
4135
|
* Function validating addresses.
|
|
4127
4136
|
* By default, will treat any addresses as valid.
|
|
@@ -4131,6 +4140,7 @@ function useIsHydrated() {
|
|
|
4131
4140
|
* @name validateAddressByTicker
|
|
4132
4141
|
* @param {string} ticker - Ticker symbol of the asset.
|
|
4133
4142
|
* @param {string} address - Address to be validated
|
|
4143
|
+
* @param {boolean} isFixed - Is swap rate mode = fixed
|
|
4134
4144
|
* @return {Promise<boolean>}
|
|
4135
4145
|
*/
|
|
4136
4146
|
|
|
@@ -4178,11 +4188,13 @@ function useIsHydrated() {
|
|
|
4178
4188
|
* @param {boolean} [props.formHasFiat] - Indicates if the form supports fiat currency.
|
|
4179
4189
|
* @param {string|null} [props.termsOfUseUrl] - Terms of use URL, shown only if both terms & privacy policy passed.
|
|
4180
4190
|
* @param {string|null} [props.privacyPolicyUrl] - Privacy policy of use URL, shown only if both terms & privacy policy passed.
|
|
4191
|
+
* @param {string} props.recipientAddressExtraIdName - Extra ID name for the recipient address.
|
|
4192
|
+
* @param {string} props.refundAddressExtraIdName - Extra ID name for the refund address.
|
|
4181
4193
|
* @param {object} [props.translations] - Object containing translations, default English texts will be used if omitted.
|
|
4182
4194
|
* @param {string} props.swapSeparatorIconSrc - Source URL for the swap separator icon.
|
|
4183
4195
|
* @param {boolean} props.swapButtonAlwaysActive - Setting that allows the form state to proceed to the next step regardless of validity.
|
|
4184
|
-
* @param {getExtraIdNameByTicker} props.getExtraIdNameByTicker - Function returning extraId name for asset
|
|
4185
4196
|
* @param {validateAddressByTicker} [props.validateAddressByTicker] - Function validating address
|
|
4197
|
+
* @param {onIsFixedChange} [props.onIsFixedChange] - callback for changed isFixed
|
|
4186
4198
|
* @return {JSX.Element} Rendered SwapForm component.
|
|
4187
4199
|
* @constructor
|
|
4188
4200
|
*/
|
|
@@ -4213,7 +4225,7 @@ const SwapForm = ({
|
|
|
4213
4225
|
preservedAmount: _preservedAmount = null,
|
|
4214
4226
|
handleSwapServiceError: _handleSwapServiceError = (errorCode, setValidationContent, setBalanceValid, setMinimalAmountValid, setMaximumAmountValid, setIsPairSupported, setIsSameCoins) => {},
|
|
4215
4227
|
formHasBalance: _formHasBalance = false,
|
|
4216
|
-
retrieveSwapDetails: _retrieveSwapDetails = async (sendingAssetTicker, receivingAssetTicker, amount, isSwapAll = false) => {},
|
|
4228
|
+
retrieveSwapDetails: _retrieveSwapDetails = async (sendingAssetTicker, receivingAssetTicker, amount, isSwapAll = false, editedLastInput = false) => {},
|
|
4217
4229
|
retrieveInitialSwapData: _retrieveInitialSwapData = async (sendingAssetTicker, receivingAssetTicker) => {},
|
|
4218
4230
|
triggerDataUpdateResetting: _triggerDataUpdateResetting = 0,
|
|
4219
4231
|
fromAssetSelectionButtonRef: _fromAssetSelectionButtonRef = null,
|
|
@@ -4226,9 +4238,12 @@ const SwapForm = ({
|
|
|
4226
4238
|
termsOfUseUrl: _termsOfUseUrl = null,
|
|
4227
4239
|
privacyPolicyUrl: _privacyPolicyUrl = null,
|
|
4228
4240
|
getExtraIdNameByTicker: _getExtraIdNameByTicker = ticker => null,
|
|
4229
|
-
validateAddressByTicker: _validateAddressByTicker =
|
|
4241
|
+
validateAddressByTicker: _validateAddressByTicker = () => false,
|
|
4230
4242
|
swapSeparatorIconSrc,
|
|
4231
4243
|
swapButtonAlwaysActive: _swapButtonAlwaysActive = false,
|
|
4244
|
+
onIsFixedChange: _onIsFixedChange = () => {},
|
|
4245
|
+
recipientAddressExtraIdName,
|
|
4246
|
+
refundAddressExtraIdName,
|
|
4232
4247
|
translations: _translations = {
|
|
4233
4248
|
swapAllButtonTitles: {
|
|
4234
4249
|
enable: "Swap all",
|
|
@@ -4258,7 +4273,9 @@ const SwapForm = ({
|
|
|
4258
4273
|
addressTitle: "Recepient address",
|
|
4259
4274
|
refundAddressTitle: "Refund address",
|
|
4260
4275
|
extraIdPlaceholder: "(optional)",
|
|
4276
|
+
refundAddressExtraIdTitle: "Refund extra ID (MEMO):",
|
|
4261
4277
|
refundAddressExtraIdNotice: "Please check if your address requires additional identifier (sometimes called a Memo, Destination Tag, Tag, ID, Label or Note). Including this identifier is crucial when required, as omitting or misentering it can result in lost assets.",
|
|
4278
|
+
receivingAddressExtraIdTitle: "Destination extra ID (MEMO):",
|
|
4262
4279
|
receivingAddressExtraIdNotice: "Please check if your address requires additional identifier (sometimes called a Memo, Destination Tag, Tag, ID, Label or Note). Including this identifier is crucial when required, as omitting or misentering it can result in lost assets."
|
|
4263
4280
|
},
|
|
4264
4281
|
rateSelector: {
|
|
@@ -4268,7 +4285,7 @@ const SwapForm = ({
|
|
|
4268
4285
|
confirmButtonText: "Swap"
|
|
4269
4286
|
}
|
|
4270
4287
|
}) => {
|
|
4271
|
-
var _isFixedRate$current2, _maximumAmount$curren4, _maximumAmount$curren5, _maximumAmount$curren6, _minimalAmount$curren5
|
|
4288
|
+
var _isFixedRate$current2, _isFixedRate$current3, _maximumAmount$curren4, _maximumAmount$curren5, _maximumAmount$curren6, _minimalAmount$curren5;
|
|
4272
4289
|
const DETAIL_REFRESH_INTERVAL_MS = 1.5 * 60000;
|
|
4273
4290
|
const IS_FIXED_BY_DEFAULT = false;
|
|
4274
4291
|
|
|
@@ -4276,6 +4293,7 @@ const SwapForm = ({
|
|
|
4276
4293
|
const [updateSendInputTo, setUpdateSendInputTo] = useState(_preservedAmount != null ? _preservedAmount : null);
|
|
4277
4294
|
const [updateReceiveInputTo, setUpdateReceiveInputTo] = useState(null);
|
|
4278
4295
|
const [sendAssetAmount, setSendAssetAmount] = useReferredState(_preservedAmount == null || _preservedAmount === "" ? null : _preservedAmount);
|
|
4296
|
+
const [receiveAssetAmount, setReceiveAssetAmount] = useReferredState(null);
|
|
4279
4297
|
const [swapRate, setSwapRate] = useState();
|
|
4280
4298
|
const [minimalAmount, setMinimalAmount] = useReferredState(null);
|
|
4281
4299
|
const [maximumAmount, setMaximumAmount] = useReferredState(null);
|
|
@@ -4291,6 +4309,7 @@ const SwapForm = ({
|
|
|
4291
4309
|
const [isAmountZero, setIsAmountZero] = useState(_preservedAmount == null || String(_preservedAmount) === "0");
|
|
4292
4310
|
const [isLoading, setIsLoading] = useReferredState(false); // Whether the form is in the progress of loading some data (new rates, for example)
|
|
4293
4311
|
const [isFixedRate, setIsFixedRate] = useReferredState(null);
|
|
4312
|
+
const [isLastEditedReceiving, setIsLastEditedReceiving] = useState(false);
|
|
4294
4313
|
const [confirmButtonTo, setConfirmButtonTo] = useState(_composeConfirmButtonTo(sendingAssetTicker, receivingAssetTicker, _preservedAmount));
|
|
4295
4314
|
const [transactionFee, setTransactionFee] = useState();
|
|
4296
4315
|
const [balanceValid, setBalanceValid] = useState(true); // Whether the amount is less than total balance
|
|
@@ -4310,17 +4329,20 @@ const SwapForm = ({
|
|
|
4310
4329
|
const recalculationDelayOnTyping = 1000;
|
|
4311
4330
|
const isAddressFieldEnabled = !_formHasBalance;
|
|
4312
4331
|
const displayRateSelector = !_formHasBalance;
|
|
4313
|
-
const recipientAddressExtraIdName = _getExtraIdNameByTicker(receivingAssetTicker);
|
|
4314
|
-
const refundAddressExtraIdName = _getExtraIdNameByTicker(sendingAssetTicker);
|
|
4315
4332
|
const handleSendAssetAmountChange = amount => {
|
|
4333
|
+
setIsLastEditedReceiving(false);
|
|
4334
|
+
const receiveAmount = AmountUtils.trim(BigNumber(amount).times(swapRate), _receivingAssetDecimalCount);
|
|
4316
4335
|
if (amount != null && amount !== "") {
|
|
4317
|
-
|
|
4336
|
+
setReceiveAssetAmount(receiveAmount);
|
|
4337
|
+
setUpdateReceiveInputTo(receiveAmount);
|
|
4318
4338
|
} else {
|
|
4319
4339
|
setUpdateReceiveInputTo("");
|
|
4320
4340
|
}
|
|
4321
4341
|
setSendAssetAmount(amount);
|
|
4322
4342
|
};
|
|
4323
4343
|
const handleReceiveAssetAmountChange = amount => {
|
|
4344
|
+
setReceiveAssetAmount(amount);
|
|
4345
|
+
setIsLastEditedReceiving(true);
|
|
4324
4346
|
let sendAssetAmount = "";
|
|
4325
4347
|
if (amount != null && amount !== "") {
|
|
4326
4348
|
sendAssetAmount = AmountUtils.trim(BigNumber(amount).div(swapRate), _sendingAssetDecimalCount);
|
|
@@ -4425,7 +4447,7 @@ const SwapForm = ({
|
|
|
4425
4447
|
setIsSameCoins(false);
|
|
4426
4448
|
setIsPairSupported(true);
|
|
4427
4449
|
setIsSwapCalculated(false);
|
|
4428
|
-
const response = await _retrieveSwapDetails(sendingAssetTicker, receivingAssetTicker, amount, isSwapAll.current, (_isFixedRate$current = isFixedRate.current) != null ? _isFixedRate$current : IS_FIXED_BY_DEFAULT);
|
|
4450
|
+
const response = await _retrieveSwapDetails(sendingAssetTicker, receivingAssetTicker, amount, isSwapAll.current, (_isFixedRate$current = isFixedRate.current) != null ? _isFixedRate$current : IS_FIXED_BY_DEFAULT, isFixedRate.current ? isLastEditedReceiving : false);
|
|
4429
4451
|
if (!isSwapAll.current && String(amount) !== String(isForPreserved && sendAssetAmount.current == null ? _preservedAmount : sendAssetAmount.current)) {
|
|
4430
4452
|
// Means amount changed and we no more need to do this exact calculation
|
|
4431
4453
|
return;
|
|
@@ -4501,7 +4523,7 @@ const SwapForm = ({
|
|
|
4501
4523
|
};
|
|
4502
4524
|
const handleRateModeChanged = isFixed => {
|
|
4503
4525
|
setIsFixedRate(isFixed);
|
|
4504
|
-
requestDataRefresh(sendAssetAmount.current, true);
|
|
4526
|
+
requestDataRefresh(isLastEditedReceiving ? receiveAssetAmount.current : sendAssetAmount.current, true);
|
|
4505
4527
|
};
|
|
4506
4528
|
useEffect(() => {
|
|
4507
4529
|
if (isSwapAll.current === true) {
|
|
@@ -4511,6 +4533,10 @@ const SwapForm = ({
|
|
|
4511
4533
|
}
|
|
4512
4534
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4513
4535
|
}, [isSwapAll.current]);
|
|
4536
|
+
useEffect(() => {
|
|
4537
|
+
_onIsFixedChange(isFixedRate.current);
|
|
4538
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4539
|
+
}, [isFixedRate.current]);
|
|
4514
4540
|
useEffect(() => {
|
|
4515
4541
|
setConfirmButtonTo(_composeConfirmButtonTo(sendingAssetTicker, receivingAssetTicker, sendAssetAmount.current || _preservedAmount || null));
|
|
4516
4542
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -4520,7 +4546,7 @@ const SwapForm = ({
|
|
|
4520
4546
|
const isCurrentAmountNotZero = sendAssetAmount.current && !BigNumber("0").eq(sendAssetAmount.current);
|
|
4521
4547
|
const isPreservedAmountNotZero = _preservedAmount && !BigNumber("0").eq(_preservedAmount);
|
|
4522
4548
|
if (isCurrentAmountNotZero) {
|
|
4523
|
-
loadFullEstimation(sendAssetAmount.current);
|
|
4549
|
+
loadFullEstimation(isLastEditedReceiving ? receiveAssetAmount.current : sendAssetAmount.current);
|
|
4524
4550
|
} else if (isPreservedAmountNotZero) {
|
|
4525
4551
|
loadFullEstimation(_preservedAmount, true);
|
|
4526
4552
|
} else {
|
|
@@ -4554,14 +4580,14 @@ const SwapForm = ({
|
|
|
4554
4580
|
useEffect(() => {
|
|
4555
4581
|
(async () => {
|
|
4556
4582
|
if (!receivingAssetTicker) return;
|
|
4557
|
-
setIsRecipientAddressValid(recipientAddress.current === "" ? false : await _validateAddressByTicker(receivingAssetTicker, recipientAddress.current));
|
|
4583
|
+
setIsRecipientAddressValid(recipientAddress.current === "" ? false : await _validateAddressByTicker(receivingAssetTicker, recipientAddress.current, isFixedRate.current));
|
|
4558
4584
|
})();
|
|
4559
4585
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4560
4586
|
}, [recipientAddress.current, recipientAddressExtraId.current, receivingAssetTicker]);
|
|
4561
4587
|
useEffect(() => {
|
|
4562
4588
|
(async () => {
|
|
4563
4589
|
if (!sendingAssetTicker || !isRefundAddressRequired) return;
|
|
4564
|
-
setIsRefundAddressValid(refundAddress.current === "" ? false : await _validateAddressByTicker(sendingAssetTicker, refundAddress.current));
|
|
4590
|
+
setIsRefundAddressValid(refundAddress.current === "" ? false : await _validateAddressByTicker(sendingAssetTicker, refundAddress.current, isFixedRate.current));
|
|
4565
4591
|
})();
|
|
4566
4592
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4567
4593
|
}, [refundAddress.current, refundAddressExtraId.current, sendingAssetTicker, isRefundAddressRequired]);
|
|
@@ -4571,7 +4597,7 @@ const SwapForm = ({
|
|
|
4571
4597
|
if (readyToSwap) {
|
|
4572
4598
|
timeoutId = setTimeout(() => {
|
|
4573
4599
|
var _sendAssetAmount$curr;
|
|
4574
|
-
return requestDataRefresh((_sendAssetAmount$curr = sendAssetAmount.current) != null ? _sendAssetAmount$curr : _preservedAmount, true);
|
|
4600
|
+
return requestDataRefresh(isLastEditedReceiving ? receiveAssetAmount.current : (_sendAssetAmount$curr = sendAssetAmount.current) != null ? _sendAssetAmount$curr : _preservedAmount, true);
|
|
4575
4601
|
}, DETAIL_REFRESH_INTERVAL_MS);
|
|
4576
4602
|
setIdleDataUpdateTimeoutId(timeoutId);
|
|
4577
4603
|
} else {
|
|
@@ -4583,8 +4609,6 @@ const SwapForm = ({
|
|
|
4583
4609
|
};
|
|
4584
4610
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4585
4611
|
}, [readyToSwap]);
|
|
4586
|
-
|
|
4587
|
-
// TODO: [refactoring, critical] this code looks like a hack related to task_id=6e328d39063142b7b9fa01d497e616da
|
|
4588
4612
|
useEffect(() => {
|
|
4589
4613
|
if (_triggerDataUpdateResetting) {
|
|
4590
4614
|
clearTimeout(dataUpdateTimeoutId.current);
|
|
@@ -4594,8 +4618,6 @@ const SwapForm = ({
|
|
|
4594
4618
|
}
|
|
4595
4619
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4596
4620
|
}, [_triggerDataUpdateResetting]);
|
|
4597
|
-
|
|
4598
|
-
// Resets the passed "set value to" param to null, so it can be used multiple times with any value
|
|
4599
4621
|
useEffect(() => {
|
|
4600
4622
|
if (!!updateSendInputTo) setUpdateSendInputTo(null);
|
|
4601
4623
|
if (!!updateReceiveInputTo) setUpdateReceiveInputTo(null);
|
|
@@ -4614,13 +4636,12 @@ const SwapForm = ({
|
|
|
4614
4636
|
}
|
|
4615
4637
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4616
4638
|
}, [isLoading.current, swapAllButtonLoaderReSetter]);
|
|
4617
|
-
|
|
4618
|
-
// Handlers upon changing the asset amount
|
|
4619
4639
|
useEffect(() => {
|
|
4620
4640
|
setConfirmButtonTo(_composeConfirmButtonTo(sendingAssetTicker, receivingAssetTicker, sendAssetAmount.current));
|
|
4621
4641
|
if (sendAssetAmount.current == null) return;
|
|
4622
4642
|
let processingAmount = sendAssetAmount.current === "" ? "0" : sendAssetAmount.current;
|
|
4623
|
-
|
|
4643
|
+
let processingReceivingAmount = receiveAssetAmount.current === "" ? "0" : receiveAssetAmount.current;
|
|
4644
|
+
requestDataRefresh(isLastEditedReceiving ? processingReceivingAmount : processingAmount);
|
|
4624
4645
|
processMinMaxAmounts(processingAmount);
|
|
4625
4646
|
setIsAmountZero(BigNumber("0").eq(processingAmount));
|
|
4626
4647
|
setIsSwapCalculated(false);
|
|
@@ -4633,7 +4654,13 @@ const SwapForm = ({
|
|
|
4633
4654
|
linkText: !_formHasBalance ? "" : isSwapAll.current ? _translations.swapAllButtonTitles.cancel : _translations.swapAllButtonTitles.enable,
|
|
4634
4655
|
linkButtonLoader: true,
|
|
4635
4656
|
isLinkButtonDisabled: isLoading.current || sendingAssetTicker === receivingAssetTicker || BigNumber(sendingAssetBalance == null ? void 0 : sendingAssetBalance.assetAmount).eq(0)
|
|
4636
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
4657
|
+
}, displayRateSelector ? /*#__PURE__*/React.createElement("div", {
|
|
4658
|
+
className: s$9["swap-form-rate-selector"]
|
|
4659
|
+
}, /*#__PURE__*/React.createElement(RateSelector, {
|
|
4660
|
+
isFixed: (_isFixedRate$current2 = isFixedRate.current) != null ? _isFixedRate$current2 : IS_FIXED_BY_DEFAULT,
|
|
4661
|
+
setIsFixed: handleRateModeChanged,
|
|
4662
|
+
translations: _translations.rateSelector
|
|
4663
|
+
})) : "", /*#__PURE__*/React.createElement("div", {
|
|
4637
4664
|
className: s$9["swap-form-inputs"]
|
|
4638
4665
|
}, /*#__PURE__*/React.createElement(AmountInput, {
|
|
4639
4666
|
ticker: sendingAssetTicker,
|
|
@@ -4677,7 +4704,7 @@ const SwapForm = ({
|
|
|
4677
4704
|
assetIconProtocolSrc: _receivingAssetProtocolIconSrc,
|
|
4678
4705
|
fallbackAssetIconSrc: _fallBackAssetIconSrc,
|
|
4679
4706
|
disabled: isSwapAll.current || sendingAssetTicker === null || receivingAssetTicker === null,
|
|
4680
|
-
locked: !_formHasBalance,
|
|
4707
|
+
locked: !_formHasBalance && !isFixedRate.current,
|
|
4681
4708
|
handleCoinAmountChange: handleReceiveAssetAmountChange,
|
|
4682
4709
|
handleChangeAssetClick: handleChangeReceivingAssetClick,
|
|
4683
4710
|
updateAssetInputTo: updateReceiveInputTo,
|
|
@@ -4697,7 +4724,7 @@ const SwapForm = ({
|
|
|
4697
4724
|
className: s$9["swap-form-information-field"]
|
|
4698
4725
|
}, /*#__PURE__*/React.createElement("p", null, !isPairSupported ? _translations.informationBlock.pairNotAvailable : transactionFee && minimalAmountValid ? /*#__PURE__*/React.createElement(React.Fragment, null, _translations.informationBlock.transactionFee, /*#__PURE__*/React.createElement("span", null, AmountUtils.crypto(transactionFee == null ? void 0 : transactionFee.crypto, sendingAssetFeeCoinTickerPrintable)), (transactionFee == null ? void 0 : transactionFee.fiat) != null && (transactionFee == null ? void 0 : transactionFee.fiat) !== "" ? /*#__PURE__*/React.createElement("span", {
|
|
4699
4726
|
className: s$9["semi-transparent"]
|
|
4700
|
-
}, " ~ " + AmountUtils.fiat(transactionFee == null ? void 0 : transactionFee.fiat, _fiatCurrencyCode)) : "") : !isLoading.current && (isSwapCalculated || !minimalAmount.current && swapRate) ? /*#__PURE__*/React.createElement(React.Fragment, null, _translations.informationBlock.swapRate, /*#__PURE__*/React.createElement("span", null, AmountUtils.composeRateText(sendingAssetTickerPrintable, receivingAssetTickerPrintable, swapRate, _receivingAssetDecimalCount, (_isFixedRate$
|
|
4727
|
+
}, " ~ " + AmountUtils.fiat(transactionFee == null ? void 0 : transactionFee.fiat, _fiatCurrencyCode)) : "") : !isLoading.current && (isSwapCalculated || !minimalAmount.current && swapRate) ? /*#__PURE__*/React.createElement(React.Fragment, null, _translations.informationBlock.swapRate, /*#__PURE__*/React.createElement("span", null, AmountUtils.composeRateText(sendingAssetTickerPrintable, receivingAssetTickerPrintable, swapRate, _receivingAssetDecimalCount, (_isFixedRate$current3 = isFixedRate.current) != null ? _isFixedRate$current3 : IS_FIXED_BY_DEFAULT))) : minimalAmount.current || maximumAmount.current ? !maximumAmountValid && maximumAmount.current != null ? /*#__PURE__*/React.createElement(React.Fragment, null, _translations.informationBlock.maximumAmount, /*#__PURE__*/React.createElement("span", {
|
|
4701
4728
|
className: s$9["interactable"] + " " + s$9["red"],
|
|
4702
4729
|
onClick: isLoading.current ? () => {} : e => callHandlingErrors(handleMaximumAmountClick, e)
|
|
4703
4730
|
}, AmountUtils.crypto((_maximumAmount$curren4 = maximumAmount.current) == null ? void 0 : _maximumAmount$curren4.crypto, sendingAssetTickerPrintable)), ((_maximumAmount$curren5 = maximumAmount.current) == null ? void 0 : _maximumAmount$curren5.fiat) != null && ((_maximumAmount$curren6 = maximumAmount.current) == null ? void 0 : _maximumAmount$curren6.fiat) !== "" ? /*#__PURE__*/React.createElement("span", {
|
|
@@ -4718,7 +4745,7 @@ const SwapForm = ({
|
|
|
4718
4745
|
adaptiveHeight: true,
|
|
4719
4746
|
errorEncountered: recipientAddress.current !== "" && !isRecipientAddressValid.current
|
|
4720
4747
|
})), isHydrated && recipientAddressExtraIdName ? /*#__PURE__*/React.createElement(TitleBox, {
|
|
4721
|
-
title:
|
|
4748
|
+
title: _translations.addressFields.receivingAddressExtraIdTitle,
|
|
4722
4749
|
titleNoticeText: _translations.addressFields.receivingAddressExtraIdNotice,
|
|
4723
4750
|
titleNoticePosition: TOOLTIP_POSITIONS.TOP_LEFT
|
|
4724
4751
|
}, /*#__PURE__*/React.createElement(Textarea, {
|
|
@@ -4736,7 +4763,7 @@ const SwapForm = ({
|
|
|
4736
4763
|
adaptiveHeight: true,
|
|
4737
4764
|
errorEncountered: refundAddress.current !== "" && !isRefundAddressValid.current
|
|
4738
4765
|
})), refundAddressExtraIdName ? /*#__PURE__*/React.createElement(TitleBox, {
|
|
4739
|
-
title:
|
|
4766
|
+
title: _translations.addressFields.refundAddressExtraIdTitle,
|
|
4740
4767
|
titleNoticeText: _translations.addressFields.refundAddressExtraIdNotice,
|
|
4741
4768
|
titleNoticePosition: TOOLTIP_POSITIONS.TOP_LEFT
|
|
4742
4769
|
}, /*#__PURE__*/React.createElement(Textarea, {
|
|
@@ -4745,13 +4772,7 @@ const SwapForm = ({
|
|
|
4745
4772
|
value: refundAddressExtraId.current,
|
|
4746
4773
|
adaptiveHeight: true,
|
|
4747
4774
|
placeholder: _translations.addressFields.extraIdPlaceholder
|
|
4748
|
-
})) : null) : null) : null,
|
|
4749
|
-
className: s$9["swap-form-rate-selector"]
|
|
4750
|
-
}, /*#__PURE__*/React.createElement(RateSelector, {
|
|
4751
|
-
isFixed: (_isFixedRate$current3 = isFixedRate.current) != null ? _isFixedRate$current3 : IS_FIXED_BY_DEFAULT,
|
|
4752
|
-
setIsFixed: !isLoading.current ? handleRateModeChanged : () => {},
|
|
4753
|
-
translations: _translations.rateSelector
|
|
4754
|
-
})) : "", validationContent ? /*#__PURE__*/React.createElement("div", {
|
|
4775
|
+
})) : null) : null) : null, validationContent ? /*#__PURE__*/React.createElement("div", {
|
|
4755
4776
|
className: s$9["swap-form-validation-text"]
|
|
4756
4777
|
}, /*#__PURE__*/React.createElement(Validation, {
|
|
4757
4778
|
text: validationContent
|
|
@@ -4771,7 +4792,7 @@ const SwapForm = ({
|
|
|
4771
4792
|
size: "lg",
|
|
4772
4793
|
mode: "primary",
|
|
4773
4794
|
content: _translations.confirmButtonText,
|
|
4774
|
-
onClick: resetButtonLoader => _handleConfirmButtonClick(resetButtonLoader, setValidationContent, setBalanceValid, setMinimalAmountValid, setMaximumAmountValid, setIsPairSupported, setIsSameCoins, recipientAddress.current, recipientAddressExtraId.current, refundAddress.current, refundAddressExtraId.current),
|
|
4795
|
+
onClick: resetButtonLoader => _handleConfirmButtonClick(resetButtonLoader, setValidationContent, setBalanceValid, setMinimalAmountValid, setMaximumAmountValid, setIsPairSupported, setIsSameCoins, recipientAddress.current, recipientAddressExtraId.current, refundAddress.current, refundAddressExtraId.current, isLastEditedReceiving),
|
|
4775
4796
|
fullWidthOnMobiles: true,
|
|
4776
4797
|
isDisabled: !readyToSwap,
|
|
4777
4798
|
to: _formHasBalance ? "" : confirmButtonTo,
|
|
@@ -4816,7 +4837,12 @@ SwapForm.propTypes = {
|
|
|
4816
4837
|
fiatCurrencyCode: PropTypes.oneOfType([PropTypes.string, null]),
|
|
4817
4838
|
fiatCurrencyDecimals: PropTypes.oneOfType([PropTypes.number, null]),
|
|
4818
4839
|
formHasFiat: PropTypes.bool,
|
|
4840
|
+
termsOfUseUrl: PropTypes.oneOfType([PropTypes.string, null]),
|
|
4841
|
+
privacyPolicyUrl: PropTypes.oneOfType([PropTypes.string, null]),
|
|
4842
|
+
recipientAddressExtraIdName: PropTypes.string,
|
|
4843
|
+
refundAddressExtraIdName: PropTypes.string,
|
|
4819
4844
|
translations: PropTypes.object,
|
|
4845
|
+
validateAddressByTicker: PropTypes.func,
|
|
4820
4846
|
swapSeparatorIconSrc: PropTypes.string.isRequired,
|
|
4821
4847
|
swapButtonAlwaysActive: PropTypes.bool
|
|
4822
4848
|
};
|
|
@@ -4843,6 +4869,9 @@ SwapForm.defaultProps = {
|
|
|
4843
4869
|
fiatCurrencyCode: null,
|
|
4844
4870
|
fiatCurrencyDecimals: null,
|
|
4845
4871
|
formHasFiat: true,
|
|
4872
|
+
termsOfUseUrl: null,
|
|
4873
|
+
privacyPolicyUrl: null,
|
|
4874
|
+
validateAddressByTicker: ticker => false,
|
|
4846
4875
|
swapButtonAlwaysActive: false
|
|
4847
4876
|
};
|
|
4848
4877
|
|
|
@@ -4865,7 +4894,21 @@ async function generateQrAndShowInCanvas(encodingString) {
|
|
|
4865
4894
|
|
|
4866
4895
|
var s$6 = {"container":"_cTbW4","m-0":"_pa1z9","p-0":"_JFpOp","m-1":"_iRmOW","p-1":"_0sPGn","m-2":"_cX5Pd","p-2":"_2cKLW","m-3":"_lsOKS","p-3":"_MDp97","m-4":"_tiugy","p-4":"_lcNdz","m-5":"_ph3Rl","p-5":"_8Oxt6","m-6":"_LQvZy","p-6":"_RqY7F","m-7":"_K6wVB","p-7":"_aqQmY","m-8":"_AvgKS","p-8":"_-THq-","m-9":"_fLxYO","p-9":"_wNjdw","m-10":"_CVvN9","p-10":"_W0zcC","ml-0":"_lOxDW","pl-0":"_AZ4Gk","ml-1":"_PfYJJ","pl-1":"_ha7hP","ml-2":"_8HztG","pl-2":"_SB-3g","ml-3":"_udBJe","pl-3":"_EYbrF","ml-4":"_zSB90","pl-4":"_bGSY-","ml-5":"_vCg0l","pl-5":"_-hUSk","ml-6":"_wpvsa","pl-6":"_Po4yI","ml-7":"_Rv-mI","pl-7":"_rHVBB","ml-8":"_zYMBf","pl-8":"_BSAmk","ml-9":"_KE07p","pl-9":"_Bhlol","ml-10":"_iG9RV","pl-10":"_syE5i","mr-0":"_Z0qEx","pr-0":"_lV0Ms","mr-1":"_gO4IU","pr-1":"_CvRZh","mr-2":"_xy-oI","pr-2":"_vihQM","mr-3":"_eJ7bJ","pr-3":"_bmsh0","mr-4":"_EoFmR","pr-4":"_fVbSK","mr-5":"_tdfPe","pr-5":"_MNash","mr-6":"_haTqx","pr-6":"_YIf0P","mr-7":"_pooWd","pr-7":"_7MZOB","mr-8":"_bS7iD","pr-8":"_JRieo","mr-9":"_f6Phu","pr-9":"_mlqUy","mr-10":"_PPXXJ","pr-10":"_abKOE","mt-0":"_ItCpw","pt-0":"_zpY0G","mt-1":"_8TETK","pt-1":"_ANVw2","mt-2":"_s2Ox7","pt-2":"_L2yLo","mt-3":"_e2KDJ","pt-3":"_QfoJy","mt-4":"_O-rrM","pt-4":"_2USiC","mt-5":"_7Kzdb","pt-5":"_l3KrZ","mt-6":"_vgOok","pt-6":"_ng-zC","mt-7":"_nTMsZ","pt-7":"_KGp6z","mt-8":"_XANFt","pt-8":"_o3eiw","mt-9":"_l3H4r","pt-9":"_CRSXn","mt-10":"_ftQLu","pt-10":"_ikh2T","mb-0":"_jg4Jh","pb-0":"_sEOhP","mb-1":"_A9pLc","pb-1":"_O3GpB","mb-2":"_Ko-ls","pb-2":"_Nh0Vh","mb-3":"_APbRY","pb-3":"_tWmjY","mb-4":"_XUlFk","pb-4":"_ZvsvW","mb-5":"_n5nhM","pb-5":"_-tSIX","mb-6":"_QtZDL","pb-6":"_-39t0","mb-7":"_D0Dpl","pb-7":"_45Xmr","mb-8":"_GqsvX","pb-8":"_6CQop","mb-9":"_Z4Ivt","pb-9":"_veodh","mb-10":"_L3rOe","pb-10":"_YRD2e","mx-0":"_bzM7J","px-0":"_8ogz0","mx-1":"_XyVmJ","px-1":"_X9KHo","mx-2":"_R6tXp","px-2":"_Zja9K","mx-3":"_vdTzJ","px-3":"_9O9dG","mx-4":"_mcsEY","px-4":"_HuOg7","mx-5":"_Q96D3","px-5":"_gwh60","mx-6":"_Tli0m","px-6":"_znyER","mx-7":"_WNYMW","px-7":"_r1il4","mx-8":"_vMRfR","px-8":"_SYdPJ","mx-9":"_3mTwX","px-9":"_XqzX6","mx-10":"_ZAjnm","px-10":"_vYiab","my-0":"_DTi5m","py-0":"_NhBC-","my-1":"_lYPq3","py-1":"_LsZYc","my-2":"_ie-4q","py-2":"_-8kuS","my-3":"_PcwSW","py-3":"_9SVW-","my-4":"_HM-DC","py-4":"_cBLeY","my-5":"_iFfyB","py-5":"_cFMUa","my-6":"_uxMHp","py-6":"_OeII-","my-7":"_Y-LlZ","py-7":"_3ydPM","my-8":"_ifpwB","py-8":"_nPGL9","my-9":"_9XS-9","py-9":"_HRWBM","my-10":"_r-9W3","py-10":"_G5SRo","m-sm-0":"_XQBmN","p-sm-0":"_s9MHP","m-sm-1":"_e6dLK","p-sm-1":"_47tQJ","m-sm-2":"_Sq84f","p-sm-2":"_7T9oC","m-sm-3":"_6DK-C","p-sm-3":"_1mWwA","m-sm-4":"_jephJ","p-sm-4":"_8isN2","m-sm-5":"_Qj6AO","p-sm-5":"_dc7y9","m-sm-6":"_TPeN7","p-sm-6":"_2rG8f","m-sm-7":"_MfYlH","p-sm-7":"_6zVKJ","m-sm-8":"_QlZvU","p-sm-8":"_tx9ap","m-sm-9":"_rLz-E","p-sm-9":"_q06Mz","m-sm-10":"_3uSku","p-sm-10":"_Hc-5n","ml-sm-0":"_1UbDf","pl-sm-0":"_touOJ","ml-sm-1":"_1bN5I","pl-sm-1":"_bQHcU","ml-sm-2":"_i8oPe","pl-sm-2":"_Vtfxf","ml-sm-3":"_CBcsQ","pl-sm-3":"_SzmcT","ml-sm-4":"_6qcw8","pl-sm-4":"_vbSGm","ml-sm-5":"_n-zBA","pl-sm-5":"_Q9Q9i","ml-sm-6":"_2o7ve","pl-sm-6":"_UPjnI","ml-sm-7":"_NeEAG","pl-sm-7":"_ngtJ-","ml-sm-8":"_-Z2Hf","pl-sm-8":"_VQpYs","ml-sm-9":"_Sla3G","pl-sm-9":"_9WquO","ml-sm-10":"_kuYOg","pl-sm-10":"_mf-JK","mr-sm-0":"_D-am2","pr-sm-0":"_Z4QgH","mr-sm-1":"_JNB16","pr-sm-1":"_1nuYG","mr-sm-2":"_JSz3T","pr-sm-2":"_VIVsb","mr-sm-3":"_hf2wL","pr-sm-3":"_U27cs","mr-sm-4":"_fphSG","pr-sm-4":"_oan05","mr-sm-5":"_-q4eR","pr-sm-5":"_1z6Az","mr-sm-6":"_ex6FB","pr-sm-6":"_4B5XH","mr-sm-7":"_AhvSF","pr-sm-7":"_98YQI","mr-sm-8":"_ukGgp","pr-sm-8":"_i1l6d","mr-sm-9":"_R-dZ7","pr-sm-9":"_rq-kd","mr-sm-10":"_dVc4S","pr-sm-10":"_X-WfK","mt-sm-0":"_gYF9v","pt-sm-0":"_EA2Ki","mt-sm-1":"_B1K8h","pt-sm-1":"_ug-cq","mt-sm-2":"_SVe1c","pt-sm-2":"_kAto4","mt-sm-3":"_zvT2b","pt-sm-3":"_eaLRc","mt-sm-4":"_2dFgE","pt-sm-4":"_tweF5","mt-sm-5":"_KlgR2","pt-sm-5":"_BwPt9","mt-sm-6":"_FVlah","pt-sm-6":"_HZ-1-","mt-sm-7":"_-usQF","pt-sm-7":"_NvK9x","mt-sm-8":"_VjH2p","pt-sm-8":"_G1yH9","mt-sm-9":"_u4fMt","pt-sm-9":"_tw7GS","mt-sm-10":"_ymkT3","pt-sm-10":"_yJhls","mb-sm-0":"_lGkDj","pb-sm-0":"_HHf7Y","mb-sm-1":"_1I2Vs","pb-sm-1":"_i3RzV","mb-sm-2":"_BIWVv","pb-sm-2":"_4tkvJ","mb-sm-3":"_FwyAM","pb-sm-3":"_abS24","mb-sm-4":"_dqY3O","pb-sm-4":"_b--2r","mb-sm-5":"_I4bmd","pb-sm-5":"_tzrqS","mb-sm-6":"_pgsKQ","pb-sm-6":"_cpvrM","mb-sm-7":"_-Rr98","pb-sm-7":"_KBGRo","mb-sm-8":"_Zl7om","pb-sm-8":"_LWOz1","mb-sm-9":"_vo0F-","pb-sm-9":"_O2BEY","mb-sm-10":"_F-Lhx","pb-sm-10":"_6AZ0T","mx-sm-0":"_Y0X-J","px-sm-0":"_HcvBd","mx-sm-1":"_X3Fb3","px-sm-1":"_-JfYt","mx-sm-2":"_1x4W2","px-sm-2":"_qydtY","mx-sm-3":"_XUuRa","px-sm-3":"_eBVc0","mx-sm-4":"_63l4w","px-sm-4":"_k3SYD","mx-sm-5":"_5i7KK","px-sm-5":"_XDYJN","mx-sm-6":"_w8TjD","px-sm-6":"_5ol5V","mx-sm-7":"_Ot40y","px-sm-7":"_oV5-L","mx-sm-8":"_a8L2h","px-sm-8":"_wi0TE","mx-sm-9":"_v7kEh","px-sm-9":"_0-HhG","mx-sm-10":"_1okBb","px-sm-10":"_95N84","my-sm-0":"_lie2G","py-sm-0":"_ouOvB","my-sm-1":"_ohdC7","py-sm-1":"_aMnh9","my-sm-2":"_7xHoJ","py-sm-2":"_0ug55","my-sm-3":"_U2pB2","py-sm-3":"_4cGIX","my-sm-4":"_ZdqXJ","py-sm-4":"_WxW7n","my-sm-5":"_oVJaN","py-sm-5":"_AWbwx","my-sm-6":"_TBmmo","py-sm-6":"_KwGcy","my-sm-7":"_o3VYk","py-sm-7":"_ci94b","my-sm-8":"_GvBdM","py-sm-8":"_SIEyA","my-sm-9":"_sq-Bc","py-sm-9":"_RahCO","my-sm-10":"_Y22he","py-sm-10":"_zgeqj","m-lg-0":"_hfSrX","p-lg-0":"_pn8y2","m-lg-1":"_LfWT0","p-lg-1":"_QVlAL","m-lg-2":"_1icWB","p-lg-2":"_dl4cc","m-lg-3":"_CMQ3-","p-lg-3":"_zrs1N","m-lg-4":"_x0g6f","p-lg-4":"_Os9NS","m-lg-5":"_U9MlN","p-lg-5":"_jFWCr","m-lg-6":"_tLOlh","p-lg-6":"_42qu5","m-lg-7":"_Aro8c","p-lg-7":"_-uOsA","m-lg-8":"_Au56y","p-lg-8":"_2Oyz7","m-lg-9":"_Osk7K","p-lg-9":"_lXQ8x","m-lg-10":"_dllSC","p-lg-10":"_Tm67i","ml-lg-0":"_Znqug","pl-lg-0":"_454P-","ml-lg-1":"_kUu3E","pl-lg-1":"_w89ET","ml-lg-2":"_WmVQL","pl-lg-2":"_kR-EV","ml-lg-3":"_k5kWU","pl-lg-3":"_-Kb0x","ml-lg-4":"_KKFXp","pl-lg-4":"_-fkcR","ml-lg-5":"_yS-Tb","pl-lg-5":"_O-1Va","ml-lg-6":"_p-vq5","pl-lg-6":"_JMyQH","ml-lg-7":"_k7-ti","pl-lg-7":"_qEF3U","ml-lg-8":"_4Hiwo","pl-lg-8":"_i0YLE","ml-lg-9":"_E7-Mc","pl-lg-9":"_tR6Ca","ml-lg-10":"_XJWn-","pl-lg-10":"_lMFa-","mr-lg-0":"_-5re8","pr-lg-0":"_frmaO","mr-lg-1":"_V7Qjd","pr-lg-1":"_RfFWZ","mr-lg-2":"_zovH5","pr-lg-2":"_I0DtE","mr-lg-3":"_R1FBX","pr-lg-3":"_UGURA","mr-lg-4":"_A91bo","pr-lg-4":"_OC0rQ","mr-lg-5":"_UuInF","pr-lg-5":"_o6Z7k","mr-lg-6":"_2WcKB","pr-lg-6":"_hb6AF","mr-lg-7":"_7zOUh","pr-lg-7":"_ISeQS","mr-lg-8":"_XB-jo","pr-lg-8":"_WH43T","mr-lg-9":"_3Z5tO","pr-lg-9":"_KDtmP","mr-lg-10":"_YWWDg","pr-lg-10":"_3jxch","mt-lg-0":"_NpdpZ","pt-lg-0":"_G3CYP","mt-lg-1":"_rBTNB","pt-lg-1":"_oP3bL","mt-lg-2":"_7k4z7","pt-lg-2":"_W-jQH","mt-lg-3":"_g3B6v","pt-lg-3":"_VJ1Ff","mt-lg-4":"_KMnJN","pt-lg-4":"_ZD8Fa","mt-lg-5":"_b5cHq","pt-lg-5":"_dg5j0","mt-lg-6":"_-Cpwd","pt-lg-6":"_THSdM","mt-lg-7":"_Z3s1F","pt-lg-7":"_lYEdd","mt-lg-8":"_Aqcim","pt-lg-8":"_layfK","mt-lg-9":"_PODRQ","pt-lg-9":"_Jwmvr","mt-lg-10":"_oE-Es","pt-lg-10":"_iqMxI","mb-lg-0":"_0ouBF","pb-lg-0":"_pY5e-","mb-lg-1":"_6UkMv","pb-lg-1":"_rTQpv","mb-lg-2":"_QdezS","pb-lg-2":"_bKRvY","mb-lg-3":"_9kRgX","pb-lg-3":"_0rDFg","mb-lg-4":"_raL2S","pb-lg-4":"_g1goH","mb-lg-5":"_ZYlhK","pb-lg-5":"_xEjIS","mb-lg-6":"_2Bqs7","pb-lg-6":"_0-ck4","mb-lg-7":"_I-Q95","pb-lg-7":"_eBNa3","mb-lg-8":"_jynhW","pb-lg-8":"_N4X7K","mb-lg-9":"_V0gnd","pb-lg-9":"_30KI-","mb-lg-10":"_u7LJD","pb-lg-10":"_0rvxP","mx-lg-0":"_eJDxo","px-lg-0":"_foMtX","mx-lg-1":"_ahZeW","px-lg-1":"_1EJE3","mx-lg-2":"_VsP4e","px-lg-2":"_ZkXCK","mx-lg-3":"_IiuAl","px-lg-3":"_ALX0f","mx-lg-4":"_jPo2Y","px-lg-4":"_iJZSC","mx-lg-5":"_uAU0P","px-lg-5":"_z75CM","mx-lg-6":"_ZiYYZ","px-lg-6":"_-wNvd","mx-lg-7":"_3W1xI","px-lg-7":"_EGCYr","mx-lg-8":"_IKuC1","px-lg-8":"_CsKA7","mx-lg-9":"_y5S5T","px-lg-9":"_pSFpC","mx-lg-10":"_X8XlP","px-lg-10":"_UFRIe","my-lg-0":"_W1tUz","py-lg-0":"_jfJjF","my-lg-1":"_nIUQq","py-lg-1":"_iG2bO","my-lg-2":"_GCiW7","py-lg-2":"_f2j4U","my-lg-3":"_a1kEm","py-lg-3":"_vucDB","my-lg-4":"_6W-Ov","py-lg-4":"_2ktTG","my-lg-5":"_O4LLf","py-lg-5":"_Hcb15","my-lg-6":"_CSfmZ","py-lg-6":"_CPuhc","my-lg-7":"_3mH-z","py-lg-7":"_X6-mZ","my-lg-8":"_asmPC","py-lg-8":"_TTf47","my-lg-9":"_mC-i2","py-lg-9":"_iFSI7","my-lg-10":"_2BFm0","py-lg-10":"_bfNEm","m-md-0":"_-spRI","p-md-0":"_LK8-A","m-md-1":"_zjpam","p-md-1":"_wv8PD","m-md-2":"_06GpP","p-md-2":"_zdlRp","m-md-3":"_sNmTl","p-md-3":"_Yo2qI","m-md-4":"_eHYDi","p-md-4":"_b0S-l","m-md-5":"_U15c8","p-md-5":"_5tzlt","m-md-6":"_ZGL7n","p-md-6":"_5wNZQ","m-md-7":"_a0fPA","p-md-7":"_QQVBX","m-md-8":"_9-xcZ","p-md-8":"_RW3k1","m-md-9":"_rDAcs","p-md-9":"_k1xXG","m-md-10":"_RbEPp","p-md-10":"_hSl5q","ml-md-0":"_JaAa5","pl-md-0":"_eC-r7","ml-md-1":"_TiFFz","pl-md-1":"_tOXmv","ml-md-2":"_9mF2Z","pl-md-2":"_vwsKB","ml-md-3":"_15YPO","pl-md-3":"_XPkcU","ml-md-4":"_boTLY","pl-md-4":"_SFsKJ","ml-md-5":"_3axKI","pl-md-5":"_D2sbk","ml-md-6":"_e7bnL","pl-md-6":"_NQ2Nm","ml-md-7":"_rBXtE","pl-md-7":"_NeI-O","ml-md-8":"_XwNPD","pl-md-8":"_SbqlX","ml-md-9":"_Y-58E","pl-md-9":"_6cNCb","ml-md-10":"_JX9Cq","pl-md-10":"_uEAJa","mr-md-0":"_Jx5kC","pr-md-0":"_9FxwM","mr-md-1":"_iy6Yx","pr-md-1":"_RTwZ-","mr-md-2":"_Sm2g4","pr-md-2":"_mZS-2","mr-md-3":"_xKF1D","pr-md-3":"_okrlw","mr-md-4":"_bSzPv","pr-md-4":"_lahnF","mr-md-5":"_p5D7E","pr-md-5":"_RYFzr","mr-md-6":"_7DOT6","pr-md-6":"_aOldY","mr-md-7":"_GfYE-","pr-md-7":"_DNhH5","mr-md-8":"_eW2PP","pr-md-8":"_fteCN","mr-md-9":"_dyAiH","pr-md-9":"_xabgi","mr-md-10":"_PHePp","pr-md-10":"_qoP00","mt-md-0":"_05YBn","pt-md-0":"_yrlcd","mt-md-1":"_yFl6Y","pt-md-1":"_6b-mC","mt-md-2":"_G7jGU","pt-md-2":"_6GZzc","mt-md-3":"_ufBby","pt-md-3":"_qbnV7","mt-md-4":"_q7LKH","pt-md-4":"_hJCP8","mt-md-5":"_qtf2d","pt-md-5":"_aRWST","mt-md-6":"_TeL7T","pt-md-6":"_ZNePu","mt-md-7":"_jl4lr","pt-md-7":"_IlTFc","mt-md-8":"_a24kO","pt-md-8":"_-zvRb","mt-md-9":"_WXX3L","pt-md-9":"_2EEJ4","mt-md-10":"_X18TD","pt-md-10":"_MVooa","mb-md-0":"_DHwvN","pb-md-0":"_Uw70J","mb-md-1":"_v4jX-","pb-md-1":"_gJHwB","mb-md-2":"_boWJw","pb-md-2":"_j5kJT","mb-md-3":"_IZI-P","pb-md-3":"_LGchh","mb-md-4":"_R0Ont","pb-md-4":"_HYfpq","mb-md-5":"_ized0","pb-md-5":"_vTIf8","mb-md-6":"_zWpdC","pb-md-6":"_WEEGo","mb-md-7":"_1f-FE","pb-md-7":"_kfQzs","mb-md-8":"_j2X9B","pb-md-8":"_yRenj","mb-md-9":"_vnyNi","pb-md-9":"_JoD-h","mb-md-10":"_M-UM-","pb-md-10":"_L6x5K","mx-md-0":"_Vb8-P","px-md-0":"_4oZZN","mx-md-1":"_x42Ry","px-md-1":"_nR54S","mx-md-2":"_sBxfn","px-md-2":"_316Hu","mx-md-3":"_Hlimc","px-md-3":"_xIOYB","mx-md-4":"_9mXFC","px-md-4":"_-Fr6a","mx-md-5":"_Iv-gL","px-md-5":"_BqRA8","mx-md-6":"_7KKoC","px-md-6":"_32kSW","mx-md-7":"_qDWiW","px-md-7":"_vFnpw","mx-md-8":"_W4giE","px-md-8":"_4xRbP","mx-md-9":"_27uMt","px-md-9":"_7JLvO","mx-md-10":"_WyzX-","px-md-10":"_rzIDq","my-md-0":"_V28a9","py-md-0":"_znJMr","my-md-1":"_-3O4g","py-md-1":"_20sBd","my-md-2":"_O-A1l","py-md-2":"_5QSZG","my-md-3":"_QzjlZ","py-md-3":"_MILKq","my-md-4":"_O6rPK","py-md-4":"_KG0dA","my-md-5":"_0OhYl","py-md-5":"_KvUZf","my-md-6":"_rpwnV","py-md-6":"_yesTR","my-md-7":"_-WMtU","py-md-7":"_Ozuan","my-md-8":"_1gsdT","py-md-8":"_Zaqjb","my-md-9":"_nBoFu","py-md-9":"_ATTX2","my-md-10":"_LmCyF","py-md-10":"_FRV8s","m-xl-0":"_vfL3y","p-xl-0":"_EAyFx","m-xl-1":"_9Ru5u","p-xl-1":"_F2FfD","m-xl-2":"_uZD3X","p-xl-2":"_X9oXS","m-xl-3":"_D4N3Z","p-xl-3":"_zDeYX","m-xl-4":"_yHbfy","p-xl-4":"_6BvXQ","m-xl-5":"_gxlNl","p-xl-5":"_pCCVG","m-xl-6":"_qya4B","p-xl-6":"_QvUyx","m-xl-7":"_eJCt5","p-xl-7":"_p6XPi","m-xl-8":"_0THjs","p-xl-8":"_cC5TI","m-xl-9":"_k0QDj","p-xl-9":"_zwxO-","m-xl-10":"_4W0VS","p-xl-10":"_Xqjzh","ml-xl-0":"_jV-29","pl-xl-0":"_yy22x","ml-xl-1":"_T5fSu","pl-xl-1":"_93-K3","ml-xl-2":"_3zBLT","pl-xl-2":"_zjoAh","ml-xl-3":"_fz6la","pl-xl-3":"_UyWvU","ml-xl-4":"_rWYaL","pl-xl-4":"_9bQv0","ml-xl-5":"_0sArB","pl-xl-5":"_7o4Af","ml-xl-6":"_Y2eGT","pl-xl-6":"_xWqqk","ml-xl-7":"_YKpXT","pl-xl-7":"_g80UK","ml-xl-8":"_4cajU","pl-xl-8":"_h9QHX","ml-xl-9":"_oOpVP","pl-xl-9":"_ZXrhV","ml-xl-10":"_WJTHf","pl-xl-10":"_IZnPI","mr-xl-0":"_TB1mj","pr-xl-0":"_E3W1c","mr-xl-1":"_8EyKO","pr-xl-1":"_eaU7V","mr-xl-2":"_aCAu-","pr-xl-2":"_Fpj5l","mr-xl-3":"_GsiAJ","pr-xl-3":"_w-FUl","mr-xl-4":"_WXA1T","pr-xl-4":"_DbO3B","mr-xl-5":"_RtwaI","pr-xl-5":"_nwxwr","mr-xl-6":"_w9wUn","pr-xl-6":"_RBEVT","mr-xl-7":"_h4yUW","pr-xl-7":"_yzODd","mr-xl-8":"_HGkda","pr-xl-8":"_NR7L2","mr-xl-9":"_DKcGP","pr-xl-9":"_vfynG","mr-xl-10":"_klfNs","pr-xl-10":"_Olvpu","mt-xl-0":"_orHon","pt-xl-0":"_pqwts","mt-xl-1":"_OH3oL","pt-xl-1":"_QKjE8","mt-xl-2":"_8D31l","pt-xl-2":"_1l79D","mt-xl-3":"_kzbfM","pt-xl-3":"_wT--w","mt-xl-4":"_r8VYm","pt-xl-4":"_DgPY3","mt-xl-5":"_LF4aG","pt-xl-5":"_vD44v","mt-xl-6":"_c4BLJ","pt-xl-6":"_ElVvf","mt-xl-7":"_GxjHg","pt-xl-7":"_230T2","mt-xl-8":"_aCStj","pt-xl-8":"_vCtDV","mt-xl-9":"_Bo25T","pt-xl-9":"_kKkav","mt-xl-10":"_koZP7","pt-xl-10":"_dsMYs","mb-xl-0":"_C-FbO","pb-xl-0":"_3Nq0y","mb-xl-1":"_XrrZu","pb-xl-1":"_bV14o","mb-xl-2":"_uMcoW","pb-xl-2":"_sreSu","mb-xl-3":"_LcyMS","pb-xl-3":"_tU2l3","mb-xl-4":"_-OT5O","pb-xl-4":"_9HkKs","mb-xl-5":"_bHipN","pb-xl-5":"_DPjem","mb-xl-6":"_hifEE","pb-xl-6":"_RIEji","mb-xl-7":"_Oa7hP","pb-xl-7":"_vzsdg","mb-xl-8":"_pkI29","pb-xl-8":"_0jC5o","mb-xl-9":"_H4C-y","pb-xl-9":"_E9bOZ","mb-xl-10":"_ZVWPI","pb-xl-10":"_-u5jh","mx-xl-0":"_zXDFY","px-xl-0":"_-1-bs","mx-xl-1":"_Tb7NK","px-xl-1":"_xsfgY","mx-xl-2":"_EIQON","px-xl-2":"_Yzt4Z","mx-xl-3":"_LT9ms","px-xl-3":"_jHgj2","mx-xl-4":"_2SbJZ","px-xl-4":"_V-Y3l","mx-xl-5":"_-G8hg","px-xl-5":"_eycX1","mx-xl-6":"_dDxDv","px-xl-6":"_TgE5t","mx-xl-7":"_9CKTr","px-xl-7":"_I-zZG","mx-xl-8":"_SyFyQ","px-xl-8":"_Hyq-2","mx-xl-9":"_LAJdn","px-xl-9":"_ng4Ed","mx-xl-10":"_lp88j","px-xl-10":"_vmD8P","my-xl-0":"_eMXwe","py-xl-0":"_aETwB","my-xl-1":"_dS2Zm","py-xl-1":"_pHxI3","my-xl-2":"_kPY2w","py-xl-2":"_sPtzJ","my-xl-3":"_g1gY4","py-xl-3":"_OUmMw","my-xl-4":"_mLo8K","py-xl-4":"_wkW-B","my-xl-5":"_6P91L","py-xl-5":"_i3OCk","my-xl-6":"_cqBd2","py-xl-6":"_fZ8e0","my-xl-7":"_saauK","py-xl-7":"_wrgof","my-xl-8":"_5m8Th","py-xl-8":"_tlMWT","my-xl-9":"_HxjEh","py-xl-9":"_l-MtD","my-xl-10":"_dJDVj","py-xl-10":"_uEjIR","background-shine":"_O8uMC","path":"_WiuLg","line":"_fS3dR","skeleton":"_Z4CzX","skeleton-animate":"_-W0Ni","skeleton-dark":"_IoNbr","skeleton-dark-animate":"_7W6h3","skeleton-transparent":"_l3AMk","skeleton-transparent-animate":"_r77sc","semi-transparent":"_ci4Xo","qr-code":"_VZ0dT","fill":"_hFE1l"};
|
|
4867
4896
|
|
|
4868
|
-
|
|
4897
|
+
/**
|
|
4898
|
+
* QrCode component renders a QR code for a provided crypto address.
|
|
4899
|
+
*
|
|
4900
|
+
* @component
|
|
4901
|
+
* @example
|
|
4902
|
+
* const address = "0x123456789abcdef";
|
|
4903
|
+
* const fill = true;
|
|
4904
|
+
* return <QrCode address={address} fill={fill} />;
|
|
4905
|
+
*
|
|
4906
|
+
* @param {Object} props - The props for the component.
|
|
4907
|
+
* @param {string} props.address - The crypto address to generate the QR code for.
|
|
4908
|
+
* @param {boolean} [props.fill=false] - If true, applies additional CSS class to fill the container.
|
|
4909
|
+
*
|
|
4910
|
+
* @returns {JSX.Element} A div containing the generated QR code.
|
|
4911
|
+
*/
|
|
4869
4912
|
const QrCode = ({
|
|
4870
4913
|
address,
|
|
4871
4914
|
fill: _fill = false
|
|
@@ -4892,7 +4935,8 @@ QrCode.propTypes = {
|
|
|
4892
4935
|
fill: PropTypes.bool
|
|
4893
4936
|
};
|
|
4894
4937
|
QrCode.defaultProps = {
|
|
4895
|
-
address: ""
|
|
4938
|
+
address: "",
|
|
4939
|
+
fill: false
|
|
4896
4940
|
};
|
|
4897
4941
|
|
|
4898
4942
|
var s$5 = {"container":"_NaTd2","m-0":"_YHORQ","p-0":"_vFwmg","m-1":"_XJaHq","p-1":"_hIM3t","m-2":"_WgBak","p-2":"_QbcpO","m-3":"_-S6sq","p-3":"_jOOQ0","m-4":"_znEJf","p-4":"_Lg8C3","m-5":"_qp5LK","p-5":"_5czqM","m-6":"_274as","p-6":"_Xl4AT","m-7":"_Zm2L-","p-7":"_apGWT","m-8":"_C94JK","p-8":"_-ZZwv","m-9":"_wCPNe","p-9":"_8AlLB","m-10":"_LkyIb","p-10":"_wmhyI","ml-0":"_X2MXW","pl-0":"_zLOyd","ml-1":"_Bt-i6","pl-1":"_btKpD","ml-2":"_4Bwl5","pl-2":"_pfI2U","ml-3":"_dkGsO","pl-3":"_Bxv71","ml-4":"_UwipE","pl-4":"_earg6","ml-5":"_F5beh","pl-5":"_0UFA4","ml-6":"_8JK7d","pl-6":"_D4Q-L","ml-7":"_xD22L","pl-7":"_x7e5C","ml-8":"_FHYzO","pl-8":"_pA0Gs","ml-9":"_beftM","pl-9":"_lygHM","ml-10":"_hxaQQ","pl-10":"_AQhiw","mr-0":"_FPd0G","pr-0":"_kzAQL","mr-1":"_3huZS","pr-1":"_QXzb1","mr-2":"_Rz58G","pr-2":"_yMW65","mr-3":"_MXmu7","pr-3":"_IDswm","mr-4":"_IcYbX","pr-4":"_x-YXe","mr-5":"_NYlLE","pr-5":"_4l555","mr-6":"_UjOdV","pr-6":"_SE5we","mr-7":"_AlzPK","pr-7":"_hUHaY","mr-8":"_-gsnW","pr-8":"_IP34z","mr-9":"_UmWyx","pr-9":"_MzrNl","mr-10":"_ds0Ix","pr-10":"_AYlq-","mt-0":"_7qyuy","pt-0":"_nIHOM","mt-1":"_6RqW-","pt-1":"_4-OC1","mt-2":"_rcUWP","pt-2":"_fkjUO","mt-3":"_S7R9D","pt-3":"_j5tAQ","mt-4":"_TUqA4","pt-4":"_vVsJ-","mt-5":"_sHshm","pt-5":"_B-zUI","mt-6":"_0cWsK","pt-6":"_9bfIn","mt-7":"_fjL9E","pt-7":"_NTUdY","mt-8":"_HasBT","pt-8":"_mVF0B","mt-9":"_-u5T1","pt-9":"_ExDUQ","mt-10":"_9pUY-","pt-10":"_eiVcd","mb-0":"_03MFB","pb-0":"_-KrHh","mb-1":"_wev0C","pb-1":"_wtVjK","mb-2":"_gprlv","pb-2":"_J2Q09","mb-3":"_RhXyK","pb-3":"_12ip-","mb-4":"_z5dvT","pb-4":"_Go5-i","mb-5":"_-KBHs","pb-5":"_E3y4V","mb-6":"_yaPh3","pb-6":"_tdi0b","mb-7":"_tv-DY","pb-7":"_fm9Cu","mb-8":"_oBOhs","pb-8":"_cplbD","mb-9":"_WLAwt","pb-9":"_Au3aP","mb-10":"_s2hC1","pb-10":"_L1xED","mx-0":"_AoX5Q","px-0":"_bNNCF","mx-1":"_h8MO1","px-1":"_AJV5c","mx-2":"_QS9LF","px-2":"_hjDVm","mx-3":"_s-SQj","px-3":"_NGiEN","mx-4":"_M6wbK","px-4":"_KCPtZ","mx-5":"_inpZ7","px-5":"_Fr1vd","mx-6":"_BZCXr","px-6":"_zX70b","mx-7":"_XS9X0","px-7":"_E-fbe","mx-8":"_1bVOE","px-8":"_q0UF1","mx-9":"_cWIFa","px-9":"_gJSuV","mx-10":"_wwZlY","px-10":"_eFX6M","my-0":"_jYkDW","py-0":"_ypkZR","my-1":"_1O4Zz","py-1":"_2yJ0B","my-2":"_s180c","py-2":"_-TKas","my-3":"_rbbHu","py-3":"_nEJt6","my-4":"_3X4XE","py-4":"_GLyG-","my-5":"_PPFYe","py-5":"_wj3wh","my-6":"_zxO-F","py-6":"_-Gh70","my-7":"_H7Lx-","py-7":"_ri-zp","my-8":"_kSsB4","py-8":"_DVbNR","my-9":"_VBCoh","py-9":"_7B8Mh","my-10":"_Bs8XQ","py-10":"_pwEBN","m-sm-0":"_oHFJU","p-sm-0":"_6Ukh0","m-sm-1":"_Etjc0","p-sm-1":"_pCMmU","m-sm-2":"_ERgH4","p-sm-2":"_gubJN","m-sm-3":"_3j0mZ","p-sm-3":"_h-278","m-sm-4":"_m25O0","p-sm-4":"_yM2Bk","m-sm-5":"_KR2He","p-sm-5":"_Q3d0A","m-sm-6":"_E1VMD","p-sm-6":"_uh277","m-sm-7":"_pDEm8","p-sm-7":"_efVXx","m-sm-8":"_PFrZ3","p-sm-8":"_qZLnl","m-sm-9":"_mvAgG","p-sm-9":"_F6MJe","m-sm-10":"_076H1","p-sm-10":"_zGVoi","ml-sm-0":"_ht3fQ","pl-sm-0":"_OOKlP","ml-sm-1":"_xyrlV","pl-sm-1":"_6N0PC","ml-sm-2":"_h9adY","pl-sm-2":"_QpEtQ","ml-sm-3":"_CD11L","pl-sm-3":"_PBl7w","ml-sm-4":"_Hfd1V","pl-sm-4":"_n-oVT","ml-sm-5":"_JTt3q","pl-sm-5":"_plbYR","ml-sm-6":"_6eXa4","pl-sm-6":"_UBe72","ml-sm-7":"_Uu42M","pl-sm-7":"_yxNHm","ml-sm-8":"_7ohP7","pl-sm-8":"_11foE","ml-sm-9":"_zRuRz","pl-sm-9":"_YisGl","ml-sm-10":"_Nc8nr","pl-sm-10":"_nyiix","mr-sm-0":"_AmWPq","pr-sm-0":"_6fYUi","mr-sm-1":"_mub2q","pr-sm-1":"_Vgj29","mr-sm-2":"_CIMnU","pr-sm-2":"_ot1oR","mr-sm-3":"_JCTye","pr-sm-3":"_vF9S2","mr-sm-4":"_DK3GL","pr-sm-4":"_xdAgD","mr-sm-5":"_WW9Gf","pr-sm-5":"_wVWX0","mr-sm-6":"_ObyBZ","pr-sm-6":"_QhcRY","mr-sm-7":"_LV5L8","pr-sm-7":"_Y5Gy0","mr-sm-8":"_5g6Dc","pr-sm-8":"_2AqT8","mr-sm-9":"_3sCFZ","pr-sm-9":"_1xGS-","mr-sm-10":"_qz1yf","pr-sm-10":"_JPmov","mt-sm-0":"_Th7pa","pt-sm-0":"_ClkMf","mt-sm-1":"_V27PW","pt-sm-1":"_mtTAL","mt-sm-2":"_Q09QK","pt-sm-2":"_1I3Gw","mt-sm-3":"_govQ3","pt-sm-3":"_tYeBV","mt-sm-4":"_EcCmu","pt-sm-4":"_XMDNY","mt-sm-5":"_PDuEt","pt-sm-5":"_6Vkzk","mt-sm-6":"_0YG19","pt-sm-6":"_2Cgli","mt-sm-7":"_-lWQN","pt-sm-7":"_cEzEZ","mt-sm-8":"_nGa33","pt-sm-8":"_-raau","mt-sm-9":"_PMq4L","pt-sm-9":"_w7zEF","mt-sm-10":"_ehNrF","pt-sm-10":"_jmaO2","mb-sm-0":"_RrFqz","pb-sm-0":"_12i4p","mb-sm-1":"_7Ahx0","pb-sm-1":"_flSBK","mb-sm-2":"_NB4sU","pb-sm-2":"_gPzKo","mb-sm-3":"_TV50u","pb-sm-3":"_bSZaB","mb-sm-4":"_eysFY","pb-sm-4":"_FteNR","mb-sm-5":"_EtHbQ","pb-sm-5":"_qTuR8","mb-sm-6":"_GB6FT","pb-sm-6":"_Py5nK","mb-sm-7":"_uIaBf","pb-sm-7":"_D2bHt","mb-sm-8":"_Q-avy","pb-sm-8":"_gsv-o","mb-sm-9":"_UG-gK","pb-sm-9":"_D9sNH","mb-sm-10":"_m2xUH","pb-sm-10":"_iQbrf","mx-sm-0":"_-L1Tf","px-sm-0":"_iKCny","mx-sm-1":"_75NUT","px-sm-1":"_QhF00","mx-sm-2":"_-LVWC","px-sm-2":"_Tvv1b","mx-sm-3":"_khdAw","px-sm-3":"_PZYyJ","mx-sm-4":"_OyZmA","px-sm-4":"_95e4A","mx-sm-5":"_Vnqmh","px-sm-5":"_eTlqy","mx-sm-6":"_XUY2U","px-sm-6":"_3EpGV","mx-sm-7":"_SHfGI","px-sm-7":"_eI7rR","mx-sm-8":"_zIL2L","px-sm-8":"_9saK-","mx-sm-9":"_H1Fzw","px-sm-9":"_kf1Hf","mx-sm-10":"_P8qDH","px-sm-10":"_gio52","my-sm-0":"_chaCt","py-sm-0":"_O7-z-","my-sm-1":"_LrTqG","py-sm-1":"_pHmaj","my-sm-2":"_oU92I","py-sm-2":"_Mnwns","my-sm-3":"_1C5A9","py-sm-3":"_ImF2o","my-sm-4":"_WbO9H","py-sm-4":"_Z1OmB","my-sm-5":"_EYXZu","py-sm-5":"_vYHEp","my-sm-6":"_g3MSP","py-sm-6":"_2NYDD","my-sm-7":"_2joeb","py-sm-7":"_qd50T","my-sm-8":"_VGpWm","py-sm-8":"_cwG11","my-sm-9":"_ekf8e","py-sm-9":"_cK4PR","my-sm-10":"_cc6Y3","py-sm-10":"_NDKAw","m-lg-0":"_iPRPm","p-lg-0":"_TWGN8","m-lg-1":"_Jb7vd","p-lg-1":"_sn9pN","m-lg-2":"_nqEiy","p-lg-2":"_Gy0Hb","m-lg-3":"_BY1ks","p-lg-3":"_8URKR","m-lg-4":"_2-3-j","p-lg-4":"_uGQk4","m-lg-5":"_-XWs9","p-lg-5":"_OnrIk","m-lg-6":"_qrdeX","p-lg-6":"_nMFGQ","m-lg-7":"_BRNYT","p-lg-7":"_3dEch","m-lg-8":"_MBNzK","p-lg-8":"_C-WZp","m-lg-9":"_dLTQ8","p-lg-9":"_w6ixh","m-lg-10":"_2jd3n","p-lg-10":"_2muU8","ml-lg-0":"_lUZMw","pl-lg-0":"_-KzSM","ml-lg-1":"_YMHZ-","pl-lg-1":"_gomUI","ml-lg-2":"_SL4B8","pl-lg-2":"_cJVO2","ml-lg-3":"_q1dRp","pl-lg-3":"_xwxkL","ml-lg-4":"_C0hXq","pl-lg-4":"_ikIn8","ml-lg-5":"_tgvFs","pl-lg-5":"_eHDg5","ml-lg-6":"_lTdC3","pl-lg-6":"_7HFwm","ml-lg-7":"_2faTD","pl-lg-7":"_jOAoH","ml-lg-8":"_deSOn","pl-lg-8":"_z9y5A","ml-lg-9":"_ws2he","pl-lg-9":"_ui5L7","ml-lg-10":"_oJN2I","pl-lg-10":"_6CRTE","mr-lg-0":"_d1x7e","pr-lg-0":"_reYgy","mr-lg-1":"_j4hAO","pr-lg-1":"_5f30G","mr-lg-2":"_liNod","pr-lg-2":"_IUuhb","mr-lg-3":"_V9TWD","pr-lg-3":"_rliGE","mr-lg-4":"_3z6mJ","pr-lg-4":"_Df6xY","mr-lg-5":"_Rd09K","pr-lg-5":"_cGcMj","mr-lg-6":"_Mwrny","pr-lg-6":"_KuKUQ","mr-lg-7":"_HR1SS","pr-lg-7":"_s2dUf","mr-lg-8":"_SAzax","pr-lg-8":"_cEuIZ","mr-lg-9":"_Ze5-9","pr-lg-9":"_JOVUS","mr-lg-10":"_Uwedj","pr-lg-10":"_ROhQj","mt-lg-0":"_Kjz26","pt-lg-0":"_6Z07U","mt-lg-1":"_aFxMX","pt-lg-1":"_KR6SN","mt-lg-2":"_5i7Rc","pt-lg-2":"_u9KBR","mt-lg-3":"_m5LsE","pt-lg-3":"_t6WGi","mt-lg-4":"_-bb51","pt-lg-4":"_cRc-3","mt-lg-5":"_bnTpD","pt-lg-5":"_hPBHM","mt-lg-6":"_bwpJA","pt-lg-6":"_PMDS2","mt-lg-7":"_hoXBi","pt-lg-7":"_8xjM4","mt-lg-8":"_gZ7--","pt-lg-8":"_BA6wE","mt-lg-9":"_21yv5","pt-lg-9":"_aWyCU","mt-lg-10":"_mGr43","pt-lg-10":"_cSkrF","mb-lg-0":"_WjmMC","pb-lg-0":"_Q1gA2","mb-lg-1":"_WkTBs","pb-lg-1":"_fvTua","mb-lg-2":"_vc-w4","pb-lg-2":"_5HHv6","mb-lg-3":"_l-4sg","pb-lg-3":"_g8uEK","mb-lg-4":"_lD2hM","pb-lg-4":"_3G1cG","mb-lg-5":"_OHyTI","pb-lg-5":"_KeAKX","mb-lg-6":"_c260B","pb-lg-6":"_Ndomr","mb-lg-7":"_BXB-e","pb-lg-7":"_dGq5C","mb-lg-8":"_4AUpv","pb-lg-8":"_npllZ","mb-lg-9":"_L9Rak","pb-lg-9":"_jt9k5","mb-lg-10":"_8RT15","pb-lg-10":"_wjycY","mx-lg-0":"_W0Be1","px-lg-0":"_4uVx8","mx-lg-1":"_i2L9f","px-lg-1":"_ZjJsm","mx-lg-2":"_ZcecZ","px-lg-2":"_hqNB-","mx-lg-3":"_jNUQn","px-lg-3":"_sHebC","mx-lg-4":"_YhUDD","px-lg-4":"_-84UO","mx-lg-5":"_Ph5qw","px-lg-5":"_NR3o7","mx-lg-6":"_9jTBk","px-lg-6":"_82ujL","mx-lg-7":"_IPpAN","px-lg-7":"_C-1sM","mx-lg-8":"_ZphvL","px-lg-8":"_HzdlK","mx-lg-9":"_X8kGx","px-lg-9":"_pXV5r","mx-lg-10":"_HzIMd","px-lg-10":"_u2L1o","my-lg-0":"_Gvgjh","py-lg-0":"_OgT1y","my-lg-1":"_u3Qyn","py-lg-1":"_taLyT","my-lg-2":"_Wy-mG","py-lg-2":"_qownY","my-lg-3":"_HI-Uz","py-lg-3":"_Q6C9n","my-lg-4":"_vOnhn","py-lg-4":"_SFYHT","my-lg-5":"_9BjMz","py-lg-5":"_8JklH","my-lg-6":"_EIbP6","py-lg-6":"_nW9wp","my-lg-7":"_zJIRo","py-lg-7":"_hPFAm","my-lg-8":"_fsnJO","py-lg-8":"_iCENv","my-lg-9":"_HnasH","py-lg-9":"_-hbdR","my-lg-10":"_X1Zxr","py-lg-10":"_H17sM","m-md-0":"_Ujtmy","p-md-0":"_49fa6","m-md-1":"_KbnrJ","p-md-1":"_yM5-R","m-md-2":"_-meNJ","p-md-2":"_Y4UvM","m-md-3":"_OwGHV","p-md-3":"_RBR9C","m-md-4":"_i-AVY","p-md-4":"_WwWmC","m-md-5":"_c1Qr0","p-md-5":"_A3U4m","m-md-6":"_GPcUJ","p-md-6":"_71YbI","m-md-7":"_ikQln","p-md-7":"_wvIwY","m-md-8":"_fT38W","p-md-8":"_9Yg2c","m-md-9":"_zBOP3","p-md-9":"_GFy-1","m-md-10":"_tYxAK","p-md-10":"_kjPhi","ml-md-0":"_quQF3","pl-md-0":"_-OzvZ","ml-md-1":"_wMPHV","pl-md-1":"_41XvH","ml-md-2":"_spwuT","pl-md-2":"_24nw7","ml-md-3":"_41odn","pl-md-3":"_yz4Tk","ml-md-4":"_-2vc6","pl-md-4":"_vvnDT","ml-md-5":"_54Ig3","pl-md-5":"_CG-dk","ml-md-6":"_iVeaz","pl-md-6":"_WXTU-","ml-md-7":"_Dh8xC","pl-md-7":"_kq23e","ml-md-8":"_BJ2fl","pl-md-8":"_MG9ww","ml-md-9":"_sQHE-","pl-md-9":"_6QT8u","ml-md-10":"_NyEZe","pl-md-10":"_ekmYg","mr-md-0":"_mTGTW","pr-md-0":"_hLgfO","mr-md-1":"_Rr3ZO","pr-md-1":"_9TkH0","mr-md-2":"_FdTOQ","pr-md-2":"_neJQM","mr-md-3":"_vBv00","pr-md-3":"_eQSPq","mr-md-4":"_yaN3k","pr-md-4":"_fAvoS","mr-md-5":"_IIII7","pr-md-5":"_NgVq0","mr-md-6":"_GpgeG","pr-md-6":"_xEVGa","mr-md-7":"_9gZpZ","pr-md-7":"_-hI7f","mr-md-8":"_U54Sx","pr-md-8":"_dMcIt","mr-md-9":"_znlEn","pr-md-9":"_2BEP4","mr-md-10":"_IJ0sH","pr-md-10":"_94GCu","mt-md-0":"_5Vn-b","pt-md-0":"_8qH0J","mt-md-1":"_81Va8","pt-md-1":"_qO6aN","mt-md-2":"_PHlw6","pt-md-2":"_mjoLe","mt-md-3":"_0l6tS","pt-md-3":"_GqIf0","mt-md-4":"_63JeO","pt-md-4":"_iETbw","mt-md-5":"_MefCn","pt-md-5":"_Jp-Or","mt-md-6":"_sP1nG","pt-md-6":"_x73S0","mt-md-7":"_DwVeG","pt-md-7":"_eCRBo","mt-md-8":"_1BuEh","pt-md-8":"_gLz6T","mt-md-9":"_TUu8p","pt-md-9":"_Od9Jg","mt-md-10":"_9xo0E","pt-md-10":"_3q9Qs","mb-md-0":"_q1N2O","pb-md-0":"_EfBmm","mb-md-1":"_e6vaB","pb-md-1":"_mPlV1","mb-md-2":"_UPkLS","pb-md-2":"_wx2ox","mb-md-3":"_L4Ru9","pb-md-3":"_U2POK","mb-md-4":"_8xBOI","pb-md-4":"_-E8B-","mb-md-5":"_W-iLG","pb-md-5":"_2QLo6","mb-md-6":"_xq6DM","pb-md-6":"_MJQbH","mb-md-7":"_23LK-","pb-md-7":"_Buv8D","mb-md-8":"_cLEvD","pb-md-8":"_wig0r","mb-md-9":"_zye4T","pb-md-9":"_XqA3E","mb-md-10":"_AHFVl","pb-md-10":"_FiJ-d","mx-md-0":"_iPAbb","px-md-0":"_OI0Hm","mx-md-1":"_9G4QU","px-md-1":"_it3Pu","mx-md-2":"_fWVT6","px-md-2":"_wLA22","mx-md-3":"_r3C2F","px-md-3":"_v1Lv8","mx-md-4":"_Voueh","px-md-4":"_b36iz","mx-md-5":"_As2Gw","px-md-5":"_dQbAe","mx-md-6":"_xcEqD","px-md-6":"_MrAbj","mx-md-7":"_eBuFO","px-md-7":"_xNr13","mx-md-8":"_QPZsY","px-md-8":"_8t2Px","mx-md-9":"_BAyIu","px-md-9":"_00pz1","mx-md-10":"_lO-A1","px-md-10":"_53BzA","my-md-0":"_lh08a","py-md-0":"_kBvO0","my-md-1":"_XTRn4","py-md-1":"_MO6dK","my-md-2":"_fHMgx","py-md-2":"_FXTLg","my-md-3":"_ffpT4","py-md-3":"_22-kw","my-md-4":"_FEg-m","py-md-4":"_ypkOx","my-md-5":"_R1AN7","py-md-5":"_DydJq","my-md-6":"_FXG1K","py-md-6":"_E0BJ-","my-md-7":"_x0N4A","py-md-7":"_WjdDu","my-md-8":"_KDLR1","py-md-8":"_y64sO","my-md-9":"_8eDO2","py-md-9":"_qquBK","my-md-10":"_EwNyz","py-md-10":"_N6I0i","m-xl-0":"_8P5t6","p-xl-0":"_ZpbeQ","m-xl-1":"_Dks6J","p-xl-1":"_mE8iF","m-xl-2":"_el9ru","p-xl-2":"_UTl4r","m-xl-3":"_azB2s","p-xl-3":"_gOS9v","m-xl-4":"_Slcp6","p-xl-4":"_lNxoS","m-xl-5":"_J-0LE","p-xl-5":"_iHe8I","m-xl-6":"_yZepR","p-xl-6":"_rbMpb","m-xl-7":"_-WhgU","p-xl-7":"_mjvu4","m-xl-8":"_1GOfJ","p-xl-8":"_sxTqQ","m-xl-9":"_I4D6b","p-xl-9":"_iVvvh","m-xl-10":"_wg39S","p-xl-10":"_GyDPP","ml-xl-0":"_6gsjS","pl-xl-0":"_JmRU5","ml-xl-1":"_v1VpM","pl-xl-1":"_DEQsB","ml-xl-2":"_9L1JA","pl-xl-2":"_ie1jJ","ml-xl-3":"_zpNcl","pl-xl-3":"_0SKlr","ml-xl-4":"_-REYo","pl-xl-4":"_2lS8e","ml-xl-5":"_2Na2F","pl-xl-5":"_-s-Fm","ml-xl-6":"_pJW1z","pl-xl-6":"_CKN-E","ml-xl-7":"_FgJs7","pl-xl-7":"_j0Erz","ml-xl-8":"_J7vMq","pl-xl-8":"_o2JEq","ml-xl-9":"_drfPx","pl-xl-9":"_jyscO","ml-xl-10":"_5tuQV","pl-xl-10":"_QqMj7","mr-xl-0":"_3s4H3","pr-xl-0":"_-g6oD","mr-xl-1":"_irt5W","pr-xl-1":"_cixdv","mr-xl-2":"_-WyU1","pr-xl-2":"_508yO","mr-xl-3":"_hcmRB","pr-xl-3":"_yv-S6","mr-xl-4":"_Azljg","pr-xl-4":"_iSmGO","mr-xl-5":"_ljdF7","pr-xl-5":"_ExPZ3","mr-xl-6":"_JnJB4","pr-xl-6":"_hqr45","mr-xl-7":"_QHl1W","pr-xl-7":"_NNYAu","mr-xl-8":"_Uvzse","pr-xl-8":"_iXiqD","mr-xl-9":"_7uOKO","pr-xl-9":"_kit7Z","mr-xl-10":"_wAqvW","pr-xl-10":"_6PFk0","mt-xl-0":"_sdtH-","pt-xl-0":"_NCcCs","mt-xl-1":"_DQicu","pt-xl-1":"_4ULM-","mt-xl-2":"_YDSc6","pt-xl-2":"_lIAG5","mt-xl-3":"_TfWVv","pt-xl-3":"_iSTeE","mt-xl-4":"_JM-Od","pt-xl-4":"_k5SO2","mt-xl-5":"_FQRS6","pt-xl-5":"_L0fB3","mt-xl-6":"_eX5qy","pt-xl-6":"_y6uWa","mt-xl-7":"_c2Kgp","pt-xl-7":"_NuKFH","mt-xl-8":"_sKUD0","pt-xl-8":"_SrcyS","mt-xl-9":"_zm1YI","pt-xl-9":"_tCb2k","mt-xl-10":"_5V3Ww","pt-xl-10":"_JI4CW","mb-xl-0":"_werGX","pb-xl-0":"_ElhJG","mb-xl-1":"_RvlfX","pb-xl-1":"_ByoQk","mb-xl-2":"_Be3gd","pb-xl-2":"_FoRlm","mb-xl-3":"_1z4eB","pb-xl-3":"_4mmGN","mb-xl-4":"_ktyWD","pb-xl-4":"_NDUC-","mb-xl-5":"_5vEIK","pb-xl-5":"_ZPRwH","mb-xl-6":"_yfnPa","pb-xl-6":"_u52jn","mb-xl-7":"_y1Puu","pb-xl-7":"_Dt-tw","mb-xl-8":"_uX6MD","pb-xl-8":"_EefsF","mb-xl-9":"_GM91N","pb-xl-9":"_6tOpa","mb-xl-10":"_d9w9L","pb-xl-10":"_qMAiq","mx-xl-0":"_r0ha6","px-xl-0":"_arjXu","mx-xl-1":"_lQe5Y","px-xl-1":"_aFAtc","mx-xl-2":"_qGnkl","px-xl-2":"_r2bDr","mx-xl-3":"_AKBiJ","px-xl-3":"_qidn1","mx-xl-4":"_Xndir","px-xl-4":"_mzK8z","mx-xl-5":"_vuKvl","px-xl-5":"_5eob9","mx-xl-6":"_6zjoG","px-xl-6":"_u2376","mx-xl-7":"_NomJg","px-xl-7":"_cpIVH","mx-xl-8":"_DIbHl","px-xl-8":"_sTwkl","mx-xl-9":"_LJhtb","px-xl-9":"_99ZRS","mx-xl-10":"_RyT0w","px-xl-10":"_NXPYf","my-xl-0":"_4mARD","py-xl-0":"_cZCg4","my-xl-1":"_s65h0","py-xl-1":"_h0IMr","my-xl-2":"_xJjZc","py-xl-2":"_ap-Wz","my-xl-3":"_-nrYV","py-xl-3":"_VoZny","my-xl-4":"_t29x5","py-xl-4":"_yt6Uh","my-xl-5":"_1GB5N","py-xl-5":"_Zfpi1","my-xl-6":"_Z9v80","py-xl-6":"_-Ymwb","my-xl-7":"_TPI94","py-xl-7":"_yDb9i","my-xl-8":"_PG7cx","py-xl-8":"_Au4Oz","my-xl-9":"_NGXXu","py-xl-9":"_q-tXb","my-xl-10":"_g63Xq","py-xl-10":"_dVrmW","background-shine":"_9FSCy","path":"_YSBJs","line":"_MGRy0","skeleton":"_uSX6q","skeleton-animate":"_1JImE","skeleton-dark":"_GoVkE","skeleton-dark-animate":"_W4Xm1","skeleton-transparent":"_miCCb","skeleton-transparent-animate":"_8nUtm","semi-transparent":"_TNpj-","first-line-text":"_IGz2I","wrap":"_eKd8P","break":"_mT5i4","full-text":"_PVKxC","shorted":"_wB5qV","horizontal":"_lqJz-","second-line-text":"_hdF64"};
|
|
@@ -7780,12 +7824,21 @@ class BaseSwapCreationInfo {
|
|
|
7780
7824
|
}
|
|
7781
7825
|
}
|
|
7782
7826
|
|
|
7827
|
+
// TODO: [refactoring, moderate] extract structure of _supportedCoins into model class
|
|
7783
7828
|
class SwapProvider {
|
|
7829
|
+
constructor(cache, customCoinBuilder = (coin, network) => null, useRestrictedCoinsSet = true) {
|
|
7830
|
+
this._supportedCoins = [];
|
|
7831
|
+
this._maxRateDigits = 20;
|
|
7832
|
+
this.useRestrictedCoinsSet = useRestrictedCoinsSet;
|
|
7833
|
+
this._customCoinBuilder = customCoinBuilder;
|
|
7834
|
+
this._cache = cache;
|
|
7835
|
+
this.isAggregator = false;
|
|
7836
|
+
}
|
|
7784
7837
|
/**
|
|
7785
7838
|
* @return {Promise<void>}
|
|
7786
7839
|
*/
|
|
7787
7840
|
async initialize() {
|
|
7788
|
-
|
|
7841
|
+
await this._fetchSupportedCurrenciesIfNeeded();
|
|
7789
7842
|
}
|
|
7790
7843
|
|
|
7791
7844
|
/**
|
|
@@ -7795,6 +7848,33 @@ class SwapProvider {
|
|
|
7795
7848
|
throw new Error("Not implemented in base");
|
|
7796
7849
|
}
|
|
7797
7850
|
|
|
7851
|
+
/**
|
|
7852
|
+
* This method sort internal list putting popular (as provider thinks) coins to the top.
|
|
7853
|
+
* 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.
|
|
7854
|
+
* @private
|
|
7855
|
+
*/
|
|
7856
|
+
_putPopularCoinsFirst() {
|
|
7857
|
+
this._supportedCoins.sort((i1, i2) => {
|
|
7858
|
+
if (i1.isPopular !== i2.isPopular) return i2.isPopular - i1.isPopular;
|
|
7859
|
+
return i1.coin.ticker.localeCompare(i2.coin.ticker);
|
|
7860
|
+
});
|
|
7861
|
+
}
|
|
7862
|
+
|
|
7863
|
+
/**
|
|
7864
|
+
* Should fill _supportedCoins with array of coins.
|
|
7865
|
+
* Coin construction rules:
|
|
7866
|
+
* 1. ticker should be CODEPROTOCOL_CODE e.g. USDTERC20
|
|
7867
|
+
* 2. name should not contain (PROTOCOL_CODE) or just PROTOCOL_CODe
|
|
7868
|
+
* 3. protocol should be null for coins major for their blockchains like BTC, ETH
|
|
7869
|
+
* 4. isPopular should be a number
|
|
7870
|
+
*
|
|
7871
|
+
* @return {Promise<void>}
|
|
7872
|
+
* @private
|
|
7873
|
+
*/
|
|
7874
|
+
async _fetchSupportedCurrenciesIfNeeded() {
|
|
7875
|
+
throw new Error("Not implemented in base - _fetchSupportedCurrenciesIfNeeded");
|
|
7876
|
+
}
|
|
7877
|
+
|
|
7798
7878
|
/**
|
|
7799
7879
|
* Retrieves all currencies supported by this swap provider.
|
|
7800
7880
|
* Returns one of SwapProvider.COMMON_ERRORS in case of processable fail.
|
|
@@ -7802,7 +7882,25 @@ class SwapProvider {
|
|
|
7802
7882
|
* @return {Promise<({ result: true, coins: Coin[] }|{ result: false, reason: string })>}
|
|
7803
7883
|
*/
|
|
7804
7884
|
async getAllSupportedCurrencies() {
|
|
7805
|
-
|
|
7885
|
+
const loggerSource = "getAllSupportedCurrencies";
|
|
7886
|
+
try {
|
|
7887
|
+
var _this$_supportedCoins;
|
|
7888
|
+
await this._fetchSupportedCurrenciesIfNeeded();
|
|
7889
|
+
Logger.log(`We have ${(_this$_supportedCoins = this._supportedCoins) == null ? void 0 : _this$_supportedCoins.length} supported coins returning`, loggerSource);
|
|
7890
|
+
return {
|
|
7891
|
+
result: true,
|
|
7892
|
+
coins: this._supportedCoins.map(item => item.coin)
|
|
7893
|
+
};
|
|
7894
|
+
} catch (e) {
|
|
7895
|
+
var _e$response;
|
|
7896
|
+
if ((e == null || (_e$response = e.response) == null ? void 0 : _e$response.status) === 429) {
|
|
7897
|
+
return {
|
|
7898
|
+
result: false,
|
|
7899
|
+
reason: SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
7900
|
+
};
|
|
7901
|
+
}
|
|
7902
|
+
improveAndRethrow(e, loggerSource);
|
|
7903
|
+
}
|
|
7806
7904
|
}
|
|
7807
7905
|
|
|
7808
7906
|
/**
|
|
@@ -7812,7 +7910,25 @@ class SwapProvider {
|
|
|
7812
7910
|
* @return {Promise<({ result: true, coins: Coin[] }|{ result: false, reason: string })>}
|
|
7813
7911
|
*/
|
|
7814
7912
|
async getDepositCurrencies() {
|
|
7815
|
-
|
|
7913
|
+
const loggerSource = "getDepositCurrencies";
|
|
7914
|
+
try {
|
|
7915
|
+
var _this$_supportedCoins2;
|
|
7916
|
+
await this._fetchSupportedCurrenciesIfNeeded();
|
|
7917
|
+
Logger.log(`We have ${(_this$_supportedCoins2 = this._supportedCoins) == null ? void 0 : _this$_supportedCoins2.length} supported coins, getting depositable`, loggerSource);
|
|
7918
|
+
return {
|
|
7919
|
+
result: true,
|
|
7920
|
+
coins: this._supportedCoins.filter(item => item.deposit).map(item => item.coin)
|
|
7921
|
+
};
|
|
7922
|
+
} catch (e) {
|
|
7923
|
+
var _e$response2;
|
|
7924
|
+
if ((e == null || (_e$response2 = e.response) == null ? void 0 : _e$response2.status) === 429) {
|
|
7925
|
+
return {
|
|
7926
|
+
result: false,
|
|
7927
|
+
reason: SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
7928
|
+
};
|
|
7929
|
+
}
|
|
7930
|
+
improveAndRethrow(e, loggerSource);
|
|
7931
|
+
}
|
|
7816
7932
|
}
|
|
7817
7933
|
|
|
7818
7934
|
/**
|
|
@@ -7823,17 +7939,52 @@ class SwapProvider {
|
|
|
7823
7939
|
* @return {Promise<({ result: true, coins: Coin[] }|{ result: false, reason: string })>}
|
|
7824
7940
|
*/
|
|
7825
7941
|
async getWithdrawalCurrencies(exceptCurrency = null) {
|
|
7826
|
-
|
|
7942
|
+
const loggerSource = "getWithdrawalCurrencies";
|
|
7943
|
+
try {
|
|
7944
|
+
var _this$_supportedCoins3;
|
|
7945
|
+
await this._fetchSupportedCurrenciesIfNeeded();
|
|
7946
|
+
Logger.log(`We have ${(_this$_supportedCoins3 = this._supportedCoins) == null ? void 0 : _this$_supportedCoins3.length} supported coins, getting withdrawable`, loggerSource);
|
|
7947
|
+
return {
|
|
7948
|
+
result: true,
|
|
7949
|
+
coins: this._supportedCoins.filter(item => {
|
|
7950
|
+
var _item$coin;
|
|
7951
|
+
return item.withdrawal && (!exceptCurrency || ((_item$coin = item.coin) == null ? void 0 : _item$coin.ticker) !== (exceptCurrency == null ? void 0 : exceptCurrency.ticker));
|
|
7952
|
+
}).map(item => item.coin)
|
|
7953
|
+
};
|
|
7954
|
+
} catch (e) {
|
|
7955
|
+
var _e$response3;
|
|
7956
|
+
if ((e == null || (_e$response3 = e.response) == null ? void 0 : _e$response3.status) === 429) {
|
|
7957
|
+
return {
|
|
7958
|
+
result: false,
|
|
7959
|
+
reason: SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
7960
|
+
};
|
|
7961
|
+
}
|
|
7962
|
+
improveAndRethrow(e, loggerSource);
|
|
7963
|
+
}
|
|
7827
7964
|
}
|
|
7828
7965
|
|
|
7829
7966
|
/**
|
|
7830
7967
|
* Retrieves URL for coin icon or fallback if not found.
|
|
7831
7968
|
*
|
|
7832
|
-
* @param
|
|
7969
|
+
* @param coinOrTicker {Coin|string} coin or rabbit-format of coin ticker
|
|
7833
7970
|
* @return {string}
|
|
7834
7971
|
*/
|
|
7835
|
-
getIconUrl(
|
|
7836
|
-
|
|
7972
|
+
getIconUrl(coinOrTicker) {
|
|
7973
|
+
const loggerSource = "getIconUrl";
|
|
7974
|
+
try {
|
|
7975
|
+
var _this$_supportedCoins5, _this$_supportedCoins6;
|
|
7976
|
+
let coin = coinOrTicker;
|
|
7977
|
+
if (!(coinOrTicker instanceof Coin)) {
|
|
7978
|
+
var _this$_supportedCoins4;
|
|
7979
|
+
coin = (_this$_supportedCoins4 = this._supportedCoins.find(i => i.coin.ticker === coinOrTicker)) == null ? void 0 : _this$_supportedCoins4.coin;
|
|
7980
|
+
}
|
|
7981
|
+
return (_this$_supportedCoins5 = (_this$_supportedCoins6 = this._supportedCoins.find(item => {
|
|
7982
|
+
var _item$coin2, _coin;
|
|
7983
|
+
return ((_item$coin2 = item.coin) == null ? void 0 : _item$coin2.ticker) === ((_coin = coin) == null ? void 0 : _coin.ticker);
|
|
7984
|
+
})) == null ? void 0 : _this$_supportedCoins6.iconURL) != null ? _this$_supportedCoins5 : FALLBACK_ASSET_ICON_URL;
|
|
7985
|
+
} catch (e) {
|
|
7986
|
+
improveAndRethrow(e, loggerSource);
|
|
7987
|
+
}
|
|
7837
7988
|
}
|
|
7838
7989
|
|
|
7839
7990
|
/**
|
|
@@ -7843,7 +7994,46 @@ class SwapProvider {
|
|
|
7843
7994
|
* @return {{result: true, rate: string}|{result: false}}
|
|
7844
7995
|
*/
|
|
7845
7996
|
async getCoinToUSDTRate(coin) {
|
|
7846
|
-
|
|
7997
|
+
const loggerSource = "getCoinToUSDTRate";
|
|
7998
|
+
try {
|
|
7999
|
+
var _this$_supportedCoins7;
|
|
8000
|
+
if (!coin) return null;
|
|
8001
|
+
await this._fetchSupportedCurrenciesIfNeeded();
|
|
8002
|
+
|
|
8003
|
+
// Using USDT TRC20 as usually fee in this network is smaller than ERC20 and this network is widely used for USDT
|
|
8004
|
+
const usdtTrc20 = (_this$_supportedCoins7 = this._supportedCoins.find(i => i.coin.ticker === "USDTTRC20")) == null ? void 0 : _this$_supportedCoins7.coin;
|
|
8005
|
+
if (!usdtTrc20) {
|
|
8006
|
+
return {
|
|
8007
|
+
result: false
|
|
8008
|
+
};
|
|
8009
|
+
}
|
|
8010
|
+
const cached = this._cache.get("swapspace_usdt_rate_" + coin.ticker);
|
|
8011
|
+
if (cached != null) {
|
|
8012
|
+
return {
|
|
8013
|
+
result: true,
|
|
8014
|
+
rate: cached
|
|
8015
|
+
};
|
|
8016
|
+
}
|
|
8017
|
+
Logger.log("Loading USDT->coin rate as not found in cache:", coin == null ? void 0 : coin.ticker);
|
|
8018
|
+
const result = await this.getSwapInfo(usdtTrc20, coin, "5000", false);
|
|
8019
|
+
if (!result.result) {
|
|
8020
|
+
return {
|
|
8021
|
+
result: false
|
|
8022
|
+
};
|
|
8023
|
+
}
|
|
8024
|
+
|
|
8025
|
+
// This calculation is not precise as we cannot recognize the actual fee and network fee. Just approximate.
|
|
8026
|
+
const standardSwapspaceFeeMultiplier = 1.004; // fee is usually 0.4%
|
|
8027
|
+
const rate = BigNumber(1).div(BigNumber(result.rate).times(standardSwapspaceFeeMultiplier)).toString();
|
|
8028
|
+
this._cache.put("swap_usdt_rate_" + coin.ticker, rate, 15 * 60000 // 15 minutes
|
|
8029
|
+
);
|
|
8030
|
+
return {
|
|
8031
|
+
result: true,
|
|
8032
|
+
rate: rate
|
|
8033
|
+
};
|
|
8034
|
+
} catch (e) {
|
|
8035
|
+
improveAndRethrow(e, loggerSource);
|
|
8036
|
+
}
|
|
7847
8037
|
}
|
|
7848
8038
|
|
|
7849
8039
|
/**
|
|
@@ -7858,6 +8048,7 @@ class SwapProvider {
|
|
|
7858
8048
|
* @param [fixed=false] {boolean|null} null means fixed or float doesn't matter
|
|
7859
8049
|
* @param [fromCoinToUsdRate=null] pass if you want to increase the min amount returned
|
|
7860
8050
|
* by provider with some fixed "insurance" amount to cover min amount fluctuations.
|
|
8051
|
+
* @param [amountIsToReceive=false] {boolean} whether the given amount is receiving amount. False means the amount is the sending amount.
|
|
7861
8052
|
* @return {Promise<({
|
|
7862
8053
|
* result: false,
|
|
7863
8054
|
* reason: string,
|
|
@@ -7876,7 +8067,7 @@ class SwapProvider {
|
|
|
7876
8067
|
* [rawSwapData]: Object
|
|
7877
8068
|
* })>}
|
|
7878
8069
|
*/
|
|
7879
|
-
async getSwapInfo(fromCoin, toCoin, amountCoins, fixed = false, fromCoinToUsdRate = null) {
|
|
8070
|
+
async getSwapInfo(fromCoin, toCoin, amountCoins, fixed = false, fromCoinToUsdRate = null, amountIsToReceive = false) {
|
|
7880
8071
|
throw new Error("Not implemented in base");
|
|
7881
8072
|
}
|
|
7882
8073
|
|
|
@@ -7893,6 +8084,7 @@ class SwapProvider {
|
|
|
7893
8084
|
* @param fixed {boolean}
|
|
7894
8085
|
* @param [toCurrencyExtraId=""] {string} optional extra ID
|
|
7895
8086
|
* @param [refundExtraId=""] {string} optional extra ID for refund address
|
|
8087
|
+
* @param [amountIsToReceive=false] {boolean} whether the given amount is receiving amount. False means the amount is the sending amount.
|
|
7896
8088
|
* @return {Promise<({
|
|
7897
8089
|
* result: true,
|
|
7898
8090
|
* swapId: string,
|
|
@@ -7911,7 +8103,7 @@ class SwapProvider {
|
|
|
7911
8103
|
* partner: string
|
|
7912
8104
|
* })>}
|
|
7913
8105
|
*/
|
|
7914
|
-
async createSwap(fromCoin, toCoin, amount, toAddress, refundAddress, rawSwapData, clientIpAddress, fixed, toCurrencyExtraId = "", refundExtraId = "") {
|
|
8106
|
+
async createSwap(fromCoin, toCoin, amount, toAddress, refundAddress, rawSwapData, clientIpAddress, fixed, toCurrencyExtraId = "", refundExtraId = "", amountIsToReceive = false) {
|
|
7915
8107
|
throw new Error("Not implemented in base");
|
|
7916
8108
|
}
|
|
7917
8109
|
|
|
@@ -7931,7 +8123,13 @@ class SwapProvider {
|
|
|
7931
8123
|
* @return {Coin|null}
|
|
7932
8124
|
*/
|
|
7933
8125
|
getCoinByTickerIfPresent(ticker) {
|
|
7934
|
-
|
|
8126
|
+
try {
|
|
8127
|
+
var _item$coin3;
|
|
8128
|
+
const item = this._supportedCoins.find(i => i.coin.ticker === ticker);
|
|
8129
|
+
return (_item$coin3 = item == null ? void 0 : item.coin) != null ? _item$coin3 : null;
|
|
8130
|
+
} catch (e) {
|
|
8131
|
+
improveAndRethrow(e, "getCoinByTickerIfPresent");
|
|
8132
|
+
}
|
|
7935
8133
|
}
|
|
7936
8134
|
|
|
7937
8135
|
/**
|
|
@@ -7940,7 +8138,21 @@ class SwapProvider {
|
|
|
7940
8138
|
* @return {boolean}
|
|
7941
8139
|
*/
|
|
7942
8140
|
isAddressValidForAsset(asset, address) {
|
|
7943
|
-
|
|
8141
|
+
try {
|
|
8142
|
+
const assetData = this._supportedCoins.find(i => {
|
|
8143
|
+
var _i$coin;
|
|
8144
|
+
return ((_i$coin = i.coin) == null ? void 0 : _i$coin.ticker) === (asset == null ? void 0 : asset.ticker);
|
|
8145
|
+
});
|
|
8146
|
+
if (assetData) {
|
|
8147
|
+
let corrected = assetData.validationRegexp.trim();
|
|
8148
|
+
corrected = corrected[0] === "/" ? corrected.slice(1) : corrected;
|
|
8149
|
+
corrected = corrected[corrected.length - 1] === "/" ? corrected.slice(0, corrected.length - 1) : corrected;
|
|
8150
|
+
return address.match(corrected) != null;
|
|
8151
|
+
}
|
|
8152
|
+
} catch (e) {
|
|
8153
|
+
Logger.logError(e, "isAddressValidForAsset");
|
|
8154
|
+
}
|
|
8155
|
+
return false;
|
|
7944
8156
|
}
|
|
7945
8157
|
|
|
7946
8158
|
/**
|
|
@@ -7948,7 +8160,42 @@ class SwapProvider {
|
|
|
7948
8160
|
* @return {string|null}
|
|
7949
8161
|
*/
|
|
7950
8162
|
getExtraIdNameIfPresent(asset) {
|
|
7951
|
-
|
|
8163
|
+
try {
|
|
8164
|
+
const assetData = this._supportedCoins.find(i => {
|
|
8165
|
+
var _i$coin2;
|
|
8166
|
+
return ((_i$coin2 = i.coin) == null ? void 0 : _i$coin2.ticker) === (asset == null ? void 0 : asset.ticker);
|
|
8167
|
+
});
|
|
8168
|
+
if (assetData != null && assetData.hasExtraId) {
|
|
8169
|
+
if ((assetData == null ? void 0 : assetData.extraIdName) == null || (assetData == null ? void 0 : assetData.extraIdName) === "") {
|
|
8170
|
+
// We return some default name if the extraIdName is empty
|
|
8171
|
+
return "ID";
|
|
8172
|
+
}
|
|
8173
|
+
return assetData == null ? void 0 : assetData.extraIdName;
|
|
8174
|
+
}
|
|
8175
|
+
return null;
|
|
8176
|
+
} catch (e) {
|
|
8177
|
+
improveAndRethrow(e, "getExtraIdNameIfPresent");
|
|
8178
|
+
}
|
|
8179
|
+
}
|
|
8180
|
+
removeProtocolNameFromCoinName(coinName, tickerPrintable, protocolName) {
|
|
8181
|
+
if (coinName) {
|
|
8182
|
+
const originalName = coinName;
|
|
8183
|
+
if (tickerPrintable) {
|
|
8184
|
+
coinName = coinName.replaceAll(new RegExp(`\\(${tickerPrintable}\\)`, "gi"), "");
|
|
8185
|
+
}
|
|
8186
|
+
if (protocolName) {
|
|
8187
|
+
coinName = coinName.replaceAll(new RegExp(`\\(${protocolName}\\)`, "gi"), "").replaceAll(new RegExp(`(?<!on) ${protocolName}$`, "gi"), "").replaceAll(new RegExp(`^${protocolName} `, "gi"), "").replaceAll(new RegExp(`(?<!on) ${protocolName} `, "gi"), " ");
|
|
8188
|
+
}
|
|
8189
|
+
coinName = coinName.replaceAll(/ +/g, " ").trim();
|
|
8190
|
+
const defaultNames = ["token", "network", "protocol", "coin", "mainnet", "chain", "project", "cash", "finance", "wrapped", "blockchain", "network"];
|
|
8191
|
+
const lowerCoinName = coinName.toLowerCase();
|
|
8192
|
+
const isBecameDefaultName = defaultNames.find(defName => lowerCoinName === defName || lowerCoinName === `the ${defName}`);
|
|
8193
|
+
if (coinName === "" || isBecameDefaultName) {
|
|
8194
|
+
// Rolling back to original name if our processing leads in empty name or one of the default words
|
|
8195
|
+
coinName = originalName;
|
|
8196
|
+
}
|
|
8197
|
+
}
|
|
8198
|
+
return coinName;
|
|
7952
8199
|
}
|
|
7953
8200
|
}
|
|
7954
8201
|
SwapProvider.COMMON_ERRORS = {
|
|
@@ -7966,129 +8213,33 @@ SwapProvider.CREATION_FAIL_REASONS = {
|
|
|
7966
8213
|
};
|
|
7967
8214
|
SwapProvider.SWAP_STATUSES = {
|
|
7968
8215
|
WAITING_FOR_PAYMENT: "waiting_for_payment",
|
|
7969
|
-
// public +
|
|
7970
8216
|
CONFIRMING: "confirming",
|
|
7971
8217
|
PAYMENT_RECEIVED: "payment_received",
|
|
7972
|
-
// public +
|
|
7973
8218
|
EXCHANGING: "exchanging",
|
|
7974
|
-
// session full // public +
|
|
7975
8219
|
COMPLETED: "completed",
|
|
7976
|
-
// session full // public +
|
|
7977
8220
|
REFUNDED: "refunded",
|
|
7978
|
-
// session full // public +
|
|
7979
8221
|
EXPIRED: "expired",
|
|
7980
|
-
|
|
7981
|
-
FAILED: "failed" // public +
|
|
8222
|
+
FAILED: "failed"
|
|
7982
8223
|
};
|
|
7983
8224
|
|
|
7984
8225
|
const BANNED_PARTNERS = ["stealthex", "changee", "coincraddle"];
|
|
7985
8226
|
class SwapspaceSwapProvider extends SwapProvider {
|
|
7986
8227
|
constructor(apiKeysProxyUrl, cache, customCoinBuilder = (coin, network) => null, useRestrictedCoinsSet = true) {
|
|
7987
|
-
super();
|
|
7988
|
-
this._supportedCoins = [];
|
|
8228
|
+
super(cache, customCoinBuilder, useRestrictedCoinsSet);
|
|
7989
8229
|
this._partners = [];
|
|
7990
|
-
this._URL = `${apiKeysProxyUrl}`;
|
|
7991
|
-
this.
|
|
7992
|
-
this.useRestrictedCoinsSet = useRestrictedCoinsSet;
|
|
7993
|
-
this._customCoinBuilder = customCoinBuilder;
|
|
7994
|
-
this._cache = cache;
|
|
8230
|
+
this._URL = `${apiKeysProxyUrl}/swapspace`;
|
|
8231
|
+
this.isAggregator = true;
|
|
7995
8232
|
}
|
|
7996
8233
|
getSwapCreationInfoTtlMs() {
|
|
7997
8234
|
/* Actually 2 minutes and only relevant for some partners, but we use it
|
|
7998
8235
|
* (and even a bit smaller value) for better consistency */
|
|
7999
8236
|
return 110000;
|
|
8000
8237
|
}
|
|
8001
|
-
async
|
|
8002
|
-
const loggerSource = "
|
|
8238
|
+
async _fetchSupportedCurrenciesIfNeeded() {
|
|
8239
|
+
const loggerSource = "_fetchSupportedCurrenciesIfNeeded";
|
|
8003
8240
|
try {
|
|
8004
8241
|
var _this$_supportedCoins;
|
|
8005
|
-
|
|
8006
|
-
Logger.log(`We have ${(_this$_supportedCoins = this._supportedCoins) == null ? void 0 : _this$_supportedCoins.length} supported coins, getting depositable`, loggerSource);
|
|
8007
|
-
return {
|
|
8008
|
-
result: true,
|
|
8009
|
-
coins: this._supportedCoins.filter(item => item.deposit).map(item => item.coin)
|
|
8010
|
-
};
|
|
8011
|
-
} catch (e) {
|
|
8012
|
-
var _e$response;
|
|
8013
|
-
if ((e == null || (_e$response = e.response) == null ? void 0 : _e$response.status) === 429) {
|
|
8014
|
-
return {
|
|
8015
|
-
result: false,
|
|
8016
|
-
reason: SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
8017
|
-
};
|
|
8018
|
-
}
|
|
8019
|
-
improveAndRethrow(e, loggerSource);
|
|
8020
|
-
}
|
|
8021
|
-
}
|
|
8022
|
-
async getAllSupportedCurrencies() {
|
|
8023
|
-
const loggerSource = "getAllSupportedCurrencies";
|
|
8024
|
-
try {
|
|
8025
|
-
var _this$_supportedCoins2;
|
|
8026
|
-
await this._fetchSupportedCurrenciesIfNeeded();
|
|
8027
|
-
Logger.log(`We have ${(_this$_supportedCoins2 = this._supportedCoins) == null ? void 0 : _this$_supportedCoins2.length} supported coins returning`, loggerSource);
|
|
8028
|
-
return {
|
|
8029
|
-
result: true,
|
|
8030
|
-
coins: this._supportedCoins.map(item => item.coin)
|
|
8031
|
-
};
|
|
8032
|
-
} catch (e) {
|
|
8033
|
-
var _e$response2;
|
|
8034
|
-
if ((e == null || (_e$response2 = e.response) == null ? void 0 : _e$response2.status) === 429) {
|
|
8035
|
-
return {
|
|
8036
|
-
result: false,
|
|
8037
|
-
reason: SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
8038
|
-
};
|
|
8039
|
-
}
|
|
8040
|
-
improveAndRethrow(e, loggerSource);
|
|
8041
|
-
}
|
|
8042
|
-
}
|
|
8043
|
-
async getWithdrawalCurrencies(exceptCurrency = null) {
|
|
8044
|
-
const loggerSource = "getWithdrawalCurrencies";
|
|
8045
|
-
try {
|
|
8046
|
-
var _this$_supportedCoins3;
|
|
8047
|
-
await this._fetchSupportedCurrenciesIfNeeded();
|
|
8048
|
-
Logger.log(`We have ${(_this$_supportedCoins3 = this._supportedCoins) == null ? void 0 : _this$_supportedCoins3.length} supported coins, getting withdrawable`, loggerSource);
|
|
8049
|
-
return {
|
|
8050
|
-
result: true,
|
|
8051
|
-
coins: this._supportedCoins.filter(item => {
|
|
8052
|
-
var _item$coin;
|
|
8053
|
-
return item.withdrawal && (!exceptCurrency || ((_item$coin = item.coin) == null ? void 0 : _item$coin.ticker) !== (exceptCurrency == null ? void 0 : exceptCurrency.ticker));
|
|
8054
|
-
}).map(item => item.coin)
|
|
8055
|
-
};
|
|
8056
|
-
} catch (e) {
|
|
8057
|
-
var _e$response3;
|
|
8058
|
-
if ((e == null || (_e$response3 = e.response) == null ? void 0 : _e$response3.status) === 429) {
|
|
8059
|
-
return {
|
|
8060
|
-
result: false,
|
|
8061
|
-
reason: SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
8062
|
-
};
|
|
8063
|
-
}
|
|
8064
|
-
improveAndRethrow(e, loggerSource);
|
|
8065
|
-
}
|
|
8066
|
-
}
|
|
8067
|
-
async initialize() {
|
|
8068
|
-
await this._fetchSupportedCurrenciesIfNeeded();
|
|
8069
|
-
}
|
|
8070
|
-
getIconUrl(coinOrTicker) {
|
|
8071
|
-
const loggerSource = "getIconUrl";
|
|
8072
|
-
try {
|
|
8073
|
-
var _this$_supportedCoins5, _this$_supportedCoins6;
|
|
8074
|
-
let coin = coinOrTicker;
|
|
8075
|
-
if (!(coinOrTicker instanceof Coin)) {
|
|
8076
|
-
var _this$_supportedCoins4;
|
|
8077
|
-
coin = (_this$_supportedCoins4 = this._supportedCoins.find(i => i.coin.ticker === coinOrTicker)) == null ? void 0 : _this$_supportedCoins4.coin;
|
|
8078
|
-
}
|
|
8079
|
-
return (_this$_supportedCoins5 = (_this$_supportedCoins6 = this._supportedCoins.find(item => {
|
|
8080
|
-
var _item$coin2, _coin;
|
|
8081
|
-
return ((_item$coin2 = item.coin) == null ? void 0 : _item$coin2.ticker) === ((_coin = coin) == null ? void 0 : _coin.ticker);
|
|
8082
|
-
})) == null ? void 0 : _this$_supportedCoins6.iconURL) != null ? _this$_supportedCoins5 : FALLBACK_ASSET_ICON_URL;
|
|
8083
|
-
} catch (e) {
|
|
8084
|
-
improveAndRethrow(e, loggerSource);
|
|
8085
|
-
}
|
|
8086
|
-
}
|
|
8087
|
-
async _fetchSupportedCurrenciesIfNeeded() {
|
|
8088
|
-
const loggerSource = "_fetchSupportedCurrenciesIfNeeded";
|
|
8089
|
-
try {
|
|
8090
|
-
var _this$_supportedCoins7;
|
|
8091
|
-
if (!((_this$_supportedCoins7 = this._supportedCoins) != null && _this$_supportedCoins7.length)) {
|
|
8242
|
+
if (!((_this$_supportedCoins = this._supportedCoins) != null && _this$_supportedCoins.length)) {
|
|
8092
8243
|
var _rawResponse$data, _rawResponse$data2;
|
|
8093
8244
|
const rawResponse = await axios.get(`${this._URL}/api/v2/currencies`);
|
|
8094
8245
|
Logger.log(`Retrieved ${rawResponse == null || (_rawResponse$data = rawResponse.data) == null ? void 0 : _rawResponse$data.length}`, loggerSource);
|
|
@@ -8097,7 +8248,6 @@ class SwapspaceSwapProvider extends SwapProvider {
|
|
|
8097
8248
|
this._supportedCoins = allowedCoins.map(item => {
|
|
8098
8249
|
let coin = this._customCoinBuilder(item.code, item.network);
|
|
8099
8250
|
if (!coin && !this.useRestrictedCoinsSet) {
|
|
8100
|
-
var _item$name;
|
|
8101
8251
|
/** Building coin object for coin that isn't supported OOB in Rabbit.
|
|
8102
8252
|
* We are doing this way to be able to use extended coins set for swaps.
|
|
8103
8253
|
* These temporary built coins are only for in-swap use, and we omit some usual
|
|
@@ -8111,11 +8261,7 @@ class SwapspaceSwapProvider extends SwapProvider {
|
|
|
8111
8261
|
/** Removing ticker and protocol name from coin name as we usually use them explicitly
|
|
8112
8262
|
* from coin object rather than counting on having it in the coin name itself.
|
|
8113
8263
|
* This processing is needed due to poor quality of swapspace coins names. */
|
|
8114
|
-
let name = (
|
|
8115
|
-
if (name === "") {
|
|
8116
|
-
// Rolling back to original name if our processing leads in empty name
|
|
8117
|
-
name = item.name;
|
|
8118
|
-
}
|
|
8264
|
+
let name = this.removeProtocolNameFromCoinName(item.name, code, network);
|
|
8119
8265
|
const ticker = `${code}${code === network ? "" : network}`;
|
|
8120
8266
|
const defaultDecimalPlacesForCoinNotSupportedOOB = 8;
|
|
8121
8267
|
const defaultMinConfirmationsForCoinNotSupportedOOB = 1;
|
|
@@ -8131,11 +8277,12 @@ class SwapspaceSwapProvider extends SwapProvider {
|
|
|
8131
8277
|
network: item.network,
|
|
8132
8278
|
hasExtraId: item.hasExtraId,
|
|
8133
8279
|
extraIdName: item.extraIdName,
|
|
8134
|
-
isPopular:
|
|
8280
|
+
isPopular: item.popular ? 1 : 0,
|
|
8135
8281
|
iconURL: item.icon ? `https://storage.swapspace.co${item.icon}` : FALLBACK_ASSET_ICON_URL,
|
|
8136
8282
|
deposit: (_item$deposit = item.deposit) != null ? _item$deposit : false,
|
|
8137
8283
|
withdrawal: (_item$withdrawal = item.withdrawal) != null ? _item$withdrawal : false,
|
|
8138
|
-
validationRegexp: (_item$validationRegex = item.validationRegexp) != null ? _item$validationRegex : null
|
|
8284
|
+
validationRegexp: (_item$validationRegex = item.validationRegexp) != null ? _item$validationRegex : null,
|
|
8285
|
+
isAvailable: true
|
|
8139
8286
|
};
|
|
8140
8287
|
}
|
|
8141
8288
|
return [];
|
|
@@ -8160,74 +8307,11 @@ class SwapspaceSwapProvider extends SwapProvider {
|
|
|
8160
8307
|
Logger.logError(e, loggerSource, "Failed to fetch partners list from swapspace");
|
|
8161
8308
|
}
|
|
8162
8309
|
}
|
|
8163
|
-
|
|
8164
|
-
/**
|
|
8165
|
-
* This method sort internal list putting popular (as swapspace thinks) coins to the top.
|
|
8166
|
-
* 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.
|
|
8167
|
-
* @private
|
|
8168
|
-
*/
|
|
8169
|
-
_putPopularCoinsFirst() {
|
|
8170
|
-
this._supportedCoins.sort((i1, i2) => {
|
|
8171
|
-
if (i1.isPopular && !i2.isPopular) return -1;
|
|
8172
|
-
if (i2.isPopular && !i1.isPopular) return 1;
|
|
8173
|
-
return i1.coin.ticker > i2.coin.ticker ? 1 : i1.coin.ticker < i2.coin.ticker ? -1 : 0;
|
|
8174
|
-
});
|
|
8175
|
-
}
|
|
8176
|
-
async getCoinToUSDTRate(coin) {
|
|
8177
|
-
const loggerSource = "getCoinToUSDTRate";
|
|
8178
|
-
try {
|
|
8179
|
-
var _this$_supportedCoins8;
|
|
8180
|
-
if (!coin) return null;
|
|
8181
|
-
await this._fetchSupportedCurrenciesIfNeeded();
|
|
8182
|
-
|
|
8183
|
-
// Using USDT TRC20 as usually fee in this network is smaller than ERC20 and this network is widely used for USDT
|
|
8184
|
-
const usdtTrc20 = (_this$_supportedCoins8 = this._supportedCoins.find(i => i.coin.ticker === "USDTTRC20")) == null ? void 0 : _this$_supportedCoins8.coin;
|
|
8185
|
-
if (!usdtTrc20) {
|
|
8186
|
-
return {
|
|
8187
|
-
result: false
|
|
8188
|
-
};
|
|
8189
|
-
}
|
|
8190
|
-
const cached = this._cache.get("swapspace_usdt_rate_" + coin.ticker);
|
|
8191
|
-
if (cached != null) {
|
|
8192
|
-
return {
|
|
8193
|
-
result: true,
|
|
8194
|
-
rate: cached
|
|
8195
|
-
};
|
|
8196
|
-
}
|
|
8197
|
-
Logger.log("Loading USDT->coin rate as not found in cache:", coin == null ? void 0 : coin.ticker);
|
|
8198
|
-
const result = await this.getSwapInfo(usdtTrc20, coin, "5000", false);
|
|
8199
|
-
if (!result.result) {
|
|
8200
|
-
return {
|
|
8201
|
-
result: false
|
|
8202
|
-
};
|
|
8203
|
-
}
|
|
8204
|
-
|
|
8205
|
-
// This calculation is not precise as we cannot recognize the actual fee and network fee. Just approximate.
|
|
8206
|
-
const standardSwapspaceFeeMultiplier = 1.004; // fee is usually 0.4%
|
|
8207
|
-
const rate = BigNumber(1).div(BigNumber(result.rate).times(standardSwapspaceFeeMultiplier)).toString();
|
|
8208
|
-
this._cache.put("swapspace_usdt_rate_" + coin.ticker, rate, 15 * 60000 // 15 minutes
|
|
8209
|
-
);
|
|
8210
|
-
return {
|
|
8211
|
-
result: true,
|
|
8212
|
-
rate: rate
|
|
8213
|
-
};
|
|
8214
|
-
} catch (e) {
|
|
8215
|
-
improveAndRethrow(e, loggerSource);
|
|
8216
|
-
}
|
|
8217
|
-
}
|
|
8218
|
-
getCoinByTickerIfPresent(ticker) {
|
|
8219
|
-
try {
|
|
8220
|
-
var _item$coin3;
|
|
8221
|
-
const item = this._supportedCoins.find(i => i.coin.ticker === ticker);
|
|
8222
|
-
return (_item$coin3 = item == null ? void 0 : item.coin) != null ? _item$coin3 : null;
|
|
8223
|
-
} catch (e) {
|
|
8224
|
-
improveAndRethrow(e, "getCoinByTickerIfPresent");
|
|
8225
|
-
}
|
|
8226
|
-
}
|
|
8227
|
-
async getSwapInfo(fromCoin, toCoin, amountCoins, fixed = false, fromCoinToUsdRate = null) {
|
|
8310
|
+
async getSwapInfo(fromCoin, toCoin, amountCoins, fixed = false, fromCoinToUsdRate = null, amountIsToReceive = false) {
|
|
8228
8311
|
const loggerSource = "getSwapInfo";
|
|
8229
8312
|
try {
|
|
8230
8313
|
var _response$data, _exchangesSupportingT;
|
|
8314
|
+
if (amountIsToReceive) throw new Error("Swapspace doesn't support exchanging to get the exact receiving amount");
|
|
8231
8315
|
if (!(fromCoin instanceof Coin) || !(toCoin instanceof Coin) || typeof amountCoins !== "string" || BigNumber(amountCoins).lt("0") || fixed !== null && typeof fixed !== "boolean") {
|
|
8232
8316
|
throw new Error(`Wrong input params: ${amountCoins} ${fromCoin.ticker} -> ${toCoin.ticker}, ${fromCoin instanceof Coin}, ${toCoin instanceof Coin}, ${typeof fixed} ${fixed}`);
|
|
8233
8317
|
}
|
|
@@ -8351,8 +8435,8 @@ class SwapspaceSwapProvider extends SwapProvider {
|
|
|
8351
8435
|
Logger.log(`Returning result ${safeStringify(result)}`, loggerSource);
|
|
8352
8436
|
return result;
|
|
8353
8437
|
} catch (e) {
|
|
8354
|
-
var _e$
|
|
8355
|
-
if ((e == null || (_e$
|
|
8438
|
+
var _e$response;
|
|
8439
|
+
if ((e == null || (_e$response = e.response) == null ? void 0 : _e$response.status) === 429) {
|
|
8356
8440
|
return {
|
|
8357
8441
|
result: false,
|
|
8358
8442
|
reason: SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
@@ -8362,10 +8446,11 @@ class SwapspaceSwapProvider extends SwapProvider {
|
|
|
8362
8446
|
improveAndRethrow(e, loggerSource);
|
|
8363
8447
|
}
|
|
8364
8448
|
}
|
|
8365
|
-
async createSwap(fromCoin, toCoin, amount, toAddress, refundAddress, rawSwapData, clientIpAddress, fixed, toCurrencyExtraId = "", refundExtraId = "") {
|
|
8449
|
+
async createSwap(fromCoin, toCoin, amount, toAddress, refundAddress, rawSwapData, clientIpAddress, fixed, toCurrencyExtraId = "", refundExtraId = "", amountIsToReceive = false) {
|
|
8366
8450
|
const loggerSource = "createSwap";
|
|
8367
8451
|
const partner = rawSwapData == null ? void 0 : rawSwapData.partner;
|
|
8368
8452
|
try {
|
|
8453
|
+
if (amountIsToReceive) throw new Error("Swapspace doesn't support exchanging to get the exact receiving amount");
|
|
8369
8454
|
if (!(fromCoin instanceof Coin) || !(toCoin instanceof Coin) || typeof amount !== "string" || typeof toAddress !== "string" || typeof refundAddress !== "string" || typeof clientIpAddress != "string" || typeof fixed != "boolean" || clientIpAddress.length === 0) {
|
|
8370
8455
|
throw new Error(`Invalid input: ${fromCoin} ${toCoin} ${amount} ${toAddress} ${refundAddress} ${clientIpAddress == null ? void 0 : clientIpAddress.length} ${fixed}`);
|
|
8371
8456
|
}
|
|
@@ -8425,15 +8510,15 @@ class SwapspaceSwapProvider extends SwapProvider {
|
|
|
8425
8510
|
Logger.log(errorMessage, loggerSource);
|
|
8426
8511
|
throw new Error(errorMessage);
|
|
8427
8512
|
} catch (e) {
|
|
8428
|
-
var _e$
|
|
8513
|
+
var _e$response2, _e$response3;
|
|
8429
8514
|
Logger.logError(e, loggerSource, `Failed to create swap. Error is: ${safeStringify(e)}`);
|
|
8430
8515
|
const composeFailResult = reason => ({
|
|
8431
8516
|
result: false,
|
|
8432
8517
|
reason: reason,
|
|
8433
8518
|
partner: partner
|
|
8434
8519
|
});
|
|
8435
|
-
const status = e == null || (_e$
|
|
8436
|
-
const data = e == null || (_e$
|
|
8520
|
+
const status = e == null || (_e$response2 = e.response) == null ? void 0 : _e$response2.status;
|
|
8521
|
+
const data = e == null || (_e$response3 = e.response) == null ? void 0 : _e$response3.data;
|
|
8437
8522
|
if (status === 429) {
|
|
8438
8523
|
Logger.log(`Returning fail - RPS limit exceeded ${data}`, loggerSource);
|
|
8439
8524
|
return composeFailResult(SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED);
|
|
@@ -8495,9 +8580,9 @@ class SwapspaceSwapProvider extends SwapProvider {
|
|
|
8495
8580
|
const wo404 = responses.flat();
|
|
8496
8581
|
Logger.log("All swaps RAW: " + JSON.stringify(wo404.map(r => r.data)), loggerSource);
|
|
8497
8582
|
const swaps = wo404.map(r => r.data).map((swap, index) => {
|
|
8498
|
-
var _this$
|
|
8499
|
-
const fromCoin = (_this$
|
|
8500
|
-
const toCoin = (_this$
|
|
8583
|
+
var _this$_supportedCoins2, _this$_supportedCoins3, _swap$from$extraId, _swap$to$extraId, _swap$refundExtraId;
|
|
8584
|
+
const fromCoin = (_this$_supportedCoins2 = this._supportedCoins.find(i => i.code === swap.from.code && i.network === swap.from.network)) == null ? void 0 : _this$_supportedCoins2.coin;
|
|
8585
|
+
const toCoin = (_this$_supportedCoins3 = this._supportedCoins.find(i => i.code === swap.to.code && i.network === swap.to.network)) == null ? void 0 : _this$_supportedCoins3.coin;
|
|
8501
8586
|
if (!fromCoin || !toCoin) {
|
|
8502
8587
|
return []; // We skip swaps with not supported coins for now
|
|
8503
8588
|
}
|
|
@@ -8515,14 +8600,14 @@ class SwapspaceSwapProvider extends SwapProvider {
|
|
|
8515
8600
|
swaps: swaps
|
|
8516
8601
|
};
|
|
8517
8602
|
} catch (e) {
|
|
8518
|
-
var _e$
|
|
8603
|
+
var _e$response4, _e$response5;
|
|
8519
8604
|
Logger.logError(e, loggerSource, `Failed to get swap details. Error is: ${safeStringify(e)}`);
|
|
8520
8605
|
const composeFailResult = reason => ({
|
|
8521
8606
|
result: false,
|
|
8522
8607
|
reason: reason
|
|
8523
8608
|
});
|
|
8524
|
-
const status = e == null || (_e$
|
|
8525
|
-
const data = e == null || (_e$
|
|
8609
|
+
const status = e == null || (_e$response4 = e.response) == null ? void 0 : _e$response4.status;
|
|
8610
|
+
const data = e == null || (_e$response5 = e.response) == null ? void 0 : _e$response5.data;
|
|
8526
8611
|
if (status === 429) {
|
|
8527
8612
|
Logger.log(`Returning fail - RPS limit exceeded ${data}`, loggerSource);
|
|
8528
8613
|
return composeFailResult(SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED);
|
|
@@ -8530,41 +8615,6 @@ class SwapspaceSwapProvider extends SwapProvider {
|
|
|
8530
8615
|
improveAndRethrow(e, loggerSource);
|
|
8531
8616
|
}
|
|
8532
8617
|
}
|
|
8533
|
-
isAddressValidForAsset(asset, address) {
|
|
8534
|
-
try {
|
|
8535
|
-
const assetData = this._supportedCoins.find(i => {
|
|
8536
|
-
var _i$coin3;
|
|
8537
|
-
return ((_i$coin3 = i.coin) == null ? void 0 : _i$coin3.ticker) === (asset == null ? void 0 : asset.ticker);
|
|
8538
|
-
});
|
|
8539
|
-
if (assetData) {
|
|
8540
|
-
let corrected = assetData.validationRegexp.trim();
|
|
8541
|
-
corrected = corrected[0] === "/" ? corrected.slice(1) : corrected;
|
|
8542
|
-
corrected = corrected[corrected.length - 1] === "/" ? corrected.slice(0, corrected.length - 1) : corrected;
|
|
8543
|
-
return address.match(corrected) != null;
|
|
8544
|
-
}
|
|
8545
|
-
} catch (e) {
|
|
8546
|
-
Logger.logError(e, "isAddressValidForAsset");
|
|
8547
|
-
}
|
|
8548
|
-
return false;
|
|
8549
|
-
}
|
|
8550
|
-
getExtraIdNameIfPresent(asset) {
|
|
8551
|
-
try {
|
|
8552
|
-
const assetData = this._supportedCoins.find(i => {
|
|
8553
|
-
var _i$coin4;
|
|
8554
|
-
return ((_i$coin4 = i.coin) == null ? void 0 : _i$coin4.ticker) === (asset == null ? void 0 : asset.ticker);
|
|
8555
|
-
});
|
|
8556
|
-
if (assetData != null && assetData.hasExtraId) {
|
|
8557
|
-
if ((assetData == null ? void 0 : assetData.extraIdName) == null || (assetData == null ? void 0 : assetData.extraIdName) === "") {
|
|
8558
|
-
// We return some default name if the extraIdName is empty
|
|
8559
|
-
return "ID";
|
|
8560
|
-
}
|
|
8561
|
-
return assetData == null ? void 0 : assetData.extraIdName;
|
|
8562
|
-
}
|
|
8563
|
-
return null;
|
|
8564
|
-
} catch (e) {
|
|
8565
|
-
improveAndRethrow(e, "getExtraIdNameIfPresent");
|
|
8566
|
-
}
|
|
8567
|
-
}
|
|
8568
8618
|
}
|
|
8569
8619
|
|
|
8570
8620
|
class SwapUtils {
|
|
@@ -8656,8 +8706,8 @@ class SwapUtils {
|
|
|
8656
8706
|
/**
|
|
8657
8707
|
* If some swap is not found by id then there is no item in return list.
|
|
8658
8708
|
*
|
|
8659
|
-
* @param
|
|
8660
|
-
* @param swapIds {string[]}
|
|
8709
|
+
* @param swapProviders {SwapProvider[]} - Array of swap providers
|
|
8710
|
+
* @param swapIds {string[]} - Array of swap IDs
|
|
8661
8711
|
* @return {Promise<{
|
|
8662
8712
|
* result: true,
|
|
8663
8713
|
* swaps: ExistingSwapWithFiatData[]
|
|
@@ -8666,80 +8716,467 @@ class SwapUtils {
|
|
|
8666
8716
|
* reason: string
|
|
8667
8717
|
* }>}
|
|
8668
8718
|
*/
|
|
8669
|
-
static async getExistingSwapsDetailsWithFiatAmounts(
|
|
8719
|
+
static async getExistingSwapsDetailsWithFiatAmounts(swapProviders, swapIds) {
|
|
8670
8720
|
try {
|
|
8671
|
-
|
|
8672
|
-
|
|
8673
|
-
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
|
|
8679
|
-
|
|
8680
|
-
|
|
8721
|
+
let allSwaps = [];
|
|
8722
|
+
let remainingSwapIds = new Set(swapIds);
|
|
8723
|
+
const failResults = [];
|
|
8724
|
+
for (let provider of swapProviders) {
|
|
8725
|
+
const result = await provider.getExistingSwapsDetailsAndStatus([...remainingSwapIds]);
|
|
8726
|
+
if (result.result) {
|
|
8727
|
+
const extendedSwaps = [];
|
|
8728
|
+
for (let swap of result.swaps) {
|
|
8729
|
+
if (swap.status === SwapProvider.SWAP_STATUSES.REFUNDED) {
|
|
8730
|
+
const rate = await provider.getCoinToUSDTRate(swap.fromCoin);
|
|
8731
|
+
extendedSwaps.push(ExistingSwapWithFiatData.fromExistingSwap(swap, (rate == null ? void 0 : rate.rate) != null ? BigNumber(swap.fromAmount).times(rate.rate).toNumber() : null, (rate == null ? void 0 : rate.rate) != null ? BigNumber(swap.toAmount).times(rate.rate).toNumber() : null, "USD", FiatCurrenciesService.getCurrencyDecimalCountByCode("USD")));
|
|
8732
|
+
} else {
|
|
8733
|
+
const [fromCoinFiatRate, toCoinFiatRate] = await Promise.all([provider.getCoinToUSDTRate(swap.fromCoin), provider.getCoinToUSDTRate(swap.toCoin)]);
|
|
8734
|
+
extendedSwaps.push(ExistingSwapWithFiatData.fromExistingSwap(swap, (fromCoinFiatRate == null ? void 0 : fromCoinFiatRate.rate) != null ? BigNumber(swap.fromAmount).times(fromCoinFiatRate.rate).toNumber() : null, (toCoinFiatRate == null ? void 0 : toCoinFiatRate.rate) != null ? BigNumber(swap.toAmount).times(toCoinFiatRate.rate).toNumber() : null, "USD", FiatCurrenciesService.getCurrencyDecimalCountByCode("USD")));
|
|
8735
|
+
}
|
|
8736
|
+
remainingSwapIds.delete(swap.id);
|
|
8681
8737
|
}
|
|
8738
|
+
allSwaps = allSwaps.concat(extendedSwaps);
|
|
8739
|
+
|
|
8740
|
+
// Stop if we have retrieved all swaps
|
|
8741
|
+
if (allSwaps.length >= swapIds.length) {
|
|
8742
|
+
break;
|
|
8743
|
+
}
|
|
8744
|
+
} else {
|
|
8745
|
+
failResults.push(result);
|
|
8682
8746
|
}
|
|
8683
|
-
result.swaps = extendedSwaps;
|
|
8684
8747
|
}
|
|
8685
|
-
|
|
8748
|
+
if (swapIds.length > 0 && allSwaps.length === 0 && failResults.length > 0) {
|
|
8749
|
+
const failReasons = failResults.map(r => r.reason);
|
|
8750
|
+
return {
|
|
8751
|
+
result: false,
|
|
8752
|
+
reason: failReasons.find(r => r !== SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) ? failReasons.join("\n") : SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
8753
|
+
};
|
|
8754
|
+
}
|
|
8755
|
+
return {
|
|
8756
|
+
result: true,
|
|
8757
|
+
swaps: allSwaps
|
|
8758
|
+
};
|
|
8686
8759
|
} catch (e) {
|
|
8687
8760
|
improveAndRethrow(e, "getExistingSwapsDetailsWithFiatAmounts");
|
|
8688
8761
|
}
|
|
8689
8762
|
}
|
|
8690
8763
|
}
|
|
8691
8764
|
|
|
8765
|
+
class LetsExchangeSwapProvider extends SwapProvider {
|
|
8766
|
+
constructor(apiKeysProxyUrl, cache, customCoinBuilder = (coin, network) => null, useRestrictedCoinsSet = true) {
|
|
8767
|
+
super(cache, customCoinBuilder, useRestrictedCoinsSet);
|
|
8768
|
+
this._partners = [];
|
|
8769
|
+
this._URL = `${apiKeysProxyUrl}/letsexchange`;
|
|
8770
|
+
this.isAggregator = false;
|
|
8771
|
+
this.COINS_EXPIRATION_TIME_MS = 5 * 60 * 1000;
|
|
8772
|
+
this.coinsLastUpdateTimestamp = null;
|
|
8773
|
+
}
|
|
8774
|
+
getSwapCreationInfoTtlMs() {
|
|
8775
|
+
return 110000;
|
|
8776
|
+
}
|
|
8777
|
+
async _fetchSupportedCurrenciesIfNeeded() {
|
|
8778
|
+
const loggerSource = "_fetchSupportedCurrenciesIfNeeded";
|
|
8779
|
+
try {
|
|
8780
|
+
var _this$_supportedCoins;
|
|
8781
|
+
if (!((_this$_supportedCoins = this._supportedCoins) != null && _this$_supportedCoins.length) || !this.coinsLastUpdateTimestamp || this.coinsLastUpdateTimestamp + this.COINS_EXPIRATION_TIME_MS < Date.now()) {
|
|
8782
|
+
var _rawResponse$data, _rawResponse$data2;
|
|
8783
|
+
const rawResponse = await axios.get(`${this._URL}/v2/coins`);
|
|
8784
|
+
Logger.log(`Retrieved ${rawResponse == null || (_rawResponse$data = rawResponse.data) == null ? void 0 : _rawResponse$data.length}`, loggerSource);
|
|
8785
|
+
let allowedCoins = (_rawResponse$data2 = rawResponse == null ? void 0 : rawResponse.data) != null ? _rawResponse$data2 : [];
|
|
8786
|
+
Logger.log(`Allowed cnt ${allowedCoins.length}`, loggerSource);
|
|
8787
|
+
this._supportedCoins = allowedCoins.map(item => {
|
|
8788
|
+
const code = item.code.toUpperCase();
|
|
8789
|
+
if (!Array.isArray(item.networks)) return [];
|
|
8790
|
+
return item.networks.map(networkDetails => {
|
|
8791
|
+
const network = networkDetails.code.toUpperCase();
|
|
8792
|
+
let coin = this._customCoinBuilder(code, network);
|
|
8793
|
+
if (!coin && !this.useRestrictedCoinsSet) {
|
|
8794
|
+
let name = this.removeProtocolNameFromCoinName(item.name, code, network);
|
|
8795
|
+
const ticker = `${code}${code === network ? "" : network}`;
|
|
8796
|
+
const defaultDecimalPlacesForCoinNotSupportedOOB = DEFAULT_CRYPTO_DECIMAL_COUNT;
|
|
8797
|
+
const defaultMinConfirmationsForCoinNotSupportedOOB = 1;
|
|
8798
|
+
coin = new Coin(name, ticker, code, defaultDecimalPlacesForCoinNotSupportedOOB, null, "", null, null, defaultMinConfirmationsForCoinNotSupportedOOB, null, [], 60000, null, code !== network ? new Protocol(network) : null, item.contract_address || null, false);
|
|
8799
|
+
}
|
|
8800
|
+
if (coin) {
|
|
8801
|
+
var _networkDetails$extra, _networkDetails$valid;
|
|
8802
|
+
return {
|
|
8803
|
+
coin: coin,
|
|
8804
|
+
code: item.code,
|
|
8805
|
+
network: networkDetails.code,
|
|
8806
|
+
hasExtraId: !!networkDetails.has_extra,
|
|
8807
|
+
extraIdName: (_networkDetails$extra = networkDetails.extra_name) != null ? _networkDetails$extra : null,
|
|
8808
|
+
isPopular: item.rating || 0,
|
|
8809
|
+
iconURL: item.icon ? item.icon : FALLBACK_ASSET_ICON_URL,
|
|
8810
|
+
deposit: true,
|
|
8811
|
+
// Letsexchange provide no such details
|
|
8812
|
+
withdrawal: true,
|
|
8813
|
+
// Letsexchange provide no such details
|
|
8814
|
+
validationRegexp: (_networkDetails$valid = networkDetails.validation_address_regex) != null ? _networkDetails$valid : null,
|
|
8815
|
+
isAvailable: (typeof item.is_active !== "number" || item.is_active === 1) && (typeof item.disabled !== "number" || item.disabled === 0) && (typeof networkDetails.is_active !== "number" || networkDetails.is_active === 1)
|
|
8816
|
+
};
|
|
8817
|
+
}
|
|
8818
|
+
return [];
|
|
8819
|
+
});
|
|
8820
|
+
}).flat();
|
|
8821
|
+
this.coinsLastUpdateTimestamp = Date.now();
|
|
8822
|
+
this._putPopularCoinsFirst();
|
|
8823
|
+
}
|
|
8824
|
+
} catch (e) {
|
|
8825
|
+
improveAndRethrow(e, loggerSource);
|
|
8826
|
+
}
|
|
8827
|
+
}
|
|
8828
|
+
async getSwapInfo(fromCoin, toCoin, amountCoins, fixed = false, fromCoinToUsdRate = null, amountIsToReceive = false) {
|
|
8829
|
+
const loggerSource = "getSwapInfo";
|
|
8830
|
+
try {
|
|
8831
|
+
if (!(fromCoin instanceof Coin) || !(toCoin instanceof Coin) || typeof amountCoins !== "string" || BigNumber(amountCoins).lt("0") || fixed !== null && typeof fixed !== "boolean" || amountIsToReceive && !fixed) {
|
|
8832
|
+
throw new Error(`Wrong input params: ${amountCoins} ${fromCoin.ticker} -> ${toCoin.ticker}, ${fromCoin instanceof Coin}, ${toCoin instanceof Coin}, ${typeof fixed} ${fixed}, ${amountIsToReceive}`);
|
|
8833
|
+
}
|
|
8834
|
+
const fromCoinDetails = this._supportedCoins.find(i => {
|
|
8835
|
+
var _i$coin;
|
|
8836
|
+
return ((_i$coin = i.coin) == null ? void 0 : _i$coin.ticker) === (fromCoin == null ? void 0 : fromCoin.ticker);
|
|
8837
|
+
});
|
|
8838
|
+
const toCoinDetails = this._supportedCoins.find(i => {
|
|
8839
|
+
var _i$coin2;
|
|
8840
|
+
return ((_i$coin2 = i.coin) == null ? void 0 : _i$coin2.ticker) === (toCoin == null ? void 0 : toCoin.ticker);
|
|
8841
|
+
});
|
|
8842
|
+
if (!fromCoinDetails || !toCoinDetails) {
|
|
8843
|
+
throw new Error("Failed to find coin details for: " + fromCoin.ticker + " -> " + toCoin.ticker);
|
|
8844
|
+
}
|
|
8845
|
+
if (!fromCoinDetails.deposit || !fromCoinDetails.isAvailable || !toCoinDetails.withdrawal || !toCoinDetails.isAvailable) {
|
|
8846
|
+
return {
|
|
8847
|
+
result: false,
|
|
8848
|
+
reason: SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED
|
|
8849
|
+
};
|
|
8850
|
+
}
|
|
8851
|
+
const pathAndQuery = `/v1/info${amountIsToReceive ? "-revert" : `?float=${!fixed}`}`;
|
|
8852
|
+
const response = await axios.post(`${this._URL}${pathAndQuery}`, {
|
|
8853
|
+
from: fromCoinDetails.code,
|
|
8854
|
+
to: toCoinDetails.code,
|
|
8855
|
+
network_from: fromCoinDetails.network,
|
|
8856
|
+
network_to: toCoinDetails.network,
|
|
8857
|
+
amount: amountCoins,
|
|
8858
|
+
affiliate_id: LetsExchangeSwapProvider.AFFILIATE_ID
|
|
8859
|
+
});
|
|
8860
|
+
Logger.log(`Retrieved ${response == null ? void 0 : response.data}`, loggerSource);
|
|
8861
|
+
const data = response.data;
|
|
8862
|
+
|
|
8863
|
+
// TODO: [dev] add SwapProvider.NO_SWAPS_REASONS.NO_FIXED_BUT_HAVE_FLOATING - request alternative rate. task_id=
|
|
8864
|
+
|
|
8865
|
+
// TODO: [feature, low] implement extra coins to fit min/max if there are frequent errors due to min/max exceeding
|
|
8866
|
+
// let extraCoinsToFitMinMax = "0";
|
|
8867
|
+
// if (typeof fromCoinToUsdRate === "string" && BigNumber(fromCoinToUsdRate).gt("0")) {
|
|
8868
|
+
// const extraUsdToFitMinMax = BigNumber("1"); // We correct the limits as the exact limit can fluctuate and cause failed swap creation
|
|
8869
|
+
// extraCoinsToFitMinMax = AmountUtils.trim(extraUsdToFitMinMax.div(fromCoinToUsdRate), fromCoin.digits);
|
|
8870
|
+
// }
|
|
8871
|
+
let min = null;
|
|
8872
|
+
if (data != null && data.min_amount) {
|
|
8873
|
+
min = AmountUtils.trim(data == null ? void 0 : data.min_amount, amountIsToReceive ? toCoin.digits : fromCoin.digits);
|
|
8874
|
+
}
|
|
8875
|
+
let max = null;
|
|
8876
|
+
if (data != null && data.max_amount) {
|
|
8877
|
+
max = AmountUtils.trim(data == null ? void 0 : data.max_amount, amountIsToReceive ? toCoin.digits : fromCoin.digits);
|
|
8878
|
+
}
|
|
8879
|
+
if (data.success === false && data.error) {
|
|
8880
|
+
// TODO: [dev] waiting for response from letsexchange about their not-documented responses
|
|
8881
|
+
// {
|
|
8882
|
+
// "success": false,
|
|
8883
|
+
// "error": "Internal error"
|
|
8884
|
+
// }
|
|
8885
|
+
throw new Error("Failed to estimate swap letsexchange");
|
|
8886
|
+
}
|
|
8887
|
+
if (BigNumber(data.rate).eq("0") || BigNumber(data.amount).eq("0")) {
|
|
8888
|
+
// TODO actualize according to letsexchage clarification - decide, can we count on min/max abcense? task_id=76512110797f4eab8b37f1bb789825cb
|
|
8889
|
+
// amount: "0", rate: "0", rate_id: ""
|
|
8890
|
+
let reason = SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED;
|
|
8891
|
+
if (min && BigNumber(amountCoins).lt(min)) {
|
|
8892
|
+
reason = SwapProvider.NO_SWAPS_REASONS.TOO_LOW;
|
|
8893
|
+
} else if (max && BigNumber(amountCoins).gt(max)) {
|
|
8894
|
+
reason = SwapProvider.NO_SWAPS_REASONS.TOO_HIGH;
|
|
8895
|
+
} else if (!amountIsToReceive) {
|
|
8896
|
+
// If we are not requesting receiving amount (it cannot be floating-rate)
|
|
8897
|
+
// todo [feature, moderate] request alternative rate. task_id=31884db5392f49738c20a86115c90e1f
|
|
8898
|
+
// const alternativeRate = 1;
|
|
8899
|
+
// const alternativeRateAvailable = alternativeRate;
|
|
8900
|
+
// if (alternativeRateAvailable) {
|
|
8901
|
+
// reason = fixed
|
|
8902
|
+
// ? SwapProvider.NO_SWAPS_REASONS.NO_FIXED_BUT_HAVE_FLOATING
|
|
8903
|
+
// : SwapProvider.NO_SWAPS_REASONS.NO_FLOATING_BUT_HAVE_FIXED;
|
|
8904
|
+
// }
|
|
8905
|
+
}
|
|
8906
|
+
return {
|
|
8907
|
+
result: false,
|
|
8908
|
+
reason: reason,
|
|
8909
|
+
smallestMin: min,
|
|
8910
|
+
greatestMax: max
|
|
8911
|
+
};
|
|
8912
|
+
}
|
|
8913
|
+
const rate = amountIsToReceive ? BigNumber(amountCoins).div(data.amount) : BigNumber(data.amount).div(amountCoins);
|
|
8914
|
+
return {
|
|
8915
|
+
result: true,
|
|
8916
|
+
min: min,
|
|
8917
|
+
max: max,
|
|
8918
|
+
smallestMin: min,
|
|
8919
|
+
greatestMax: max,
|
|
8920
|
+
rate: AmountUtils.trim(rate, this._maxRateDigits),
|
|
8921
|
+
durationMinutesRange: null,
|
|
8922
|
+
fixed: fixed,
|
|
8923
|
+
rawSwapData: data,
|
|
8924
|
+
isRefundAddressRequired: false
|
|
8925
|
+
};
|
|
8926
|
+
} catch (e) {
|
|
8927
|
+
var _e$response;
|
|
8928
|
+
if ((e == null || (_e$response = e.response) == null ? void 0 : _e$response.status) === 429) {
|
|
8929
|
+
return {
|
|
8930
|
+
result: false,
|
|
8931
|
+
reason: SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
8932
|
+
};
|
|
8933
|
+
}
|
|
8934
|
+
Logger.log(`Internal error when getting swap options ${safeStringify(e)}`, loggerSource);
|
|
8935
|
+
improveAndRethrow(e, loggerSource);
|
|
8936
|
+
}
|
|
8937
|
+
}
|
|
8938
|
+
async createSwap(fromCoin, toCoin, amount, toAddress, refundAddress, rawSwapData, clientIpAddress, fixed, toCurrencyExtraId = "", refundExtraId = "", amountIsToReceive = false) {
|
|
8939
|
+
const loggerSource = "createSwap";
|
|
8940
|
+
try {
|
|
8941
|
+
if (!(fromCoin instanceof Coin) || !(toCoin instanceof Coin) || typeof amount !== "string" || typeof toAddress !== "string" || typeof refundAddress !== "string" || typeof clientIpAddress != "string" || typeof fixed != "boolean") {
|
|
8942
|
+
throw new Error(`Invalid input: ${fromCoin} ${toCoin} ${amount} ${toAddress} ${refundAddress} ${fixed}`);
|
|
8943
|
+
}
|
|
8944
|
+
if (typeof rawSwapData !== "object" || fixed && !rawSwapData.rate_id) {
|
|
8945
|
+
throw new Error(`Invalid raw swap data: ${safeStringify(rawSwapData)}`);
|
|
8946
|
+
}
|
|
8947
|
+
const fromCoinDetails = this._supportedCoins.find(i => {
|
|
8948
|
+
var _i$coin3;
|
|
8949
|
+
return ((_i$coin3 = i.coin) == null ? void 0 : _i$coin3.ticker) === (fromCoin == null ? void 0 : fromCoin.ticker);
|
|
8950
|
+
});
|
|
8951
|
+
const toCoinDetails = this._supportedCoins.find(i => {
|
|
8952
|
+
var _i$coin4;
|
|
8953
|
+
return ((_i$coin4 = i.coin) == null ? void 0 : _i$coin4.ticker) === (toCoin == null ? void 0 : toCoin.ticker);
|
|
8954
|
+
});
|
|
8955
|
+
if (!fromCoinDetails || !toCoinDetails) {
|
|
8956
|
+
throw new Error("Failed to find coin details for: " + fromCoin.ticker + " -> " + toCoin.ticker);
|
|
8957
|
+
}
|
|
8958
|
+
const requestBody = {
|
|
8959
|
+
coin_from: fromCoinDetails.code,
|
|
8960
|
+
network_from: fromCoinDetails.network,
|
|
8961
|
+
coin_to: toCoinDetails.code,
|
|
8962
|
+
network_to: toCoinDetails.network,
|
|
8963
|
+
withdrawal: toAddress,
|
|
8964
|
+
withdrawal_extra_id: toCurrencyExtraId,
|
|
8965
|
+
return: refundAddress,
|
|
8966
|
+
return_extra_id: refundExtraId,
|
|
8967
|
+
affiliate_id: LetsExchangeSwapProvider.AFFILIATE_ID
|
|
8968
|
+
};
|
|
8969
|
+
if (amountIsToReceive) {
|
|
8970
|
+
requestBody.withdrawal_amount = amount;
|
|
8971
|
+
} else {
|
|
8972
|
+
requestBody.deposit_amount = amount;
|
|
8973
|
+
}
|
|
8974
|
+
if (fixed) {
|
|
8975
|
+
requestBody.rate_id = rawSwapData.rate_id;
|
|
8976
|
+
}
|
|
8977
|
+
const response = await axios.post(`${this._URL}/v1/transaction${amountIsToReceive ? "-revert" : `?float=${!fixed}`}`, requestBody);
|
|
8978
|
+
const result = response.data;
|
|
8979
|
+
Logger.log(`Creation result ${safeStringify(result)}`, loggerSource);
|
|
8980
|
+
if (result != null && result.transaction_id) {
|
|
8981
|
+
var _result$rate, _result$deposit_extra;
|
|
8982
|
+
const rate = BigNumber((_result$rate = result.rate) != null ? _result$rate : 0).isZero() ? BigNumber(result.withdrawal_amount).div(result.deposit_amount) : BigNumber(result.rate);
|
|
8983
|
+
return {
|
|
8984
|
+
result: true,
|
|
8985
|
+
swapId: result.transaction_id,
|
|
8986
|
+
fromCoin: fromCoin,
|
|
8987
|
+
fromAmount: AmountUtils.trim(result.deposit_amount, fromCoin.digits),
|
|
8988
|
+
fromAddress: result.deposit,
|
|
8989
|
+
toCoin: toCoin,
|
|
8990
|
+
toAmount: AmountUtils.trim(result.withdrawal_amount, toCoin.digits),
|
|
8991
|
+
toAddress: result.withdrawal,
|
|
8992
|
+
fromCurrencyExtraId: (_result$deposit_extra = result.deposit_extra_id) != null ? _result$deposit_extra : "",
|
|
8993
|
+
rate: AmountUtils.trim(rate, this._maxRateDigits),
|
|
8994
|
+
fixed: !result.is_float
|
|
8995
|
+
};
|
|
8996
|
+
}
|
|
8997
|
+
const errorMessage = `Swap creation succeeded but the response is wrong: ${safeStringify(response)}`;
|
|
8998
|
+
Logger.log(errorMessage, loggerSource);
|
|
8999
|
+
throw new Error(errorMessage);
|
|
9000
|
+
} catch (e) {
|
|
9001
|
+
var _e$response2, _e$response3;
|
|
9002
|
+
Logger.logError(e, loggerSource, `Failed to create swap. Error is: ${safeStringify(e)}`);
|
|
9003
|
+
const composeFailResult = reason => ({
|
|
9004
|
+
result: false,
|
|
9005
|
+
reason: reason
|
|
9006
|
+
});
|
|
9007
|
+
const status = e == null || (_e$response2 = e.response) == null ? void 0 : _e$response2.status;
|
|
9008
|
+
const data = e == null || (_e$response3 = e.response) == null ? void 0 : _e$response3.data;
|
|
9009
|
+
if (status === 429) {
|
|
9010
|
+
Logger.log(`Returning fail - RPS limit exceeded ${data}`, loggerSource);
|
|
9011
|
+
return composeFailResult(SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED);
|
|
9012
|
+
}
|
|
9013
|
+
// TODO: [feature, low] add custom errors handling - waiting for response from letsexchange. task_id=00d2e435f6df4fb99af912135bd9ee27
|
|
9014
|
+
// 422 - missing params
|
|
9015
|
+
Logger.log(`Internal error for swap: ${safeStringify(e)}`, loggerSource);
|
|
9016
|
+
improveAndRethrow(e, loggerSource);
|
|
9017
|
+
}
|
|
9018
|
+
}
|
|
9019
|
+
async getExistingSwapsDetailsAndStatus(swapIds) {
|
|
9020
|
+
const loggerSource = "getExistingSwapsDetailsAndStatus";
|
|
9021
|
+
try {
|
|
9022
|
+
if (swapIds.find(id => typeof id !== "string")) {
|
|
9023
|
+
throw new Error("Swap id is not string: " + safeStringify(swapIds));
|
|
9024
|
+
}
|
|
9025
|
+
const response = await axios.get(`${this._URL}/v1/transactions-list?ids[]=${swapIds.join("&ids[]=")}`);
|
|
9026
|
+
Logger.log("All swaps RAW: " + safeStringify(response.data), loggerSource);
|
|
9027
|
+
const swaps = response.data.map((swap, index) => {
|
|
9028
|
+
var _this$_supportedCoins2, _this$_supportedCoins3, _swap$deposit_extra_i, _swap$withdrawal_extr, _swap$return_extra_id;
|
|
9029
|
+
const fromCoin = (_this$_supportedCoins2 = this._supportedCoins.find(i => i.code === swap.coin_from && i.network === swap.coin_from_network)) == null ? void 0 : _this$_supportedCoins2.coin;
|
|
9030
|
+
const toCoin = (_this$_supportedCoins3 = this._supportedCoins.find(i => i.code === swap.coin_to && i.network === swap.coin_to_network)) == null ? void 0 : _this$_supportedCoins3.coin;
|
|
9031
|
+
if (!fromCoin || !toCoin) {
|
|
9032
|
+
return []; // We skip swaps with not supported coins for now
|
|
9033
|
+
}
|
|
9034
|
+
const toUtcTimestamp = timeStr => Date.parse(timeStr.match(/.+[Zz]$/) ? timeStr : `${timeStr}Z`);
|
|
9035
|
+
const expiresAt = swap.expired_at ? swap.expired_at * 1000 : null;
|
|
9036
|
+
const createdAt = swap.created_at ? toUtcTimestamp(`${swap.created_at}`) : null;
|
|
9037
|
+
const isExpiredByTime = expiresAt && expiresAt < Date.now();
|
|
9038
|
+
const status = this._mapLetsExchangeStatusToRabbitStatus(swap.status, isExpiredByTime);
|
|
9039
|
+
const toDigits = status === SwapProvider.SWAP_STATUSES.REFUNDED ? fromCoin.digits : toCoin.digits;
|
|
9040
|
+
return new ExistingSwap(swapIds[index], status, createdAt, expiresAt, swap.confirmations, AmountUtils.trim(swap.rate, this._maxRateDigits), swap.is_float != null ? !swap.is_float : false, swap.return, swap.deposit, fromCoin, AmountUtils.trim(swap.deposit_amount, fromCoin.digits), swap.hash_in, swap.hash_in ? `${swap.coin_from_explorer_url}${swap.hash_in}` : null, toCoin, AmountUtils.trim(swap.withdrawal_amount, toDigits), swap.hash_out, swap.hash_out ? `${swap.coin_to_explorer_url}${swap.hash_out}` : null, swap.withdrawal, "letsexchange", (_swap$deposit_extra_i = swap.deposit_extra_id) != null ? _swap$deposit_extra_i : null, (_swap$withdrawal_extr = swap.withdrawal_extra_id) != null ? _swap$withdrawal_extr : null, (_swap$return_extra_id = swap.return_extra_id) != null ? _swap$return_extra_id : null);
|
|
9041
|
+
}).flat();
|
|
9042
|
+
Logger.log(`Swap details result ${safeStringify(swaps)}`, loggerSource);
|
|
9043
|
+
return {
|
|
9044
|
+
result: true,
|
|
9045
|
+
swaps: swaps
|
|
9046
|
+
};
|
|
9047
|
+
} catch (e) {
|
|
9048
|
+
var _e$response4, _e$response5;
|
|
9049
|
+
Logger.logError(e, loggerSource, `Failed to get swap details. Error is: ${safeStringify(e)}`);
|
|
9050
|
+
const composeFailResult = reason => ({
|
|
9051
|
+
result: false,
|
|
9052
|
+
reason: reason
|
|
9053
|
+
});
|
|
9054
|
+
const status = e == null || (_e$response4 = e.response) == null ? void 0 : _e$response4.status;
|
|
9055
|
+
const data = e == null || (_e$response5 = e.response) == null ? void 0 : _e$response5.data;
|
|
9056
|
+
if (status === 429) {
|
|
9057
|
+
Logger.log(`Returning fail - RPS limit exceeded ${data}`, loggerSource);
|
|
9058
|
+
return composeFailResult(SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED);
|
|
9059
|
+
}
|
|
9060
|
+
improveAndRethrow(e, loggerSource);
|
|
9061
|
+
}
|
|
9062
|
+
}
|
|
9063
|
+
|
|
9064
|
+
// TODO: [dev] Serg, please check this during the review to make sure I did no mistakes in statuses mapping.
|
|
9065
|
+
// I will remove these comments after the review. https://api.letsexchange.io/doc
|
|
9066
|
+
// wait The exchange has just been created and it’s waiting for coins to reach the deposit wallet
|
|
9067
|
+
// confirmation The transaction appears in mempool and now it is waiting for necessary network confirmations to start.
|
|
9068
|
+
// confirmed The user’s payment is confirmed, the exchange process is about to start.
|
|
9069
|
+
// exchanging The exchange process is running.
|
|
9070
|
+
// sending Funds are being sent to the recipient`s address.
|
|
9071
|
+
// sending_confirmation The outgoing transaction is waiting for network confirmations.
|
|
9072
|
+
// success The exchange is completed and the funds are successfully sent to the recipient’s address.
|
|
9073
|
+
// aml_check_failed The deposit was marked as risky by AML check service.
|
|
9074
|
+
// overdue The deposit receiving time for this transaction has expired.
|
|
9075
|
+
// error The transaction has failed. In most cases, the amount that was sent differs from the amount that was specified when creating the transaction.
|
|
9076
|
+
// refund The exchange failed and the coins were refunded to the user's wallet.
|
|
9077
|
+
_mapLetsExchangeStatusToRabbitStatus(status, isExpiredByTime) {
|
|
9078
|
+
switch (status) {
|
|
9079
|
+
case "wait":
|
|
9080
|
+
if (isExpiredByTime) {
|
|
9081
|
+
return SwapProvider.SWAP_STATUSES.EXPIRED;
|
|
9082
|
+
}
|
|
9083
|
+
return SwapProvider.SWAP_STATUSES.WAITING_FOR_PAYMENT;
|
|
9084
|
+
case "confirmation":
|
|
9085
|
+
return SwapProvider.SWAP_STATUSES.CONFIRMING;
|
|
9086
|
+
case "confirmed":
|
|
9087
|
+
return SwapProvider.SWAP_STATUSES.PAYMENT_RECEIVED;
|
|
9088
|
+
case "exchanging":
|
|
9089
|
+
return SwapProvider.SWAP_STATUSES.EXCHANGING;
|
|
9090
|
+
case "sending":
|
|
9091
|
+
return SwapProvider.SWAP_STATUSES.PAYMENT_RECEIVED;
|
|
9092
|
+
case "sending_confirmation":
|
|
9093
|
+
return SwapProvider.SWAP_STATUSES.EXCHANGING;
|
|
9094
|
+
case "success":
|
|
9095
|
+
return SwapProvider.SWAP_STATUSES.COMPLETED;
|
|
9096
|
+
case "refund":
|
|
9097
|
+
return SwapProvider.SWAP_STATUSES.REFUNDED;
|
|
9098
|
+
case "overdue":
|
|
9099
|
+
return SwapProvider.SWAP_STATUSES.EXPIRED;
|
|
9100
|
+
case "aml_check_failed":
|
|
9101
|
+
return SwapProvider.SWAP_STATUSES.EXCHANGING;
|
|
9102
|
+
case "error":
|
|
9103
|
+
return SwapProvider.SWAP_STATUSES.FAILED;
|
|
9104
|
+
default:
|
|
9105
|
+
throw new Error(`Unknown LetsExchange status: ${status}`);
|
|
9106
|
+
}
|
|
9107
|
+
}
|
|
9108
|
+
}
|
|
9109
|
+
LetsExchangeSwapProvider.AFFILIATE_ID = "0zbj9hf7xg7jgdgv";
|
|
9110
|
+
|
|
8692
9111
|
class PublicSwapService {
|
|
8693
9112
|
constructor(apiKeysProxyUrl, cache) {
|
|
8694
9113
|
this._swapProvider = new SwapspaceSwapProvider(apiKeysProxyUrl, cache, () => null, false);
|
|
9114
|
+
this._fixedSwapProvider = new LetsExchangeSwapProvider(apiKeysProxyUrl, cache, () => null, false);
|
|
8695
9115
|
}
|
|
8696
9116
|
async initialize() {
|
|
8697
9117
|
try {
|
|
8698
|
-
await this._swapProvider.initialize();
|
|
9118
|
+
await Promise.all([this._swapProvider.initialize(), this._fixedSwapProvider.initialize()]);
|
|
8699
9119
|
} catch (e) {
|
|
8700
9120
|
Logger.logError(e, "PublicSwapService.initialize");
|
|
8701
9121
|
}
|
|
8702
9122
|
}
|
|
9123
|
+
|
|
9124
|
+
/**
|
|
9125
|
+
* Gets all currencies across all partners. Useful for sitemap or supported currencies count/list.
|
|
9126
|
+
*
|
|
9127
|
+
* @return {Promise<{result: boolean, coins: Coin[]}|{result: boolean, reason: string}>}
|
|
9128
|
+
*/
|
|
8703
9129
|
async getAllSupportedCurrenciesListForPublicSwap() {
|
|
8704
9130
|
const loggerSource = "getAllSupportedCurrenciesListForPublicSwap";
|
|
8705
9131
|
try {
|
|
8706
|
-
var _result$coins;
|
|
8707
|
-
|
|
8708
|
-
|
|
9132
|
+
var _result$0$coins, _result$1$coins, _result$coins;
|
|
9133
|
+
await this.initialize();
|
|
9134
|
+
const result = await Promise.all([this._fixedSwapProvider.getAllSupportedCurrencies(), this._swapProvider.getAllSupportedCurrencies()]);
|
|
9135
|
+
const allCoins = [...((_result$0$coins = result[0].coins) != null ? _result$0$coins : [])];
|
|
9136
|
+
((_result$1$coins = result[1].coins) != null ? _result$1$coins : []).forEach(c => {
|
|
9137
|
+
if (!allCoins.find(existingCoin => existingCoin.ticker === c.ticker)) {
|
|
9138
|
+
allCoins.push(c);
|
|
9139
|
+
}
|
|
9140
|
+
});
|
|
9141
|
+
if (result[0].reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED || result[1].reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) {
|
|
8709
9142
|
SwapUtils.safeHandleRequestsLimitExceeding();
|
|
8710
|
-
|
|
8711
|
-
|
|
8712
|
-
|
|
8713
|
-
|
|
9143
|
+
// TODO: [dev] improve this during the whitebit integration. task_id=20e7e41211b540d081bf98f392a34b2c
|
|
9144
|
+
// return {
|
|
9145
|
+
// result: false,
|
|
9146
|
+
// reason: PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED,
|
|
9147
|
+
// };
|
|
9148
|
+
} else if (result[0].reason || result[1].reason) {
|
|
9149
|
+
console.log("Failed to get all supported coins", result[0].reason, result[1].reason);
|
|
8714
9150
|
}
|
|
8715
9151
|
Logger.log(`Retrieved ${result == null || (_result$coins = result.coins) == null ? void 0 : _result$coins.length} supported currencies for swap`, loggerSource);
|
|
8716
9152
|
return {
|
|
8717
9153
|
result: true,
|
|
8718
|
-
coins:
|
|
9154
|
+
coins: allCoins
|
|
8719
9155
|
};
|
|
8720
9156
|
} catch (e) {
|
|
8721
|
-
improveAndRethrow(e, "
|
|
9157
|
+
improveAndRethrow(e, "getAllSupportedCurrenciesListForPublicSwap");
|
|
8722
9158
|
}
|
|
8723
9159
|
}
|
|
8724
|
-
async getDepositCurrenciesListForPublicSwap() {
|
|
9160
|
+
async getDepositCurrenciesListForPublicSwap(fixed = false) {
|
|
8725
9161
|
try {
|
|
8726
|
-
return await this._getCurrenciesListForPublicSwap(false);
|
|
9162
|
+
return await this._getCurrenciesListForPublicSwap(false, fixed);
|
|
8727
9163
|
} catch (e) {
|
|
8728
9164
|
improveAndRethrow(e, "getDepositCurrenciesListForPublicSwap");
|
|
8729
9165
|
}
|
|
8730
9166
|
}
|
|
8731
|
-
async getWithdrawCurrenciesListForPublicSwap() {
|
|
9167
|
+
async getWithdrawCurrenciesListForPublicSwap(fixed = false) {
|
|
8732
9168
|
try {
|
|
8733
|
-
return await this._getCurrenciesListForPublicSwap(true);
|
|
9169
|
+
return await this._getCurrenciesListForPublicSwap(true, fixed);
|
|
8734
9170
|
} catch (e) {
|
|
8735
9171
|
improveAndRethrow(e, "getWithdrawCurrenciesListForPublicSwap");
|
|
8736
9172
|
}
|
|
8737
9173
|
}
|
|
8738
|
-
async _getCurrenciesListForPublicSwap(withdraw = false) {
|
|
9174
|
+
async _getCurrenciesListForPublicSwap(withdraw = false, fixed = false) {
|
|
8739
9175
|
const loggerSource = "getCurrenciesListForPublicSwap";
|
|
8740
9176
|
try {
|
|
8741
9177
|
var _result$coins2;
|
|
8742
|
-
const
|
|
9178
|
+
const provider = fixed ? this._fixedSwapProvider : this._swapProvider;
|
|
9179
|
+
const result = withdraw ? await provider.getWithdrawalCurrencies() : await provider.getDepositCurrencies();
|
|
8743
9180
|
if (result.reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) {
|
|
8744
9181
|
SwapUtils.safeHandleRequestsLimitExceeding();
|
|
8745
9182
|
return {
|
|
@@ -8760,6 +9197,9 @@ class PublicSwapService {
|
|
|
8760
9197
|
/**
|
|
8761
9198
|
* Retrieves initial data for swapping two coins.
|
|
8762
9199
|
*
|
|
9200
|
+
* Always FLOATING rate, FIXED is not supported - if you want to change it the default rate - all
|
|
9201
|
+
* the swaps code logic should be verified to align with this change.
|
|
9202
|
+
*
|
|
8763
9203
|
* @param fromCoin {Coin}
|
|
8764
9204
|
* @param toCoin {Coin}
|
|
8765
9205
|
* @return {Promise<{
|
|
@@ -8806,6 +9246,8 @@ class PublicSwapService {
|
|
|
8806
9246
|
* @param fromAmountCoins {string}
|
|
8807
9247
|
* @param [fixed=false] {boolean|null} null means fixed or float doesn't matter
|
|
8808
9248
|
* @param [withoutFiat=false] {boolean} pass true if you don't need the fiat equivalent - this will diminish requests count
|
|
9249
|
+
* @param [amountIsToReceive=false] {boolean} whether the given amount is receiving amount.
|
|
9250
|
+
* False means the amount is the sending amount.
|
|
8809
9251
|
* @return {Promise<{
|
|
8810
9252
|
* result: false,
|
|
8811
9253
|
* reason: string,
|
|
@@ -8819,12 +9261,15 @@ class PublicSwapService {
|
|
|
8819
9261
|
* swapCreationInfo: BaseSwapCreationInfo
|
|
8820
9262
|
* }>}
|
|
8821
9263
|
*/
|
|
8822
|
-
async getPublicSwapDetails(fromCoin, toCoin, fromAmountCoins, fixed = false, withoutFiat = false) {
|
|
9264
|
+
async getPublicSwapDetails(fromCoin, toCoin, fromAmountCoins, fixed = false, withoutFiat = false, amountIsToReceive = false) {
|
|
8823
9265
|
const loggerSource = "getPublicSwapDetails";
|
|
8824
9266
|
try {
|
|
8825
|
-
var _await$
|
|
8826
|
-
|
|
8827
|
-
|
|
9267
|
+
var _await$getCoinToUSDTR, _await$getCoinToUSDTR2, _result$swapCreationI, _result$swapCreationI2;
|
|
9268
|
+
if (amountIsToReceive && !fixed) {
|
|
9269
|
+
throw new Error("Estimating allowed only for fixed rate.");
|
|
9270
|
+
}
|
|
9271
|
+
const coinUsdtRate = withoutFiat ? null : (_await$getCoinToUSDTR = (_await$getCoinToUSDTR2 = await (fixed ? this._fixedSwapProvider : this._swapProvider).getCoinToUSDTRate(fromCoin)) == null ? void 0 : _await$getCoinToUSDTR2.rate) != null ? _await$getCoinToUSDTR : null;
|
|
9272
|
+
const details = await (fixed ? this._fixedSwapProvider : this._swapProvider).getSwapInfo(fromCoin, toCoin, fromAmountCoins, fixed, coinUsdtRate, amountIsToReceive);
|
|
8828
9273
|
|
|
8829
9274
|
// eslint-disable-next-line no-console
|
|
8830
9275
|
console.log("getSwapInfo result: ", details);
|
|
@@ -8893,13 +9338,15 @@ class PublicSwapService {
|
|
|
8893
9338
|
*
|
|
8894
9339
|
* @param fromCoin {Coin}
|
|
8895
9340
|
* @param toCoin {Coin}
|
|
8896
|
-
* @param
|
|
9341
|
+
* @param amount {string}
|
|
8897
9342
|
* @param swapCreationInfo {BaseSwapCreationInfo}
|
|
8898
9343
|
* @param toAddress {string}
|
|
8899
9344
|
* @param refundAddress {string}
|
|
8900
9345
|
* @param clientIp {string}
|
|
8901
9346
|
* @param [toCurrencyExtraId] {string}
|
|
8902
9347
|
* @param [refundExtraId] {string}
|
|
9348
|
+
* @param [amountIsToReceive=false] {boolean} whether the given amount is receiving amount.
|
|
9349
|
+
* False means the amount is the sending amount.
|
|
8903
9350
|
* @return {Promise<{
|
|
8904
9351
|
* result: true,
|
|
8905
9352
|
* fiatCurrencyCode: string,
|
|
@@ -8921,18 +9368,18 @@ class PublicSwapService {
|
|
|
8921
9368
|
* reason: string
|
|
8922
9369
|
* }>}
|
|
8923
9370
|
*/
|
|
8924
|
-
async createPublicSwap(fromCoin, toCoin,
|
|
9371
|
+
async createPublicSwap(fromCoin, toCoin, amount, swapCreationInfo, toAddress, refundAddress, clientIp, toCurrencyExtraId, refundExtraId, amountIsToReceive = false) {
|
|
8925
9372
|
const loggerSource = "createPublicSwap";
|
|
8926
9373
|
try {
|
|
8927
9374
|
var _swapCreationInfo$fro, _swapCreationInfo$toC;
|
|
8928
|
-
if (!(fromCoin instanceof Coin) || !(toCoin instanceof Coin) || typeof
|
|
8929
|
-
throw new Error(`Wrong input: ${fromCoin.ticker} ${toCoin.ticker} ${
|
|
9375
|
+
if (!(fromCoin instanceof Coin) || !(toCoin instanceof Coin) || typeof amount !== "string" || typeof toAddress !== "string" || swapCreationInfo.isRefundAddressRequired && (typeof refundAddress !== "string" || refundAddress.length === 0) || !(swapCreationInfo instanceof BaseSwapCreationInfo)) {
|
|
9376
|
+
throw new Error(`Wrong input: ${fromCoin.ticker} ${toCoin.ticker} ${amount} ${swapCreationInfo}`);
|
|
8930
9377
|
}
|
|
8931
|
-
Logger.log(`Start: ${
|
|
9378
|
+
Logger.log(`Start: ${amount} ${fromCoin.ticker} -> ${toCoin.ticker}. Details: ${safeStringify(_extends({}, swapCreationInfo, {
|
|
8932
9379
|
fromCoin: swapCreationInfo == null || (_swapCreationInfo$fro = swapCreationInfo.fromCoin) == null ? void 0 : _swapCreationInfo$fro.ticker,
|
|
8933
9380
|
toCoin: swapCreationInfo == null || (_swapCreationInfo$toC = swapCreationInfo.toCoin) == null ? void 0 : _swapCreationInfo$toC.ticker
|
|
8934
9381
|
}))}`, loggerSource);
|
|
8935
|
-
const result = await this._swapProvider.createSwap(fromCoin, toCoin,
|
|
9382
|
+
const result = await (swapCreationInfo.fixed ? this._fixedSwapProvider : this._swapProvider).createSwap(fromCoin, toCoin, amount, toAddress, refundAddress, swapCreationInfo.rawSwapData, clientIp, swapCreationInfo.fixed, toCurrencyExtraId, refundExtraId, amountIsToReceive);
|
|
8936
9383
|
Logger.log(`Created:${safeStringify(_extends({}, result, {
|
|
8937
9384
|
fromCoin: fromCoin == null ? void 0 : fromCoin.ticker,
|
|
8938
9385
|
toCoin: toCoin == null ? void 0 : toCoin.ticker
|
|
@@ -8958,9 +9405,9 @@ class PublicSwapService {
|
|
|
8958
9405
|
let fromAmountFiat = null,
|
|
8959
9406
|
toAmountFiat = null;
|
|
8960
9407
|
try {
|
|
8961
|
-
var _await$this$
|
|
8962
|
-
const fromCoinUsdtRate = (_await$this$
|
|
8963
|
-
const toCoinUsdtRate = (_await$this$
|
|
9408
|
+
var _await$this$_swapProv, _await$this$_swapProv2, _await$this$_swapProv3, _await$this$_swapProv4;
|
|
9409
|
+
const fromCoinUsdtRate = (_await$this$_swapProv = (_await$this$_swapProv2 = await this._swapProvider.getCoinToUSDTRate(fromCoin)) == null ? void 0 : _await$this$_swapProv2.rate) != null ? _await$this$_swapProv : null;
|
|
9410
|
+
const toCoinUsdtRate = (_await$this$_swapProv3 = (_await$this$_swapProv4 = await this._swapProvider.getCoinToUSDTRate(fromCoin)) == null ? void 0 : _await$this$_swapProv4.rate) != null ? _await$this$_swapProv3 : null;
|
|
8964
9411
|
if (fromCoinUsdtRate != null && result.fromAmount != null) {
|
|
8965
9412
|
fromAmountFiat = BigNumber(result.fromAmount).times(fromCoinUsdtRate).toFixed(PublicSwapService._fiatDecimalsCount);
|
|
8966
9413
|
}
|
|
@@ -8971,7 +9418,7 @@ class PublicSwapService {
|
|
|
8971
9418
|
Logger.logError(e, loggerSource, "Failed to calculate fiat amounts for result");
|
|
8972
9419
|
}
|
|
8973
9420
|
|
|
8974
|
-
// TODO: feature, cirtical] add GA event. task_id=
|
|
9421
|
+
// TODO: feature, cirtical] add GA event. task_id=091004f1b6b748b29ddece6a130df904
|
|
8975
9422
|
EventBusInstance.dispatch(PublicSwapService.PUBLIC_SWAP_CREATED_EVENT, null, fromCoin.ticker, toCoin.ticker, fromAmountFiat);
|
|
8976
9423
|
const toReturn = {
|
|
8977
9424
|
result: true,
|
|
@@ -9021,7 +9468,7 @@ class PublicSwapService {
|
|
|
9021
9468
|
async getPublicExistingSwapDetailsAndStatus(swapIds) {
|
|
9022
9469
|
const loggerSource = "getPublicExistingSwapDetailsAndStatus";
|
|
9023
9470
|
try {
|
|
9024
|
-
const result = await SwapUtils.getExistingSwapsDetailsWithFiatAmounts(this._swapProvider, swapIds);
|
|
9471
|
+
const result = await SwapUtils.getExistingSwapsDetailsWithFiatAmounts([this._swapProvider, this._fixedSwapProvider], swapIds);
|
|
9025
9472
|
if (!(result != null && result.result)) {
|
|
9026
9473
|
if (result.reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) {
|
|
9027
9474
|
SwapUtils.safeHandleRequestsLimitExceeding();
|
|
@@ -9098,18 +9545,21 @@ class PublicSwapService {
|
|
|
9098
9545
|
|
|
9099
9546
|
/**
|
|
9100
9547
|
* @param coinOrTicker {Coin|string}
|
|
9548
|
+
* @param [isFixed=true] {boolean} rate type
|
|
9101
9549
|
* @return {string} icon URL (ready to use)
|
|
9102
9550
|
*/
|
|
9103
|
-
getAssetIconUrl(coinOrTicker) {
|
|
9104
|
-
|
|
9551
|
+
getAssetIconUrl(coinOrTicker, isFixed = false) {
|
|
9552
|
+
// TODO: [feature, high] improve this logic - currently hacked to show better icons from fixed provider. task_id=3b6b8c2a9df04a86aaff2e070424b64f
|
|
9553
|
+
return this._fixedSwapProvider.getIconUrl(coinOrTicker);
|
|
9105
9554
|
}
|
|
9106
9555
|
|
|
9107
9556
|
/**
|
|
9108
9557
|
* @param ticker {string}
|
|
9558
|
+
* @param [fixed=false] {boolean}
|
|
9109
9559
|
* @return {Coin|null}
|
|
9110
9560
|
*/
|
|
9111
|
-
getCoinByTickerIfPresent(ticker) {
|
|
9112
|
-
return this._swapProvider.getCoinByTickerIfPresent(ticker);
|
|
9561
|
+
getCoinByTickerIfPresent(ticker, fixed = false) {
|
|
9562
|
+
return !fixed ? this._swapProvider.getCoinByTickerIfPresent(ticker) : this._fixedSwapProvider.getCoinByTickerIfPresent(ticker);
|
|
9113
9563
|
}
|
|
9114
9564
|
|
|
9115
9565
|
/**
|
|
@@ -9119,9 +9569,12 @@ class PublicSwapService {
|
|
|
9119
9569
|
*/
|
|
9120
9570
|
async getAssetToUsdtRate(asset) {
|
|
9121
9571
|
try {
|
|
9122
|
-
var _result$rate;
|
|
9123
|
-
|
|
9124
|
-
|
|
9572
|
+
var _result, _result$rate, _result2;
|
|
9573
|
+
let result = await this._swapProvider.getCoinToUSDTRate(asset);
|
|
9574
|
+
if (((_result = result) == null ? void 0 : _result.rate) == null) {
|
|
9575
|
+
result = await this._fixedSwapProvider.getCoinToUSDTRate(asset);
|
|
9576
|
+
}
|
|
9577
|
+
return (_result$rate = (_result2 = result) == null ? void 0 : _result2.rate) != null ? _result$rate : null;
|
|
9125
9578
|
} catch (e) {
|
|
9126
9579
|
improveAndRethrow(e, "getAssetToUsdtRate");
|
|
9127
9580
|
}
|
|
@@ -9130,11 +9583,12 @@ class PublicSwapService {
|
|
|
9130
9583
|
/**
|
|
9131
9584
|
* @param asset {Coin}
|
|
9132
9585
|
* @param address {string}
|
|
9586
|
+
* @param [fixed=false] {boolean}
|
|
9133
9587
|
* @return {boolean}
|
|
9134
9588
|
*/
|
|
9135
|
-
isAddressValidForAsset(asset, address) {
|
|
9589
|
+
isAddressValidForAsset(asset, address, fixed = false) {
|
|
9136
9590
|
try {
|
|
9137
|
-
return this._swapProvider.isAddressValidForAsset(asset, address);
|
|
9591
|
+
return !fixed ? this._swapProvider.isAddressValidForAsset(asset, address) : this._fixedSwapProvider.isAddressValidForAsset(asset, address);
|
|
9138
9592
|
} catch (e) {
|
|
9139
9593
|
improveAndRethrow(e, "isAddressValidForAsset");
|
|
9140
9594
|
}
|
|
@@ -9144,13 +9598,14 @@ class PublicSwapService {
|
|
|
9144
9598
|
* Retrieves token by contract address.
|
|
9145
9599
|
*
|
|
9146
9600
|
* @param addressString {string}
|
|
9601
|
+
* @param [fixed=false] {boolean}
|
|
9147
9602
|
* @return {Promise<Coin|null>}
|
|
9148
9603
|
*/
|
|
9149
|
-
async getTokenByContractAddress(addressString) {
|
|
9604
|
+
async getTokenByContractAddress(addressString, fixed = false) {
|
|
9150
9605
|
try {
|
|
9151
9606
|
if (!addressString) return null;
|
|
9152
9607
|
const addressLowerCase = addressString.toLowerCase();
|
|
9153
|
-
const allCoins = await this._swapProvider.getAllSupportedCurrencies();
|
|
9608
|
+
const allCoins = await (fixed ? this._fixedSwapProvider : this._swapProvider).getAllSupportedCurrencies();
|
|
9154
9609
|
if (allCoins.result) {
|
|
9155
9610
|
return allCoins.coins.find(coin => coin.tokenAddress && coin.tokenAddress.toLowerCase() === addressLowerCase);
|
|
9156
9611
|
}
|
|
@@ -9162,11 +9617,12 @@ class PublicSwapService {
|
|
|
9162
9617
|
|
|
9163
9618
|
/**
|
|
9164
9619
|
* @param asset {Coin}
|
|
9620
|
+
* @param [fixed=false] {boolean}
|
|
9165
9621
|
* @return {string|null}
|
|
9166
9622
|
*/
|
|
9167
|
-
getExtraIdNameIfPresentForAsset(asset) {
|
|
9623
|
+
getExtraIdNameIfPresentForAsset(asset, fixed = false) {
|
|
9168
9624
|
try {
|
|
9169
|
-
return this._swapProvider.getExtraIdNameIfPresent(asset);
|
|
9625
|
+
return (fixed ? this._fixedSwapProvider : this._swapProvider).getExtraIdNameIfPresent(asset);
|
|
9170
9626
|
} catch (e) {
|
|
9171
9627
|
improveAndRethrow(e, "getExtraIdNameIfPresentForAsset");
|
|
9172
9628
|
}
|