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

Wallet Standard Remote Wallet #957

Merged
merged 7 commits into from
Nov 14, 2024
Merged

Conversation

Funkatronics
Copy link
Contributor

No description provided.

Copy link

Choose a reason for hiding this comment

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

Should we wait with merging this until we build WebBluetooth connections end-to-end?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes

Copy link

Choose a reason for hiding this comment

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

Remove?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes

#disconnect: StandardDisconnectMethod = async () => {
// TODO: figure out why this call throws "TypeError: _a.terminateSession is not a function"
// even though the session termination is actually executed (websocket closes).
try { this.#wallet?.terminateSession(); } catch (e) {}
Copy link

Choose a reason for hiding this comment

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

Could stem from the remote proxy implementation of the TerminateSessionAPI interface assigning an 'any' property instead of a function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm good thought, let me investigate 🦺

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed!

I still don't love this solution of using the wallet proxy request handler to handle what is not an MWA RPC request (terminateSession). But for now I think its the best way to add this functionality - I am thinking about a big refactor to the js impl to clean this up. the terminate session API is not exposed directly to consumers so it will be safe to refactor the implementation later on.

try {
const cachedAuthorizationResult = await this.#authorizationResultCache.get();
if (cachedAuthorizationResult) {
// TODO: Evaluate whether there's any threat to not `awaiting` this expression
Copy link

Choose a reason for hiding this comment

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

Is the assumption that pubkey / cachedAuthorizationResult.accounts shouldn't have changed at this point?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think so, that is my understanding. this comment + logic are a hold over from the original implementation. So I left as much of the original logic as possible - for now. I basically wanted to re-wrap everything as-is into a wallet-standard lib. Once we know that is working I plan to refactor some stuff and clean up TODOs like this,

@Funkatronics Funkatronics changed the title [WIP] Wallet Standard Remote Wallet Wallet Standard Remote Wallet Nov 14, 2024
@Funkatronics Funkatronics merged commit 40a9ecc into main Nov 14, 2024
6 checks passed
@Funkatronics Funkatronics deleted the wallet-standard-remote-wallet branch November 14, 2024 20:41
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