@@ -108,16 +108,23 @@ export const selectByTxHash = txHash => state => state.transactions.entities[txH
108108 * @param {PromiEvent } tx the transaction PromiEvent from web3.js
109109 * @param {object } options the options object
110110 * @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.
116115 * @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.
117118 */
118119export function * registerTxSaga (
119120 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+ } = { }
121128) {
122129 const txChannel = yield call ( createTransactionChannel , tx , { wait } ) ;
123130
@@ -169,7 +176,7 @@ export function* registerTxSaga(
169176 }
170177}
171178
172- function * afterTxResultSaga ( txHash , { onSuccess = ( ) => { } , onFailure = ( ) => { } } ) {
179+ function * afterTxResultSaga ( txHash , { onSuccess = function * ( ) { } , onFailure = function * ( ) { } } ) {
173180 const matchesActionType = action => [ confirm , fail ] . some ( ( { match } ) => match ( action ) ) ;
174181 const matchesTxHash = action => action . payload ?. txHash === txHash ;
175182
0 commit comments