-
Notifications
You must be signed in to change notification settings - Fork 27
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
feat: event handling in get-starknet #413
Conversation
53d1b9f
to
2071148
Compare
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.
the overall coding look good,
some advice for clean up the code
and some bug/wrong behaviour discovered:
- any handler error will break other handler
- previous address never assign
18941a2
to
2790ad8
Compare
893e19b
to
f50bb63
Compare
4793645
to
d35521f
Compare
Quality Gate passed for 'consensys_starknet-snap-starknet-snap'Issues Measures |
Quality Gate passed for 'consensys_starknet-snap-wallet-ui'Issues Measures |
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.
LGTM, we can have a unit test later on
Description
This PR introduces event handling in
get-starknet
by implementing a polling mechanism to detect and handleaccountsChanged
andnetworkChanged
events.Changes Introduced:
Event Polling Added:
walletAccount
object remains in sync with the snap state.Unified Polling Logic:
accountsChanged
andnetworkChanged
event handling.Optimized Polling Mechanism:
Performance Validation:
Purpose:
This ensure that the walletAccount object address and network are in sync with the snap state. As both events are used in the walletAccount object to ensure this: https://github.com/starknet-io/starknet.js/blob/b15fe2d6aa9a5494c510fcac3d6d34fd7e41bf5c/src/wallet/account.ts#L56