UNPKG

645 BTypeScriptView Raw
1import type { ToBigInt, ToBn } from '../types.js';
2import { BN } from './bn.js';
3/**
4 * @name bnToBn
5 * @summary Creates a BN value from a BN, bigint, string (base 10 or hex) or number input.
6 * @description
7 * `null` inputs returns a `0x0` result, BN values returns the value, numbers returns a BN representation.
8 * @example
9 * <BR>
10 *
11 * ```javascript
12 * import BN from 'bn.js';
13 * import { bnToBn } from '@polkadot/util';
14 *
15 * bnToBn(0x1234); // => BN(0x1234)
16 * bnToBn(new BN(0x1234)); // => BN(0x1234)
17 * ```
18 */
19export declare function bnToBn<ExtToBn extends ToBigInt | ToBn>(value?: ExtToBn | BN | bigint | string | number | null): BN;