From 30f48f81acc16d33ea28dbe6ef311736a97e5a37 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Wed, 7 Dec 2022 04:24:42 -0500 Subject: [PATCH] *Update api usage --- package.json | 3 ++- src/index.ts | 15 ++++----------- 2 files changed, 6 insertions(+), 12 deletions(-) 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; }, }); },