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