UNPKG

758 BTypeScriptView Raw
1import type { HexString, NumberOptions, ToBn } from '../types.js';
2import type { BN } from './bn.js';
3/**
4 * @name bnToHex
5 * @summary Creates a hex value from a BN.js bignumber object.
6 * @description
7 * `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.
8 * @example
9 * <BR>
10 *
11 * ```javascript
12 * import BN from 'bn.js';
13 * import { bnToHex } from '@polkadot/util';
14 *
15 * bnToHex(new BN(0x123456)); // => '0x123456'
16 * ```
17 */
18export declare function bnToHex<ExtToBn extends ToBn>(value?: ExtToBn | BN | bigint | number | null, { bitLength, isLe, isNegative }?: NumberOptions): HexString;