storacha / ucanto

🐧 UCAN RPC
Other
50 stars 6 forks source link

Links should not be printed as {"code":85,"version":1,"hash":{"0":0,"1":0}}}} #171

Open Gozala opened 1 year ago

Gozala commented 1 year ago

Bunch of errors produce unreadable messages because links are not serialized properly. That is because CIDs define links as follows https://github.com/multiformats/js-multiformats/blob/15c52c8a5384e1bc84cccfa34ed6c7a78eb23978/src/cid.js#L202-L208 where bytes gets serialized as on object containing each byte.

Gozala commented 1 year ago

I have submitted issue to multiformats https://github.com/multiformats/js-multiformats/issues/228, but in the meantime we could workaround this via JSON.stringify replacer function which can substitute { code, version, hash } as needed.