Skip to content

Commit

Permalink
Revert "fix: cherry-pick PermitSimulationValueDisplay code"
Browse files Browse the repository at this point in the history
This reverts commit 4f8e366.
  • Loading branch information
digiwand committed Sep 18, 2024
1 parent 4f8e366 commit 99cfb20
Showing 1 changed file with 18 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useMemo } from 'react';
import { NameType } from '@metamask/name-controller';
import { Hex } from '@metamask/utils';
import { captureException } from '@sentry/browser';
import { getTokenStandardAndDetails } from '../../../../../../../../store/actions';
import { shortenString } from '../../../../../../../../helpers/utils/util';

import { calcTokenAmount } from '../../../../../../../../../shared/lib/transactions-controller-utils';
Expand All @@ -27,23 +27,30 @@ import {
TextAlign,
} from '../../../../../../../../helpers/constants/design-system';
import Name from '../../../../../../../../components/app/name/name';
import { fetchErc20Decimals } from '../../../../../../utils/token';

const getTokenDecimals = async (tokenContract: string) => {
const tokenDetails = await getTokenStandardAndDetails(tokenContract);
const tokenDecimals = tokenDetails?.decimals;
type PermitSimulationValueDisplayParams = {
/** The primaryType of the typed sign message */
primaryType?: string;

return parseInt(tokenDecimals ?? '0', 10);
};
/**
* The ethereum token contract address. It is expected to be in hex format.
* We currently accept strings since we have a patch that accepts a custom string
* {@see .yarn/patches/@metamask-eth-json-rpc-middleware-npm-14.0.1-b6c2ccbe8c.patch}
*/
tokenContract: Hex | string;

const PermitSimulationValueDisplay: React.FC<{
primaryType?: string;
tokenContract: string;
/** The token amount */
value: number | string;
}> = ({ primaryType, tokenContract, value }) => {
};

const PermitSimulationValueDisplay: React.FC<
PermitSimulationValueDisplayParams
> = ({ primaryType, tokenContract, value }) => {
const exchangeRate = useTokenExchangeRate(tokenContract);

const { value: tokenDecimals } = useAsyncResult(
async () => await getTokenDecimals(tokenContract),
async () => await fetchErc20Decimals(tokenContract),
[tokenContract],
);

Expand Down

0 comments on commit 99cfb20

Please sign in to comment.