Skip to content

Commit

Permalink
Emit a new "smartTransactionConfirmationDone" event (#424)
Browse files Browse the repository at this point in the history
  • Loading branch information
dan437 authored Sep 24, 2024
1 parent 4df1a7b commit 9558638
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/SmartTransactionsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,18 @@ export type SmartTransactionsControllerSmartTransactionEvent = {
payload: [SmartTransaction];
};

export type SmartTransactionsControllerSmartTransactionConfirmationDoneEvent = {
type: 'SmartTransactionsController:smartTransactionConfirmationDone';
payload: [SmartTransaction];
};

/**
* The events that {@link SmartTransactionsController} can emit.
*/
export type SmartTransactionsControllerEvents =
| SmartTransactionsControllerStateChangeEvent
| SmartTransactionsControllerSmartTransactionEvent;
| SmartTransactionsControllerSmartTransactionEvent
| SmartTransactionsControllerSmartTransactionConfirmationDoneEvent;

export type AllowedEvents = NetworkControllerStateChangeEvent;

Expand Down Expand Up @@ -682,6 +688,11 @@ export default class SmartTransactionsController extends StaticIntervalPollingCo
category: MetaMetricsEventCategory.Transactions,
});
console.error('confirm error', error);
} finally {
this.messagingSystem.publish(
`SmartTransactionsController:smartTransactionConfirmationDone`,
smartTransaction,
);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ export type {
SmartTransactionsControllerActions,
SmartTransactionsControllerStateChangeEvent,
SmartTransactionsControllerSmartTransactionEvent,
SmartTransactionsControllerSmartTransactionConfirmationDoneEvent,
SmartTransactionsControllerEvents,
} from './SmartTransactionsController';

0 comments on commit 9558638

Please sign in to comment.