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

Solana provider refactoring #23702

Closed
darkdh opened this issue Jun 27, 2022 · 0 comments · Fixed by brave/brave-core#13977
Closed

Solana provider refactoring #23702

darkdh opened this issue Jun 27, 2022 · 0 comments · Fixed by brave/brave-core#13977
Assignees

Comments

@darkdh
Copy link
Member

darkdh commented Jun 27, 2022

Remove disconnect handler

We are currently doing it in
https://github.com/brave/brave-core/blob/b2cc506b7d573033e845c771976ba031343edb38/components/brave_wallet/renderer/js_ethereum_provider.cc#L128-L132
and https://github.com/brave/brave-core/blob/b2cc506b7d573033e845c771976ba031343edb38/components/brave_wallet/renderer/js_solana_provider.cc#L188-L192

It's not necessary to do that because mojo would reconnects automatically.

Separate JSSolanaProvider from gin::Wrappable

we make JSSolanaProvider a WeakPtr,
pass that into the new wrappable class as the “delegate”
the new wrappable class just calls the existing methods on JSSolanaProvider after checking for null.
ex.

v8::Local<v8::Value> JSSolanaProviderWrapper::GetPublicKey(gin::Arguments* arguments) {
  if (!delegate)
    return v8::Null(isolate);

  return delegate->GetPublicKey(arguments);
}

Make JSSolanaProvider both gin::Wrappable and RederFrameObserver

Follow DomAutomationController and install it in BraveWalletRenderFrameObserver:: DidClearWindowObject
And then bind brave_wallet::mojom::SolanaProvider in RegisterAssociatedInterfaceBindersForRenderFrameHost
This deprecates Separate JSSolanaProvider from gin::Wrappable

cc @bridiver

@darkdh darkdh added priority/P3 The next thing for us to work on. It'll ride the trains. dev-concern OS/Desktop feature/web3/wallet/dapps labels Jun 27, 2022
@darkdh darkdh changed the title Wallet providers don't need to do manually mojo reconnect Solana provider refactoring Jun 27, 2022
@darkdh darkdh self-assigned this Jun 27, 2022
@darkdh darkdh added the QA/No label Jun 28, 2022
@brave-builds brave-builds added this to the 1.42.x - Nightly milestone Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants