1 | /// <reference types="bn.js" />
|
2 | import type { NumberOptions, ToBn } from '../types';
|
3 | import type { BN } from './bn';
|
4 | /**
|
5 | * @name bnToU8a
|
6 | * @summary Creates a Uint8Array object from a BN.
|
7 | * @description
|
8 | * `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.
|
9 | * @example
|
10 | * <BR>
|
11 | *
|
12 | * ```javascript
|
13 | * import { bnToU8a } from '@polkadot/util';
|
14 | *
|
15 | * bnToU8a(new BN(0x1234)); // => [0x12, 0x34]
|
16 | * ```
|
17 | */
|
18 | declare function bnToU8a<ExtToBn extends ToBn>(value?: ExtToBn | BN | bigint | number | null, options?: NumberOptions): Uint8Array;
|
19 | /** @deprecated Use bnToU8a(value?: ExtToBn | BN | bigint | number | null, options?: NumberOptions) */
|
20 | declare function bnToU8a<ExtToBn extends ToBn>(value?: ExtToBn | BN | bigint | number | null, bitLength?: number, isLe?: boolean): Uint8Array;
|
21 | export { bnToU8a };
|