@ckb-lumos/bi
Version:
Bigint support in lumos
41 lines • 1.32 kB
TypeScript
import JSBI from "jsbi";
export type BIish = number | string | bigint | BI;
export declare function isBIish(value: unknown): value is BIish;
export declare class BI {
private readonly jsbi;
readonly _isBI: boolean;
constructor(value: JSBI);
add(other: BIish): BI;
sub(other: BIish): BI;
div(other: BIish): BI;
mul(other: BIish): BI;
mod(other: BIish): BI;
abs(): BI;
pow(other: BIish): BI;
and(other: BIish): BI;
or(other: BIish): BI;
xor(other: BIish): BI;
not(): BI;
mask(other: BIish): BI;
shl(other: BIish): BI;
shr(other: BIish): BI;
eq(other: BIish): boolean;
lt(other: BIish): boolean;
lte(other: BIish): boolean;
gt(other: BIish): boolean;
gte(other: BIish): boolean;
isNegative(): boolean;
isZero(): boolean;
toNumber(): number;
toBigInt(): bigint;
toString(radix?: number): string;
toHexString(): string;
static from(value: unknown): BI;
static isBI(value: unknown): value is BI;
}
export declare function toJSBI(value: BIish): JSBI;
export type Unit = "shannon" | "ckb" | number;
export declare const ckbDecimals = 8;
export declare function formatUnit(value: BIish, unit: Unit): string;
export declare function parseUnit(value: string, unit: Unit): BI;
//# sourceMappingURL=index.d.ts.map