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-04-08 20:11:39 +00:00
|
|
|
import type { eventNS, event, ListenerFn, OnOptions, Listener } from "eventemitter2";
|
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-17 02:48:11 +00:00
|
|
|
private _autoReconnect;
|
|
|
|
private _connectBackoff;
|
|
|
|
private _ready?;
|
2023-03-19 18:03:38 +00:00
|
|
|
private _connectionListener?;
|
2023-02-18 00:36:14 +00:00
|
|
|
private _topics;
|
2023-03-19 14:48:28 +00:00
|
|
|
private _sockets;
|
2023-03-18 17:55:47 +00:00
|
|
|
get dht(): {
|
|
|
|
ready(): Promise<void>;
|
|
|
|
};
|
2023-02-17 02:48:11 +00:00
|
|
|
constructor(useDefaultDht?: boolean, autoReconnect?: boolean);
|
2023-02-06 10:25:32 +00:00
|
|
|
get swarm(): number | undefined;
|
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>;
|
2023-02-17 02:48:11 +00:00
|
|
|
start(): Promise<void>;
|
2023-02-17 13:50:06 +00:00
|
|
|
private _listen;
|
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-18 01:05:07 +00:00
|
|
|
join(topic: Buffer | Uint8Array | string): 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;
|
2023-04-05 07:54:36 +00:00
|
|
|
private syncMutex;
|
2023-04-06 13:57:29 +00:00
|
|
|
private swarm;
|
2023-04-06 14:17:33 +00:00
|
|
|
private userData?;
|
2023-04-06 13:57:29 +00:00
|
|
|
constructor(id: number, swarm: SwarmClient);
|
2023-02-06 10:25:32 +00:00
|
|
|
private _remotePublicKey?;
|
|
|
|
get remotePublicKey(): Uint8Array;
|
|
|
|
private _rawStream?;
|
|
|
|
get rawStream(): Uint8Array;
|
|
|
|
setup(): Promise<void>;
|
2023-04-08 20:11:39 +00:00
|
|
|
on(event: event | eventNS, listener: ListenerFn, options?: boolean | OnOptions): this | Listener;
|
|
|
|
off(event: event | eventNS, listener: ListenerFn): this;
|
2022-07-20 06:13:07 +00:00
|
|
|
write(message: string | Buffer): void;
|
2022-09-01 00:38:27 +00:00
|
|
|
end(): void;
|
2022-07-20 06:13:07 +00:00
|
|
|
private ensureEvent;
|
|
|
|
private trackEvent;
|
|
|
|
}
|
2023-04-07 17:20:36 +00:00
|
|
|
export declare const MODULE = "_AVKgzVYC8Sb_qiTA6kw5BDzQ4Ch-8D4sldQJl8dXF9oTw";
|
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
|