interface-relay/dist/plugin.d.ts

38 lines
1019 B
TypeScript
Raw Normal View History

2022-12-19 20:09:07 +00:00
import type { EventEmitter2 } from "eventemitter2";
2022-11-26 07:54:14 +00:00
import { RPCMethod, RPCServer } from "./rpc.js";
2022-12-19 20:09:07 +00:00
import { Logger } from "pino";
import SSLManager from "./ssl.js";
import type { HDKey } from "micro-ed25519-hdkey";
2022-12-21 20:19:10 +00:00
import type Config from "@lumeweb/cfg";
2022-12-15 09:47:36 +00:00
export type PluginFunction = (api: PluginAPI) => Promise<void>;
2022-11-26 07:54:14 +00:00
export interface Plugin {
name: string;
plugin: PluginFunction;
exports?: any;
default?: Plugin;
}
2022-12-19 20:13:43 +00:00
export declare class PluginAPI extends EventEmitter2 {
2022-12-19 20:09:07 +00:00
constructor({
config,
logger,
server,
swarm,
}: {
config: Config;
logger: Logger;
server: RPCServer;
swarm: any;
});
get swarm(): any;
get config(): Config;
2022-12-21 20:19:10 +00:00
get pluginConfig(): Config;
2022-12-19 20:09:07 +00:00
get logger(): Logger;
get rpcServer(): RPCServer;
get seed(): Uint8Array;
get identity(): HDKey;
get ssl(): SSLManager;
loadPlugin(moduleName: string): (moduleName: string) => Promise<Plugin>;
registerMethod(methodName: string, method: RPCMethod): void;
2022-11-26 07:54:14 +00:00
}
//# sourceMappingURL=plugin.d.ts.map