UNPKG

804 BTypeScriptView Raw
1import type { ToBnOptions } from '../types.js';
2import { BN } from '../bn/bn.js';
3/**
4 * @name hexToBn
5 * @summary Creates a BN.js object from a hex string.
6 * @description
7 * `null` inputs returns a `BN(0)` result. Hex input values return the actual value converted to a BN. Anything that is not a hex string (including the `0x` prefix) throws an error.
8 * @param _value The value to convert
9 * @param _options Options to pass while converting
10 * @param _options.isLe Convert using Little Endian
11 * @param _options.isNegative Convert using two's complement
12 * @example
13 * <BR>
14 *
15 * ```javascript
16 * import { hexToBn } from '@polkadot/util';
17 *
18 * hexToBn('0x123480001f'); // => BN(0x123480001f)
19 * ```
20 */
21export declare function hexToBn(value?: string | null, { isLe, isNegative }?: ToBnOptions): BN;