Move contract event handling into service

This commit is contained in:
2018-04-15 20:36:21 +02:00
parent e4215557c8
commit d425ed6b9e
4 changed files with 80 additions and 64 deletions
+7
View File
@@ -7,4 +7,11 @@ export default class Base {
return this.contract.functions;
}
on(type, callback) {
let eventMethod = `on${type.toLowerCase()}`;
// Don't use this.contract.events here. Seems to be a bug in ethers.js
this.contract[eventMethod] = callback;
return this;
}
}