Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Property 'divmod' does not exist on type 'BN' #300

@tungleanh92

Description

@tungleanh92

export const toUnit = async (balance: any) => {
let curConfig: Config = getConfig();
const api = await setupProviderApi(curConfig);
let decimals = api.registry.chainDecimals;
let base = new BN(10).pow(new BN(decimals));
//I'm using typescript and it return the error at this line
let dm = new BN(balance).divmod(base);
return parseFloat(dm.div.toString() + "." + dm.mod.toString())
}
How can I fix this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions