-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Conversation
Update a test
src/SmartTransactionsController.ts
Outdated
[chainId]: smartTransactionsState.smartTransactions[chainId].map( | ||
(item, index) => { | ||
return index === currentIndex | ||
? { ...item, ...smartTransaction } |
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.
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}
.
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.
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.
src/SmartTransactionsController.ts
Outdated
smartTransactions: { | ||
...smartTransactionsState.smartTransactions, | ||
[chainId]: smartTransactionsState.smartTransactions[chainId].map( | ||
(item, index) => { |
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.
Hey, consider naming the item parameter something more specific like existingSmartTransaction to make it clearer.
Great work! |
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.