Update current block when new one is mined
This commit is contained in:
@@ -118,9 +118,12 @@ export default Service.extend({
|
|||||||
});
|
});
|
||||||
|
|
||||||
await kredits.init();
|
await kredits.init();
|
||||||
|
|
||||||
this.set('kredits', kredits);
|
this.set('kredits', kredits);
|
||||||
this.set('currentBlock', await kredits.provider.getBlockNumber());
|
this.set('currentBlock', await this.kredits.provider.getBlockNumber());
|
||||||
|
this.kredits.provider.on('block', blockNumber => {
|
||||||
|
console.debug('[kredits] New block mined:', blockNumber);
|
||||||
|
this.set('currentBlock', blockNumber)
|
||||||
|
});
|
||||||
|
|
||||||
if (this.currentUserAccounts && this.currentUserAccounts.length > 0) {
|
if (this.currentUserAccounts && this.currentUserAccounts.length > 0) {
|
||||||
this.getCurrentUser.then(contributorData => {
|
this.getCurrentUser.then(contributorData => {
|
||||||
@@ -738,5 +741,5 @@ export default Service.extend({
|
|||||||
this.contributors
|
this.contributors
|
||||||
.findBy('address', to)
|
.findBy('address', to)
|
||||||
.incrementProperty('balance', value);
|
.incrementProperty('balance', value);
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user