-
Notifications
You must be signed in to change notification settings - Fork 37
feat: enable skip select namespaces in useStatefulConnect hook #1285
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
base: next
Are you sure you want to change the base?
feat: enable skip select namespaces in useStatefulConnect hook #1285
Conversation
ae9f0b7 to
5a9a7c8
Compare
5a9a7c8 to
d7a4afc
Compare
d7a4afc to
a6e1484
Compare
| path: string | ||
| path: string, | ||
| options?: { | ||
| forcedNamespaces?: Namespace[]; |
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.
let's call the option: onlyConnectTo or forceConnectTo.
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.
Changed to forceConnectToNamespaces. I think its better to keep namespaces in the naming.
| : 'An unknown error happened during connecting wallet.'; | ||
|
|
||
| if (options?.disconnectOnError) { | ||
| await handleDisconnect(wallet); |
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.
this may throw an error itself, you need to do something like L86 for .catch here as well.
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.
As the only important error here is the error related to connecting the wallet, added a try/catch around the disconnect to warn the error related to disconnecting wallet in the console.
9431967 to
6507542
Compare
Summary
Currently, initial and detached modals get displayed when user tries to connect a hub wallet. In this PR, a
forcedNamespacesparameter is added tohandleConnectmethod ofuseStatefulConnecthook to enable selecting some namespaces programmatically without displaying initial and detached modal. So whenhandleConnectgets called with someforcedNamespaces, those namespaces get connected and if one of them get an error, all of them get disconnected.How did you test this change?
Tested by linking this PR to app and passed
SolanaandEVMnamespaces asskipSelectNamespacesand observed the required behavior.Checklist: