-
Notifications
You must be signed in to change notification settings - Fork 19
Trigger on confirmed transactions #622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -220,7 +220,16 @@ export const WidgetContainer: React.FunctionComponent<WidgetContainerProps> = | |||||||||||||||||||||||||||||||||||||||||||
| setSuccess(true); | ||||||||||||||||||||||||||||||||||||||||||||
| onSuccess?.(transaction); | ||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||
| onTransaction?.(transaction); | ||||||||||||||||||||||||||||||||||||||||||||
| // FIXME: Since the confirmed transactions are supported this could | ||||||||||||||||||||||||||||||||||||||||||||
| // be called twice for the same transaction. In order to maintain | ||||||||||||||||||||||||||||||||||||||||||||
| // the same behavior as before the confirmed transactions are | ||||||||||||||||||||||||||||||||||||||||||||
| // supported we should only call onTransaction if the transaction is | ||||||||||||||||||||||||||||||||||||||||||||
| // not confirmed. The proper fix would be to add a status so the | ||||||||||||||||||||||||||||||||||||||||||||
| // callback know why it's called (added to mempool, finalized, | ||||||||||||||||||||||||||||||||||||||||||||
| // confirmed, etc.). Fabien 2026-02-20 | ||||||||||||||||||||||||||||||||||||||||||||
| if (transaction.confirmed === false) { | ||||||||||||||||||||||||||||||||||||||||||||
| onTransaction?.(transaction); | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| if (transactionText){ | ||||||||||||||||||||||||||||||||||||||||||||
| enqueueSnackbar( | ||||||||||||||||||||||||||||||||||||||||||||
| `${ | ||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -275,14 +284,15 @@ export const WidgetContainer: React.FunctionComponent<WidgetContainerProps> = | |||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| const handleNewTransaction = useCallback( | ||||||||||||||||||||||||||||||||||||||||||||
| (tx: Transaction) => { | ||||||||||||||||||||||||||||||||||||||||||||
| if ( | ||||||||||||||||||||||||||||||||||||||||||||
| tx.confirmed === false && | ||||||||||||||||||||||||||||||||||||||||||||
| isGreaterThanZero(resolveNumber(tx.amount)) | ||||||||||||||||||||||||||||||||||||||||||||
| ) { | ||||||||||||||||||||||||||||||||||||||||||||
| if (success) { | ||||||||||||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| if (isGreaterThanZero(resolveNumber(tx.amount))) { | ||||||||||||||||||||||||||||||||||||||||||||
| handlePayment(tx); | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||
| [handlePayment], | ||||||||||||||||||||||||||||||||||||||||||||
| [handlePayment, success], | ||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+287
to
296
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The early-return at Line 278 only checks 🐛 Proposed fix- if (success) {
+ if (success || shiftCompleted) {
return;
}And add - [handlePayment, success],
+ [handlePayment, success, shiftCompleted],📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| const checkForTransactions = useCallback(async (): Promise<boolean> => { | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.