Skip to content

Commit

Permalink
Emit an event with a Smart Transaction before confirmation (#333)
Browse files Browse the repository at this point in the history
  • Loading branch information
dan437 authored May 9, 2024
1 parent 69a7455 commit 5100ea3
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/SmartTransactionsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,13 @@ export default class SmartTransactionsController extends StaticIntervalPollingCo
return;
}

// We have to emit this event here, because then a txHash is returned to the TransactionController once it's available
// and the #doesTransactionNeedConfirmation function will work properly, since it will find the txHash in the regular transactions list.
this.eventEmitter.emit(
`${smartTransaction.uuid}:smartTransaction`,
smartTransaction,
);

if (
(smartTransaction.status === SmartTransactionStatuses.SUCCESS ||
smartTransaction.status === SmartTransactionStatuses.REVERTED) &&
Expand Down Expand Up @@ -426,11 +433,6 @@ export default class SmartTransactionsController extends StaticIntervalPollingCo
},
});
}

this.eventEmitter.emit(
`${smartTransaction.uuid}:smartTransaction`,
smartTransaction,
);
}

async updateSmartTransactions({
Expand Down

0 comments on commit 5100ea3

Please sign in to comment.