minty
minty copied to clipboard
TypeError: CID instance expected instead of object
The latest version of ipfs-http-client
client is using CIDs from https://www.npmjs.com/package/multiformats but Minty is currently configured to use CIDS from https://www.npmjs.com/package/cids
Which means that the 'pin to remote service' functions like pinTokenData
will fail with TypeError: CID instance expected instead of object.
As far as I can tell, the way to fix this is to use the CID classes that come with the multiformats dependency in ipfs-http-client
such as...
const { CID } = require('multiformats/cid')
and then update the extractCID
helper method to use the multiformats CID.parse method...
function extractCID(cidOrURI) {
// remove the ipfs:// prefix, split on '/' and return first path component (root CID)
const cidString = stripIpfsUriPrefix(cidOrURI).split('/')[0]
return CID.parse(cidString)
}