UNPKG

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