refactor: use new CID with the multihash

This commit is contained in:
Derrick Hammer 2024-03-21 16:20:37 -04:00
parent f7a760051f
commit 0c304b20db
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 3 additions and 2 deletions

View File

@ -76,14 +76,15 @@ export const fileProvider: SdkProvider = {
const manifest = await getIsManifest(s5, pin.hash) as number; const manifest = await getIsManifest(s5, pin.hash) as number;
if (manifest) { if (manifest) {
const mHash = Multihash.fromBase64Url(pin.hash);
items.push({ items.push({
cid: CID.fromHash(pin.hash, pin.size, manifest).toString(), cid: new CID(manifest, mHash, pin.size).toString(),
type: "manifest", type: "manifest",
mimeType: "application/octet-stream", mimeType: "application/octet-stream",
}); });
} else { } else {
items.push({ items.push({
cid: CID.fromHash(pin.hash, pin.size, CID_TYPES.RAW).toString(), cid: new CID(CID_TYPES.RAW, Multihash.fromBase64Url(pin.hash), pin.size).toString(),
type: "raw", type: "raw",
mimeType: pin.mime_type, mimeType: pin.mime_type,
}); });