-
Notifications
You must be signed in to change notification settings - Fork 44
Pass transaction send status to analytics #790
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
Pass transaction send status to analytics #790
Conversation
|
📦 build.zip [updated at May 23, 3:09:31 PM UTC] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
The purpose of this PR is to pass the transaction send status to the analytics service by tracking successful and failed transaction events.
- Introduces a new helper function (trackSentTransaction) to standardize analytics payload construction.
- Updates event emission for failed transaction sends via a new "transactionSendFailed" event in analytics and events files.
- Enhances error handling in the Wallet module to integrate with the new analytics flow.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/shared/analytics/analytics.background.ts | Adds trackSentTransaction function and refactors tracking logic. |
| src/background/events.ts | Introduces a new "transactionSendFailed" event type. |
| src/background/Wallet/Wallet.ts | Updates error handling to emit transaction failure analytics. |
| return safeTxPlain; | ||
| } catch (error) { | ||
| throw getEthersError(error); | ||
| const parsedError = getEthersError(error); |
Copilot
AI
May 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The error handling code here duplicates logic by emitting the 'transactionSendFailed' event and throwing the error immediately after; consider extracting this common logic into a helper function to reduce duplication.
| const parsedError = getEthersError(error); | ||
| emitter.emit('transactionSendFailed', { | ||
| message: getError(parsedError).message, | ||
| ...transactionContextParams, | ||
| }); | ||
| throw parsedError; | ||
| } | ||
| } | ||
|
|
Copilot
AI
May 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Similar to the earlier catch block, the error handling logic is repeated here; abstracting this into a shared function would improve code maintainability and reduce the potential for inconsistencies.
| const parsedError = getEthersError(error); | |
| emitter.emit('transactionSendFailed', { | |
| message: getError(parsedError).message, | |
| ...transactionContextParams, | |
| }); | |
| throw parsedError; | |
| } | |
| } | |
| this.handleTransactionError(error, transactionContextParams); | |
| } | |
| } | |
| private handleTransactionError( | |
| error: unknown, | |
| contextParams: TransactionContextParams | |
| ): never { | |
| const parsedError = getEthersError(error); | |
| emitter.emit('transactionSendFailed', { | |
| message: getError(parsedError).message, | |
| ...contextParams, | |
| }); | |
| throw parsedError; | |
| } |
|
Done in #829 |
No description provided.