xdcai 0.1.13
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/LICENSE +9 -0
- package/README.md +13 -0
- package/SKILL.md +63 -0
- package/bin/xdcai.js +45759 -0
- package/package.json +36 -0
- package/providers.json +31 -0
- package/skill.json +74 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 XDC AI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# xdcai
|
|
2
|
+
|
|
3
|
+
Pay for [x402](https://x402.org) services on the **XDC** network with USDC, from a
|
|
4
|
+
custodial wallet — the agent **never pays gas** (EIP-3009).
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
npx xdcai login # email -> OTP -> an XDC wallet
|
|
8
|
+
npx xdcai wallet balance # fund the printed address with USDC
|
|
9
|
+
npx xdcai marketplace list --search lending,rates # find the most relevant x402 services (ranked)
|
|
10
|
+
npx xdcai call <x402-url> # auto-pays the 402 and returns the result
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
See https://xdctaskman-web.vercel.app/integrate. MIT licensed.
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: xdcai
|
|
3
|
+
description: Pay for x402 services on the XDC network with USDC. Log in with email, get a custodial XDC wallet, browse the curated marketplace, and call any x402 URL - the payment is signed from your wallet and you never pay gas (EIP-3009).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# XDC AI skill
|
|
7
|
+
|
|
8
|
+
Use this skill to discover and pay for x402-protected services on XDC. Drive it through the `xdcai` CLI (installed via `npx xdcai` or `pnpm cli --`).
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
- The user wants onchain data or any paid API that returns HTTP 402 on XDC.
|
|
12
|
+
- The user asks to log in, check a wallet balance, list marketplace services, or call a paid URL.
|
|
13
|
+
|
|
14
|
+
## Environments (important)
|
|
15
|
+
This skill is a **CLI** - it needs a shell and outbound network. That means:
|
|
16
|
+
- ✅ **Claude Code, Cursor, Codex, a terminal** - `npx xdcai ...` works directly.
|
|
17
|
+
- ❌ **claude.ai web** - its sandbox blocks outbound network, so `login` can't reach the
|
|
18
|
+
auth/wallet service. In claude.ai, **add the MCP connector instead**:
|
|
19
|
+
`https://xdctaskman-x402-server.vercel.app/mcp` (Settings → Connectors → Add custom
|
|
20
|
+
connector). It exposes the same flow as tools (`login_start`, `login_verify`,
|
|
21
|
+
`wallet_address`, `wallet_balance`, `marketplace_list`, `call`, `wallet_transfer`) and runs
|
|
22
|
+
the network work server-side.
|
|
23
|
+
|
|
24
|
+
## Setup (once)
|
|
25
|
+
```
|
|
26
|
+
npx xdcai login # email → OTP → an XDC wallet is created for you
|
|
27
|
+
npx xdcai wallet address # show the address to fund with USDC
|
|
28
|
+
npx xdcai wallet balance # check USDC + XDC balance
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Core loop
|
|
32
|
+
```
|
|
33
|
+
npx xdcai marketplace list --search weather,forecast # find the best-matching services
|
|
34
|
+
npx xdcai call https://provider.example/x402/endpoint
|
|
35
|
+
```
|
|
36
|
+
Pass `--search` comma-separated keywords from the task; results are ranked by tags
|
|
37
|
+
+ capability (best match first) against the **live** catalog - the fastest way to
|
|
38
|
+
find the most relevant API for a prompt.
|
|
39
|
+
`call` performs the full x402 flow automatically: it requests the URL, and if it
|
|
40
|
+
returns `402`, signs an EIP-3009 USDC payment authorization from your wallet,
|
|
41
|
+
resends with the `X-PAYMENT` header, and returns the result. **You never pay gas**
|
|
42
|
+
- a relayer settles the signed authorization on-chain.
|
|
43
|
+
|
|
44
|
+
## Commands
|
|
45
|
+
- `login [--email <e>] [--code <c>] [--accept-terms]` - authenticate; creates/loads your XDC wallet. Login requires accepting the Terms & Conditions (https://xdctaskman-web.vercel.app/terms): show them to the user and pass `--accept-terms` (non-interactive) only with the user's consent, or answer the interactive prompt.
|
|
46
|
+
- `whoami` / `logout`
|
|
47
|
+
- `wallet address|balance|fund`
|
|
48
|
+
- `marketplace list [--search <a,b,c>] [--capability <c>] [--max-price <usdc>]` - `--search` ranks live services by tags + capability (OR over the terms, best first).
|
|
49
|
+
- `call <serviceUrl> [--method GET|POST] [--data <json>]`
|
|
50
|
+
|
|
51
|
+
## Output contract (for agents)
|
|
52
|
+
- **stdout** = exactly one JSON object per command - parse this.
|
|
53
|
+
- `call` → `{ ok, status, paid, txHash?, explorer?, result }`
|
|
54
|
+
- `wallet transfer` → `{ success, amount, token, to, txHash?, explorer?, error? }`
|
|
55
|
+
- `login` → `{ loggedIn, email, address }`; `wallet address|balance|fund` → JSON; `whoami` → JSON
|
|
56
|
+
- On any failure → `{ "error": "<message>" }` and a non-zero exit code.
|
|
57
|
+
- **stderr** = human/log lines (prompts, "Sent a code...", structured logs). Ignore for parsing.
|
|
58
|
+
- Set `LOG_LEVEL=error` to silence info logs.
|
|
59
|
+
|
|
60
|
+
## Notes
|
|
61
|
+
- Amounts are in USDC (6 decimals). Prices are shown per call.
|
|
62
|
+
- Always `wallet balance` before paid calls; if USDC is 0, tell the user to fund
|
|
63
|
+
the printed address (gas is sponsored - no native XDC needed).
|