UNPKG

748 BTypeScriptView Raw
1import type { ToBnOptions } from '../types.js';
2import { BN } from '../bn/bn.js';
3/**
4 * @name u8aToBn
5 * @summary Creates a BN from a Uint8Array object.
6 * @description
7 * `UInt8Array` input values return the actual BN. `null` or `undefined` values returns an `0x0` value.
8 * @param value The value to convert
9 * @param options Options to pass while converting
10 * @param options.isLe Convert using Little Endian (default)
11 * @param options.isNegative Convert using two's complement
12 * @example
13 * <BR>
14 *
15 * ```javascript
16 * import { u8aToBn } from '@polkadot/util';
17 *
18 * u8aToHex(new Uint8Array([0x68, 0x65, 0x6c, 0x6c, 0xf])); // 0x68656c0f
19 * ```
20 */
21export declare function u8aToBn(value: Uint8Array, { isLe, isNegative }?: ToBnOptions): BN;