Skip to Content

@cfxdevkit/core


@cfxdevkit/core / formatUnits

Function: formatUnits()

formatUnits(value, decimals): string

Defined in: node_modules/.pnpm/viem@2.46.2_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_types/utils/unit/formatUnits.d.ts:14

Divides a number by a given exponent of base 10 (10exponent), and formats it into a string representation of the number..

Parameters

value

bigint

decimals

number

Returns

string

Example

import { formatUnits } from 'viem' formatUnits(420000000000n, 9) // '420'