This repository has been archived on 2022-09-29. You can view files and clone it, but cannot push or open issues or pull requests.
relay-plugin-core/src/index.ts

27 lines
574 B
TypeScript
Raw Permalink Normal View History

2022-08-29 03:59:15 +00:00
import type { Plugin, PluginAPI, RPCResponse } from "@lumeweb/relay-types";
2022-08-27 02:43:23 +00:00
const plugin: Plugin = {
2022-08-28 17:09:47 +00:00
name: "core",
async plugin(api: PluginAPI): Promise<void> {
api.registerMethod("ping", {
cacheable: false,
async handler(): Promise<RPCResponse | null> {
return {
data: "pong",
};
},
});
2022-08-27 02:43:23 +00:00
2022-08-28 17:09:47 +00:00
api.registerMethod("get_methods", {
cacheable: false,
async handler(): Promise<RPCResponse | null> {
return {
data: api.getMethods(),
};
},
});
},
};
2022-08-27 02:43:23 +00:00
export default plugin;