-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat: browser wallet #12302
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: master
Are you sure you want to change the base?
feat: browser wallet #12302
Conversation
…te & cookie token
…ndry into zerosnacks/browser-wallet
…rigin check, enforce injected session token protected by strict CSP in production
|
Only took us 4 years to have an alternative to Truffle Dashboard! Very much looking forward to this! Something to note (from someone who worked on this years ago): It is generally preferred to use the Browser RPC for all interactions, including onchain reads as well as receipts. Receipts is the obvious one since not all wallets give you the canonical receipt but some give you a namespaced hash (most common example is Safe Wallet). RPC interactions because some wallets apply additional state changes before execution, as well as ordered-transaction-priority. (Also would be down to help with the interface if that's useful!) |
|
Hi @akshatmittal, that's great to hear! I've now put it up for an initial review for the core team, once it is merged we gladly accept external contributions to improve the interface and feature set. |
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.
how do we rebuild the frontend?
| return Err(BrowserWalletError::Timeout { operation: "Transaction" }); | ||
| } | ||
|
|
||
| tokio::time::sleep(Duration::from_millis(100)).await; |
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.
nit: this works, but i believe u could listen to events by using tokio::sync::watch


Motivation
Closes: #8693
Solution
Adds a browser wallet interface for Foundry.
Currently support transaction signing for:
cast sendAnd message signing and typed data (EIP712) signing for:
cast wallet signTo test, build the branch:
To test Rabby / Metamask, load up the private key of Alice:
0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80To test Porto, load up a wallet with a balance on Base:
For development mode add the
--browser-disable-openand--browser-developmentflags.To test the sign typed data / message
Security
It has number of security features:
127.0.0.1can load up the pagemain.jsand is required to be passed in the header and the CSP enforces no other page can load theindex.html. This prevents random processes from interacting with the API (the session token is required for all endpoints).Considering the server is short-lived I think this should limit the attack surface to a significant degree.
Updating the interface
You can create a release as follows
This yields a release
Then download and unzip the
dist.tar.gzand update the build files & commitThis could also be automated in a
syncworkflow similar to how we updateforge-std, I haven't gotten around to that just yet.PR Checklist