Files
common/docs/util/modules/_bn_tohex_.md
T
2018-11-28 15:23:14 +00:00

999 B

Functions

bnToHex

▸ bnToHex(value?: * BN | number*, bitLength?: number): string

Defined in bn/toHex.ts:28

name: bnToHex

signature: bnToHex (value?: BN, bitLength: number = -1): string

summary: Creates a hex value from a BN.js bignumber object.

description: null inputs returns a 0x result, BN values return the actual value as a 0x prefixed hex value. Anything that is not a BN object throws an error. With bitLength set, it fixes the number to the specified length.

example:

import BN from 'bn.js';
import { bnToHex } from '@polkadot/util';

bnToHex(new BN(0x123456)); // => '0x123456'

Parameters:

Name Type Default value
Optional value BN | number -
Default value bitLength number -1

Returns: string