1 |
|
2 | import type { BN } from './bn/bn.js';
|
3 |
|
4 | export interface Class<T = any, A extends unknown[] = any[]> {
|
5 | prototype: T;
|
6 | new (...args: A): T;
|
7 | hasOwnProperty(prop: string): boolean;
|
8 | isPrototypeOf(other: unknown): boolean;
|
9 | }
|
10 | export type Constructor<T = any, A extends unknown[] = any[]> = Class<T, A>;
|
11 | export interface ToBigInt {
|
12 | toBigInt: () => bigint;
|
13 | }
|
14 | export interface ToBn {
|
15 | toBn: () => BN;
|
16 | }
|
17 | export interface SiDef {
|
18 | power: number;
|
19 | text: string;
|
20 | value: string;
|
21 | }
|
22 | export interface Logger {
|
23 | debug: (...values: unknown[]) => void;
|
24 | error: (...values: unknown[]) => void;
|
25 | log: (...values: unknown[]) => void;
|
26 | noop: (...values: unknown[]) => void;
|
27 | warn: (...values: unknown[]) => void;
|
28 | }
|
29 | export interface ToBnOptions {
|
30 |
|
31 | isLe?: boolean;
|
32 |
|
33 | isNegative?: boolean;
|
34 | }
|
35 | export interface NumberOptions extends ToBnOptions {
|
36 |
|
37 | bitLength?: number;
|
38 | }
|
39 | export interface Time {
|
40 | days: number;
|
41 | hours: number;
|
42 | minutes: number;
|
43 | seconds: number;
|
44 | milliseconds: number;
|
45 | }
|
46 | export type Memoized<F> = F & {
|
47 | unmemoize: (...args: unknown[]) => void;
|
48 | };
|
49 | export type AnyString = string | String;
|
50 | export type HexDigit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f';
|
51 | export type HexString = `0x${string}`;
|
52 | export interface BufferObject extends Uint8Array {
|
53 | equals: (otherBuffer: Uint8Array) => boolean;
|
54 | readDoubleLE: (offset?: number) => number;
|
55 | }
|
56 | export interface BufferClass extends Class<BufferObject> {
|
57 | from: <T = BufferObject>(value: unknown) => T;
|
58 | isBuffer: (value: unknown) => boolean;
|
59 | }
|
60 | export type U8aLike = number[] | Uint8Array | AnyString;
|
61 | export interface Observable {
|
62 | next: (...params: unknown[]) => unknown;
|
63 | }
|