Update to ethers 5 #200
@ -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);
|
||||||
});
|
});
|
||||||
|
@ -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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user