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

Eagerly connecting from an untrusted client should return not throw #17

Closed
fredguest opened this issue Nov 7, 2021 · 0 comments
Closed

Comments

@fredguest
Copy link

Right now his method:

window.solana.connect({ onlyIfTrusted: true });

throws a funky error that does not look to be by design:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading '_bn')

It's tough to diagnose since Phantom does not seem to be open source (?), but that looks like the connect method itself is not catching an internal async error, rather than intentionally throwing a designed error. What would be even better than throwing a designed error though, is just returning a message code to the client without throwing at all.

As it stands, if the client attempts to eagerly connect but is not yet trusted, because of that uncaught async error within the connect method, the client cannot continue execution. So if, for example, you want to toggle a piece of client side state to indicate that an attempt was made to eagerly connect, you can't.

Calling connect({ onlyIfTrusted: true }) from an untrusted client is obviously an expected usage, so it should not result in an uncaught async error, or a designed thrown error, but simply a message code that indicates the client is not yet trusted. This would be much easier to handle from the client, and allow for better UX implementations.

@bfriel bfriel closed this as completed Dec 14, 2022
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

No branches or pull requests

2 participants