refactor: update encodeCid to match the portal encodeCid
This commit is contained in:
parent
dd296e9e50
commit
bb0c8de24e
|
@ -7,9 +7,14 @@ import { addContextToErr } from "#err.js";
|
||||||
|
|
||||||
export function encodeCid(hash: Uint8Array, size: bigint): any;
|
export function encodeCid(hash: Uint8Array, size: bigint): any;
|
||||||
export function encodeCid(hash: string, 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 {
|
try {
|
||||||
return [encodeCidPortal(hash, size), null];
|
return [encodeCidPortal(hash, size, type, hashType), null];
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return [null, addContextToErr(e as Error, "failed to encode cid")];
|
return [null, addContextToErr(e as Error, "failed to encode cid")];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue