Skip to content

BigNumber toFixed throws error causing numbers to appear in scientific notation #44

@kelsos

Description

@kelsos

When using the step component on an amount this causes an error and shows scientific notation instead.

TokenInputComponent.html:3 ERROR Error: [BigNumber Error] Argument not a primitive number: 18
    at intCheck (bignumber.js:2789)
    at BigNumber.P.toFixed (bignumber.js:2459)
    at TokenInputComponent.push../src/app/components/token-input/token-input.component.ts.TokenInputComponent.getTokenAmount (token-input.component.ts:216)
    at TokenInputComponent.push../src/app/components/token-input/token-input.component.ts.TokenInputComponent.precise (token-input.component.ts:109)
    at Object.eval [as handleEvent] (TokenInputComponent.html:7)
    at handleEvent (core.js:21673)
    at callWithDebugContext (core.js:22767)
    at Object.debugHandleEvent [as handleEvent] (core.js:22470)
    at dispatchEvent (core.js:19122)
    at core.js:19569

After some investigation it appears that for some reason the _decimals property is a string instead of a number, and this is caused by BatchManager handling all the returned contract values as strings

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions