@elizaos/plugin-x402 2.0.0-alpha.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 ADDED
@@ -0,0 +1,30 @@
1
+ # @elizaos/plugin-x402
2
+
3
+ x402 HTTP payment protocol plugin for ElizaOS. Enables agents to send and receive crypto payments (USDC on EVM chains) using the [x402 protocol standard](https://www.x402.org/).
4
+
5
+ ## Features
6
+
7
+ - **Send payments** — Pay for x402-protected HTTP resources
8
+ - **Receive payments** — Serve paywalled endpoints with automatic USDC settlement
9
+ - **Multiple storage backends** — Memory, SQLite, and PostgreSQL
10
+ - **Payment policies** — Configurable spending limits and circuit breakers
11
+ - **Facilitator integration** — Payment verification via x402 facilitator service
12
+ - **REST API** — Endpoints for payment history, summaries, and CSV export
13
+
14
+ ## Configuration
15
+
16
+ | Variable | Description | Required |
17
+ |----------|-------------|----------|
18
+ | `X402_PRIVATE_KEY` | Wallet private key (hex, 0x-prefixed) | Yes |
19
+ | `X402_NETWORK` | Network name (e.g. `base-sepolia`, `base`) | No |
20
+ | `X402_PAY_TO` | Default payment recipient address | No |
21
+ | `X402_FACILITATOR_URL` | Facilitator service URL | No |
22
+ | `X402_MAX_PAYMENT_USD` | Max single payment (USD) | No |
23
+ | `X402_MAX_TOTAL_USD` | Max total payments (USD) | No |
24
+ | `X402_ENABLED` | Enable/disable plugin | No |
25
+
26
+ ## Usage
27
+
28
+ ```typescript
29
+ import { x402Plugin } from "@elizaos/plugin-x402";
30
+ ```
package/package.json ADDED
@@ -0,0 +1,104 @@
1
+ {
2
+ "name": "@elizaos/plugin-x402",
3
+ "version": "2.0.0-alpha.1",
4
+ "description": "x402 HTTP payment protocol plugin for ElizaOS - send and receive crypto payments",
5
+ "type": "module",
6
+ "main": "typescript/dist/index.js",
7
+ "types": "typescript/dist/index.d.ts",
8
+ "exports": {
9
+ "./package.json": "./package.json",
10
+ ".": {
11
+ "types": "./typescript/dist/index.d.ts",
12
+ "import": "./typescript/dist/index.js",
13
+ "default": "./typescript/dist/index.js"
14
+ }
15
+ },
16
+ "files": [
17
+ "typescript/dist",
18
+ "README.md"
19
+ ],
20
+ "keywords": [],
21
+ "author": "elizaOS",
22
+ "license": "MIT",
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "https://github.com/elizaos-plugins/plugin-x402"
26
+ },
27
+ "scripts": {
28
+ "build": "bun run build:ts",
29
+ "build:ts": "cd typescript && bun run build.ts",
30
+ "dev": "cd typescript && bun --hot build.ts",
31
+ "test": "bun run test:ts",
32
+ "test:ts": "cd typescript && vitest run || echo 'TypeScript tests skipped - no tests found'",
33
+ "typecheck": "tsc --noEmit -p typescript/tsconfig.json",
34
+ "lint": "bunx @biomejs/biome check --write ./typescript",
35
+ "lint:check": "bunx @biomejs/biome check ./typescript",
36
+ "clean": "rm -rf typescript/dist .turbo typescript/node_modules",
37
+ "format": "bunx @biomejs/biome format --write ./typescript",
38
+ "format:check": "bunx @biomejs/biome format ./typescript"
39
+ },
40
+ "devDependencies": {
41
+ "@biomejs/biome": "^2.3.11",
42
+ "@types/bun": "^1.3.5",
43
+ "@types/node": "^25.0.3",
44
+ "typescript": "^5.9.3",
45
+ "@types/better-sqlite3": "7.6.12",
46
+ "@types/pg": "8.11.10"
47
+ },
48
+ "peerDependencies": {
49
+ "@elizaos/core": "next"
50
+ },
51
+ "agentConfig": {
52
+ "pluginType": "elizaos:plugin:1.0.0",
53
+ "pluginParameters": {
54
+ "X402_PRIVATE_KEY": {
55
+ "type": "string",
56
+ "description": "Private key for the x402 payment wallet (hex-encoded, starting with 0x).",
57
+ "required": true,
58
+ "sensitive": true
59
+ },
60
+ "X402_NETWORK": {
61
+ "type": "string",
62
+ "description": "Network to use for x402 payments (e.g. base-sepolia, base).",
63
+ "required": false,
64
+ "sensitive": false
65
+ },
66
+ "X402_PAY_TO": {
67
+ "type": "string",
68
+ "description": "Default payment recipient address.",
69
+ "required": false,
70
+ "sensitive": false
71
+ },
72
+ "X402_FACILITATOR_URL": {
73
+ "type": "string",
74
+ "description": "URL of the x402 facilitator service for payment verification.",
75
+ "required": false,
76
+ "sensitive": false
77
+ },
78
+ "X402_MAX_PAYMENT_USD": {
79
+ "type": "string",
80
+ "description": "Maximum single payment amount in USD.",
81
+ "required": false,
82
+ "sensitive": false
83
+ },
84
+ "X402_MAX_TOTAL_USD": {
85
+ "type": "string",
86
+ "description": "Maximum total payment amount in USD within the policy window.",
87
+ "required": false,
88
+ "sensitive": false
89
+ },
90
+ "X402_ENABLED": {
91
+ "type": "boolean",
92
+ "description": "Whether the x402 plugin is enabled.",
93
+ "required": false,
94
+ "default": true,
95
+ "sensitive": false
96
+ }
97
+ }
98
+ },
99
+ "dependencies": {
100
+ "viem": "2.21.0",
101
+ "better-sqlite3": "11.7.0",
102
+ "pg": "8.13.1"
103
+ }
104
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./index";
2
+ export { default } from "./index";