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

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