*Use shorthand function
This commit is contained in:
parent
187e2f8fdf
commit
e7aedc9950
29
src/index.ts
29
src/index.ts
|
@ -1,28 +1,27 @@
|
||||||
import type {Plugin, PluginAPI} from "@lumeweb/relay";
|
import type { Plugin, PluginAPI } from "@lumeweb/relay";
|
||||||
import {RPCResponse} from "@lumeweb/relay";
|
import { RPCResponse } from "@lumeweb/relay";
|
||||||
|
|
||||||
const plugin: Plugin = {
|
const plugin: Plugin = {
|
||||||
name: "core",
|
name: "core",
|
||||||
async plugin(api: PluginAPI): Promise<void> {
|
async plugin(api: PluginAPI): Promise<void> {
|
||||||
api.registerMethod("ping", {
|
api.registerMethod("ping", {
|
||||||
cacheable: false,
|
cacheable: false,
|
||||||
handler: async (): Promise<RPCResponse | null> => {
|
async handler(): Promise<RPCResponse | null> {
|
||||||
return {
|
return {
|
||||||
data: "pong"
|
data: "pong",
|
||||||
}
|
};
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
|
|
||||||
api.registerMethod("get_methods", {
|
api.registerMethod("get_methods", {
|
||||||
cacheable: false,
|
cacheable: false,
|
||||||
handler: async (): Promise<RPCResponse | null> => {
|
async handler(): Promise<RPCResponse | null> {
|
||||||
return {
|
return {
|
||||||
data: api.getMethods()
|
data: api.getMethods(),
|
||||||
}
|
};
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
}
|
},
|
||||||
|
};
|
||||||
}
|
|
||||||
|
|
||||||
export default plugin;
|
export default plugin;
|
||||||
|
|
Reference in New Issue