@@ -62,7 +62,7 @@ const handlers = {
62
62
error : function ( context , error ) {
63
63
if ( ! handlers . ignoreTimeoutError ( context , error ) ) {
64
64
context . promiEvent . emit ( "error" , error ) ;
65
- this . removeListener ( "error" , handlers . error ) ;
65
+ this . off ( "error" , handlers . error ) ;
66
66
}
67
67
} ,
68
68
@@ -73,18 +73,17 @@ const handlers = {
73
73
* @param {String } hash transaction hash
74
74
*/
75
75
hash : function ( context , hash ) {
76
- console . log ( "%%%%% transactionHash" , hash ) ;
77
76
context . transactionHash = hash ;
78
77
context . promiEvent . eventEmitter . emit ( "transactionHash" , hash ) ;
79
- this . removeListener ( "transactionHash" , handlers . hash ) ;
78
+ this . off ( "transactionHash" , handlers . hash ) ;
80
79
} ,
81
80
82
81
confirmation : function ( context , number , receipt ) {
83
82
context . promiEvent . eventEmitter . emit ( "confirmation" , number , receipt ) ;
84
83
85
84
// Per web3: initial confirmation index is 0
86
85
if ( number === handlers . maxConfirmations + 1 ) {
87
- this . removeListener ( "confirmation" , handlers . confirmation ) ;
86
+ this . off ( "confirmation" , handlers . confirmation ) ;
88
87
}
89
88
} ,
90
89
@@ -95,7 +94,6 @@ const handlers = {
95
94
* @param {Object } receipt transaction receipt
96
95
*/
97
96
receipt : async function ( context , receipt ) {
98
- console . log ( "%%%%% receipt" , receipt ) ;
99
97
// keep around the raw (not decoded) logs in the raw logs field as a
100
98
// stopgap until we can get the ABI for all events, not just the current
101
99
// contract
@@ -146,8 +144,8 @@ const handlers = {
146
144
147
145
//HACK: adding this conditional for when the handler is invoked
148
146
//manually during stacktracing
149
- if ( this . removeListener ) {
150
- this . removeListener ( "receipt" , handlers . receipt ) ;
147
+ if ( this . off ) {
148
+ this . off ( "receipt" , handlers . receipt ) ;
151
149
}
152
150
}
153
151
} ;
0 commit comments