Skip to content
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

Update metrics, refactoring #374

Merged
merged 2 commits into from
Jul 10, 2024
Merged

Update metrics, refactoring #374

merged 2 commits into from
Jul 10, 2024

Conversation

dan437
Copy link
Collaborator

@dan437 dan437 commented Jul 9, 2024

Description

This PR updates metrics for 2 events and includes a bit of refactoring, which was needed to make the events work for non-swaps transactions.

@dan437 dan437 requested a review from a team as a code owner July 9, 2024 15:49
dbrans
dbrans previously approved these changes Jul 9, 2024
[chainId]: smartTransactionsState.smartTransactions[chainId].map(
(item, index) => {
return index === currentIndex
? { ...item, ...smartTransaction }
Copy link

@dbrans dbrans Jul 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a heads-up: this method updates only the properties present in the provided smartTransaction. This merge-like behavior might be surprising for some users. Case in point, on line 593 in this PR, if "merge" were the expected bahaviour, you could just write {confirmed: true}.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could only pass { confirmed: true } on line 593, but the #updateSmartTransaction function expects the SmartTransaction type for the smartTransaction input param, which also requires uuid. I believe that for simplicity it's easier to just pass the whole smartTransaction to be updated in state.

smartTransactions: {
...smartTransactionsState.smartTransactions,
[chainId]: smartTransactionsState.smartTransactions[chainId].map(
(item, index) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, consider naming the item parameter something more specific like existingSmartTransaction to make it clearer.

@dbrans
Copy link

dbrans commented Jul 10, 2024

Great work!

@dan437 dan437 merged commit b5ffebf into main Jul 10, 2024
16 checks passed
@dan437 dan437 deleted the metrics branch July 10, 2024 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants