Closed grod220 closed 1 month ago
the PenumbraProvider
interface is already designed so that all interactions with it can be the same, regradless of the software behind it. all that the prax-specific methods actually do is, they grab the penumbraprovider object identified by the prax id in the global.
at some point, generic equivalent methods existed, but must have been deleted from a PR before merge
currently, our client package ignores non-prax providers, if they are present.
We have an objective that eventually other wallets (leap, keplr, etc) will be able to serve as a Penumbra wallet. We already have a few issues with this in mind (https://github.com/penumbra-zone/web/issues/340, https://github.com/penumbra-zone/web/issues/341).
At the moment, web apps have a pretty simple set of things to utilize a penumbra wallet:
These rely upon the extension (ours or others) to implement a few things available globally:
isPraxInstalled
requires a specific manifest id exposed inthrowIfPraxNotAvailable
requires the extension to inject a penumbra field on thewindow
objectrequestPraxConnection
expects a specific method on that window penumbra fieldAll of this we handle for ourselves in extension/src/content-scripts. Side note: I'm not quite sure what would happen if two Penumbra-compatible wallets were installed.
Proposal
Create an interface to define the expectations for the extension serving as a Penumbra wallet. Here's an example interface:
And then perhaps the web app is required to pass it in themselves
Another benefit of the interface, is that each method's doc string could inform the extension developer where it needs to go (content scripts, service worker, etc).