UNPKG

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