fix: pass the fullBytes of the hash, and return the CID in string form with fromRegistry

This commit is contained in:
Derrick Hammer 2023-09-11 05:44:19 -04:00
parent b6142a654d
commit 2d616979c3
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 3 additions and 3 deletions

View File

@ -1,5 +1,5 @@
import { internalModuleCall, modules } from "./queries.js";
import { SignedRegistryEntry, CID } from "@lumeweb/libs5";
import { CID, SignedRegistryEntry } from "@lumeweb/libs5";
const CORE_MODULES = {
swarm: "zdiLmwHCC15afFNLYzzT2DVV7m27SrBde7oXHdSzAe95GpFZXzdpatUN6b",
@ -32,7 +32,7 @@ function moduleLoaded(module: string) {
export async function resolveModuleRegistryEntry(module: string) {
const cid = CID.decode(module);
const pubkey = cid.hash;
const pubkey = cid.hash.fullBytes;
const signedEntry = (await internalModuleCall(
CORE_MODULES.s5,
@ -40,5 +40,5 @@ export async function resolveModuleRegistryEntry(module: string) {
{ pubkey },
)) as SignedRegistryEntry;
const entry = CID.fromRegistry(signedEntry.data);
return CID.fromRegistry(signedEntry.data).toString();
}