UNPKG

836 BTypeScriptView Raw
1/// <reference types="bn.js" />
2import type { ToBnOptions } from '../types.js';
3import { BN } from '../bn/bn.js';
4/**
5 * @name hexToBn
6 * @summary Creates a BN.js object from a hex string.
7 * @description
8 * `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.
9 * @param _value The value to convert
10 * @param _options Options to pass while converting
11 * @param _options.isLe Convert using Little Endian
12 * @param _options.isNegative Convert using two's complement
13 * @example
14 * <BR>
15 *
16 * ```javascript
17 * import { hexToBn } from '@polkadot/util';
18 *
19 * hexToBn('0x123480001f'); // => BN(0x123480001f)
20 * ```
21 */
22export declare function hexToBn(value?: string | null, { isLe, isNegative }?: ToBnOptions): BN;