Handle bignumber conversions

The kredits module always returns raw data from the contract. For uint
values these are bignumbers.
To handle those in the ember app we need to convert them to string or to
number.
This commit is contained in:
2018-04-09 20:31:34 +02:00
parent 1a5d33b1f0
commit 32846194b6
4 changed files with 24 additions and 9 deletions
+2 -2
View File
@@ -17,7 +17,7 @@ export default Controller.extend({
contributors: alias('model.contributors'),
contributorsWithKredits: filter('contributors', function(contributor) {
return contributor.get('balance').toString() !== "0";
return contributor.get('balance') !== 0;
}),
contributorsSorting: ['balance:desc'],
contributorsSorted: sort('contributorsWithKredits', 'contributorsSorting'),
@@ -68,7 +68,7 @@ export default Controller.extend({
this.get('contributors')
.findBy('id', recipientId.toString())
.incrementProperty('balance', amount.toNumber());
.incrementProperty('balance', amount);
},
_handleProposalVoted(proposalId, voter, totalVotes) {