plugin-x402-endpoints 0.1.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 +86 -0
- package/dist/index.cjs +2060 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +150 -0
- package/dist/index.d.ts +150 -0
- package/dist/index.js +2048 -0
- package/dist/index.js.map +1 -0
- package/package.json +90 -0
package/README.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# plugin-x402-endpoints — ElizaOS plugin
|
|
2
|
+
|
|
3
|
+
Exposes the **28 paid endpoints** of the [x402-endpoints](https://x402-endpoints.onrender.com)
|
|
4
|
+
catalogue as **native ElizaOS actions**. An Eliza agent can discover and call them in
|
|
5
|
+
natural language; each call is billed per use via the **x402 protocol** (USDC on **Base mainnet**).
|
|
6
|
+
|
|
7
|
+
The catalogue covers:
|
|
8
|
+
- **Official EU / global registries** — GLEIF (LEI), VIES (EU VAT), Companies House (UK),
|
|
9
|
+
INSEE Sirene (FR), BODACC, EUR-Lex, Légifrance, EPO patents, TED tenders, sanctions
|
|
10
|
+
screening, CVE, FDA recalls / drug labels, IBAN, ECB FX…
|
|
11
|
+
- **Crypto pre-trade data** — token-safety, derivatives-radar, wallet-xray, dex-cex-spread,
|
|
12
|
+
new-pairs, plus Polymarket odds and web search/extract.
|
|
13
|
+
|
|
14
|
+
The actions are generated from `src/catalog.json`, which is bundled at build time, so the
|
|
15
|
+
plugin never diverges from the catalogue it was built from.
|
|
16
|
+
|
|
17
|
+
## Two modes
|
|
18
|
+
|
|
19
|
+
| Mode | When | An action call does |
|
|
20
|
+
|---|---|---|
|
|
21
|
+
| **Auto-pay** | a funded Base buyer key is configured | pays the x402 micropayment and returns **live data** |
|
|
22
|
+
| **Discovery** (default) | no key | returns the exact **payment terms** (price, network, asset, `payTo`, resource) + an example output |
|
|
23
|
+
|
|
24
|
+
> ⚠️ Never put a buyer key on a shared/hosted agent. Auto-pay is for an agent that runs
|
|
25
|
+
> with its own wallet.
|
|
26
|
+
|
|
27
|
+
## Install
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install plugin-x402-endpoints
|
|
31
|
+
# peer dependency:
|
|
32
|
+
npm install @elizaos/core
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { AgentRuntime } from "@elizaos/core";
|
|
39
|
+
import x402Plugin from "plugin-x402-endpoints";
|
|
40
|
+
|
|
41
|
+
const runtime = new AgentRuntime({
|
|
42
|
+
character: {
|
|
43
|
+
name: "MyAgent",
|
|
44
|
+
plugins: ["plugin-x402-endpoints"],
|
|
45
|
+
settings: {
|
|
46
|
+
secrets: {
|
|
47
|
+
// optional — enables auto-pay (a Base wallet funded in USDC):
|
|
48
|
+
X402_BUYER_PRIVATE_KEY: process.env.X402_BUYER_PRIVATE_KEY,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
plugins: [x402Plugin],
|
|
53
|
+
});
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
The agent now has 28 actions (`X402_GLEIF_LEI`, `X402_VIES_VAT`, `X402_CRYPTO_TOKEN_SAFETY`,
|
|
57
|
+
`X402_CRYPTO_DERIVATIVES_RADAR`, `X402_CRYPTO_WALLET_XRAY`, …) and an `X402_CATALOG`
|
|
58
|
+
provider that lists every paid tool in context. Example prompts:
|
|
59
|
+
|
|
60
|
+
- *"Look up LEI 529900T8BM49AURSDO55"* → `X402_GLEIF_LEI`
|
|
61
|
+
- *"Is token 0x… on Base a honeypot?"* → `X402_CRYPTO_TOKEN_SAFETY`
|
|
62
|
+
- *"Validate IE VAT 6388047V"* → `X402_VIES_VAT`
|
|
63
|
+
|
|
64
|
+
Parameters are taken from explicit action options, structured message content, or extracted
|
|
65
|
+
from the natural-language message via the runtime model.
|
|
66
|
+
|
|
67
|
+
## Settings
|
|
68
|
+
|
|
69
|
+
| Setting | Default | Role |
|
|
70
|
+
|---|---|---|
|
|
71
|
+
| `X402_BUYER_PRIVATE_KEY` | — | Private key of a **Base wallet funded in USDC**; enables auto-pay. `EVM_PRIVATE_KEY` / `WALLET_PRIVATE_KEY` are also accepted. |
|
|
72
|
+
| `X402_AUTO_PAY` | `1` | Set to `0`/`false` to force discovery mode even with a key. |
|
|
73
|
+
| `X402_BASE_URL` | `https://x402-endpoints.onrender.com` | API base URL. |
|
|
74
|
+
| `X402_NETWORK` | `eip155:8453` | Payment network (Base mainnet). |
|
|
75
|
+
|
|
76
|
+
## Build & test
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
npm install
|
|
80
|
+
npm run build # tsup -> dist/ (ESM + CJS + d.ts)
|
|
81
|
+
npm run smoke # discovery smoke test against the live API
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## License
|
|
85
|
+
|
|
86
|
+
MIT
|