browser-rpc 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +25 -22
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # browser-rpc
1
+ # Browser RPC Proxy
2
2
 
3
3
  A local RPC proxy that routes Ethereum transactions through your browser wallet instead of requiring private keys in `.env` files.
4
4
 
@@ -48,11 +48,32 @@ npx browser-rpc --rpc https://mainnet.base.org
48
48
  browser-rpc --rpc https://mainnet.base.org
49
49
  ```
50
50
 
51
- 2. Configure your tool to use `http://localhost:8545` as the RPC URL
51
+ 2. Configure your script to use `http://localhost:8545` as the RPC URL
52
52
 
53
53
  3. Run your script - when it sends a transaction, your browser will open for approval
54
54
 
55
- ### With Foundry
55
+ ### With viem
56
+
57
+ ```typescript
58
+ import { createWalletClient, http } from 'viem'
59
+ import { base } from 'viem/chains'
60
+
61
+ const client = createWalletClient({
62
+ chain: base,
63
+ transport: http('http://localhost:8545', {
64
+ timeout: 1000 * 60, // Viem default timeout is 10 seconds
65
+ }),
66
+ })
67
+
68
+ // This will open your browser for approval
69
+ const hash = await client.sendTransaction({
70
+ account: null,
71
+ to: '0x...',
72
+ value: parseEther('0.01'),
73
+ })
74
+ ```
75
+
76
+ ### With Foundry (not tested)
56
77
 
57
78
  ```bash
58
79
  # Start the proxy
@@ -62,7 +83,7 @@ browser-rpc --rpc https://mainnet.base.org
62
83
  forge script script/Deploy.s.sol --rpc-url http://localhost:8545 --broadcast
63
84
  ```
64
85
 
65
- ### With Hardhat
86
+ ### With Hardhat (not tested)
66
87
 
67
88
  ```javascript
68
89
  // hardhat.config.js
@@ -79,24 +100,6 @@ module.exports = {
79
100
  npx hardhat run scripts/deploy.js --network browserRpc
80
101
  ```
81
102
 
82
- ### With viem
83
-
84
- ```typescript
85
- import { createWalletClient, http } from 'viem'
86
- import { base } from 'viem/chains'
87
-
88
- const client = createWalletClient({
89
- chain: base,
90
- transport: http('http://localhost:8545'),
91
- })
92
-
93
- // This will open your browser for approval
94
- const hash = await client.sendTransaction({
95
- to: '0x...',
96
- value: parseEther('0.01'),
97
- })
98
- ```
99
-
100
103
  ## CLI Options
101
104
 
102
105
  | Flag | Default | Description |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browser-rpc",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Local RPC proxy that routes Ethereum transactions through your browser wallet",
5
5
  "type": "module",
6
6
  "repository": {