@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.cjs
CHANGED
|
@@ -1655,7 +1655,7 @@ var Logger = /*#__PURE__*/function () {
|
|
|
1655
1655
|
return Logger;
|
|
1656
1656
|
}();
|
|
1657
1657
|
|
|
1658
|
-
function _catch$
|
|
1658
|
+
function _catch$f(body, recover) {
|
|
1659
1659
|
try {
|
|
1660
1660
|
var result = body();
|
|
1661
1661
|
} catch (e) {
|
|
@@ -1671,7 +1671,7 @@ function useCallHandlingErrors() {
|
|
|
1671
1671
|
setState = _useState[1];
|
|
1672
1672
|
return React.useCallback(function (functionToBeCalled, event) {
|
|
1673
1673
|
try {
|
|
1674
|
-
var _temp = _catch$
|
|
1674
|
+
var _temp = _catch$f(function () {
|
|
1675
1675
|
return Promise.resolve(functionToBeCalled(event)).then(function () {});
|
|
1676
1676
|
}, function (error) {
|
|
1677
1677
|
Logger.logError(error, (functionToBeCalled == null ? void 0 : functionToBeCalled.name) || "errorBoundaryTrigger", "Caught by ErrorBoundary");
|
|
@@ -4609,6 +4609,15 @@ function useIsHydrated() {
|
|
|
4609
4609
|
* @return {string|null}
|
|
4610
4610
|
*/
|
|
4611
4611
|
|
|
4612
|
+
/**
|
|
4613
|
+
* Callback to handle isFixed flag change.
|
|
4614
|
+
*
|
|
4615
|
+
* @function
|
|
4616
|
+
* @name onIsFixedChange
|
|
4617
|
+
* @param {boolean} isFixedNewValue - new value
|
|
4618
|
+
* @return {void}
|
|
4619
|
+
*/
|
|
4620
|
+
|
|
4612
4621
|
/**
|
|
4613
4622
|
* Function validating addresses.
|
|
4614
4623
|
* By default, will treat any addresses as valid.
|
|
@@ -4618,6 +4627,7 @@ function useIsHydrated() {
|
|
|
4618
4627
|
* @name validateAddressByTicker
|
|
4619
4628
|
* @param {string} ticker - Ticker symbol of the asset.
|
|
4620
4629
|
* @param {string} address - Address to be validated
|
|
4630
|
+
* @param {boolean} isFixed - Is swap rate mode = fixed
|
|
4621
4631
|
* @return {Promise<boolean>}
|
|
4622
4632
|
*/
|
|
4623
4633
|
|
|
@@ -4665,16 +4675,18 @@ function useIsHydrated() {
|
|
|
4665
4675
|
* @param {boolean} [props.formHasFiat] - Indicates if the form supports fiat currency.
|
|
4666
4676
|
* @param {string|null} [props.termsOfUseUrl] - Terms of use URL, shown only if both terms & privacy policy passed.
|
|
4667
4677
|
* @param {string|null} [props.privacyPolicyUrl] - Privacy policy of use URL, shown only if both terms & privacy policy passed.
|
|
4678
|
+
* @param {string} props.recipientAddressExtraIdName - Extra ID name for the recipient address.
|
|
4679
|
+
* @param {string} props.refundAddressExtraIdName - Extra ID name for the refund address.
|
|
4668
4680
|
* @param {object} [props.translations] - Object containing translations, default English texts will be used if omitted.
|
|
4669
4681
|
* @param {string} props.swapSeparatorIconSrc - Source URL for the swap separator icon.
|
|
4670
4682
|
* @param {boolean} props.swapButtonAlwaysActive - Setting that allows the form state to proceed to the next step regardless of validity.
|
|
4671
|
-
* @param {getExtraIdNameByTicker} props.getExtraIdNameByTicker - Function returning extraId name for asset
|
|
4672
4683
|
* @param {validateAddressByTicker} [props.validateAddressByTicker] - Function validating address
|
|
4684
|
+
* @param {onIsFixedChange} [props.onIsFixedChange] - callback for changed isFixed
|
|
4673
4685
|
* @return {JSX.Element} Rendered SwapForm component.
|
|
4674
4686
|
* @constructor
|
|
4675
4687
|
*/
|
|
4676
4688
|
|
|
4677
|
-
function _catch$
|
|
4689
|
+
function _catch$e(body, recover) {
|
|
4678
4690
|
try {
|
|
4679
4691
|
var result = body();
|
|
4680
4692
|
} catch (e) {
|
|
@@ -4686,7 +4698,7 @@ function _catch$c(body, recover) {
|
|
|
4686
4698
|
return result;
|
|
4687
4699
|
}
|
|
4688
4700
|
var SwapForm = function SwapForm(_ref) {
|
|
4689
|
-
var _isFixedRate$current2, _maximumAmount$curren4, _maximumAmount$curren5, _maximumAmount$curren6, _minimalAmount$curren5
|
|
4701
|
+
var _isFixedRate$current2, _isFixedRate$current3, _maximumAmount$curren4, _maximumAmount$curren5, _maximumAmount$curren6, _minimalAmount$curren5;
|
|
4690
4702
|
var sendingAssetTicker = _ref.sendingAssetTicker,
|
|
4691
4703
|
receivingAssetTicker = _ref.receivingAssetTicker,
|
|
4692
4704
|
_ref$sendingAssetDeci = _ref.sendingAssetDecimalCount,
|
|
@@ -4729,7 +4741,7 @@ var SwapForm = function SwapForm(_ref) {
|
|
|
4729
4741
|
_ref$formHasBalance = _ref.formHasBalance,
|
|
4730
4742
|
formHasBalance = _ref$formHasBalance === void 0 ? false : _ref$formHasBalance,
|
|
4731
4743
|
_ref$retrieveSwapDeta = _ref.retrieveSwapDetails,
|
|
4732
|
-
retrieveSwapDetails = _ref$retrieveSwapDeta === void 0 ? function (sendingAssetTicker, receivingAssetTicker, amount, isSwapAll) {
|
|
4744
|
+
retrieveSwapDetails = _ref$retrieveSwapDeta === void 0 ? function (sendingAssetTicker, receivingAssetTicker, amount, isSwapAll, editedLastInput) {
|
|
4733
4745
|
return Promise.resolve();
|
|
4734
4746
|
} : _ref$retrieveSwapDeta,
|
|
4735
4747
|
_ref$retrieveInitialS = _ref.retrieveInitialSwapData,
|
|
@@ -4756,17 +4768,17 @@ var SwapForm = function SwapForm(_ref) {
|
|
|
4756
4768
|
termsOfUseUrl = _ref$termsOfUseUrl === void 0 ? null : _ref$termsOfUseUrl,
|
|
4757
4769
|
_ref$privacyPolicyUrl = _ref.privacyPolicyUrl,
|
|
4758
4770
|
privacyPolicyUrl = _ref$privacyPolicyUrl === void 0 ? null : _ref$privacyPolicyUrl,
|
|
4759
|
-
_ref$getExtraIdNameBy = _ref.getExtraIdNameByTicker,
|
|
4760
|
-
getExtraIdNameByTicker = _ref$getExtraIdNameBy === void 0 ? function (ticker) {
|
|
4761
|
-
return null;
|
|
4762
|
-
} : _ref$getExtraIdNameBy,
|
|
4763
4771
|
_ref$validateAddressB = _ref.validateAddressByTicker,
|
|
4764
|
-
validateAddressByTicker = _ref$validateAddressB === void 0 ? function (
|
|
4772
|
+
validateAddressByTicker = _ref$validateAddressB === void 0 ? function () {
|
|
4765
4773
|
return false;
|
|
4766
4774
|
} : _ref$validateAddressB,
|
|
4767
4775
|
swapSeparatorIconSrc = _ref.swapSeparatorIconSrc,
|
|
4768
4776
|
_ref$swapButtonAlways = _ref.swapButtonAlwaysActive,
|
|
4769
4777
|
swapButtonAlwaysActive = _ref$swapButtonAlways === void 0 ? false : _ref$swapButtonAlways,
|
|
4778
|
+
_ref$onIsFixedChange = _ref.onIsFixedChange,
|
|
4779
|
+
onIsFixedChange = _ref$onIsFixedChange === void 0 ? function () {} : _ref$onIsFixedChange,
|
|
4780
|
+
recipientAddressExtraIdName = _ref.recipientAddressExtraIdName,
|
|
4781
|
+
refundAddressExtraIdName = _ref.refundAddressExtraIdName,
|
|
4770
4782
|
_ref$translations = _ref.translations,
|
|
4771
4783
|
translations = _ref$translations === void 0 ? {
|
|
4772
4784
|
swapAllButtonTitles: {
|
|
@@ -4797,7 +4809,9 @@ var SwapForm = function SwapForm(_ref) {
|
|
|
4797
4809
|
addressTitle: "Recepient address",
|
|
4798
4810
|
refundAddressTitle: "Refund address",
|
|
4799
4811
|
extraIdPlaceholder: "(optional)",
|
|
4812
|
+
refundAddressExtraIdTitle: "Refund extra ID (MEMO):",
|
|
4800
4813
|
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.",
|
|
4814
|
+
receivingAddressExtraIdTitle: "Destination extra ID (MEMO):",
|
|
4801
4815
|
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."
|
|
4802
4816
|
},
|
|
4803
4817
|
rateSelector: {
|
|
@@ -4819,15 +4833,18 @@ var SwapForm = function SwapForm(_ref) {
|
|
|
4819
4833
|
var _useReferredState = useReferredState(preservedAmount == null || preservedAmount === "" ? null : preservedAmount),
|
|
4820
4834
|
sendAssetAmount = _useReferredState[0],
|
|
4821
4835
|
setSendAssetAmount = _useReferredState[1];
|
|
4836
|
+
var _useReferredState2 = useReferredState(null),
|
|
4837
|
+
receiveAssetAmount = _useReferredState2[0],
|
|
4838
|
+
setReceiveAssetAmount = _useReferredState2[1];
|
|
4822
4839
|
var _useState3 = React.useState(),
|
|
4823
4840
|
swapRate = _useState3[0],
|
|
4824
4841
|
setSwapRate = _useState3[1];
|
|
4825
|
-
var _useReferredState2 = useReferredState(null),
|
|
4826
|
-
minimalAmount = _useReferredState2[0],
|
|
4827
|
-
setMinimalAmount = _useReferredState2[1];
|
|
4828
4842
|
var _useReferredState3 = useReferredState(null),
|
|
4829
|
-
|
|
4830
|
-
|
|
4843
|
+
minimalAmount = _useReferredState3[0],
|
|
4844
|
+
setMinimalAmount = _useReferredState3[1];
|
|
4845
|
+
var _useReferredState4 = useReferredState(null),
|
|
4846
|
+
maximumAmount = _useReferredState4[0],
|
|
4847
|
+
setMaximumAmount = _useReferredState4[1];
|
|
4831
4848
|
var _useState4 = React.useState(),
|
|
4832
4849
|
validationContent = _useState4[0],
|
|
4833
4850
|
setValidationContent = _useState4[1];
|
|
@@ -4854,70 +4871,76 @@ var SwapForm = function SwapForm(_ref) {
|
|
|
4854
4871
|
var _useState11 = React.useState(preservedAmount == null || String(preservedAmount) === "0"),
|
|
4855
4872
|
isAmountZero = _useState11[0],
|
|
4856
4873
|
setIsAmountZero = _useState11[1];
|
|
4857
|
-
var
|
|
4858
|
-
isLoading =
|
|
4859
|
-
setIsLoading =
|
|
4860
|
-
var _useReferredState5 = useReferredState(null),
|
|
4861
|
-
isFixedRate = _useReferredState5[0],
|
|
4862
|
-
setIsFixedRate = _useReferredState5[1];
|
|
4863
|
-
var _useState12 = React.useState(composeConfirmButtonTo(sendingAssetTicker, receivingAssetTicker, preservedAmount)),
|
|
4864
|
-
confirmButtonTo = _useState12[0],
|
|
4865
|
-
setConfirmButtonTo = _useState12[1];
|
|
4866
|
-
var _useState13 = React.useState(),
|
|
4867
|
-
transactionFee = _useState13[0],
|
|
4868
|
-
setTransactionFee = _useState13[1];
|
|
4869
|
-
var _useState14 = React.useState(true),
|
|
4870
|
-
balanceValid = _useState14[0],
|
|
4871
|
-
setBalanceValid = _useState14[1]; // Whether the amount is less than total balance
|
|
4874
|
+
var _useReferredState5 = useReferredState(false),
|
|
4875
|
+
isLoading = _useReferredState5[0],
|
|
4876
|
+
setIsLoading = _useReferredState5[1]; // Whether the form is in the progress of loading some data (new rates, for example)
|
|
4872
4877
|
var _useReferredState6 = useReferredState(null),
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
var
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
+
isFixedRate = _useReferredState6[0],
|
|
4879
|
+
setIsFixedRate = _useReferredState6[1];
|
|
4880
|
+
var _useState12 = React.useState(false),
|
|
4881
|
+
isLastEditedReceiving = _useState12[0],
|
|
4882
|
+
setIsLastEditedReceiving = _useState12[1];
|
|
4883
|
+
var _useState13 = React.useState(composeConfirmButtonTo(sendingAssetTicker, receivingAssetTicker, preservedAmount)),
|
|
4884
|
+
confirmButtonTo = _useState13[0],
|
|
4885
|
+
setConfirmButtonTo = _useState13[1];
|
|
4886
|
+
var _useState14 = React.useState(),
|
|
4887
|
+
transactionFee = _useState14[0],
|
|
4888
|
+
setTransactionFee = _useState14[1];
|
|
4889
|
+
var _useState15 = React.useState(true),
|
|
4890
|
+
balanceValid = _useState15[0],
|
|
4891
|
+
setBalanceValid = _useState15[1]; // Whether the amount is less than total balance
|
|
4878
4892
|
var _useReferredState7 = useReferredState(null),
|
|
4879
|
-
|
|
4880
|
-
|
|
4893
|
+
isSwapAll = _useReferredState7[0],
|
|
4894
|
+
setIsSwapAll = _useReferredState7[1];
|
|
4895
|
+
var _useState16 = React.useState([]),
|
|
4896
|
+
swapAllButtonLoaderReSetter = _useState16[0],
|
|
4897
|
+
setSwapAllButtonLoaderReSetter = _useState16[1];
|
|
4881
4898
|
var _useReferredState8 = useReferredState(null),
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
var _useReferredState9 = useReferredState(
|
|
4885
|
-
|
|
4886
|
-
|
|
4899
|
+
dataUpdateTimeoutId = _useReferredState8[0],
|
|
4900
|
+
setDataUpdateTimeoutId = _useReferredState8[1];
|
|
4901
|
+
var _useReferredState9 = useReferredState(null),
|
|
4902
|
+
idleDataUpdateTimeoutId = _useReferredState9[0],
|
|
4903
|
+
setIdleDataUpdateTimeoutId = _useReferredState9[1];
|
|
4887
4904
|
var _useReferredState10 = useReferredState(""),
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
var _useReferredState11 = useReferredState(
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
var
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
var
|
|
4897
|
-
|
|
4898
|
-
|
|
4905
|
+
recipientAddress = _useReferredState10[0],
|
|
4906
|
+
setRecipientAddress = _useReferredState10[1];
|
|
4907
|
+
var _useReferredState11 = useReferredState(""),
|
|
4908
|
+
recipientAddressExtraId = _useReferredState11[0],
|
|
4909
|
+
setRecipientAddressExtraId = _useReferredState11[1];
|
|
4910
|
+
var _useReferredState12 = useReferredState(false),
|
|
4911
|
+
isRecipientAddressValid = _useReferredState12[0],
|
|
4912
|
+
setIsRecipientAddressValid = _useReferredState12[1];
|
|
4913
|
+
var _useState17 = React.useState(false),
|
|
4914
|
+
isRefundAddressRequired = _useState17[0],
|
|
4915
|
+
setIsRefundAddressRequired = _useState17[1];
|
|
4899
4916
|
var _useReferredState13 = useReferredState(""),
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
var _useReferredState14 = useReferredState(
|
|
4903
|
-
|
|
4904
|
-
|
|
4917
|
+
refundAddress = _useReferredState13[0],
|
|
4918
|
+
setRefundAddress = _useReferredState13[1];
|
|
4919
|
+
var _useReferredState14 = useReferredState(""),
|
|
4920
|
+
refundAddressExtraId = _useReferredState14[0],
|
|
4921
|
+
setRefundAddressExtraId = _useReferredState14[1];
|
|
4922
|
+
var _useReferredState15 = useReferredState(false),
|
|
4923
|
+
isRefundAddressValid = _useReferredState15[0],
|
|
4924
|
+
setIsRefundAddressValid = _useReferredState15[1];
|
|
4905
4925
|
var callHandlingErrors = useCallHandlingErrors();
|
|
4906
4926
|
var isHydrated = useIsHydrated();
|
|
4907
4927
|
var recalculationDelayOnTyping = 1000;
|
|
4908
4928
|
var isAddressFieldEnabled = !formHasBalance;
|
|
4909
4929
|
var displayRateSelector = !formHasBalance;
|
|
4910
|
-
var recipientAddressExtraIdName = getExtraIdNameByTicker(receivingAssetTicker);
|
|
4911
|
-
var refundAddressExtraIdName = getExtraIdNameByTicker(sendingAssetTicker);
|
|
4912
4930
|
var handleSendAssetAmountChange = function handleSendAssetAmountChange(amount) {
|
|
4931
|
+
setIsLastEditedReceiving(false);
|
|
4932
|
+
var receiveAmount = AmountUtils.trim(bignumber_js.BigNumber(amount).times(swapRate), receivingAssetDecimalCount);
|
|
4913
4933
|
if (amount != null && amount !== "") {
|
|
4914
|
-
|
|
4934
|
+
setReceiveAssetAmount(receiveAmount);
|
|
4935
|
+
setUpdateReceiveInputTo(receiveAmount);
|
|
4915
4936
|
} else {
|
|
4916
4937
|
setUpdateReceiveInputTo("");
|
|
4917
4938
|
}
|
|
4918
4939
|
setSendAssetAmount(amount);
|
|
4919
4940
|
};
|
|
4920
4941
|
var handleReceiveAssetAmountChange = function handleReceiveAssetAmountChange(amount) {
|
|
4942
|
+
setReceiveAssetAmount(amount);
|
|
4943
|
+
setIsLastEditedReceiving(true);
|
|
4921
4944
|
var sendAssetAmount = "";
|
|
4922
4945
|
if (amount != null && amount !== "") {
|
|
4923
4946
|
sendAssetAmount = AmountUtils.trim(bignumber_js.BigNumber(amount).div(swapRate), sendingAssetDecimalCount);
|
|
@@ -5018,7 +5041,7 @@ var SwapForm = function SwapForm(_ref) {
|
|
|
5018
5041
|
}
|
|
5019
5042
|
(function () {
|
|
5020
5043
|
try {
|
|
5021
|
-
return _catch$
|
|
5044
|
+
return _catch$e(function () {
|
|
5022
5045
|
var _minimalAmount$curren4, _maximumAmount$curren3, _isFixedRate$current;
|
|
5023
5046
|
var dataMemento = {
|
|
5024
5047
|
rate: swapRate,
|
|
@@ -5036,7 +5059,7 @@ var SwapForm = function SwapForm(_ref) {
|
|
|
5036
5059
|
setIsSameCoins(false);
|
|
5037
5060
|
setIsPairSupported(true);
|
|
5038
5061
|
setIsSwapCalculated(false);
|
|
5039
|
-
return Promise.resolve(retrieveSwapDetails(sendingAssetTicker, receivingAssetTicker, amount, isSwapAll.current, (_isFixedRate$current = isFixedRate.current) != null ? _isFixedRate$current : IS_FIXED_BY_DEFAULT)).then(function (response) {
|
|
5062
|
+
return Promise.resolve(retrieveSwapDetails(sendingAssetTicker, receivingAssetTicker, amount, isSwapAll.current, (_isFixedRate$current = isFixedRate.current) != null ? _isFixedRate$current : IS_FIXED_BY_DEFAULT, isFixedRate.current ? isLastEditedReceiving : false)).then(function (response) {
|
|
5040
5063
|
if (!isSwapAll.current && String(amount) !== String(isForPreserved && sendAssetAmount.current == null ? preservedAmount : sendAssetAmount.current)) {
|
|
5041
5064
|
// Means amount changed and we no more need to do this exact calculation
|
|
5042
5065
|
return;
|
|
@@ -5084,7 +5107,7 @@ var SwapForm = function SwapForm(_ref) {
|
|
|
5084
5107
|
}
|
|
5085
5108
|
(function () {
|
|
5086
5109
|
try {
|
|
5087
|
-
return _catch$
|
|
5110
|
+
return _catch$e(function () {
|
|
5088
5111
|
setIsLoading(true);
|
|
5089
5112
|
setMinimalAmount(null);
|
|
5090
5113
|
setMaximumAmount(null);
|
|
@@ -5124,7 +5147,7 @@ var SwapForm = function SwapForm(_ref) {
|
|
|
5124
5147
|
};
|
|
5125
5148
|
var handleRateModeChanged = function handleRateModeChanged(isFixed) {
|
|
5126
5149
|
setIsFixedRate(isFixed);
|
|
5127
|
-
requestDataRefresh(sendAssetAmount.current, true);
|
|
5150
|
+
requestDataRefresh(isLastEditedReceiving ? receiveAssetAmount.current : sendAssetAmount.current, true);
|
|
5128
5151
|
};
|
|
5129
5152
|
React.useEffect(function () {
|
|
5130
5153
|
if (isSwapAll.current === true) {
|
|
@@ -5134,6 +5157,10 @@ var SwapForm = function SwapForm(_ref) {
|
|
|
5134
5157
|
}
|
|
5135
5158
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5136
5159
|
}, [isSwapAll.current]);
|
|
5160
|
+
React.useEffect(function () {
|
|
5161
|
+
onIsFixedChange(isFixedRate.current);
|
|
5162
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5163
|
+
}, [isFixedRate.current]);
|
|
5137
5164
|
React.useEffect(function () {
|
|
5138
5165
|
setConfirmButtonTo(composeConfirmButtonTo(sendingAssetTicker, receivingAssetTicker, sendAssetAmount.current || preservedAmount || null));
|
|
5139
5166
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -5143,7 +5170,7 @@ var SwapForm = function SwapForm(_ref) {
|
|
|
5143
5170
|
var isCurrentAmountNotZero = sendAssetAmount.current && !bignumber_js.BigNumber("0").eq(sendAssetAmount.current);
|
|
5144
5171
|
var isPreservedAmountNotZero = preservedAmount && !bignumber_js.BigNumber("0").eq(preservedAmount);
|
|
5145
5172
|
if (isCurrentAmountNotZero) {
|
|
5146
|
-
loadFullEstimation(sendAssetAmount.current);
|
|
5173
|
+
loadFullEstimation(isLastEditedReceiving ? receiveAssetAmount.current : sendAssetAmount.current);
|
|
5147
5174
|
} else if (isPreservedAmountNotZero) {
|
|
5148
5175
|
loadFullEstimation(preservedAmount, true);
|
|
5149
5176
|
} else {
|
|
@@ -5182,7 +5209,7 @@ var SwapForm = function SwapForm(_ref) {
|
|
|
5182
5209
|
};
|
|
5183
5210
|
if (!receivingAssetTicker) return;
|
|
5184
5211
|
var _temp = recipientAddress.current === "";
|
|
5185
|
-
return _temp ? _temp2(false) : Promise.resolve(validateAddressByTicker(receivingAssetTicker, recipientAddress.current)).then(_temp2);
|
|
5212
|
+
return _temp ? _temp2(false) : Promise.resolve(validateAddressByTicker(receivingAssetTicker, recipientAddress.current, isFixedRate.current)).then(_temp2);
|
|
5186
5213
|
} catch (e) {
|
|
5187
5214
|
Promise.reject(e);
|
|
5188
5215
|
}
|
|
@@ -5197,7 +5224,7 @@ var SwapForm = function SwapForm(_ref) {
|
|
|
5197
5224
|
};
|
|
5198
5225
|
if (!sendingAssetTicker || !isRefundAddressRequired) return;
|
|
5199
5226
|
var _temp3 = refundAddress.current === "";
|
|
5200
|
-
return _temp3 ? _temp4(false) : Promise.resolve(validateAddressByTicker(sendingAssetTicker, refundAddress.current)).then(_temp4);
|
|
5227
|
+
return _temp3 ? _temp4(false) : Promise.resolve(validateAddressByTicker(sendingAssetTicker, refundAddress.current, isFixedRate.current)).then(_temp4);
|
|
5201
5228
|
} catch (e) {
|
|
5202
5229
|
Promise.reject(e);
|
|
5203
5230
|
}
|
|
@@ -5210,7 +5237,7 @@ var SwapForm = function SwapForm(_ref) {
|
|
|
5210
5237
|
if (readyToSwap) {
|
|
5211
5238
|
timeoutId = setTimeout(function () {
|
|
5212
5239
|
var _sendAssetAmount$curr;
|
|
5213
|
-
return requestDataRefresh((_sendAssetAmount$curr = sendAssetAmount.current) != null ? _sendAssetAmount$curr : preservedAmount, true);
|
|
5240
|
+
return requestDataRefresh(isLastEditedReceiving ? receiveAssetAmount.current : (_sendAssetAmount$curr = sendAssetAmount.current) != null ? _sendAssetAmount$curr : preservedAmount, true);
|
|
5214
5241
|
}, DETAIL_REFRESH_INTERVAL_MS);
|
|
5215
5242
|
setIdleDataUpdateTimeoutId(timeoutId);
|
|
5216
5243
|
} else {
|
|
@@ -5222,8 +5249,6 @@ var SwapForm = function SwapForm(_ref) {
|
|
|
5222
5249
|
};
|
|
5223
5250
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5224
5251
|
}, [readyToSwap]);
|
|
5225
|
-
|
|
5226
|
-
// TODO: [refactoring, critical] this code looks like a hack related to task_id=6e328d39063142b7b9fa01d497e616da
|
|
5227
5252
|
React.useEffect(function () {
|
|
5228
5253
|
if (triggerDataUpdateResetting) {
|
|
5229
5254
|
clearTimeout(dataUpdateTimeoutId.current);
|
|
@@ -5233,8 +5258,6 @@ var SwapForm = function SwapForm(_ref) {
|
|
|
5233
5258
|
}
|
|
5234
5259
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5235
5260
|
}, [triggerDataUpdateResetting]);
|
|
5236
|
-
|
|
5237
|
-
// Resets the passed "set value to" param to null, so it can be used multiple times with any value
|
|
5238
5261
|
React.useEffect(function () {
|
|
5239
5262
|
if (!!updateSendInputTo) setUpdateSendInputTo(null);
|
|
5240
5263
|
if (!!updateReceiveInputTo) setUpdateReceiveInputTo(null);
|
|
@@ -5253,13 +5276,12 @@ var SwapForm = function SwapForm(_ref) {
|
|
|
5253
5276
|
}
|
|
5254
5277
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5255
5278
|
}, [isLoading.current, swapAllButtonLoaderReSetter]);
|
|
5256
|
-
|
|
5257
|
-
// Handlers upon changing the asset amount
|
|
5258
5279
|
React.useEffect(function () {
|
|
5259
5280
|
setConfirmButtonTo(composeConfirmButtonTo(sendingAssetTicker, receivingAssetTicker, sendAssetAmount.current));
|
|
5260
5281
|
if (sendAssetAmount.current == null) return;
|
|
5261
5282
|
var processingAmount = sendAssetAmount.current === "" ? "0" : sendAssetAmount.current;
|
|
5262
|
-
|
|
5283
|
+
var processingReceivingAmount = receiveAssetAmount.current === "" ? "0" : receiveAssetAmount.current;
|
|
5284
|
+
requestDataRefresh(isLastEditedReceiving ? processingReceivingAmount : processingAmount);
|
|
5263
5285
|
processMinMaxAmounts(processingAmount);
|
|
5264
5286
|
setIsAmountZero(bignumber_js.BigNumber("0").eq(processingAmount));
|
|
5265
5287
|
setIsSwapCalculated(false);
|
|
@@ -5274,7 +5296,13 @@ var SwapForm = function SwapForm(_ref) {
|
|
|
5274
5296
|
linkText: !formHasBalance ? "" : isSwapAll.current ? translations.swapAllButtonTitles.cancel : translations.swapAllButtonTitles.enable,
|
|
5275
5297
|
linkButtonLoader: true,
|
|
5276
5298
|
isLinkButtonDisabled: isLoading.current || sendingAssetTicker === receivingAssetTicker || bignumber_js.BigNumber(sendingAssetBalance == null ? void 0 : sendingAssetBalance.assetAmount).eq(0)
|
|
5277
|
-
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5299
|
+
}, displayRateSelector ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5300
|
+
className: s$9["swap-form-rate-selector"]
|
|
5301
|
+
}, /*#__PURE__*/React__default["default"].createElement(RateSelector, {
|
|
5302
|
+
isFixed: (_isFixedRate$current2 = isFixedRate.current) != null ? _isFixedRate$current2 : IS_FIXED_BY_DEFAULT,
|
|
5303
|
+
setIsFixed: handleRateModeChanged,
|
|
5304
|
+
translations: translations.rateSelector
|
|
5305
|
+
})) : "", /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5278
5306
|
className: s$9["swap-form-inputs"]
|
|
5279
5307
|
}, /*#__PURE__*/React__default["default"].createElement(AmountInput, {
|
|
5280
5308
|
ticker: sendingAssetTicker,
|
|
@@ -5322,7 +5350,7 @@ var SwapForm = function SwapForm(_ref) {
|
|
|
5322
5350
|
assetIconProtocolSrc: receivingAssetProtocolIconSrc,
|
|
5323
5351
|
fallbackAssetIconSrc: fallBackAssetIconSrc,
|
|
5324
5352
|
disabled: isSwapAll.current || sendingAssetTicker === null || receivingAssetTicker === null,
|
|
5325
|
-
locked: !formHasBalance,
|
|
5353
|
+
locked: !formHasBalance && !isFixedRate.current,
|
|
5326
5354
|
handleCoinAmountChange: handleReceiveAssetAmountChange,
|
|
5327
5355
|
handleChangeAssetClick: handleChangeReceivingAssetClick,
|
|
5328
5356
|
updateAssetInputTo: updateReceiveInputTo,
|
|
@@ -5342,7 +5370,7 @@ var SwapForm = function SwapForm(_ref) {
|
|
|
5342
5370
|
className: s$9["swap-form-information-field"]
|
|
5343
5371
|
}, /*#__PURE__*/React__default["default"].createElement("p", null, !isPairSupported ? translations.informationBlock.pairNotAvailable : transactionFee && minimalAmountValid ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, translations.informationBlock.transactionFee, /*#__PURE__*/React__default["default"].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__default["default"].createElement("span", {
|
|
5344
5372
|
className: s$9["semi-transparent"]
|
|
5345
|
-
}, " ~ " + AmountUtils.fiat(transactionFee == null ? void 0 : transactionFee.fiat, fiatCurrencyCode)) : "") : !isLoading.current && (isSwapCalculated || !minimalAmount.current && swapRate) ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, translations.informationBlock.swapRate, /*#__PURE__*/React__default["default"].createElement("span", null, AmountUtils.composeRateText(sendingAssetTickerPrintable, receivingAssetTickerPrintable, swapRate, receivingAssetDecimalCount, (_isFixedRate$
|
|
5373
|
+
}, " ~ " + AmountUtils.fiat(transactionFee == null ? void 0 : transactionFee.fiat, fiatCurrencyCode)) : "") : !isLoading.current && (isSwapCalculated || !minimalAmount.current && swapRate) ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, translations.informationBlock.swapRate, /*#__PURE__*/React__default["default"].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__default["default"].createElement(React__default["default"].Fragment, null, translations.informationBlock.maximumAmount, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
5346
5374
|
className: s$9["interactable"] + " " + s$9["red"],
|
|
5347
5375
|
onClick: isLoading.current ? function () {} : function (e) {
|
|
5348
5376
|
return callHandlingErrors(handleMaximumAmountClick, e);
|
|
@@ -5369,7 +5397,7 @@ var SwapForm = function SwapForm(_ref) {
|
|
|
5369
5397
|
adaptiveHeight: true,
|
|
5370
5398
|
errorEncountered: recipientAddress.current !== "" && !isRecipientAddressValid.current
|
|
5371
5399
|
})), isHydrated && recipientAddressExtraIdName ? /*#__PURE__*/React__default["default"].createElement(TitleBox, {
|
|
5372
|
-
title:
|
|
5400
|
+
title: translations.addressFields.receivingAddressExtraIdTitle,
|
|
5373
5401
|
titleNoticeText: translations.addressFields.receivingAddressExtraIdNotice,
|
|
5374
5402
|
titleNoticePosition: TOOLTIP_POSITIONS.TOP_LEFT
|
|
5375
5403
|
}, /*#__PURE__*/React__default["default"].createElement(Textarea, {
|
|
@@ -5391,7 +5419,7 @@ var SwapForm = function SwapForm(_ref) {
|
|
|
5391
5419
|
adaptiveHeight: true,
|
|
5392
5420
|
errorEncountered: refundAddress.current !== "" && !isRefundAddressValid.current
|
|
5393
5421
|
})), refundAddressExtraIdName ? /*#__PURE__*/React__default["default"].createElement(TitleBox, {
|
|
5394
|
-
title:
|
|
5422
|
+
title: translations.addressFields.refundAddressExtraIdTitle,
|
|
5395
5423
|
titleNoticeText: translations.addressFields.refundAddressExtraIdNotice,
|
|
5396
5424
|
titleNoticePosition: TOOLTIP_POSITIONS.TOP_LEFT
|
|
5397
5425
|
}, /*#__PURE__*/React__default["default"].createElement(Textarea, {
|
|
@@ -5402,13 +5430,7 @@ var SwapForm = function SwapForm(_ref) {
|
|
|
5402
5430
|
value: refundAddressExtraId.current,
|
|
5403
5431
|
adaptiveHeight: true,
|
|
5404
5432
|
placeholder: translations.addressFields.extraIdPlaceholder
|
|
5405
|
-
})) : null) : null) : null,
|
|
5406
|
-
className: s$9["swap-form-rate-selector"]
|
|
5407
|
-
}, /*#__PURE__*/React__default["default"].createElement(RateSelector, {
|
|
5408
|
-
isFixed: (_isFixedRate$current3 = isFixedRate.current) != null ? _isFixedRate$current3 : IS_FIXED_BY_DEFAULT,
|
|
5409
|
-
setIsFixed: !isLoading.current ? handleRateModeChanged : function () {},
|
|
5410
|
-
translations: translations.rateSelector
|
|
5411
|
-
})) : "", validationContent ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5433
|
+
})) : null) : null) : null, validationContent ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5412
5434
|
className: s$9["swap-form-validation-text"]
|
|
5413
5435
|
}, /*#__PURE__*/React__default["default"].createElement(Validation, {
|
|
5414
5436
|
text: validationContent
|
|
@@ -5429,7 +5451,7 @@ var SwapForm = function SwapForm(_ref) {
|
|
|
5429
5451
|
mode: "primary",
|
|
5430
5452
|
content: translations.confirmButtonText,
|
|
5431
5453
|
onClick: function onClick(resetButtonLoader) {
|
|
5432
|
-
return handleConfirmButtonClick(resetButtonLoader, setValidationContent, setBalanceValid, setMinimalAmountValid, setMaximumAmountValid, setIsPairSupported, setIsSameCoins, recipientAddress.current, recipientAddressExtraId.current, refundAddress.current, refundAddressExtraId.current);
|
|
5454
|
+
return handleConfirmButtonClick(resetButtonLoader, setValidationContent, setBalanceValid, setMinimalAmountValid, setMaximumAmountValid, setIsPairSupported, setIsSameCoins, recipientAddress.current, recipientAddressExtraId.current, refundAddress.current, refundAddressExtraId.current, isLastEditedReceiving);
|
|
5433
5455
|
},
|
|
5434
5456
|
fullWidthOnMobiles: true,
|
|
5435
5457
|
isDisabled: !readyToSwap,
|
|
@@ -5475,7 +5497,12 @@ SwapForm.propTypes = {
|
|
|
5475
5497
|
fiatCurrencyCode: PropTypes.oneOfType([PropTypes.string, null]),
|
|
5476
5498
|
fiatCurrencyDecimals: PropTypes.oneOfType([PropTypes.number, null]),
|
|
5477
5499
|
formHasFiat: PropTypes.bool,
|
|
5500
|
+
termsOfUseUrl: PropTypes.oneOfType([PropTypes.string, null]),
|
|
5501
|
+
privacyPolicyUrl: PropTypes.oneOfType([PropTypes.string, null]),
|
|
5502
|
+
recipientAddressExtraIdName: PropTypes.string,
|
|
5503
|
+
refundAddressExtraIdName: PropTypes.string,
|
|
5478
5504
|
translations: PropTypes.object,
|
|
5505
|
+
validateAddressByTicker: PropTypes.func,
|
|
5479
5506
|
swapSeparatorIconSrc: PropTypes.string.isRequired,
|
|
5480
5507
|
swapButtonAlwaysActive: PropTypes.bool
|
|
5481
5508
|
};
|
|
@@ -5508,6 +5535,11 @@ SwapForm.defaultProps = {
|
|
|
5508
5535
|
fiatCurrencyCode: null,
|
|
5509
5536
|
fiatCurrencyDecimals: null,
|
|
5510
5537
|
formHasFiat: true,
|
|
5538
|
+
termsOfUseUrl: null,
|
|
5539
|
+
privacyPolicyUrl: null,
|
|
5540
|
+
validateAddressByTicker: function validateAddressByTicker(ticker) {
|
|
5541
|
+
return false;
|
|
5542
|
+
},
|
|
5511
5543
|
swapButtonAlwaysActive: false
|
|
5512
5544
|
};
|
|
5513
5545
|
|
|
@@ -5519,7 +5551,7 @@ SwapForm.defaultProps = {
|
|
|
5519
5551
|
* @return {Promise<string>} xml string of generated svg image
|
|
5520
5552
|
*/
|
|
5521
5553
|
|
|
5522
|
-
function _catch$
|
|
5554
|
+
function _catch$d(body, recover) {
|
|
5523
5555
|
try {
|
|
5524
5556
|
var result = body();
|
|
5525
5557
|
} catch (e) {
|
|
@@ -5532,7 +5564,7 @@ function _catch$b(body, recover) {
|
|
|
5532
5564
|
}
|
|
5533
5565
|
var generateQrAndShowInCanvas = function generateQrAndShowInCanvas(encodingString) {
|
|
5534
5566
|
try {
|
|
5535
|
-
return Promise.resolve(_catch$
|
|
5567
|
+
return Promise.resolve(_catch$d(function () {
|
|
5536
5568
|
return Promise.resolve(QRCode__default["default"].toString(encodingString, {
|
|
5537
5569
|
type: "svg"
|
|
5538
5570
|
}));
|
|
@@ -5546,9 +5578,23 @@ var generateQrAndShowInCanvas = function generateQrAndShowInCanvas(encodingStrin
|
|
|
5546
5578
|
|
|
5547
5579
|
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"};
|
|
5548
5580
|
|
|
5549
|
-
|
|
5581
|
+
/**
|
|
5582
|
+
* QrCode component renders a QR code for a provided crypto address.
|
|
5583
|
+
*
|
|
5584
|
+
* @component
|
|
5585
|
+
* @example
|
|
5586
|
+
* const address = "0x123456789abcdef";
|
|
5587
|
+
* const fill = true;
|
|
5588
|
+
* return <QrCode address={address} fill={fill} />;
|
|
5589
|
+
*
|
|
5590
|
+
* @param {Object} props - The props for the component.
|
|
5591
|
+
* @param {string} props.address - The crypto address to generate the QR code for.
|
|
5592
|
+
* @param {boolean} [props.fill=false] - If true, applies additional CSS class to fill the container.
|
|
5593
|
+
*
|
|
5594
|
+
* @returns {JSX.Element} A div containing the generated QR code.
|
|
5595
|
+
*/
|
|
5550
5596
|
|
|
5551
|
-
function _catch$
|
|
5597
|
+
function _catch$c(body, recover) {
|
|
5552
5598
|
try {
|
|
5553
5599
|
var result = body();
|
|
5554
5600
|
} catch (e) {
|
|
@@ -5567,7 +5613,7 @@ var QrCode = function QrCode(_ref) {
|
|
|
5567
5613
|
React.useEffect(function () {
|
|
5568
5614
|
(function () {
|
|
5569
5615
|
try {
|
|
5570
|
-
return _catch$
|
|
5616
|
+
return _catch$c(function () {
|
|
5571
5617
|
var _temp = function () {
|
|
5572
5618
|
if (address) {
|
|
5573
5619
|
return Promise.resolve(generateQrAndShowInCanvas(address)).then(function (_generateQrAndShowInC) {
|
|
@@ -5594,7 +5640,8 @@ QrCode.propTypes = {
|
|
|
5594
5640
|
fill: PropTypes.bool
|
|
5595
5641
|
};
|
|
5596
5642
|
QrCode.defaultProps = {
|
|
5597
|
-
address: ""
|
|
5643
|
+
address: "",
|
|
5644
|
+
fill: false
|
|
5598
5645
|
};
|
|
5599
5646
|
|
|
5600
5647
|
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"};
|
|
@@ -6279,7 +6326,7 @@ var s = {"container":"_4QDrB","coin-picker":"_mvuzQ","loading":"_18kIX","item":"
|
|
|
6279
6326
|
var FALLBACK_ASSET_ICON_URL = "https://rabbit.io/asset-icons/fallback.svg";
|
|
6280
6327
|
var DEFAULT_CRYPTO_DECIMAL_COUNT = 8;
|
|
6281
6328
|
|
|
6282
|
-
function _catch$
|
|
6329
|
+
function _catch$b(body, recover) {
|
|
6283
6330
|
try {
|
|
6284
6331
|
var result = body();
|
|
6285
6332
|
} catch (e) {
|
|
@@ -6503,7 +6550,7 @@ var CoinPicker = function CoinPicker(_ref) {
|
|
|
6503
6550
|
var loadCoinsAndSaveToState = function loadCoinsAndSaveToState() {
|
|
6504
6551
|
(function () {
|
|
6505
6552
|
try {
|
|
6506
|
-
var _temp = _catch$
|
|
6553
|
+
var _temp = _catch$b(function () {
|
|
6507
6554
|
return Promise.resolve(loadCoinsAndContent ? loadCoinsAndContent() : defaultLoadCoinsAndContent()).then(function (data) {
|
|
6508
6555
|
setCoins(data.coins);
|
|
6509
6556
|
setFilteredCoins(data.coins);
|
|
@@ -7312,7 +7359,7 @@ var Cache = /*#__PURE__*/function () {
|
|
|
7312
7359
|
return Cache;
|
|
7313
7360
|
}();
|
|
7314
7361
|
|
|
7315
|
-
function _catch$
|
|
7362
|
+
function _catch$a(body, recover) {
|
|
7316
7363
|
try {
|
|
7317
7364
|
var result = body();
|
|
7318
7365
|
} catch (e) {
|
|
@@ -7330,7 +7377,7 @@ function postponeExecution(execution, timeoutMS) {
|
|
|
7330
7377
|
return new Promise(function (resolve, reject) {
|
|
7331
7378
|
setTimeout(function () {
|
|
7332
7379
|
try {
|
|
7333
|
-
var _temp = _catch$
|
|
7380
|
+
var _temp = _catch$a(function () {
|
|
7334
7381
|
return Promise.resolve(execution()).then(function (_execution) {
|
|
7335
7382
|
resolve(_execution);
|
|
7336
7383
|
});
|
|
@@ -7414,7 +7461,7 @@ var AxiosAdapter = /*#__PURE__*/function () {
|
|
|
7414
7461
|
return AxiosAdapter;
|
|
7415
7462
|
}();
|
|
7416
7463
|
|
|
7417
|
-
function _catch$
|
|
7464
|
+
function _catch$9(body, recover) {
|
|
7418
7465
|
try {
|
|
7419
7466
|
var result = body();
|
|
7420
7467
|
} catch (e) {
|
|
@@ -7430,7 +7477,7 @@ var EmailsApi = /*#__PURE__*/function () {
|
|
|
7430
7477
|
EmailsApi.sendEmail = function sendEmail(subject, body) {
|
|
7431
7478
|
try {
|
|
7432
7479
|
var _this = this;
|
|
7433
|
-
var _temp = _catch$
|
|
7480
|
+
var _temp = _catch$9(function () {
|
|
7434
7481
|
var url = window.location.protocol + "//" + window.location.host + "/api/v1/" + _this.serverEndpointEntity;
|
|
7435
7482
|
return Promise.resolve(axios__default["default"].post(url, {
|
|
7436
7483
|
subject: subject,
|
|
@@ -7848,7 +7895,7 @@ var ExternalServicesStatsCollector = /*#__PURE__*/function () {
|
|
|
7848
7895
|
* improve the reliability of a data retrieval.
|
|
7849
7896
|
*/
|
|
7850
7897
|
|
|
7851
|
-
function _catch$
|
|
7898
|
+
function _catch$8(body, recover) {
|
|
7852
7899
|
try {
|
|
7853
7900
|
var result = body();
|
|
7854
7901
|
} catch (e) {
|
|
@@ -8187,7 +8234,7 @@ var RobustExternalAPICallerService = /*#__PURE__*/function () {
|
|
|
8187
8234
|
var result;
|
|
8188
8235
|
var calculationUuid = concurrentCalculationsMetadataHolder.startCalculation(_this.bio);
|
|
8189
8236
|
return Promise.resolve(_finallyRethrows$1(function () {
|
|
8190
|
-
return _catch$
|
|
8237
|
+
return _catch$8(function () {
|
|
8191
8238
|
function _temp5() {
|
|
8192
8239
|
var _result2, _result3;
|
|
8193
8240
|
if (((_result2 = result) == null ? void 0 : _result2.data) == null) {
|
|
@@ -8215,7 +8262,7 @@ var RobustExternalAPICallerService = /*#__PURE__*/function () {
|
|
|
8215
8262
|
*/
|
|
8216
8263
|
var rpsFactor = result ? result.rpsFactor : RobustExternalAPICallerService.defaultRPSFactor;
|
|
8217
8264
|
result = null;
|
|
8218
|
-
var _temp3 = _catch$
|
|
8265
|
+
var _temp3 = _catch$8(function () {
|
|
8219
8266
|
function _temp2() {
|
|
8220
8267
|
var _result$errors;
|
|
8221
8268
|
if ((_result$errors = result.errors) != null && _result$errors.length) {
|
|
@@ -8239,7 +8286,7 @@ var RobustExternalAPICallerService = /*#__PURE__*/function () {
|
|
|
8239
8286
|
return Promise.resolve(new Promise(function (resolve, reject) {
|
|
8240
8287
|
setTimeout(function () {
|
|
8241
8288
|
try {
|
|
8242
|
-
var _temp6 = _catch$
|
|
8289
|
+
var _temp6 = _catch$8(function () {
|
|
8243
8290
|
return Promise.resolve(_this._performCallAttempt(parametersValues, timeoutMS, cancelToken, rpsFactor, doNotFailForNowData)).then(function (_this$_performCallAtt2) {
|
|
8244
8291
|
resolve(_this$_performCallAtt2);
|
|
8245
8292
|
});
|
|
@@ -8309,7 +8356,7 @@ var RobustExternalAPICallerService = /*#__PURE__*/function () {
|
|
|
8309
8356
|
return;
|
|
8310
8357
|
}
|
|
8311
8358
|
var _temp13 = _finallyRethrows$1(function () {
|
|
8312
|
-
return _catch$
|
|
8359
|
+
return _catch$8(function () {
|
|
8313
8360
|
var _provider$specificHea;
|
|
8314
8361
|
function _temp12() {
|
|
8315
8362
|
if (iterationsData.length) {
|
|
@@ -8641,7 +8688,7 @@ function _for(test, update, body) {
|
|
|
8641
8688
|
}
|
|
8642
8689
|
}
|
|
8643
8690
|
}
|
|
8644
|
-
function _catch$
|
|
8691
|
+
function _catch$7(body, recover) {
|
|
8645
8692
|
try {
|
|
8646
8693
|
var result = body();
|
|
8647
8694
|
} catch (e) {
|
|
@@ -8720,7 +8767,7 @@ var CacheAndConcurrentRequestsResolver = /*#__PURE__*/function () {
|
|
|
8720
8767
|
_proto.getCachedOrWaitForCachedOrAcquireLock = function getCachedOrWaitForCachedOrAcquireLock(cacheId) {
|
|
8721
8768
|
try {
|
|
8722
8769
|
var _this = this;
|
|
8723
|
-
return Promise.resolve(_catch$
|
|
8770
|
+
return Promise.resolve(_catch$7(function () {
|
|
8724
8771
|
function _temp2() {
|
|
8725
8772
|
var _cached, _cached2;
|
|
8726
8773
|
return calculationId ? {
|
|
@@ -8799,7 +8846,7 @@ var CacheAndConcurrentRequestsResolver = /*#__PURE__*/function () {
|
|
|
8799
8846
|
_proto.acquireLock = function acquireLock(cacheId) {
|
|
8800
8847
|
try {
|
|
8801
8848
|
var _this2 = this;
|
|
8802
|
-
return Promise.resolve(_catch$
|
|
8849
|
+
return Promise.resolve(_catch$7(function () {
|
|
8803
8850
|
return Promise.resolve(_this2._requestsManager.acquireLock(cacheId));
|
|
8804
8851
|
}, function (e) {
|
|
8805
8852
|
improveAndRethrow(e, "acquireLock");
|
|
@@ -8969,7 +9016,7 @@ var ManagerOfRequestsToTheSameResource = /*#__PURE__*/function () {
|
|
|
8969
9016
|
try {
|
|
8970
9017
|
var _exit;
|
|
8971
9018
|
var _this3 = this;
|
|
8972
|
-
var _temp3 = _catch$
|
|
9019
|
+
var _temp3 = _catch$7(function () {
|
|
8973
9020
|
var activeCalculationIdForHash = _this3._activeCalculationsIds.get(requestHash);
|
|
8974
9021
|
if (activeCalculationIdForHash == null) {
|
|
8975
9022
|
var id = uuid.v4();
|
|
@@ -9003,7 +9050,7 @@ var ManagerOfRequestsToTheSameResource = /*#__PURE__*/function () {
|
|
|
9003
9050
|
_proto2.acquireLock = function acquireLock(requestHash) {
|
|
9004
9051
|
try {
|
|
9005
9052
|
var _this4 = this;
|
|
9006
|
-
return Promise.resolve(_catch$
|
|
9053
|
+
return Promise.resolve(_catch$7(function () {
|
|
9007
9054
|
var _this4$_nextCalculati;
|
|
9008
9055
|
var activeId = _this4._activeCalculationsIds.get(requestHash);
|
|
9009
9056
|
var nextId = uuid.v4();
|
|
@@ -9154,7 +9201,7 @@ var ManagerOfRequestsToTheSameResource = /*#__PURE__*/function () {
|
|
|
9154
9201
|
* TODO: [tests, critical] Massively used logic
|
|
9155
9202
|
*/
|
|
9156
9203
|
|
|
9157
|
-
function _catch$
|
|
9204
|
+
function _catch$6(body, recover) {
|
|
9158
9205
|
try {
|
|
9159
9206
|
var result = body();
|
|
9160
9207
|
} catch (e) {
|
|
@@ -9251,7 +9298,7 @@ var CachedRobustExternalApiCallerService = /*#__PURE__*/function () {
|
|
|
9251
9298
|
var cacheId;
|
|
9252
9299
|
var result;
|
|
9253
9300
|
return Promise.resolve(_finallyRethrows(function () {
|
|
9254
|
-
return _catch$
|
|
9301
|
+
return _catch$6(function () {
|
|
9255
9302
|
cacheId = _this._calculateCacheId(parametersValues, customHashFunctionForParams);
|
|
9256
9303
|
return Promise.resolve(_this._cahceAndRequestsResolver.getCachedOrWaitForCachedOrAcquireLock(cacheId)).then(function (_this$_cahceAndReques) {
|
|
9257
9304
|
var _result2, _result4;
|
|
@@ -9320,7 +9367,7 @@ var CachedRobustExternalApiCallerService = /*#__PURE__*/function () {
|
|
|
9320
9367
|
return CachedRobustExternalApiCallerService;
|
|
9321
9368
|
}();
|
|
9322
9369
|
|
|
9323
|
-
function _catch$
|
|
9370
|
+
function _catch$5(body, recover) {
|
|
9324
9371
|
try {
|
|
9325
9372
|
var result = body();
|
|
9326
9373
|
} catch (e) {
|
|
@@ -9404,7 +9451,7 @@ var IpAddressProvider = /*#__PURE__*/function () {
|
|
|
9404
9451
|
IpAddressProvider.getClientIpAddress = function getClientIpAddress() {
|
|
9405
9452
|
try {
|
|
9406
9453
|
var _this = this;
|
|
9407
|
-
return Promise.resolve(_catch$
|
|
9454
|
+
return Promise.resolve(_catch$5(function () {
|
|
9408
9455
|
return Promise.resolve(_this.externalIPAddressAPICaller.callExternalAPICached([], 7000));
|
|
9409
9456
|
}, function (e) {
|
|
9410
9457
|
improveAndRethrow(e, "getClientIpAddress");
|
|
@@ -9584,15 +9631,44 @@ function BaseSwapCreationInfo(fromCoin, toCoin, fromAmountCoins, toAmountCoins,
|
|
|
9584
9631
|
this.isRefundAddressRequired = isRefundAddressRequired;
|
|
9585
9632
|
};
|
|
9586
9633
|
|
|
9634
|
+
// TODO: [refactoring, moderate] extract structure of _supportedCoins into model class
|
|
9635
|
+
|
|
9636
|
+
function _catch$4(body, recover) {
|
|
9637
|
+
try {
|
|
9638
|
+
var result = body();
|
|
9639
|
+
} catch (e) {
|
|
9640
|
+
return recover(e);
|
|
9641
|
+
}
|
|
9642
|
+
if (result && result.then) {
|
|
9643
|
+
return result.then(void 0, recover);
|
|
9644
|
+
}
|
|
9645
|
+
return result;
|
|
9646
|
+
}
|
|
9587
9647
|
var SwapProvider = /*#__PURE__*/function () {
|
|
9588
|
-
function SwapProvider() {
|
|
9648
|
+
function SwapProvider(cache, customCoinBuilder, useRestrictedCoinsSet) {
|
|
9649
|
+
if (customCoinBuilder === void 0) {
|
|
9650
|
+
customCoinBuilder = function customCoinBuilder(coin, network) {
|
|
9651
|
+
return null;
|
|
9652
|
+
};
|
|
9653
|
+
}
|
|
9654
|
+
if (useRestrictedCoinsSet === void 0) {
|
|
9655
|
+
useRestrictedCoinsSet = true;
|
|
9656
|
+
}
|
|
9657
|
+
this._supportedCoins = [];
|
|
9658
|
+
this._maxRateDigits = 20;
|
|
9659
|
+
this.useRestrictedCoinsSet = useRestrictedCoinsSet;
|
|
9660
|
+
this._customCoinBuilder = customCoinBuilder;
|
|
9661
|
+
this._cache = cache;
|
|
9662
|
+
this.isAggregator = false;
|
|
9663
|
+
}
|
|
9589
9664
|
var _proto = SwapProvider.prototype;
|
|
9590
9665
|
/**
|
|
9591
9666
|
* @return {Promise<void>}
|
|
9592
9667
|
*/
|
|
9593
9668
|
_proto.initialize = function initialize() {
|
|
9594
9669
|
try {
|
|
9595
|
-
|
|
9670
|
+
var _this = this;
|
|
9671
|
+
return Promise.resolve(_this._fetchSupportedCurrenciesIfNeeded()).then(function () {});
|
|
9596
9672
|
} catch (e) {
|
|
9597
9673
|
return Promise.reject(e);
|
|
9598
9674
|
}
|
|
@@ -9605,15 +9681,68 @@ var SwapProvider = /*#__PURE__*/function () {
|
|
|
9605
9681
|
throw new Error("Not implemented in base");
|
|
9606
9682
|
}
|
|
9607
9683
|
|
|
9684
|
+
/**
|
|
9685
|
+
* This method sort internal list putting popular (as provider thinks) coins to the top.
|
|
9686
|
+
* 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.
|
|
9687
|
+
* @private
|
|
9688
|
+
*/;
|
|
9689
|
+
_proto._putPopularCoinsFirst = function _putPopularCoinsFirst() {
|
|
9690
|
+
this._supportedCoins.sort(function (i1, i2) {
|
|
9691
|
+
if (i1.isPopular !== i2.isPopular) return i2.isPopular - i1.isPopular;
|
|
9692
|
+
return i1.coin.ticker.localeCompare(i2.coin.ticker);
|
|
9693
|
+
});
|
|
9694
|
+
}
|
|
9695
|
+
|
|
9696
|
+
/**
|
|
9697
|
+
* Should fill _supportedCoins with array of coins.
|
|
9698
|
+
* Coin construction rules:
|
|
9699
|
+
* 1. ticker should be CODEPROTOCOL_CODE e.g. USDTERC20
|
|
9700
|
+
* 2. name should not contain (PROTOCOL_CODE) or just PROTOCOL_CODe
|
|
9701
|
+
* 3. protocol should be null for coins major for their blockchains like BTC, ETH
|
|
9702
|
+
* 4. isPopular should be a number
|
|
9703
|
+
*
|
|
9704
|
+
* @return {Promise<void>}
|
|
9705
|
+
* @private
|
|
9706
|
+
*/;
|
|
9707
|
+
_proto._fetchSupportedCurrenciesIfNeeded = function _fetchSupportedCurrenciesIfNeeded() {
|
|
9708
|
+
try {
|
|
9709
|
+
throw new Error("Not implemented in base - _fetchSupportedCurrenciesIfNeeded");
|
|
9710
|
+
} catch (e) {
|
|
9711
|
+
return Promise.reject(e);
|
|
9712
|
+
}
|
|
9713
|
+
}
|
|
9608
9714
|
/**
|
|
9609
9715
|
* Retrieves all currencies supported by this swap provider.
|
|
9610
9716
|
* Returns one of SwapProvider.COMMON_ERRORS in case of processable fail.
|
|
9611
9717
|
*
|
|
9612
9718
|
* @return {Promise<({ result: true, coins: Coin[] }|{ result: false, reason: string })>}
|
|
9613
|
-
|
|
9719
|
+
*/
|
|
9720
|
+
;
|
|
9614
9721
|
_proto.getAllSupportedCurrencies = function getAllSupportedCurrencies() {
|
|
9615
9722
|
try {
|
|
9616
|
-
|
|
9723
|
+
var _this2 = this;
|
|
9724
|
+
var loggerSource = "getAllSupportedCurrencies";
|
|
9725
|
+
return Promise.resolve(_catch$4(function () {
|
|
9726
|
+
return Promise.resolve(_this2._fetchSupportedCurrenciesIfNeeded()).then(function () {
|
|
9727
|
+
var _this2$_supportedCoin;
|
|
9728
|
+
Logger.log("We have " + ((_this2$_supportedCoin = _this2._supportedCoins) == null ? void 0 : _this2$_supportedCoin.length) + " supported coins returning", loggerSource);
|
|
9729
|
+
return {
|
|
9730
|
+
result: true,
|
|
9731
|
+
coins: _this2._supportedCoins.map(function (item) {
|
|
9732
|
+
return item.coin;
|
|
9733
|
+
})
|
|
9734
|
+
};
|
|
9735
|
+
});
|
|
9736
|
+
}, function (e) {
|
|
9737
|
+
var _e$response;
|
|
9738
|
+
if ((e == null || (_e$response = e.response) == null ? void 0 : _e$response.status) === 429) {
|
|
9739
|
+
return {
|
|
9740
|
+
result: false,
|
|
9741
|
+
reason: SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
9742
|
+
};
|
|
9743
|
+
}
|
|
9744
|
+
improveAndRethrow(e, loggerSource);
|
|
9745
|
+
}));
|
|
9617
9746
|
} catch (e) {
|
|
9618
9747
|
return Promise.reject(e);
|
|
9619
9748
|
}
|
|
@@ -9627,7 +9756,31 @@ var SwapProvider = /*#__PURE__*/function () {
|
|
|
9627
9756
|
;
|
|
9628
9757
|
_proto.getDepositCurrencies = function getDepositCurrencies() {
|
|
9629
9758
|
try {
|
|
9630
|
-
|
|
9759
|
+
var _this3 = this;
|
|
9760
|
+
var loggerSource = "getDepositCurrencies";
|
|
9761
|
+
return Promise.resolve(_catch$4(function () {
|
|
9762
|
+
return Promise.resolve(_this3._fetchSupportedCurrenciesIfNeeded()).then(function () {
|
|
9763
|
+
var _this3$_supportedCoin;
|
|
9764
|
+
Logger.log("We have " + ((_this3$_supportedCoin = _this3._supportedCoins) == null ? void 0 : _this3$_supportedCoin.length) + " supported coins, getting depositable", loggerSource);
|
|
9765
|
+
return {
|
|
9766
|
+
result: true,
|
|
9767
|
+
coins: _this3._supportedCoins.filter(function (item) {
|
|
9768
|
+
return item.deposit;
|
|
9769
|
+
}).map(function (item) {
|
|
9770
|
+
return item.coin;
|
|
9771
|
+
})
|
|
9772
|
+
};
|
|
9773
|
+
});
|
|
9774
|
+
}, function (e) {
|
|
9775
|
+
var _e$response2;
|
|
9776
|
+
if ((e == null || (_e$response2 = e.response) == null ? void 0 : _e$response2.status) === 429) {
|
|
9777
|
+
return {
|
|
9778
|
+
result: false,
|
|
9779
|
+
reason: SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
9780
|
+
};
|
|
9781
|
+
}
|
|
9782
|
+
improveAndRethrow(e, loggerSource);
|
|
9783
|
+
}));
|
|
9631
9784
|
} catch (e) {
|
|
9632
9785
|
return Promise.reject(e);
|
|
9633
9786
|
}
|
|
@@ -9641,8 +9794,36 @@ var SwapProvider = /*#__PURE__*/function () {
|
|
|
9641
9794
|
*/
|
|
9642
9795
|
;
|
|
9643
9796
|
_proto.getWithdrawalCurrencies = function getWithdrawalCurrencies(exceptCurrency) {
|
|
9797
|
+
if (exceptCurrency === void 0) {
|
|
9798
|
+
exceptCurrency = null;
|
|
9799
|
+
}
|
|
9644
9800
|
try {
|
|
9645
|
-
|
|
9801
|
+
var _this4 = this;
|
|
9802
|
+
var loggerSource = "getWithdrawalCurrencies";
|
|
9803
|
+
return Promise.resolve(_catch$4(function () {
|
|
9804
|
+
return Promise.resolve(_this4._fetchSupportedCurrenciesIfNeeded()).then(function () {
|
|
9805
|
+
var _this4$_supportedCoin;
|
|
9806
|
+
Logger.log("We have " + ((_this4$_supportedCoin = _this4._supportedCoins) == null ? void 0 : _this4$_supportedCoin.length) + " supported coins, getting withdrawable", loggerSource);
|
|
9807
|
+
return {
|
|
9808
|
+
result: true,
|
|
9809
|
+
coins: _this4._supportedCoins.filter(function (item) {
|
|
9810
|
+
var _item$coin, _exceptCurrency;
|
|
9811
|
+
return item.withdrawal && (!exceptCurrency || ((_item$coin = item.coin) == null ? void 0 : _item$coin.ticker) !== ((_exceptCurrency = exceptCurrency) == null ? void 0 : _exceptCurrency.ticker));
|
|
9812
|
+
}).map(function (item) {
|
|
9813
|
+
return item.coin;
|
|
9814
|
+
})
|
|
9815
|
+
};
|
|
9816
|
+
});
|
|
9817
|
+
}, function (e) {
|
|
9818
|
+
var _e$response3;
|
|
9819
|
+
if ((e == null || (_e$response3 = e.response) == null ? void 0 : _e$response3.status) === 429) {
|
|
9820
|
+
return {
|
|
9821
|
+
result: false,
|
|
9822
|
+
reason: SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
9823
|
+
};
|
|
9824
|
+
}
|
|
9825
|
+
improveAndRethrow(e, loggerSource);
|
|
9826
|
+
}));
|
|
9646
9827
|
} catch (e) {
|
|
9647
9828
|
return Promise.reject(e);
|
|
9648
9829
|
}
|
|
@@ -9650,12 +9831,28 @@ var SwapProvider = /*#__PURE__*/function () {
|
|
|
9650
9831
|
/**
|
|
9651
9832
|
* Retrieves URL for coin icon or fallback if not found.
|
|
9652
9833
|
*
|
|
9653
|
-
* @param
|
|
9834
|
+
* @param coinOrTicker {Coin|string} coin or rabbit-format of coin ticker
|
|
9654
9835
|
* @return {string}
|
|
9655
9836
|
*/
|
|
9656
9837
|
;
|
|
9657
|
-
_proto.getIconUrl = function getIconUrl(
|
|
9658
|
-
|
|
9838
|
+
_proto.getIconUrl = function getIconUrl(coinOrTicker) {
|
|
9839
|
+
var loggerSource = "getIconUrl";
|
|
9840
|
+
try {
|
|
9841
|
+
var _this$_supportedCoins2, _this$_supportedCoins3;
|
|
9842
|
+
var coin = coinOrTicker;
|
|
9843
|
+
if (!(coinOrTicker instanceof Coin)) {
|
|
9844
|
+
var _this$_supportedCoins;
|
|
9845
|
+
coin = (_this$_supportedCoins = this._supportedCoins.find(function (i) {
|
|
9846
|
+
return i.coin.ticker === coinOrTicker;
|
|
9847
|
+
})) == null ? void 0 : _this$_supportedCoins.coin;
|
|
9848
|
+
}
|
|
9849
|
+
return (_this$_supportedCoins2 = (_this$_supportedCoins3 = this._supportedCoins.find(function (item) {
|
|
9850
|
+
var _item$coin2, _coin;
|
|
9851
|
+
return ((_item$coin2 = item.coin) == null ? void 0 : _item$coin2.ticker) === ((_coin = coin) == null ? void 0 : _coin.ticker);
|
|
9852
|
+
})) == null ? void 0 : _this$_supportedCoins3.iconURL) != null ? _this$_supportedCoins2 : FALLBACK_ASSET_ICON_URL;
|
|
9853
|
+
} catch (e) {
|
|
9854
|
+
improveAndRethrow(e, loggerSource);
|
|
9855
|
+
}
|
|
9659
9856
|
}
|
|
9660
9857
|
|
|
9661
9858
|
/**
|
|
@@ -9666,7 +9863,49 @@ var SwapProvider = /*#__PURE__*/function () {
|
|
|
9666
9863
|
*/;
|
|
9667
9864
|
_proto.getCoinToUSDTRate = function getCoinToUSDTRate(coin) {
|
|
9668
9865
|
try {
|
|
9669
|
-
|
|
9866
|
+
var _this5 = this;
|
|
9867
|
+
var loggerSource = "getCoinToUSDTRate";
|
|
9868
|
+
return Promise.resolve(_catch$4(function () {
|
|
9869
|
+
return coin ? Promise.resolve(_this5._fetchSupportedCurrenciesIfNeeded()).then(function () {
|
|
9870
|
+
var _this5$_supportedCoin;
|
|
9871
|
+
// Using USDT TRC20 as usually fee in this network is smaller than ERC20 and this network is widely used for USDT
|
|
9872
|
+
var usdtTrc20 = (_this5$_supportedCoin = _this5._supportedCoins.find(function (i) {
|
|
9873
|
+
return i.coin.ticker === "USDTTRC20";
|
|
9874
|
+
})) == null ? void 0 : _this5$_supportedCoin.coin;
|
|
9875
|
+
if (!usdtTrc20) {
|
|
9876
|
+
return {
|
|
9877
|
+
result: false
|
|
9878
|
+
};
|
|
9879
|
+
}
|
|
9880
|
+
var cached = _this5._cache.get("swapspace_usdt_rate_" + coin.ticker);
|
|
9881
|
+
if (cached != null) {
|
|
9882
|
+
return {
|
|
9883
|
+
result: true,
|
|
9884
|
+
rate: cached
|
|
9885
|
+
};
|
|
9886
|
+
}
|
|
9887
|
+
Logger.log("Loading USDT->coin rate as not found in cache:", coin == null ? void 0 : coin.ticker);
|
|
9888
|
+
return Promise.resolve(_this5.getSwapInfo(usdtTrc20, coin, "5000", false)).then(function (result) {
|
|
9889
|
+
if (!result.result) {
|
|
9890
|
+
return {
|
|
9891
|
+
result: false
|
|
9892
|
+
};
|
|
9893
|
+
}
|
|
9894
|
+
|
|
9895
|
+
// This calculation is not precise as we cannot recognize the actual fee and network fee. Just approximate.
|
|
9896
|
+
var standardSwapspaceFeeMultiplier = 1.004; // fee is usually 0.4%
|
|
9897
|
+
var rate = bignumber_js.BigNumber(1).div(bignumber_js.BigNumber(result.rate).times(standardSwapspaceFeeMultiplier)).toString();
|
|
9898
|
+
_this5._cache.put("swap_usdt_rate_" + coin.ticker, rate, 15 * 60000 // 15 minutes
|
|
9899
|
+
);
|
|
9900
|
+
return {
|
|
9901
|
+
result: true,
|
|
9902
|
+
rate: rate
|
|
9903
|
+
};
|
|
9904
|
+
});
|
|
9905
|
+
}) : null;
|
|
9906
|
+
}, function (e) {
|
|
9907
|
+
improveAndRethrow(e, loggerSource);
|
|
9908
|
+
}));
|
|
9670
9909
|
} catch (e) {
|
|
9671
9910
|
return Promise.reject(e);
|
|
9672
9911
|
}
|
|
@@ -9683,6 +9922,7 @@ var SwapProvider = /*#__PURE__*/function () {
|
|
|
9683
9922
|
* @param [fixed=false] {boolean|null} null means fixed or float doesn't matter
|
|
9684
9923
|
* @param [fromCoinToUsdRate=null] pass if you want to increase the min amount returned
|
|
9685
9924
|
* by provider with some fixed "insurance" amount to cover min amount fluctuations.
|
|
9925
|
+
* @param [amountIsToReceive=false] {boolean} whether the given amount is receiving amount. False means the amount is the sending amount.
|
|
9686
9926
|
* @return {Promise<({
|
|
9687
9927
|
* result: false,
|
|
9688
9928
|
* reason: string,
|
|
@@ -9702,7 +9942,7 @@ var SwapProvider = /*#__PURE__*/function () {
|
|
|
9702
9942
|
* })>}
|
|
9703
9943
|
*/
|
|
9704
9944
|
;
|
|
9705
|
-
_proto.getSwapInfo = function getSwapInfo(fromCoin, toCoin, amountCoins, fixed, fromCoinToUsdRate) {
|
|
9945
|
+
_proto.getSwapInfo = function getSwapInfo(fromCoin, toCoin, amountCoins, fixed, fromCoinToUsdRate, amountIsToReceive) {
|
|
9706
9946
|
try {
|
|
9707
9947
|
throw new Error("Not implemented in base");
|
|
9708
9948
|
} catch (e) {
|
|
@@ -9722,6 +9962,7 @@ var SwapProvider = /*#__PURE__*/function () {
|
|
|
9722
9962
|
* @param fixed {boolean}
|
|
9723
9963
|
* @param [toCurrencyExtraId=""] {string} optional extra ID
|
|
9724
9964
|
* @param [refundExtraId=""] {string} optional extra ID for refund address
|
|
9965
|
+
* @param [amountIsToReceive=false] {boolean} whether the given amount is receiving amount. False means the amount is the sending amount.
|
|
9725
9966
|
* @return {Promise<({
|
|
9726
9967
|
* result: true,
|
|
9727
9968
|
* swapId: string,
|
|
@@ -9741,7 +9982,7 @@ var SwapProvider = /*#__PURE__*/function () {
|
|
|
9741
9982
|
* })>}
|
|
9742
9983
|
*/
|
|
9743
9984
|
;
|
|
9744
|
-
_proto.createSwap = function createSwap(fromCoin, toCoin, amount, toAddress, refundAddress, rawSwapData, clientIpAddress, fixed, toCurrencyExtraId, refundExtraId) {
|
|
9985
|
+
_proto.createSwap = function createSwap(fromCoin, toCoin, amount, toAddress, refundAddress, rawSwapData, clientIpAddress, fixed, toCurrencyExtraId, refundExtraId, amountIsToReceive) {
|
|
9745
9986
|
try {
|
|
9746
9987
|
throw new Error("Not implemented in base");
|
|
9747
9988
|
} catch (e) {
|
|
@@ -9769,7 +10010,15 @@ var SwapProvider = /*#__PURE__*/function () {
|
|
|
9769
10010
|
*/
|
|
9770
10011
|
;
|
|
9771
10012
|
_proto.getCoinByTickerIfPresent = function getCoinByTickerIfPresent(ticker) {
|
|
9772
|
-
|
|
10013
|
+
try {
|
|
10014
|
+
var _item$coin3;
|
|
10015
|
+
var item = this._supportedCoins.find(function (i) {
|
|
10016
|
+
return i.coin.ticker === ticker;
|
|
10017
|
+
});
|
|
10018
|
+
return (_item$coin3 = item == null ? void 0 : item.coin) != null ? _item$coin3 : null;
|
|
10019
|
+
} catch (e) {
|
|
10020
|
+
improveAndRethrow(e, "getCoinByTickerIfPresent");
|
|
10021
|
+
}
|
|
9773
10022
|
}
|
|
9774
10023
|
|
|
9775
10024
|
/**
|
|
@@ -9778,16 +10027,67 @@ var SwapProvider = /*#__PURE__*/function () {
|
|
|
9778
10027
|
* @return {boolean}
|
|
9779
10028
|
*/;
|
|
9780
10029
|
_proto.isAddressValidForAsset = function isAddressValidForAsset(asset, address) {
|
|
9781
|
-
|
|
9782
|
-
|
|
9783
|
-
|
|
9784
|
-
|
|
9785
|
-
|
|
9786
|
-
|
|
9787
|
-
|
|
9788
|
-
|
|
9789
|
-
|
|
9790
|
-
|
|
10030
|
+
try {
|
|
10031
|
+
var assetData = this._supportedCoins.find(function (i) {
|
|
10032
|
+
var _i$coin;
|
|
10033
|
+
return ((_i$coin = i.coin) == null ? void 0 : _i$coin.ticker) === (asset == null ? void 0 : asset.ticker);
|
|
10034
|
+
});
|
|
10035
|
+
if (assetData) {
|
|
10036
|
+
var corrected = assetData.validationRegexp.trim();
|
|
10037
|
+
corrected = corrected[0] === "/" ? corrected.slice(1) : corrected;
|
|
10038
|
+
corrected = corrected[corrected.length - 1] === "/" ? corrected.slice(0, corrected.length - 1) : corrected;
|
|
10039
|
+
return address.match(corrected) != null;
|
|
10040
|
+
}
|
|
10041
|
+
} catch (e) {
|
|
10042
|
+
Logger.logError(e, "isAddressValidForAsset");
|
|
10043
|
+
}
|
|
10044
|
+
return false;
|
|
10045
|
+
}
|
|
10046
|
+
|
|
10047
|
+
/**
|
|
10048
|
+
* @param asset {Coin}
|
|
10049
|
+
* @return {string|null}
|
|
10050
|
+
*/;
|
|
10051
|
+
_proto.getExtraIdNameIfPresent = function getExtraIdNameIfPresent(asset) {
|
|
10052
|
+
try {
|
|
10053
|
+
var assetData = this._supportedCoins.find(function (i) {
|
|
10054
|
+
var _i$coin2;
|
|
10055
|
+
return ((_i$coin2 = i.coin) == null ? void 0 : _i$coin2.ticker) === (asset == null ? void 0 : asset.ticker);
|
|
10056
|
+
});
|
|
10057
|
+
if (assetData != null && assetData.hasExtraId) {
|
|
10058
|
+
if ((assetData == null ? void 0 : assetData.extraIdName) == null || (assetData == null ? void 0 : assetData.extraIdName) === "") {
|
|
10059
|
+
// We return some default name if the extraIdName is empty
|
|
10060
|
+
return "ID";
|
|
10061
|
+
}
|
|
10062
|
+
return assetData == null ? void 0 : assetData.extraIdName;
|
|
10063
|
+
}
|
|
10064
|
+
return null;
|
|
10065
|
+
} catch (e) {
|
|
10066
|
+
improveAndRethrow(e, "getExtraIdNameIfPresent");
|
|
10067
|
+
}
|
|
10068
|
+
};
|
|
10069
|
+
_proto.removeProtocolNameFromCoinName = function removeProtocolNameFromCoinName(coinName, tickerPrintable, protocolName) {
|
|
10070
|
+
if (coinName) {
|
|
10071
|
+
var originalName = coinName;
|
|
10072
|
+
if (tickerPrintable) {
|
|
10073
|
+
coinName = coinName.replaceAll(new RegExp("\\(" + tickerPrintable + "\\)", "gi"), "");
|
|
10074
|
+
}
|
|
10075
|
+
if (protocolName) {
|
|
10076
|
+
coinName = coinName.replaceAll(new RegExp("\\(" + protocolName + "\\)", "gi"), "").replaceAll(new RegExp("(?<!on) " + protocolName + "$", "gi"), "").replaceAll(new RegExp("^" + protocolName + " ", "gi"), "").replaceAll(new RegExp("(?<!on) " + protocolName + " ", "gi"), " ");
|
|
10077
|
+
}
|
|
10078
|
+
coinName = coinName.replaceAll(/ +/g, " ").trim();
|
|
10079
|
+
var defaultNames = ["token", "network", "protocol", "coin", "mainnet", "chain", "project", "cash", "finance", "wrapped", "blockchain", "network"];
|
|
10080
|
+
var lowerCoinName = coinName.toLowerCase();
|
|
10081
|
+
var isBecameDefaultName = defaultNames.find(function (defName) {
|
|
10082
|
+
return lowerCoinName === defName || lowerCoinName === "the " + defName;
|
|
10083
|
+
});
|
|
10084
|
+
if (coinName === "" || isBecameDefaultName) {
|
|
10085
|
+
// Rolling back to original name if our processing leads in empty name or one of the default words
|
|
10086
|
+
coinName = originalName;
|
|
10087
|
+
}
|
|
10088
|
+
}
|
|
10089
|
+
return coinName;
|
|
10090
|
+
};
|
|
9791
10091
|
return SwapProvider;
|
|
9792
10092
|
}();
|
|
9793
10093
|
SwapProvider.COMMON_ERRORS = {
|
|
@@ -9805,22 +10105,16 @@ SwapProvider.CREATION_FAIL_REASONS = {
|
|
|
9805
10105
|
};
|
|
9806
10106
|
SwapProvider.SWAP_STATUSES = {
|
|
9807
10107
|
WAITING_FOR_PAYMENT: "waiting_for_payment",
|
|
9808
|
-
// public +
|
|
9809
10108
|
CONFIRMING: "confirming",
|
|
9810
10109
|
PAYMENT_RECEIVED: "payment_received",
|
|
9811
|
-
// public +
|
|
9812
10110
|
EXCHANGING: "exchanging",
|
|
9813
|
-
// session full // public +
|
|
9814
10111
|
COMPLETED: "completed",
|
|
9815
|
-
// session full // public +
|
|
9816
10112
|
REFUNDED: "refunded",
|
|
9817
|
-
// session full // public +
|
|
9818
10113
|
EXPIRED: "expired",
|
|
9819
|
-
|
|
9820
|
-
FAILED: "failed" // public +
|
|
10114
|
+
FAILED: "failed"
|
|
9821
10115
|
};
|
|
9822
10116
|
|
|
9823
|
-
function _catch$
|
|
10117
|
+
function _catch$3(body, recover) {
|
|
9824
10118
|
try {
|
|
9825
10119
|
var result = body();
|
|
9826
10120
|
} catch (e) {
|
|
@@ -9844,14 +10138,10 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
|
|
|
9844
10138
|
if (useRestrictedCoinsSet === void 0) {
|
|
9845
10139
|
useRestrictedCoinsSet = true;
|
|
9846
10140
|
}
|
|
9847
|
-
_this = _SwapProvider.call(this) || this;
|
|
9848
|
-
_this._supportedCoins = [];
|
|
10141
|
+
_this = _SwapProvider.call(this, cache, customCoinBuilder, useRestrictedCoinsSet) || this;
|
|
9849
10142
|
_this._partners = [];
|
|
9850
|
-
_this._URL =
|
|
9851
|
-
_this.
|
|
9852
|
-
_this.useRestrictedCoinsSet = useRestrictedCoinsSet;
|
|
9853
|
-
_this._customCoinBuilder = customCoinBuilder;
|
|
9854
|
-
_this._cache = cache;
|
|
10143
|
+
_this._URL = apiKeysProxyUrl + "/swapspace";
|
|
10144
|
+
_this.isAggregator = true;
|
|
9855
10145
|
return _this;
|
|
9856
10146
|
}
|
|
9857
10147
|
var _proto = SwapspaceSwapProvider.prototype;
|
|
@@ -9860,144 +10150,21 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
|
|
|
9860
10150
|
* (and even a bit smaller value) for better consistency */
|
|
9861
10151
|
return 110000;
|
|
9862
10152
|
};
|
|
9863
|
-
_proto.getDepositCurrencies = function getDepositCurrencies() {
|
|
9864
|
-
try {
|
|
9865
|
-
var _this2 = this;
|
|
9866
|
-
var loggerSource = "getDepositCurrencies";
|
|
9867
|
-
return Promise.resolve(_catch$2(function () {
|
|
9868
|
-
return Promise.resolve(_this2._fetchSupportedCurrenciesIfNeeded()).then(function () {
|
|
9869
|
-
var _this2$_supportedCoin;
|
|
9870
|
-
Logger.log("We have " + ((_this2$_supportedCoin = _this2._supportedCoins) == null ? void 0 : _this2$_supportedCoin.length) + " supported coins, getting depositable", loggerSource);
|
|
9871
|
-
return {
|
|
9872
|
-
result: true,
|
|
9873
|
-
coins: _this2._supportedCoins.filter(function (item) {
|
|
9874
|
-
return item.deposit;
|
|
9875
|
-
}).map(function (item) {
|
|
9876
|
-
return item.coin;
|
|
9877
|
-
})
|
|
9878
|
-
};
|
|
9879
|
-
});
|
|
9880
|
-
}, function (e) {
|
|
9881
|
-
var _e$response;
|
|
9882
|
-
if ((e == null || (_e$response = e.response) == null ? void 0 : _e$response.status) === 429) {
|
|
9883
|
-
return {
|
|
9884
|
-
result: false,
|
|
9885
|
-
reason: SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
9886
|
-
};
|
|
9887
|
-
}
|
|
9888
|
-
improveAndRethrow(e, loggerSource);
|
|
9889
|
-
}));
|
|
9890
|
-
} catch (e) {
|
|
9891
|
-
return Promise.reject(e);
|
|
9892
|
-
}
|
|
9893
|
-
};
|
|
9894
|
-
_proto.getAllSupportedCurrencies = function getAllSupportedCurrencies() {
|
|
9895
|
-
try {
|
|
9896
|
-
var _this3 = this;
|
|
9897
|
-
var loggerSource = "getAllSupportedCurrencies";
|
|
9898
|
-
return Promise.resolve(_catch$2(function () {
|
|
9899
|
-
return Promise.resolve(_this3._fetchSupportedCurrenciesIfNeeded()).then(function () {
|
|
9900
|
-
var _this3$_supportedCoin;
|
|
9901
|
-
Logger.log("We have " + ((_this3$_supportedCoin = _this3._supportedCoins) == null ? void 0 : _this3$_supportedCoin.length) + " supported coins returning", loggerSource);
|
|
9902
|
-
return {
|
|
9903
|
-
result: true,
|
|
9904
|
-
coins: _this3._supportedCoins.map(function (item) {
|
|
9905
|
-
return item.coin;
|
|
9906
|
-
})
|
|
9907
|
-
};
|
|
9908
|
-
});
|
|
9909
|
-
}, function (e) {
|
|
9910
|
-
var _e$response2;
|
|
9911
|
-
if ((e == null || (_e$response2 = e.response) == null ? void 0 : _e$response2.status) === 429) {
|
|
9912
|
-
return {
|
|
9913
|
-
result: false,
|
|
9914
|
-
reason: SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
9915
|
-
};
|
|
9916
|
-
}
|
|
9917
|
-
improveAndRethrow(e, loggerSource);
|
|
9918
|
-
}));
|
|
9919
|
-
} catch (e) {
|
|
9920
|
-
return Promise.reject(e);
|
|
9921
|
-
}
|
|
9922
|
-
};
|
|
9923
|
-
_proto.getWithdrawalCurrencies = function getWithdrawalCurrencies(exceptCurrency) {
|
|
9924
|
-
if (exceptCurrency === void 0) {
|
|
9925
|
-
exceptCurrency = null;
|
|
9926
|
-
}
|
|
9927
|
-
try {
|
|
9928
|
-
var _this4 = this;
|
|
9929
|
-
var loggerSource = "getWithdrawalCurrencies";
|
|
9930
|
-
return Promise.resolve(_catch$2(function () {
|
|
9931
|
-
return Promise.resolve(_this4._fetchSupportedCurrenciesIfNeeded()).then(function () {
|
|
9932
|
-
var _this4$_supportedCoin;
|
|
9933
|
-
Logger.log("We have " + ((_this4$_supportedCoin = _this4._supportedCoins) == null ? void 0 : _this4$_supportedCoin.length) + " supported coins, getting withdrawable", loggerSource);
|
|
9934
|
-
return {
|
|
9935
|
-
result: true,
|
|
9936
|
-
coins: _this4._supportedCoins.filter(function (item) {
|
|
9937
|
-
var _item$coin, _exceptCurrency;
|
|
9938
|
-
return item.withdrawal && (!exceptCurrency || ((_item$coin = item.coin) == null ? void 0 : _item$coin.ticker) !== ((_exceptCurrency = exceptCurrency) == null ? void 0 : _exceptCurrency.ticker));
|
|
9939
|
-
}).map(function (item) {
|
|
9940
|
-
return item.coin;
|
|
9941
|
-
})
|
|
9942
|
-
};
|
|
9943
|
-
});
|
|
9944
|
-
}, function (e) {
|
|
9945
|
-
var _e$response3;
|
|
9946
|
-
if ((e == null || (_e$response3 = e.response) == null ? void 0 : _e$response3.status) === 429) {
|
|
9947
|
-
return {
|
|
9948
|
-
result: false,
|
|
9949
|
-
reason: SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
9950
|
-
};
|
|
9951
|
-
}
|
|
9952
|
-
improveAndRethrow(e, loggerSource);
|
|
9953
|
-
}));
|
|
9954
|
-
} catch (e) {
|
|
9955
|
-
return Promise.reject(e);
|
|
9956
|
-
}
|
|
9957
|
-
};
|
|
9958
|
-
_proto.initialize = function initialize() {
|
|
9959
|
-
try {
|
|
9960
|
-
var _this5 = this;
|
|
9961
|
-
return Promise.resolve(_this5._fetchSupportedCurrenciesIfNeeded()).then(function () {});
|
|
9962
|
-
} catch (e) {
|
|
9963
|
-
return Promise.reject(e);
|
|
9964
|
-
}
|
|
9965
|
-
};
|
|
9966
|
-
_proto.getIconUrl = function getIconUrl(coinOrTicker) {
|
|
9967
|
-
var loggerSource = "getIconUrl";
|
|
9968
|
-
try {
|
|
9969
|
-
var _this$_supportedCoins2, _this$_supportedCoins3;
|
|
9970
|
-
var coin = coinOrTicker;
|
|
9971
|
-
if (!(coinOrTicker instanceof Coin)) {
|
|
9972
|
-
var _this$_supportedCoins;
|
|
9973
|
-
coin = (_this$_supportedCoins = this._supportedCoins.find(function (i) {
|
|
9974
|
-
return i.coin.ticker === coinOrTicker;
|
|
9975
|
-
})) == null ? void 0 : _this$_supportedCoins.coin;
|
|
9976
|
-
}
|
|
9977
|
-
return (_this$_supportedCoins2 = (_this$_supportedCoins3 = this._supportedCoins.find(function (item) {
|
|
9978
|
-
var _item$coin2, _coin;
|
|
9979
|
-
return ((_item$coin2 = item.coin) == null ? void 0 : _item$coin2.ticker) === ((_coin = coin) == null ? void 0 : _coin.ticker);
|
|
9980
|
-
})) == null ? void 0 : _this$_supportedCoins3.iconURL) != null ? _this$_supportedCoins2 : FALLBACK_ASSET_ICON_URL;
|
|
9981
|
-
} catch (e) {
|
|
9982
|
-
improveAndRethrow(e, loggerSource);
|
|
9983
|
-
}
|
|
9984
|
-
};
|
|
9985
10153
|
_proto._fetchSupportedCurrenciesIfNeeded = function _fetchSupportedCurrenciesIfNeeded() {
|
|
9986
10154
|
try {
|
|
9987
|
-
var
|
|
10155
|
+
var _this2 = this;
|
|
9988
10156
|
var loggerSource = "_fetchSupportedCurrenciesIfNeeded";
|
|
9989
|
-
return Promise.resolve(_catch$
|
|
9990
|
-
var _temp = function (
|
|
9991
|
-
if (!((
|
|
9992
|
-
return Promise.resolve(axios__default["default"].get(
|
|
10157
|
+
return Promise.resolve(_catch$3(function () {
|
|
10158
|
+
var _temp = function (_this2$_supportedCoin) {
|
|
10159
|
+
if (!((_this2$_supportedCoin = _this2._supportedCoins) != null && _this2$_supportedCoin.length)) {
|
|
10160
|
+
return Promise.resolve(axios__default["default"].get(_this2._URL + "/api/v2/currencies")).then(function (rawResponse) {
|
|
9993
10161
|
var _rawResponse$data, _rawResponse$data2;
|
|
9994
10162
|
Logger.log("Retrieved " + (rawResponse == null || (_rawResponse$data = rawResponse.data) == null ? void 0 : _rawResponse$data.length), loggerSource);
|
|
9995
10163
|
var allowedCoins = (_rawResponse$data2 = rawResponse == null ? void 0 : rawResponse.data) != null ? _rawResponse$data2 : [];
|
|
9996
10164
|
Logger.log("Allowed cnt " + allowedCoins.length, loggerSource);
|
|
9997
|
-
|
|
9998
|
-
var coin =
|
|
9999
|
-
if (!coin && !
|
|
10000
|
-
var _item$name;
|
|
10165
|
+
_this2._supportedCoins = allowedCoins.map(function (item) {
|
|
10166
|
+
var coin = _this2._customCoinBuilder(item.code, item.network);
|
|
10167
|
+
if (!coin && !_this2.useRestrictedCoinsSet) {
|
|
10001
10168
|
/** Building coin object for coin that isn't supported OOB in Rabbit.
|
|
10002
10169
|
* We are doing this way to be able to use extended coins set for swaps.
|
|
10003
10170
|
* These temporary built coins are only for in-swap use, and we omit some usual
|
|
@@ -10011,11 +10178,7 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
|
|
|
10011
10178
|
/** Removing ticker and protocol name from coin name as we usually use them explicitly
|
|
10012
10179
|
* from coin object rather than counting on having it in the coin name itself.
|
|
10013
10180
|
* This processing is needed due to poor quality of swapspace coins names. */
|
|
10014
|
-
var name = (
|
|
10015
|
-
if (name === "") {
|
|
10016
|
-
// Rolling back to original name if our processing leads in empty name
|
|
10017
|
-
name = item.name;
|
|
10018
|
-
}
|
|
10181
|
+
var name = _this2.removeProtocolNameFromCoinName(item.name, code, network);
|
|
10019
10182
|
var ticker = "" + code + (code === network ? "" : network);
|
|
10020
10183
|
var defaultDecimalPlacesForCoinNotSupportedOOB = 8;
|
|
10021
10184
|
var defaultMinConfirmationsForCoinNotSupportedOOB = 1;
|
|
@@ -10031,16 +10194,17 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
|
|
|
10031
10194
|
network: item.network,
|
|
10032
10195
|
hasExtraId: item.hasExtraId,
|
|
10033
10196
|
extraIdName: item.extraIdName,
|
|
10034
|
-
isPopular:
|
|
10197
|
+
isPopular: item.popular ? 1 : 0,
|
|
10035
10198
|
iconURL: item.icon ? "https://storage.swapspace.co" + item.icon : FALLBACK_ASSET_ICON_URL,
|
|
10036
10199
|
deposit: (_item$deposit = item.deposit) != null ? _item$deposit : false,
|
|
10037
10200
|
withdrawal: (_item$withdrawal = item.withdrawal) != null ? _item$withdrawal : false,
|
|
10038
|
-
validationRegexp: (_item$validationRegex = item.validationRegexp) != null ? _item$validationRegex : null
|
|
10201
|
+
validationRegexp: (_item$validationRegex = item.validationRegexp) != null ? _item$validationRegex : null,
|
|
10202
|
+
isAvailable: true
|
|
10039
10203
|
};
|
|
10040
10204
|
}
|
|
10041
10205
|
return [];
|
|
10042
10206
|
}).flat();
|
|
10043
|
-
|
|
10207
|
+
_this2._putPopularCoinsFirst();
|
|
10044
10208
|
});
|
|
10045
10209
|
}
|
|
10046
10210
|
}();
|
|
@@ -10054,15 +10218,15 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
|
|
|
10054
10218
|
};
|
|
10055
10219
|
_proto._fetchPartnersListIfNeeded = function _fetchPartnersListIfNeeded() {
|
|
10056
10220
|
try {
|
|
10057
|
-
var
|
|
10221
|
+
var _this3 = this;
|
|
10058
10222
|
var loggerSource = "_fetchPartnersListIfNeeded";
|
|
10059
|
-
return Promise.resolve(_catch$
|
|
10060
|
-
var _temp2 = function (
|
|
10061
|
-
if (((
|
|
10062
|
-
return Promise.resolve(axios__default["default"].get(
|
|
10223
|
+
return Promise.resolve(_catch$3(function () {
|
|
10224
|
+
var _temp2 = function (_this3$_partners) {
|
|
10225
|
+
if (((_this3$_partners = _this3._partners) == null ? void 0 : _this3$_partners.length) === 0) {
|
|
10226
|
+
return Promise.resolve(axios__default["default"].get(_this3._URL + "/api/v2/partners")).then(function (rawResponse) {
|
|
10063
10227
|
var _rawResponse$data3;
|
|
10064
10228
|
Logger.log("Retrieved " + (rawResponse == null || (_rawResponse$data3 = rawResponse.data) == null ? void 0 : _rawResponse$data3.length) + " partners", loggerSource);
|
|
10065
|
-
|
|
10229
|
+
_this3._partners = Array.isArray(rawResponse == null ? void 0 : rawResponse.data) ? rawResponse == null ? void 0 : rawResponse.data : [];
|
|
10066
10230
|
});
|
|
10067
10231
|
}
|
|
10068
10232
|
}();
|
|
@@ -10073,99 +10237,30 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
|
|
|
10073
10237
|
} catch (e) {
|
|
10074
10238
|
return Promise.reject(e);
|
|
10075
10239
|
}
|
|
10076
|
-
}
|
|
10077
|
-
/**
|
|
10078
|
-
* This method sort internal list putting popular (as swapspace thinks) coins to the top.
|
|
10079
|
-
* 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.
|
|
10080
|
-
* @private
|
|
10081
|
-
*/
|
|
10082
|
-
;
|
|
10083
|
-
_proto._putPopularCoinsFirst = function _putPopularCoinsFirst() {
|
|
10084
|
-
this._supportedCoins.sort(function (i1, i2) {
|
|
10085
|
-
if (i1.isPopular && !i2.isPopular) return -1;
|
|
10086
|
-
if (i2.isPopular && !i1.isPopular) return 1;
|
|
10087
|
-
return i1.coin.ticker > i2.coin.ticker ? 1 : i1.coin.ticker < i2.coin.ticker ? -1 : 0;
|
|
10088
|
-
});
|
|
10089
|
-
};
|
|
10090
|
-
_proto.getCoinToUSDTRate = function getCoinToUSDTRate(coin) {
|
|
10091
|
-
try {
|
|
10092
|
-
var _this8 = this;
|
|
10093
|
-
var loggerSource = "getCoinToUSDTRate";
|
|
10094
|
-
return Promise.resolve(_catch$2(function () {
|
|
10095
|
-
return coin ? Promise.resolve(_this8._fetchSupportedCurrenciesIfNeeded()).then(function () {
|
|
10096
|
-
var _this8$_supportedCoin;
|
|
10097
|
-
// Using USDT TRC20 as usually fee in this network is smaller than ERC20 and this network is widely used for USDT
|
|
10098
|
-
var usdtTrc20 = (_this8$_supportedCoin = _this8._supportedCoins.find(function (i) {
|
|
10099
|
-
return i.coin.ticker === "USDTTRC20";
|
|
10100
|
-
})) == null ? void 0 : _this8$_supportedCoin.coin;
|
|
10101
|
-
if (!usdtTrc20) {
|
|
10102
|
-
return {
|
|
10103
|
-
result: false
|
|
10104
|
-
};
|
|
10105
|
-
}
|
|
10106
|
-
var cached = _this8._cache.get("swapspace_usdt_rate_" + coin.ticker);
|
|
10107
|
-
if (cached != null) {
|
|
10108
|
-
return {
|
|
10109
|
-
result: true,
|
|
10110
|
-
rate: cached
|
|
10111
|
-
};
|
|
10112
|
-
}
|
|
10113
|
-
Logger.log("Loading USDT->coin rate as not found in cache:", coin == null ? void 0 : coin.ticker);
|
|
10114
|
-
return Promise.resolve(_this8.getSwapInfo(usdtTrc20, coin, "5000", false)).then(function (result) {
|
|
10115
|
-
if (!result.result) {
|
|
10116
|
-
return {
|
|
10117
|
-
result: false
|
|
10118
|
-
};
|
|
10119
|
-
}
|
|
10120
|
-
|
|
10121
|
-
// This calculation is not precise as we cannot recognize the actual fee and network fee. Just approximate.
|
|
10122
|
-
var standardSwapspaceFeeMultiplier = 1.004; // fee is usually 0.4%
|
|
10123
|
-
var rate = bignumber_js.BigNumber(1).div(bignumber_js.BigNumber(result.rate).times(standardSwapspaceFeeMultiplier)).toString();
|
|
10124
|
-
_this8._cache.put("swapspace_usdt_rate_" + coin.ticker, rate, 15 * 60000 // 15 minutes
|
|
10125
|
-
);
|
|
10126
|
-
return {
|
|
10127
|
-
result: true,
|
|
10128
|
-
rate: rate
|
|
10129
|
-
};
|
|
10130
|
-
});
|
|
10131
|
-
}) : null;
|
|
10132
|
-
}, function (e) {
|
|
10133
|
-
improveAndRethrow(e, loggerSource);
|
|
10134
|
-
}));
|
|
10135
|
-
} catch (e) {
|
|
10136
|
-
return Promise.reject(e);
|
|
10137
|
-
}
|
|
10138
10240
|
};
|
|
10139
|
-
_proto.
|
|
10140
|
-
try {
|
|
10141
|
-
var _item$coin3;
|
|
10142
|
-
var item = this._supportedCoins.find(function (i) {
|
|
10143
|
-
return i.coin.ticker === ticker;
|
|
10144
|
-
});
|
|
10145
|
-
return (_item$coin3 = item == null ? void 0 : item.coin) != null ? _item$coin3 : null;
|
|
10146
|
-
} catch (e) {
|
|
10147
|
-
improveAndRethrow(e, "getCoinByTickerIfPresent");
|
|
10148
|
-
}
|
|
10149
|
-
};
|
|
10150
|
-
_proto.getSwapInfo = function getSwapInfo(fromCoin, toCoin, amountCoins, fixed, fromCoinToUsdRate) {
|
|
10241
|
+
_proto.getSwapInfo = function getSwapInfo(fromCoin, toCoin, amountCoins, fixed, fromCoinToUsdRate, amountIsToReceive) {
|
|
10151
10242
|
if (fixed === void 0) {
|
|
10152
10243
|
fixed = false;
|
|
10153
10244
|
}
|
|
10154
10245
|
if (fromCoinToUsdRate === void 0) {
|
|
10155
10246
|
fromCoinToUsdRate = null;
|
|
10156
10247
|
}
|
|
10248
|
+
if (amountIsToReceive === void 0) {
|
|
10249
|
+
amountIsToReceive = false;
|
|
10250
|
+
}
|
|
10157
10251
|
try {
|
|
10158
|
-
var
|
|
10252
|
+
var _this4 = this;
|
|
10159
10253
|
var loggerSource = "getSwapInfo";
|
|
10160
|
-
return Promise.resolve(_catch$
|
|
10254
|
+
return Promise.resolve(_catch$3(function () {
|
|
10255
|
+
if (amountIsToReceive) throw new Error("Swapspace doesn't support exchanging to get the exact receiving amount");
|
|
10161
10256
|
if (!(fromCoin instanceof Coin) || !(toCoin instanceof Coin) || typeof amountCoins !== "string" || bignumber_js.BigNumber(amountCoins).lt("0") || fixed !== null && typeof fixed !== "boolean") {
|
|
10162
10257
|
throw new Error("Wrong input params: " + amountCoins + " " + fromCoin.ticker + " -> " + toCoin.ticker + ", " + (fromCoin instanceof Coin) + ", " + (toCoin instanceof Coin) + ", " + typeof fixed + " " + fixed);
|
|
10163
10258
|
}
|
|
10164
|
-
var fromCoinSwapspaceDetails =
|
|
10259
|
+
var fromCoinSwapspaceDetails = _this4._supportedCoins.find(function (i) {
|
|
10165
10260
|
var _i$coin;
|
|
10166
10261
|
return ((_i$coin = i.coin) == null ? void 0 : _i$coin.ticker) === (fromCoin == null ? void 0 : fromCoin.ticker);
|
|
10167
10262
|
});
|
|
10168
|
-
var toCoinSwapspaceDetails =
|
|
10263
|
+
var toCoinSwapspaceDetails = _this4._supportedCoins.find(function (i) {
|
|
10169
10264
|
var _i$coin2;
|
|
10170
10265
|
return ((_i$coin2 = i.coin) == null ? void 0 : _i$coin2.ticker) === (toCoin == null ? void 0 : toCoin.ticker);
|
|
10171
10266
|
});
|
|
@@ -10175,11 +10270,11 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
|
|
|
10175
10270
|
return !fromCoinSwapspaceDetails.deposit || !toCoinSwapspaceDetails.withdrawal ? {
|
|
10176
10271
|
result: false,
|
|
10177
10272
|
reason: SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED
|
|
10178
|
-
} : Promise.resolve(axios__default["default"].get(
|
|
10273
|
+
} : Promise.resolve(axios__default["default"].get(_this4._URL + "/api/v2/amounts?fromCurrency=" + fromCoinSwapspaceDetails.code + "&fromNetwork=" + fromCoinSwapspaceDetails.network + "&toNetwork=" + toCoinSwapspaceDetails.network + "&toCurrency=" + toCoinSwapspaceDetails.code + "&amount=" + amountCoins + "&estimated=false")).then(function (response) {
|
|
10179
10274
|
var _response$data, _exchangesSupportingT;
|
|
10180
10275
|
var _exit;
|
|
10181
|
-
function _temp4(
|
|
10182
|
-
if (_exit) return
|
|
10276
|
+
function _temp4(_result2) {
|
|
10277
|
+
if (_exit) return _result2;
|
|
10183
10278
|
var result = {
|
|
10184
10279
|
result: false,
|
|
10185
10280
|
reason: smallestMin && bignumber_js.BigNumber(amountCoins).lt(smallestMin) ? SwapProvider.NO_SWAPS_REASONS.TOO_LOW : greatestMax && bignumber_js.BigNumber(amountCoins).gt(greatestMax) ? SwapProvider.NO_SWAPS_REASONS.TOO_HIGH : SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED,
|
|
@@ -10273,9 +10368,9 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
|
|
|
10273
10368
|
}
|
|
10274
10369
|
}
|
|
10275
10370
|
var rate = bestOpt.toAmount && bestOpt.fromAmount ? bignumber_js.BigNumber(bestOpt.toAmount).div(bestOpt.fromAmount) : null;
|
|
10276
|
-
return Promise.resolve(
|
|
10371
|
+
return Promise.resolve(_this4._fetchPartnersListIfNeeded()).then(function () {
|
|
10277
10372
|
var _bestOpt$duration;
|
|
10278
|
-
var partner =
|
|
10373
|
+
var partner = _this4._partners.find(function (p) {
|
|
10279
10374
|
var _bestOpt$partner;
|
|
10280
10375
|
return (bestOpt == null || (_bestOpt$partner = bestOpt.partner) == null ? void 0 : _bestOpt$partner.toLowerCase()) === p.path.toLowerCase();
|
|
10281
10376
|
});
|
|
@@ -10286,7 +10381,7 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
|
|
|
10286
10381
|
max: max,
|
|
10287
10382
|
smallestMin: smallestMin,
|
|
10288
10383
|
greatestMax: greatestMax,
|
|
10289
|
-
rate: rate != null ? AmountUtils.trim(rate,
|
|
10384
|
+
rate: rate != null ? AmountUtils.trim(rate, _this4._maxRateDigits) : null,
|
|
10290
10385
|
durationMinutesRange: (_bestOpt$duration = bestOpt.duration) != null ? _bestOpt$duration : null,
|
|
10291
10386
|
fixed: bestOpt.fixed,
|
|
10292
10387
|
rawSwapData: bestOpt,
|
|
@@ -10300,8 +10395,8 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
|
|
|
10300
10395
|
return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
|
|
10301
10396
|
});
|
|
10302
10397
|
}, function (e) {
|
|
10303
|
-
var _e$
|
|
10304
|
-
if ((e == null || (_e$
|
|
10398
|
+
var _e$response;
|
|
10399
|
+
if ((e == null || (_e$response = e.response) == null ? void 0 : _e$response.status) === 429) {
|
|
10305
10400
|
return {
|
|
10306
10401
|
result: false,
|
|
10307
10402
|
reason: SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
@@ -10314,18 +10409,22 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
|
|
|
10314
10409
|
return Promise.reject(e);
|
|
10315
10410
|
}
|
|
10316
10411
|
};
|
|
10317
|
-
_proto.createSwap = function createSwap(fromCoin, toCoin, amount, toAddress, refundAddress, rawSwapData, clientIpAddress, fixed, toCurrencyExtraId, refundExtraId) {
|
|
10412
|
+
_proto.createSwap = function createSwap(fromCoin, toCoin, amount, toAddress, refundAddress, rawSwapData, clientIpAddress, fixed, toCurrencyExtraId, refundExtraId, amountIsToReceive) {
|
|
10318
10413
|
if (toCurrencyExtraId === void 0) {
|
|
10319
10414
|
toCurrencyExtraId = "";
|
|
10320
10415
|
}
|
|
10321
10416
|
if (refundExtraId === void 0) {
|
|
10322
10417
|
refundExtraId = "";
|
|
10323
10418
|
}
|
|
10419
|
+
if (amountIsToReceive === void 0) {
|
|
10420
|
+
amountIsToReceive = false;
|
|
10421
|
+
}
|
|
10324
10422
|
try {
|
|
10325
|
-
var
|
|
10423
|
+
var _this5 = this;
|
|
10326
10424
|
var loggerSource = "createSwap";
|
|
10327
10425
|
var partner = rawSwapData == null ? void 0 : rawSwapData.partner;
|
|
10328
|
-
return Promise.resolve(_catch$
|
|
10426
|
+
return Promise.resolve(_catch$3(function () {
|
|
10427
|
+
if (amountIsToReceive) throw new Error("Swapspace doesn't support exchanging to get the exact receiving amount");
|
|
10329
10428
|
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) {
|
|
10330
10429
|
throw new Error("Invalid input: " + fromCoin + " " + toCoin + " " + amount + " " + toAddress + " " + refundAddress + " " + (clientIpAddress == null ? void 0 : clientIpAddress.length) + " " + fixed);
|
|
10331
10430
|
}
|
|
@@ -10333,12 +10432,12 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
|
|
|
10333
10432
|
) {
|
|
10334
10433
|
throw new Error("Invalid raw swap data: " + safeStringify(rawSwapData));
|
|
10335
10434
|
}
|
|
10336
|
-
var
|
|
10435
|
+
var _this5$_supportedCoin = _this5._supportedCoins.reduce(function (prev, coinData) {
|
|
10337
10436
|
return [coinData.coin.ticker === fromCoin.ticker ? coinData.hasExtraId : prev[0], coinData.coin.ticker === toCoin.ticker ? coinData.hasExtraId : prev[1]];
|
|
10338
10437
|
}, [false, false]),
|
|
10339
|
-
fromCurrencyHasExtraId =
|
|
10340
|
-
toCurrencyHasExtraId =
|
|
10341
|
-
return Promise.resolve(
|
|
10438
|
+
fromCurrencyHasExtraId = _this5$_supportedCoin[0],
|
|
10439
|
+
toCurrencyHasExtraId = _this5$_supportedCoin[1];
|
|
10440
|
+
return Promise.resolve(_this5._fetchSupportedCurrenciesIfNeeded()).then(function () {
|
|
10342
10441
|
var _toCurrencyExtraId, _refundExtraId;
|
|
10343
10442
|
var requestData = {
|
|
10344
10443
|
partner: partner,
|
|
@@ -10357,7 +10456,7 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
|
|
|
10357
10456
|
refund: refundAddress
|
|
10358
10457
|
};
|
|
10359
10458
|
Logger.log("Sending create request: " + safeStringify(requestData), loggerSource);
|
|
10360
|
-
return Promise.resolve(axios__default["default"].post(
|
|
10459
|
+
return Promise.resolve(axios__default["default"].post(_this5._URL + "/api/v2/exchange", requestData)).then(function (response) {
|
|
10361
10460
|
var result = response.data;
|
|
10362
10461
|
Logger.log("Creation result " + safeStringify(result), loggerSource);
|
|
10363
10462
|
if (result != null && result.id) {
|
|
@@ -10382,7 +10481,7 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
|
|
|
10382
10481
|
toAmount: AmountUtils.trim(result == null || (_result$to4 = result.to) == null ? void 0 : _result$to4.amount, toCoin.digits),
|
|
10383
10482
|
toAddress: result == null || (_result$to5 = result.to) == null ? void 0 : _result$to5.address,
|
|
10384
10483
|
fromCurrencyExtraId: (_result$from$extraId = result == null || (_result$from6 = result.from) == null ? void 0 : _result$from6.extraId) != null ? _result$from$extraId : "",
|
|
10385
|
-
rate: AmountUtils.trim(rate,
|
|
10484
|
+
rate: AmountUtils.trim(rate, _this5._maxRateDigits),
|
|
10386
10485
|
fixed: result.fixed
|
|
10387
10486
|
};
|
|
10388
10487
|
}
|
|
@@ -10392,7 +10491,7 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
|
|
|
10392
10491
|
});
|
|
10393
10492
|
});
|
|
10394
10493
|
}, function (e) {
|
|
10395
|
-
var _e$
|
|
10494
|
+
var _e$response2, _e$response3;
|
|
10396
10495
|
Logger.logError(e, loggerSource, "Failed to create swap. Error is: " + safeStringify(e));
|
|
10397
10496
|
var composeFailResult = function composeFailResult(reason) {
|
|
10398
10497
|
return {
|
|
@@ -10401,8 +10500,8 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
|
|
|
10401
10500
|
partner: partner
|
|
10402
10501
|
};
|
|
10403
10502
|
};
|
|
10404
|
-
var status = e == null || (_e$
|
|
10405
|
-
var data = e == null || (_e$
|
|
10503
|
+
var status = e == null || (_e$response2 = e.response) == null ? void 0 : _e$response2.status;
|
|
10504
|
+
var data = e == null || (_e$response3 = e.response) == null ? void 0 : _e$response3.data;
|
|
10406
10505
|
if (status === 429) {
|
|
10407
10506
|
Logger.log("Returning fail - RPS limit exceeded " + data, loggerSource);
|
|
10408
10507
|
return composeFailResult(SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED);
|
|
@@ -10451,9 +10550,9 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
|
|
|
10451
10550
|
};
|
|
10452
10551
|
_proto.getExistingSwapsDetailsAndStatus = function getExistingSwapsDetailsAndStatus(swapIds) {
|
|
10453
10552
|
try {
|
|
10454
|
-
var
|
|
10553
|
+
var _this6 = this;
|
|
10455
10554
|
var loggerSource = "getExistingSwapsDetailsAndStatus";
|
|
10456
|
-
return Promise.resolve(_catch$
|
|
10555
|
+
return Promise.resolve(_catch$3(function () {
|
|
10457
10556
|
if (swapIds.find(function (id) {
|
|
10458
10557
|
return typeof id !== "string";
|
|
10459
10558
|
})) {
|
|
@@ -10461,8 +10560,8 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
|
|
|
10461
10560
|
}
|
|
10462
10561
|
var getNotFailingOn404 = function getNotFailingOn404(swapId) {
|
|
10463
10562
|
try {
|
|
10464
|
-
return Promise.resolve(_catch$
|
|
10465
|
-
return Promise.resolve(axios__default["default"].get(
|
|
10563
|
+
return Promise.resolve(_catch$3(function () {
|
|
10564
|
+
return Promise.resolve(axios__default["default"].get(_this6._URL + "/api/v2/exchange/" + swapId));
|
|
10466
10565
|
}, function (error) {
|
|
10467
10566
|
var _error$response;
|
|
10468
10567
|
if ((error == null || (_error$response = error.response) == null ? void 0 : _error$response.status) === 404) return [];
|
|
@@ -10482,13 +10581,13 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
|
|
|
10482
10581
|
var swaps = wo404.map(function (r) {
|
|
10483
10582
|
return r.data;
|
|
10484
10583
|
}).map(function (swap, index) {
|
|
10485
|
-
var
|
|
10486
|
-
var fromCoin = (
|
|
10584
|
+
var _this6$_supportedCoin, _this6$_supportedCoin2, _swap$from$extraId, _swap$to$extraId, _swap$refundExtraId;
|
|
10585
|
+
var fromCoin = (_this6$_supportedCoin = _this6._supportedCoins.find(function (i) {
|
|
10487
10586
|
return i.code === swap.from.code && i.network === swap.from.network;
|
|
10488
|
-
})) == null ? void 0 :
|
|
10489
|
-
var toCoin = (
|
|
10587
|
+
})) == null ? void 0 : _this6$_supportedCoin.coin;
|
|
10588
|
+
var toCoin = (_this6$_supportedCoin2 = _this6._supportedCoins.find(function (i) {
|
|
10490
10589
|
return i.code === swap.to.code && i.network === swap.to.network;
|
|
10491
|
-
})) == null ? void 0 :
|
|
10590
|
+
})) == null ? void 0 : _this6$_supportedCoin2.coin;
|
|
10492
10591
|
if (!fromCoin || !toCoin) {
|
|
10493
10592
|
return []; // We skip swaps with not supported coins for now
|
|
10494
10593
|
}
|
|
@@ -10497,10 +10596,10 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
|
|
|
10497
10596
|
};
|
|
10498
10597
|
var expiresAt = toUtcTimestamp(swap.timestamps.expiresAt);
|
|
10499
10598
|
var isExpiredByTime = expiresAt < Date.now();
|
|
10500
|
-
var status =
|
|
10599
|
+
var status = _this6._mapSwapspaceStatusToRabbitStatus(swap.status, isExpiredByTime);
|
|
10501
10600
|
var toDigits = status === SwapProvider.SWAP_STATUSES.REFUNDED ? fromCoin.digits : toCoin.digits;
|
|
10502
10601
|
var addressToSendCoinsToSwapspace = swap.from.address;
|
|
10503
|
-
return new ExistingSwap(swapIds[index], status, toUtcTimestamp(swap.timestamps.createdAt), expiresAt, swap.confirmations, AmountUtils.trim(swap.rate,
|
|
10602
|
+
return new ExistingSwap(swapIds[index], status, toUtcTimestamp(swap.timestamps.createdAt), expiresAt, swap.confirmations, AmountUtils.trim(swap.rate, _this6._maxRateDigits), swap.fixed, swap.refundAddress, addressToSendCoinsToSwapspace, fromCoin, AmountUtils.trim(swap.from.amount, fromCoin.digits), swap.from.transactionHash, swap.blockExplorerTransactionUrl.from, toCoin, AmountUtils.trim(swap.to.amount, toDigits), swap.to.transactionHash, swap.blockExplorerTransactionUrl.to, swap.to.address, swap.partner, (_swap$from$extraId = swap.from.extraId) != null ? _swap$from$extraId : null, (_swap$to$extraId = swap.to.extraId) != null ? _swap$to$extraId : null, (_swap$refundExtraId = swap.refundExtraId) != null ? _swap$refundExtraId : null);
|
|
10504
10603
|
}).flat();
|
|
10505
10604
|
Logger.log("Swap details result " + safeStringify(swaps), loggerSource);
|
|
10506
10605
|
return {
|
|
@@ -10509,7 +10608,7 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
|
|
|
10509
10608
|
};
|
|
10510
10609
|
});
|
|
10511
10610
|
}, function (e) {
|
|
10512
|
-
var _e$
|
|
10611
|
+
var _e$response4, _e$response5;
|
|
10513
10612
|
Logger.logError(e, loggerSource, "Failed to get swap details. Error is: " + safeStringify(e));
|
|
10514
10613
|
var composeFailResult = function composeFailResult(reason) {
|
|
10515
10614
|
return {
|
|
@@ -10517,8 +10616,8 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
|
|
|
10517
10616
|
reason: reason
|
|
10518
10617
|
};
|
|
10519
10618
|
};
|
|
10520
|
-
var status = e == null || (_e$
|
|
10521
|
-
var data = e == null || (_e$
|
|
10619
|
+
var status = e == null || (_e$response4 = e.response) == null ? void 0 : _e$response4.status;
|
|
10620
|
+
var data = e == null || (_e$response5 = e.response) == null ? void 0 : _e$response5.data;
|
|
10522
10621
|
if (status === 429) {
|
|
10523
10622
|
Logger.log("Returning fail - RPS limit exceeded " + data, loggerSource);
|
|
10524
10623
|
return composeFailResult(SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED);
|
|
@@ -10529,45 +10628,10 @@ var SwapspaceSwapProvider = /*#__PURE__*/function (_SwapProvider) {
|
|
|
10529
10628
|
return Promise.reject(e);
|
|
10530
10629
|
}
|
|
10531
10630
|
};
|
|
10532
|
-
_proto.isAddressValidForAsset = function isAddressValidForAsset(asset, address) {
|
|
10533
|
-
try {
|
|
10534
|
-
var assetData = this._supportedCoins.find(function (i) {
|
|
10535
|
-
var _i$coin3;
|
|
10536
|
-
return ((_i$coin3 = i.coin) == null ? void 0 : _i$coin3.ticker) === (asset == null ? void 0 : asset.ticker);
|
|
10537
|
-
});
|
|
10538
|
-
if (assetData) {
|
|
10539
|
-
var corrected = assetData.validationRegexp.trim();
|
|
10540
|
-
corrected = corrected[0] === "/" ? corrected.slice(1) : corrected;
|
|
10541
|
-
corrected = corrected[corrected.length - 1] === "/" ? corrected.slice(0, corrected.length - 1) : corrected;
|
|
10542
|
-
return address.match(corrected) != null;
|
|
10543
|
-
}
|
|
10544
|
-
} catch (e) {
|
|
10545
|
-
Logger.logError(e, "isAddressValidForAsset");
|
|
10546
|
-
}
|
|
10547
|
-
return false;
|
|
10548
|
-
};
|
|
10549
|
-
_proto.getExtraIdNameIfPresent = function getExtraIdNameIfPresent(asset) {
|
|
10550
|
-
try {
|
|
10551
|
-
var assetData = this._supportedCoins.find(function (i) {
|
|
10552
|
-
var _i$coin4;
|
|
10553
|
-
return ((_i$coin4 = i.coin) == null ? void 0 : _i$coin4.ticker) === (asset == null ? void 0 : asset.ticker);
|
|
10554
|
-
});
|
|
10555
|
-
if (assetData != null && assetData.hasExtraId) {
|
|
10556
|
-
if ((assetData == null ? void 0 : assetData.extraIdName) == null || (assetData == null ? void 0 : assetData.extraIdName) === "") {
|
|
10557
|
-
// We return some default name if the extraIdName is empty
|
|
10558
|
-
return "ID";
|
|
10559
|
-
}
|
|
10560
|
-
return assetData == null ? void 0 : assetData.extraIdName;
|
|
10561
|
-
}
|
|
10562
|
-
return null;
|
|
10563
|
-
} catch (e) {
|
|
10564
|
-
improveAndRethrow(e, "getExtraIdNameIfPresent");
|
|
10565
|
-
}
|
|
10566
|
-
};
|
|
10567
10631
|
return SwapspaceSwapProvider;
|
|
10568
10632
|
}(SwapProvider);
|
|
10569
10633
|
|
|
10570
|
-
function _catch$
|
|
10634
|
+
function _catch$2(body, recover) {
|
|
10571
10635
|
try {
|
|
10572
10636
|
var result = body();
|
|
10573
10637
|
} catch (e) {
|
|
@@ -10764,134 +10828,590 @@ var SwapUtils = /*#__PURE__*/function () {
|
|
|
10764
10828
|
if (coinToCurrentFiatRate === void 0) {
|
|
10765
10829
|
coinToCurrentFiatRate = null;
|
|
10766
10830
|
}
|
|
10767
|
-
if (fiatCurrencyDecimals === void 0) {
|
|
10768
|
-
fiatCurrencyDecimals = null;
|
|
10831
|
+
if (fiatCurrencyDecimals === void 0) {
|
|
10832
|
+
fiatCurrencyDecimals = null;
|
|
10833
|
+
}
|
|
10834
|
+
try {
|
|
10835
|
+
var loggerSource = "getInitialSwapData";
|
|
10836
|
+
return Promise.resolve(_catch$2(function () {
|
|
10837
|
+
/* We use some amount here that should fit at least some of the limits of the swap providers.
|
|
10838
|
+
* So we are going to get some rate to be used as the default for the on-flight calculations before we get
|
|
10839
|
+
* the exact rate (that should be retrieved by getSwapCreationInfo method) for a specific amount.
|
|
10840
|
+
*/
|
|
10841
|
+
var defaultAmountUsd = bignumber_js.BigNumber("300");
|
|
10842
|
+
return Promise.resolve(swapProvider.getCoinToUSDTRate(fromCoin)).then(function (coinUsdRate) {
|
|
10843
|
+
var coinAmountForDefaultUsdAmount = AmountUtils.trim(coinUsdRate.result ? defaultAmountUsd.div(coinUsdRate == null ? void 0 : coinUsdRate.rate) : defaultAmountUsd, fromCoin.digits);
|
|
10844
|
+
Logger.log("Init: " + coinAmountForDefaultUsdAmount + " " + fromCoin.ticker + "->" + toCoin.ticker, loggerSource);
|
|
10845
|
+
return Promise.resolve(swapProvider.getSwapInfo(fromCoin, toCoin, coinAmountForDefaultUsdAmount)).then(function (details) {
|
|
10846
|
+
var _coinToCurrentFiatRat, _fiatCurrencyDecimals;
|
|
10847
|
+
if (!details) {
|
|
10848
|
+
throw new Error("The details are empty: " + safeStringify(details));
|
|
10849
|
+
}
|
|
10850
|
+
if (!details.result) {
|
|
10851
|
+
Logger.log("Failed with reason: " + details.reason + ". " + fromCoin.ticker + "->" + toCoin.ticker, loggerSource);
|
|
10852
|
+
if ((details == null ? void 0 : details.reason) === SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED || (details == null ? void 0 : details.reason) === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) {
|
|
10853
|
+
return {
|
|
10854
|
+
result: false,
|
|
10855
|
+
reason: details.reason
|
|
10856
|
+
};
|
|
10857
|
+
} else {
|
|
10858
|
+
throw new Error("Unhandled error case: " + (details == null ? void 0 : details.reason));
|
|
10859
|
+
}
|
|
10860
|
+
}
|
|
10861
|
+
var fiatMin = null;
|
|
10862
|
+
var fiatMax = null;
|
|
10863
|
+
var fiatRate = (_coinToCurrentFiatRat = coinToCurrentFiatRate) != null ? _coinToCurrentFiatRat : coinUsdRate == null ? void 0 : coinUsdRate.rate;
|
|
10864
|
+
var fiatDecimals = (_fiatCurrencyDecimals = fiatCurrencyDecimals) != null ? _fiatCurrencyDecimals : FiatCurrenciesService.getCurrencyDecimalCountByCode("USD");
|
|
10865
|
+
if (fiatRate != null) {
|
|
10866
|
+
fiatMin = bignumber_js.BigNumber(details == null ? void 0 : details.smallestMin).times(fiatRate).toFixed(fiatDecimals);
|
|
10867
|
+
fiatMax = bignumber_js.BigNumber(details == null ? void 0 : details.greatestMax).times(fiatRate).toFixed(fiatDecimals);
|
|
10868
|
+
}
|
|
10869
|
+
var result = {
|
|
10870
|
+
result: true,
|
|
10871
|
+
min: details == null ? void 0 : details.smallestMin,
|
|
10872
|
+
fiatMin: fiatMin,
|
|
10873
|
+
max: details == null ? void 0 : details.greatestMax,
|
|
10874
|
+
fiatMax: fiatMax,
|
|
10875
|
+
rate: AmountUtils.trim(details.rate, 30)
|
|
10876
|
+
};
|
|
10877
|
+
Logger.log("Returning: " + safeStringify(result), loggerSource);
|
|
10878
|
+
return result;
|
|
10879
|
+
});
|
|
10880
|
+
});
|
|
10881
|
+
}, function (e) {
|
|
10882
|
+
Logger.logError(e, loggerSource, "Failed to init swap: " + safeStringify(e));
|
|
10883
|
+
improveAndRethrow(e, loggerSource);
|
|
10884
|
+
}));
|
|
10885
|
+
} catch (e) {
|
|
10886
|
+
return Promise.reject(e);
|
|
10887
|
+
}
|
|
10888
|
+
};
|
|
10889
|
+
SwapUtils.safeHandleRequestsLimitExceeding = function safeHandleRequestsLimitExceeding() {
|
|
10890
|
+
(function () {
|
|
10891
|
+
try {
|
|
10892
|
+
var _temp = _catch$2(function () {
|
|
10893
|
+
return Promise.resolve(EmailsApi.sendEmail("AUTOMATIC EMAIL - SWAPSPACE REQUESTS LIMIT EXCEEDED", "Requests limit exceeded. Urgently ask swaps provider support for limit increasing")).then(function () {});
|
|
10894
|
+
}, function (e) {
|
|
10895
|
+
Logger.log("Failed to handle limit exceeding " + safeStringify(e), "_safeHandleRequestsLimitExceeding");
|
|
10896
|
+
});
|
|
10897
|
+
return _temp && _temp.then ? _temp.then(function () {}) : void 0;
|
|
10898
|
+
} catch (e) {
|
|
10899
|
+
Promise.reject(e);
|
|
10900
|
+
}
|
|
10901
|
+
})();
|
|
10902
|
+
}
|
|
10903
|
+
|
|
10904
|
+
/**
|
|
10905
|
+
* If some swap is not found by id then there is no item in return list.
|
|
10906
|
+
*
|
|
10907
|
+
* @param swapProviders {SwapProvider[]} - Array of swap providers
|
|
10908
|
+
* @param swapIds {string[]} - Array of swap IDs
|
|
10909
|
+
* @return {Promise<{
|
|
10910
|
+
* result: true,
|
|
10911
|
+
* swaps: ExistingSwapWithFiatData[]
|
|
10912
|
+
* }|{
|
|
10913
|
+
* result: false,
|
|
10914
|
+
* reason: string
|
|
10915
|
+
* }>}
|
|
10916
|
+
*/;
|
|
10917
|
+
SwapUtils.getExistingSwapsDetailsWithFiatAmounts = function getExistingSwapsDetailsWithFiatAmounts(swapProviders, swapIds) {
|
|
10918
|
+
try {
|
|
10919
|
+
return Promise.resolve(_catch$2(function () {
|
|
10920
|
+
var _interrupt;
|
|
10921
|
+
function _temp8() {
|
|
10922
|
+
if (swapIds.length > 0 && allSwaps.length === 0 && failResults.length > 0) {
|
|
10923
|
+
var failReasons = failResults.map(function (r) {
|
|
10924
|
+
return r.reason;
|
|
10925
|
+
});
|
|
10926
|
+
return {
|
|
10927
|
+
result: false,
|
|
10928
|
+
reason: failReasons.find(function (r) {
|
|
10929
|
+
return r !== SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED;
|
|
10930
|
+
}) ? failReasons.join("\n") : SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
10931
|
+
};
|
|
10932
|
+
}
|
|
10933
|
+
return {
|
|
10934
|
+
result: true,
|
|
10935
|
+
swaps: allSwaps
|
|
10936
|
+
};
|
|
10937
|
+
}
|
|
10938
|
+
var allSwaps = [];
|
|
10939
|
+
var remainingSwapIds = new Set(swapIds);
|
|
10940
|
+
var failResults = [];
|
|
10941
|
+
var _temp7 = _forOf(swapProviders, function (provider) {
|
|
10942
|
+
return Promise.resolve(provider.getExistingSwapsDetailsAndStatus([].concat(remainingSwapIds))).then(function (result) {
|
|
10943
|
+
var _temp6 = function () {
|
|
10944
|
+
if (result.result) {
|
|
10945
|
+
var _temp5 = function _temp5() {
|
|
10946
|
+
allSwaps = allSwaps.concat(_extendedSwaps);
|
|
10947
|
+
|
|
10948
|
+
// Stop if we have retrieved all swaps
|
|
10949
|
+
if (allSwaps.length >= swapIds.length) {
|
|
10950
|
+
_interrupt = 1;
|
|
10951
|
+
}
|
|
10952
|
+
};
|
|
10953
|
+
var _extendedSwaps = [];
|
|
10954
|
+
var _temp4 = _forOf(result.swaps, function (swap) {
|
|
10955
|
+
function _temp3() {
|
|
10956
|
+
remainingSwapIds["delete"](swap.id);
|
|
10957
|
+
}
|
|
10958
|
+
var _temp2 = function () {
|
|
10959
|
+
if (swap.status === SwapProvider.SWAP_STATUSES.REFUNDED) {
|
|
10960
|
+
return Promise.resolve(provider.getCoinToUSDTRate(swap.fromCoin)).then(function (rate) {
|
|
10961
|
+
_extendedSwaps.push(ExistingSwapWithFiatData.fromExistingSwap(swap, (rate == null ? void 0 : rate.rate) != null ? bignumber_js.BigNumber(swap.fromAmount).times(rate.rate).toNumber() : null, (rate == null ? void 0 : rate.rate) != null ? bignumber_js.BigNumber(swap.toAmount).times(rate.rate).toNumber() : null, "USD", FiatCurrenciesService.getCurrencyDecimalCountByCode("USD")));
|
|
10962
|
+
});
|
|
10963
|
+
} else {
|
|
10964
|
+
return Promise.resolve(Promise.all([provider.getCoinToUSDTRate(swap.fromCoin), provider.getCoinToUSDTRate(swap.toCoin)])).then(function (_ref) {
|
|
10965
|
+
var fromCoinFiatRate = _ref[0],
|
|
10966
|
+
toCoinFiatRate = _ref[1];
|
|
10967
|
+
_extendedSwaps.push(ExistingSwapWithFiatData.fromExistingSwap(swap, (fromCoinFiatRate == null ? void 0 : fromCoinFiatRate.rate) != null ? bignumber_js.BigNumber(swap.fromAmount).times(fromCoinFiatRate.rate).toNumber() : null, (toCoinFiatRate == null ? void 0 : toCoinFiatRate.rate) != null ? bignumber_js.BigNumber(swap.toAmount).times(toCoinFiatRate.rate).toNumber() : null, "USD", FiatCurrenciesService.getCurrencyDecimalCountByCode("USD")));
|
|
10968
|
+
});
|
|
10969
|
+
}
|
|
10970
|
+
}();
|
|
10971
|
+
return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2);
|
|
10972
|
+
});
|
|
10973
|
+
return _temp4 && _temp4.then ? _temp4.then(_temp5) : _temp5(_temp4);
|
|
10974
|
+
} else {
|
|
10975
|
+
failResults.push(result);
|
|
10976
|
+
}
|
|
10977
|
+
}();
|
|
10978
|
+
if (_temp6 && _temp6.then) return _temp6.then(function () {});
|
|
10979
|
+
});
|
|
10980
|
+
}, function () {
|
|
10981
|
+
return _interrupt;
|
|
10982
|
+
});
|
|
10983
|
+
return _temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7);
|
|
10984
|
+
}, function (e) {
|
|
10985
|
+
improveAndRethrow(e, "getExistingSwapsDetailsWithFiatAmounts");
|
|
10986
|
+
}));
|
|
10987
|
+
} catch (e) {
|
|
10988
|
+
return Promise.reject(e);
|
|
10989
|
+
}
|
|
10990
|
+
};
|
|
10991
|
+
return SwapUtils;
|
|
10992
|
+
}();
|
|
10993
|
+
|
|
10994
|
+
function _catch$1(body, recover) {
|
|
10995
|
+
try {
|
|
10996
|
+
var result = body();
|
|
10997
|
+
} catch (e) {
|
|
10998
|
+
return recover(e);
|
|
10999
|
+
}
|
|
11000
|
+
if (result && result.then) {
|
|
11001
|
+
return result.then(void 0, recover);
|
|
11002
|
+
}
|
|
11003
|
+
return result;
|
|
11004
|
+
}
|
|
11005
|
+
var LetsExchangeSwapProvider = /*#__PURE__*/function (_SwapProvider) {
|
|
11006
|
+
_inheritsLoose(LetsExchangeSwapProvider, _SwapProvider);
|
|
11007
|
+
function LetsExchangeSwapProvider(apiKeysProxyUrl, cache, customCoinBuilder, useRestrictedCoinsSet) {
|
|
11008
|
+
var _this;
|
|
11009
|
+
if (customCoinBuilder === void 0) {
|
|
11010
|
+
customCoinBuilder = function customCoinBuilder(coin, network) {
|
|
11011
|
+
return null;
|
|
11012
|
+
};
|
|
11013
|
+
}
|
|
11014
|
+
if (useRestrictedCoinsSet === void 0) {
|
|
11015
|
+
useRestrictedCoinsSet = true;
|
|
11016
|
+
}
|
|
11017
|
+
_this = _SwapProvider.call(this, cache, customCoinBuilder, useRestrictedCoinsSet) || this;
|
|
11018
|
+
_this._partners = [];
|
|
11019
|
+
_this._URL = apiKeysProxyUrl + "/letsexchange";
|
|
11020
|
+
_this.isAggregator = false;
|
|
11021
|
+
_this.COINS_EXPIRATION_TIME_MS = 5 * 60 * 1000;
|
|
11022
|
+
_this.coinsLastUpdateTimestamp = null;
|
|
11023
|
+
return _this;
|
|
11024
|
+
}
|
|
11025
|
+
var _proto = LetsExchangeSwapProvider.prototype;
|
|
11026
|
+
_proto.getSwapCreationInfoTtlMs = function getSwapCreationInfoTtlMs() {
|
|
11027
|
+
return 110000;
|
|
11028
|
+
};
|
|
11029
|
+
_proto._fetchSupportedCurrenciesIfNeeded = function _fetchSupportedCurrenciesIfNeeded() {
|
|
11030
|
+
try {
|
|
11031
|
+
var _this2 = this;
|
|
11032
|
+
var loggerSource = "_fetchSupportedCurrenciesIfNeeded";
|
|
11033
|
+
return Promise.resolve(_catch$1(function () {
|
|
11034
|
+
var _temp = function (_this2$_supportedCoin) {
|
|
11035
|
+
if (!((_this2$_supportedCoin = _this2._supportedCoins) != null && _this2$_supportedCoin.length) || !_this2.coinsLastUpdateTimestamp || _this2.coinsLastUpdateTimestamp + _this2.COINS_EXPIRATION_TIME_MS < Date.now()) {
|
|
11036
|
+
return Promise.resolve(axios__default["default"].get(_this2._URL + "/v2/coins")).then(function (rawResponse) {
|
|
11037
|
+
var _rawResponse$data, _rawResponse$data2;
|
|
11038
|
+
Logger.log("Retrieved " + (rawResponse == null || (_rawResponse$data = rawResponse.data) == null ? void 0 : _rawResponse$data.length), loggerSource);
|
|
11039
|
+
var allowedCoins = (_rawResponse$data2 = rawResponse == null ? void 0 : rawResponse.data) != null ? _rawResponse$data2 : [];
|
|
11040
|
+
Logger.log("Allowed cnt " + allowedCoins.length, loggerSource);
|
|
11041
|
+
_this2._supportedCoins = allowedCoins.map(function (item) {
|
|
11042
|
+
var code = item.code.toUpperCase();
|
|
11043
|
+
if (!Array.isArray(item.networks)) return [];
|
|
11044
|
+
return item.networks.map(function (networkDetails) {
|
|
11045
|
+
var network = networkDetails.code.toUpperCase();
|
|
11046
|
+
var coin = _this2._customCoinBuilder(code, network);
|
|
11047
|
+
if (!coin && !_this2.useRestrictedCoinsSet) {
|
|
11048
|
+
var name = _this2.removeProtocolNameFromCoinName(item.name, code, network);
|
|
11049
|
+
var ticker = "" + code + (code === network ? "" : network);
|
|
11050
|
+
var defaultDecimalPlacesForCoinNotSupportedOOB = DEFAULT_CRYPTO_DECIMAL_COUNT;
|
|
11051
|
+
var defaultMinConfirmationsForCoinNotSupportedOOB = 1;
|
|
11052
|
+
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);
|
|
11053
|
+
}
|
|
11054
|
+
if (coin) {
|
|
11055
|
+
var _networkDetails$extra, _networkDetails$valid;
|
|
11056
|
+
return {
|
|
11057
|
+
coin: coin,
|
|
11058
|
+
code: item.code,
|
|
11059
|
+
network: networkDetails.code,
|
|
11060
|
+
hasExtraId: !!networkDetails.has_extra,
|
|
11061
|
+
extraIdName: (_networkDetails$extra = networkDetails.extra_name) != null ? _networkDetails$extra : null,
|
|
11062
|
+
isPopular: item.rating || 0,
|
|
11063
|
+
iconURL: item.icon ? item.icon : FALLBACK_ASSET_ICON_URL,
|
|
11064
|
+
deposit: true,
|
|
11065
|
+
// Letsexchange provide no such details
|
|
11066
|
+
withdrawal: true,
|
|
11067
|
+
// Letsexchange provide no such details
|
|
11068
|
+
validationRegexp: (_networkDetails$valid = networkDetails.validation_address_regex) != null ? _networkDetails$valid : null,
|
|
11069
|
+
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)
|
|
11070
|
+
};
|
|
11071
|
+
}
|
|
11072
|
+
return [];
|
|
11073
|
+
});
|
|
11074
|
+
}).flat();
|
|
11075
|
+
_this2.coinsLastUpdateTimestamp = Date.now();
|
|
11076
|
+
_this2._putPopularCoinsFirst();
|
|
11077
|
+
});
|
|
11078
|
+
}
|
|
11079
|
+
}();
|
|
11080
|
+
if (_temp && _temp.then) return _temp.then(function () {});
|
|
11081
|
+
}, function (e) {
|
|
11082
|
+
improveAndRethrow(e, loggerSource);
|
|
11083
|
+
}));
|
|
11084
|
+
} catch (e) {
|
|
11085
|
+
return Promise.reject(e);
|
|
11086
|
+
}
|
|
11087
|
+
};
|
|
11088
|
+
_proto.getSwapInfo = function getSwapInfo(fromCoin, toCoin, amountCoins, fixed, fromCoinToUsdRate, amountIsToReceive) {
|
|
11089
|
+
if (fixed === void 0) {
|
|
11090
|
+
fixed = false;
|
|
11091
|
+
}
|
|
11092
|
+
if (amountIsToReceive === void 0) {
|
|
11093
|
+
amountIsToReceive = false;
|
|
11094
|
+
}
|
|
11095
|
+
try {
|
|
11096
|
+
var _this3 = this;
|
|
11097
|
+
var loggerSource = "getSwapInfo";
|
|
11098
|
+
return Promise.resolve(_catch$1(function () {
|
|
11099
|
+
if (!(fromCoin instanceof Coin) || !(toCoin instanceof Coin) || typeof amountCoins !== "string" || bignumber_js.BigNumber(amountCoins).lt("0") || fixed !== null && typeof fixed !== "boolean" || amountIsToReceive && !fixed) {
|
|
11100
|
+
throw new Error("Wrong input params: " + amountCoins + " " + fromCoin.ticker + " -> " + toCoin.ticker + ", " + (fromCoin instanceof Coin) + ", " + (toCoin instanceof Coin) + ", " + typeof fixed + " " + fixed + ", " + amountIsToReceive);
|
|
11101
|
+
}
|
|
11102
|
+
var fromCoinDetails = _this3._supportedCoins.find(function (i) {
|
|
11103
|
+
var _i$coin;
|
|
11104
|
+
return ((_i$coin = i.coin) == null ? void 0 : _i$coin.ticker) === (fromCoin == null ? void 0 : fromCoin.ticker);
|
|
11105
|
+
});
|
|
11106
|
+
var toCoinDetails = _this3._supportedCoins.find(function (i) {
|
|
11107
|
+
var _i$coin2;
|
|
11108
|
+
return ((_i$coin2 = i.coin) == null ? void 0 : _i$coin2.ticker) === (toCoin == null ? void 0 : toCoin.ticker);
|
|
11109
|
+
});
|
|
11110
|
+
if (!fromCoinDetails || !toCoinDetails) {
|
|
11111
|
+
throw new Error("Failed to find coin details for: " + fromCoin.ticker + " -> " + toCoin.ticker);
|
|
11112
|
+
}
|
|
11113
|
+
if (!fromCoinDetails.deposit || !fromCoinDetails.isAvailable || !toCoinDetails.withdrawal || !toCoinDetails.isAvailable) {
|
|
11114
|
+
return {
|
|
11115
|
+
result: false,
|
|
11116
|
+
reason: SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED
|
|
11117
|
+
};
|
|
11118
|
+
}
|
|
11119
|
+
var pathAndQuery = "/v1/info" + (amountIsToReceive ? "-revert" : "?float=" + !fixed);
|
|
11120
|
+
return Promise.resolve(axios__default["default"].post("" + _this3._URL + pathAndQuery, {
|
|
11121
|
+
from: fromCoinDetails.code,
|
|
11122
|
+
to: toCoinDetails.code,
|
|
11123
|
+
network_from: fromCoinDetails.network,
|
|
11124
|
+
network_to: toCoinDetails.network,
|
|
11125
|
+
amount: amountCoins,
|
|
11126
|
+
affiliate_id: LetsExchangeSwapProvider.AFFILIATE_ID
|
|
11127
|
+
})).then(function (response) {
|
|
11128
|
+
Logger.log("Retrieved " + (response == null ? void 0 : response.data), loggerSource);
|
|
11129
|
+
var data = response.data;
|
|
11130
|
+
|
|
11131
|
+
// TODO: [dev] add SwapProvider.NO_SWAPS_REASONS.NO_FIXED_BUT_HAVE_FLOATING - request alternative rate. task_id=
|
|
11132
|
+
|
|
11133
|
+
// TODO: [feature, low] implement extra coins to fit min/max if there are frequent errors due to min/max exceeding
|
|
11134
|
+
// let extraCoinsToFitMinMax = "0";
|
|
11135
|
+
// if (typeof fromCoinToUsdRate === "string" && BigNumber(fromCoinToUsdRate).gt("0")) {
|
|
11136
|
+
// const extraUsdToFitMinMax = BigNumber("1"); // We correct the limits as the exact limit can fluctuate and cause failed swap creation
|
|
11137
|
+
// extraCoinsToFitMinMax = AmountUtils.trim(extraUsdToFitMinMax.div(fromCoinToUsdRate), fromCoin.digits);
|
|
11138
|
+
// }
|
|
11139
|
+
var min = null;
|
|
11140
|
+
if (data != null && data.min_amount) {
|
|
11141
|
+
min = AmountUtils.trim(data == null ? void 0 : data.min_amount, amountIsToReceive ? toCoin.digits : fromCoin.digits);
|
|
11142
|
+
}
|
|
11143
|
+
var max = null;
|
|
11144
|
+
if (data != null && data.max_amount) {
|
|
11145
|
+
max = AmountUtils.trim(data == null ? void 0 : data.max_amount, amountIsToReceive ? toCoin.digits : fromCoin.digits);
|
|
11146
|
+
}
|
|
11147
|
+
if (data.success === false && data.error) {
|
|
11148
|
+
// TODO: [dev] waiting for response from letsexchange about their not-documented responses
|
|
11149
|
+
// {
|
|
11150
|
+
// "success": false,
|
|
11151
|
+
// "error": "Internal error"
|
|
11152
|
+
// }
|
|
11153
|
+
throw new Error("Failed to estimate swap letsexchange");
|
|
11154
|
+
}
|
|
11155
|
+
if (bignumber_js.BigNumber(data.rate).eq("0") || bignumber_js.BigNumber(data.amount).eq("0")) {
|
|
11156
|
+
// TODO actualize according to letsexchage clarification - decide, can we count on min/max abcense? task_id=76512110797f4eab8b37f1bb789825cb
|
|
11157
|
+
// amount: "0", rate: "0", rate_id: ""
|
|
11158
|
+
var reason = SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED;
|
|
11159
|
+
if (min && bignumber_js.BigNumber(amountCoins).lt(min)) {
|
|
11160
|
+
reason = SwapProvider.NO_SWAPS_REASONS.TOO_LOW;
|
|
11161
|
+
} else if (max && bignumber_js.BigNumber(amountCoins).gt(max)) {
|
|
11162
|
+
reason = SwapProvider.NO_SWAPS_REASONS.TOO_HIGH;
|
|
11163
|
+
} else if (!amountIsToReceive) {
|
|
11164
|
+
// If we are not requesting receiving amount (it cannot be floating-rate)
|
|
11165
|
+
// todo [feature, moderate] request alternative rate. task_id=31884db5392f49738c20a86115c90e1f
|
|
11166
|
+
// const alternativeRate = 1;
|
|
11167
|
+
// const alternativeRateAvailable = alternativeRate;
|
|
11168
|
+
// if (alternativeRateAvailable) {
|
|
11169
|
+
// reason = fixed
|
|
11170
|
+
// ? SwapProvider.NO_SWAPS_REASONS.NO_FIXED_BUT_HAVE_FLOATING
|
|
11171
|
+
// : SwapProvider.NO_SWAPS_REASONS.NO_FLOATING_BUT_HAVE_FIXED;
|
|
11172
|
+
// }
|
|
11173
|
+
}
|
|
11174
|
+
return {
|
|
11175
|
+
result: false,
|
|
11176
|
+
reason: reason,
|
|
11177
|
+
smallestMin: min,
|
|
11178
|
+
greatestMax: max
|
|
11179
|
+
};
|
|
11180
|
+
}
|
|
11181
|
+
var rate = amountIsToReceive ? bignumber_js.BigNumber(amountCoins).div(data.amount) : bignumber_js.BigNumber(data.amount).div(amountCoins);
|
|
11182
|
+
return {
|
|
11183
|
+
result: true,
|
|
11184
|
+
min: min,
|
|
11185
|
+
max: max,
|
|
11186
|
+
smallestMin: min,
|
|
11187
|
+
greatestMax: max,
|
|
11188
|
+
rate: AmountUtils.trim(rate, _this3._maxRateDigits),
|
|
11189
|
+
durationMinutesRange: null,
|
|
11190
|
+
fixed: fixed,
|
|
11191
|
+
rawSwapData: data,
|
|
11192
|
+
isRefundAddressRequired: false
|
|
11193
|
+
};
|
|
11194
|
+
});
|
|
11195
|
+
}, function (e) {
|
|
11196
|
+
var _e$response;
|
|
11197
|
+
if ((e == null || (_e$response = e.response) == null ? void 0 : _e$response.status) === 429) {
|
|
11198
|
+
return {
|
|
11199
|
+
result: false,
|
|
11200
|
+
reason: SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED
|
|
11201
|
+
};
|
|
11202
|
+
}
|
|
11203
|
+
Logger.log("Internal error when getting swap options " + safeStringify(e), loggerSource);
|
|
11204
|
+
improveAndRethrow(e, loggerSource);
|
|
11205
|
+
}));
|
|
11206
|
+
} catch (e) {
|
|
11207
|
+
return Promise.reject(e);
|
|
11208
|
+
}
|
|
11209
|
+
};
|
|
11210
|
+
_proto.createSwap = function createSwap(fromCoin, toCoin, amount, toAddress, refundAddress, rawSwapData, clientIpAddress, fixed, toCurrencyExtraId, refundExtraId, amountIsToReceive) {
|
|
11211
|
+
if (toCurrencyExtraId === void 0) {
|
|
11212
|
+
toCurrencyExtraId = "";
|
|
11213
|
+
}
|
|
11214
|
+
if (refundExtraId === void 0) {
|
|
11215
|
+
refundExtraId = "";
|
|
11216
|
+
}
|
|
11217
|
+
if (amountIsToReceive === void 0) {
|
|
11218
|
+
amountIsToReceive = false;
|
|
10769
11219
|
}
|
|
10770
11220
|
try {
|
|
10771
|
-
var
|
|
11221
|
+
var _this4 = this;
|
|
11222
|
+
var loggerSource = "createSwap";
|
|
10772
11223
|
return Promise.resolve(_catch$1(function () {
|
|
10773
|
-
|
|
10774
|
-
|
|
10775
|
-
|
|
10776
|
-
|
|
10777
|
-
|
|
10778
|
-
|
|
10779
|
-
|
|
10780
|
-
|
|
10781
|
-
return
|
|
10782
|
-
|
|
10783
|
-
|
|
10784
|
-
|
|
10785
|
-
|
|
10786
|
-
|
|
10787
|
-
|
|
10788
|
-
|
|
10789
|
-
|
|
10790
|
-
|
|
10791
|
-
|
|
10792
|
-
|
|
10793
|
-
|
|
10794
|
-
|
|
10795
|
-
|
|
10796
|
-
|
|
10797
|
-
|
|
10798
|
-
|
|
10799
|
-
|
|
10800
|
-
|
|
10801
|
-
|
|
10802
|
-
|
|
10803
|
-
|
|
10804
|
-
|
|
10805
|
-
|
|
11224
|
+
if (!(fromCoin instanceof Coin) || !(toCoin instanceof Coin) || typeof amount !== "string" || typeof toAddress !== "string" || typeof refundAddress !== "string" || typeof clientIpAddress != "string" || typeof fixed != "boolean") {
|
|
11225
|
+
throw new Error("Invalid input: " + fromCoin + " " + toCoin + " " + amount + " " + toAddress + " " + refundAddress + " " + fixed);
|
|
11226
|
+
}
|
|
11227
|
+
if (typeof rawSwapData !== "object" || fixed && !rawSwapData.rate_id) {
|
|
11228
|
+
throw new Error("Invalid raw swap data: " + safeStringify(rawSwapData));
|
|
11229
|
+
}
|
|
11230
|
+
var fromCoinDetails = _this4._supportedCoins.find(function (i) {
|
|
11231
|
+
var _i$coin3;
|
|
11232
|
+
return ((_i$coin3 = i.coin) == null ? void 0 : _i$coin3.ticker) === (fromCoin == null ? void 0 : fromCoin.ticker);
|
|
11233
|
+
});
|
|
11234
|
+
var toCoinDetails = _this4._supportedCoins.find(function (i) {
|
|
11235
|
+
var _i$coin4;
|
|
11236
|
+
return ((_i$coin4 = i.coin) == null ? void 0 : _i$coin4.ticker) === (toCoin == null ? void 0 : toCoin.ticker);
|
|
11237
|
+
});
|
|
11238
|
+
if (!fromCoinDetails || !toCoinDetails) {
|
|
11239
|
+
throw new Error("Failed to find coin details for: " + fromCoin.ticker + " -> " + toCoin.ticker);
|
|
11240
|
+
}
|
|
11241
|
+
var requestBody = {
|
|
11242
|
+
coin_from: fromCoinDetails.code,
|
|
11243
|
+
network_from: fromCoinDetails.network,
|
|
11244
|
+
coin_to: toCoinDetails.code,
|
|
11245
|
+
network_to: toCoinDetails.network,
|
|
11246
|
+
withdrawal: toAddress,
|
|
11247
|
+
withdrawal_extra_id: toCurrencyExtraId,
|
|
11248
|
+
"return": refundAddress,
|
|
11249
|
+
return_extra_id: refundExtraId,
|
|
11250
|
+
affiliate_id: LetsExchangeSwapProvider.AFFILIATE_ID
|
|
11251
|
+
};
|
|
11252
|
+
if (amountIsToReceive) {
|
|
11253
|
+
requestBody.withdrawal_amount = amount;
|
|
11254
|
+
} else {
|
|
11255
|
+
requestBody.deposit_amount = amount;
|
|
11256
|
+
}
|
|
11257
|
+
if (fixed) {
|
|
11258
|
+
requestBody.rate_id = rawSwapData.rate_id;
|
|
11259
|
+
}
|
|
11260
|
+
return Promise.resolve(axios__default["default"].post(_this4._URL + "/v1/transaction" + (amountIsToReceive ? "-revert" : "?float=" + !fixed), requestBody)).then(function (response) {
|
|
11261
|
+
var result = response.data;
|
|
11262
|
+
Logger.log("Creation result " + safeStringify(result), loggerSource);
|
|
11263
|
+
if (result != null && result.transaction_id) {
|
|
11264
|
+
var _result$rate, _result$deposit_extra;
|
|
11265
|
+
var rate = bignumber_js.BigNumber((_result$rate = result.rate) != null ? _result$rate : 0).isZero() ? bignumber_js.BigNumber(result.withdrawal_amount).div(result.deposit_amount) : bignumber_js.BigNumber(result.rate);
|
|
11266
|
+
return {
|
|
10806
11267
|
result: true,
|
|
10807
|
-
|
|
10808
|
-
|
|
10809
|
-
|
|
10810
|
-
|
|
10811
|
-
|
|
11268
|
+
swapId: result.transaction_id,
|
|
11269
|
+
fromCoin: fromCoin,
|
|
11270
|
+
fromAmount: AmountUtils.trim(result.deposit_amount, fromCoin.digits),
|
|
11271
|
+
fromAddress: result.deposit,
|
|
11272
|
+
toCoin: toCoin,
|
|
11273
|
+
toAmount: AmountUtils.trim(result.withdrawal_amount, toCoin.digits),
|
|
11274
|
+
toAddress: result.withdrawal,
|
|
11275
|
+
fromCurrencyExtraId: (_result$deposit_extra = result.deposit_extra_id) != null ? _result$deposit_extra : "",
|
|
11276
|
+
rate: AmountUtils.trim(rate, _this4._maxRateDigits),
|
|
11277
|
+
fixed: !result.is_float
|
|
10812
11278
|
};
|
|
10813
|
-
|
|
10814
|
-
|
|
10815
|
-
|
|
11279
|
+
}
|
|
11280
|
+
var errorMessage = "Swap creation succeeded but the response is wrong: " + safeStringify(response);
|
|
11281
|
+
Logger.log(errorMessage, loggerSource);
|
|
11282
|
+
throw new Error(errorMessage);
|
|
10816
11283
|
});
|
|
10817
11284
|
}, function (e) {
|
|
10818
|
-
|
|
11285
|
+
var _e$response2, _e$response3;
|
|
11286
|
+
Logger.logError(e, loggerSource, "Failed to create swap. Error is: " + safeStringify(e));
|
|
11287
|
+
var composeFailResult = function composeFailResult(reason) {
|
|
11288
|
+
return {
|
|
11289
|
+
result: false,
|
|
11290
|
+
reason: reason
|
|
11291
|
+
};
|
|
11292
|
+
};
|
|
11293
|
+
var status = e == null || (_e$response2 = e.response) == null ? void 0 : _e$response2.status;
|
|
11294
|
+
var data = e == null || (_e$response3 = e.response) == null ? void 0 : _e$response3.data;
|
|
11295
|
+
if (status === 429) {
|
|
11296
|
+
Logger.log("Returning fail - RPS limit exceeded " + data, loggerSource);
|
|
11297
|
+
return composeFailResult(SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED);
|
|
11298
|
+
}
|
|
11299
|
+
// TODO: [feature, low] add custom errors handling - waiting for response from letsexchange. task_id=00d2e435f6df4fb99af912135bd9ee27
|
|
11300
|
+
// 422 - missing params
|
|
11301
|
+
Logger.log("Internal error for swap: " + safeStringify(e), loggerSource);
|
|
10819
11302
|
improveAndRethrow(e, loggerSource);
|
|
10820
11303
|
}));
|
|
10821
11304
|
} catch (e) {
|
|
10822
11305
|
return Promise.reject(e);
|
|
10823
11306
|
}
|
|
10824
11307
|
};
|
|
10825
|
-
|
|
10826
|
-
(function () {
|
|
10827
|
-
try {
|
|
10828
|
-
var _temp = _catch$1(function () {
|
|
10829
|
-
return Promise.resolve(EmailsApi.sendEmail("AUTOMATIC EMAIL - SWAPSPACE REQUESTS LIMIT EXCEEDED", "Requests limit exceeded. Urgently ask swaps provider support for limit increasing")).then(function () {});
|
|
10830
|
-
}, function (e) {
|
|
10831
|
-
Logger.log("Failed to handle limit exceeding " + safeStringify(e), "_safeHandleRequestsLimitExceeding");
|
|
10832
|
-
});
|
|
10833
|
-
return _temp && _temp.then ? _temp.then(function () {}) : void 0;
|
|
10834
|
-
} catch (e) {
|
|
10835
|
-
Promise.reject(e);
|
|
10836
|
-
}
|
|
10837
|
-
})();
|
|
10838
|
-
}
|
|
10839
|
-
|
|
10840
|
-
/**
|
|
10841
|
-
* If some swap is not found by id then there is no item in return list.
|
|
10842
|
-
*
|
|
10843
|
-
* @param swapProvider {SwapProvider}
|
|
10844
|
-
* @param swapIds {string[]}
|
|
10845
|
-
* @return {Promise<{
|
|
10846
|
-
* result: true,
|
|
10847
|
-
* swaps: ExistingSwapWithFiatData[]
|
|
10848
|
-
* }|{
|
|
10849
|
-
* result: false,
|
|
10850
|
-
* reason: string
|
|
10851
|
-
* }>}
|
|
10852
|
-
*/;
|
|
10853
|
-
SwapUtils.getExistingSwapsDetailsWithFiatAmounts = function getExistingSwapsDetailsWithFiatAmounts(swapProvider, swapIds) {
|
|
11308
|
+
_proto.getExistingSwapsDetailsAndStatus = function getExistingSwapsDetailsAndStatus(swapIds) {
|
|
10854
11309
|
try {
|
|
11310
|
+
var _this5 = this;
|
|
11311
|
+
var loggerSource = "getExistingSwapsDetailsAndStatus";
|
|
10855
11312
|
return Promise.resolve(_catch$1(function () {
|
|
10856
|
-
|
|
10857
|
-
|
|
10858
|
-
|
|
10859
|
-
|
|
10860
|
-
|
|
10861
|
-
|
|
10862
|
-
|
|
10863
|
-
|
|
10864
|
-
|
|
10865
|
-
|
|
10866
|
-
|
|
10867
|
-
|
|
10868
|
-
|
|
10869
|
-
|
|
10870
|
-
|
|
10871
|
-
|
|
10872
|
-
|
|
10873
|
-
_extendedSwaps.push(ExistingSwapWithFiatData.fromExistingSwap(swap, (fromCoinFiatRate == null ? void 0 : fromCoinFiatRate.rate) != null ? bignumber_js.BigNumber(swap.fromAmount).times(fromCoinFiatRate.rate).toNumber() : null, (toConFiatRate == null ? void 0 : toConFiatRate.rate) != null ? bignumber_js.BigNumber(swap.toAmount).times(toConFiatRate.rate).toNumber() : null, "USD", FiatCurrenciesService.getCurrencyDecimalCountByCode("USD")));
|
|
10874
|
-
});
|
|
10875
|
-
}
|
|
10876
|
-
}();
|
|
10877
|
-
if (_temp2 && _temp2.then) return _temp2.then(function () {});
|
|
10878
|
-
});
|
|
10879
|
-
return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
|
|
11313
|
+
if (swapIds.find(function (id) {
|
|
11314
|
+
return typeof id !== "string";
|
|
11315
|
+
})) {
|
|
11316
|
+
throw new Error("Swap id is not string: " + safeStringify(swapIds));
|
|
11317
|
+
}
|
|
11318
|
+
return Promise.resolve(axios__default["default"].get(_this5._URL + "/v1/transactions-list?ids[]=" + swapIds.join("&ids[]="))).then(function (response) {
|
|
11319
|
+
Logger.log("All swaps RAW: " + safeStringify(response.data), loggerSource);
|
|
11320
|
+
var swaps = response.data.map(function (swap, index) {
|
|
11321
|
+
var _this5$_supportedCoin, _this5$_supportedCoin2, _swap$deposit_extra_i, _swap$withdrawal_extr, _swap$return_extra_id;
|
|
11322
|
+
var fromCoin = (_this5$_supportedCoin = _this5._supportedCoins.find(function (i) {
|
|
11323
|
+
return i.code === swap.coin_from && i.network === swap.coin_from_network;
|
|
11324
|
+
})) == null ? void 0 : _this5$_supportedCoin.coin;
|
|
11325
|
+
var toCoin = (_this5$_supportedCoin2 = _this5._supportedCoins.find(function (i) {
|
|
11326
|
+
return i.code === swap.coin_to && i.network === swap.coin_to_network;
|
|
11327
|
+
})) == null ? void 0 : _this5$_supportedCoin2.coin;
|
|
11328
|
+
if (!fromCoin || !toCoin) {
|
|
11329
|
+
return []; // We skip swaps with not supported coins for now
|
|
10880
11330
|
}
|
|
10881
|
-
|
|
10882
|
-
|
|
10883
|
-
|
|
10884
|
-
|
|
11331
|
+
var toUtcTimestamp = function toUtcTimestamp(timeStr) {
|
|
11332
|
+
return Date.parse(timeStr.match(/.+[Zz]$/) ? timeStr : timeStr + "Z");
|
|
11333
|
+
};
|
|
11334
|
+
var expiresAt = swap.expired_at ? swap.expired_at * 1000 : null;
|
|
11335
|
+
var createdAt = swap.created_at ? toUtcTimestamp("" + swap.created_at) : null;
|
|
11336
|
+
var isExpiredByTime = expiresAt && expiresAt < Date.now();
|
|
11337
|
+
var status = _this5._mapLetsExchangeStatusToRabbitStatus(swap.status, isExpiredByTime);
|
|
11338
|
+
var toDigits = status === SwapProvider.SWAP_STATUSES.REFUNDED ? fromCoin.digits : toCoin.digits;
|
|
11339
|
+
return new ExistingSwap(swapIds[index], status, createdAt, expiresAt, swap.confirmations, AmountUtils.trim(swap.rate, _this5._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);
|
|
11340
|
+
}).flat();
|
|
11341
|
+
Logger.log("Swap details result " + safeStringify(swaps), loggerSource);
|
|
11342
|
+
return {
|
|
11343
|
+
result: true,
|
|
11344
|
+
swaps: swaps
|
|
11345
|
+
};
|
|
10885
11346
|
});
|
|
10886
11347
|
}, function (e) {
|
|
10887
|
-
|
|
11348
|
+
var _e$response4, _e$response5;
|
|
11349
|
+
Logger.logError(e, loggerSource, "Failed to get swap details. Error is: " + safeStringify(e));
|
|
11350
|
+
var composeFailResult = function composeFailResult(reason) {
|
|
11351
|
+
return {
|
|
11352
|
+
result: false,
|
|
11353
|
+
reason: reason
|
|
11354
|
+
};
|
|
11355
|
+
};
|
|
11356
|
+
var status = e == null || (_e$response4 = e.response) == null ? void 0 : _e$response4.status;
|
|
11357
|
+
var data = e == null || (_e$response5 = e.response) == null ? void 0 : _e$response5.data;
|
|
11358
|
+
if (status === 429) {
|
|
11359
|
+
Logger.log("Returning fail - RPS limit exceeded " + data, loggerSource);
|
|
11360
|
+
return composeFailResult(SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED);
|
|
11361
|
+
}
|
|
11362
|
+
improveAndRethrow(e, loggerSource);
|
|
10888
11363
|
}));
|
|
10889
11364
|
} catch (e) {
|
|
10890
11365
|
return Promise.reject(e);
|
|
10891
11366
|
}
|
|
11367
|
+
} // TODO: [dev] Serg, please check this during the review to make sure I did no mistakes in statuses mapping.
|
|
11368
|
+
// I will remove these comments after the review. https://api.letsexchange.io/doc
|
|
11369
|
+
// wait The exchange has just been created and it’s waiting for coins to reach the deposit wallet
|
|
11370
|
+
// confirmation The transaction appears in mempool and now it is waiting for necessary network confirmations to start.
|
|
11371
|
+
// confirmed The user’s payment is confirmed, the exchange process is about to start.
|
|
11372
|
+
// exchanging The exchange process is running.
|
|
11373
|
+
// sending Funds are being sent to the recipient`s address.
|
|
11374
|
+
// sending_confirmation The outgoing transaction is waiting for network confirmations.
|
|
11375
|
+
// success The exchange is completed and the funds are successfully sent to the recipient’s address.
|
|
11376
|
+
// aml_check_failed The deposit was marked as risky by AML check service.
|
|
11377
|
+
// overdue The deposit receiving time for this transaction has expired.
|
|
11378
|
+
// error The transaction has failed. In most cases, the amount that was sent differs from the amount that was specified when creating the transaction.
|
|
11379
|
+
// refund The exchange failed and the coins were refunded to the user's wallet.
|
|
11380
|
+
;
|
|
11381
|
+
_proto._mapLetsExchangeStatusToRabbitStatus = function _mapLetsExchangeStatusToRabbitStatus(status, isExpiredByTime) {
|
|
11382
|
+
switch (status) {
|
|
11383
|
+
case "wait":
|
|
11384
|
+
if (isExpiredByTime) {
|
|
11385
|
+
return SwapProvider.SWAP_STATUSES.EXPIRED;
|
|
11386
|
+
}
|
|
11387
|
+
return SwapProvider.SWAP_STATUSES.WAITING_FOR_PAYMENT;
|
|
11388
|
+
case "confirmation":
|
|
11389
|
+
return SwapProvider.SWAP_STATUSES.CONFIRMING;
|
|
11390
|
+
case "confirmed":
|
|
11391
|
+
return SwapProvider.SWAP_STATUSES.PAYMENT_RECEIVED;
|
|
11392
|
+
case "exchanging":
|
|
11393
|
+
return SwapProvider.SWAP_STATUSES.EXCHANGING;
|
|
11394
|
+
case "sending":
|
|
11395
|
+
return SwapProvider.SWAP_STATUSES.PAYMENT_RECEIVED;
|
|
11396
|
+
case "sending_confirmation":
|
|
11397
|
+
return SwapProvider.SWAP_STATUSES.EXCHANGING;
|
|
11398
|
+
case "success":
|
|
11399
|
+
return SwapProvider.SWAP_STATUSES.COMPLETED;
|
|
11400
|
+
case "refund":
|
|
11401
|
+
return SwapProvider.SWAP_STATUSES.REFUNDED;
|
|
11402
|
+
case "overdue":
|
|
11403
|
+
return SwapProvider.SWAP_STATUSES.EXPIRED;
|
|
11404
|
+
case "aml_check_failed":
|
|
11405
|
+
return SwapProvider.SWAP_STATUSES.EXCHANGING;
|
|
11406
|
+
case "error":
|
|
11407
|
+
return SwapProvider.SWAP_STATUSES.FAILED;
|
|
11408
|
+
default:
|
|
11409
|
+
throw new Error("Unknown LetsExchange status: " + status);
|
|
11410
|
+
}
|
|
10892
11411
|
};
|
|
10893
|
-
return
|
|
10894
|
-
}();
|
|
11412
|
+
return LetsExchangeSwapProvider;
|
|
11413
|
+
}(SwapProvider);
|
|
11414
|
+
LetsExchangeSwapProvider.AFFILIATE_ID = "0zbj9hf7xg7jgdgv";
|
|
10895
11415
|
|
|
10896
11416
|
function _catch(body, recover) {
|
|
10897
11417
|
try {
|
|
@@ -10909,13 +11429,16 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
10909
11429
|
this._swapProvider = new SwapspaceSwapProvider(apiKeysProxyUrl, cache, function () {
|
|
10910
11430
|
return null;
|
|
10911
11431
|
}, false);
|
|
11432
|
+
this._fixedSwapProvider = new LetsExchangeSwapProvider(apiKeysProxyUrl, cache, function () {
|
|
11433
|
+
return null;
|
|
11434
|
+
}, false);
|
|
10912
11435
|
}
|
|
10913
11436
|
var _proto = PublicSwapService.prototype;
|
|
10914
11437
|
_proto.initialize = function initialize() {
|
|
10915
11438
|
try {
|
|
10916
11439
|
var _this = this;
|
|
10917
11440
|
var _temp = _catch(function () {
|
|
10918
|
-
return Promise.resolve(_this._swapProvider.initialize()).then(function () {});
|
|
11441
|
+
return Promise.resolve(Promise.all([_this._swapProvider.initialize(), _this._fixedSwapProvider.initialize()])).then(function () {});
|
|
10919
11442
|
}, function (e) {
|
|
10920
11443
|
Logger.logError(e, "PublicSwapService.initialize");
|
|
10921
11444
|
});
|
|
@@ -10923,39 +11446,61 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
10923
11446
|
} catch (e) {
|
|
10924
11447
|
return Promise.reject(e);
|
|
10925
11448
|
}
|
|
10926
|
-
}
|
|
11449
|
+
}
|
|
11450
|
+
/**
|
|
11451
|
+
* Gets all currencies across all partners. Useful for sitemap or supported currencies count/list.
|
|
11452
|
+
*
|
|
11453
|
+
* @return {Promise<{result: boolean, coins: Coin[]}|{result: boolean, reason: string}>}
|
|
11454
|
+
*/
|
|
11455
|
+
;
|
|
10927
11456
|
_proto.getAllSupportedCurrenciesListForPublicSwap = function getAllSupportedCurrenciesListForPublicSwap() {
|
|
10928
11457
|
try {
|
|
10929
11458
|
var _this2 = this;
|
|
10930
11459
|
var loggerSource = "getAllSupportedCurrenciesListForPublicSwap";
|
|
10931
11460
|
return Promise.resolve(_catch(function () {
|
|
10932
|
-
return Promise.resolve(_this2.
|
|
10933
|
-
|
|
10934
|
-
|
|
10935
|
-
|
|
11461
|
+
return Promise.resolve(_this2.initialize()).then(function () {
|
|
11462
|
+
return Promise.resolve(Promise.all([_this2._fixedSwapProvider.getAllSupportedCurrencies(), _this2._swapProvider.getAllSupportedCurrencies()])).then(function (result) {
|
|
11463
|
+
var _result$0$coins, _result$1$coins, _result$coins;
|
|
11464
|
+
var allCoins = [].concat((_result$0$coins = result[0].coins) != null ? _result$0$coins : []);
|
|
11465
|
+
((_result$1$coins = result[1].coins) != null ? _result$1$coins : []).forEach(function (c) {
|
|
11466
|
+
if (!allCoins.find(function (existingCoin) {
|
|
11467
|
+
return existingCoin.ticker === c.ticker;
|
|
11468
|
+
})) {
|
|
11469
|
+
allCoins.push(c);
|
|
11470
|
+
}
|
|
11471
|
+
});
|
|
11472
|
+
if (result[0].reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED || result[1].reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) {
|
|
11473
|
+
SwapUtils.safeHandleRequestsLimitExceeding();
|
|
11474
|
+
// TODO: [dev] improve this during the whitebit integration. task_id=20e7e41211b540d081bf98f392a34b2c
|
|
11475
|
+
// return {
|
|
11476
|
+
// result: false,
|
|
11477
|
+
// reason: PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED,
|
|
11478
|
+
// };
|
|
11479
|
+
} else if (result[0].reason || result[1].reason) {
|
|
11480
|
+
console.log("Failed to get all supported coins", result[0].reason, result[1].reason);
|
|
11481
|
+
}
|
|
11482
|
+
Logger.log("Retrieved " + (result == null || (_result$coins = result.coins) == null ? void 0 : _result$coins.length) + " supported currencies for swap", loggerSource);
|
|
10936
11483
|
return {
|
|
10937
|
-
result:
|
|
10938
|
-
|
|
11484
|
+
result: true,
|
|
11485
|
+
coins: allCoins
|
|
10939
11486
|
};
|
|
10940
|
-
}
|
|
10941
|
-
Logger.log("Retrieved " + (result == null || (_result$coins = result.coins) == null ? void 0 : _result$coins.length) + " supported currencies for swap", loggerSource);
|
|
10942
|
-
return {
|
|
10943
|
-
result: true,
|
|
10944
|
-
coins: result.coins
|
|
10945
|
-
};
|
|
11487
|
+
});
|
|
10946
11488
|
});
|
|
10947
11489
|
}, function (e) {
|
|
10948
|
-
improveAndRethrow(e, "
|
|
11490
|
+
improveAndRethrow(e, "getAllSupportedCurrenciesListForPublicSwap");
|
|
10949
11491
|
}));
|
|
10950
11492
|
} catch (e) {
|
|
10951
11493
|
return Promise.reject(e);
|
|
10952
11494
|
}
|
|
10953
11495
|
};
|
|
10954
|
-
_proto.getDepositCurrenciesListForPublicSwap = function getDepositCurrenciesListForPublicSwap() {
|
|
11496
|
+
_proto.getDepositCurrenciesListForPublicSwap = function getDepositCurrenciesListForPublicSwap(fixed) {
|
|
11497
|
+
if (fixed === void 0) {
|
|
11498
|
+
fixed = false;
|
|
11499
|
+
}
|
|
10955
11500
|
try {
|
|
10956
11501
|
var _this3 = this;
|
|
10957
11502
|
return Promise.resolve(_catch(function () {
|
|
10958
|
-
return Promise.resolve(_this3._getCurrenciesListForPublicSwap(false));
|
|
11503
|
+
return Promise.resolve(_this3._getCurrenciesListForPublicSwap(false, fixed));
|
|
10959
11504
|
}, function (e) {
|
|
10960
11505
|
improveAndRethrow(e, "getDepositCurrenciesListForPublicSwap");
|
|
10961
11506
|
}));
|
|
@@ -10963,11 +11508,14 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
10963
11508
|
return Promise.reject(e);
|
|
10964
11509
|
}
|
|
10965
11510
|
};
|
|
10966
|
-
_proto.getWithdrawCurrenciesListForPublicSwap = function getWithdrawCurrenciesListForPublicSwap() {
|
|
11511
|
+
_proto.getWithdrawCurrenciesListForPublicSwap = function getWithdrawCurrenciesListForPublicSwap(fixed) {
|
|
11512
|
+
if (fixed === void 0) {
|
|
11513
|
+
fixed = false;
|
|
11514
|
+
}
|
|
10967
11515
|
try {
|
|
10968
11516
|
var _this4 = this;
|
|
10969
11517
|
return Promise.resolve(_catch(function () {
|
|
10970
|
-
return Promise.resolve(_this4._getCurrenciesListForPublicSwap(true));
|
|
11518
|
+
return Promise.resolve(_this4._getCurrenciesListForPublicSwap(true, fixed));
|
|
10971
11519
|
}, function (e) {
|
|
10972
11520
|
improveAndRethrow(e, "getWithdrawCurrenciesListForPublicSwap");
|
|
10973
11521
|
}));
|
|
@@ -10975,15 +11523,19 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
10975
11523
|
return Promise.reject(e);
|
|
10976
11524
|
}
|
|
10977
11525
|
};
|
|
10978
|
-
_proto._getCurrenciesListForPublicSwap = function _getCurrenciesListForPublicSwap(withdraw) {
|
|
11526
|
+
_proto._getCurrenciesListForPublicSwap = function _getCurrenciesListForPublicSwap(withdraw, fixed) {
|
|
10979
11527
|
if (withdraw === void 0) {
|
|
10980
11528
|
withdraw = false;
|
|
10981
11529
|
}
|
|
11530
|
+
if (fixed === void 0) {
|
|
11531
|
+
fixed = false;
|
|
11532
|
+
}
|
|
10982
11533
|
try {
|
|
10983
11534
|
var _this5 = this;
|
|
10984
11535
|
var loggerSource = "getCurrenciesListForPublicSwap";
|
|
10985
11536
|
return Promise.resolve(_catch(function () {
|
|
10986
|
-
|
|
11537
|
+
var provider = fixed ? _this5._fixedSwapProvider : _this5._swapProvider;
|
|
11538
|
+
return Promise.resolve(withdraw ? provider.getWithdrawalCurrencies() : provider.getDepositCurrencies()).then(function (result) {
|
|
10987
11539
|
var _result$coins2;
|
|
10988
11540
|
if (result.reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) {
|
|
10989
11541
|
SwapUtils.safeHandleRequestsLimitExceeding();
|
|
@@ -11008,6 +11560,9 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
11008
11560
|
/**
|
|
11009
11561
|
* Retrieves initial data for swapping two coins.
|
|
11010
11562
|
*
|
|
11563
|
+
* Always FLOATING rate, FIXED is not supported - if you want to change it the default rate - all
|
|
11564
|
+
* the swaps code logic should be verified to align with this change.
|
|
11565
|
+
*
|
|
11011
11566
|
* @param fromCoin {Coin}
|
|
11012
11567
|
* @param toCoin {Coin}
|
|
11013
11568
|
* @return {Promise<{
|
|
@@ -11060,6 +11615,8 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
11060
11615
|
* @param fromAmountCoins {string}
|
|
11061
11616
|
* @param [fixed=false] {boolean|null} null means fixed or float doesn't matter
|
|
11062
11617
|
* @param [withoutFiat=false] {boolean} pass true if you don't need the fiat equivalent - this will diminish requests count
|
|
11618
|
+
* @param [amountIsToReceive=false] {boolean} whether the given amount is receiving amount.
|
|
11619
|
+
* False means the amount is the sending amount.
|
|
11063
11620
|
* @return {Promise<{
|
|
11064
11621
|
* result: false,
|
|
11065
11622
|
* reason: string,
|
|
@@ -11074,21 +11631,24 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
11074
11631
|
* }>}
|
|
11075
11632
|
*/
|
|
11076
11633
|
;
|
|
11077
|
-
_proto.getPublicSwapDetails = function getPublicSwapDetails(fromCoin, toCoin, fromAmountCoins, fixed, withoutFiat) {
|
|
11634
|
+
_proto.getPublicSwapDetails = function getPublicSwapDetails(fromCoin, toCoin, fromAmountCoins, fixed, withoutFiat, amountIsToReceive) {
|
|
11078
11635
|
if (fixed === void 0) {
|
|
11079
11636
|
fixed = false;
|
|
11080
11637
|
}
|
|
11081
11638
|
if (withoutFiat === void 0) {
|
|
11082
11639
|
withoutFiat = false;
|
|
11083
11640
|
}
|
|
11641
|
+
if (amountIsToReceive === void 0) {
|
|
11642
|
+
amountIsToReceive = false;
|
|
11643
|
+
}
|
|
11084
11644
|
try {
|
|
11085
11645
|
var _this7 = this;
|
|
11086
11646
|
var loggerSource = "getPublicSwapDetails";
|
|
11087
11647
|
return Promise.resolve(_catch(function () {
|
|
11088
|
-
function _temp2(
|
|
11089
|
-
var
|
|
11090
|
-
var coinUsdtRate = withoutFiat ?
|
|
11091
|
-
return Promise.resolve(_this7._swapProvider.getSwapInfo(fromCoin, toCoin, fromAmountCoins, fixed, coinUsdtRate)).then(function (details) {
|
|
11648
|
+
function _temp2(_getCoinToUSDTRate) {
|
|
11649
|
+
var _getCoinToUSDTRate$ra;
|
|
11650
|
+
var coinUsdtRate = withoutFiat ? _getCoinToUSDTRate : (_getCoinToUSDTRate$ra = _getCoinToUSDTRate == null ? void 0 : _getCoinToUSDTRate.rate) != null ? _getCoinToUSDTRate$ra : null;
|
|
11651
|
+
return Promise.resolve((fixed ? _this7._fixedSwapProvider : _this7._swapProvider).getSwapInfo(fromCoin, toCoin, fromAmountCoins, fixed, coinUsdtRate, amountIsToReceive)).then(function (details) {
|
|
11092
11652
|
var _result$swapCreationI, _result$swapCreationI2;
|
|
11093
11653
|
// eslint-disable-next-line no-console
|
|
11094
11654
|
console.log("getSwapInfo result: ", details);
|
|
@@ -11149,7 +11709,10 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
11149
11709
|
return result;
|
|
11150
11710
|
});
|
|
11151
11711
|
}
|
|
11152
|
-
|
|
11712
|
+
if (amountIsToReceive && !fixed) {
|
|
11713
|
+
throw new Error("Estimating allowed only for fixed rate.");
|
|
11714
|
+
}
|
|
11715
|
+
return withoutFiat ? _temp2(null) : Promise.resolve((fixed ? _this7._fixedSwapProvider : _this7._swapProvider).getCoinToUSDTRate(fromCoin)).then(_temp2);
|
|
11153
11716
|
}, function (e) {
|
|
11154
11717
|
improveAndRethrow(e, loggerSource);
|
|
11155
11718
|
}));
|
|
@@ -11162,13 +11725,15 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
11162
11725
|
*
|
|
11163
11726
|
* @param fromCoin {Coin}
|
|
11164
11727
|
* @param toCoin {Coin}
|
|
11165
|
-
* @param
|
|
11728
|
+
* @param amount {string}
|
|
11166
11729
|
* @param swapCreationInfo {BaseSwapCreationInfo}
|
|
11167
11730
|
* @param toAddress {string}
|
|
11168
11731
|
* @param refundAddress {string}
|
|
11169
11732
|
* @param clientIp {string}
|
|
11170
11733
|
* @param [toCurrencyExtraId] {string}
|
|
11171
11734
|
* @param [refundExtraId] {string}
|
|
11735
|
+
* @param [amountIsToReceive=false] {boolean} whether the given amount is receiving amount.
|
|
11736
|
+
* False means the amount is the sending amount.
|
|
11172
11737
|
* @return {Promise<{
|
|
11173
11738
|
* result: true,
|
|
11174
11739
|
* fiatCurrencyCode: string,
|
|
@@ -11191,20 +11756,23 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
11191
11756
|
* }>}
|
|
11192
11757
|
*/
|
|
11193
11758
|
;
|
|
11194
|
-
_proto.createPublicSwap = function createPublicSwap(fromCoin, toCoin,
|
|
11759
|
+
_proto.createPublicSwap = function createPublicSwap(fromCoin, toCoin, amount, swapCreationInfo, toAddress, refundAddress, clientIp, toCurrencyExtraId, refundExtraId, amountIsToReceive) {
|
|
11760
|
+
if (amountIsToReceive === void 0) {
|
|
11761
|
+
amountIsToReceive = false;
|
|
11762
|
+
}
|
|
11195
11763
|
try {
|
|
11196
11764
|
var _this8 = this;
|
|
11197
11765
|
var loggerSource = "createPublicSwap";
|
|
11198
11766
|
return Promise.resolve(_catch(function () {
|
|
11199
11767
|
var _swapCreationInfo$fro, _swapCreationInfo$toC;
|
|
11200
|
-
if (!(fromCoin instanceof Coin) || !(toCoin instanceof Coin) || typeof
|
|
11201
|
-
throw new Error("Wrong input: " + fromCoin.ticker + " " + toCoin.ticker + " " +
|
|
11768
|
+
if (!(fromCoin instanceof Coin) || !(toCoin instanceof Coin) || typeof amount !== "string" || typeof toAddress !== "string" || swapCreationInfo.isRefundAddressRequired && (typeof refundAddress !== "string" || refundAddress.length === 0) || !(swapCreationInfo instanceof BaseSwapCreationInfo)) {
|
|
11769
|
+
throw new Error("Wrong input: " + fromCoin.ticker + " " + toCoin.ticker + " " + amount + " " + swapCreationInfo);
|
|
11202
11770
|
}
|
|
11203
|
-
Logger.log("Start: " +
|
|
11771
|
+
Logger.log("Start: " + amount + " " + fromCoin.ticker + " -> " + toCoin.ticker + ". Details: " + safeStringify(_extends({}, swapCreationInfo, {
|
|
11204
11772
|
fromCoin: swapCreationInfo == null || (_swapCreationInfo$fro = swapCreationInfo.fromCoin) == null ? void 0 : _swapCreationInfo$fro.ticker,
|
|
11205
11773
|
toCoin: swapCreationInfo == null || (_swapCreationInfo$toC = swapCreationInfo.toCoin) == null ? void 0 : _swapCreationInfo$toC.ticker
|
|
11206
11774
|
})), loggerSource);
|
|
11207
|
-
return Promise.resolve(_this8._swapProvider.createSwap(fromCoin, toCoin,
|
|
11775
|
+
return Promise.resolve((swapCreationInfo.fixed ? _this8._fixedSwapProvider : _this8._swapProvider).createSwap(fromCoin, toCoin, amount, toAddress, refundAddress, swapCreationInfo.rawSwapData, clientIp, swapCreationInfo.fixed, toCurrencyExtraId, refundExtraId, amountIsToReceive)).then(function (result) {
|
|
11208
11776
|
var _exit;
|
|
11209
11777
|
function _temp6(_result8) {
|
|
11210
11778
|
if (_exit) return _result8;
|
|
@@ -11234,7 +11802,7 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
11234
11802
|
if (result.result && result != null && result.swapId) {
|
|
11235
11803
|
var _temp4 = function _temp4() {
|
|
11236
11804
|
var _result$fromCurrencyE;
|
|
11237
|
-
// TODO: feature, cirtical] add GA event. task_id=
|
|
11805
|
+
// TODO: feature, cirtical] add GA event. task_id=091004f1b6b748b29ddece6a130df904
|
|
11238
11806
|
EventBusInstance__default["default"].dispatch(PublicSwapService.PUBLIC_SWAP_CREATED_EVENT, null, fromCoin.ticker, toCoin.ticker, _fromAmountFiat);
|
|
11239
11807
|
var toReturn = {
|
|
11240
11808
|
result: true,
|
|
@@ -11314,7 +11882,7 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
11314
11882
|
var _this9 = this;
|
|
11315
11883
|
var loggerSource = "getPublicExistingSwapDetailsAndStatus";
|
|
11316
11884
|
return Promise.resolve(_catch(function () {
|
|
11317
|
-
return Promise.resolve(SwapUtils.getExistingSwapsDetailsWithFiatAmounts(_this9._swapProvider, swapIds)).then(function (result) {
|
|
11885
|
+
return Promise.resolve(SwapUtils.getExistingSwapsDetailsWithFiatAmounts([_this9._swapProvider, _this9._fixedSwapProvider], swapIds)).then(function (result) {
|
|
11318
11886
|
if (!(result != null && result.result)) {
|
|
11319
11887
|
if (result.reason === SwapProvider.COMMON_ERRORS.REQUESTS_LIMIT_EXCEEDED) {
|
|
11320
11888
|
SwapUtils.safeHandleRequestsLimitExceeding();
|
|
@@ -11409,18 +11977,24 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
11409
11977
|
|
|
11410
11978
|
/**
|
|
11411
11979
|
* @param coinOrTicker {Coin|string}
|
|
11980
|
+
* @param [isFixed=true] {boolean} rate type
|
|
11412
11981
|
* @return {string} icon URL (ready to use)
|
|
11413
11982
|
*/;
|
|
11414
|
-
_proto.getAssetIconUrl = function getAssetIconUrl(coinOrTicker) {
|
|
11415
|
-
|
|
11983
|
+
_proto.getAssetIconUrl = function getAssetIconUrl(coinOrTicker, isFixed) {
|
|
11984
|
+
// TODO: [feature, high] improve this logic - currently hacked to show better icons from fixed provider. task_id=3b6b8c2a9df04a86aaff2e070424b64f
|
|
11985
|
+
return this._fixedSwapProvider.getIconUrl(coinOrTicker);
|
|
11416
11986
|
}
|
|
11417
11987
|
|
|
11418
11988
|
/**
|
|
11419
11989
|
* @param ticker {string}
|
|
11990
|
+
* @param [fixed=false] {boolean}
|
|
11420
11991
|
* @return {Coin|null}
|
|
11421
11992
|
*/;
|
|
11422
|
-
_proto.getCoinByTickerIfPresent = function getCoinByTickerIfPresent(ticker) {
|
|
11423
|
-
|
|
11993
|
+
_proto.getCoinByTickerIfPresent = function getCoinByTickerIfPresent(ticker, fixed) {
|
|
11994
|
+
if (fixed === void 0) {
|
|
11995
|
+
fixed = false;
|
|
11996
|
+
}
|
|
11997
|
+
return !fixed ? this._swapProvider.getCoinByTickerIfPresent(ticker) : this._fixedSwapProvider.getCoinByTickerIfPresent(ticker);
|
|
11424
11998
|
}
|
|
11425
11999
|
|
|
11426
12000
|
/**
|
|
@@ -11433,8 +12007,18 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
11433
12007
|
var _this11 = this;
|
|
11434
12008
|
return Promise.resolve(_catch(function () {
|
|
11435
12009
|
return Promise.resolve(_this11._swapProvider.getCoinToUSDTRate(asset)).then(function (result) {
|
|
11436
|
-
|
|
11437
|
-
|
|
12010
|
+
function _temp10() {
|
|
12011
|
+
var _result$rate, _result13;
|
|
12012
|
+
return (_result$rate = (_result13 = result) == null ? void 0 : _result13.rate) != null ? _result$rate : null;
|
|
12013
|
+
}
|
|
12014
|
+
var _temp9 = function (_result14) {
|
|
12015
|
+
if (((_result14 = result) == null ? void 0 : _result14.rate) == null) {
|
|
12016
|
+
return Promise.resolve(_this11._fixedSwapProvider.getCoinToUSDTRate(asset)).then(function (_this11$_fixedSwapPro) {
|
|
12017
|
+
result = _this11$_fixedSwapPro;
|
|
12018
|
+
});
|
|
12019
|
+
}
|
|
12020
|
+
}();
|
|
12021
|
+
return _temp9 && _temp9.then ? _temp9.then(_temp10) : _temp10(_temp9);
|
|
11438
12022
|
});
|
|
11439
12023
|
}, function (e) {
|
|
11440
12024
|
improveAndRethrow(e, "getAssetToUsdtRate");
|
|
@@ -11446,12 +12030,16 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
11446
12030
|
/**
|
|
11447
12031
|
* @param asset {Coin}
|
|
11448
12032
|
* @param address {string}
|
|
12033
|
+
* @param [fixed=false] {boolean}
|
|
11449
12034
|
* @return {boolean}
|
|
11450
12035
|
*/
|
|
11451
12036
|
;
|
|
11452
|
-
_proto.isAddressValidForAsset = function isAddressValidForAsset(asset, address) {
|
|
12037
|
+
_proto.isAddressValidForAsset = function isAddressValidForAsset(asset, address, fixed) {
|
|
12038
|
+
if (fixed === void 0) {
|
|
12039
|
+
fixed = false;
|
|
12040
|
+
}
|
|
11453
12041
|
try {
|
|
11454
|
-
return this._swapProvider.isAddressValidForAsset(asset, address);
|
|
12042
|
+
return !fixed ? this._swapProvider.isAddressValidForAsset(asset, address) : this._fixedSwapProvider.isAddressValidForAsset(asset, address);
|
|
11455
12043
|
} catch (e) {
|
|
11456
12044
|
improveAndRethrow(e, "isAddressValidForAsset");
|
|
11457
12045
|
}
|
|
@@ -11461,20 +12049,24 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
11461
12049
|
* Retrieves token by contract address.
|
|
11462
12050
|
*
|
|
11463
12051
|
* @param addressString {string}
|
|
12052
|
+
* @param [fixed=false] {boolean}
|
|
11464
12053
|
* @return {Promise<Coin|null>}
|
|
11465
12054
|
*/;
|
|
11466
|
-
_proto.getTokenByContractAddress = function getTokenByContractAddress(addressString) {
|
|
12055
|
+
_proto.getTokenByContractAddress = function getTokenByContractAddress(addressString, fixed) {
|
|
12056
|
+
if (fixed === void 0) {
|
|
12057
|
+
fixed = false;
|
|
12058
|
+
}
|
|
11467
12059
|
try {
|
|
11468
12060
|
var _exit3;
|
|
11469
12061
|
var _this12 = this;
|
|
11470
|
-
var
|
|
12062
|
+
var _temp12 = _catch(function () {
|
|
11471
12063
|
if (!addressString) {
|
|
11472
|
-
var
|
|
12064
|
+
var _temp11 = null;
|
|
11473
12065
|
_exit3 = 1;
|
|
11474
|
-
return
|
|
12066
|
+
return _temp11;
|
|
11475
12067
|
}
|
|
11476
12068
|
var addressLowerCase = addressString.toLowerCase();
|
|
11477
|
-
return Promise.resolve(_this12._swapProvider.getAllSupportedCurrencies()).then(function (allCoins) {
|
|
12069
|
+
return Promise.resolve((fixed ? _this12._fixedSwapProvider : _this12._swapProvider).getAllSupportedCurrencies()).then(function (allCoins) {
|
|
11478
12070
|
if (allCoins.result) {
|
|
11479
12071
|
var _allCoins$coins$find = allCoins.coins.find(function (coin) {
|
|
11480
12072
|
return coin.tokenAddress && coin.tokenAddress.toLowerCase() === addressLowerCase;
|
|
@@ -11486,21 +12078,25 @@ var PublicSwapService = /*#__PURE__*/function () {
|
|
|
11486
12078
|
}, function (e) {
|
|
11487
12079
|
Logger.logError(e, "getTokenByContractAddress");
|
|
11488
12080
|
});
|
|
11489
|
-
return Promise.resolve(
|
|
11490
|
-
return _exit3 ?
|
|
11491
|
-
}) : _exit3 ?
|
|
12081
|
+
return Promise.resolve(_temp12 && _temp12.then ? _temp12.then(function (_result15) {
|
|
12082
|
+
return _exit3 ? _result15 : null;
|
|
12083
|
+
}) : _exit3 ? _temp12 : null);
|
|
11492
12084
|
} catch (e) {
|
|
11493
12085
|
return Promise.reject(e);
|
|
11494
12086
|
}
|
|
11495
12087
|
}
|
|
11496
12088
|
/**
|
|
11497
12089
|
* @param asset {Coin}
|
|
12090
|
+
* @param [fixed=false] {boolean}
|
|
11498
12091
|
* @return {string|null}
|
|
11499
12092
|
*/
|
|
11500
12093
|
;
|
|
11501
|
-
_proto.getExtraIdNameIfPresentForAsset = function getExtraIdNameIfPresentForAsset(asset) {
|
|
12094
|
+
_proto.getExtraIdNameIfPresentForAsset = function getExtraIdNameIfPresentForAsset(asset, fixed) {
|
|
12095
|
+
if (fixed === void 0) {
|
|
12096
|
+
fixed = false;
|
|
12097
|
+
}
|
|
11502
12098
|
try {
|
|
11503
|
-
return this._swapProvider.getExtraIdNameIfPresent(asset);
|
|
12099
|
+
return (fixed ? this._fixedSwapProvider : this._swapProvider).getExtraIdNameIfPresent(asset);
|
|
11504
12100
|
} catch (e) {
|
|
11505
12101
|
improveAndRethrow(e, "getExtraIdNameIfPresentForAsset");
|
|
11506
12102
|
}
|