diff --git a/lib/contracts/contributor.js b/lib/contracts/contributor.js index 5edbfa9..05e3abc 100644 --- a/lib/contracts/contributor.js +++ b/lib/contracts/contributor.js @@ -52,6 +52,7 @@ class Contributor extends Record { const jsonStr = contributor.serialize(); + // console.log('Adding IPFS doc for', contributorAttr.account); return this.ipfs .add(jsonStr) .then((ipfsHashAttr) => { @@ -62,7 +63,11 @@ class Contributor extends Record { ipfsHashAttr.hashSize, ]; + // console.log('Adding onchain record for', contributorAttr.account); return this.contract.addContributor(...contributor, callOptions); + }).catch(err => { + console.log('Failed to add IPFS document:', err.message); + throw(err); }); } diff --git a/lib/utils/ipfs.js b/lib/utils/ipfs.js index 3b4ee17..7382bda 100644 --- a/lib/utils/ipfs.js +++ b/lib/utils/ipfs.js @@ -9,6 +9,13 @@ class IPFS { } this._config = config; this._ipfsAPI = ipfsClient.create(config); + + this._ipfsAPI.id().then(res => { + console.debug('IPFS ID:', res.id); + }).catch(e => { + console.debug('IPFS config:', config); + console.warn('Failed to initialize IPFS:', e.message); + }); } async catAndMerge (contractData, deserialize) {