mirror of
https://github.com/pezkuwichain/pezkuwi-common.git
synced 2026-04-22 04:27:59 +00:00
18 lines
701 B
TypeScript
18 lines
701 B
TypeScript
import type { NumberOptions, ToBn } from '../types.js';
|
|
import type { BN } from './bn.js';
|
|
/**
|
|
* @name bnToU8a
|
|
* @summary Creates a Uint8Array object from a BN.
|
|
* @description
|
|
* `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.
|
|
* @example
|
|
* <BR>
|
|
*
|
|
* ```javascript
|
|
* import { bnToU8a } from '@pezkuwi/util';
|
|
*
|
|
* bnToU8a(new BN(0x1234)); // => [0x12, 0x34]
|
|
* ```
|
|
*/
|
|
export declare function bnToU8a<ExtToBn extends ToBn>(value?: ExtToBn | BN | bigint | number | null, { bitLength, isLe, isNegative }?: NumberOptions): Uint8Array;
|