Update to ethers 5 #200

Merged
bumi merged 5 commits from ethers5 into master 2020-07-07 14:59:40 +00:00
2 changed files with 4 additions and 2 deletions
Showing only changes of commit bc38dcb136 - Show all commits

View File

@ -9,7 +9,8 @@ class Contributor extends Record {
getById (id) { getById (id) {
return this.functions.getContributorById(id) return this.functions.getContributorById(id)
.then(data => { .then(contractData => {
let data = {...contractData};
data.balanceInt = formatKredits(data.balance); data.balanceInt = formatKredits(data.balance);
return this.ipfs.catAndMerge(data, ContributorSerializer.deserialize); return this.ipfs.catAndMerge(data, ContributorSerializer.deserialize);
}); });

View File

@ -11,7 +11,8 @@ class IPFS {
this._ipfsAPI = ipfsClient(config); this._ipfsAPI = ipfsClient(config);
} }
catAndMerge (data, deserialize) { catAndMerge (contractData, deserialize) {
let data = {...contractData}; // data from ethers.js is not extensible. this copy the attributes in a new object
// if no hash details are found simply return the data; nothing to merge // if no hash details are found simply return the data; nothing to merge
if (!data.hashSize || data.hashSize === 0) { if (!data.hashSize || data.hashSize === 0) {
return data; return data;