kangarang / tcr-ui

A client-side shell to interact with token-curated registries
MIT License
68 stars 28 forks source link

Type checking IPFS #60

Closed kangarang closed 6 years ago

kangarang commented 6 years ago

Build for Prospect Park edition, but be prepared to fail gracefully.

Add

const obj = {
  id: "0xd0d6d6c5fe4a677d343cc433536bb717bae167dd",
  data: "This is a super token"
}

const CID = ipfs.addJSON(obj)
const multihash = CID[0].hash

registry.apply(keccak256(obj.id, numTokens, multihash)

Get

const ipfsPath = await ipfs.files.get(multihash)
let content
ipfsPath.forEach(file => {
  console.log(file.path)
  content = JSON.parse(file.content.toString('utf8'))
})
return content
// { "id": "0xd0d6d6c5fe4a677d343cc433536bb717bae167dd", "data": "This is a super token" }

https://github.com/jfairbank/revalidate

kangarang commented 6 years ago

e35f24d6e8b9cbd2e4379db6bc226bf775e32034