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) {
|
getContributorById(id) {
|
||||||
return this.get('contributorsContract')
|
return this.get('contributorsContract')
|
||||||
.then((contract) => contract.contributors(id))
|
.then((contract) => contract.getContributorById(id))
|
||||||
// Set basic data
|
// Set basic data
|
||||||
.then(({
|
.then(({
|
||||||
account: address,
|
account: address,
|
||||||
@@ -125,8 +125,8 @@ export default Service.extend({
|
|||||||
hashSize,
|
hashSize,
|
||||||
isCore,
|
isCore,
|
||||||
profileHash: digest,
|
profileHash: digest,
|
||||||
|
balance
|
||||||
}) => {
|
}) => {
|
||||||
|
|
||||||
let isCurrentUser = this.get('currentUserAccounts').includes(address);
|
let isCurrentUser = this.get('currentUserAccounts').includes(address);
|
||||||
let profileHash = fromBytes32({ digest, hashFunction, hashSize });
|
let profileHash = fromBytes32({ digest, hashFunction, hashSize });
|
||||||
|
|
||||||
@@ -136,17 +136,9 @@ export default Service.extend({
|
|||||||
isCore,
|
isCore,
|
||||||
isCurrentUser,
|
isCurrentUser,
|
||||||
profileHash,
|
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
|
// Fetch IPFS data if available
|
||||||
.then(this.loadContributorProfile.bind(this))
|
.then(this.loadContributorProfile.bind(this))
|
||||||
.then((attributes) => {
|
.then((attributes) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user