From 2212e77b51077bfe594f0e7476fed698a4089e92 Mon Sep 17 00:00:00 2001 From: Samy RABAH-MONTAROU Date: Wed, 4 Sep 2024 21:37:57 +0200 Subject: [PATCH] mul by magnitude beforehand --- .../e2e/specs/delegate/cosmos.spec.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/ledger-live-mobile/e2e/specs/delegate/cosmos.spec.ts b/apps/ledger-live-mobile/e2e/specs/delegate/cosmos.spec.ts index c703bb1f4ff3..580737c62feb 100644 --- a/apps/ledger-live-mobile/e2e/specs/delegate/cosmos.spec.ts +++ b/apps/ledger-live-mobile/e2e/specs/delegate/cosmos.spec.ts @@ -8,6 +8,7 @@ import { } from "../../models/currencies"; import { Application } from "../../page"; import DeviceAction from "../../models/DeviceAction"; +import BigNumber from "bignumber.js"; let app: Application; let deviceAction: DeviceAction; @@ -36,8 +37,15 @@ describe("Cosmos delegate flow", () => { const delegatedPercent = 50; const unit = getAccountUnit(testAccount); + const multiplier = new BigNumber(10).pow(unit.magnitude); const usableAmount = testAccount.spendableBalance.minus(COSMOS_MIN_SAFE).minus(COSMOS_MIN_FEES); - const delegatedAmount = usableAmount.multipliedBy(delegatedPercent).div(100).integerValue(); + // const delegatedAmount = usableAmount.multipliedBy(delegatedPercent).div(100).integerValue(); + const delegatedAmount = usableAmount + .multipliedBy(multiplier) + .multipliedBy(delegatedPercent) + .div(100) + .div(multiplier) + .integerValue(); const remainingAmount = usableAmount.minus(delegatedAmount); await app.stake.selectCurrency(testedCurrency);