Skip to content

Commit 5100ea3

Browse files
authored
Emit an event with a Smart Transaction before confirmation (#333)
1 parent 69a7455 commit 5100ea3

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/SmartTransactionsController.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,13 @@ export default class SmartTransactionsController extends StaticIntervalPollingCo
394394
return;
395395
}
396396

397+
// We have to emit this event here, because then a txHash is returned to the TransactionController once it's available
398+
// and the #doesTransactionNeedConfirmation function will work properly, since it will find the txHash in the regular transactions list.
399+
this.eventEmitter.emit(
400+
`${smartTransaction.uuid}:smartTransaction`,
401+
smartTransaction,
402+
);
403+
397404
if (
398405
(smartTransaction.status === SmartTransactionStatuses.SUCCESS ||
399406
smartTransaction.status === SmartTransactionStatuses.REVERTED) &&
@@ -426,11 +433,6 @@ export default class SmartTransactionsController extends StaticIntervalPollingCo
426433
},
427434
});
428435
}
429-
430-
this.eventEmitter.emit(
431-
`${smartTransaction.uuid}:smartTransaction`,
432-
smartTransaction,
433-
);
434436
}
435437

436438
async updateSmartTransactions({

0 commit comments

Comments
 (0)