nodpay 0.2.0 → 0.2.1

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/README.md CHANGED
@@ -1,48 +1,48 @@
1
- # NodPay
1
+ # nodpay
2
2
 
3
- > Two minds, one wallet.
3
+ Agent toolkit for [NodPay](https://nodpay.ai) — propose on-chain payments from a shared wallet.
4
4
 
5
- AI agents propose on-chain payments. Humans approve with one tap. Self-custodial 2-of-3 multisig powered by [Safe](https://safe.global).
5
+ > **This package is for AI agents.** If you're a human, visit [nodpay.ai](https://nodpay.ai).
6
6
 
7
- ## Install
7
+ ## What NodPay does
8
8
 
9
- ```bash
10
- npx nodpay propose --safe 0x... --to 0x... --value-eth 0.01 --signer-type passkey
11
- ```
12
-
13
- No install needed — `npx` handles everything.
14
-
15
- ## What it does
9
+ You (an AI agent) and your human share a 2-of-3 multisig wallet. You propose transactions; the human approves or rejects each one. You cannot spend without their approval.
16
10
 
17
- 1. **Agent** generates a key and sends the user a wallet creation link
18
- 2. **User** opens the link, creates a passkey wallet in 30 seconds
19
- 3. **Agent** proposes transactions → user approves or rejects each one
20
-
21
- The wallet is an ERC-4337 Safe multisig. The agent holds 1 key, the user holds 2 (passkey + recovery). The agent cannot spend without human approval.
22
-
23
- ## Quick start
11
+ ## Usage
24
12
 
25
13
  ```bash
26
- # 1. Generate an agent key
27
- node -e "const w=require('ethers').Wallet.createRandom();console.log(w.address,w.privateKey)"
28
-
29
- # 2. Send user: https://nodpay.ai/?agent=YOUR_ADDRESS
30
-
31
- # 3. After user creates wallet, propose a transaction:
14
+ # No install needed
32
15
  NODPAY_AGENT_KEY=0x... npx nodpay propose \
33
16
  --safe 0xWALLET --to 0xRECIPIENT --value-eth 0.01 \
34
- --signer-type passkey --passkey-x 0x... --passkey-y 0x... --recovery 0x...
17
+ --signer-type passkey --passkey-x 0x... --passkey-y 0x...
35
18
  ```
36
19
 
37
- ## Docs
20
+ ## Full guide
21
+
22
+ **[nodpay.ai/skill.md](https://nodpay.ai/skill.md)** — complete setup + integration guide for agents (key generation, wallet creation, proposing, error handling).
23
+
24
+ ## How it works
25
+
26
+ 1. Agent generates a key → sends user a wallet creation link
27
+ 2. User creates a passkey wallet at nodpay.ai (30 seconds)
28
+ 3. Agent proposes transactions with `npx nodpay propose`
29
+ 4. User approves/rejects on their phone
38
30
 
39
- - **Full agent guide**: [nodpay.ai/skill.md](https://nodpay.ai/skill.md)
40
- - **Website**: [nodpay.ai](https://nodpay.ai)
31
+ ## Env
32
+
33
+ | Variable | Required | Description |
34
+ |----------|----------|-------------|
35
+ | `NODPAY_AGENT_KEY` | ✅ | Agent's private key (hex) |
41
36
 
42
37
  ## Supported chains
43
38
 
44
39
  Ethereum · Base · Arbitrum · Optimism · Polygon · Sepolia · Base Sepolia
45
40
 
41
+ ## Related
42
+
43
+ - [`@nodpay/core`](https://www.npmjs.com/package/@nodpay/core) — Protocol primitives (hash, decode, verify)
44
+ - [nodpay.ai](https://nodpay.ai) — Web app
45
+
46
46
  ## License
47
47
 
48
48
  MIT
package/SKILL.md CHANGED
@@ -68,6 +68,8 @@ Recovery Signer: 0x...
68
68
 
69
69
  **Store all fields** — you need them for proposing transactions.
70
70
 
71
+ **After wallet creation**, tell the user their wallet is ready and the address works on any supported chain. Briefly offer: *"Want to try a test transaction on a testnet first?"* — only guide to testnets (Sepolia, etc.) if the user says yes.
72
+
71
73
  #### Wallet file management
72
74
 
73
75
  Store wallet info in `.nodpay/wallets/` in your workspace root:
@@ -87,7 +89,6 @@ Each wallet file:
87
89
  "passkeyX": "0x...",
88
90
  "passkeyY": "0x...",
89
91
  "recovery": "0x...",
90
- "chain": "sepolia",
91
92
  "createdAt": "2025-01-01"
92
93
  }
93
94
  ```
@@ -172,7 +173,9 @@ Chain config (RPC, bundler, explorer) is auto-resolved from `references/networks
172
173
 
173
174
  ### Supported Chains
174
175
 
175
- `sepolia`, `ethereum`, `base`, `base_sepolia`, `arbitrum`, `optimism`, `polygon`
176
+ `ethereum`, `base`, `arbitrum`, `optimism`, `polygon`, `sepolia`, `base_sepolia`
177
+
178
+ The wallet address is the same across all chains (counterfactual). Chain is only relevant at transaction time. **Do not assume a default chain.** When the user asks to send, ask which chain if not specified.
176
179
 
177
180
  ---
178
181
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodpay",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "NodPay CLI — propose on-chain payments from agent-human shared wallets",
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,7 +9,6 @@
9
9
  "files": [
10
10
  "bin/",
11
11
  "scripts/",
12
- "references/",
13
12
  "SKILL.md"
14
13
  ],
15
14
  "repository": {
@@ -10,7 +10,7 @@
10
10
  * NODPAY_AGENT_KEY - Agent signer private key
11
11
  * SAFE_ADDRESS - Deployed Safe address (can be overridden with --safe)
12
12
  * RPC_URL - RPC endpoint
13
- * CHAIN_ID - Chain ID (default: 11155111)
13
+ * CHAIN_ID - Chain ID (required, no default)
14
14
  *
15
15
  * Args:
16
16
  * --to <address> - Recipient address
@@ -37,8 +37,12 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
37
37
  const PENDING_DIR = join(__dirname, '..', '.pending-txs');
38
38
  mkdirSync(PENDING_DIR, { recursive: true });
39
39
 
40
- const RPC_URL = process.env.RPC_URL || 'https://ethereum-sepolia-rpc.publicnode.com';
41
- const CHAIN_ID = process.env.CHAIN_ID || '11155111';
40
+ const RPC_URL = process.env.RPC_URL;
41
+ const CHAIN_ID = process.env.CHAIN_ID;
42
+ if (!RPC_URL || !CHAIN_ID) {
43
+ console.error('Error: RPC_URL and CHAIN_ID environment variables are required.\nSet them for your target chain. See references/networks.json for supported chains.');
44
+ process.exit(1);
45
+ }
42
46
  const ENTRYPOINT_ADDRESS = ENTRYPOINT;
43
47
  const NODPAY_AGENT_KEY = process.env.NODPAY_AGENT_KEY;
44
48
  const DEFAULT_SAFE = process.env.SAFE_ADDRESS;
@@ -1,84 +0,0 @@
1
- {
2
- "mainnet": {
3
- "ethereum": {
4
- "name": "Ethereum",
5
- "chainId": 1,
6
- "rpcUrl": "https://ethereum-rpc.publicnode.com",
7
- "txServiceUrl": "https://safe-transaction-mainnet.safe.global",
8
- "safePrefix": "eth",
9
- "explorerUrl": "https://etherscan.io",
10
- "explorerTxPath": "/tx/",
11
- "explorerAddrPath": "/address/",
12
- "nativeCurrency": "ETH"
13
- },
14
- "base": {
15
- "name": "Base",
16
- "chainId": 8453,
17
- "rpcUrl": "https://base-rpc.publicnode.com",
18
- "txServiceUrl": "https://safe-transaction-base.safe.global",
19
- "safePrefix": "base",
20
- "explorerUrl": "https://basescan.org",
21
- "explorerTxPath": "/tx/",
22
- "explorerAddrPath": "/address/",
23
- "nativeCurrency": "ETH",
24
- "gasSponsored": true
25
- },
26
- "arbitrum": {
27
- "name": "Arbitrum",
28
- "chainId": 42161,
29
- "rpcUrl": "https://arbitrum-one-rpc.publicnode.com",
30
- "txServiceUrl": "https://safe-transaction-arbitrum.safe.global",
31
- "safePrefix": "arb1",
32
- "explorerUrl": "https://arbiscan.io",
33
- "explorerTxPath": "/tx/",
34
- "explorerAddrPath": "/address/",
35
- "nativeCurrency": "ETH"
36
- },
37
- "polygon": {
38
- "name": "Polygon",
39
- "chainId": 137,
40
- "rpcUrl": "https://polygon-bor-rpc.publicnode.com",
41
- "txServiceUrl": "https://safe-transaction-polygon.safe.global",
42
- "safePrefix": "matic",
43
- "explorerUrl": "https://polygonscan.com",
44
- "explorerTxPath": "/tx/",
45
- "explorerAddrPath": "/address/",
46
- "nativeCurrency": "MATIC"
47
- },
48
- "optimism": {
49
- "name": "Optimism",
50
- "chainId": 10,
51
- "rpcUrl": "https://optimism-rpc.publicnode.com",
52
- "txServiceUrl": "https://safe-transaction-optimism.safe.global",
53
- "safePrefix": "oeth",
54
- "explorerUrl": "https://optimistic.etherscan.io",
55
- "explorerTxPath": "/tx/",
56
- "explorerAddrPath": "/address/",
57
- "nativeCurrency": "ETH"
58
- }
59
- },
60
- "testnet": {
61
- "sepolia": {
62
- "name": "Sepolia (Ethereum)",
63
- "chainId": 11155111,
64
- "rpcUrl": "https://ethereum-sepolia-rpc.publicnode.com",
65
- "txServiceUrl": "https://safe-transaction-sepolia.safe.global",
66
- "safePrefix": "sep",
67
- "explorerUrl": "https://sepolia.etherscan.io",
68
- "explorerTxPath": "/tx/",
69
- "explorerAddrPath": "/address/",
70
- "nativeCurrency": "ETH"
71
- },
72
- "base_sepolia": {
73
- "name": "Base Sepolia",
74
- "chainId": 84532,
75
- "rpcUrl": "https://base-sepolia-rpc.publicnode.com",
76
- "txServiceUrl": "https://safe-transaction-base-sepolia.safe.global",
77
- "safePrefix": "basesep",
78
- "explorerUrl": "https://sepolia.basescan.org",
79
- "explorerTxPath": "/tx/",
80
- "explorerAddrPath": "/address/",
81
- "nativeCurrency": "ETH"
82
- }
83
- }
84
- }