paytaca-cli 0.6.1 → 0.7.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/README.md +153 -37
- package/dist/ai/autoRefill.d.ts +27 -0
- package/dist/ai/autoRefill.d.ts.map +1 -0
- package/dist/ai/autoRefill.js +75 -0
- package/dist/ai/autoRefill.js.map +1 -0
- package/dist/ai/client.d.ts +73 -0
- package/dist/ai/client.d.ts.map +1 -0
- package/dist/ai/client.js +90 -0
- package/dist/ai/client.js.map +1 -0
- package/dist/ai/config.d.ts +7 -0
- package/dist/ai/config.d.ts.map +1 -0
- package/dist/ai/config.js +16 -0
- package/dist/ai/config.js.map +1 -0
- package/dist/ai/configure.d.ts +61 -0
- package/dist/ai/configure.d.ts.map +1 -0
- package/dist/ai/configure.js +452 -0
- package/dist/ai/configure.js.map +1 -0
- package/dist/ai/credits.d.ts +27 -0
- package/dist/ai/credits.d.ts.map +1 -0
- package/dist/ai/credits.js +99 -0
- package/dist/ai/credits.js.map +1 -0
- package/dist/ai/models.d.ts +13 -0
- package/dist/ai/models.d.ts.map +1 -0
- package/dist/ai/models.js +49 -0
- package/dist/ai/models.js.map +1 -0
- package/dist/ai/oauth.d.ts +45 -0
- package/dist/ai/oauth.d.ts.map +1 -0
- package/dist/ai/oauth.js +137 -0
- package/dist/ai/oauth.js.map +1 -0
- package/dist/ai/purchase.d.ts +30 -0
- package/dist/ai/purchase.d.ts.map +1 -0
- package/dist/ai/purchase.js +456 -0
- package/dist/ai/purchase.js.map +1 -0
- package/dist/commands/address.d.ts.map +1 -1
- package/dist/commands/address.js +88 -36
- package/dist/commands/address.js.map +1 -1
- package/dist/commands/ai.d.ts +9 -0
- package/dist/commands/ai.d.ts.map +1 -0
- package/dist/commands/ai.js +675 -0
- package/dist/commands/ai.js.map +1 -0
- package/dist/commands/balance.d.ts.map +1 -1
- package/dist/commands/balance.js +68 -129
- package/dist/commands/balance.js.map +1 -1
- package/dist/commands/history.d.ts.map +1 -1
- package/dist/commands/history.js +38 -78
- package/dist/commands/history.js.map +1 -1
- package/dist/commands/mcp.d.ts +14 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +68 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/pay.js +1 -1
- package/dist/commands/pay.js.map +1 -1
- package/dist/commands/receive.d.ts +1 -8
- package/dist/commands/receive.d.ts.map +1 -1
- package/dist/commands/receive.js +51 -124
- package/dist/commands/receive.js.map +1 -1
- package/dist/commands/send.d.ts +0 -10
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +40 -50
- package/dist/commands/send.js.map +1 -1
- package/dist/commands/swap.js +1 -1
- package/dist/commands/swap.js.map +1 -1
- package/dist/commands/token.d.ts +1 -9
- package/dist/commands/token.d.ts.map +1 -1
- package/dist/commands/token.js +192 -289
- package/dist/commands/token.js.map +1 -1
- package/dist/core/context.d.ts +30 -0
- package/dist/core/context.d.ts.map +1 -0
- package/dist/core/context.js +45 -0
- package/dist/core/context.js.map +1 -0
- package/dist/core/wallet.d.ts +130 -0
- package/dist/core/wallet.d.ts.map +1 -0
- package/dist/core/wallet.js +276 -0
- package/dist/core/wallet.js.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp/server.d.ts +8 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +24 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tools.d.ts +5 -0
- package/dist/mcp/tools.d.ts.map +1 -0
- package/dist/mcp/tools.js +473 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/utils/format.d.ts +23 -0
- package/dist/utils/format.d.ts.map +1 -0
- package/dist/utils/format.js +62 -0
- package/dist/utils/format.js.map +1 -0
- package/dist/utils/x402.js +1 -1
- package/dist/utils/x402.js.map +1 -1
- package/dist/wallet/index.d.ts +13 -0
- package/dist/wallet/index.d.ts.map +1 -1
- package/dist/wallet/index.js +18 -0
- package/dist/wallet/index.js.map +1 -1
- package/dist/wallet/keys.d.ts.map +1 -1
- package/dist/wallet/keys.js +2 -0
- package/dist/wallet/keys.js.map +1 -1
- package/package.json +7 -3
- package/dist/commands/wallet.test.d.ts +0 -2
- package/dist/commands/wallet.test.d.ts.map +0 -1
- package/dist/commands/wallet.test.js +0 -68
- package/dist/commands/wallet.test.js.map +0 -1
- package/dist/nostr/chat.test.d.ts +0 -2
- package/dist/nostr/chat.test.d.ts.map +0 -1
- package/dist/nostr/chat.test.js +0 -121
- package/dist/nostr/chat.test.js.map +0 -1
- package/dist/nostr/store.test.d.ts +0 -2
- package/dist/nostr/store.test.d.ts.map +0 -1
- package/dist/nostr/store.test.js +0 -456
- package/dist/nostr/store.test.js.map +0 -1
- package/dist/utils/prices.test.d.ts +0 -5
- package/dist/utils/prices.test.d.ts.map +0 -1
- package/dist/utils/prices.test.js +0 -62
- package/dist/utils/prices.test.js.map +0 -1
- package/dist/utils/x402.test.d.ts +0 -2
- package/dist/utils/x402.test.d.ts.map +0 -1
- package/dist/utils/x402.test.js +0 -216
- package/dist/utils/x402.test.js.map +0 -1
- package/dist/wallet/cauldron/pools.test.d.ts +0 -3
- package/dist/wallet/cauldron/pools.test.d.ts.map +0 -1
- package/dist/wallet/cauldron/pools.test.js +0 -149
- package/dist/wallet/cauldron/pools.test.js.map +0 -1
- package/dist/wallet/cauldron/swap.test.d.ts +0 -2
- package/dist/wallet/cauldron/swap.test.d.ts.map +0 -1
- package/dist/wallet/cauldron/swap.test.js +0 -179
- package/dist/wallet/cauldron/swap.test.js.map +0 -1
- package/skills/README.md +0 -68
- package/skills/paytaca-send/SKILL.md +0 -159
- package/skills/paytaca-wallet/SKILL.md +0 -164
- package/skills/paytaca-x402/SKILL.md +0 -130
package/skills/README.md
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
# Paytaca CLI Skills
|
|
2
|
-
|
|
3
|
-
This directory contains AI agent skills for the Paytaca CLI.
|
|
4
|
-
|
|
5
|
-
## Available Skills
|
|
6
|
-
|
|
7
|
-
### paytaca-x402
|
|
8
|
-
|
|
9
|
-
Handles x402 HTTP payment requests using Paytaca BCH wallet. Use when encountering HTTP 402 responses or when calling APIs that may require payment via the x402 protocol.
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
npx skills add paytaca/paytaca-cli --skill paytaca-x402 -a <agent> -g
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### paytaca-wallet
|
|
16
|
-
|
|
17
|
-
Query wallet information including BCH balance, CashToken holdings, addresses, and transaction history. Use for read-only wallet operations.
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
npx skills add paytaca/paytaca-cli --skill paytaca-wallet -a <agent> -g
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
### paytaca-send
|
|
24
|
-
|
|
25
|
-
Send BCH and CashTokens from the wallet. **Requires user approval** before any sending operation.
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
npx skills add paytaca/paytaca-cli --skill paytaca-send -a <agent> -g
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## Installation
|
|
32
|
-
|
|
33
|
-
Install specific skill:
|
|
34
|
-
```bash
|
|
35
|
-
npx skills add paytaca/paytaca-cli --skill <skill-name> -a <agent> -g
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
Install all skills:
|
|
39
|
-
```bash
|
|
40
|
-
npx skills add paytaca/paytaca-cli --all
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
List available skills:
|
|
44
|
-
```bash
|
|
45
|
-
npx skills add paytaca/paytaca-cli --list
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## Skill Overview
|
|
49
|
-
|
|
50
|
-
| Skill | Purpose | Approval Needed |
|
|
51
|
-
|-------|---------|-----------------|
|
|
52
|
-
| paytaca-x402 | HTTP 402 payment handling | Yes (before payment) |
|
|
53
|
-
| paytaca-wallet | Balance, addresses, history, token info | No (read-only) |
|
|
54
|
-
| paytaca-send | Send BCH and tokens | Yes (before sending) |
|
|
55
|
-
|
|
56
|
-
## Adding New Skills
|
|
57
|
-
|
|
58
|
-
To add a new skill:
|
|
59
|
-
|
|
60
|
-
1. Create a new directory: `skills/<skill-name>/`
|
|
61
|
-
2. Add a `SKILL.md` file with YAML frontmatter:
|
|
62
|
-
```yaml
|
|
63
|
-
---
|
|
64
|
-
name: <skill-name>
|
|
65
|
-
description: What this skill does and when to use it
|
|
66
|
-
---
|
|
67
|
-
```
|
|
68
|
-
3. Write the skill instructions below the frontmatter
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: paytaca-send
|
|
3
|
-
description: Send BCH and CashTokens from the wallet. REQUIRES USER APPROVAL before any sending operation.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Paytaca Send
|
|
7
|
-
|
|
8
|
-
This skill handles sending BCH and CashTokens. **All sending operations require explicit user approval before execution.**
|
|
9
|
-
|
|
10
|
-
## ⚠️ User Approval Required
|
|
11
|
-
|
|
12
|
-
**CRITICAL**: The agent MUST NOT execute any `paytaca send` or `paytaca token send` command without first:
|
|
13
|
-
1. Informing the user of the exact amount and recipient
|
|
14
|
-
2. Waiting for explicit user confirmation (e.g., "yes", "send it", "confirm")
|
|
15
|
-
3. Only then executing the send command
|
|
16
|
-
|
|
17
|
-
These commands spend real funds from the user's wallet.
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## Send BCH
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
# Basic send (BCH amount)
|
|
25
|
-
paytaca send <address> <amount>
|
|
26
|
-
|
|
27
|
-
# Send in satoshis
|
|
28
|
-
paytaca send <address> 50000 --unit sats
|
|
29
|
-
|
|
30
|
-
# Testnet (chipnet)
|
|
31
|
-
paytaca send <address> 0.001 --chipnet
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### Example Workflow
|
|
35
|
-
```
|
|
36
|
-
Agent: I'll send 0.001 BCH to bitcoincash:qpm5...
|
|
37
|
-
Confirm? (This will spend real funds)
|
|
38
|
-
|
|
39
|
-
User: yes
|
|
40
|
-
|
|
41
|
-
Agent: paytaca send bitcoincash:qpm5... 0.001
|
|
42
|
-
→ Transaction sent: txid...
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
---
|
|
46
|
-
|
|
47
|
-
## Send Fungible Tokens
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
# Send tokens (amount in base units)
|
|
51
|
-
paytaca token send <address> <amount> --token <category>
|
|
52
|
-
|
|
53
|
-
# Example: Send 1000 units of a token
|
|
54
|
-
paytaca token send bitcoincash:zpm5... 1000 --token abc123...
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
**Note**: Token amounts are in base units. If a token has 8 decimals, sending `1` token requires `100000000` base units.
|
|
58
|
-
|
|
59
|
-
### Token Address Warning
|
|
60
|
-
Tokens should be sent to token-aware (z-prefix) addresses. The CLI will warn if the recipient address is not token-aware.
|
|
61
|
-
|
|
62
|
-
---
|
|
63
|
-
|
|
64
|
-
## Send NFTs
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
# Send NFT (auto-detect UTXO)
|
|
68
|
-
paytaca token send-nft <address> --token <category> --commitment <hex>
|
|
69
|
-
|
|
70
|
-
# Example: Send NFT with empty commitment
|
|
71
|
-
paytaca token send-nft bitcoincash:zpm5... --token abc123... --commitment ""
|
|
72
|
-
|
|
73
|
-
# With capability (minting or mutable)
|
|
74
|
-
paytaca token send-nft <address> --token <category> --commitment <hex> --capability minting
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
### Find NFT details
|
|
78
|
-
```bash
|
|
79
|
-
# List NFTs for a token category
|
|
80
|
-
paytaca token info <category>
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
---
|
|
84
|
-
|
|
85
|
-
## Network
|
|
86
|
-
|
|
87
|
-
All commands default to **mainnet**. Use `--chipnet` for testnet:
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
paytaca send <address> 0.01 --chipnet
|
|
91
|
-
paytaca token send <address> 100 --token <cat> --chipnet
|
|
92
|
-
paytaca token send-nft <address> --token <cat> --commitment "" --chipnet
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
---
|
|
96
|
-
|
|
97
|
-
## Decision Flow
|
|
98
|
-
|
|
99
|
-
When user requests to send funds:
|
|
100
|
-
|
|
101
|
-
1. **Validate inputs**: Check address format and amount
|
|
102
|
-
2. **Inform user**: State the exact amount, recipient, and network
|
|
103
|
-
3. **Wait for approval**: Ask "Send X [BCH/tokens] to <address>? Confirm?"
|
|
104
|
-
4. **Execute**: Only after explicit approval
|
|
105
|
-
|
|
106
|
-
### Example: Sending BCH
|
|
107
|
-
```
|
|
108
|
-
User: Send 0.01 BCH to bitcoincash:qpm5qz6j5p5s5s5s5s5s5s5s5s5s5s5s5s5
|
|
109
|
-
|
|
110
|
-
Agent: Checking wallet balance...
|
|
111
|
-
paytaca balance
|
|
112
|
-
|
|
113
|
-
Agent: Balance: 0.5 BCH
|
|
114
|
-
Sending 0.01 BCH to bitcoincash:qpm5qz6j5p5s5s5s5s5s5s5s5s5s5s5s5s
|
|
115
|
-
Confirm? (yes/no)
|
|
116
|
-
|
|
117
|
-
User: yes
|
|
118
|
-
|
|
119
|
-
Agent: paytaca send bitcoincash:qpm5qz6j5p5s5s5s5s5s5s5s5s5s5s5s5s 0.01
|
|
120
|
-
→ Transaction sent!
|
|
121
|
-
txid: abc123...
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
### Example: Sending Tokens
|
|
125
|
-
```
|
|
126
|
-
User: Send 1000 tokens to bitcoincash:zpm5...
|
|
127
|
-
|
|
128
|
-
Agent: Let me check your token balance first...
|
|
129
|
-
paytaca token info <category>
|
|
130
|
-
|
|
131
|
-
Agent: You have 5000 tokens.
|
|
132
|
-
Sending 1000 base units to bitcoincash:zpm5...
|
|
133
|
-
Confirm? (yes/no)
|
|
134
|
-
|
|
135
|
-
User: yes
|
|
136
|
-
|
|
137
|
-
Agent: paytaca token send bitcoincash:zpm5... 1000 --token <category>
|
|
138
|
-
→ Transaction sent!
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
---
|
|
142
|
-
|
|
143
|
-
## Error Handling
|
|
144
|
-
|
|
145
|
-
| Error | Cause | Solution |
|
|
146
|
-
|-------|-------|----------|
|
|
147
|
-
| `Insufficient balance` | Not enough BCH | Check `paytaca balance` first |
|
|
148
|
-
| `Insufficient BCH for fees` | Can't afford tx fee | Need more BCH for miner fee |
|
|
149
|
-
| `Invalid address` | Bad address format | Use CashAddr format |
|
|
150
|
-
| `Token not found` | Unknown category | Check token category ID |
|
|
151
|
-
|
|
152
|
-
---
|
|
153
|
-
|
|
154
|
-
## Security Notes
|
|
155
|
-
|
|
156
|
-
- Seed phrase is stored in OS keychain (never transmitted)
|
|
157
|
-
- Transactions are signed locally
|
|
158
|
-
- Always verify recipient address before confirming
|
|
159
|
-
- Test with small amounts on mainnet, or use `--chipnet` for testing
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: paytaca-wallet
|
|
3
|
-
description: Query wallet information including BCH balance, CashToken holdings, addresses, and transaction history. Use for read-only wallet operations.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Paytaca Wallet Info
|
|
7
|
-
|
|
8
|
-
This skill provides read-only access to wallet information via the Paytaca CLI.
|
|
9
|
-
|
|
10
|
-
## Commands
|
|
11
|
-
|
|
12
|
-
### Check Balance
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
# BCH balance
|
|
16
|
-
paytaca balance
|
|
17
|
-
|
|
18
|
-
# Balance in satoshis
|
|
19
|
-
paytaca balance --sats
|
|
20
|
-
|
|
21
|
-
# CashToken balances only (positive balances)
|
|
22
|
-
paytaca balance --tokens
|
|
23
|
-
|
|
24
|
-
# BCH and CashToken balances
|
|
25
|
-
paytaca balance --all
|
|
26
|
-
|
|
27
|
-
# Balance for a specific token
|
|
28
|
-
paytaca balance --token <category>
|
|
29
|
-
|
|
30
|
-
# Testnet (chipnet)
|
|
31
|
-
paytaca balance --chipnet
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### View Transaction History
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
# Recent transactions
|
|
38
|
-
paytaca history
|
|
39
|
-
|
|
40
|
-
# Filter by type
|
|
41
|
-
paytaca history --type incoming
|
|
42
|
-
paytaca history --type outgoing
|
|
43
|
-
|
|
44
|
-
# Filter by token
|
|
45
|
-
paytaca history --token <category>
|
|
46
|
-
|
|
47
|
-
# Pagination
|
|
48
|
-
paytaca history --page 2
|
|
49
|
-
|
|
50
|
-
# Satoshis display
|
|
51
|
-
paytaca history --sats
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### Get Receiving Address
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
# BCH address with QR code
|
|
58
|
-
paytaca receive
|
|
59
|
-
|
|
60
|
-
# Address at specific index
|
|
61
|
-
paytaca receive --index 5
|
|
62
|
-
|
|
63
|
-
# Address only (no QR)
|
|
64
|
-
paytaca receive --no-qr
|
|
65
|
-
|
|
66
|
-
# Token-aware address (z-prefix)
|
|
67
|
-
paytaca receive --token
|
|
68
|
-
|
|
69
|
-
# With payment amount (BIP21 URI)
|
|
70
|
-
paytaca receive --amount 0.5
|
|
71
|
-
|
|
72
|
-
# Token payment URI
|
|
73
|
-
paytaca receive --token <category> --amount 100
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
The displayed address (and its token-aware variant) is auto-subscribed with Watchtower, so incoming BCH and CashTokens are monitored even at indices beyond the initial wallet scan.
|
|
77
|
-
|
|
78
|
-
### Derive Addresses
|
|
79
|
-
|
|
80
|
-
```bash
|
|
81
|
-
# Address at index 0
|
|
82
|
-
paytaca address derive
|
|
83
|
-
|
|
84
|
-
# Address at index 5
|
|
85
|
-
paytaca address derive 5
|
|
86
|
-
|
|
87
|
-
# Token address
|
|
88
|
-
paytaca address derive --token
|
|
89
|
-
|
|
90
|
-
# List first 5 addresses
|
|
91
|
-
paytaca address list
|
|
92
|
-
|
|
93
|
-
# List 20 addresses
|
|
94
|
-
paytaca address list -n 20
|
|
95
|
-
|
|
96
|
-
# Token addresses
|
|
97
|
-
paytaca address list --token
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
### Wallet Info
|
|
101
|
-
|
|
102
|
-
```bash
|
|
103
|
-
# Wallet hash, address, balance
|
|
104
|
-
paytaca wallet info
|
|
105
|
-
|
|
106
|
-
# Testnet
|
|
107
|
-
paytaca wallet info --chipnet
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
### Token Information
|
|
111
|
-
|
|
112
|
-
```bash
|
|
113
|
-
# List all fungible tokens
|
|
114
|
-
paytaca token list
|
|
115
|
-
|
|
116
|
-
# Token details (name, symbol, decimals, balance, NFTs)
|
|
117
|
-
paytaca token info <category>
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
## JSON Output
|
|
121
|
-
|
|
122
|
-
For programmatic parsing, use `--json` where available:
|
|
123
|
-
|
|
124
|
-
```bash
|
|
125
|
-
paytaca balance --json # Not yet supported
|
|
126
|
-
paytaca history --json # Not yet supported
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
## Network
|
|
130
|
-
|
|
131
|
-
All commands default to **mainnet**. Use `--chipnet` for testnet:
|
|
132
|
-
|
|
133
|
-
```bash
|
|
134
|
-
paytaca balance --chipnet
|
|
135
|
-
paytaca history --chipnet
|
|
136
|
-
paytaca receive --chipnet
|
|
137
|
-
paytaca token list --chipnet
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
## Common Workflows
|
|
141
|
-
|
|
142
|
-
### Check wallet status
|
|
143
|
-
```bash
|
|
144
|
-
paytaca wallet info
|
|
145
|
-
paytaca balance
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
### Get deposit address
|
|
149
|
-
```bash
|
|
150
|
-
paytaca receive
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
### Check token holdings
|
|
154
|
-
```bash
|
|
155
|
-
paytaca balance --tokens
|
|
156
|
-
paytaca token list
|
|
157
|
-
paytaca token info <category>
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
### View recent activity
|
|
161
|
-
```bash
|
|
162
|
-
paytaca history
|
|
163
|
-
paytaca history --type incoming
|
|
164
|
-
```
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: paytaca-x402
|
|
3
|
-
description: Handles x402 HTTP payment requests using Paytaca BCH wallet. Use when encountering HTTP 402 responses or when calling APIs that may require payment via the x402 protocol.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Paytaca x402 Payment Handler
|
|
7
|
-
|
|
8
|
-
This skill teaches the agent how to handle x402-based HTTP payments using the Paytaca CLI wallet.
|
|
9
|
-
|
|
10
|
-
## Overview
|
|
11
|
-
|
|
12
|
-
Some APIs (like nanogpt, etc.) use the x402 protocol for HTTP payments. When you call these APIs:
|
|
13
|
-
- Server returns **HTTP 402 PAYMENT REQUIRED**
|
|
14
|
-
- You must pay with BCH to access the resource
|
|
15
|
-
- After payment, the server returns the actual response
|
|
16
|
-
|
|
17
|
-
## Commands
|
|
18
|
-
|
|
19
|
-
### Check if a URL requires payment (recommended first step)
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
paytaca check <url> --json
|
|
23
|
-
# Returns: acceptsX402, acceptsBch, estimatedCostSats, etc.
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
Example output:
|
|
27
|
-
```json
|
|
28
|
-
{
|
|
29
|
-
"url": "https://api.nanogpt.com/v1/complete",
|
|
30
|
-
"acceptsX402": true,
|
|
31
|
-
"acceptsBch": true,
|
|
32
|
-
"paymentRequired": true,
|
|
33
|
-
"estimatedCostSats": "100",
|
|
34
|
-
"costInBch": "0.00000100"
|
|
35
|
-
}
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
### Preview payment without executing (dry-run)
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
paytaca pay <url> --dry-run --json
|
|
42
|
-
# Shows what would happen without actually paying
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### Make a paid request
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
# Basic (will prompt for confirmation)
|
|
49
|
-
paytaca pay <url>
|
|
50
|
-
|
|
51
|
-
# With JSON output (preferred for AI agents)
|
|
52
|
-
paytaca pay <url> --json
|
|
53
|
-
|
|
54
|
-
# Skip confirmation prompt (only use after user has already approved via paytaca check)
|
|
55
|
-
paytaca pay <url> --confirmed
|
|
56
|
-
|
|
57
|
-
# POST request
|
|
58
|
-
paytaca pay <url> --method POST --body '{"prompt":"hello"}'
|
|
59
|
-
|
|
60
|
-
# Custom headers
|
|
61
|
-
paytaca pay <url> -H "Authorization: Bearer token123"
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
### Check wallet balance
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
paytaca balance
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
## Decision Flow
|
|
71
|
-
|
|
72
|
-
When preparing to call an unfamiliar API that might require payment:
|
|
73
|
-
|
|
74
|
-
1. **First check**: `paytaca check <url> --json`
|
|
75
|
-
- If `paymentRequired: false` → proceed normally
|
|
76
|
-
- If `paymentRequired: true` and `acceptsBch: true` → inform user of cost and **seek explicit approval** before paying
|
|
77
|
-
- If `paymentRequired: true` but `acceptsBch: false` → inform user
|
|
78
|
-
|
|
79
|
-
2. **When encountering HTTP 402**:
|
|
80
|
-
- Parse the `PAYMENT-REQUIRED` headers
|
|
81
|
-
- **Seek explicit user approval** before spending any BCH
|
|
82
|
-
- Once approved, use `paytaca pay <url> --json` to handle payment
|
|
83
|
-
- The command handles: parse headers → build BCH tx → broadcast → retry with signature
|
|
84
|
-
|
|
85
|
-
3. **For known paid APIs**:
|
|
86
|
-
- **Always seek user approval first**, then use `paytaca pay <url>` - it handles 402 automatically
|
|
87
|
-
|
|
88
|
-
## ⚠️ User Approval Required Before Any Payment
|
|
89
|
-
|
|
90
|
-
**CRITICAL**: The agent MUST NOT execute `paytaca pay` without explicit user approval. Since `paytaca pay` spends real BCH from the user's wallet, always:
|
|
91
|
-
|
|
92
|
-
1. Run `paytaca check <url> --json` first to determine the cost
|
|
93
|
-
2. Inform the user of the cost (e.g., "This API costs ~1000 sats")
|
|
94
|
-
3. Wait for explicit user confirmation (e.g., "yes", "go ahead", "pay")
|
|
95
|
-
4. Only then execute the payment using `paytaca pay <url> --confirmed --json`
|
|
96
|
-
|
|
97
|
-
The `--confirmed` flag skips the interactive confirmation prompt since the user has already approved the transaction. Do NOT use `--confirmed` without first obtaining explicit user approval.
|
|
98
|
-
|
|
99
|
-
Do NOT assume the user wants to pay - even if the cost seems small.
|
|
100
|
-
|
|
101
|
-
## AI Agent Workflow
|
|
102
|
-
|
|
103
|
-
```
|
|
104
|
-
Task: Call nanogpt API
|
|
105
|
-
Agent: paytaca check https://api.nanogpt.com/v1/complete --json
|
|
106
|
-
→ {"acceptsBch": true, "estimatedCostSats": "100"}
|
|
107
|
-
|
|
108
|
-
Agent: Informs user "This API costs 100 sats (0.00000100 BCH). Approve to proceed?"
|
|
109
|
-
User: "yes"
|
|
110
|
-
|
|
111
|
-
Agent: paytaca pay https://api.nanogpt.com/v1/complete --method POST --body '{"prompt":"hello"}' --confirmed --json
|
|
112
|
-
→ Handles 402 → pays 100 sats → returns response with txid
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
## Key Options
|
|
116
|
-
|
|
117
|
-
| Option | Description |
|
|
118
|
-
|--------|-------------|
|
|
119
|
-
| `--json` | Machine-readable output (recommended for AI) |
|
|
120
|
-
| `--dry-run` | Preview payment without executing |
|
|
121
|
-
| `--confirmed` | Skip confirmation prompt (prior approval obtained) |
|
|
122
|
-
| `--chipnet` | Use chipnet (testnet) instead of mainnet |
|
|
123
|
-
| `--max-amount` | Override max payment amount in sats |
|
|
124
|
-
|
|
125
|
-
## Notes
|
|
126
|
-
|
|
127
|
-
- Payment is per-request (no batching)
|
|
128
|
-
- Each request = separate BCH transaction
|
|
129
|
-
- Only BCH payments are supported (no stablecoins)
|
|
130
|
-
- Uses local wallet from OS keychain (credentials never leave the machine)
|