kernel-handshake-client/src/index.ts

26 lines
660 B
TypeScript
Raw Normal View History

2023-07-05 17:08:38 +00:00
import { Client, factory } from "@lumeweb/libkernel/module";
2023-02-19 19:42:15 +00:00
2023-07-22 00:55:13 +00:00
export const MODULE = "zduGANW6wKgvQkA7VnmZS6RsiNZYsTy72VfgbQYHHQGXFEwTaoJN47do51";
2023-02-19 19:42:15 +00:00
export interface Response {
id?: number;
error?: string;
result: any;
}
export class HandshakeClient extends Client {
public async ready(): Promise<void> {
return this.callModuleReturn("ready");
}
public async query(method: string, params: any): Promise<Response> {
return this.callModuleReturn("query", { method, params });
}
2023-07-19 16:29:30 +00:00
public async register(){
return this.callModuleReturn("register");
}
2023-02-19 19:42:15 +00:00
}
export const createClient = factory<HandshakeClient>(HandshakeClient, MODULE);