@ethersproject/bignumber

  • Version 5.7.0
  • Published
  • 143 kB
  • 3 dependencies
  • MIT license

Install

npm i @ethersproject/bignumber
yarn add @ethersproject/bignumber
pnpm add @ethersproject/bignumber

Overview

BigNumber library used in ethers.js.

Index

Functions

function formatFixed

formatFixed: (value: BigNumberish, decimals?: string | BigNumberish) => string;

    function parseFixed

    parseFixed: (value: string, decimals?: BigNumberish) => BigNumber;

      Classes

      class BigNumber

      class BigNumber implements Hexable {}

        constructor

        constructor(constructorGuard: any, hex: string);

          method abs

          abs: () => BigNumber;

            method add

            add: (other: BigNumberish) => BigNumber;

              method and

              and: (other: BigNumberish) => BigNumber;

                method div

                div: (other: BigNumberish) => BigNumber;

                  method eq

                  eq: (other: BigNumberish) => boolean;

                    method from

                    static from: (value: any) => BigNumber;

                      method fromTwos

                      fromTwos: (value: number) => BigNumber;

                        method gt

                        gt: (other: BigNumberish) => boolean;

                          method gte

                          gte: (other: BigNumberish) => boolean;

                            method isBigNumber

                            static isBigNumber: (value: any) => value is BigNumber;

                              method isNegative

                              isNegative: () => boolean;

                                method isZero

                                isZero: () => boolean;

                                  method lt

                                  lt: (other: BigNumberish) => boolean;

                                    method lte

                                    lte: (other: BigNumberish) => boolean;

                                      method mask

                                      mask: (value: number) => BigNumber;

                                        method mod

                                        mod: (other: BigNumberish) => BigNumber;

                                          method mul

                                          mul: (other: BigNumberish) => BigNumber;

                                            method or

                                            or: (other: BigNumberish) => BigNumber;

                                              method pow

                                              pow: (other: BigNumberish) => BigNumber;

                                                method shl

                                                shl: (value: number) => BigNumber;

                                                  method shr

                                                  shr: (value: number) => BigNumber;

                                                    method sub

                                                    sub: (other: BigNumberish) => BigNumber;

                                                      method toBigInt

                                                      toBigInt: () => bigint;

                                                        method toHexString

                                                        toHexString: () => string;

                                                          method toJSON

                                                          toJSON: (key?: string) => any;

                                                            method toNumber

                                                            toNumber: () => number;

                                                              method toString

                                                              toString: () => string;

                                                                method toTwos

                                                                toTwos: (value: number) => BigNumber;

                                                                  method xor

                                                                  xor: (other: BigNumberish) => BigNumber;

                                                                    class FixedFormat

                                                                    class FixedFormat {}

                                                                      constructor

                                                                      constructor(
                                                                      constructorGuard: any,
                                                                      signed: boolean,
                                                                      width: number,
                                                                      decimals: number
                                                                      );

                                                                        property decimals

                                                                        readonly decimals: number;

                                                                          property name

                                                                          readonly name: string;

                                                                            property signed

                                                                            readonly signed: boolean;

                                                                              property width

                                                                              readonly width: number;

                                                                                method from

                                                                                static from: (value: any) => FixedFormat;

                                                                                  class FixedNumber

                                                                                  class FixedNumber {}

                                                                                    constructor

                                                                                    constructor(
                                                                                    constructorGuard: any,
                                                                                    hex: string,
                                                                                    value: string,
                                                                                    format?: FixedFormat
                                                                                    );

                                                                                      property format

                                                                                      readonly format: FixedFormat;

                                                                                        method addUnsafe

                                                                                        addUnsafe: (other: FixedNumber) => FixedNumber;

                                                                                          method ceiling

                                                                                          ceiling: () => FixedNumber;

                                                                                            method divUnsafe

                                                                                            divUnsafe: (other: FixedNumber) => FixedNumber;

                                                                                              method floor

                                                                                              floor: () => FixedNumber;

                                                                                                method from

                                                                                                static from: (value: any, format?: FixedFormat | string | number) => FixedNumber;

                                                                                                  method fromBytes

                                                                                                  static fromBytes: (
                                                                                                  value: BytesLike,
                                                                                                  format?: FixedFormat | string | number
                                                                                                  ) => FixedNumber;

                                                                                                    method fromString

                                                                                                    static fromString: (
                                                                                                    value: string,
                                                                                                    format?: FixedFormat | string | number
                                                                                                    ) => FixedNumber;

                                                                                                      method fromValue

                                                                                                      static fromValue: (
                                                                                                      value: BigNumber,
                                                                                                      decimals?: BigNumberish,
                                                                                                      format?: FixedFormat | string | number
                                                                                                      ) => FixedNumber;

                                                                                                        method isFixedNumber

                                                                                                        static isFixedNumber: (value: any) => value is FixedNumber;

                                                                                                          method isNegative

                                                                                                          isNegative: () => boolean;

                                                                                                            method isZero

                                                                                                            isZero: () => boolean;

                                                                                                              method mulUnsafe

                                                                                                              mulUnsafe: (other: FixedNumber) => FixedNumber;

                                                                                                                method round

                                                                                                                round: (decimals?: number) => FixedNumber;

                                                                                                                  method subUnsafe

                                                                                                                  subUnsafe: (other: FixedNumber) => FixedNumber;

                                                                                                                    method toFormat

                                                                                                                    toFormat: (format: FixedFormat | string) => FixedNumber;

                                                                                                                      method toHexString

                                                                                                                      toHexString: (width?: number) => string;

                                                                                                                        method toString

                                                                                                                        toString: () => string;

                                                                                                                          method toUnsafeFloat

                                                                                                                          toUnsafeFloat: () => number;

                                                                                                                            Type Aliases

                                                                                                                            type BigNumberish

                                                                                                                            type BigNumberish = BigNumber | Bytes | bigint | string | number;

                                                                                                                              Namespaces

                                                                                                                              namespace bn.js

                                                                                                                              module 'bn.js' {}

                                                                                                                                class BN

                                                                                                                                class BN {}

                                                                                                                                  constructor

                                                                                                                                  constructor(value: string | number, radix?: number);

                                                                                                                                    method add

                                                                                                                                    add: (other: BN) => BN;

                                                                                                                                      method and

                                                                                                                                      and: (other: BN) => BN;

                                                                                                                                        method div

                                                                                                                                        div: (other: BN) => BN;

                                                                                                                                          method encode

                                                                                                                                          encode: (encoding: string, compact: boolean) => Uint8Array;

                                                                                                                                            method eq

                                                                                                                                            eq: (other: BN) => boolean;

                                                                                                                                              method fromTwos

                                                                                                                                              fromTwos: (other: number) => BN;

                                                                                                                                                method gt

                                                                                                                                                gt: (other: BN) => boolean;

                                                                                                                                                  method gte

                                                                                                                                                  gte: (other: BN) => boolean;

                                                                                                                                                    method isNeg

                                                                                                                                                    isNeg: () => boolean;

                                                                                                                                                      method isZero

                                                                                                                                                      isZero: () => boolean;

                                                                                                                                                        method lt

                                                                                                                                                        lt: (other: BN) => boolean;

                                                                                                                                                          method lte

                                                                                                                                                          lte: (other: BN) => boolean;

                                                                                                                                                            method maskn

                                                                                                                                                            maskn: (other: number) => BN;

                                                                                                                                                              method mod

                                                                                                                                                              mod: (other: BN) => BN;

                                                                                                                                                                method mul

                                                                                                                                                                mul: (other: BN) => BN;

                                                                                                                                                                  method or

                                                                                                                                                                  or: (other: BN) => BN;

                                                                                                                                                                    method pow

                                                                                                                                                                    pow: (other: BN) => BN;

                                                                                                                                                                      method shln

                                                                                                                                                                      shln: (other: number) => BN;

                                                                                                                                                                        method shrn

                                                                                                                                                                        shrn: (other: number) => BN;

                                                                                                                                                                          method sub

                                                                                                                                                                          sub: (other: BN) => BN;

                                                                                                                                                                            method toArray

                                                                                                                                                                            toArray: (endian: string, width: number) => Uint8Array;

                                                                                                                                                                              method toNumber

                                                                                                                                                                              toNumber: () => number;

                                                                                                                                                                                method toString

                                                                                                                                                                                toString: (radix: number) => string;

                                                                                                                                                                                  method toTwos

                                                                                                                                                                                  toTwos: (other: number) => BN;

                                                                                                                                                                                    method umod

                                                                                                                                                                                    umod: (other: BN) => BN;

                                                                                                                                                                                      method xor

                                                                                                                                                                                      xor: (other: BN) => BN;

                                                                                                                                                                                        Package Files (4)

                                                                                                                                                                                        Dependencies (3)

                                                                                                                                                                                        Dev Dependencies (0)

                                                                                                                                                                                        No dev dependencies.

                                                                                                                                                                                        Peer Dependencies (0)

                                                                                                                                                                                        No peer dependencies.

                                                                                                                                                                                        Badge

                                                                                                                                                                                        To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                                        You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@ethersproject/bignumber.

                                                                                                                                                                                        • Markdown
                                                                                                                                                                                          [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@ethersproject/bignumber)
                                                                                                                                                                                        • HTML
                                                                                                                                                                                          <a href="https://www.jsdocs.io/package/@ethersproject/bignumber"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>