Commit 54267a02 authored by tom goriunov's avatar tom goriunov Committed by GitHub

Contract method output: remove the tooltip with the value divided by 10**18 (#2886)

Fixes #2873
parent 85d4b287
import BigNumber from 'bignumber.js';
import React from 'react'; import React from 'react';
import type { AbiParameter } from 'viem'; import type { AbiParameter } from 'viem';
import { route } from 'nextjs-routes'; import { route } from 'nextjs-routes';
import { Link } from 'toolkit/chakra/link'; import { Link } from 'toolkit/chakra/link';
import { Tooltip } from 'toolkit/chakra/tooltip';
import { WEI } from 'toolkit/utils/consts';
import CopyToClipboard from 'ui/shared/CopyToClipboard'; import CopyToClipboard from 'ui/shared/CopyToClipboard';
import { matchInt } from '../utils';
import ItemLabel from './ItemLabel'; import ItemLabel from './ItemLabel';
import { printRowOffset } from './utils'; import { printRowOffset } from './utils';
...@@ -29,8 +25,6 @@ function castValueToString(value: unknown): string { ...@@ -29,8 +25,6 @@ function castValueToString(value: unknown): string {
} }
} }
const INT_TOOLTIP_THRESHOLD = 10 ** 9;
interface Props { interface Props {
abiParameter: AbiParameter; abiParameter: AbiParameter;
data: unknown; data: unknown;
...@@ -50,16 +44,6 @@ const ItemPrimitive = ({ abiParameter, data, level, hideLabel }: Props) => { ...@@ -50,16 +44,6 @@ const ItemPrimitive = ({ abiParameter, data, level, hideLabel }: Props) => {
); );
} }
const intMatch = matchInt(abiParameter.type);
if (intMatch && typeof data === 'bigint' && intMatch.max > INT_TOOLTIP_THRESHOLD && data > INT_TOOLTIP_THRESHOLD) {
const dividedValue = BigNumber(data.toString()).div(WEI);
return (
<Tooltip content={ dividedValue.toLocaleString() + ' ETH' }>
<span>{ castValueToString(data) }</span>
</Tooltip>
);
}
return <span>{ castValueToString(data) }</span>; return <span>{ castValueToString(data) }</span>;
})(); })();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment