From e5ed06e1df9f60bee10980ff8b337fe2990f4b52 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Tue, 31 Jan 2023 08:14:50 -0500 Subject: [PATCH] *Update dist --- dist/index.d.ts | 2 +- dist/index.d.ts.map | 2 +- dist/index.js | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dist/index.d.ts b/dist/index.d.ts index 237f051..712f266 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -5,7 +5,7 @@ export declare class PeerDiscoveryClient extends Client { remove(name: string): Promise; removeAll(): Promise; exists(name: string): Promise; - discover(pubkey: string): Promise; + discover(pubkey: string | Uint8Array): Promise; } export declare const createClient: (...args: any) => PeerDiscoveryClient; export { Peer }; diff --git a/dist/index.d.ts.map b/dist/index.d.ts.map index 0d7c3d2..63020e7 100644 --- a/dist/index.d.ts.map +++ b/dist/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAW,MAAM,8BAA8B,CAAC;AAC/D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACpD,qBAAa,mBAAoB,SAAQ,MAAM;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMvC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAItC,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1B,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAGtC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC;CAG/D;AAED,eAAO,MAAM,YAAY,uCAGxB,CAAC;AAEF,OAAO,EAAE,IAAI,EAAE,CAAC"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAW,MAAM,8BAA8B,CAAC;AAC/D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEpD,qBAAa,mBAAoB,SAAQ,MAAM;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMvC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAItC,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1B,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAGtC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC;CAW5E;AAED,eAAO,MAAM,YAAY,uCAGxB,CAAC;AAEF,OAAO,EAAE,IAAI,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index c705065..ce28492 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,4 +1,5 @@ import { Client, factory } from "@lumeweb/libkernel-universal"; +import { hexToBuf } from "@siaweb/libweb/dist"; export class PeerDiscoveryClient extends Client { async register(source) { const bag = await this.loadBound(source); @@ -15,6 +16,13 @@ export class PeerDiscoveryClient extends Client { return await this.callModuleReturn("remove", { name }); } async discover(pubkey) { + if (typeof pubkey === "string") { + let buf = hexToBuf(pubkey); + if (buf[1]) { + throw new Error(buf[1]); + } + pubkey = buf[0]; + } return await this.callModuleReturn("discover", { pubkey }); } }