toTokens

Converts a given number of units to a string representation with a specified number of decimal places.

Example

import { toTokens } from "thirdweb/utils";
toTokens(1000000000000000000n, 18);
// '1'
function toTokens(units: bigint, decimals: number): string;

Parameters

The number of units to convert.

Type

let units: bigint;

The number of decimal places to include in the string representation.

Type

let decimals: number;

Returns

let returnType: string;

The string representation of the converted units.