A browser extension that provides Web3 wallet functionality for iTerm2's Browser using Foundry Cast as the backend.
This extension consists of:
- Browser Extension: Provides
window.ethereuminterface to web pages - Cast HTTP Server: Modified Foundry Cast tool with JSON-RPC HTTP server
- Transaction UI: In-page confirmation modals for transaction approval
manifest.json- Extension manifest (Manifest V3)background.js- Service worker handling Cast communicationcontent-script.js- Injectswindow.ethereumprovider into web pagesconfirmation-modal.html- Transaction confirmation UIconfirmation-modal.css- Styling for confirmation modal
Handles:
- Communication with Cast HTTP server on localhost:8545
- Translation between Web3 JSON-RPC and Cast commands
- Basic wallet operations (accounts, balance, transactions)
Provides:
- EIP-1193 compliant
window.ethereumprovider - Legacy Web3 compatibility methods
- Event handling for account/network changes
- Native in-page transaction confirmation
- Shows transaction details, gas estimates, fees
- User approval/rejection handling
- Modified Cast Tool: Fork Foundry Cast with HTTP server support
- iTerm2 Browser: Latest version with WebExtensions support
-
Install Modified Cast:
# Build cast with HTTP server support git clone [cast-fork-repo] cd foundry cargo build --release --bin cast cp target/release/cast /usr/local/bin/cast-web3
-
Start Cast HTTP Server:
cast-web3 --http-server --port 8545
-
Install Extension:
- Copy extension folder to iTerm2 extensions directory
- Enable in iTerm2 Browser settings
-
Start Cast HTTP server:
cast-web3 --http-server
-
Create or import wallet:
cast-web3 wallet new # Create new wallet # or cast-web3 wallet import --private-key 0x... # Import existing
-
Extension automatically connects to Cast server
The extension provides a standard window.ethereum interface:
// Connect to wallet
const accounts = await ethereum.request({ method: 'eth_requestAccounts' });
// Get balance
const balance = await ethereum.request({
method: 'eth_getBalance',
params: [accounts[0], 'latest']
});
// Send transaction
const txHash = await ethereum.request({
method: 'eth_sendTransaction',
params: [{
from: accounts[0],
to: '0x...',
value: '0x1000000000000000000' // 1 ETH in wei
}]
});eth_requestAccounts- Connect walleteth_accounts- Get connected accounts
eth_chainId- Get current chain IDnet_version- Get network version
eth_getBalance- Get account balanceeth_sendTransaction- Send transactioneth_call- Call contract methodeth_estimateGas- Estimate gas for transaction
The extension requires a modified version of Foundry Cast with HTTP server support:
cast --http-server- Start JSON-RPC HTTP servercast wallet list- List available accounts (JSON)- Additional JSON output modes for all commands
POST /- JSON-RPC endpoint for all Cast operationsGET /health- Server health check
eth_getBalance→cast balanceeth_sendTransaction→cast sendeth_call→cast calleth_chainId→cast chain-id
web3-wallet-extension/
├── manifest.json
├── background.js
├── content-script.js
├── confirmation-modal.html
├── confirmation-modal.css
└── README.md
- Load extension in iTerm2 Browser
- Navigate to a Web3 dApp (e.g., Uniswap)
- Connect wallet and test transactions
- Check browser console for Web3 provider logs
- Monitor Cast server logs for RPC requests
- Use iTerm2's extension debugging tools
- Extension runs in isolated context
- Private keys managed by Cast (not extension)
- Transaction confirmation required for all sends
- No automatic transaction approvals
- Hardware wallet support via Cast
- Multi-network switching
- Transaction history
- Gas optimization
- dApp permissions system