From 4e4a22542fd328ad230f799f7b19d1221ca60508 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sat, 13 Aug 2022 15:11:18 -0400 Subject: [PATCH] *Switch from Buffer to hexToBuf --- src/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 62f6a5f..bea1f53 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,7 +4,8 @@ import type { ActiveQuery } from "libkmodule"; import { addHandler, getSeed, handleMessage } from "libkmodule"; import { handlePresentSeed as handlePresentSeedModule } from "libkmodule/dist/seed.js"; import { nextId } from "./id"; -import { Buffer } from "buffer"; +import type { Buffer } from "buffer"; +import {hexToBuf} from "libskynet"; interface DhtConnection { dht: number; @@ -89,7 +90,7 @@ async function handleConnect(aq: ActiveQuery) { try { // @ts-ignore socket = await dht.connect( - typeof pubkey === "string" ? Buffer.from(pubkey, "hex") : pubkey, + typeof pubkey === "string" ? hexToBuf(pubkey) : pubkey, options ); } catch (e: any) {