UNPKG

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