1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Fix token balance precision on confirm token approval page from soon-to-be-deprecated token allowance flow (#16934)

* ConfirmToken: fix token balance onboarding v1
this UI/UX should be deprecated following PR#16740, maybe v10.25

* TokenApproval: use precision for token balance

* EditApproval: calc utilizing existing util
This commit is contained in:
Ariella Vu 2022-12-16 22:20:05 +07:00 committed by seaona
parent 60bfdf51d6
commit e0644a64f6

View File

@ -6,7 +6,10 @@ import BigNumber from 'bignumber.js';
import Modal from '../../modal';
import Identicon from '../../../ui/identicon';
import TextField from '../../../ui/text-field';
import { calcTokenAmount } from '../../../../../shared/lib/transactions-controller-utils';
import {
calcTokenAmount,
toPrecisionWithoutTrailingZeros,
} from '../../../../../shared/lib/transactions-controller-utils';
const MAX_UNSIGNED_256_INT = new BigNumber(2).pow(256).minus(1).toString(10);
@ -70,7 +73,10 @@ export default class EditApprovalPermission extends PureComponent {
</div>
</div>
<div className="edit-approval-permission__account-info__balance">
{`${Number(tokenBalance).toPrecision(9)} ${tokenSymbol}`}
{`${toPrecisionWithoutTrailingZeros(
tokenBalance,
9,
)} ${tokenSymbol}`}
</div>
</div>
<div className="edit-approval-permission__edit-section">