relay/src/modules/plugins/core.ts

24 lines
529 B
TypeScript

import { Plugin, PluginAPI } from "@lumeweb/relay-types";
import { getRpcServer } from "../rpc/server";
const plugin: Plugin = {
name: "core",
async plugin(api: PluginAPI): Promise<void> {
api.registerMethod("ping", {
cacheable: false,
async handler(): Promise<any> {
return "pong";
},
});
api.registerMethod("get_methods", {
cacheable: false,
async handler(): Promise<any> {
return api.getRpcServer().getMethods();
},
});
},
};
export default plugin;