diff --git a/package.json b/package.json index 6882a7c..5837caa 100644 --- a/package.json +++ b/package.json @@ -6,10 +6,11 @@ "build": "bash build.sh" }, "devDependencies": { - "@lumeweb/relay": "https://github.com/LumeWeb/relay.git", + "@types/node": "^18.11.10", "esbuild": "^0.15.5" }, "dependencies": { + "@lumeweb/relay-types": "https://git.lumeweb.com/LumeWeb/relay-types.git", "hs-client": "^0.0.11", "hsd": "https://github.com/LumeWeb/hsd.git#spv-namestate", "random-key": "^0.3.2" diff --git a/src/index.ts b/src/index.ts index 8eb0e1c..df6a1f4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,9 +1,4 @@ -import type { - Plugin, - PluginAPI, - RPCResponse, - RPCRequest, -} from "@lumeweb/relay"; +import type { Plugin, PluginAPI } from "@lumeweb/relay-types"; // @ts-ignore import rand from "random-key"; // @ts-ignore @@ -88,10 +83,10 @@ const plugin: Plugin = { api.registerMethod("getnameresource", { cacheable: true, - async handler(request: RPCRequest): Promise { + async handler(name: string): Promise { let resp; try { - resp = await client.execute("getnameresource", request.data); + resp = await client.execute("getnameresource", name); } catch (e: any) { e = e as Error; const eType = e.type.toLowerCase(); @@ -107,9 +102,7 @@ const plugin: Plugin = { throw e; } - return { - data: resp, - }; + return resp; }, }); },