@@ -108,16 +108,23 @@ export const selectByTxHash = txHash => state => state.transactions.entities[txH
108
108
* @param {PromiEvent } tx the transaction PromiEvent from web3.js
109
109
* @param {object } options the options object
110
110
* @param {false|number } [options.wait=false] if the saga must wait for the transaction to be mined.
111
- * If `false`, it will return right after the transaction hash is calculated.
112
- * If `0`, it will wait until the transaction is mined.
113
- * If `n`, it will wait until `n` confirmations.
114
- * @param {number } [options.ttl=10] time in milliseconds which the transaction data should be kept
115
- * in the store.
111
+ * If `false`, it will return right after the transaction hash is calculated.
112
+ * If `0`, it will wait until the transaction is mined.
113
+ * If `n`, it will wait until `n` confirmations.
114
+ * @param {number } [options.ttl=10] time in milliseconds which the transaction data should be kept in the store.
116
115
* @param {boolean|ShouldNotifyOption } [options.shouldNotify=true] time in milliseconds which the transaction data should be kept
116
+ * @param {function } [options.onSuccess=] a function/generator to be executed if the transaction is sucessfully mined.
117
+ * @param {function } [options.onFailure=] a function/generator to be executed if the transaction fails.
117
118
*/
118
119
export function * registerTxSaga (
119
120
tx ,
120
- { wait = false , shouldNotify = true , onSuccess = ( ) => { } , onFailure = ( ) => { } , ttl = DEFAULT_TTL } = { }
121
+ {
122
+ wait = false ,
123
+ shouldNotify = true ,
124
+ ttl = DEFAULT_TTL ,
125
+ onSuccess = function * ( ) { } ,
126
+ onFailure = function * ( ) { } ,
127
+ } = { }
121
128
) {
122
129
const txChannel = yield call ( createTransactionChannel , tx , { wait } ) ;
123
130
@@ -169,7 +176,7 @@ export function* registerTxSaga(
169
176
}
170
177
}
171
178
172
- function * afterTxResultSaga ( txHash , { onSuccess = ( ) => { } , onFailure = ( ) => { } } ) {
179
+ function * afterTxResultSaga ( txHash , { onSuccess = function * ( ) { } , onFailure = function * ( ) { } } ) {
173
180
const matchesActionType = action => [ confirm , fail ] . some ( ( { match } ) => match ( action ) ) ;
174
181
const matchesTxHash = action => action . payload ?. txHash === txHash ;
175
182
0 commit comments