Refactor IPFS hash handling

This now uses the multihashes dependency (which is an ipfs dependency)
to decode/encode the ipfs hashes.
This commit is contained in:
2018-04-09 14:52:39 +02:00
parent e527099b00
commit 41a04d6b53
3 changed files with 20 additions and 24 deletions
+1 -2
View File
@@ -26,7 +26,6 @@ export default class Contributor extends Base {
id = ethers.utils.bigNumberify(id);
return this.contract.functions.getContributorById(id)
.then(this.reassembleIpfsHash)
.then((data) => {
// TODO: remove as soon as the contract provides the id
data.id = id;
@@ -51,7 +50,7 @@ export default class Contributor extends Base {
.add(new Kredits.ipfs.Buffer(json))
.then((res) => res[0].hash)
.then((ipfsHash) => {
Object.assign(attributes, toBytes32(ipfsHash));
Object.assign(attributes, this.decodeIpfsHash(ipfsHash));
return attributes;
})
.then((attributes) => {