*Update dist
This commit is contained in:
parent
abbaf55f5f
commit
e5ed06e1df
|
@ -5,7 +5,7 @@ export declare class PeerDiscoveryClient extends Client {
|
|||
remove(name: string): Promise<boolean>;
|
||||
removeAll(): Promise<void>;
|
||||
exists(name: string): Promise<boolean>;
|
||||
discover(pubkey: string): Promise<Peer | boolean>;
|
||||
discover(pubkey: string | Uint8Array): Promise<Peer | boolean>;
|
||||
}
|
||||
export declare const createClient: (...args: any) => PeerDiscoveryClient;
|
||||
export { Peer };
|
||||
|
|
|
@ -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"}
|
||||
{"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"}
|
|
@ -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 });
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue