agentic-x402 0.2.1 → 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 +1 -2
- package/SKILL.md +0 -2
- package/config/example.env +1 -4
- package/package.json +1 -1
- package/scripts/commands/create-link.ts +1 -9
- package/scripts/core/config.ts +0 -2
package/README.md
CHANGED
|
@@ -162,7 +162,7 @@ x402 fetch https://api.example.com/submit --method POST --body '{"key":"value"}'
|
|
|
162
162
|
|
|
163
163
|
### create-link — Create a Payment Link
|
|
164
164
|
|
|
165
|
-
Create a payment link via the [21.cash](https://21.cash) x402-links-server. You can gate a URL or text content behind a USDC payment. Requires `X402_LINKS_API_URL`
|
|
165
|
+
Create a payment link via the [21.cash](https://21.cash) x402-links-server. You can gate a URL or text content behind a USDC payment. Requires `X402_LINKS_API_URL` environment variable. Link creation costs $0.10 USDC, paid automatically via x402.
|
|
166
166
|
|
|
167
167
|
```bash
|
|
168
168
|
x402 create-link --name "Premium Guide" --price 5.00 --url https://mysite.com/guide.pdf
|
|
@@ -230,7 +230,6 @@ Config is loaded from these locations (in order of priority):
|
|
|
230
230
|
| Variable | Description |
|
|
231
231
|
|----------|-------------|
|
|
232
232
|
| `X402_LINKS_API_URL` | Base URL of x402-links-server (e.g., `https://21.cash`) |
|
|
233
|
-
| `X402_LINKS_API_KEY` | API key for programmatic link creation |
|
|
234
233
|
|
|
235
234
|
## Global Options
|
|
236
235
|
|
package/SKILL.md
CHANGED
|
@@ -130,7 +130,6 @@ Create payment links to monetize your own content using x402-links-server:
|
|
|
130
130
|
Add to `.env`:
|
|
131
131
|
```bash
|
|
132
132
|
X402_LINKS_API_URL=https://your-x402-links-server.com
|
|
133
|
-
X402_LINKS_API_KEY=your_api_key
|
|
134
133
|
```
|
|
135
134
|
|
|
136
135
|
### Create a link
|
|
@@ -255,7 +254,6 @@ x402 link-info <router-address> [--json]
|
|
|
255
254
|
| `X402_SLIPPAGE_BPS` | Slippage tolerance in basis points (100 bps = 1%) | `50` |
|
|
256
255
|
| `X402_VERBOSE` | Enable verbose logging (`1` = on, `0` = off) | `0` |
|
|
257
256
|
| `X402_LINKS_API_URL` | Base URL of x402-links-server (e.g., `https://21.cash`) | — |
|
|
258
|
-
| `X402_LINKS_API_KEY` | API key for programmatic link creation | — |
|
|
259
257
|
|
|
260
258
|
## Supported Networks
|
|
261
259
|
|
package/config/example.env
CHANGED
|
@@ -39,13 +39,10 @@ X402_MAX_PAYMENT_USD=10
|
|
|
39
39
|
# 21CASH INTEGRATION (Optional - for creating payment links)
|
|
40
40
|
# =============================================================================
|
|
41
41
|
|
|
42
|
-
# x402-links-server API URL
|
|
42
|
+
# x402-links-server API URL (link creation is gated by x402 payment)
|
|
43
43
|
# Example: https://your-21cash-instance.com or https://21.cash
|
|
44
44
|
# X402_LINKS_API_URL=https://your-server.com
|
|
45
45
|
|
|
46
|
-
# API key for programmatic link creation
|
|
47
|
-
# X402_LINKS_API_KEY=your_api_key_here
|
|
48
|
-
|
|
49
46
|
# =============================================================================
|
|
50
47
|
# DEBUG
|
|
51
48
|
# =============================================================================
|
package/package.json
CHANGED
|
@@ -57,7 +57,6 @@ Options:
|
|
|
57
57
|
|
|
58
58
|
Environment:
|
|
59
59
|
X402_LINKS_API_URL Base URL of x402-links-server (required)
|
|
60
|
-
X402_LINKS_API_KEY API key for programmatic access (required)
|
|
61
60
|
|
|
62
61
|
Examples:
|
|
63
62
|
x402 create-link --name "Premium Guide" --price 5.00 --url https://mysite.com/guide.pdf
|
|
@@ -75,12 +74,6 @@ Examples:
|
|
|
75
74
|
process.exit(1);
|
|
76
75
|
}
|
|
77
76
|
|
|
78
|
-
if (!config.x402LinksApiKey) {
|
|
79
|
-
console.error('Error: X402_LINKS_API_KEY environment variable is required');
|
|
80
|
-
console.error('This is the API key for programmatic access to x402-links-server');
|
|
81
|
-
process.exit(1);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
77
|
const name = flags.name as string;
|
|
85
78
|
const price = flags.price as string;
|
|
86
79
|
const gatedUrl = flags.url as string | undefined;
|
|
@@ -142,11 +135,10 @@ Examples:
|
|
|
142
135
|
|
|
143
136
|
const apiUrl = `${config.x402LinksApiUrl}/api/links/programmatic`;
|
|
144
137
|
|
|
145
|
-
const response = await
|
|
138
|
+
const response = await client.fetchWithPayment(apiUrl, {
|
|
146
139
|
method: 'POST',
|
|
147
140
|
headers: {
|
|
148
141
|
'Content-Type': 'application/json',
|
|
149
|
-
'X-API-Key': config.x402LinksApiKey,
|
|
150
142
|
},
|
|
151
143
|
body: JSON.stringify(requestBody),
|
|
152
144
|
});
|
package/scripts/core/config.ts
CHANGED
|
@@ -36,7 +36,6 @@ export interface X402Config {
|
|
|
36
36
|
|
|
37
37
|
// 21cash integration (optional)
|
|
38
38
|
x402LinksApiUrl?: string;
|
|
39
|
-
x402LinksApiKey?: string;
|
|
40
39
|
|
|
41
40
|
// Defaults
|
|
42
41
|
maxPaymentUsd: number;
|
|
@@ -73,7 +72,6 @@ export function getConfig(): X402Config {
|
|
|
73
72
|
chainId,
|
|
74
73
|
facilitatorUrl: getOptionalEnv('X402_FACILITATOR_URL', defaultFacilitator),
|
|
75
74
|
x402LinksApiUrl: process.env.X402_LINKS_API_URL,
|
|
76
|
-
x402LinksApiKey: process.env.X402_LINKS_API_KEY,
|
|
77
75
|
maxPaymentUsd: parseFloat(getOptionalEnv('X402_MAX_PAYMENT_USD', '10')),
|
|
78
76
|
slippageBps: parseInt(getOptionalEnv('X402_SLIPPAGE_BPS', '50'), 10),
|
|
79
77
|
verbose: getOptionalEnv('X402_VERBOSE', '0') === '1',
|