@rabbitio/ui-kit 1.0.0-beta.111 → 1.0.0-beta.113
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/.env +1 -0
- package/.env.example +1 -1
- package/coverage/clover.xml +1686 -1723
- package/coverage/coverage-final.json +118 -118
- package/coverage/index.html +86 -86
- 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/analyticsAdapters/googleAnalyticsAdapter.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/adapters/analyticsAdapters/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/adapters/analyticsAdapters/metrikaAdapter.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/adapters/analyticsAdapters/mixpanelAdapter.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/external-apis/apiGroups.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/external-apis/emailAPI.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/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 +6 -6
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/models/coin.js.html +223 -223
- 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 +5 -5
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/services/fiatCurrenciesService.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/services/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/amountUtils.js.html +51 -51
- 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/errorUtils.js.html +15 -15
- 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 +24 -24
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/logging/logsStorage.js.html +5 -5
- 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/rabbitTicker.js.html +12 -12
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common-apis/utils/safeStringify.js.html +29 -29
- 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 +14 -14
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/external-apis/exolixSwapProvider.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/external-apis/goexmeSwapProvider.js.html +566 -677
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/external-apis/index.html +29 -29
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/external-apis/letsExchangeSwapProvider.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/external-apis/swapProvider.js.html +349 -349
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/external-apis/swapspaceSwapProvider.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/external-apis/utils.js.html +16 -16
- 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 +143 -143
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/existingSwapWithFiatData.js.html +103 -103
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/index.html +16 -16
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/partner.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/swapProviderCoinInfo.js.html +75 -75
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/services/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/services/publicSwapService.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/utils/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/utils/swapUtils.js.html +3 -3
- 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/messageIcon.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/supportDialogImage.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 +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/atoms/QrCode/index.html +3 -3
- 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/ColoredNotice/ColoredNotice.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/ColoredNotice/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/LogoCarousel/LogoCarousel.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/LogoCarousel/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/SearchableCoinsList/SearchableCoinsList.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/molecules/SearchableCoinsList/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 +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/SwapForm/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/WaitlistSubscription/WaitlistSubscription.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/ui-kit/components/organisms/WaitlistSubscription/index.html +3 -3
- 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/searchCoins.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/AmountInput.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/molecules/CoinPicker.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/molecules/ColoredNotice.stories.jsx.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/LogoCarousel.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/organisms/WaitlistSubscription.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/stubs/coins.jsx.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/dist/index.cjs +120 -169
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +36 -71
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +120 -169
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +120 -169
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/swaps-lib/external-apis/goexmeSwapProvider.js +40 -77
- package/src/swaps-lib/models/existingSwap.js +1 -1
- package/src/swaps-lib/test/external-apis/goexmeSwapProvider/_convertCurrencyMeta.test.js +80 -0
- package/src/swaps-lib/test/external-apis/goexmeSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +50 -123
- package/src/swaps-lib/test/external-apis/goexmeSwapProvider/createSwap.test.js +177 -72
- package/src/swaps-lib/test/external-apis/goexmeSwapProvider/getExistingSwapsDetailsAndStatus.test.js +151 -0
- package/src/swaps-lib/test/external-apis/goexmeSwapProvider/getSwapInfo.test.js +140 -104
- package/src/swaps-lib/test/external-apis/goexmeSwapProvider/helpers.test.js +26 -0
- package/src/swaps-lib/test/external-apis/goexmeSwapProvider/integration/PairSupport.int.test.js +31 -60
- package/src/swaps-lib/test/external-apis/goexmeSwapProvider/integration/_fetchSupportedCurrenciesIfNeeded.int.test.js +261 -126
- package/src/swaps-lib/test/external-apis/goexmeSwapProvider/integration/createSwap.int.test.js +319 -225
- package/src/swaps-lib/test/external-apis/goexmeSwapProvider/integration/getSwapInfo.int.test.js +137 -127
package/src/swaps-lib/test/external-apis/goexmeSwapProvider/integration/createSwap.int.test.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import "dotenv/config";
|
|
2
|
-
import
|
|
2
|
+
import sinon from "sinon";
|
|
3
|
+
import should from "should";
|
|
4
|
+
import { describe, it, beforeEach, afterEach } from "vitest";
|
|
3
5
|
import axios from "axios";
|
|
4
6
|
import BigNumber from "bignumber.js";
|
|
5
7
|
|
|
@@ -9,231 +11,323 @@ import { GoexmeSwapProvider } from "../../../../external-apis/goexmeSwapProvider
|
|
|
9
11
|
const GOEXME_API_KEY = process.env.GOEXME_API_KEY?.trim?.() || "";
|
|
10
12
|
const maybeDescribe = GOEXME_API_KEY ? describe : describe.skip;
|
|
11
13
|
|
|
12
|
-
maybeDescribe("
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (!BTC || !ETH || !hasPair(BTC, ETH)) return;
|
|
43
|
-
|
|
44
|
-
const amount = await pickAmount(BTC, ETH, "0.001");
|
|
45
|
-
const dto = await provider.createSwap(
|
|
46
|
-
BTC,
|
|
47
|
-
ETH,
|
|
48
|
-
amount,
|
|
49
|
-
"bc1qw508d6qejxtdg4y5r3zarvaryvaxxpcs",
|
|
50
|
-
"",
|
|
51
|
-
null,
|
|
52
|
-
null,
|
|
53
|
-
false
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
expect(dto.result).toBe(true);
|
|
57
|
-
expect(dto.fixed).toBe(false);
|
|
58
|
-
expect(dto.swapId).toBeTruthy();
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it("creates FIXED BTC → ETH swap", async () => {
|
|
62
|
-
const BTC = byCode("BTC");
|
|
63
|
-
const ETH = byCode("ETH");
|
|
64
|
-
if (!BTC || !ETH || !hasPair(BTC, ETH)) return;
|
|
65
|
-
|
|
66
|
-
const amount = await pickAmount(BTC, ETH, "0.002");
|
|
67
|
-
const dto = await provider.createSwap(
|
|
68
|
-
BTC,
|
|
69
|
-
ETH,
|
|
70
|
-
amount,
|
|
71
|
-
"bc1qw508d6qejxtdg4y5r3zarvaryvaxxpcs",
|
|
72
|
-
"",
|
|
73
|
-
null,
|
|
74
|
-
null,
|
|
75
|
-
true
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
expect(dto.fixed).toBe(true);
|
|
79
|
-
expect(provider._cache.get(`goexme_fixed_ttl_${dto.swapId}`)).toBe(true);
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it("creates ETH → TRX swap", async () => {
|
|
83
|
-
const ETH = byCode("ETH");
|
|
84
|
-
const TRX = byCode("TRX");
|
|
85
|
-
if (!ETH || !TRX || !hasPair(ETH, TRX)) return;
|
|
86
|
-
|
|
87
|
-
const amount = await pickAmount(ETH, TRX, "0.05");
|
|
88
|
-
const dto = await provider.createSwap(
|
|
89
|
-
ETH,
|
|
90
|
-
TRX,
|
|
91
|
-
amount,
|
|
92
|
-
"T123456789012345678901234567890123",
|
|
93
|
-
"",
|
|
94
|
-
null,
|
|
95
|
-
null,
|
|
96
|
-
false
|
|
97
|
-
);
|
|
98
|
-
|
|
99
|
-
expect(dto.result).toBe(true);
|
|
100
|
-
expect(dto.fromCoin.ticker).toBe("ETH");
|
|
101
|
-
expect(dto.toCoin.ticker).toBe("TRX");
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
it("creates XMR → BTC swap", async () => {
|
|
105
|
-
const XMR = byCode("XMR");
|
|
106
|
-
const BTC = byCode("BTC");
|
|
107
|
-
if (!XMR || !BTC || !hasPair(XMR, BTC)) return;
|
|
108
|
-
|
|
109
|
-
const amount = await pickAmount(XMR, BTC, "1");
|
|
110
|
-
const dto = await provider.createSwap(
|
|
111
|
-
XMR,
|
|
112
|
-
BTC,
|
|
113
|
-
amount,
|
|
114
|
-
"bc1qw508d6qejxtdg4y5r3zarvaryvaxxpcs",
|
|
115
|
-
"",
|
|
116
|
-
null,
|
|
117
|
-
null,
|
|
118
|
-
false
|
|
119
|
-
);
|
|
120
|
-
|
|
121
|
-
expect(dto.result).toBe(true);
|
|
122
|
-
expect(dto.fromCoin.ticker).toBe("XMR");
|
|
123
|
-
expect(dto.toCoin.ticker).toBe("BTC");
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
it("creates USDT(TRC20) → ETH swap", async () => {
|
|
127
|
-
const USDTTRC20 = byCode("USDTTRC20");
|
|
128
|
-
const ETH = byCode("ETH");
|
|
129
|
-
if (!USDTTRC20 || !ETH || !hasPair(USDTTRC20, ETH)) return;
|
|
130
|
-
|
|
131
|
-
const amount = await pickAmount(USDTTRC20, ETH, "400");
|
|
132
|
-
const dto = await provider.createSwap(
|
|
133
|
-
USDTTRC20,
|
|
134
|
-
ETH,
|
|
135
|
-
amount,
|
|
136
|
-
"0xAb5801a7D398351b8bE11C439e05C5b3259aec9B",
|
|
137
|
-
"",
|
|
138
|
-
null,
|
|
139
|
-
null,
|
|
140
|
-
false
|
|
141
|
-
);
|
|
142
|
-
|
|
143
|
-
expect(dto.result).toBe(true);
|
|
144
|
-
expect(dto.fromCoin.ticker.toUpperCase()).toMatch(/USDT.*TRC20/);
|
|
145
|
-
expect(dto.toCoin.ticker).toBe("ETH");
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
it("passes refund address to exchange-create call", async () => {
|
|
149
|
-
const USDT = byCode("USDT");
|
|
150
|
-
const BTC = byCode("BTC");
|
|
151
|
-
if (!USDT || !BTC || !hasPair(USDT, BTC)) return;
|
|
152
|
-
|
|
153
|
-
const refundAddr = "0xebb97aa373adec59b33959d2dd67da54dcc0ae00";
|
|
154
|
-
let capturedParams = null;
|
|
155
|
-
|
|
156
|
-
axios.get = async (url, cfg = {}) => {
|
|
157
|
-
if (url.endsWith("/exchange-create")) capturedParams = cfg.params;
|
|
158
|
-
return axiosOriginalGet(url, cfg);
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
const amount = await pickAmount(USDT, BTC, "1000");
|
|
162
|
-
await provider.createSwap(
|
|
163
|
-
USDT,
|
|
164
|
-
BTC,
|
|
165
|
-
amount,
|
|
166
|
-
"bc1qw508d6qejxtdg4y5r3zarvaryvaxxpcs",
|
|
167
|
-
refundAddr,
|
|
168
|
-
null,
|
|
169
|
-
null,
|
|
170
|
-
false
|
|
171
|
-
);
|
|
172
|
-
|
|
173
|
-
expect(capturedParams?.refundAddress).toBe(refundAddr);
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
it("adds destinationTag when target coin requires it", async () => {
|
|
177
|
-
const BTC = byCode("BTC");
|
|
178
|
-
const XRP = byCode("XRP");
|
|
179
|
-
if (!BTC || !XRP || !hasPair(BTC, XRP)) return;
|
|
180
|
-
|
|
181
|
-
let capturedParams = null;
|
|
182
|
-
axios.get = async (url, cfg = {}) => {
|
|
183
|
-
if (url.endsWith("/exchange-create")) capturedParams = cfg.params;
|
|
184
|
-
return axiosOriginalGet(url, cfg);
|
|
14
|
+
maybeDescribe("external-apis/goexmeSwapProvider integration", function () {
|
|
15
|
+
describe("createSwap (live)", function () {
|
|
16
|
+
let provider;
|
|
17
|
+
let axiosOriginalGet;
|
|
18
|
+
|
|
19
|
+
beforeEach(async () => {
|
|
20
|
+
provider = new GoexmeSwapProvider("/", new Cache(), () => null, false, GOEXME_API_KEY);
|
|
21
|
+
await provider._fetchSupportedCurrenciesIfNeeded();
|
|
22
|
+
axiosOriginalGet = axios.get;
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
afterEach(() => {
|
|
26
|
+
if (axios.get.restore) {
|
|
27
|
+
axios.get.restore();
|
|
28
|
+
} else {
|
|
29
|
+
axios.get = axiosOriginalGet;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const getCoinByCode = code => provider._supportedCoins.find(c => c.code === code)?.coin || null;
|
|
34
|
+
const pairSupported = (fromCoin, toCoin) =>
|
|
35
|
+
provider._pairsCache?.[fromCoin.code]?.has(toCoin.code) || provider._pairsCache?.[fromCoin]?.has(toCoin);
|
|
36
|
+
|
|
37
|
+
const pickValidAmount = async (fromCoin, toCoin, fallbackAmount) => {
|
|
38
|
+
const info = await provider.getSwapInfo(fromCoin, toCoin, fallbackAmount);
|
|
39
|
+
if (info.result) return fallbackAmount;
|
|
40
|
+
if (info.reason === provider.constructor.NO_SWAPS_REASONS.TOO_LOW && info.smallestMin) {
|
|
41
|
+
return new BigNumber(info.smallestMin).times(1.1).toFixed(fromCoin.digits);
|
|
42
|
+
}
|
|
43
|
+
throw new Error(`Unable to pick viable amount for ${fromCoin.ticker} → ${toCoin.ticker}`);
|
|
185
44
|
};
|
|
186
45
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
"
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
46
|
+
it("Should create a FLOAT BTC→ETH swap", async () => {
|
|
47
|
+
const btcCoin = getCoinByCode("BTC");
|
|
48
|
+
const ethCoin = getCoinByCode("ETH");
|
|
49
|
+
if (!btcCoin || !ethCoin || !pairSupported(btcCoin, ethCoin)) return;
|
|
50
|
+
|
|
51
|
+
const amount = await pickValidAmount(btcCoin, ethCoin, "0.001");
|
|
52
|
+
const result = await provider.createSwap(
|
|
53
|
+
btcCoin,
|
|
54
|
+
ethCoin,
|
|
55
|
+
amount,
|
|
56
|
+
"bc1qw508d6qejxtdg4y5r3zarvaryvaxxpcs",
|
|
57
|
+
"",
|
|
58
|
+
null,
|
|
59
|
+
null,
|
|
60
|
+
false
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
result.result.should.be.true();
|
|
64
|
+
result.fixed.should.be.false();
|
|
65
|
+
should.exist(result.swapId);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it("Should create a FIXED BTC→ETH swap and cache TTL", async () => {
|
|
69
|
+
const btcCoin = getCoinByCode("BTC");
|
|
70
|
+
const ethCoin = getCoinByCode("ETH");
|
|
71
|
+
if (!btcCoin || !ethCoin || !pairSupported(btcCoin, ethCoin)) return;
|
|
72
|
+
|
|
73
|
+
const amount = await pickValidAmount(btcCoin, ethCoin, "0.002");
|
|
74
|
+
const result = await provider.createSwap(
|
|
75
|
+
btcCoin,
|
|
76
|
+
ethCoin,
|
|
77
|
+
amount,
|
|
78
|
+
"bc1qw508d6qejxtdg4y5r3zarvaryvaxxpcs",
|
|
79
|
+
"",
|
|
80
|
+
null,
|
|
81
|
+
null,
|
|
82
|
+
true
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
result.fixed.should.be.true();
|
|
86
|
+
provider._cache.get(`goexme_fixed_ttl_${result.swapId}`).should.be.true();
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it("Should create an ETH→TRX swap", async () => {
|
|
90
|
+
const ethCoin = getCoinByCode("ETH");
|
|
91
|
+
const trxCoin = getCoinByCode("TRX");
|
|
92
|
+
if (!ethCoin || !trxCoin || !pairSupported(ethCoin, trxCoin)) return;
|
|
93
|
+
|
|
94
|
+
const amount = await pickValidAmount(ethCoin, trxCoin, "0.05");
|
|
95
|
+
const result = await provider.createSwap(
|
|
96
|
+
ethCoin,
|
|
97
|
+
trxCoin,
|
|
98
|
+
amount,
|
|
99
|
+
"T123456789012345678901234567890123",
|
|
100
|
+
"",
|
|
101
|
+
null,
|
|
102
|
+
null,
|
|
103
|
+
false
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
result.result.should.be.true();
|
|
107
|
+
result.fromCoin.ticker.should.equal("ETH");
|
|
108
|
+
result.toCoin.ticker.should.equal("TRX");
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it("Should create an XMR→BTC swap", async () => {
|
|
112
|
+
const xmrCoin = getCoinByCode("XMR");
|
|
113
|
+
const btcCoin = getCoinByCode("BTC");
|
|
114
|
+
if (!xmrCoin || !btcCoin || !pairSupported(xmrCoin, btcCoin)) return;
|
|
115
|
+
|
|
116
|
+
const amount = await pickValidAmount(xmrCoin, btcCoin, "1");
|
|
117
|
+
const result = await provider.createSwap(
|
|
118
|
+
xmrCoin,
|
|
119
|
+
btcCoin,
|
|
120
|
+
amount,
|
|
121
|
+
"bc1qw508d6qejxtdg4y5r3zarvaryvaxxpcs",
|
|
122
|
+
"",
|
|
123
|
+
null,
|
|
124
|
+
null,
|
|
125
|
+
false
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
result.result.should.be.true();
|
|
129
|
+
result.fromCoin.ticker.should.equal("XMR");
|
|
130
|
+
result.toCoin.ticker.should.equal("BTC");
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it("Should create a USDT(TRC20)→ETH swap", async () => {
|
|
134
|
+
const usdtTrc20Coin = getCoinByCode("USDTTRC20");
|
|
135
|
+
const ethCoin = getCoinByCode("ETH");
|
|
136
|
+
if (!usdtTrc20Coin || !ethCoin || !pairSupported(usdtTrc20Coin, ethCoin)) return;
|
|
137
|
+
|
|
138
|
+
const amount = await pickValidAmount(usdtTrc20Coin, ethCoin, "400");
|
|
139
|
+
const result = await provider.createSwap(
|
|
140
|
+
usdtTrc20Coin,
|
|
141
|
+
ethCoin,
|
|
142
|
+
amount,
|
|
143
|
+
"0xAb5801a7D398351b8bE11C439e05C5b3259aec9B",
|
|
144
|
+
"",
|
|
145
|
+
null,
|
|
146
|
+
null,
|
|
147
|
+
false
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
result.result.should.be.true();
|
|
151
|
+
result.fromCoin.ticker.toUpperCase().should.match(/USDT.*TRC20/);
|
|
152
|
+
result.toCoin.ticker.should.equal("ETH");
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
it("Should pass refund address to exchange‑create call", async () => {
|
|
156
|
+
const usdtCoin = getCoinByCode("USDT");
|
|
157
|
+
const btcCoin = getCoinByCode("BTC");
|
|
158
|
+
if (!usdtCoin || !btcCoin || !pairSupported(usdtCoin, btcCoin)) return;
|
|
159
|
+
|
|
160
|
+
const refundAddress = "0xebb97aa373adec59b33959d2dd67da54dcc0ae00";
|
|
161
|
+
let capturedParams = null;
|
|
162
|
+
|
|
163
|
+
const getStub = sinon.stub(axios, "get").callsFake((url, cfg = {}) => {
|
|
164
|
+
if (url.endsWith("/exchange-create")) capturedParams = cfg.params;
|
|
165
|
+
return axiosOriginalGet(url, cfg);
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
const amount = await pickValidAmount(usdtCoin, btcCoin, "1000");
|
|
169
|
+
await provider.createSwap(
|
|
170
|
+
usdtCoin,
|
|
171
|
+
btcCoin,
|
|
172
|
+
amount,
|
|
173
|
+
"bc1qw508d6qejxtdg4y5r3zarvaryvaxxpcs",
|
|
174
|
+
refundAddress,
|
|
175
|
+
null,
|
|
176
|
+
null,
|
|
177
|
+
false
|
|
178
|
+
);
|
|
179
|
+
|
|
180
|
+
capturedParams.should.have.property("refundAddress", refundAddress);
|
|
181
|
+
getStub.restore();
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
it("Should add destinationTag when target coin requires it", async () => {
|
|
185
|
+
const btcCoin = getCoinByCode("BTC");
|
|
186
|
+
const xrpCoin = getCoinByCode("XRP");
|
|
187
|
+
if (!btcCoin || !xrpCoin || !pairSupported(btcCoin, xrpCoin)) return;
|
|
188
|
+
|
|
189
|
+
let capturedParams = null;
|
|
190
|
+
const getStub = sinon.stub(axios, "get").callsFake((url, cfg = {}) => {
|
|
191
|
+
if (url.endsWith("/exchange-create")) capturedParams = cfg.params;
|
|
192
|
+
return axiosOriginalGet(url, cfg);
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
const amount = await pickValidAmount(btcCoin, xrpCoin, "0.002");
|
|
196
|
+
await provider.createSwap(
|
|
197
|
+
btcCoin,
|
|
198
|
+
xrpCoin,
|
|
199
|
+
amount,
|
|
200
|
+
"rUpy3eEg8rqjqfUoLeBnZkscbKbfsPrgd",
|
|
201
|
+
"",
|
|
202
|
+
null,
|
|
203
|
+
null,
|
|
204
|
+
false,
|
|
205
|
+
"MEMO123"
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
capturedParams.should.have.property("destinationTag", "MEMO123");
|
|
209
|
+
getStub.restore();
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
it("Should omit destinationTag when target coin has no extraId", async () => {
|
|
213
|
+
const btcCoin = getCoinByCode("BTC");
|
|
214
|
+
const ethCoin = getCoinByCode("ETH");
|
|
215
|
+
if (!btcCoin || !ethCoin || !pairSupported(btcCoin, ethCoin)) return;
|
|
216
|
+
|
|
217
|
+
let capturedParams = null;
|
|
218
|
+
const getStub = sinon.stub(axios, "get").callsFake((url, cfg = {}) => {
|
|
219
|
+
if (url.endsWith("/exchange-create")) capturedParams = cfg.params;
|
|
220
|
+
return axiosOriginalGet(url, cfg);
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
const amount = await pickValidAmount(btcCoin, ethCoin, "0.001");
|
|
224
|
+
await provider.createSwap(
|
|
225
|
+
btcCoin,
|
|
226
|
+
ethCoin,
|
|
227
|
+
amount,
|
|
228
|
+
"0xAb5801a7D398351b8bE11C439e05C5b3259aec9B",
|
|
229
|
+
"",
|
|
230
|
+
null,
|
|
231
|
+
null,
|
|
232
|
+
false
|
|
233
|
+
);
|
|
234
|
+
|
|
235
|
+
should(capturedParams).not.have.property("destinationTag");
|
|
236
|
+
getStub.restore();
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
it("Should throw when amountIsToReceive=true", async () => {
|
|
240
|
+
const btcCoin = getCoinByCode("BTC");
|
|
241
|
+
const ethCoin = getCoinByCode("ETH");
|
|
242
|
+
if (!btcCoin || !ethCoin || !pairSupported(btcCoin, ethCoin)) return;
|
|
243
|
+
|
|
244
|
+
const amount = await pickValidAmount(btcCoin, ethCoin, "0.001");
|
|
245
|
+
await provider
|
|
246
|
+
.createSwap(
|
|
247
|
+
btcCoin,
|
|
248
|
+
ethCoin,
|
|
249
|
+
amount,
|
|
250
|
+
"bc1qw508d6qejxtdg4y5r3zarvaryvaxxpcs",
|
|
251
|
+
"",
|
|
252
|
+
null,
|
|
253
|
+
null,
|
|
254
|
+
false,
|
|
255
|
+
"",
|
|
256
|
+
"",
|
|
257
|
+
true
|
|
258
|
+
)
|
|
259
|
+
.should.be.rejected();
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
it("Should throw when destinationTag is required but not provided", async () => {
|
|
263
|
+
const btcCoin = getCoinByCode("BTC");
|
|
264
|
+
const xrpCoin = getCoinByCode("XRP");
|
|
265
|
+
if (!btcCoin || !xrpCoin || !pairSupported(btcCoin, xrpCoin)) return;
|
|
266
|
+
|
|
267
|
+
const amount = await pickValidAmount(btcCoin, xrpCoin, "0.002");
|
|
268
|
+
await provider
|
|
269
|
+
.createSwap(btcCoin, xrpCoin, amount, "rUpy3eEg8rqjqfUoLeBnZkscbKbfsPrgd", "", null, null, false, "")
|
|
270
|
+
.should.be.rejected();
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
it("Should not include refundTag when source coin has no extraId", async () => {
|
|
274
|
+
const btcCoin = getCoinByCode("BTC");
|
|
275
|
+
const ethCoin = getCoinByCode("ETH");
|
|
276
|
+
if (!btcCoin || !ethCoin || !pairSupported(btcCoin, ethCoin)) return;
|
|
277
|
+
|
|
278
|
+
let capturedParams = null;
|
|
279
|
+
const getStub = sinon.stub(axios, "get").callsFake((url, cfg = {}) => {
|
|
280
|
+
if (url.endsWith("/exchange-create")) capturedParams = cfg.params;
|
|
281
|
+
return axiosOriginalGet(url, cfg);
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
const amount = await pickValidAmount(btcCoin, ethCoin, "0.001");
|
|
285
|
+
await provider.createSwap(
|
|
286
|
+
btcCoin,
|
|
287
|
+
ethCoin,
|
|
288
|
+
amount,
|
|
289
|
+
"bc1qw508d6qejxtdg4y5r3zarvaryvaxxpcs",
|
|
290
|
+
"1BitcoinRefundAddrxxxxxxxxxxxx",
|
|
291
|
+
null,
|
|
292
|
+
null,
|
|
293
|
+
false
|
|
294
|
+
);
|
|
295
|
+
|
|
296
|
+
should(capturedParams).not.have.property("refundTag");
|
|
297
|
+
getStub.restore();
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
it("Should compute toAmount from rate×amount when amountTo not returned", async () => {
|
|
301
|
+
const btcCoin = getCoinByCode("BTC");
|
|
302
|
+
const ethCoin = getCoinByCode("ETH");
|
|
303
|
+
if (!btcCoin || !ethCoin || !pairSupported(btcCoin, ethCoin)) return;
|
|
304
|
+
|
|
305
|
+
const amount = await pickValidAmount(btcCoin, ethCoin, "0.003");
|
|
306
|
+
const result = await provider.createSwap(
|
|
307
|
+
btcCoin,
|
|
308
|
+
ethCoin,
|
|
309
|
+
amount,
|
|
310
|
+
"bc1qw508d6qejxtdg4y5r3zarvaryvaxxpcs",
|
|
311
|
+
"",
|
|
312
|
+
null,
|
|
313
|
+
null,
|
|
314
|
+
false
|
|
315
|
+
);
|
|
316
|
+
|
|
317
|
+
const expected = new BigNumber(result.fromAmount)
|
|
318
|
+
.times(result.rate)
|
|
319
|
+
.decimalPlaces(result.toCoin.digits, BigNumber.ROUND_DOWN);
|
|
320
|
+
new BigNumber(result.toAmount).eq(expected).should.be.true();
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
it("Should return NOT_SUPPORTED for JOE→TRX pair", async () => {
|
|
324
|
+
const joeCoin = getCoinByCode("JOE");
|
|
325
|
+
const trxCoin = getCoinByCode("TRX");
|
|
326
|
+
if (!joeCoin || !trxCoin) return;
|
|
327
|
+
|
|
328
|
+
const info = await provider.getSwapInfo(joeCoin, trxCoin, "50");
|
|
329
|
+
info.result.should.be.false();
|
|
330
|
+
info.reason.should.equal(provider.constructor.NO_SWAPS_REASONS.NOT_SUPPORTED);
|
|
331
|
+
});
|
|
238
332
|
});
|
|
239
333
|
});
|