@walletchan/rpc 0.1.0
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.
- package/LICENSE.md +9 -0
- package/README.md +166 -0
- package/SKILL.md +149 -0
- package/dist/chains.d.ts +20 -0
- package/dist/chains.d.ts.map +1 -0
- package/dist/chains.js +130 -0
- package/dist/chains.js.map +1 -0
- package/dist/cli.d.ts +14 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +78 -0
- package/dist/cli.js.map +1 -0
- package/dist/clipboard.d.ts +7 -0
- package/dist/clipboard.d.ts.map +1 -0
- package/dist/clipboard.js +75 -0
- package/dist/clipboard.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +104 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +21 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +117 -0
- package/dist/logger.js.map +1 -0
- package/dist/rpcHandler.d.ts +14 -0
- package/dist/rpcHandler.d.ts.map +1 -0
- package/dist/rpcHandler.js +197 -0
- package/dist/rpcHandler.js.map +1 -0
- package/dist/rpcServer.d.ts +5 -0
- package/dist/rpcServer.d.ts.map +1 -0
- package/dist/rpcServer.js +59 -0
- package/dist/rpcServer.js.map +1 -0
- package/dist/rpcTypes.d.ts +29 -0
- package/dist/rpcTypes.d.ts.map +1 -0
- package/dist/rpcTypes.js +39 -0
- package/dist/rpcTypes.js.map +1 -0
- package/dist/skill.d.ts +4 -0
- package/dist/skill.d.ts.map +1 -0
- package/dist/skill.js +158 -0
- package/dist/skill.js.map +1 -0
- package/dist/upstream.d.ts +4 -0
- package/dist/upstream.d.ts.map +1 -0
- package/dist/upstream.js +21 -0
- package/dist/upstream.js.map +1 -0
- package/dist/walletConnect.d.ts +44 -0
- package/dist/walletConnect.d.ts.map +1 -0
- package/dist/walletConnect.js +277 -0
- package/dist/walletConnect.js.map +1 -0
- package/package.json +63 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021-2025 Apoorv Lathey
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# WalletChan RPC
|
|
2
|
+
|
|
3
|
+
Local Ethereum JSON-RPC server for WalletChan approvals.
|
|
4
|
+
|
|
5
|
+
WalletChan RPC gives scripts, CLIs, and AI agents a standard local RPC endpoint while keeping transaction and signature approval inside the user's connected wallet. Tools send normal Ethereum JSON-RPC to `localhost`; [WalletChan](https://walletchan.com) receives the request over WalletConnect and asks the user to approve it.
|
|
6
|
+
|
|
7
|
+
> Agent skill: [SKILL.md](https://raw.githubusercontent.com/apoorvlathey/walletchan/master/apps/walletchan-rpc/SKILL.md)
|
|
8
|
+
|
|
9
|
+
Use it for:
|
|
10
|
+
|
|
11
|
+
- Giving AI agents wallet access through a local RPC, with every send or signature still requiring user approval
|
|
12
|
+
- Foundry, Cast, viem, ethers, shell scripts, or any JSON-RPC client
|
|
13
|
+
- User-approved sends, signatures, and ERC-5792 `wallet_sendCalls` batches
|
|
14
|
+
- WalletConnect-compatible wallets, including [WalletChan](https://walletchan.com) and many mobile wallets
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
Published package, choose one:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# npm
|
|
22
|
+
npx @walletchan/rpc --chain base
|
|
23
|
+
|
|
24
|
+
# pnpm
|
|
25
|
+
pnpm dlx @walletchan/rpc --chain base
|
|
26
|
+
|
|
27
|
+
# Yarn
|
|
28
|
+
yarn dlx @walletchan/rpc --chain base
|
|
29
|
+
|
|
30
|
+
# Bun
|
|
31
|
+
bunx @walletchan/rpc --chain base
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
From this repo:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pnpm dev:walletchan-rpc --chain base
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
On first use, the CLI copies the `wc:` URI to your clipboard, then prints a terminal QR code and raw URI.
|
|
41
|
+
|
|
42
|
+
- WalletChan extension: open More -> WalletConnect and paste.
|
|
43
|
+
- Mobile wallets: scan the QR code.
|
|
44
|
+
|
|
45
|
+
The local RPC and `SKILL.md` endpoint start immediately at `http://127.0.0.1:4209` by default. Wallet requests become available after the wallet session is approved.
|
|
46
|
+
|
|
47
|
+
## Agent Skill
|
|
48
|
+
|
|
49
|
+
Agents can fetch the live local skill/manual from the running RPC:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
curl http://127.0.0.1:4209/SKILL.md
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The live skill includes the current RPC URL, approved account, active chain, and batching state.
|
|
56
|
+
|
|
57
|
+
## Chains
|
|
58
|
+
|
|
59
|
+
Named chains are built in:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
walletchan-rpc --chain base
|
|
63
|
+
walletchan-rpc --chain base --chain ethereum
|
|
64
|
+
walletchan-rpc --chain polygon --port 4210
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Supported names:
|
|
68
|
+
|
|
69
|
+
| Name | Chain ID | Default RPC |
|
|
70
|
+
| ---------- | -------- | --------------------------------- |
|
|
71
|
+
| `base` | 8453 | `https://mainnet.base.org` |
|
|
72
|
+
| `ethereum` | 1 | `https://eth.llamarpc.com` |
|
|
73
|
+
| `megaeth` | 4326 | `https://mainnet.megaeth.com/rpc` |
|
|
74
|
+
| `polygon` | 137 | `https://polygon-rpc.com` |
|
|
75
|
+
| `unichain` | 130 | `https://mainnet.unichain.org` |
|
|
76
|
+
|
|
77
|
+
Override RPC URLs per selected chain:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
walletchan-rpc --chain base --rpc base=https://mainnet.base.org
|
|
81
|
+
walletchan-rpc --chain 84532 --rpc 84532=https://sepolia.base.org
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Batching
|
|
85
|
+
|
|
86
|
+
ERC-5792 batching is enabled by default. The WalletConnect proposal includes:
|
|
87
|
+
|
|
88
|
+
- `wallet_getCapabilities`
|
|
89
|
+
- `wallet_sendCalls`
|
|
90
|
+
- `wallet_getCallsStatus`
|
|
91
|
+
- `wallet_showCallsStatus`
|
|
92
|
+
|
|
93
|
+
For wallets that do not support batching:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
walletchan-rpc --chain base --skip-batching
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## JSON-RPC Behavior
|
|
100
|
+
|
|
101
|
+
Wallet requests are sent through WalletConnect:
|
|
102
|
+
|
|
103
|
+
- `eth_sendTransaction`
|
|
104
|
+
- `personal_sign`
|
|
105
|
+
- `eth_signTypedData_v3`
|
|
106
|
+
- `eth_signTypedData_v4`
|
|
107
|
+
- ERC-5792 methods, unless `--skip-batching` is set
|
|
108
|
+
|
|
109
|
+
Read-only and unknown methods are forwarded to the active chain's upstream RPC.
|
|
110
|
+
|
|
111
|
+
Local methods:
|
|
112
|
+
|
|
113
|
+
- `eth_accounts`
|
|
114
|
+
- `eth_requestAccounts`
|
|
115
|
+
- `eth_chainId`
|
|
116
|
+
- `net_version`
|
|
117
|
+
- `web3_clientVersion`
|
|
118
|
+
- `wallet_switchEthereumChain`
|
|
119
|
+
|
|
120
|
+
Rejected methods:
|
|
121
|
+
|
|
122
|
+
- `eth_sendRawTransaction`
|
|
123
|
+
- `eth_sign`
|
|
124
|
+
- `eth_signTransaction`
|
|
125
|
+
|
|
126
|
+
## Session Lifecycle
|
|
127
|
+
|
|
128
|
+
WalletConnect sessions persist across CLI restarts by default. If a compatible stored session exists for the same host and port, the CLI reuses it and skips the QR/paste flow.
|
|
129
|
+
|
|
130
|
+
To discard stored sessions and force a fresh pairing:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
walletchan-rpc --chain base --force-new-session
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Use `--force-new-session` when switching wallets, changing to a wallet that supports different methods, or intentionally revoking stale local session state.
|
|
137
|
+
|
|
138
|
+
## Environment
|
|
139
|
+
|
|
140
|
+
`WALLETCONNECT_PROJECT_ID` is optional. If omitted, the CLI uses WalletChan's default public WalletConnect project ID.
|
|
141
|
+
|
|
142
|
+
## Foundry
|
|
143
|
+
|
|
144
|
+
Foundry is optional. WalletChan RPC is a standard JSON-RPC endpoint and is not restricted to Foundry.
|
|
145
|
+
|
|
146
|
+
For a single call, agents should usually prefer `cast send` because it avoids creating a full Foundry script. Use Foundry's unlocked-account path so it sends `eth_sendTransaction` to the local RPC:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
cast send 0xContractAddress \
|
|
150
|
+
"transfer(address,uint256)" 0xRecipient 1000000000000000000 \
|
|
151
|
+
--rpc-url http://127.0.0.1:4209 \
|
|
152
|
+
--unlocked \
|
|
153
|
+
--from 0xYourConnectedAddress
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
For larger flows that already live in a script, use the same unlocked-account path:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
forge script script/Deploy.s.sol \
|
|
160
|
+
--rpc-url http://127.0.0.1:4209 \
|
|
161
|
+
--broadcast \
|
|
162
|
+
--unlocked \
|
|
163
|
+
--sender 0xYourConnectedAddress
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Do not pass a private key to Foundry for this flow. Signed raw transactions are rejected because they bypass WalletChan approval.
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: walletchan-rpc
|
|
3
|
+
description: Use when sending Ethereum JSON-RPC, Foundry, or ERC-5792 wallet_sendCalls requests through a local WalletChan RPC server with user wallet approval.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# WalletChan RPC
|
|
7
|
+
|
|
8
|
+
WalletChan RPC is a local JSON-RPC proxy for wallet-approved Ethereum transactions and signatures. A user starts the CLI, approves or reuses a WalletConnect session, and then agents or tools send standard JSON-RPC to the local server.
|
|
9
|
+
|
|
10
|
+
Package README: https://github.com/apoorvlathey/walletchan/blob/master/apps/walletchan-rpc/README.md
|
|
11
|
+
|
|
12
|
+
## Package Setup
|
|
13
|
+
|
|
14
|
+
If WalletChan RPC is not already running, ask the user to start it. For Base mainnet:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# npm
|
|
18
|
+
npx @walletchan/rpc --chain base
|
|
19
|
+
|
|
20
|
+
# pnpm
|
|
21
|
+
pnpm dlx @walletchan/rpc --chain base
|
|
22
|
+
|
|
23
|
+
# Yarn
|
|
24
|
+
yarn dlx @walletchan/rpc --chain base
|
|
25
|
+
|
|
26
|
+
# Bun
|
|
27
|
+
bunx @walletchan/rpc --chain base
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The CLI starts the local RPC and `SKILL.md` endpoint immediately, then displays a WalletConnect QR/URI if no reusable session exists. The user must approve the WalletConnect session before wallet send/sign requests can succeed. Stored WalletConnect sessions are reused across CLI restarts by default.
|
|
31
|
+
|
|
32
|
+
When the RPC is running, prefer the live local skill because it contains the exact URL, connected account, active chain, and batching state:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
curl -s http://127.0.0.1:4209/SKILL.md
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The default local RPC URL is `http://127.0.0.1:4209`; the user may choose a different port with `--port`.
|
|
39
|
+
|
|
40
|
+
## How To Use
|
|
41
|
+
|
|
42
|
+
Send JSON-RPC over HTTP to the local RPC URL, usually `http://127.0.0.1:4209` or `http://127.0.0.1:4209/rpc`. Any JSON-RPC client can use this endpoint, including JavaScript code, shell scripts, viem, ethers, Foundry, or an AI agent.
|
|
43
|
+
|
|
44
|
+
Use these wallet methods:
|
|
45
|
+
|
|
46
|
+
- `eth_sendTransaction`
|
|
47
|
+
- `personal_sign`
|
|
48
|
+
- `eth_signTypedData_v3`
|
|
49
|
+
- `eth_signTypedData_v4`
|
|
50
|
+
- `wallet_sendCalls`
|
|
51
|
+
- `wallet_getCallsStatus`
|
|
52
|
+
- `wallet_showCallsStatus`
|
|
53
|
+
- `wallet_getCapabilities`
|
|
54
|
+
|
|
55
|
+
Read-only JSON-RPC methods may be forwarded to the configured upstream RPC. Local account and chain methods include `eth_accounts`, `eth_requestAccounts`, `eth_chainId`, `net_version`, `web3_clientVersion`, and `wallet_switchEthereumChain`.
|
|
56
|
+
|
|
57
|
+
## Safety Rules
|
|
58
|
+
|
|
59
|
+
- Use `eth_sendTransaction` for sends. Never use `eth_sendRawTransaction`, `eth_sign`, or `eth_signTransaction`.
|
|
60
|
+
- Every send/sign/batch request opens a user approval prompt in the connected wallet.
|
|
61
|
+
- If the wallet rejects a request, report the rejection to the user. Do not retry rejected sends automatically.
|
|
62
|
+
- Use only an approved account from `eth_accounts` as `from` or Foundry `--sender`.
|
|
63
|
+
- If a request targets a different configured chain, include the target `chainId` or call `wallet_switchEthereumChain` first.
|
|
64
|
+
- WalletConnect sessions persist across CLI restarts. Ask the user to restart with `--force-new-session` only when they want a fresh pairing.
|
|
65
|
+
|
|
66
|
+
## Discovery
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
curl -s http://127.0.0.1:4209/health
|
|
70
|
+
curl -s http://127.0.0.1:4209/session
|
|
71
|
+
curl -s http://127.0.0.1:4209/SKILL.md
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
curl -s http://127.0.0.1:4209 \
|
|
76
|
+
-H 'content-type: application/json' \
|
|
77
|
+
-d '{"jsonrpc":"2.0","id":1,"method":"eth_accounts","params":[]}'
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## wallet_sendCalls
|
|
81
|
+
|
|
82
|
+
When batching is enabled, prefer `wallet_sendCalls` for related write actions that should be reviewed and submitted together. The goal is to reduce the number of wallet approval popups for one user intent while preserving a clear wallet confirmation.
|
|
83
|
+
|
|
84
|
+
Use `wallet_sendCalls` when:
|
|
85
|
+
|
|
86
|
+
- A later call depends on an earlier call in the same user intent.
|
|
87
|
+
- The user asks for several related sends or contract writes, such as sending tokens or ETH to multiple addresses, distributing payments, claiming several rewards, minting several NFTs from the same collection, or doing several same-protocol actions.
|
|
88
|
+
- The flow would otherwise require multiple approvals for one task, such as `approve + swap`, `approve + stake`, `approve + deposit`, `approve + bridge`, or `claim + stake`.
|
|
89
|
+
- The calls must target one chain and use the same approved `from` account.
|
|
90
|
+
|
|
91
|
+
For dependent actions such as `approve + swap` or `approve + stake`, set `atomicRequired: true` so the wallet must execute all calls atomically or none of the material effects should land onchain. Put calls in execution order: approval first, then the action that consumes the approval. For independent but related actions, such as sending tokens to multiple recipients, still prefer one `wallet_sendCalls` request so the user reviews one batch instead of several popups.
|
|
92
|
+
|
|
93
|
+
Do not use `wallet_sendCalls` for unrelated actions that the user should consider separately, for cross-chain flows, or as a blind retry after the user rejects a request. If the user query describes one cohesive task with multiple same-chain writes, batch it.
|
|
94
|
+
|
|
95
|
+
After `wallet_sendCalls`, record the returned bundle ID. WalletChan returns an object with `id`; some wallets may call this `batchId`. Poll `wallet_getCallsStatus` with that ID until status is terminal, or use `wallet_showCallsStatus` to open the bundle's explorer view.
|
|
96
|
+
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"jsonrpc": "2.0",
|
|
100
|
+
"id": 1,
|
|
101
|
+
"method": "wallet_sendCalls",
|
|
102
|
+
"params": [
|
|
103
|
+
{
|
|
104
|
+
"version": "2.0.0",
|
|
105
|
+
"chainId": "0x2105",
|
|
106
|
+
"from": "0xYourApprovedAccount",
|
|
107
|
+
"atomicRequired": true,
|
|
108
|
+
"calls": [
|
|
109
|
+
{
|
|
110
|
+
"to": "0xTokenAddress",
|
|
111
|
+
"value": "0x0",
|
|
112
|
+
"data": "0xApproveCalldata"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"to": "0xSwapOrStakeContract",
|
|
116
|
+
"value": "0x0",
|
|
117
|
+
"data": "0xSwapOrStakeCalldata"
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Optional Foundry Examples
|
|
126
|
+
|
|
127
|
+
These examples are optional. WalletChan RPC is a standard JSON-RPC endpoint and is not restricted to Foundry.
|
|
128
|
+
|
|
129
|
+
For a single call, `cast send` is often convenient because it avoids creating a full Foundry script. Use Foundry's unlocked-account path so Foundry sends `eth_sendTransaction` to WalletChan RPC:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
cast send 0xContractAddress \
|
|
133
|
+
"transfer(address,uint256)" 0xRecipient 1000000000000000000 \
|
|
134
|
+
--rpc-url http://127.0.0.1:4209 \
|
|
135
|
+
--unlocked \
|
|
136
|
+
--from 0xYourApprovedAccount
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
For larger flows that already live in a script, use the same unlocked-account path:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
forge script script/Deploy.s.sol \
|
|
143
|
+
--rpc-url http://127.0.0.1:4209 \
|
|
144
|
+
--broadcast \
|
|
145
|
+
--unlocked \
|
|
146
|
+
--sender 0xYourApprovedAccount
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Do not pass a private key for this flow.
|
package/dist/chains.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface RuntimeChain {
|
|
2
|
+
name: string;
|
|
3
|
+
displayName: string;
|
|
4
|
+
chainId: number;
|
|
5
|
+
rpcUrl: string;
|
|
6
|
+
}
|
|
7
|
+
interface BuiltInChain extends RuntimeChain {
|
|
8
|
+
aliases: string[];
|
|
9
|
+
}
|
|
10
|
+
export declare function toHexChainId(chainId: number): string;
|
|
11
|
+
export declare function toCaip2(chainId: number): string;
|
|
12
|
+
export declare function parseChainId(value: unknown): number | null;
|
|
13
|
+
export declare function findBuiltInChain(value: string): BuiltInChain | null;
|
|
14
|
+
export declare function resolveChainInput(value: string): RuntimeChain;
|
|
15
|
+
export declare function resolveRuntimeChains(chainInputs: string[], rpcInputs: string[]): RuntimeChain[];
|
|
16
|
+
export declare function getChainById(chains: RuntimeChain[], chainId: number): RuntimeChain | null;
|
|
17
|
+
export declare function formatChain(chain: RuntimeChain): string;
|
|
18
|
+
export declare function formatChains(chains: RuntimeChain[]): string;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=chains.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chains.d.ts","sourceRoot":"","sources":["../src/chains.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,YAAa,SAAQ,YAAY;IACzC,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAwCD,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAU1D;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAYnE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,CAkB7D;AAkBD,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,MAAM,EAAE,EACrB,SAAS,EAAE,MAAM,EAAE,GAClB,YAAY,EAAE,CA8BhB;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAEzF;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAEvD;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,CAE3D"}
|
package/dist/chains.js
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
const BUILTIN_CHAINS = [
|
|
2
|
+
{
|
|
3
|
+
name: "base",
|
|
4
|
+
displayName: "Base",
|
|
5
|
+
chainId: 8453,
|
|
6
|
+
rpcUrl: "https://mainnet.base.org",
|
|
7
|
+
aliases: ["base-mainnet"],
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
name: "ethereum",
|
|
11
|
+
displayName: "Ethereum",
|
|
12
|
+
chainId: 1,
|
|
13
|
+
rpcUrl: "https://eth.llamarpc.com",
|
|
14
|
+
aliases: ["eth", "mainnet"],
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: "megaeth",
|
|
18
|
+
displayName: "MegaETH",
|
|
19
|
+
chainId: 4326,
|
|
20
|
+
rpcUrl: "https://mainnet.megaeth.com/rpc",
|
|
21
|
+
aliases: ["mega"],
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: "polygon",
|
|
25
|
+
displayName: "Polygon",
|
|
26
|
+
chainId: 137,
|
|
27
|
+
rpcUrl: "https://polygon-rpc.com",
|
|
28
|
+
aliases: ["matic"],
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: "unichain",
|
|
32
|
+
displayName: "Unichain",
|
|
33
|
+
chainId: 130,
|
|
34
|
+
rpcUrl: "https://mainnet.unichain.org",
|
|
35
|
+
aliases: ["uni"],
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
export function toHexChainId(chainId) {
|
|
39
|
+
return `0x${chainId.toString(16)}`;
|
|
40
|
+
}
|
|
41
|
+
export function toCaip2(chainId) {
|
|
42
|
+
return `eip155:${chainId}`;
|
|
43
|
+
}
|
|
44
|
+
export function parseChainId(value) {
|
|
45
|
+
if (typeof value === "number" && Number.isInteger(value) && value > 0) {
|
|
46
|
+
return value;
|
|
47
|
+
}
|
|
48
|
+
if (typeof value !== "string" || value.trim() === "")
|
|
49
|
+
return null;
|
|
50
|
+
const trimmed = value.trim();
|
|
51
|
+
const parsed = trimmed.startsWith("0x")
|
|
52
|
+
? Number.parseInt(trimmed, 16)
|
|
53
|
+
: Number(trimmed);
|
|
54
|
+
return Number.isInteger(parsed) && parsed > 0 ? parsed : null;
|
|
55
|
+
}
|
|
56
|
+
export function findBuiltInChain(value) {
|
|
57
|
+
const normalized = value.trim().toLowerCase();
|
|
58
|
+
const chainId = parseChainId(normalized);
|
|
59
|
+
return (BUILTIN_CHAINS.find((chain) => {
|
|
60
|
+
return (chain.name === normalized ||
|
|
61
|
+
chain.aliases.includes(normalized) ||
|
|
62
|
+
chain.chainId === chainId);
|
|
63
|
+
}) || null);
|
|
64
|
+
}
|
|
65
|
+
export function resolveChainInput(value) {
|
|
66
|
+
const builtIn = findBuiltInChain(value);
|
|
67
|
+
if (builtIn) {
|
|
68
|
+
const { aliases: _aliases, ...chain } = builtIn;
|
|
69
|
+
return chain;
|
|
70
|
+
}
|
|
71
|
+
const chainId = parseChainId(value);
|
|
72
|
+
if (!chainId) {
|
|
73
|
+
throw new Error(`Unknown chain "${value}". Use a built-in name or numeric chain ID.`);
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
name: String(chainId),
|
|
77
|
+
displayName: `Chain ${chainId}`,
|
|
78
|
+
chainId,
|
|
79
|
+
rpcUrl: "",
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function parseRpcOverride(value) {
|
|
83
|
+
const separator = value.indexOf("=");
|
|
84
|
+
if (separator <= 0 || separator === value.length - 1) {
|
|
85
|
+
throw new Error(`Invalid --rpc value "${value}". Use chain=url, e.g. base=https://...`);
|
|
86
|
+
}
|
|
87
|
+
const key = value.slice(0, separator).trim();
|
|
88
|
+
const rpcUrl = value.slice(separator + 1).trim();
|
|
89
|
+
const parsedUrl = new URL(rpcUrl);
|
|
90
|
+
if (parsedUrl.protocol !== "http:" && parsedUrl.protocol !== "https:") {
|
|
91
|
+
throw new Error(`RPC URL for ${key} must use http or https`);
|
|
92
|
+
}
|
|
93
|
+
return { chain: resolveChainInput(key), rpcUrl };
|
|
94
|
+
}
|
|
95
|
+
export function resolveRuntimeChains(chainInputs, rpcInputs) {
|
|
96
|
+
const selectedInputs = chainInputs.length > 0 ? chainInputs : ["base"];
|
|
97
|
+
const chains = new Map();
|
|
98
|
+
for (const input of selectedInputs) {
|
|
99
|
+
const chain = resolveChainInput(input);
|
|
100
|
+
chains.set(chain.chainId, chain);
|
|
101
|
+
}
|
|
102
|
+
for (const input of rpcInputs) {
|
|
103
|
+
const override = parseRpcOverride(input);
|
|
104
|
+
const selected = chains.get(override.chain.chainId);
|
|
105
|
+
if (!selected) {
|
|
106
|
+
throw new Error(`RPC override ${override.chain.name}=... does not match a selected chain. Add --chain ${override.chain.name}.`);
|
|
107
|
+
}
|
|
108
|
+
chains.set(override.chain.chainId, {
|
|
109
|
+
...selected,
|
|
110
|
+
rpcUrl: override.rpcUrl,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
const resolved = Array.from(chains.values());
|
|
114
|
+
for (const chain of resolved) {
|
|
115
|
+
if (!chain.rpcUrl) {
|
|
116
|
+
throw new Error(`Missing RPC URL for chain ${chain.name}. Add --rpc ${chain.name}=https://...`);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return resolved;
|
|
120
|
+
}
|
|
121
|
+
export function getChainById(chains, chainId) {
|
|
122
|
+
return chains.find((chain) => chain.chainId === chainId) || null;
|
|
123
|
+
}
|
|
124
|
+
export function formatChain(chain) {
|
|
125
|
+
return `${chain.name}(${chain.chainId})`;
|
|
126
|
+
}
|
|
127
|
+
export function formatChains(chains) {
|
|
128
|
+
return chains.map(formatChain).join(", ");
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=chains.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chains.js","sourceRoot":"","sources":["../src/chains.ts"],"names":[],"mappings":"AAWA,MAAM,cAAc,GAAmB;IACrC;QACE,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,MAAM;QACnB,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,0BAA0B;QAClC,OAAO,EAAE,CAAC,cAAc,CAAC;KAC1B;IACD;QACE,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,UAAU;QACvB,OAAO,EAAE,CAAC;QACV,MAAM,EAAE,0BAA0B;QAClC,OAAO,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC;KAC5B;IACD;QACE,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,SAAS;QACtB,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,iCAAiC;QACzC,OAAO,EAAE,CAAC,MAAM,CAAC;KAClB;IACD;QACE,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,SAAS;QACtB,OAAO,EAAE,GAAG;QACZ,MAAM,EAAE,yBAAyB;QACjC,OAAO,EAAE,CAAC,OAAO,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MAAM;SACxB,CAAC,CAAC;IACL,CAAC;IAED,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IAC7C,KAAK,MAAM,KAAK,IAAI,QAAQ,EAAE,CAAC;QAC7B,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,6BAA6B,KAAK,CAAC,IAAI,eAAe,KAAK,CAAC,IAAI,cAAc,CAAC,CAAC;QAClG,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAAsB,EAAE,OAAe;IAClE,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,KAAK,OAAO,CAAC,IAAI,IAAI,CAAC;AACnE,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAmB;IAC7C,OAAO,GAAG,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,OAAO,GAAG,CAAC;AAC3C,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAAsB;IACjD,OAAO,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC"}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type RuntimeChain } from "./chains.js";
|
|
2
|
+
export interface CliConfig {
|
|
3
|
+
chains: RuntimeChain[];
|
|
4
|
+
forceNewSession: boolean;
|
|
5
|
+
host: string;
|
|
6
|
+
includeBatching: boolean;
|
|
7
|
+
port: number;
|
|
8
|
+
projectId: string;
|
|
9
|
+
requestTimeoutSeconds: number;
|
|
10
|
+
upstreamTimeoutMs: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function parseCli(argv: string[]): CliConfig;
|
|
13
|
+
export declare function formatCliSummary(config: CliConfig): string;
|
|
14
|
+
//# sourceMappingURL=cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AACA,OAAO,EAAsC,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAKpF,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,eAAe,EAAE,OAAO,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,OAAO,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AA0BD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,SAAS,CAgElD;AAMD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAO1D"}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { formatChains, resolveRuntimeChains } from "./chains.js";
|
|
3
|
+
import { style } from "./logger.js";
|
|
4
|
+
const DEFAULT_PROJECT_ID = "56262dba600174595278ffdf73ceb06f";
|
|
5
|
+
function collect(value, previous) {
|
|
6
|
+
previous.push(value);
|
|
7
|
+
return previous;
|
|
8
|
+
}
|
|
9
|
+
function parsePositiveInteger(value, label) {
|
|
10
|
+
const parsed = Number(value);
|
|
11
|
+
if (!Number.isInteger(parsed) || parsed <= 0) {
|
|
12
|
+
throw new Error(`${label} must be a positive integer`);
|
|
13
|
+
}
|
|
14
|
+
return parsed;
|
|
15
|
+
}
|
|
16
|
+
export function parseCli(argv) {
|
|
17
|
+
const program = new Command();
|
|
18
|
+
program
|
|
19
|
+
.name("walletchan-rpc")
|
|
20
|
+
.description("Local JSON-RPC proxy that routes wallet requests through WalletConnect")
|
|
21
|
+
.option("-c, --chain <name-or-id>", "chain to expose; repeatable", collect, [])
|
|
22
|
+
.option("-r, --rpc <chain=url>", "override upstream RPC for a selected chain; repeatable", collect, [])
|
|
23
|
+
.option("-p, --port <number>", "local RPC port", "4209")
|
|
24
|
+
.option("--force-new-session", "discard stored WalletConnect sessions and show a fresh pairing URI")
|
|
25
|
+
.option("--project-id <id>", "WalletConnect project ID")
|
|
26
|
+
.option("--skip-batching", "do not require or expose ERC-5792 wallet_sendCalls")
|
|
27
|
+
.option("--request-timeout <seconds>", "WalletConnect request timeout", "300")
|
|
28
|
+
.option("--upstream-timeout <milliseconds>", "upstream RPC timeout", "15000")
|
|
29
|
+
.addHelpText("after", `
|
|
30
|
+
|
|
31
|
+
Examples:
|
|
32
|
+
walletchan-rpc --chain base
|
|
33
|
+
walletchan-rpc --chain base --chain ethereum
|
|
34
|
+
walletchan-rpc --chain base --rpc base=https://mainnet.base.org
|
|
35
|
+
walletchan-rpc --chain 84532 --rpc 84532=https://sepolia.base.org
|
|
36
|
+
`)
|
|
37
|
+
.parse(stripForwardedSeparator(argv));
|
|
38
|
+
const options = program.opts();
|
|
39
|
+
const projectId = options.projectId ||
|
|
40
|
+
process.env.WALLETCONNECT_PROJECT_ID ||
|
|
41
|
+
process.env.WC_PROJECT_ID ||
|
|
42
|
+
process.env.VITE_WALLETCONNECT_PROJECT_ID ||
|
|
43
|
+
process.env.VITE_WC_PROJECT_ID ||
|
|
44
|
+
DEFAULT_PROJECT_ID;
|
|
45
|
+
const requestTimeoutSeconds = parsePositiveInteger(options.requestTimeout, "--request-timeout");
|
|
46
|
+
if (requestTimeoutSeconds < 300) {
|
|
47
|
+
throw new Error("--request-timeout must be at least 300 seconds for WalletConnect");
|
|
48
|
+
}
|
|
49
|
+
const config = {
|
|
50
|
+
chains: resolveRuntimeChains(options.chain, options.rpc),
|
|
51
|
+
forceNewSession: Boolean(options.forceNewSession),
|
|
52
|
+
host: "127.0.0.1",
|
|
53
|
+
includeBatching: !options.skipBatching,
|
|
54
|
+
port: parsePositiveInteger(options.port, "--port"),
|
|
55
|
+
projectId,
|
|
56
|
+
requestTimeoutSeconds,
|
|
57
|
+
upstreamTimeoutMs: parsePositiveInteger(options.upstreamTimeout, "--upstream-timeout"),
|
|
58
|
+
};
|
|
59
|
+
if (config.port > 65535) {
|
|
60
|
+
throw new Error("--port must be between 1 and 65535");
|
|
61
|
+
}
|
|
62
|
+
if (!config.projectId) {
|
|
63
|
+
throw new Error("WalletConnect project ID is required");
|
|
64
|
+
}
|
|
65
|
+
return config;
|
|
66
|
+
}
|
|
67
|
+
function stripForwardedSeparator(argv) {
|
|
68
|
+
return argv.filter((value, index) => index < 2 || value !== "--");
|
|
69
|
+
}
|
|
70
|
+
export function formatCliSummary(config) {
|
|
71
|
+
return [
|
|
72
|
+
style.green(`Local RPC: http://${config.host}:${config.port}`),
|
|
73
|
+
style.purple(`SKILL.md: http://${config.host}:${config.port}/SKILL.md`),
|
|
74
|
+
`Chains: ${formatChains(config.chains)}`,
|
|
75
|
+
`Batching: ${config.includeBatching ? "enabled" : "disabled"}`,
|
|
76
|
+
].join("\n");
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAqB,MAAM,aAAa,CAAC;AACpF,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,MAAM,kBAAkB,GAAG,kCAAkC,CAAC;AAwB9D,SAAS,OAAO,CAAC,KAAa,EAAE,QAAkB;IAChD,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrB,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,oBAAoB,CAAC,KAAa,EAAE,KAAa;IACxD,MAAM,MAAM,GAA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