Merge pull request #34 from 67P/features/balance-from-contributors
Use getContributorById call to get contributor data
This commit was merged in pull request #34.
This commit is contained in:
+3
-11
@@ -117,7 +117,7 @@ export default Service.extend({
|
||||
|
||||
getContributorById(id) {
|
||||
return this.get('contributorsContract')
|
||||
.then((contract) => contract.contributors(id))
|
||||
.then((contract) => contract.getContributorById(id))
|
||||
// Set basic data
|
||||
.then(({
|
||||
account: address,
|
||||
@@ -125,8 +125,8 @@ export default Service.extend({
|
||||
hashSize,
|
||||
isCore,
|
||||
profileHash: digest,
|
||||
balance
|
||||
}) => {
|
||||
|
||||
let isCurrentUser = this.get('currentUserAccounts').includes(address);
|
||||
let profileHash = fromBytes32({ digest, hashFunction, hashSize });
|
||||
|
||||
@@ -136,17 +136,9 @@ export default Service.extend({
|
||||
isCore,
|
||||
isCurrentUser,
|
||||
profileHash,
|
||||
balance: balance.toNumber()
|
||||
};
|
||||
})
|
||||
// Add the balance
|
||||
.then((data) => {
|
||||
return this.get('tokenContract')
|
||||
.then((contract) => contract.balanceOf(data.address))
|
||||
.then((balance) => {
|
||||
data.balance = balance.toNumber();
|
||||
return data;
|
||||
});
|
||||
})
|
||||
// Fetch IPFS data if available
|
||||
.then(this.loadContributorProfile.bind(this))
|
||||
.then((attributes) => {
|
||||
|
||||
Reference in New Issue
Block a user