UNPKG

702 BTypeScriptView Raw
1import type { NumberOptions, ToBn } from '../types.js';
2import type { BN } from './bn.js';
3/**
4 * @name bnToU8a
5 * @summary Creates a Uint8Array object from a BN.
6 * @description
7 * `null`/`undefined`/`NaN` inputs returns an empty `Uint8Array` result. `BN` input values return the actual bytes value converted to a `Uint8Array`. Optionally convert using little-endian format if `isLE` is set.
8 * @example
9 * <BR>
10 *
11 * ```javascript
12 * import { bnToU8a } from '@polkadot/util';
13 *
14 * bnToU8a(new BN(0x1234)); // => [0x12, 0x34]
15 * ```
16 */
17export declare function bnToU8a<ExtToBn extends ToBn>(value?: ExtToBn | BN | bigint | number | null, { bitLength, isLe, isNegative }?: NumberOptions): Uint8Array;