diff --git a/lib/ipfs-pinner.js b/lib/ipfs-pinner.js index 9e0aebc..4762d42 100644 --- a/lib/ipfs-pinner.js +++ b/lib/ipfs-pinner.js @@ -29,8 +29,7 @@ class IpfsPinner { const contracts = [ this.kredits.Contributor, this.kredits.Contribution, - // TODO uncomment once we have data here - // this.kredits.Reimbursement + this.kredits.Reimbursement ] for (const contract of contracts) { @@ -72,6 +71,11 @@ class IpfsPinner { .then(data => { return this.ipfsApi.pin(data); }) .then(callback); }); + this.kredits.Reimbursement.on('ReimbursementAdded', (id) => { + this.kredits.Reimbursement.getData(id) + .then(data => { return this.ipfsApi.pin(data); }) + .then(callback); + }); } async _pinAllFromContract (contract, itemCount, progressBar) { @@ -91,7 +95,7 @@ class IpfsPinner { cid = await ipfsApi.pin(data); debug(`Pinned ${contract.constructor.name} #${id} at ${cid}`); } catch(e) { - debug(`Error while trying to load an pin ${contract.constructor.name} #${id}:`) + debug(`Error while trying to load and pin ${contract.constructor.name} #${id}:`) debug(e); debug(`\nTrying again...`); loadAndPin(id);