How to use the @ethersproject/bignumber.parseFixed function in @ethersproject/bignumber

To help you get started, we’ve selected a few @ethersproject/bignumber examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ethers-io / ethers.js / packages / units / src.ts / index.ts View on Github external
export function parseUnits(value: string, unitName?: BigNumberish): BigNumber {
    if (typeof(unitName) === "string") {
        const index = names.indexOf(unitName);
        if (index !== -1) { unitName = 3 * index; }
    }
    return parseFixed(value, (unitName != null) ? unitName: 18);
}
github ethers-io / ethers.js / packages / units / lib.esm / index.js View on Github external
export function parseUnits(value, unitName) {
    if (typeof (unitName) === "string") {
        const index = names.indexOf(unitName);
        if (index !== -1) {
            unitName = 3 * index;
        }
    }
    return parseFixed(value, (unitName != null) ? unitName : 18);
}
export function formatEther(wei) {