nodpay 0.2.0 → 0.2.2
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 +28 -28
- package/SKILL.md +7 -2
- package/package.json +4 -2
- package/scripts/propose.mjs +7 -3
- package/references/networks.json +0 -84
package/README.md
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
#
|
|
1
|
+
# nodpay
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Agent toolkit for [NodPay](https://nodpay.ai) — propose on-chain payments from a shared wallet.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
> **This package is for AI agents.** If you're a human, visit [nodpay.ai](https://nodpay.ai).
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## What NodPay does
|
|
8
8
|
|
|
9
|
-
|
|
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
|
-
|
|
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
|
-
#
|
|
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...
|
|
17
|
+
--signer-type passkey --passkey-x 0x... --passkey-y 0x...
|
|
35
18
|
```
|
|
36
19
|
|
|
37
|
-
##
|
|
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
|
-
|
|
40
|
-
|
|
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
|
@@ -44,6 +44,8 @@ node -e "const w=require('ethers').Wallet.createRandom();console.log('Address:',
|
|
|
44
44
|
|
|
45
45
|
Store the private key as `NODPAY_AGENT_KEY` in your environment. The address is your public agent identity.
|
|
46
46
|
|
|
47
|
+
**⚠️ Storing the env var may trigger a restart.** Complete all config/env changes and wait for the restart to finish BEFORE sending any message to the user. Do not send messages and update config in parallel — the restart will truncate your message.
|
|
48
|
+
|
|
47
49
|
### 2. Send the user a wallet link
|
|
48
50
|
|
|
49
51
|
Replace `YOUR_AGENT_ADDRESS` with your EOA address and send:
|
|
@@ -68,6 +70,8 @@ Recovery Signer: 0x...
|
|
|
68
70
|
|
|
69
71
|
**Store all fields** — you need them for proposing transactions.
|
|
70
72
|
|
|
73
|
+
**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.
|
|
74
|
+
|
|
71
75
|
#### Wallet file management
|
|
72
76
|
|
|
73
77
|
Store wallet info in `.nodpay/wallets/` in your workspace root:
|
|
@@ -87,7 +91,6 @@ Each wallet file:
|
|
|
87
91
|
"passkeyX": "0x...",
|
|
88
92
|
"passkeyY": "0x...",
|
|
89
93
|
"recovery": "0x...",
|
|
90
|
-
"chain": "sepolia",
|
|
91
94
|
"createdAt": "2025-01-01"
|
|
92
95
|
}
|
|
93
96
|
```
|
|
@@ -172,7 +175,9 @@ Chain config (RPC, bundler, explorer) is auto-resolved from `references/networks
|
|
|
172
175
|
|
|
173
176
|
### Supported Chains
|
|
174
177
|
|
|
175
|
-
`
|
|
178
|
+
`ethereum`, `base`, `arbitrum`, `optimism`, `polygon`, `sepolia`, `base_sepolia`
|
|
179
|
+
|
|
180
|
+
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
181
|
|
|
177
182
|
---
|
|
178
183
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nodpay",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
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": {
|
|
@@ -28,6 +27,9 @@
|
|
|
28
27
|
],
|
|
29
28
|
"author": "xhyumiracle",
|
|
30
29
|
"license": "MIT",
|
|
30
|
+
"scripts": {
|
|
31
|
+
"postpublish": "curl -s https://purge.jsdelivr.net/npm/nodpay@latest/SKILL.md > /dev/null && echo 'jsdelivr cache purged'"
|
|
32
|
+
},
|
|
31
33
|
"dependencies": {
|
|
32
34
|
"@nodpay/core": "^0.1.0",
|
|
33
35
|
"@safe-global/relay-kit": "^4.1.1",
|
package/scripts/propose.mjs
CHANGED
|
@@ -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
|
|
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
|
|
41
|
-
const CHAIN_ID = process.env.CHAIN_ID
|
|
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;
|
package/references/networks.json
DELETED
|
@@ -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
|
-
}
|