@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/package.json
CHANGED
|
@@ -89,25 +89,13 @@ export class GoexmeSwapProvider extends SwapProvider {
|
|
|
89
89
|
};
|
|
90
90
|
|
|
91
91
|
this.COINS_EXPIRATION_TIME_MS = 5 * 60 * 1000;
|
|
92
|
-
this.PAIRS_EXPIRATION_TIME_MS = 5 * 60 * 1000;
|
|
93
92
|
this.SWAP_EXPIRATION_TIME_MS = 4 * 60 * 60 * 1000;
|
|
94
|
-
|
|
95
|
-
this._pairsCache = null;
|
|
96
|
-
this._pairsCacheTimestamp = 0;
|
|
97
93
|
}
|
|
98
94
|
|
|
99
95
|
getSwapCreationInfoTtlMs() {
|
|
100
96
|
return 30000;
|
|
101
97
|
}
|
|
102
98
|
|
|
103
|
-
_isPairSupported(fromInfo, toInfo) {
|
|
104
|
-
if (!this._pairsCache || !this._pairsCache[fromInfo.code]) return false;
|
|
105
|
-
const toSet = this._pairsCache[fromInfo.code];
|
|
106
|
-
/* GoExme may list either the raw provider code **or**
|
|
107
|
-
* the “pretty” Rabbit ticker in `/pairs`, so we test both. */
|
|
108
|
-
return toSet.has(toInfo.code) || toSet.has(toInfo.coin.ticker);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
99
|
_findInfoByTicker(ticker) {
|
|
112
100
|
return this._supportedCoins.find(i => i.coin.ticker === ticker) || null;
|
|
113
101
|
}
|
|
@@ -196,33 +184,6 @@ export class GoexmeSwapProvider extends SwapProvider {
|
|
|
196
184
|
);
|
|
197
185
|
}
|
|
198
186
|
|
|
199
|
-
async _ensurePairsLoaded() {
|
|
200
|
-
const loggerSource = "Goexme._ensurePairsLoaded";
|
|
201
|
-
try {
|
|
202
|
-
if (this._pairsCache && Date.now() - this._pairsCacheTimestamp < this.PAIRS_EXPIRATION_TIME_MS) return;
|
|
203
|
-
|
|
204
|
-
const response = await axios.get(`${this._URL}/pairs`, {
|
|
205
|
-
...this.axiosPreset,
|
|
206
|
-
...createRobustTimeoutSetupForAxios(),
|
|
207
|
-
params: { key: this._apiKey },
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
if (response.status !== 200 || typeof response.data !== "object") {
|
|
211
|
-
throw new Error("Failed to load /pairs");
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
this._pairsCache = Object.fromEntries(
|
|
215
|
-
Object.entries(response.data).map(([from, arr]) => [
|
|
216
|
-
from.toUpperCase(),
|
|
217
|
-
new Set(arr.map(v => v.toUpperCase())),
|
|
218
|
-
])
|
|
219
|
-
);
|
|
220
|
-
this._pairsCacheTimestamp = Date.now();
|
|
221
|
-
} catch (e) {
|
|
222
|
-
improveAndRethrow(e, loggerSource);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
187
|
_mapGoexmeStatus(status) {
|
|
227
188
|
switch (status) {
|
|
228
189
|
case "new":
|
|
@@ -303,12 +264,11 @@ export class GoexmeSwapProvider extends SwapProvider {
|
|
|
303
264
|
throw new Error("Invalid params for getSwapInfo");
|
|
304
265
|
|
|
305
266
|
await this._fetchSupportedCurrenciesIfNeeded();
|
|
306
|
-
await this._ensurePairsLoaded();
|
|
307
267
|
|
|
308
268
|
const fromCoinInfo = this._findInfoByTicker(fromCoin.ticker);
|
|
309
269
|
const toCoinInfo = this._findInfoByTicker(toCoin.ticker);
|
|
310
270
|
|
|
311
|
-
if (!fromCoinInfo || !toCoinInfo
|
|
271
|
+
if (!fromCoinInfo || !toCoinInfo) {
|
|
312
272
|
return {
|
|
313
273
|
result: false,
|
|
314
274
|
reason: SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED,
|
|
@@ -361,10 +321,18 @@ export class GoexmeSwapProvider extends SwapProvider {
|
|
|
361
321
|
};
|
|
362
322
|
}
|
|
363
323
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
324
|
+
if (
|
|
325
|
+
response.data.rate == null ||
|
|
326
|
+
BigNumber(response.data.rate).isNaN() ||
|
|
327
|
+
BigNumber(response.data.rate).lte(0)
|
|
328
|
+
) {
|
|
329
|
+
return {
|
|
330
|
+
result: false,
|
|
331
|
+
reason: SwapProvider.NO_SWAPS_REASONS.NOT_SUPPORTED,
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// Convert amountTo → ratio so that downstream code can do amountFrom * rate === amountTo
|
|
368
336
|
let rateRatio = null;
|
|
369
337
|
if (response.data.rate != null && BigNumber(amountCoins).gt(0)) {
|
|
370
338
|
rateRatio = AmountUtils.trim(
|
|
@@ -385,10 +353,6 @@ export class GoexmeSwapProvider extends SwapProvider {
|
|
|
385
353
|
rawSwapData: response.data,
|
|
386
354
|
/**
|
|
387
355
|
* GoExme never requires a refund address.
|
|
388
|
-
*
|
|
389
|
-
* The official API documentation marks `destinationTag` / `refundTag` as **optional**.
|
|
390
|
-
* Support chat confirmation (2025‑06‑27): "Yes, it's optional and can be omitted even for small amounts."
|
|
391
|
-
*
|
|
392
356
|
*/
|
|
393
357
|
isRefundAddressRequired: false,
|
|
394
358
|
};
|
|
@@ -407,23 +371,28 @@ export class GoexmeSwapProvider extends SwapProvider {
|
|
|
407
371
|
/**
|
|
408
372
|
* Creates a swap on GoExme.
|
|
409
373
|
*
|
|
410
|
-
*
|
|
411
|
-
* `
|
|
412
|
-
*
|
|
413
|
-
* •
|
|
374
|
+
* The `proprietarySwapEstimationData` object **must** carry two distinct values
|
|
375
|
+
* produced by a prior `/rate` call:
|
|
376
|
+
*
|
|
377
|
+
* • `rawSwapData.rate` – **amountTo**
|
|
378
|
+
* (the exact number of coins GoExme will send to the user);
|
|
379
|
+
* • `rate` – **ratio**
|
|
380
|
+
* (`amountTo / amountFrom`, i.e. Rabbit‑style per‑coin rate).
|
|
381
|
+
*
|
|
382
|
+
* Processing steps
|
|
383
|
+
* ----------------
|
|
384
|
+
* 1. Determine **amountTo** (`rawSwapData.rate`).
|
|
385
|
+
* 2. Compute the canonical per‑coin **ratio**:
|
|
414
386
|
*
|
|
415
|
-
*
|
|
416
|
-
* estimation as amountTo, then derive the ratio ourselves.
|
|
387
|
+
* ratio = amountTo / amountFrom
|
|
417
388
|
*
|
|
418
|
-
*
|
|
419
|
-
*
|
|
420
|
-
*
|
|
421
|
-
*
|
|
422
|
-
*
|
|
423
|
-
*
|
|
424
|
-
*
|
|
425
|
-
* → both mandatory fields (`rate`, `withdrawal.amount`)
|
|
426
|
-
* are always present, avoiding schema validation errors.
|
|
389
|
+
* 3. Return both numbers for downstream code:
|
|
390
|
+
* • `rate` → ratio (Rabbit convention);
|
|
391
|
+
* • `toAmount` → amountTo (final coins the user receives).
|
|
392
|
+
*
|
|
393
|
+
* This guarantees the invariant:
|
|
394
|
+
*
|
|
395
|
+
* amountFrom * rate === toAmount
|
|
427
396
|
*/
|
|
428
397
|
async createSwap(
|
|
429
398
|
fromCoin,
|
|
@@ -447,7 +416,7 @@ export class GoexmeSwapProvider extends SwapProvider {
|
|
|
447
416
|
const fromCoinInfo = this._findInfoByTicker(fromCoin.ticker);
|
|
448
417
|
const toCoinInfo = this._findInfoByTicker(toCoin.ticker);
|
|
449
418
|
|
|
450
|
-
if (!fromCoinInfo || !toCoinInfo
|
|
419
|
+
if (!fromCoinInfo || !toCoinInfo) {
|
|
451
420
|
throw new Error(`Unsupported pair ${fromCoin.ticker} -> ${toCoin.ticker}`);
|
|
452
421
|
}
|
|
453
422
|
|
|
@@ -474,6 +443,9 @@ export class GoexmeSwapProvider extends SwapProvider {
|
|
|
474
443
|
};
|
|
475
444
|
|
|
476
445
|
params.amount = amount;
|
|
446
|
+
|
|
447
|
+
// Add refundAddress only if extraId is present:
|
|
448
|
+
// GoExme documents these fields as optional, and support (2025‑06‑27) confirmed that.
|
|
477
449
|
if (toCoinInfo.hasExtraId && toCurrencyExtraId) params.destinationTag = toCurrencyExtraId;
|
|
478
450
|
if (refundAddress) {
|
|
479
451
|
params.refundAddress = refundAddress;
|
|
@@ -494,9 +466,7 @@ export class GoexmeSwapProvider extends SwapProvider {
|
|
|
494
466
|
throw new Error(errMsg);
|
|
495
467
|
}
|
|
496
468
|
|
|
497
|
-
|
|
498
|
-
* Extract amountTo from estimation (first non-null source).
|
|
499
|
-
*-----------------------------------------------------------*/
|
|
469
|
+
// Extract amountTo from estimation (first non-null source).
|
|
500
470
|
const amountToCandidate =
|
|
501
471
|
proprietarySwapEstimationData?.rawSwapData?.rate ?? proprietarySwapEstimationData?.rate ?? null;
|
|
502
472
|
|
|
@@ -506,9 +476,7 @@ export class GoexmeSwapProvider extends SwapProvider {
|
|
|
506
476
|
|
|
507
477
|
const toAmountCalculated = AmountUtils.trim(amountToCandidate, toCoin.digits);
|
|
508
478
|
|
|
509
|
-
|
|
510
|
-
* Derive ratio so that amountFrom * ratio = amountTo.
|
|
511
|
-
*-----------------------------------------------------------*/
|
|
479
|
+
// Derive ratio so that amountFrom * ratio = amountTo.
|
|
512
480
|
const rateRatio = AmountUtils.trim(
|
|
513
481
|
BigNumber(toAmountCalculated).div(amount).toString(),
|
|
514
482
|
this._maxRateDigits
|
|
@@ -561,26 +529,23 @@ export class GoexmeSwapProvider extends SwapProvider {
|
|
|
561
529
|
|
|
562
530
|
const statusResponses = await Promise.all(swapIds.map(fetchOne));
|
|
563
531
|
|
|
564
|
-
|
|
532
|
+
// helper: normalize coin code using CODE_TRANSLATIONS
|
|
565
533
|
const normalize = code => CODE_TRANSLATIONS[code.toUpperCase()] ?? code.toUpperCase();
|
|
566
534
|
|
|
567
535
|
const swaps = statusResponses
|
|
568
536
|
.map((statusData, swapIndex) => {
|
|
569
537
|
if (!statusData) return null;
|
|
570
538
|
|
|
571
|
-
/* ------------------ coins ------------------ */
|
|
572
539
|
const fromCoinTicker = toRabbitTicker(normalize(statusData.from), "");
|
|
573
540
|
const toCoinTicker = toRabbitTicker(normalize(statusData.to), "");
|
|
574
541
|
|
|
575
542
|
let fromCoin = this.getCoinByTickerIfPresent(fromCoinTicker);
|
|
576
543
|
let toCoin = this.getCoinByTickerIfPresent(toCoinTicker);
|
|
577
544
|
|
|
578
|
-
/* fallback: look up by raw provider code if ticker lookup failed */
|
|
579
545
|
if (!fromCoin) {
|
|
580
546
|
const byCode = this._supportedCoins.find(c => c.code === statusData.from);
|
|
581
547
|
fromCoin = byCode?.coin ?? null;
|
|
582
548
|
}
|
|
583
|
-
/* fallback: look up by raw provider code if ticker lookup failed */
|
|
584
549
|
if (!toCoin) {
|
|
585
550
|
const byCode = this._supportedCoins.find(c => c.code === statusData.to);
|
|
586
551
|
toCoin = byCode?.coin ?? null;
|
|
@@ -588,11 +553,9 @@ export class GoexmeSwapProvider extends SwapProvider {
|
|
|
588
553
|
|
|
589
554
|
if (!fromCoin || !toCoin) return null;
|
|
590
555
|
|
|
591
|
-
/* timestamps */
|
|
592
556
|
const createdAt = GoexmeSwapProvider._parseGoexmeDate(statusData.date);
|
|
593
557
|
const expiresAt = createdAt + this.SWAP_EXPIRATION_TIME_MS;
|
|
594
558
|
|
|
595
|
-
/* amounts & rate */
|
|
596
559
|
const amountFromEffective = statusData.amountFrom ?? statusData.expectedAmountFrom ?? "0";
|
|
597
560
|
const amountToEffective = statusData.amountTo ?? statusData.expectedAmountTo ?? null;
|
|
598
561
|
let rateVal = statusData.rate;
|
|
@@ -76,7 +76,7 @@ export class ExistingSwap {
|
|
|
76
76
|
* @param {number} expiresAt - The timestamp when the swap expires.
|
|
77
77
|
* @param {number|null} confirmations - The number of confirmations the swap has received, or null.
|
|
78
78
|
* @param {string} rate - The exchange rate for the swap.
|
|
79
|
-
* @param {
|
|
79
|
+
* @param {boolean} fixed - Indicates if the rate is fixed.
|
|
80
80
|
* @param {string|null} refundAddress - The address to refund to in case of failure, or null.
|
|
81
81
|
* @param {string} payToAddress - The address to send the funds to.
|
|
82
82
|
* @param {Coin} fromCoin - The coin that is being swapped from.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import should from "should";
|
|
2
|
+
import { describe, it } from "vitest";
|
|
3
|
+
|
|
4
|
+
import { GoexmeSwapProvider } from "../../../external-apis/goexmeSwapProvider.js";
|
|
5
|
+
import { Cache } from "../../../../common-apis/utils/cache.js";
|
|
6
|
+
import { Coin } from "../../../../common-apis/models/coin.js";
|
|
7
|
+
import { Protocol } from "../../../../common-apis/models/protocol.js";
|
|
8
|
+
|
|
9
|
+
describe("goexmeSwapProvider", function () {
|
|
10
|
+
describe("_convertCurrencyMeta", function () {
|
|
11
|
+
it("Should return null for restricted set", () => {
|
|
12
|
+
const restrictedProvider = new GoexmeSwapProvider("/", new Cache(), () => null, true);
|
|
13
|
+
should(restrictedProvider._convertCurrencyMeta("abc", { coinName: "Abc" })).be.null();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("Should auto‑construct Coin when builder is null and unrestricted", () => {
|
|
17
|
+
const unrestrictedProvider = new GoexmeSwapProvider("/", new Cache(), null, false);
|
|
18
|
+
const currencyInfo = unrestrictedProvider._convertCurrencyMeta("btc", {
|
|
19
|
+
coinName: "Bitcoin Test",
|
|
20
|
+
network: "",
|
|
21
|
+
available: true,
|
|
22
|
+
});
|
|
23
|
+
currencyInfo.should.have.properties({ code: "BTC", network: null });
|
|
24
|
+
currencyInfo.coin.should.be.instanceOf(Coin);
|
|
25
|
+
if (currencyInfo.coin.protocol) currencyInfo.coin.protocol.should.be.instanceOf(Protocol);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("Should set hasExtraId=true and extraIdName when tagname present", () => {
|
|
29
|
+
const unrestrictedProvider = new GoexmeSwapProvider("/", new Cache(), null, false);
|
|
30
|
+
const currencyInfo = unrestrictedProvider._convertCurrencyMeta("xrp", {
|
|
31
|
+
coinName: "Ripple",
|
|
32
|
+
network: "",
|
|
33
|
+
available: true,
|
|
34
|
+
tagname: "DestinationTag",
|
|
35
|
+
});
|
|
36
|
+
currencyInfo.hasExtraId.should.be.true();
|
|
37
|
+
currencyInfo.extraIdName.should.equal("DestinationTag");
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it("Should set hasExtraId=false and extraIdName=null when no tagname", () => {
|
|
41
|
+
const unrestrictedProvider = new GoexmeSwapProvider("/", new Cache(), null, false);
|
|
42
|
+
const currencyInfo = unrestrictedProvider._convertCurrencyMeta("ltc", {
|
|
43
|
+
coinName: "Litecoin",
|
|
44
|
+
network: "",
|
|
45
|
+
available: true,
|
|
46
|
+
});
|
|
47
|
+
currencyInfo.hasExtraId.should.be.false();
|
|
48
|
+
should(currencyInfo.extraIdName).be.null();
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
describe("constructor", function () {
|
|
53
|
+
it("Should default _URL to proxy path when apiKey empty", () => {
|
|
54
|
+
const provider = new GoexmeSwapProvider("/proxy", new Cache());
|
|
55
|
+
provider._URL.should.equal("/proxy/goexme");
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("Should set direct URL when apiKey passed", () => {
|
|
59
|
+
const providerWithKey = new GoexmeSwapProvider("/proxy", new Cache(), () => null, false, "key");
|
|
60
|
+
providerWithKey._URL.should.equal("https://goexme.io/v1/api");
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("Should not set Authorization header", () => {
|
|
64
|
+
const providerWithSecret = new GoexmeSwapProvider("/proxy", new Cache(), () => null, false, "mySecret");
|
|
65
|
+
should(providerWithSecret.headers).not.have.property("Authorization");
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it("Should not set any unexpected headers", () => {
|
|
69
|
+
const providerWithSecret = new GoexmeSwapProvider("/proxy", new Cache(), () => null, false, "mySecret");
|
|
70
|
+
Object.keys(providerWithSecret.headers).should.eql([]);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it("Should allow only 200, 400 and 404 in validateStatus", () => {
|
|
74
|
+
const defaultProvider = new GoexmeSwapProvider("/", new Cache());
|
|
75
|
+
const allowedStatuses = [200, 400, 404];
|
|
76
|
+
allowedStatuses.forEach(status => defaultProvider.axiosPreset.validateStatus(status).should.be.true());
|
|
77
|
+
[199, 500].forEach(status => defaultProvider.axiosPreset.validateStatus(status).should.be.false());
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
});
|
|
@@ -1,148 +1,75 @@
|
|
|
1
1
|
import sinon from "sinon";
|
|
2
2
|
import axios from "axios";
|
|
3
3
|
import should from "should";
|
|
4
|
-
import {
|
|
4
|
+
import { beforeEach, afterEach, describe, it } from "vitest";
|
|
5
5
|
|
|
6
6
|
import { GoexmeSwapProvider } from "../../../external-apis/goexmeSwapProvider.js";
|
|
7
7
|
import { Cache } from "../../../../common-apis/utils/cache.js";
|
|
8
|
-
import { Coin } from "../../../../common-apis/models/coin.js";
|
|
9
|
-
import { Protocol } from "../../../../common-apis/models/protocol.js";
|
|
10
|
-
|
|
11
|
-
describe("goexmeSwapProvider::_fetchSupportedCurrenciesIfNeeded-stack", () => {
|
|
12
|
-
const apiOK = {
|
|
13
|
-
btc: { coinName: "Bitcoin", available: true, network: "", tagname: "", minamount: 0.001, maxamount: 10 },
|
|
14
|
-
eth: { coinName: "Ethereum", available: true, network: "erc20", tagname: "" },
|
|
15
|
-
usdt: { coinName: "Tether", available: false, network: "" },
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
let provider, axiosStub;
|
|
19
|
-
beforeEach(() => {
|
|
20
|
-
provider = new GoexmeSwapProvider("/", new Cache(), () => null, false);
|
|
21
|
-
axiosStub = sinon.stub(axios, "get");
|
|
22
|
-
});
|
|
23
|
-
afterEach(() => sinon.restore());
|
|
24
8
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
});
|
|
9
|
+
describe("goexmeSwapProvider", function () {
|
|
10
|
+
describe("_fetchSupportedCurrenciesIfNeeded", function () {
|
|
11
|
+
let provider, axiosGetStub;
|
|
29
12
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
provider = new GoexmeSwapProvider("/", new Cache(), () => null, false);
|
|
15
|
+
axiosGetStub = sinon.stub(axios, "get");
|
|
16
|
+
});
|
|
34
17
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
{ coinName: "Bitcoin Test", network: "", available: true },
|
|
40
|
-
new Set()
|
|
41
|
-
);
|
|
42
|
-
info.should.have.properties({ code: "BTC", network: null });
|
|
43
|
-
info.coin.should.be.instanceOf(Coin);
|
|
44
|
-
if (info.coin.protocol) info.coin.protocol.should.be.instanceOf(Protocol);
|
|
45
|
-
});
|
|
18
|
+
afterEach(() => {
|
|
19
|
+
axiosGetStub.restore();
|
|
20
|
+
provider._supportedCoins = [];
|
|
21
|
+
});
|
|
46
22
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
});
|
|
23
|
+
it("Should load and map available currencies when status is 200", async () => {
|
|
24
|
+
const apiOK = {
|
|
25
|
+
btc: { coinName: "Bitcoin", available: true, network: "", tagname: "" },
|
|
26
|
+
eth: { coinName: "Ethereum", available: true, network: "erc20", tagname: "" },
|
|
27
|
+
usdt: { coinName: "Tether", available: false, network: "" },
|
|
28
|
+
};
|
|
29
|
+
axiosGetStub.resolves({ status: 200, data: apiOK });
|
|
55
30
|
|
|
56
|
-
|
|
57
|
-
axiosStub.resolves({ status: 200, data: apiOK });
|
|
58
|
-
await provider._fetchSupportedCurrenciesIfNeeded();
|
|
59
|
-
provider._supportedCoins.some(i => i.code === "usdt").should.be.false();
|
|
60
|
-
});
|
|
31
|
+
await provider._fetchSupportedCurrenciesIfNeeded();
|
|
61
32
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
});
|
|
33
|
+
provider._supportedCoins.length.should.equal(2);
|
|
34
|
+
provider._supportedCoins.forEach(info => info.coin.should.be.instanceOf(info.coin.constructor));
|
|
35
|
+
});
|
|
66
36
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
37
|
+
it("Should skip currencies with available=false", async () => {
|
|
38
|
+
const apiPartial = {
|
|
39
|
+
btc: { coinName: "Bitcoin", available: false, network: "", tagname: "" },
|
|
40
|
+
eth: { coinName: "Ethereum", available: true, network: "", tagname: "" },
|
|
41
|
+
};
|
|
42
|
+
axiosGetStub.resolves({ status: 200, data: apiPartial });
|
|
72
43
|
|
|
73
|
-
|
|
74
|
-
let provider, axiosStub;
|
|
75
|
-
beforeEach(() => {
|
|
76
|
-
provider = new GoexmeSwapProvider("/", new Cache(), () => null, false);
|
|
77
|
-
axiosStub = sinon
|
|
78
|
-
.stub(axios, "get")
|
|
79
|
-
.callsFake(url =>
|
|
80
|
-
url.includes("/pairs")
|
|
81
|
-
? Promise.resolve({ status: 200, data: { BTC: ["ETH"] } })
|
|
82
|
-
: Promise.resolve({ status: 200, data: {} })
|
|
83
|
-
);
|
|
84
|
-
});
|
|
85
|
-
afterEach(() => sinon.restore());
|
|
44
|
+
await provider._fetchSupportedCurrenciesIfNeeded();
|
|
86
45
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
await provider._ensurePairsLoaded();
|
|
91
|
-
axiosStub.callCount.should.equal(calls);
|
|
92
|
-
});
|
|
46
|
+
provider._supportedCoins.length.should.equal(1);
|
|
47
|
+
provider._supportedCoins[0].code.should.equal("ETH");
|
|
48
|
+
});
|
|
93
49
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
provider._pairsCacheTimestamp -= provider.PAIRS_EXPIRATION_TIME_MS + 1000;
|
|
97
|
-
await provider._ensurePairsLoaded();
|
|
98
|
-
axiosStub.callCount.should.equal(2);
|
|
99
|
-
});
|
|
50
|
+
it("Should reject when response status is not 200", async () => {
|
|
51
|
+
axiosGetStub.resolves({ status: 500, data: {} });
|
|
100
52
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
axiosStub.resolves({ status: 400, data: {} });
|
|
104
|
-
await provider._ensurePairsLoaded().should.be.rejectedWith(/Failed to load/);
|
|
105
|
-
});
|
|
53
|
+
return provider._fetchSupportedCurrenciesIfNeeded().should.be.rejected();
|
|
54
|
+
});
|
|
106
55
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
provider._pairsCache.should.have.property("BTC");
|
|
110
|
-
provider._pairsCache.BTC.has("ETH").should.be.true();
|
|
111
|
-
});
|
|
112
|
-
});
|
|
56
|
+
it("Should propagate axios error", async () => {
|
|
57
|
+
axiosGetStub.rejects(new Error("network"));
|
|
113
58
|
|
|
114
|
-
|
|
115
|
-
let provider, axiosStub;
|
|
116
|
-
beforeEach(() => {
|
|
117
|
-
provider = new GoexmeSwapProvider("/", new Cache(), () => null, false);
|
|
118
|
-
axiosStub = sinon.stub(axios, "get").resolves({
|
|
119
|
-
status: 200,
|
|
120
|
-
data: { btc: { coinName: "btc", available: true } },
|
|
59
|
+
return provider._fetchSupportedCurrenciesIfNeeded().should.be.rejectedWith(/network/);
|
|
121
60
|
});
|
|
122
|
-
});
|
|
123
|
-
afterEach(() => sinon.restore());
|
|
124
61
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
describe("goexmeSwapProvider::helpers", () => {
|
|
132
|
-
it("getSwapCreationInfoTtlMs returns 30 000 ms", () => {
|
|
133
|
-
const p = new GoexmeSwapProvider("/", new Cache());
|
|
134
|
-
p.getSwapCreationInfoTtlMs().should.equal(30000);
|
|
135
|
-
});
|
|
62
|
+
it("Should not call axios again while cache is fresh", async () => {
|
|
63
|
+
const apiOK = {
|
|
64
|
+
btc: { coinName: "Bitcoin", available: true, network: "", tagname: "" },
|
|
65
|
+
};
|
|
66
|
+
axiosGetStub.resolves({ status: 200, data: apiOK });
|
|
136
67
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
});
|
|
68
|
+
await provider._fetchSupportedCurrenciesIfNeeded();
|
|
69
|
+
const initialCalls = axiosGetStub.callCount;
|
|
70
|
+
await provider._fetchSupportedCurrenciesIfNeeded();
|
|
141
71
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
const partners = await p.getPartnersList();
|
|
145
|
-
partners.should.have.length(1);
|
|
146
|
-
partners[0].should.have.property("name", "GoExme");
|
|
72
|
+
axiosGetStub.callCount.should.equal(initialCalls);
|
|
73
|
+
});
|
|
147
74
|
});
|
|
148
75
|
});
|