From bb0c8de24ed975b1e9e64b5075e77c086cd0e10e Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sat, 2 Sep 2023 06:38:47 -0400 Subject: [PATCH] refactor: update encodeCid to match the portal encodeCid --- src/cid.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/cid.ts b/src/cid.ts index 70f5e5b..07d1374 100644 --- a/src/cid.ts +++ b/src/cid.ts @@ -7,9 +7,14 @@ import { addContextToErr } from "#err.js"; export function encodeCid(hash: Uint8Array, size: bigint): any; export function encodeCid(hash: string, size: bigint): any; -export function encodeCid(hash: any, size: bigint): ErrTuple { +export function encodeCid( + hash: any, + size: bigint, + type?: number, + hashType?: number, +): ErrTuple { try { - return [encodeCidPortal(hash, size), null]; + return [encodeCidPortal(hash, size, type, hashType), null]; } catch (e) { return [null, addContextToErr(e as Error, "failed to encode cid")]; }