name: Int

description: A generic signed integer codec. For Substrate all numbers are LE encoded, this handles the encoding and decoding of those numbers. Upon construction the bitLength is provided and any additional use keeps the number to this length. This extends BN, so all methods available on a normal BN object is available here.

Hierarchy

AbstractInt

↳ Int

↳ I8

↳ I16

↳ I32

↳ I64

↳ I128

↳ I256

Implements

Constructors

constructor

⊕ new Int(value?: AnyNumber, bitLength?: UIntBitLength, isHexJson?: boolean): Int

Overrides AbstractInt.__constructor

Defined in codec/Int.ts:21

Parameters:

Name Type Default value
Default value value AnyNumber 0
Default value bitLength UIntBitLength DEFAULT_UINT_BITS
Default value isHexJson boolean true

Returns: Int


Methods

toHex

▸ toHex(): string

Implementation of Codec.toHex

Overrides AbstractInt.toHex

Defined in codec/Int.ts:36

description: Returns a hex string representation of the value

Returns: string


toU8a

▸ toU8a(isBare?: undefined | false | true): Uint8Array

Implementation of Codec.toU8a

Overrides AbstractInt.toU8a

Defined in codec/Int.ts:48

description: Encodes the value as a Uint8Array as per the parity-codec specifications

Parameters:

Name Type Description
Optional isBare undefined | false | true true when the value has none of the type-specific prefixes (internal)

Returns: Uint8Array


Last Updated: 2/25/2019, 4:39:16 PM