kernel-swarm-client/dist/index.d.ts

32 lines
1.3 KiB
TypeScript
Raw Normal View History

2022-07-20 06:13:07 +00:00
/// <reference types="node" />
import { Buffer } from "buffer";
2023-02-01 12:55:30 +00:00
import { Client } from "@lumeweb/libkernel-universal";
import { ErrTuple } from "@siaweb/libweb";
2023-02-06 08:26:19 +00:00
import type { EventEmitter } from "eventemitter3";
2023-02-01 12:55:30 +00:00
export declare class SwarmClient extends Client {
private useDefaultSwarm;
2022-08-03 16:29:53 +00:00
private id;
2023-02-01 12:55:30 +00:00
get swarm(): number | undefined;
2022-08-03 16:29:53 +00:00
constructor(useDefaultDht?: boolean);
2023-02-01 12:55:30 +00:00
connect(pubkey: string | Uint8Array): Promise<Socket>;
2023-02-01 13:47:57 +00:00
init(): Promise<ErrTuple>;
2023-02-06 08:26:19 +00:00
ready(): Promise<void>;
2022-07-20 07:27:17 +00:00
addRelay(pubkey: string): Promise<void>;
2022-07-20 22:03:37 +00:00
removeRelay(pubkey: string): Promise<void>;
clearRelays(): Promise<void>;
2022-08-14 11:33:04 +00:00
getRelays(): Promise<string[]>;
2023-02-01 19:08:26 +00:00
join(topic: Buffer): Promise<void>;
2022-07-20 06:13:07 +00:00
}
2023-02-01 12:55:30 +00:00
export declare class Socket extends Client {
2022-07-20 06:13:07 +00:00
private id;
private eventUpdates;
constructor(id: number);
2023-02-06 08:26:19 +00:00
on<T extends EventEmitter.EventNames<string | symbol>>(event: T, fn: EventEmitter.EventListener<string | symbol, T>, context?: any): this;
off<T extends EventEmitter.EventNames<string | symbol>>(event: T, fn?: EventEmitter.EventListener<string | symbol, T>, context?: any, once?: boolean): this;
2022-07-20 06:13:07 +00:00
write(message: string | Buffer): void;
end(): void;
2022-07-20 06:13:07 +00:00
private ensureEvent;
private trackEvent;
}
2023-02-01 12:55:30 +00:00
export declare const createClient: (...args: any) => SwarmClient;
2022-07-20 06:13:07 +00:00
//# sourceMappingURL=index.d.ts.map