PHP WebShell
Текущая директория: /usr/lib/node_modules/bitgo/node_modules/viem/utils/unit
Просмотр файла: formatEther.ts
import { etherUnits } from '../../constants/unit.js'
import { type FormatUnitsErrorType, formatUnits } from './formatUnits.js'
export type FormatEtherErrorType = FormatUnitsErrorType
/**
* Converts numerical wei to a string representation of ether.
*
* - Docs: https://viem.sh/docs/utilities/formatEther
*
* @example
* import { formatEther } from 'viem'
*
* formatEther(1000000000000000000n)
* // '1'
*/
export function formatEther(wei: bigint, unit: 'wei' | 'gwei' = 'wei') {
return formatUnits(wei, etherUnits[unit])
}
Выполнить команду
Для локальной разработки. Не используйте в интернете!