@rabbitio/ui-kit 1.0.0-beta.63 → 1.0.0-beta.64
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 +881 -4772
- package/coverage/coverage-final.json +99 -159
- package/coverage/index.html +91 -346
- package/coverage/{ui-kit → rabbit-ui-kit}/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/index.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/assets/wrappedImages/arrowIcon.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/assets/wrappedImages/arrowTosca.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/assets/wrappedImages/arrowWhite.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/assets/wrappedImages/darkRectangle.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/assets/wrappedImages/determinedError.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/assets/wrappedImages/failedValidationIcon.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/assets/wrappedImages/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/assets/wrappedImages/infoIcon.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/assets/wrappedImages/noticeQuestionIcon.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/assets/wrappedImages/successfulValidationIcon.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/assets/wrappedImages/walletIcon.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common/adapters/axiosAdapter.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common/adapters/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common/adapters/qrUtils.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common/amountUtils.js.html +138 -105
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common/errorUtils.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common/external-apis/apiGroups.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common/external-apis/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common/external-apis/ipAddressProviders.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common/fiatCurrenciesService.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common/index.html +22 -22
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common/models/blockchain.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common/models/coin.js.html +42 -42
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common/models/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common/models/protocol.js.html +5 -5
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common/utils/cache.js.html +8 -8
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common/utils/emailAPI.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common/utils/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common/utils/logging/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common/utils/logging/logger.js.html +6 -6
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common/utils/logging/logsStorage.js.html +5 -5
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common/utils/postponeExecution.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/common/utils/safeStringify.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/AssetIcon/AssetIcon.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/AssetIcon/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/AssetSelection/AssetSelection.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/AssetSelection/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/BackgroundTitle/BackgroundTitle.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/BackgroundTitle/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/InformationMessage/InformationMessage.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/InformationMessage/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/Input/Input.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/Input/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/LoadingDots/LoadingDots.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/LoadingDots/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/NoticeIcon/NoticeIcon.jsx.html +16 -7
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/NoticeIcon/index.html +7 -7
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/QrCode/QrCode.jsx.html +26 -8
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/QrCode/index.html +7 -7
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/RateSelector/RateSelector.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/RateSelector/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/SupportChat/SupportChat.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/SupportChat/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/Textarea/Textarea.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/Textarea/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/TitleBox/TitleBox.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/TitleBox/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/Tooltip/Tooltip.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/Tooltip/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/TwoLinesOfText/LinesOfText.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/TwoLinesOfText/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/Validation/Validation.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/Validation/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/buttons/Button/Button.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/buttons/Button/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/buttons/Close/Close.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/buttons/Close/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/buttons/LinkButton/LinkButton.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/buttons/LinkButton/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/atoms/buttons/RadioButtonWithText/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/hooks/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/hooks/useCallHandlingErrors.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/hooks/useReferredState.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/molecules/AmountInput/AmountInput.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/molecules/AmountInput/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/molecules/CoinPicker/CoinPicker.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/molecules/CoinPicker/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/molecules/LineWithIconLink/LineWithIconLink.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/molecules/LineWithIconLink/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/molecules/TitledLineWithIconLink/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/organisms/CoinPickerDialogStep/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/organisms/Dialog/Dialog.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/organisms/Dialog/DialogButtons/DialogButtons.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/organisms/Dialog/DialogButtons/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/organisms/Dialog/DialogStep/DialogStep.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/organisms/Dialog/DialogStep/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/organisms/Dialog/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/organisms/SwapForm/SwapForm.jsx.html +24 -27
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/organisms/SwapForm/index.html +7 -7
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/templates/DeterminedErrorDialogStep/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/utils/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/utils/inputValueProviders.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/utils/textUtils.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/utils/uiUtils.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/components/utils/urlQueryUtils.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/constants/atoms/Close/close.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/constants/atoms/Close/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/constants/atoms/LinkButton/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/constants/atoms/LinkButton/linkButton.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/constants/atoms/Tooltip/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/constants/atoms/Tooltip/tooltip.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/constants/globalConstants.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/constants/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/constants/organisms/dialog/DialogStep/dialogStep.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/constants/organisms/dialog/DialogStep/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/constants/organisms/dialog/dialog.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/constants/organisms/dialog/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/index.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/robustExteranlApiCallerService/cacheAndConcurrentRequestsResolver.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/robustExteranlApiCallerService/cachedRobustExternalApiCallerService.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/robustExteranlApiCallerService/cancelProcessing.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/robustExteranlApiCallerService/concurrentCalculationsMetadataHolder.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/robustExteranlApiCallerService/externalApiProvider.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/robustExteranlApiCallerService/externalServicesStatsCollector.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/robustExteranlApiCallerService/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/robustExteranlApiCallerService/robustExternalAPICallerService.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/swaps-lib/external-apis/index.html +17 -17
- package/coverage/{ui-kit → rabbit-ui-kit}/src/swaps-lib/external-apis/swapProvider.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/swaps-lib/external-apis/swapspaceSwapProvider.js.html +139 -103
- package/coverage/{ui-kit → rabbit-ui-kit}/src/swaps-lib/models/baseSwapCreationInfo.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/swaps-lib/models/existingSwap.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/swaps-lib/models/existingSwapWithFiatData.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/swaps-lib/models/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/swaps-lib/services/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/swaps-lib/services/publicSwapService.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/swaps-lib/utils/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/src/swaps-lib/utils/swapUtils.js.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/atoms/BackgroundTitle.stories.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/atoms/LinesOfText.stories.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/atoms/LoadingDots.stories.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/atoms/QrCode.stories.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/atoms/RateSelector.stories.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/atoms/Validation.stories.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/atoms/buttons/Button.stories.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/atoms/buttons/Close.stories.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/atoms/buttons/LinkButton.stories.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/atoms/buttons/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/atoms/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/molecules/LineWithIconLink.stories.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/molecules/TitledLineWithIconLink.stories.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/molecules/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/organisms/Dialog/Dialog.stories.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/organisms/Dialog/DialogButtons/DialogButtons.stories.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/organisms/Dialog/DialogButtons/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/organisms/Dialog/DialogStep/DialogStep.stories.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/organisms/Dialog/DialogStep/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/organisms/Dialog/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/stubs/exampleContent.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/stubs/index.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/templates/DeterminedErrorDialogStep.stories.jsx.html +3 -3
- package/coverage/{ui-kit → rabbit-ui-kit}/stories/templates/index.html +3 -3
- package/dist/index.cjs +65 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +6 -0
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +53 -36
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +65 -38
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +65 -38
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/common/amountUtils.js +32 -21
- package/src/common/tests/amountUtils/composeRateText.test.js +209 -0
- package/src/components/atoms/AssetSelection/asset-selection.module.scss +1 -0
- package/src/components/atoms/NoticeIcon/NoticeIcon.jsx +4 -1
- package/src/components/atoms/QrCode/QrCode.jsx +8 -2
- package/src/components/atoms/QrCode/qr-code.module.scss +6 -0
- package/src/components/organisms/SwapForm/SwapForm.jsx +18 -19
- package/src/swaps-lib/external-apis/swapspaceSwapProvider.js +13 -1
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +117 -0
package/package.json
CHANGED
|
@@ -356,42 +356,53 @@ export class AmountUtils {
|
|
|
356
356
|
}
|
|
357
357
|
|
|
358
358
|
/**
|
|
359
|
-
* Safely composes rate string (handles small/big rates)
|
|
359
|
+
* Safely composes rate string (handles small/big rates).
|
|
360
|
+
* Here we try to calculate a clear rate for the user. The difficulty is that the rate value can be pretty
|
|
361
|
+
* small as some coins have significantly higher price than the other. For such cases we calculate
|
|
362
|
+
* not the "1 <coin_A> is X <coin B>" but "Y <coin_A> is X <coin B>" where Y is one of the powers of 100.
|
|
360
363
|
*
|
|
361
364
|
* @param leftTicker {string}
|
|
362
365
|
* @param rightTicker {string}
|
|
363
366
|
* @param rate {number|string|BigNumber}
|
|
364
367
|
* @param [rightCurrencyDigitsAfterDots=8] {number}
|
|
368
|
+
* @param [strictRate=false] {boolean} true if the rate is strict and false if approximate
|
|
365
369
|
* @return {string}
|
|
366
370
|
*/
|
|
367
371
|
static composeRateText(
|
|
368
372
|
leftTicker,
|
|
369
373
|
rightTicker,
|
|
370
374
|
rate,
|
|
371
|
-
rightCurrencyDigitsAfterDots = this.significantDecimalCount
|
|
375
|
+
rightCurrencyDigitsAfterDots = this.significantDecimalCount,
|
|
376
|
+
strictRate = false
|
|
372
377
|
) {
|
|
373
378
|
try {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
*/
|
|
379
|
+
if (rightCurrencyDigitsAfterDots < 0) {
|
|
380
|
+
rightCurrencyDigitsAfterDots = this.significantDecimalCount;
|
|
381
|
+
}
|
|
378
382
|
let leftNumber = BigNumber("1");
|
|
379
383
|
const multiplier = BigNumber("100");
|
|
380
384
|
const maxAttemptsToGetRate = 10;
|
|
381
385
|
let right = null;
|
|
382
386
|
const rateBigNumber = BigNumber(rate);
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
387
|
+
if (BigNumber(rate).eq("0")) {
|
|
388
|
+
right = BigNumber("0");
|
|
389
|
+
} else if (
|
|
390
|
+
rate &&
|
|
391
|
+
(BigNumber.isBigNumber(rate) || !Number.isNaN(+rate))
|
|
392
|
+
) {
|
|
393
|
+
for (let i = 0; i < maxAttemptsToGetRate; ++i) {
|
|
394
|
+
const rightNumberAttempt = rateBigNumber
|
|
395
|
+
.times(leftNumber)
|
|
396
|
+
.toFixed(
|
|
397
|
+
rightCurrencyDigitsAfterDots,
|
|
398
|
+
BigNumber.ROUND_FLOOR
|
|
399
|
+
);
|
|
400
|
+
if (!BigNumber(rightNumberAttempt).eq(BigNumber("0"))) {
|
|
401
|
+
right = BigNumber(rightNumberAttempt);
|
|
402
|
+
break;
|
|
403
|
+
} else {
|
|
404
|
+
leftNumber = leftNumber.times(multiplier);
|
|
405
|
+
}
|
|
395
406
|
}
|
|
396
407
|
}
|
|
397
408
|
const leftAmountString = AmountUtils.toIntegerString(leftNumber);
|
|
@@ -402,9 +413,9 @@ export class AmountUtils {
|
|
|
402
413
|
BigNumber.ROUND_FLOOR
|
|
403
414
|
)
|
|
404
415
|
: null;
|
|
405
|
-
return `${leftAmountString} ${leftTicker}
|
|
406
|
-
|
|
407
|
-
} ${rightTicker}`;
|
|
416
|
+
return `${leftAmountString} ${leftTicker} ${
|
|
417
|
+
strictRate ? "=" : "~"
|
|
418
|
+
} ${rightAmountString ?? "?"} ${rightTicker}`;
|
|
408
419
|
} catch (e) {
|
|
409
420
|
// eslint-disable-next-line no-console
|
|
410
421
|
console.log("composeRateText", e);
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import sinon from "sinon";
|
|
2
|
+
import should from "should";
|
|
3
|
+
|
|
4
|
+
import { beforeEach, afterEach, describe, it } from "vitest";
|
|
5
|
+
import BigNumber from "bignumber.js";
|
|
6
|
+
import { AmountUtils } from "../../amountUtils.js";
|
|
7
|
+
|
|
8
|
+
describe("AmountUtils", function () {
|
|
9
|
+
let toIntegerStringStub;
|
|
10
|
+
|
|
11
|
+
beforeEach(function () {
|
|
12
|
+
toIntegerStringStub = sinon
|
|
13
|
+
.stub(AmountUtils, "toIntegerString")
|
|
14
|
+
.callsFake((number) => number.toFixed(0));
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
afterEach(function () {
|
|
18
|
+
toIntegerStringStub.restore();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
describe("composeRateText", function () {
|
|
22
|
+
it("Should handle simple rate calculation", function () {
|
|
23
|
+
const result = AmountUtils.composeRateText("BTC", "ETH", "0.1");
|
|
24
|
+
|
|
25
|
+
result.should.equal("1 BTC ~ 0.10000000 ETH");
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("Should handle rate with strictRate set to true", function () {
|
|
29
|
+
const result = AmountUtils.composeRateText(
|
|
30
|
+
"BTC",
|
|
31
|
+
"ETH",
|
|
32
|
+
"0.1",
|
|
33
|
+
8,
|
|
34
|
+
true
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
result.should.equal("1 BTC = 0.10000000 ETH");
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it("Should handle rate with high precision", function () {
|
|
41
|
+
const result = AmountUtils.composeRateText(
|
|
42
|
+
"BTC",
|
|
43
|
+
"ETH",
|
|
44
|
+
"0.12345678903422",
|
|
45
|
+
8
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
result.should.equal("1 BTC ~ 0.12345678 ETH");
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it("Should handle very small rates by scaling up", function () {
|
|
52
|
+
const result = AmountUtils.composeRateText(
|
|
53
|
+
"BTC",
|
|
54
|
+
"ETH",
|
|
55
|
+
"0.000000000000001",
|
|
56
|
+
8
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
result.should.equal("100000000 BTC ~ 0.00000010 ETH");
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("Should handle large rates", function () {
|
|
63
|
+
const result = AmountUtils.composeRateText(
|
|
64
|
+
"BTC",
|
|
65
|
+
"ETH",
|
|
66
|
+
"1000000000000000",
|
|
67
|
+
8
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
result.should.equal("1 BTC ~ 1000000000000000.00000000 ETH");
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it("Should return '?' for invalid rate input", function () {
|
|
74
|
+
const result = AmountUtils.composeRateText("BTC", "ETH", "invalid");
|
|
75
|
+
|
|
76
|
+
result.should.equal("1 BTC ~ ? ETH");
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it("Should return correct format for null rate", function () {
|
|
80
|
+
const result = AmountUtils.composeRateText("BTC", "ETH", null);
|
|
81
|
+
|
|
82
|
+
result.should.equal("1 BTC ~ ? ETH");
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it("Should ensure that toIntegerString is called with correct parameter", function () {
|
|
86
|
+
AmountUtils.composeRateText("BTC", "ETH", "0.1");
|
|
87
|
+
|
|
88
|
+
toIntegerStringStub.calledWith(BigNumber("1")).should.be.true();
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it("Should handle rate with different rightCurrencyDigitsAfterDots", function () {
|
|
92
|
+
const result = AmountUtils.composeRateText(
|
|
93
|
+
"BTC",
|
|
94
|
+
"ETH",
|
|
95
|
+
"0.123456789",
|
|
96
|
+
5
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
result.should.equal("1 BTC ~ 0.12345 ETH");
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it("Should handle rate with max rightCurrencyDigitsAfterDots", function () {
|
|
103
|
+
const result = AmountUtils.composeRateText(
|
|
104
|
+
"BTC",
|
|
105
|
+
"ETH",
|
|
106
|
+
"0.123456789",
|
|
107
|
+
10
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
result.should.equal("1 BTC ~ 0.1234567890 ETH");
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
it("Should ensure proper rounding of right amount", function () {
|
|
114
|
+
const result = AmountUtils.composeRateText(
|
|
115
|
+
"BTC",
|
|
116
|
+
"ETH",
|
|
117
|
+
"0.123456789",
|
|
118
|
+
4
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
result.should.equal("1 BTC ~ 0.1234 ETH");
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
it("Should handle great rightCurrencyDigitsAfterDots", function () {
|
|
125
|
+
const result = AmountUtils.composeRateText(
|
|
126
|
+
"BTC",
|
|
127
|
+
"ETH",
|
|
128
|
+
"0.123456789",
|
|
129
|
+
20
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
result.should.equal("1 BTC ~ 0.12345678900000000000 ETH");
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it("Should handle empty rate", function () {
|
|
136
|
+
const result = AmountUtils.composeRateText("BTC", "ETH", "");
|
|
137
|
+
|
|
138
|
+
result.should.equal("1 BTC ~ ? ETH");
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
it("Should handle negative rate", function () {
|
|
142
|
+
const result = AmountUtils.composeRateText("BTC", "ETH", "-0.1");
|
|
143
|
+
|
|
144
|
+
result.should.equal("1 BTC ~ -0.10000000 ETH");
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
it("Should return proper result for rate equal to zero", function () {
|
|
148
|
+
const result = AmountUtils.composeRateText("BTC", "ETH", "0");
|
|
149
|
+
|
|
150
|
+
result.should.equal("1 BTC ~ 0.00000000 ETH");
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
it("Should ensure that toIntegerString is called the correct number of times", function () {
|
|
154
|
+
AmountUtils.composeRateText("BTC", "ETH", "0.1");
|
|
155
|
+
|
|
156
|
+
toIntegerStringStub.callCount.should.equal(1);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it("Should handle rate with exponential notation", function () {
|
|
160
|
+
const result = AmountUtils.composeRateText("BTC", "ETH", "1e-8");
|
|
161
|
+
|
|
162
|
+
result.should.equal("1 BTC ~ 0.00000001 ETH");
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
it("Should return correct format when rate has a lot of trailing zeros", function () {
|
|
166
|
+
const result = AmountUtils.composeRateText(
|
|
167
|
+
"BTC",
|
|
168
|
+
"ETH",
|
|
169
|
+
"0.1000000000000000000000"
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
result.should.equal("1 BTC ~ 0.10000000 ETH");
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
it("Should handle zero rightCurrencyDigitsAfterDots", function () {
|
|
176
|
+
const result = AmountUtils.composeRateText(
|
|
177
|
+
"BTC",
|
|
178
|
+
"ETH",
|
|
179
|
+
"0.123456789",
|
|
180
|
+
0
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
result.should.equal("100 BTC ~ 12 ETH");
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
it("Should handle negative rightCurrencyDigitsAfterDots", function () {
|
|
187
|
+
const result = AmountUtils.composeRateText(
|
|
188
|
+
"BTC",
|
|
189
|
+
"ETH",
|
|
190
|
+
"0.123456789",
|
|
191
|
+
-1
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
result.should.equal("1 BTC ~ 0.12345678 ETH");
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
it("Should handle rate input with trailing spaces", function () {
|
|
198
|
+
const result = AmountUtils.composeRateText("BTC", "ETH", " 0.1 ");
|
|
199
|
+
|
|
200
|
+
result.should.equal("1 BTC ~ 0.10000000 ETH");
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
it("Should handle rate input in scientific notation", function () {
|
|
204
|
+
const result = AmountUtils.composeRateText("BTC", "ETH", "1e-5");
|
|
205
|
+
|
|
206
|
+
result.should.equal("1 BTC ~ 0.00001000 ETH");
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
});
|
|
@@ -41,7 +41,10 @@ export const NoticeIcon = ({
|
|
|
41
41
|
className={s["notice-icon-image"]}
|
|
42
42
|
/>
|
|
43
43
|
) : (
|
|
44
|
-
<div
|
|
44
|
+
<div
|
|
45
|
+
className={s["notice-icon-image"]}
|
|
46
|
+
onClick={() => setShowTooltip((prev) => !prev)}
|
|
47
|
+
>
|
|
45
48
|
<NoticeQuestionIcon />
|
|
46
49
|
</div>
|
|
47
50
|
)}
|
|
@@ -6,7 +6,7 @@ import { generateQrAndShowInCanvas } from "../../../common/adapters/qrUtils";
|
|
|
6
6
|
|
|
7
7
|
import s from "./qr-code.module.scss";
|
|
8
8
|
|
|
9
|
-
export const QrCode = ({ address }) => {
|
|
9
|
+
export const QrCode = ({ address, fill = false }) => {
|
|
10
10
|
const canvasRef = useRef();
|
|
11
11
|
|
|
12
12
|
useEffect(() => {
|
|
@@ -22,11 +22,17 @@ export const QrCode = ({ address }) => {
|
|
|
22
22
|
})();
|
|
23
23
|
}, [address]);
|
|
24
24
|
|
|
25
|
-
return
|
|
25
|
+
return (
|
|
26
|
+
<div
|
|
27
|
+
className={s["qr-code"] + (fill ? " " + s["fill"] : "")}
|
|
28
|
+
ref={canvasRef}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
26
31
|
};
|
|
27
32
|
|
|
28
33
|
QrCode.propTypes = {
|
|
29
34
|
address: PropTypes.string.isRequired,
|
|
35
|
+
fill: PropTypes.bool,
|
|
30
36
|
};
|
|
31
37
|
|
|
32
38
|
QrCode.defaultProps = {
|
|
@@ -275,8 +275,8 @@ export const SwapForm = ({
|
|
|
275
275
|
setRecepientAddress,
|
|
276
276
|
setRecepientAddressExtraId,
|
|
277
277
|
recepientAddressExtraIdAvailable = false,
|
|
278
|
-
|
|
279
|
-
|
|
278
|
+
displayRateSelector = false,
|
|
279
|
+
dispatchRateModeChanged = (isFixed) => {},
|
|
280
280
|
}) => {
|
|
281
281
|
const DETAIL_REFRESH_INTERVAL_MS = 1.5 * 60000;
|
|
282
282
|
|
|
@@ -310,7 +310,7 @@ export const SwapForm = ({
|
|
|
310
310
|
);
|
|
311
311
|
const [isLoading, setIsLoading] = useReferredState(false); // Whether the form is in the progress of loading some data (new rates, for example)
|
|
312
312
|
const [isAddressFieldEnabled, setIsAddressFieldEnabled] = useState(false);
|
|
313
|
-
const [
|
|
313
|
+
const [isFixedRate, setIsFixedRate] = useState(null);
|
|
314
314
|
|
|
315
315
|
const [confirmButtonTo, setConfirmButtonTo] = useState(
|
|
316
316
|
composeConfirmButtonTo(
|
|
@@ -499,7 +499,8 @@ export const SwapForm = ({
|
|
|
499
499
|
sendingAssetTicker,
|
|
500
500
|
receivingAssetTicker,
|
|
501
501
|
amount,
|
|
502
|
-
isSwapAll.current
|
|
502
|
+
isSwapAll.current,
|
|
503
|
+
isFixedRate
|
|
503
504
|
);
|
|
504
505
|
|
|
505
506
|
if (
|
|
@@ -620,6 +621,12 @@ export const SwapForm = ({
|
|
|
620
621
|
}, e);
|
|
621
622
|
};
|
|
622
623
|
|
|
624
|
+
const handleRateModeChanged = (isFixed) => {
|
|
625
|
+
setIsFixedRate(isFixed);
|
|
626
|
+
dispatchRateModeChanged(isFixed);
|
|
627
|
+
requestDataRefresh(sendAssetAmount.current, true);
|
|
628
|
+
};
|
|
629
|
+
|
|
623
630
|
useEffect(() => {
|
|
624
631
|
if (isSwapAll.current === true) {
|
|
625
632
|
requestDataRefresh(undefined, true, true);
|
|
@@ -797,14 +804,6 @@ export const SwapForm = ({
|
|
|
797
804
|
setRecepientAddressExtraId,
|
|
798
805
|
]);
|
|
799
806
|
|
|
800
|
-
useEffect(() => {
|
|
801
|
-
if (typeof isFixed !== "boolean" || !setIsFixed) return;
|
|
802
|
-
if (isInitialReaction) return;
|
|
803
|
-
requestDataRefresh(sendAssetAmount.current, true);
|
|
804
|
-
setIsInitialReaction(false);
|
|
805
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
806
|
-
}, [isFixed]);
|
|
807
|
-
|
|
808
807
|
return (
|
|
809
808
|
<div className={s["swap-form"]}>
|
|
810
809
|
<TitleBox
|
|
@@ -952,7 +951,9 @@ export const SwapForm = ({
|
|
|
952
951
|
{AmountUtils.composeRateText(
|
|
953
952
|
sendingAssetTickerPrintable,
|
|
954
953
|
receivingAssetTickerPrintable,
|
|
955
|
-
swapRate
|
|
954
|
+
swapRate,
|
|
955
|
+
receivingAssetDecimalCount,
|
|
956
|
+
isFixedRate
|
|
956
957
|
)}
|
|
957
958
|
</span>
|
|
958
959
|
</>
|
|
@@ -1107,13 +1108,11 @@ export const SwapForm = ({
|
|
|
1107
1108
|
""
|
|
1108
1109
|
)}
|
|
1109
1110
|
|
|
1110
|
-
{
|
|
1111
|
-
setIsFixed &&
|
|
1112
|
-
typeof setIsFixed === "function" ? (
|
|
1111
|
+
{displayRateSelector ? (
|
|
1113
1112
|
<div className={s["swap-form-rate-selector"]}>
|
|
1114
1113
|
<RateSelector
|
|
1115
|
-
isFixed={
|
|
1116
|
-
setIsFixed={
|
|
1114
|
+
isFixed={isFixedRate}
|
|
1115
|
+
setIsFixed={handleRateModeChanged}
|
|
1117
1116
|
translations={translations.rateSelector}
|
|
1118
1117
|
/>
|
|
1119
1118
|
</div>
|
|
@@ -1170,7 +1169,7 @@ export const SwapForm = ({
|
|
|
1170
1169
|
fullWidthOnMobiles
|
|
1171
1170
|
isDisabled={!readyToSwap}
|
|
1172
1171
|
to={formHasBalance ? "" : confirmButtonTo}
|
|
1173
|
-
loader={formHasBalance
|
|
1172
|
+
loader={formHasBalance}
|
|
1174
1173
|
handleError={callHandlingErrors}
|
|
1175
1174
|
/>
|
|
1176
1175
|
</div>
|
|
@@ -167,13 +167,25 @@ export class SwapspaceSwapProvider extends SwapProvider {
|
|
|
167
167
|
*/
|
|
168
168
|
const code = item.code.toUpperCase();
|
|
169
169
|
const network = item.network.toUpperCase();
|
|
170
|
+
/** Removing ticker and protocol name from coin name as we usually use them explicitly
|
|
171
|
+
* from coin object rather than counting on having it in the coin name itself.
|
|
172
|
+
* This processing is needed due to poor quality of swapspace coins names. */
|
|
173
|
+
let name = (item.name ?? "")
|
|
174
|
+
.replaceAll(`(${code})`, "")
|
|
175
|
+
.replaceAll(`(${network})`, "")
|
|
176
|
+
.replaceAll(/ +/g, " ")
|
|
177
|
+
.trim();
|
|
178
|
+
if (name === "") {
|
|
179
|
+
// Rolling back to original name if our processing leads in empty name
|
|
180
|
+
name = item.name;
|
|
181
|
+
}
|
|
170
182
|
const ticker = `${code}${
|
|
171
183
|
code === network ? "" : network
|
|
172
184
|
}`;
|
|
173
185
|
const defaultDecimalPlacesForCoinNotSupportedOOB = 8;
|
|
174
186
|
const defaultMinConfirmationsForCoinNotSupportedOOB = 1;
|
|
175
187
|
coin = new Coin(
|
|
176
|
-
|
|
188
|
+
name,
|
|
177
189
|
ticker,
|
|
178
190
|
code,
|
|
179
191
|
defaultDecimalPlacesForCoinNotSupportedOOB,
|
|
@@ -192,6 +192,123 @@ describe("swapspaceSwapProvider", function () {
|
|
|
192
192
|
newCoin.doesUseOutputs.should.be.equal(false);
|
|
193
193
|
});
|
|
194
194
|
|
|
195
|
+
describe("Should process name when creating custom coins", function () {
|
|
196
|
+
[
|
|
197
|
+
{
|
|
198
|
+
item: { code: "BTC", network: "BTC", name: " Bitcoin " },
|
|
199
|
+
expectedName: "Bitcoin",
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
item: {
|
|
203
|
+
code: "BTC",
|
|
204
|
+
network: "BTC",
|
|
205
|
+
name: " Bitcoin (BTC) ",
|
|
206
|
+
},
|
|
207
|
+
expectedName: "Bitcoin",
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
item: { code: "BTC", network: "BTC", name: "Bitcoin" },
|
|
211
|
+
expectedName: "Bitcoin",
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
item: { code: "BTC", network: "BTC", name: "BTC" },
|
|
215
|
+
expectedName: "BTC",
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
item: {
|
|
219
|
+
code: "BTC",
|
|
220
|
+
network: "BTC",
|
|
221
|
+
name: "Bitcoin (BTC)",
|
|
222
|
+
},
|
|
223
|
+
expectedName: "Bitcoin",
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
item: {
|
|
227
|
+
code: "BTC",
|
|
228
|
+
network: "BTC",
|
|
229
|
+
name: "Bitcoin (BTC) (BTC)",
|
|
230
|
+
},
|
|
231
|
+
expectedName: "Bitcoin",
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
item: { code: "BTC", network: "BTC", name: "BTC (BTC)" },
|
|
235
|
+
expectedName: "BTC",
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
item: { code: "BTC", network: "BTC", name: "(BTC) (BTC)" },
|
|
239
|
+
expectedName: "(BTC) (BTC)",
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
item: { code: "USDT", network: "ERC20", name: "Tether" },
|
|
243
|
+
expectedName: "Tether",
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
item: { code: "USDT", network: "ERC20", name: "USDT" },
|
|
247
|
+
expectedName: "USDT",
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
item: {
|
|
251
|
+
code: "USDT",
|
|
252
|
+
network: "ERC20",
|
|
253
|
+
name: "Tether (USDT)",
|
|
254
|
+
},
|
|
255
|
+
expectedName: "Tether",
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
item: {
|
|
259
|
+
code: "USDT",
|
|
260
|
+
network: "ERC20",
|
|
261
|
+
name: "Tether (USDT)",
|
|
262
|
+
},
|
|
263
|
+
expectedName: "Tether",
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
item: {
|
|
267
|
+
code: "USDT",
|
|
268
|
+
network: "ERC20",
|
|
269
|
+
name: "Tether (USDT) (ERC20)",
|
|
270
|
+
},
|
|
271
|
+
expectedName: "Tether",
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
item: {
|
|
275
|
+
code: "USDT",
|
|
276
|
+
network: "ERC20",
|
|
277
|
+
name: "USDT (ERC20)",
|
|
278
|
+
},
|
|
279
|
+
expectedName: "USDT",
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
item: {
|
|
283
|
+
code: "USDT",
|
|
284
|
+
network: "ERC20",
|
|
285
|
+
name: "(USDT) (ERC20)",
|
|
286
|
+
},
|
|
287
|
+
expectedName: "(USDT) (ERC20)",
|
|
288
|
+
},
|
|
289
|
+
].forEach((testCase) => {
|
|
290
|
+
it("Should construct coins with default params if _customCoinBuilder return null for some and useRestrictedCoinsSet is false", async () => {
|
|
291
|
+
const someResp = {
|
|
292
|
+
data: [testCase.item],
|
|
293
|
+
};
|
|
294
|
+
axiosGetStub.resetBehavior();
|
|
295
|
+
axiosGetStub.resolves(someResp);
|
|
296
|
+
const p = new SwapspaceSwapProvider(
|
|
297
|
+
"/",
|
|
298
|
+
new Cache(),
|
|
299
|
+
() => null,
|
|
300
|
+
false
|
|
301
|
+
);
|
|
302
|
+
|
|
303
|
+
await p._fetchSupportedCurrenciesIfNeeded();
|
|
304
|
+
|
|
305
|
+
p._supportedCoins[0].coin.latinName.should.be.equal(
|
|
306
|
+
testCase.expectedName
|
|
307
|
+
);
|
|
308
|
+
});
|
|
309
|
+
});
|
|
310
|
+
});
|
|
311
|
+
|
|
195
312
|
it("Should construct coins with null protocol and ticker===<uppercase code> if _customCoinBuilder return null for item and useRestrictedCoinsSet is false and code and network are equal for item", async () => {
|
|
196
313
|
const someResp = {
|
|
197
314
|
data: [
|