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

29 lines
701 B
TypeScript

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