name: UInt

description: A generic number 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

BN

↳ UInt

↳ U32

↳ U128

↳ U16

↳ U64

↳ U8

↳ U256

Implements

Constructors

constructor

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

Overrides BN.__constructor

Defined in codec/UInt.ts:27

Parameters:

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

Returns: UInt


Accessors

encodedLength

getencodedLength(): number

Defined in codec/UInt.ts:57

description: The length of the value when encoded as a Uint8Array

Returns: number


Methods

bitLength

▸ bitLength(): UIntBitLength

Overrides BN.bitLength

Defined in codec/UInt.ts:64

description: Returns the number of bits in the value

Returns: UIntBitLength


toBn

▸ toBn(): BN

Defined in codec/UInt.ts:71

description: Returns the BN representation of the number. (Compatibility)

Returns: BN


toHex

▸ toHex(): string

Implementation of Codec.toHex

Defined in codec/UInt.ts:78

description: Returns a hex string representation of the value

Returns: string


toJSON

▸ toJSON(): any

Implementation of Codec.toJSON

Overrides BN.toJSON

Defined in codec/UInt.ts:85

description: Converts the Object to JSON, typically used for RPC transfers

Returns: any


toString

▸ toString(base?: undefined | number): string

Overrides BN.toString

Defined in codec/UInt.ts:95

description: Returns the string representation of the value

Parameters:

Name Type Description
Optional base undefined | number The base to use for the conversion

Returns: string


toU8a

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

Implementation of Codec.toU8a

Defined in codec/UInt.ts:104

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


<Static> decodeUInt

▸ decodeUInt(value: AnyNumber, bitLength: UIntBitLength): string

Defined in codec/UInt.ts:38

Parameters:

Name Type
value AnyNumber
bitLength UIntBitLength

Returns: string


results matching ""

    No results matching ""