@waiaas/skills 2.5.0 → 2.6.0-rc.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/package.json +2 -2
- package/skills/actions.skill.md +11 -1
- package/skills/admin.skill.md +57 -1
- package/skills/policies.skill.md +59 -35
- package/skills/quickstart.skill.md +74 -86
- package/skills/transactions.skill.md +86 -1
- package/skills/wallet.skill.md +267 -30
- package/skills/x402.skill.md +10 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@waiaas/skills",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0-rc.1",
|
|
4
4
|
"description": "WAIaaS skill files for AI agents - install via npx @waiaas/skills add <name>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@types/node": "^22.0.0"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
|
-
"prebuild": "node scripts/sync-
|
|
33
|
+
"prebuild": "node scripts/sync-skills.mjs",
|
|
34
34
|
"build": "tsc -p tsconfig.build.json",
|
|
35
35
|
"clean": "rm -rf dist"
|
|
36
36
|
}
|
package/skills/actions.skill.md
CHANGED
|
@@ -3,7 +3,7 @@ name: "WAIaaS Actions"
|
|
|
3
3
|
description: "Action Provider framework: list providers, execute DeFi actions through the 6-stage transaction pipeline"
|
|
4
4
|
category: "api"
|
|
5
5
|
tags: [wallet, blockchain, defi, actions, waiass]
|
|
6
|
-
version: "2.
|
|
6
|
+
version: "2.6.0-rc.1"
|
|
7
7
|
dispatch:
|
|
8
8
|
kind: "tool"
|
|
9
9
|
allowedCommands: ["curl"]
|
|
@@ -21,6 +21,16 @@ http://localhost:3100
|
|
|
21
21
|
|
|
22
22
|
All action endpoints require **sessionAuth** via `Authorization: Bearer <token>` header.
|
|
23
23
|
|
|
24
|
+
## Permissions
|
|
25
|
+
|
|
26
|
+
### Agent (sessionAuth)
|
|
27
|
+
- List action providers and their available actions
|
|
28
|
+
- Execute actions (subject to policy evaluation)
|
|
29
|
+
|
|
30
|
+
### Admin (masterAuth -- prerequisite)
|
|
31
|
+
- Register API keys for action providers via Admin UI Settings
|
|
32
|
+
- Configure CONTRACT_WHITELIST/ALLOWED_TOKENS policies for provider contracts
|
|
33
|
+
|
|
24
34
|
```
|
|
25
35
|
Authorization: Bearer wai_sess_eyJ...
|
|
26
36
|
```
|
package/skills/admin.skill.md
CHANGED
|
@@ -3,7 +3,7 @@ name: "WAIaaS Admin"
|
|
|
3
3
|
description: "Admin API: daemon status, kill switch, notifications, settings management, JWT rotation, shutdown, oracle status, API key management"
|
|
4
4
|
category: "api"
|
|
5
5
|
tags: [wallet, blockchain, admin, security, oracle, defi, waiass]
|
|
6
|
-
version: "2.
|
|
6
|
+
version: "2.6.0-rc.1"
|
|
7
7
|
dispatch:
|
|
8
8
|
kind: "tool"
|
|
9
9
|
allowedCommands: ["curl"]
|
|
@@ -11,6 +11,8 @@ dispatch:
|
|
|
11
11
|
|
|
12
12
|
# WAIaaS Admin API
|
|
13
13
|
|
|
14
|
+
> **Operator only.** All admin endpoints require masterAuth (X-Master-Password). AI agents must NOT use these endpoints — they are for the Operator via Admin UI or CLI.
|
|
15
|
+
|
|
14
16
|
Admin endpoints for daemon operations management. Covers health monitoring, emergency kill switch, notification channels, settings (RPC, security, notifications), JWT secret rotation, and graceful shutdown.
|
|
15
17
|
|
|
16
18
|
## Base URL
|
|
@@ -31,6 +33,60 @@ The master password is set in `config.toml` under `[security]` or via environmen
|
|
|
31
33
|
|
|
32
34
|
---
|
|
33
35
|
|
|
36
|
+
## Session Creation (Multi-Wallet)
|
|
37
|
+
|
|
38
|
+
### POST /v1/sessions -- Create Session (masterAuth)
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
curl -s -X POST http://localhost:3100/v1/sessions \
|
|
42
|
+
-H 'Content-Type: application/json' \
|
|
43
|
+
-H 'X-Master-Password: <password>' \
|
|
44
|
+
-d '{"walletIds": ["wallet-1-uuid", "wallet-2-uuid"], "defaultWalletId": "wallet-1-uuid"}'
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Body:
|
|
48
|
+
- `walletIds`: string[] -- Connect multiple wallets (new)
|
|
49
|
+
- `walletId`: string -- Connect single wallet (backward compatible)
|
|
50
|
+
- `defaultWalletId`?: string -- Specify default wallet (optional, defaults to first)
|
|
51
|
+
- `expiresIn`?: number -- TTL in seconds
|
|
52
|
+
|
|
53
|
+
## Session-Wallet Management (masterAuth required)
|
|
54
|
+
|
|
55
|
+
Dynamic wallet management for existing sessions.
|
|
56
|
+
|
|
57
|
+
| Method | Endpoint | Description |
|
|
58
|
+
|--------|----------|-------------|
|
|
59
|
+
| POST | `/v1/sessions/:id/wallets` | Add wallet `{ walletId }` |
|
|
60
|
+
| DELETE | `/v1/sessions/:id/wallets/:walletId` | Remove wallet |
|
|
61
|
+
| PATCH | `/v1/sessions/:id/wallets/:walletId/default` | Set default |
|
|
62
|
+
| GET | `/v1/sessions/:id/wallets` | List connected wallets |
|
|
63
|
+
|
|
64
|
+
Wallet addition/removal triggers `SESSION_WALLET_ADDED` / `SESSION_WALLET_REMOVED` notifications.
|
|
65
|
+
|
|
66
|
+
## Agent Self-Discovery
|
|
67
|
+
|
|
68
|
+
### GET /v1/connect-info (sessionAuth)
|
|
69
|
+
|
|
70
|
+
Returns wallets, policies, capabilities, and AI prompt for the authenticated session.
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
curl -s http://localhost:3100/v1/connect-info \
|
|
74
|
+
-H 'Authorization: Bearer <session-token>'
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### POST /admin/agent-prompt (masterAuth)
|
|
78
|
+
|
|
79
|
+
Creates a multi-wallet session and returns a connection prompt with session token.
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
curl -s -X POST http://localhost:3100/v1/admin/agent-prompt \
|
|
83
|
+
-H 'Content-Type: application/json' \
|
|
84
|
+
-H 'X-Master-Password: <password>' \
|
|
85
|
+
-d '{"walletIds": ["wallet-1-uuid", "wallet-2-uuid"]}'
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
34
90
|
## 1. Daemon Status & Control
|
|
35
91
|
|
|
36
92
|
> **See also:** `GET /health` (no auth required, includes version check info: `latestVersion`, `updateAvailable`, `schemaVersion`). Documented in **quickstart.skill.md** Step 1.
|
package/skills/policies.skill.md
CHANGED
|
@@ -3,7 +3,7 @@ name: "WAIaaS Policies"
|
|
|
3
3
|
description: "Policy engine CRUD: 12 policy types for spending limits, whitelists, time restrictions, rate limits, token/contract/approve controls, network restrictions, x402 domain controls"
|
|
4
4
|
category: "api"
|
|
5
5
|
tags: [wallet, blockchain, policies, security, waiass]
|
|
6
|
-
version: "2.
|
|
6
|
+
version: "2.6.0-rc.1"
|
|
7
7
|
dispatch:
|
|
8
8
|
kind: "tool"
|
|
9
9
|
allowedCommands: ["curl"]
|
|
@@ -11,6 +11,8 @@ dispatch:
|
|
|
11
11
|
|
|
12
12
|
# WAIaaS Policy Management
|
|
13
13
|
|
|
14
|
+
> **Policy CRUD (create/update/delete) is Operator only** (requires masterAuth). AI agents can read policies via GET endpoints with sessionAuth, but cannot modify them.
|
|
15
|
+
|
|
14
16
|
Policy engine for enforcing rules on wallet operations. Policies control spending limits, allowed recipients, time windows, rate limits, token whitelists, contract access, approval requirements, and network restrictions.
|
|
15
17
|
|
|
16
18
|
## Base URL
|
|
@@ -19,22 +21,36 @@ Policy engine for enforcing rules on wallet operations. Policies control spendin
|
|
|
19
21
|
http://localhost:3100
|
|
20
22
|
```
|
|
21
23
|
|
|
24
|
+
## Permissions
|
|
25
|
+
|
|
26
|
+
### Agent (sessionAuth)
|
|
27
|
+
- **GET /v1/policies** -- Query policies applied to own wallet (filtered by session wallet)
|
|
28
|
+
|
|
29
|
+
### Admin (masterAuth)
|
|
30
|
+
- **GET /v1/policies** -- Query all policies (with optional walletId filter)
|
|
31
|
+
- **POST /v1/policies** -- Create new policies
|
|
32
|
+
- **PUT /v1/policies/{id}** -- Update existing policies
|
|
33
|
+
- **DELETE /v1/policies/{id}** -- Delete policies
|
|
34
|
+
|
|
22
35
|
## Authentication
|
|
23
36
|
|
|
24
|
-
|
|
37
|
+
- **GET** accepts both `Authorization: Bearer <token>` (sessionAuth) and `X-Master-Password` (masterAuth).
|
|
38
|
+
- sessionAuth: returns only policies for the session's wallet + global policies.
|
|
39
|
+
- masterAuth: returns all policies (with optional walletId filter).
|
|
40
|
+
- **POST/PUT/DELETE** require `X-Master-Password` (masterAuth) only.
|
|
25
41
|
|
|
26
42
|
---
|
|
27
43
|
|
|
28
44
|
## 1. Policy CRUD Endpoints
|
|
29
45
|
|
|
30
|
-
### POST /v1/policies -- Create Policy
|
|
46
|
+
### POST /v1/policies -- Create Policy (masterAuth)
|
|
31
47
|
|
|
32
48
|
Create a new policy. Policies can be wallet-specific (`walletId`) or global (omit `walletId`).
|
|
33
49
|
|
|
34
50
|
```bash
|
|
35
51
|
curl -s -X POST http://localhost:3100/v1/policies \
|
|
36
52
|
-H 'Content-Type: application/json' \
|
|
37
|
-
-H '
|
|
53
|
+
-H 'X-Master-Password: <password>' \
|
|
38
54
|
-d '{
|
|
39
55
|
"walletId": "<wallet-uuid>",
|
|
40
56
|
"type": "SPENDING_LIMIT",
|
|
@@ -70,13 +86,18 @@ curl -s -X POST http://localhost:3100/v1/policies \
|
|
|
70
86
|
}
|
|
71
87
|
```
|
|
72
88
|
|
|
73
|
-
### GET /v1/policies -- List Policies
|
|
89
|
+
### GET /v1/policies -- List Policies (sessionAuth or masterAuth)
|
|
74
90
|
|
|
75
|
-
List policies.
|
|
91
|
+
List policies. Agents see only their own wallet's policies + global policies. Admins see all.
|
|
76
92
|
|
|
77
93
|
```bash
|
|
78
|
-
|
|
94
|
+
# Agent (sessionAuth) -- auto-scoped to session wallet
|
|
95
|
+
curl -s 'http://localhost:3100/v1/policies' \
|
|
79
96
|
-H 'Authorization: Bearer <token>'
|
|
97
|
+
|
|
98
|
+
# Admin (masterAuth) -- all policies or filtered
|
|
99
|
+
curl -s 'http://localhost:3100/v1/policies?walletId=<wallet-uuid>' \
|
|
100
|
+
-H 'X-Master-Password: <password>'
|
|
80
101
|
```
|
|
81
102
|
|
|
82
103
|
**Query Parameters:**
|
|
@@ -87,14 +108,14 @@ curl -s 'http://localhost:3100/v1/policies?walletId=<wallet-uuid>' \
|
|
|
87
108
|
|
|
88
109
|
**Response (200):** Array of policy objects, ordered by priority descending.
|
|
89
110
|
|
|
90
|
-
### PUT /v1/policies/{id} -- Update Policy
|
|
111
|
+
### PUT /v1/policies/{id} -- Update Policy (masterAuth)
|
|
91
112
|
|
|
92
113
|
Update a policy's rules, priority, or enabled state. All fields are optional (partial update).
|
|
93
114
|
|
|
94
115
|
```bash
|
|
95
116
|
curl -s -X PUT http://localhost:3100/v1/policies/<policy-uuid> \
|
|
96
117
|
-H 'Content-Type: application/json' \
|
|
97
|
-
-H '
|
|
118
|
+
-H 'X-Master-Password: <password>' \
|
|
98
119
|
-d '{"rules": {"instant_max": "200000000", "notify_max": "1000000000", "delay_max": "2000000000"}, "enabled": true}'
|
|
99
120
|
```
|
|
100
121
|
|
|
@@ -108,11 +129,11 @@ curl -s -X PUT http://localhost:3100/v1/policies/<policy-uuid> \
|
|
|
108
129
|
|
|
109
130
|
**Response (200):** Updated policy object.
|
|
110
131
|
|
|
111
|
-
### DELETE /v1/policies/{id} -- Delete Policy
|
|
132
|
+
### DELETE /v1/policies/{id} -- Delete Policy (masterAuth)
|
|
112
133
|
|
|
113
134
|
```bash
|
|
114
135
|
curl -s -X DELETE http://localhost:3100/v1/policies/<policy-uuid> \
|
|
115
|
-
-H '
|
|
136
|
+
-H 'X-Master-Password: <password>'
|
|
116
137
|
```
|
|
117
138
|
|
|
118
139
|
**Response (200):**
|
|
@@ -164,7 +185,7 @@ Maximum spend per tier. Amounts are digit strings in the chain's smallest unit (
|
|
|
164
185
|
```bash
|
|
165
186
|
curl -s -X POST http://localhost:3100/v1/policies \
|
|
166
187
|
-H 'Content-Type: application/json' \
|
|
167
|
-
-H '
|
|
188
|
+
-H 'X-Master-Password: <password>' \
|
|
168
189
|
-d '{"walletId":"<uuid>","type":"SPENDING_LIMIT","rules":{"instant_max":"100000000","notify_max":"500000000","delay_max":"1000000000","daily_limit_usd":500,"monthly_limit_usd":5000}}'
|
|
169
190
|
```
|
|
170
191
|
|
|
@@ -186,7 +207,7 @@ Allowed recipient addresses. Transactions to addresses not in the list are block
|
|
|
186
207
|
```bash
|
|
187
208
|
curl -s -X POST http://localhost:3100/v1/policies \
|
|
188
209
|
-H 'Content-Type: application/json' \
|
|
189
|
-
-H '
|
|
210
|
+
-H 'X-Master-Password: <password>' \
|
|
190
211
|
-d '{"walletId":"<uuid>","type":"WHITELIST","rules":{"allowed_addresses":["<addr1>","<addr2>"]}}'
|
|
191
212
|
```
|
|
192
213
|
|
|
@@ -210,7 +231,7 @@ Allowed time windows for transactions. Transactions outside the window are block
|
|
|
210
231
|
```bash
|
|
211
232
|
curl -s -X POST http://localhost:3100/v1/policies \
|
|
212
233
|
-H 'Content-Type: application/json' \
|
|
213
|
-
-H '
|
|
234
|
+
-H 'X-Master-Password: <password>' \
|
|
214
235
|
-d '{"walletId":"<uuid>","type":"TIME_RESTRICTION","rules":{"allowedHours":{"start":9,"end":17},"timezone":"UTC"}}'
|
|
215
236
|
```
|
|
216
237
|
|
|
@@ -234,7 +255,7 @@ Maximum number of transactions per time period.
|
|
|
234
255
|
```bash
|
|
235
256
|
curl -s -X POST http://localhost:3100/v1/policies \
|
|
236
257
|
-H 'Content-Type: application/json' \
|
|
237
|
-
-H '
|
|
258
|
+
-H 'X-Master-Password: <password>' \
|
|
238
259
|
-d '{"walletId":"<uuid>","type":"RATE_LIMIT","rules":{"maxTransactions":10,"period":"hourly"}}'
|
|
239
260
|
```
|
|
240
261
|
|
|
@@ -247,7 +268,7 @@ Token whitelist for TOKEN_TRANSFER transactions. **Default deny**: tokens not li
|
|
|
247
268
|
{
|
|
248
269
|
"tokens": [
|
|
249
270
|
{"address": "<mint-or-contract>", "symbol": "USDC", "chain": "solana"},
|
|
250
|
-
{"address": "<erc20-address>", "symbol": "USDT", "chain": "ethereum"}
|
|
271
|
+
{"address": "<erc20-address>", "symbol": "USDT", "chain": "ethereum", "assetId": "eip155:1/erc20:<erc20-address>"}
|
|
251
272
|
]
|
|
252
273
|
}
|
|
253
274
|
```
|
|
@@ -258,11 +279,14 @@ Token whitelist for TOKEN_TRANSFER transactions. **Default deny**: tokens not li
|
|
|
258
279
|
| `address` | string | Yes | Token mint (Solana) or contract address (EVM). |
|
|
259
280
|
| `symbol` | string | No | Token symbol for display (e.g., "USDC"). |
|
|
260
281
|
| `chain` | string | No | "solana" or "ethereum". For documentation only. |
|
|
282
|
+
| `assetId` | string | No | CAIP-19 asset identifier. Enables cross-chain matching. |
|
|
283
|
+
|
|
284
|
+
**CAIP-19 matching:** When `assetId` is present in both the policy token entry and the transaction's token object, exact CAIP-19 matching is used (highest confidence). When only one side has `assetId`, the daemon extracts and compares addresses. When neither has `assetId`, legacy address-only matching is used. All 4 scenarios are backward compatible.
|
|
261
285
|
|
|
262
286
|
```bash
|
|
263
287
|
curl -s -X POST http://localhost:3100/v1/policies \
|
|
264
288
|
-H 'Content-Type: application/json' \
|
|
265
|
-
-H '
|
|
289
|
+
-H 'X-Master-Password: <password>' \
|
|
266
290
|
-d '{"walletId":"<uuid>","type":"ALLOWED_TOKENS","rules":{"tokens":[{"address":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","symbol":"USDC","chain":"solana"}]}}'
|
|
267
291
|
```
|
|
268
292
|
|
|
@@ -289,7 +313,7 @@ Contract address whitelist for CONTRACT_CALL transactions. **Default deny**: con
|
|
|
289
313
|
```bash
|
|
290
314
|
curl -s -X POST http://localhost:3100/v1/policies \
|
|
291
315
|
-H 'Content-Type: application/json' \
|
|
292
|
-
-H '
|
|
316
|
+
-H 'X-Master-Password: <password>' \
|
|
293
317
|
-d '{"walletId":"<uuid>","type":"CONTRACT_WHITELIST","rules":{"contracts":[{"address":"0xE592427A0AEce92De3Edee1F18E0157C05861564","name":"Uniswap V3 Router","chain":"ethereum"}]}}'
|
|
294
318
|
```
|
|
295
319
|
|
|
@@ -321,7 +345,7 @@ Common EVM selectors:
|
|
|
321
345
|
```bash
|
|
322
346
|
curl -s -X POST http://localhost:3100/v1/policies \
|
|
323
347
|
-H 'Content-Type: application/json' \
|
|
324
|
-
-H '
|
|
348
|
+
-H 'X-Master-Password: <password>' \
|
|
325
349
|
-d '{"walletId":"<uuid>","type":"METHOD_WHITELIST","rules":{"methods":[{"contractAddress":"0xE592427A0AEce92De3Edee1F18E0157C05861564","selectors":["0xa9059cbb","0x095ea7b3"]}]}}'
|
|
326
350
|
```
|
|
327
351
|
|
|
@@ -348,7 +372,7 @@ Allowed spender addresses for APPROVE transactions. **Default deny**: spenders n
|
|
|
348
372
|
```bash
|
|
349
373
|
curl -s -X POST http://localhost:3100/v1/policies \
|
|
350
374
|
-H 'Content-Type: application/json' \
|
|
351
|
-
-H '
|
|
375
|
+
-H 'X-Master-Password: <password>' \
|
|
352
376
|
-d '{"walletId":"<uuid>","type":"APPROVED_SPENDERS","rules":{"spenders":[{"address":"0xE592427A0AEce92De3Edee1F18E0157C05861564","name":"Uniswap V3 Router","maxAmount":"1000000000000000000"}]}}'
|
|
353
377
|
```
|
|
354
378
|
|
|
@@ -372,7 +396,7 @@ Maximum approval amount and unlimited approval blocking for APPROVE transactions
|
|
|
372
396
|
```bash
|
|
373
397
|
curl -s -X POST http://localhost:3100/v1/policies \
|
|
374
398
|
-H 'Content-Type: application/json' \
|
|
375
|
-
-H '
|
|
399
|
+
-H 'X-Master-Password: <password>' \
|
|
376
400
|
-d '{"walletId":"<uuid>","type":"APPROVE_AMOUNT_LIMIT","rules":{"maxAmount":"1000000000000000000","blockUnlimited":true}}'
|
|
377
401
|
```
|
|
378
402
|
|
|
@@ -394,7 +418,7 @@ Force a specific policy tier for all APPROVE transactions. Useful for requiring
|
|
|
394
418
|
```bash
|
|
395
419
|
curl -s -X POST http://localhost:3100/v1/policies \
|
|
396
420
|
-H 'Content-Type: application/json' \
|
|
397
|
-
-H '
|
|
421
|
+
-H 'X-Master-Password: <password>' \
|
|
398
422
|
-d '{"walletId":"<uuid>","type":"APPROVE_TIER_OVERRIDE","rules":{"tier":"APPROVAL"}}'
|
|
399
423
|
```
|
|
400
424
|
|
|
@@ -421,7 +445,7 @@ Restrict which networks a wallet can use for transactions. Permissive by default
|
|
|
421
445
|
```bash
|
|
422
446
|
curl -s -X POST http://localhost:3100/v1/policies \
|
|
423
447
|
-H 'Content-Type: application/json' \
|
|
424
|
-
-H '
|
|
448
|
+
-H 'X-Master-Password: <password>' \
|
|
425
449
|
-d '{"walletId":"<uuid>","type":"ALLOWED_NETWORKS","rules":{"networks":[{"network":"ethereum-sepolia"},{"network":"polygon-amoy"}]}}'
|
|
426
450
|
```
|
|
427
451
|
|
|
@@ -445,7 +469,7 @@ Allowed domains for x402 automatic payments. **Default deny**: if any X402_ALLOW
|
|
|
445
469
|
```bash
|
|
446
470
|
curl -s -X POST http://localhost:3100/v1/policies \
|
|
447
471
|
-H 'Content-Type: application/json' \
|
|
448
|
-
-H '
|
|
472
|
+
-H 'X-Master-Password: <password>' \
|
|
449
473
|
-d '{"walletId":"<uuid>","type":"X402_ALLOWED_DOMAINS","rules":{"domains":["api.example.com","*.openai.com"]}}'
|
|
450
474
|
```
|
|
451
475
|
|
|
@@ -481,20 +505,20 @@ If no policies of a given default-deny type exist for a wallet, the check is ski
|
|
|
481
505
|
|
|
482
506
|
### Allow USDC token transfers
|
|
483
507
|
|
|
484
|
-
1. Create ALLOWED_TOKENS policy to whitelist USDC:
|
|
508
|
+
1. Create ALLOWED_TOKENS policy to whitelist USDC (with optional CAIP-19 assetId):
|
|
485
509
|
```bash
|
|
486
510
|
curl -s -X POST http://localhost:3100/v1/policies \
|
|
487
511
|
-H 'Content-Type: application/json' \
|
|
488
|
-
-H '
|
|
489
|
-
-d '{"walletId":"<uuid>","type":"ALLOWED_TOKENS","rules":{"tokens":[{"address":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","symbol":"USDC"}]}}'
|
|
512
|
+
-H 'X-Master-Password: <password>' \
|
|
513
|
+
-d '{"walletId":"<uuid>","type":"ALLOWED_TOKENS","rules":{"tokens":[{"address":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","symbol":"USDC","assetId":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}]}}'
|
|
490
514
|
```
|
|
491
515
|
|
|
492
516
|
2. Send TOKEN_TRANSFER (see `transactions.skill.md` for full transaction reference):
|
|
493
517
|
```bash
|
|
494
518
|
curl -s -X POST http://localhost:3100/v1/transactions/send \
|
|
495
519
|
-H 'Content-Type: application/json' \
|
|
496
|
-
-H '
|
|
497
|
-
-d '{"type":"TOKEN_TRANSFER","to":"<recipient>","amount":"5000000","token":{"address":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","decimals":6,"symbol":"USDC"}}'
|
|
520
|
+
-H 'X-Master-Password: <password>' \
|
|
521
|
+
-d '{"type":"TOKEN_TRANSFER","to":"<recipient>","amount":"5000000","token":{"address":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","decimals":6,"symbol":"USDC","assetId":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}}'
|
|
498
522
|
```
|
|
499
523
|
|
|
500
524
|
### Allow Uniswap contract calls
|
|
@@ -503,7 +527,7 @@ curl -s -X POST http://localhost:3100/v1/transactions/send \
|
|
|
503
527
|
```bash
|
|
504
528
|
curl -s -X POST http://localhost:3100/v1/policies \
|
|
505
529
|
-H 'Content-Type: application/json' \
|
|
506
|
-
-H '
|
|
530
|
+
-H 'X-Master-Password: <password>' \
|
|
507
531
|
-d '{"walletId":"<uuid>","type":"CONTRACT_WHITELIST","rules":{"contracts":[{"address":"0xE592427A0AEce92De3Edee1F18E0157C05861564","name":"Uniswap V3 Router"}]}}'
|
|
508
532
|
```
|
|
509
533
|
|
|
@@ -511,7 +535,7 @@ curl -s -X POST http://localhost:3100/v1/policies \
|
|
|
511
535
|
```bash
|
|
512
536
|
curl -s -X POST http://localhost:3100/v1/policies \
|
|
513
537
|
-H 'Content-Type: application/json' \
|
|
514
|
-
-H '
|
|
538
|
+
-H 'X-Master-Password: <password>' \
|
|
515
539
|
-d '{"walletId":"<uuid>","type":"METHOD_WHITELIST","rules":{"methods":[{"contractAddress":"0xE592427A0AEce92De3Edee1F18E0157C05861564","selectors":["0x414bf389"]}]}}'
|
|
516
540
|
```
|
|
517
541
|
|
|
@@ -521,7 +545,7 @@ Create SPENDING_LIMIT with low tier thresholds:
|
|
|
521
545
|
```bash
|
|
522
546
|
curl -s -X POST http://localhost:3100/v1/policies \
|
|
523
547
|
-H 'Content-Type: application/json' \
|
|
524
|
-
-H '
|
|
548
|
+
-H 'X-Master-Password: <password>' \
|
|
525
549
|
-d '{"walletId":"<uuid>","type":"SPENDING_LIMIT","rules":{"instant_max":"10000000","notify_max":"100000000","delay_max":"500000000"}}'
|
|
526
550
|
```
|
|
527
551
|
|
|
@@ -532,7 +556,7 @@ Any transfer exceeding `delay_max` (500M lamports = 0.5 SOL) requires owner appr
|
|
|
532
556
|
```bash
|
|
533
557
|
curl -s -X POST http://localhost:3100/v1/policies \
|
|
534
558
|
-H 'Content-Type: application/json' \
|
|
535
|
-
-H '
|
|
559
|
+
-H 'X-Master-Password: <password>' \
|
|
536
560
|
-d '{"walletId":"<uuid>","type":"APPROVE_TIER_OVERRIDE","rules":{"tier":"APPROVAL"}}'
|
|
537
561
|
```
|
|
538
562
|
|
|
@@ -541,7 +565,7 @@ curl -s -X POST http://localhost:3100/v1/policies \
|
|
|
541
565
|
```bash
|
|
542
566
|
curl -s -X POST http://localhost:3100/v1/policies \
|
|
543
567
|
-H 'Content-Type: application/json' \
|
|
544
|
-
-H '
|
|
568
|
+
-H 'X-Master-Password: <password>' \
|
|
545
569
|
-d '{"walletId":"<uuid>","type":"ALLOWED_NETWORKS","rules":{"networks":[{"network":"ethereum-sepolia"},{"network":"polygon-amoy"}]}}'
|
|
546
570
|
```
|
|
547
571
|
|
|
@@ -553,7 +577,7 @@ Prevent split-transaction bypass by limiting total USD spending per rolling wind
|
|
|
553
577
|
```bash
|
|
554
578
|
curl -s -X POST http://localhost:3100/v1/policies \
|
|
555
579
|
-H 'Content-Type: application/json' \
|
|
556
|
-
-H '
|
|
580
|
+
-H 'X-Master-Password: <password>' \
|
|
557
581
|
-d '{"walletId":"<uuid>","type":"SPENDING_LIMIT","rules":{"instant_max":"100000000","notify_max":"500000000","delay_max":"1000000000","daily_limit_usd":500,"monthly_limit_usd":5000}}'
|
|
558
582
|
```
|
|
559
583
|
|
|
@@ -3,7 +3,7 @@ name: "WAIaaS Quickset"
|
|
|
3
3
|
description: "End-to-end quickset: create wallet, session, check balance, send first transfer"
|
|
4
4
|
category: "api"
|
|
5
5
|
tags: [wallet, blockchain, solana, ethereum, quickset, quickstart, waiass]
|
|
6
|
-
version: "2.
|
|
6
|
+
version: "2.6.0-rc.1"
|
|
7
7
|
dispatch:
|
|
8
8
|
kind: "tool"
|
|
9
9
|
allowedCommands: ["curl"]
|
|
@@ -13,84 +13,42 @@ dispatch:
|
|
|
13
13
|
|
|
14
14
|
WAIaaS (Wallet-as-a-Service for AI Agents) is a self-hosted local daemon that lets AI agents execute on-chain transactions on Solana and Ethereum with policy-based security controls. This guide walks through the complete workflow from creating your first wallet to sending a transaction.
|
|
15
15
|
|
|
16
|
-
##
|
|
17
|
-
|
|
18
|
-
### Magic Word (Agent Connection Prompt)
|
|
19
|
-
|
|
20
|
-
If the user provides a `[WAIaaS Connection]` block, extract connection info and start API calls immediately:
|
|
21
|
-
|
|
22
|
-
- `URL` -> API base URL
|
|
23
|
-
- `Wallets` -> numbered list with wallet name, ID, network, session token
|
|
24
|
-
- `Session` -> use as `Authorization: Bearer {token}` header
|
|
16
|
+
## Base URL
|
|
25
17
|
|
|
26
|
-
Example format:
|
|
27
18
|
```
|
|
28
|
-
|
|
29
|
-
- URL: http://localhost:3100
|
|
30
|
-
|
|
31
|
-
Wallets:
|
|
32
|
-
1. solana-testnet (019c6fb6-...) -- solana-devnet
|
|
33
|
-
Session: eyJhbG...
|
|
19
|
+
http://localhost:3100
|
|
34
20
|
```
|
|
35
21
|
|
|
36
|
-
|
|
22
|
+
All endpoints use this base. The daemon runs locally on port 3100 by default.
|
|
37
23
|
|
|
38
|
-
|
|
39
|
-
1. Extract `sessionId` from JWT payload `sub` claim
|
|
40
|
-
2. `POST /v1/wallets/{walletId}/sessions/{sessionId}/renew`
|
|
41
|
-
3. Use the new token from response for subsequent requests
|
|
24
|
+
## Authentication Model
|
|
42
25
|
|
|
43
|
-
|
|
26
|
+
WAIaaS uses two authentication methods:
|
|
44
27
|
|
|
45
|
-
|
|
46
|
-
|
|
28
|
+
| Auth Type | Header | Used For | Who |
|
|
29
|
+
|-----------|--------|----------|-----|
|
|
30
|
+
| **masterAuth** | `X-Master-Password: <password>` | Wallet creation, session creation, policy config, admin | **Operator only** |
|
|
31
|
+
| **sessionAuth** | `Authorization: Bearer <token>` | Balance queries, transactions, wallet info, session renewal | AI agents |
|
|
47
32
|
|
|
48
|
-
|
|
33
|
+
- **masterAuth** is for administrative operations performed by the **Operator** via Admin UI or CLI. AI agents must NEVER request or use the master password.
|
|
34
|
+
- **sessionAuth** is for wallet-scoped operations. AI agents operate exclusively with session tokens (Bearer wai_sess_...).
|
|
49
35
|
|
|
50
|
-
|
|
36
|
+
## Self-Discovery (Recommended First Step)
|
|
51
37
|
|
|
52
|
-
|
|
38
|
+
Call `GET /v1/connect-info` with your session token to discover:
|
|
39
|
+
- Which wallets you can access
|
|
40
|
+
- What policies apply to each wallet
|
|
41
|
+
- Available capabilities (transfer, sign, x402, actions)
|
|
42
|
+
- AI-ready prompt with usage instructions
|
|
53
43
|
|
|
54
44
|
```bash
|
|
55
|
-
curl -s http://localhost:3100/
|
|
45
|
+
curl -s http://localhost:3100/v1/connect-info \
|
|
46
|
+
-H 'Authorization: Bearer <session-token>'
|
|
56
47
|
```
|
|
57
48
|
|
|
58
|
-
If
|
|
59
|
-
|
|
60
|
-
#### List Existing Wallets (requires masterAuth)
|
|
49
|
+
If using MCP, call the `connect_info` tool instead.
|
|
61
50
|
|
|
62
|
-
|
|
63
|
-
curl -s http://localhost:3100/v1/wallets \
|
|
64
|
-
-H 'X-Master-Password: <master-password>'
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
This returns all wallets. If wallets already exist, you can skip to Step 3 (Create a Session) using an existing wallet ID.
|
|
68
|
-
|
|
69
|
-
> **Note**: The master password is the value set during `waiaas init`.
|
|
70
|
-
>
|
|
71
|
-
> Skill files are API references. For interactive use with an AI agent,
|
|
72
|
-
> set up the MCP server (`waiaas mcp setup`) or provide the daemon URL
|
|
73
|
-
> and authentication credentials directly.
|
|
74
|
-
|
|
75
|
-
## Base URL
|
|
76
|
-
|
|
77
|
-
```
|
|
78
|
-
http://localhost:3100
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
All endpoints use this base. The daemon runs locally on port 3100 by default.
|
|
82
|
-
|
|
83
|
-
## Authentication Model
|
|
84
|
-
|
|
85
|
-
WAIaaS uses two authentication methods:
|
|
86
|
-
|
|
87
|
-
| Auth Type | Header | Used For |
|
|
88
|
-
|-----------|--------|----------|
|
|
89
|
-
| **masterAuth** | `X-Master-Password: <password>` | Wallet creation, session creation, wallet listing, token registry, MCP provisioning, admin |
|
|
90
|
-
| **sessionAuth** | `Authorization: Bearer <token>` | Balance queries, transactions, wallet updates/deletion, session renewal |
|
|
91
|
-
|
|
92
|
-
- **masterAuth** is for administrative operations. The master password is set in `config.toml` or via `WAIAAS_SECURITY_MASTER_PASSWORD` env var.
|
|
93
|
-
- **sessionAuth** is for wallet-scoped operations. You get a JWT token by creating a session (Step 3 below). Each session is bound to one wallet.
|
|
51
|
+
For multi-wallet sessions, specify `wallet_id` parameter to target a specific wallet. Omit to use the default wallet.
|
|
94
52
|
|
|
95
53
|
## Step-by-Step Workflow
|
|
96
54
|
|
|
@@ -125,7 +83,7 @@ Create a new wallet with a key pair. Requires **masterAuth**. Each wallet belong
|
|
|
125
83
|
curl -s -X POST http://localhost:3100/v1/wallets \
|
|
126
84
|
-H 'Content-Type: application/json' \
|
|
127
85
|
-H 'X-Master-Password: your-master-password' \
|
|
128
|
-
-d '{"name": "my-first-wallet", "chain": "solana", "environment": "
|
|
86
|
+
-d '{"name": "my-first-wallet", "chain": "solana", "environment": "mainnet"}'
|
|
129
87
|
```
|
|
130
88
|
|
|
131
89
|
**EVM wallet (Ethereum):**
|
|
@@ -134,13 +92,14 @@ curl -s -X POST http://localhost:3100/v1/wallets \
|
|
|
134
92
|
curl -s -X POST http://localhost:3100/v1/wallets \
|
|
135
93
|
-H 'Content-Type: application/json' \
|
|
136
94
|
-H 'X-Master-Password: your-master-password' \
|
|
137
|
-
-d '{"name": "my-eth-wallet", "chain": "ethereum", "environment": "
|
|
95
|
+
-d '{"name": "my-eth-wallet", "chain": "ethereum", "environment": "mainnet"}'
|
|
138
96
|
```
|
|
139
97
|
|
|
140
98
|
Parameters:
|
|
141
99
|
- `name` (required): 1-100 characters
|
|
142
100
|
- `chain` (optional): `"solana"` (default) or `"ethereum"`
|
|
143
|
-
- `environment` (optional): `"
|
|
101
|
+
- `environment` (optional): `"mainnet"` (default) or `"testnet"` -- determines available networks
|
|
102
|
+
- `createSession` (optional): boolean, default `true` -- auto-creates a session and includes it in the response
|
|
144
103
|
|
|
145
104
|
Response (201):
|
|
146
105
|
```json
|
|
@@ -148,45 +107,48 @@ Response (201):
|
|
|
148
107
|
"id": "01958f3a-1234-7000-8000-abcdef123456",
|
|
149
108
|
"name": "my-first-wallet",
|
|
150
109
|
"chain": "solana",
|
|
151
|
-
"network": "
|
|
152
|
-
"environment": "
|
|
110
|
+
"network": "mainnet",
|
|
111
|
+
"environment": "mainnet",
|
|
153
112
|
"publicKey": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
|
|
154
113
|
"status": "ACTIVE",
|
|
155
|
-
"createdAt": 1707000000
|
|
114
|
+
"createdAt": 1707000000,
|
|
115
|
+
"session": {
|
|
116
|
+
"id": "01958f3b-5678-7000-8000-abcdef654321",
|
|
117
|
+
"token": "wai_sess_eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
|
|
118
|
+
"expiresAt": 1709592000
|
|
119
|
+
}
|
|
156
120
|
}
|
|
157
121
|
```
|
|
158
122
|
|
|
159
|
-
The `network` field shows the wallet's default network, automatically assigned based on the chain and environment. For Solana
|
|
123
|
+
The `network` field shows the wallet's default network, automatically assigned based on the chain and environment. For Solana mainnet, the default is `mainnet`. For Ethereum mainnet, the default is `ethereum-mainnet`.
|
|
160
124
|
|
|
161
|
-
Save the `
|
|
125
|
+
The `session` field contains the auto-created session token. Save the `token` value -- use it as `Authorization: Bearer <token>` for all wallet operations below. To skip auto-session creation, set `createSession: false`.
|
|
162
126
|
|
|
163
|
-
### Step 3: Create
|
|
127
|
+
### Step 3: Create Additional Sessions (Optional)
|
|
164
128
|
|
|
165
|
-
|
|
129
|
+
A session is already created in Step 2. Use this only if you need additional sessions. Requires **masterAuth**.
|
|
166
130
|
|
|
167
131
|
```bash
|
|
168
132
|
curl -s -X POST http://localhost:3100/v1/sessions \
|
|
169
133
|
-H 'Content-Type: application/json' \
|
|
170
134
|
-H 'X-Master-Password: your-master-password' \
|
|
171
|
-
-d '{"walletId": "01958f3a-1234-7000-8000-abcdef123456", "ttl":
|
|
135
|
+
-d '{"walletId": "01958f3a-1234-7000-8000-abcdef123456", "ttl": 2592000}'
|
|
172
136
|
```
|
|
173
137
|
|
|
174
138
|
Parameters:
|
|
175
139
|
- `walletId` (required): UUID of the wallet from Step 2
|
|
176
|
-
- `ttl` (optional): session lifetime in seconds, 300-
|
|
140
|
+
- `ttl` (optional): session lifetime in seconds, 300-31536000 (default: 2592000 = 30 days)
|
|
177
141
|
|
|
178
142
|
Response (201):
|
|
179
143
|
```json
|
|
180
144
|
{
|
|
181
145
|
"id": "01958f3b-5678-7000-8000-abcdef654321",
|
|
182
146
|
"token": "wai_sess_eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
|
|
183
|
-
"expiresAt":
|
|
147
|
+
"expiresAt": 1709592000,
|
|
184
148
|
"walletId": "01958f3a-1234-7000-8000-abcdef123456"
|
|
185
149
|
}
|
|
186
150
|
```
|
|
187
151
|
|
|
188
|
-
Save the `token` value -- use it as `Authorization: Bearer <token>` for all wallet operations below.
|
|
189
|
-
|
|
190
152
|
### Step 4: Check Balance
|
|
191
153
|
|
|
192
154
|
Get the native token balance (SOL for Solana, ETH for Ethereum). Requires **sessionAuth**.
|
|
@@ -203,7 +165,7 @@ Response:
|
|
|
203
165
|
{
|
|
204
166
|
"walletId": "01958f3a-1234-7000-8000-abcdef123456",
|
|
205
167
|
"chain": "solana",
|
|
206
|
-
"network": "
|
|
168
|
+
"network": "mainnet",
|
|
207
169
|
"address": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
|
|
208
170
|
"balance": "1000000000",
|
|
209
171
|
"decimals": 9,
|
|
@@ -229,7 +191,7 @@ Response:
|
|
|
229
191
|
{
|
|
230
192
|
"walletId": "01958f3a-1234-7000-8000-abcdef123456",
|
|
231
193
|
"chain": "solana",
|
|
232
|
-
"network": "
|
|
194
|
+
"network": "mainnet",
|
|
233
195
|
"assets": [
|
|
234
196
|
{
|
|
235
197
|
"mint": "So11111111111111111111111111111111111111112",
|
|
@@ -302,7 +264,7 @@ Response:
|
|
|
302
264
|
"status": "CONFIRMED",
|
|
303
265
|
"tier": "INSTANT",
|
|
304
266
|
"chain": "solana",
|
|
305
|
-
"network": "
|
|
267
|
+
"network": "mainnet",
|
|
306
268
|
"toAddress": "9aE476sH92Vz7DMPyq5WLPkrKWivxeuTKEFKd2sZZcde",
|
|
307
269
|
"amount": "100000000",
|
|
308
270
|
"txHash": "5UfD...abc",
|
|
@@ -323,10 +285,10 @@ Transaction status values:
|
|
|
323
285
|
If you have the CLI installed, create wallets in one step:
|
|
324
286
|
|
|
325
287
|
```bash
|
|
326
|
-
waiaas quickset
|
|
288
|
+
waiaas quickset
|
|
327
289
|
```
|
|
328
290
|
|
|
329
|
-
This creates Solana + EVM wallets and prints MCP configuration.
|
|
291
|
+
This creates Solana + EVM wallets in mainnet mode (default) and prints MCP configuration. Use `--mode testnet` for testnet.
|
|
330
292
|
|
|
331
293
|
## Error Handling
|
|
332
294
|
|
|
@@ -363,5 +325,31 @@ Common error codes:
|
|
|
363
325
|
- **transactions.skill.md** -- All 5 transaction types (TRANSFER, TOKEN_TRANSFER, CONTRACT_CALL, APPROVE, BATCH) with full parameters
|
|
364
326
|
- **policies.skill.md** -- Policy management (spending limits, whitelists, rate limits, approval tiers)
|
|
365
327
|
- **admin.skill.md** -- Admin operations (kill switch, status, settings, notifications)
|
|
366
|
-
|
|
367
|
-
|
|
328
|
+
|
|
329
|
+
## Asset Identification (CAIP-19)
|
|
330
|
+
|
|
331
|
+
WAIaaS supports CAIP-19 standard asset identifiers for unambiguous cross-chain token identification. When sending token transfers, you can include an optional `assetId` field in the token object:
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
curl -s -X POST http://localhost:3100/v1/transactions/send \
|
|
335
|
+
-H 'Content-Type: application/json' \
|
|
336
|
+
-H 'Authorization: Bearer wai_sess_eyJ...' \
|
|
337
|
+
-d '{
|
|
338
|
+
"type": "TOKEN_TRANSFER",
|
|
339
|
+
"to": "9aE476sH92Vz7DMPyq5WLPkrKWivxeuTKEFKd2sZZcde",
|
|
340
|
+
"amount": "5000000",
|
|
341
|
+
"token": {
|
|
342
|
+
"address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
|
|
343
|
+
"decimals": 6,
|
|
344
|
+
"symbol": "USDC",
|
|
345
|
+
"assetId": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
|
|
346
|
+
}
|
|
347
|
+
}'
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
CAIP-19 format: `{chain_id}/{asset_namespace}:{asset_reference}`
|
|
351
|
+
- EVM tokens: `eip155:{chainId}/erc20:{lowercase_address}`
|
|
352
|
+
- Solana tokens: `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:{base58_address}`
|
|
353
|
+
- Native assets: `{chain_id}/slip44:{coin_type}` (ETH=60, SOL=501, POL=966)
|
|
354
|
+
|
|
355
|
+
The `assetId` field is optional and backward compatible. See **transactions.skill.md** section 13 for full CAIP-19 reference.
|
|
@@ -3,7 +3,7 @@ name: "WAIaaS Transactions"
|
|
|
3
3
|
description: "All 5 transaction types (TRANSFER, TOKEN_TRANSFER, CONTRACT_CALL, APPROVE, BATCH) with lifecycle management"
|
|
4
4
|
category: "api"
|
|
5
5
|
tags: [wallet, blockchain, solana, ethereum, transactions, waiass]
|
|
6
|
-
version: "2.
|
|
6
|
+
version: "2.6.0-rc.1"
|
|
7
7
|
dispatch:
|
|
8
8
|
kind: "tool"
|
|
9
9
|
allowedCommands: ["curl"]
|
|
@@ -13,6 +13,20 @@ dispatch:
|
|
|
13
13
|
|
|
14
14
|
Complete reference for all 5 transaction types, lifecycle management, and policy interaction. All endpoints use base URL `http://localhost:3100`. Transaction endpoints require **sessionAuth** (`Authorization: Bearer <token>`) unless noted otherwise.
|
|
15
15
|
|
|
16
|
+
## Permissions
|
|
17
|
+
|
|
18
|
+
### Agent (sessionAuth)
|
|
19
|
+
- Send all 5 transaction types via `POST /v1/transactions/send`
|
|
20
|
+
- Sign raw transactions via `POST /v1/transactions/sign`
|
|
21
|
+
- Query transaction status and history
|
|
22
|
+
- Renew session tokens
|
|
23
|
+
|
|
24
|
+
### Owner (ownerAuth -- SIWS/SIWE)
|
|
25
|
+
- Approve pending transactions via `POST /v1/transactions/{id}/approve`
|
|
26
|
+
- Reject pending transactions via `POST /v1/transactions/{id}/reject`
|
|
27
|
+
|
|
28
|
+
**Prerequisite:** Policy types (ALLOWED_TOKENS, CONTRACT_WHITELIST, APPROVED_SPENDERS) must be configured by admin before agents can use TOKEN_TRANSFER, CONTRACT_CALL, and APPROVE transaction types.
|
|
29
|
+
|
|
16
30
|
## 1. Overview
|
|
17
31
|
|
|
18
32
|
WAIaaS uses a **discriminatedUnion 5-type** system for transactions. The `type` field in the request body determines which transaction variant to execute:
|
|
@@ -124,6 +138,7 @@ Parameters:
|
|
|
124
138
|
- `address` (required): mint address (SPL) or contract address (ERC-20)
|
|
125
139
|
- `decimals` (required): integer, 0-18
|
|
126
140
|
- `symbol` (required): string, 1-10 characters
|
|
141
|
+
- `assetId` (optional): CAIP-19 asset identifier (e.g., `"eip155:1/erc20:0xa0b8..."`). Cross-validated against `address` when provided.
|
|
127
142
|
- `memo` (optional): string, max 256 characters
|
|
128
143
|
- `network` (optional): target network for this transaction. Defaults to wallet's default network. Must be valid for the wallet's environment.
|
|
129
144
|
|
|
@@ -250,6 +265,7 @@ Parameters:
|
|
|
250
265
|
- `address` (required): token contract/mint address
|
|
251
266
|
- `decimals` (required): integer, 0-18
|
|
252
267
|
- `symbol` (required): string, 1-10 characters
|
|
268
|
+
- `assetId` (optional): CAIP-19 asset identifier. Cross-validated against `address` when provided.
|
|
253
269
|
- `amount` (required): string of digits, max approval amount in token's smallest unit
|
|
254
270
|
- `network` (optional): target network for this transaction. Defaults to wallet's default network. Must be valid for the wallet's environment.
|
|
255
271
|
|
|
@@ -705,3 +721,72 @@ curl -s -X POST http://localhost:3100/v1/utils/encode-calldata \
|
|
|
705
721
|
- Python: `await client.encode_calldata(abi, function_name, args)`
|
|
706
722
|
|
|
707
723
|
**MCP Tool:** `encode_calldata` with parameters `abi`, `functionName`, `args`
|
|
724
|
+
|
|
725
|
+
## 13. CAIP-19 Asset Identification
|
|
726
|
+
|
|
727
|
+
WAIaaS supports [CAIP-19](https://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-19.md) standard asset identifiers for cross-chain token identification. The `assetId` field is an optional addition to token objects in TOKEN_TRANSFER and APPROVE requests.
|
|
728
|
+
|
|
729
|
+
### Format
|
|
730
|
+
|
|
731
|
+
```
|
|
732
|
+
{CAIP-2 chain ID}/{asset namespace}:{asset reference}
|
|
733
|
+
```
|
|
734
|
+
|
|
735
|
+
### Examples by Chain
|
|
736
|
+
|
|
737
|
+
| Chain | Type | assetId | Description |
|
|
738
|
+
|-------|------|---------|-------------|
|
|
739
|
+
| Ethereum | ERC-20 | `eip155:1/erc20:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48` | USDC on Ethereum Mainnet |
|
|
740
|
+
| Polygon | ERC-20 | `eip155:137/erc20:0x3c499c542cef5e3811e1192ce70d8cc03d5c3359` | USDC on Polygon |
|
|
741
|
+
| Solana | SPL | `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v` | USDC on Solana Mainnet |
|
|
742
|
+
| Ethereum | Native | `eip155:1/slip44:60` | ETH (native) |
|
|
743
|
+
| Solana | Native | `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501` | SOL (native) |
|
|
744
|
+
| Polygon | Native | `eip155:137/slip44:966` | POL (native) |
|
|
745
|
+
|
|
746
|
+
**Important:** EVM addresses in CAIP-19 must be **lowercase** (not checksummed).
|
|
747
|
+
|
|
748
|
+
### Usage in TOKEN_TRANSFER
|
|
749
|
+
|
|
750
|
+
```bash
|
|
751
|
+
curl -s -X POST http://localhost:3100/v1/transactions/send \
|
|
752
|
+
-H 'Content-Type: application/json' \
|
|
753
|
+
-H 'Authorization: Bearer wai_sess_eyJ...' \
|
|
754
|
+
-d '{
|
|
755
|
+
"type": "TOKEN_TRANSFER",
|
|
756
|
+
"to": "0x742d35Cc6634C0532925a3b844Bc9e7595f2bD16",
|
|
757
|
+
"amount": "5000000",
|
|
758
|
+
"token": {
|
|
759
|
+
"address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
|
|
760
|
+
"decimals": 6,
|
|
761
|
+
"symbol": "USDC",
|
|
762
|
+
"assetId": "eip155:1/erc20:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
|
|
763
|
+
}
|
|
764
|
+
}'
|
|
765
|
+
```
|
|
766
|
+
|
|
767
|
+
### Usage in APPROVE
|
|
768
|
+
|
|
769
|
+
```bash
|
|
770
|
+
curl -s -X POST http://localhost:3100/v1/transactions/send \
|
|
771
|
+
-H 'Content-Type: application/json' \
|
|
772
|
+
-H 'Authorization: Bearer wai_sess_eyJ...' \
|
|
773
|
+
-d '{
|
|
774
|
+
"type": "APPROVE",
|
|
775
|
+
"spender": "0xE592427A0AEce92De3Edee1F18E0157C05861564",
|
|
776
|
+
"token": {
|
|
777
|
+
"address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
|
|
778
|
+
"decimals": 6,
|
|
779
|
+
"symbol": "USDC",
|
|
780
|
+
"assetId": "eip155:1/erc20:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
|
|
781
|
+
},
|
|
782
|
+
"amount": "1000000000"
|
|
783
|
+
}'
|
|
784
|
+
```
|
|
785
|
+
|
|
786
|
+
### Cross-Validation
|
|
787
|
+
|
|
788
|
+
When both `address` and `assetId` are provided, the daemon extracts the address from the CAIP-19 URI and validates it matches `token.address` (case-insensitive for EVM). If they don't match, the request is rejected with `ACTION_VALIDATION_FAILED`.
|
|
789
|
+
|
|
790
|
+
### Backward Compatibility
|
|
791
|
+
|
|
792
|
+
`assetId` is fully optional. Existing requests without `assetId` continue to work unchanged. You can gradually adopt CAIP-19 identifiers without breaking existing integrations.
|
package/skills/wallet.skill.md
CHANGED
|
@@ -3,7 +3,7 @@ name: "WAIaaS Wallet Management"
|
|
|
3
3
|
description: "Wallet CRUD, asset queries, session management, token registry, MCP provisioning, owner management"
|
|
4
4
|
category: "api"
|
|
5
5
|
tags: [wallet, blockchain, solana, ethereum, sessions, tokens, mcp, waiass]
|
|
6
|
-
version: "2.
|
|
6
|
+
version: "2.6.0-rc.1"
|
|
7
7
|
dispatch:
|
|
8
8
|
kind: "tool"
|
|
9
9
|
allowedCommands: ["curl"]
|
|
@@ -13,6 +13,24 @@ dispatch:
|
|
|
13
13
|
|
|
14
14
|
Complete reference for wallet CRUD operations, asset queries, session management, token registry, MCP provisioning, and owner management. All endpoints use base URL `http://localhost:3100`.
|
|
15
15
|
|
|
16
|
+
## Permissions
|
|
17
|
+
|
|
18
|
+
### Agent (sessionAuth) — AI agents use these
|
|
19
|
+
- Query wallet balance, assets, address, nonce, and info
|
|
20
|
+
- Send transactions via transaction endpoints (see transactions.skill.md)
|
|
21
|
+
- Get registered tokens via `GET /v1/tokens`
|
|
22
|
+
- Get applied policies via `GET /v1/policies`
|
|
23
|
+
|
|
24
|
+
### Operator only (masterAuth) — NOT for AI agents
|
|
25
|
+
- Create/list/update/delete wallets
|
|
26
|
+
- Create/list/delete sessions, manage session-wallet links
|
|
27
|
+
- Create/delete MCP tokens
|
|
28
|
+
- Register/remove custom tokens
|
|
29
|
+
- Set owner addresses, default network, additional networks
|
|
30
|
+
- WalletConnect pairing management
|
|
31
|
+
|
|
32
|
+
> AI agents must NEVER request the master password. Use only your session token.
|
|
33
|
+
|
|
16
34
|
## 1. Wallet CRUD
|
|
17
35
|
|
|
18
36
|
All wallet CRUD endpoints require **masterAuth** (`X-Master-Password` header), except `PUT /v1/wallets/{id}` and `DELETE /v1/wallets/{id}` which require **sessionAuth** (`Authorization: Bearer <token>`).
|
|
@@ -25,13 +43,13 @@ Create a new wallet with an auto-generated key pair. Each wallet belongs to an *
|
|
|
25
43
|
curl -s -X POST http://localhost:3100/v1/wallets \
|
|
26
44
|
-H 'Content-Type: application/json' \
|
|
27
45
|
-H 'X-Master-Password: your-master-password' \
|
|
28
|
-
-d '{"name": "trading-bot", "chain": "solana", "environment": "
|
|
46
|
+
-d '{"name": "trading-bot", "chain": "solana", "environment": "mainnet"}'
|
|
29
47
|
```
|
|
30
48
|
|
|
31
49
|
Parameters:
|
|
32
50
|
- `name` (required): string, 1-100 characters
|
|
33
51
|
- `chain` (optional): `"solana"` (default) or `"ethereum"`
|
|
34
|
-
- `environment` (optional): `"
|
|
52
|
+
- `environment` (optional): `"mainnet"` (default) or `"testnet"` -- determines available networks and default network
|
|
35
53
|
- `createSession` (optional): boolean, default `true` -- auto-creates a session token in the response
|
|
36
54
|
|
|
37
55
|
Response (201):
|
|
@@ -40,8 +58,8 @@ Response (201):
|
|
|
40
58
|
"id": "01958f3a-1234-7000-8000-abcdef123456",
|
|
41
59
|
"name": "trading-bot",
|
|
42
60
|
"chain": "solana",
|
|
43
|
-
"network": "
|
|
44
|
-
"environment": "
|
|
61
|
+
"network": "mainnet",
|
|
62
|
+
"environment": "mainnet",
|
|
45
63
|
"publicKey": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
|
|
46
64
|
"status": "ACTIVE",
|
|
47
65
|
"createdAt": 1707000000,
|
|
@@ -70,8 +88,8 @@ Response (200):
|
|
|
70
88
|
"id": "01958f3a-1234-7000-8000-abcdef123456",
|
|
71
89
|
"name": "trading-bot",
|
|
72
90
|
"chain": "solana",
|
|
73
|
-
"network": "
|
|
74
|
-
"environment": "
|
|
91
|
+
"network": "mainnet",
|
|
92
|
+
"environment": "mainnet",
|
|
75
93
|
"publicKey": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
|
|
76
94
|
"status": "ACTIVE",
|
|
77
95
|
"createdAt": 1707000000
|
|
@@ -95,9 +113,9 @@ Response (200):
|
|
|
95
113
|
"id": "01958f3a-1234-7000-8000-abcdef123456",
|
|
96
114
|
"name": "trading-bot",
|
|
97
115
|
"chain": "solana",
|
|
98
|
-
"network": "
|
|
99
|
-
"environment": "
|
|
100
|
-
"defaultNetwork": "
|
|
116
|
+
"network": "mainnet",
|
|
117
|
+
"environment": "mainnet",
|
|
118
|
+
"defaultNetwork": "mainnet",
|
|
101
119
|
"publicKey": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
|
|
102
120
|
"status": "ACTIVE",
|
|
103
121
|
"ownerAddress": null,
|
|
@@ -165,8 +183,8 @@ Response (200):
|
|
|
165
183
|
"id": "01958f3a-1234-7000-8000-abcdef123456",
|
|
166
184
|
"name": "trading-bot",
|
|
167
185
|
"chain": "solana",
|
|
168
|
-
"network": "
|
|
169
|
-
"environment": "
|
|
186
|
+
"network": "mainnet",
|
|
187
|
+
"environment": "mainnet",
|
|
170
188
|
"publicKey": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
|
|
171
189
|
"status": "ACTIVE",
|
|
172
190
|
"ownerAddress": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
|
|
@@ -244,18 +262,41 @@ Response (200):
|
|
|
244
262
|
{
|
|
245
263
|
"id": "01958f3a-1234-7000-8000-abcdef123456",
|
|
246
264
|
"chain": "solana",
|
|
247
|
-
"environment": "
|
|
248
|
-
"defaultNetwork": "
|
|
265
|
+
"environment": "mainnet",
|
|
266
|
+
"defaultNetwork": "mainnet",
|
|
249
267
|
"availableNetworks": [
|
|
250
|
-
{"network": "
|
|
251
|
-
{"network": "testnet", "isDefault": false}
|
|
268
|
+
{"network": "mainnet", "isDefault": true}
|
|
252
269
|
]
|
|
253
270
|
}
|
|
254
271
|
```
|
|
255
272
|
|
|
256
|
-
## 2. Wallet
|
|
273
|
+
## 2. Multi-Wallet Operations
|
|
274
|
+
|
|
275
|
+
When your session has multiple wallets, you can target a specific wallet:
|
|
276
|
+
- GET requests: add `?walletId=<id>` query parameter
|
|
277
|
+
- POST requests: add `walletId` field in request body
|
|
278
|
+
- Omitting walletId uses the session's default wallet
|
|
279
|
+
|
|
280
|
+
Example:
|
|
281
|
+
```bash
|
|
282
|
+
GET /v1/wallet/balance?walletId=wallet-abc
|
|
283
|
+
POST /v1/transactions/send { "walletId": "wallet-abc", "to": "...", "amount": "..." }
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### Self-Discovery via connect-info
|
|
287
|
+
|
|
288
|
+
Call `GET /v1/connect-info` (sessionAuth) to discover all accessible wallets, policies, and capabilities:
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
curl -s http://localhost:3100/v1/connect-info \
|
|
292
|
+
-H 'Authorization: Bearer <session-token>'
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
Returns wallets with their addresses and chains, applicable policies per wallet, available capabilities (transfer, token_transfer, balance, assets, sign, actions, x402), and an AI-ready prompt.
|
|
257
296
|
|
|
258
|
-
|
|
297
|
+
## 3. Wallet Query (Session-Scoped)
|
|
298
|
+
|
|
299
|
+
These endpoints operate on the wallet bound to the session token (or the specified walletId). Require **sessionAuth**.
|
|
259
300
|
|
|
260
301
|
### GET /v1/wallet/address -- Get Wallet Address
|
|
261
302
|
|
|
@@ -460,12 +501,13 @@ Response (200):
|
|
|
460
501
|
|
|
461
502
|
Error: `ENVIRONMENT_NETWORK_MISMATCH` (400) if the specified network is not valid for the wallet's environment.
|
|
462
503
|
|
|
463
|
-
##
|
|
504
|
+
## 4. Session Management
|
|
464
505
|
|
|
465
506
|
Session creation and listing require **masterAuth**. Revocation requires **masterAuth**. Renewal requires **sessionAuth** (the session's own token).
|
|
466
507
|
|
|
467
508
|
### POST /v1/sessions -- Create Session (masterAuth)
|
|
468
509
|
|
|
510
|
+
**Single wallet:**
|
|
469
511
|
```bash
|
|
470
512
|
curl -s -X POST http://localhost:3100/v1/sessions \
|
|
471
513
|
-H 'Content-Type: application/json' \
|
|
@@ -473,8 +515,18 @@ curl -s -X POST http://localhost:3100/v1/sessions \
|
|
|
473
515
|
-d '{"walletId": "01958f3a-1234-7000-8000-abcdef123456", "ttl": 86400}'
|
|
474
516
|
```
|
|
475
517
|
|
|
518
|
+
**Multi-wallet:**
|
|
519
|
+
```bash
|
|
520
|
+
curl -s -X POST http://localhost:3100/v1/sessions \
|
|
521
|
+
-H 'Content-Type: application/json' \
|
|
522
|
+
-H 'X-Master-Password: your-master-password' \
|
|
523
|
+
-d '{"walletIds": ["wallet-1-uuid", "wallet-2-uuid"], "defaultWalletId": "wallet-1-uuid"}'
|
|
524
|
+
```
|
|
525
|
+
|
|
476
526
|
Parameters:
|
|
477
|
-
- `walletId` (
|
|
527
|
+
- `walletId` (string): UUID of a single wallet (backward compatible)
|
|
528
|
+
- `walletIds` (string[]): UUIDs of multiple wallets (mutually exclusive with walletId)
|
|
529
|
+
- `defaultWalletId` (optional): specify default wallet (defaults to first in walletIds)
|
|
478
530
|
- `ttl` (optional): session lifetime in seconds, 300-604800 (default: 86400 = 24 hours)
|
|
479
531
|
- `constraints` (optional): custom constraints object
|
|
480
532
|
|
|
@@ -555,7 +607,7 @@ Safety checks: 50% TTL must have elapsed, max 30 renewals, 30-day absolute lifet
|
|
|
555
607
|
|
|
556
608
|
Errors: `RENEWAL_TOO_EARLY` (403), `RENEWAL_LIMIT_REACHED` (403), `SESSION_REVOKED` (401), `SESSION_ABSOLUTE_LIFETIME_EXCEEDED` (403), `SESSION_RENEWAL_MISMATCH` (401).
|
|
557
609
|
|
|
558
|
-
##
|
|
610
|
+
## 5. Token Registry (EVM Only)
|
|
559
611
|
|
|
560
612
|
Manage the known token list for EVM networks. Token registry is UX-only -- adding/removing tokens here does NOT affect ALLOWED_TOKENS policy. Requires **masterAuth**.
|
|
561
613
|
|
|
@@ -638,7 +690,7 @@ Response (200):
|
|
|
638
690
|
}
|
|
639
691
|
```
|
|
640
692
|
|
|
641
|
-
##
|
|
693
|
+
## 6. MCP Token Provisioning (masterAuth)
|
|
642
694
|
|
|
643
695
|
One-stop provisioning for Claude Desktop MCP integration: creates a session, writes the JWT to a token file, and returns the Claude Desktop config snippet.
|
|
644
696
|
|
|
@@ -679,7 +731,7 @@ Response (201):
|
|
|
679
731
|
|
|
680
732
|
Copy the `claudeDesktopConfig` object into your Claude Desktop `claude_desktop_config.json` under `mcpServers`.
|
|
681
733
|
|
|
682
|
-
##
|
|
734
|
+
## 7. Auth Nonce
|
|
683
735
|
|
|
684
736
|
Public endpoint (no auth required). Returns a nonce for owner signature verification (SIWS for Solana, SIWE for Ethereum).
|
|
685
737
|
|
|
@@ -699,7 +751,7 @@ Response (200):
|
|
|
699
751
|
|
|
700
752
|
The nonce is a random 32-byte hex string valid for 5 minutes. Used by owner wallets to construct SIWS/SIWE authentication signatures.
|
|
701
753
|
|
|
702
|
-
##
|
|
754
|
+
## 8. Multi-Chain Notes
|
|
703
755
|
|
|
704
756
|
### Environment-Network Reference
|
|
705
757
|
|
|
@@ -722,9 +774,9 @@ The nonce is a random 32-byte hex string valid for 5 minutes. Used by owner wall
|
|
|
722
774
|
| Batch transactions | Supported | Not supported (BATCH_NOT_SUPPORTED) |
|
|
723
775
|
| Owner signature | SIWS (Sign-In With Solana) | SIWE (Sign-In With Ethereum) |
|
|
724
776
|
|
|
725
|
-
##
|
|
777
|
+
## 9. MCP Tools Reference
|
|
726
778
|
|
|
727
|
-
The MCP server exposes
|
|
779
|
+
The MCP server exposes 23 tools for AI agents. Key wallet management tools:
|
|
728
780
|
|
|
729
781
|
### set_default_network
|
|
730
782
|
|
|
@@ -753,7 +805,7 @@ Get all assets (native + tokens). Same `network` parameter support as `get_balan
|
|
|
753
805
|
|
|
754
806
|
Combined wallet information including address, chain, environment, and available networks with their default status.
|
|
755
807
|
|
|
756
|
-
##
|
|
808
|
+
## 10. CLI Commands
|
|
757
809
|
|
|
758
810
|
### waiaas wallet info
|
|
759
811
|
|
|
@@ -771,7 +823,7 @@ Changes the wallet's default network.
|
|
|
771
823
|
waiaas wallet set-default-network polygon-amoy
|
|
772
824
|
```
|
|
773
825
|
|
|
774
|
-
##
|
|
826
|
+
## 11. SDK Methods
|
|
775
827
|
|
|
776
828
|
### TypeScript SDK
|
|
777
829
|
|
|
@@ -814,7 +866,7 @@ async with WAIaaSClient("http://localhost:3100", "wai_sess_...") as client:
|
|
|
814
866
|
all_assets = await client.get_all_assets()
|
|
815
867
|
```
|
|
816
868
|
|
|
817
|
-
##
|
|
869
|
+
## 12. Error Reference
|
|
818
870
|
|
|
819
871
|
| Code | HTTP | Description |
|
|
820
872
|
|------|------|-------------|
|
|
@@ -834,7 +886,7 @@ async with WAIaaSClient("http://localhost:3100", "wai_sess_...") as client:
|
|
|
834
886
|
| `CHAIN_ERROR` | 502 | Blockchain RPC error |
|
|
835
887
|
| `UNAUTHORIZED` | 401 | Missing or invalid auth header |
|
|
836
888
|
|
|
837
|
-
##
|
|
889
|
+
## 13. WalletConnect Session Management
|
|
838
890
|
|
|
839
891
|
WalletConnect allows the wallet owner to connect an external wallet (D'CENT, MetaMask, Phantom, etc.) to approve high-tier transactions. The daemon manages WC pairing, sessions, and signing bridges.
|
|
840
892
|
|
|
@@ -977,3 +1029,188 @@ async with WAIaaSClient("http://localhost:3100", "wai_sess_...") as client:
|
|
|
977
1029
|
result = await client.wc_disconnect()
|
|
978
1030
|
print(result.disconnected) # True
|
|
979
1031
|
```
|
|
1032
|
+
|
|
1033
|
+
## 14. Wallet SDK: Notification Functions
|
|
1034
|
+
|
|
1035
|
+
The `@waiaas/wallet-sdk` package provides functions for wallet apps to receive real-time notification events from the WAIaaS daemon.
|
|
1036
|
+
|
|
1037
|
+
### subscribeToNotifications(topic, callback, serverUrl?)
|
|
1038
|
+
|
|
1039
|
+
Subscribe to notification events via ntfy SSE stream. The daemon pushes notification events (transaction confirmations, policy violations, security alerts, etc.) to `waiaas-notify-{walletName}` ntfy topics.
|
|
1040
|
+
|
|
1041
|
+
```typescript
|
|
1042
|
+
import { subscribeToNotifications } from '@waiaas/wallet-sdk';
|
|
1043
|
+
|
|
1044
|
+
const subscription = subscribeToNotifications(
|
|
1045
|
+
'waiaas-notify-trading-bot', // ntfy topic
|
|
1046
|
+
(notification) => {
|
|
1047
|
+
console.log(notification.eventType); // e.g. 'TX_CONFIRMED'
|
|
1048
|
+
console.log(notification.category); // e.g. 'transaction'
|
|
1049
|
+
console.log(notification.title); // Human-readable title
|
|
1050
|
+
console.log(notification.body); // Human-readable body
|
|
1051
|
+
},
|
|
1052
|
+
'https://ntfy.sh', // optional, defaults to https://ntfy.sh
|
|
1053
|
+
);
|
|
1054
|
+
|
|
1055
|
+
// Later: unsubscribe
|
|
1056
|
+
subscription.unsubscribe();
|
|
1057
|
+
```
|
|
1058
|
+
|
|
1059
|
+
### parseNotification(data)
|
|
1060
|
+
|
|
1061
|
+
Decode and validate a base64url-encoded NotificationMessage. Used internally by `subscribeToNotifications`, but also available for manual parsing.
|
|
1062
|
+
|
|
1063
|
+
```typescript
|
|
1064
|
+
import { parseNotification } from '@waiaas/wallet-sdk';
|
|
1065
|
+
|
|
1066
|
+
const notification = parseNotification(base64urlEncodedString);
|
|
1067
|
+
// notification: { version, eventType, walletId, walletName, category, title, body, details?, timestamp }
|
|
1068
|
+
```
|
|
1069
|
+
|
|
1070
|
+
### NotificationMessage Type
|
|
1071
|
+
|
|
1072
|
+
```typescript
|
|
1073
|
+
interface NotificationMessage {
|
|
1074
|
+
version: '1';
|
|
1075
|
+
eventType: string; // One of 28 NotificationEventType values
|
|
1076
|
+
walletId: string; // UUID of the wallet
|
|
1077
|
+
walletName: string; // Human-readable wallet name
|
|
1078
|
+
category: 'transaction' | 'policy' | 'security_alert' | 'session' | 'owner' | 'system';
|
|
1079
|
+
title: string; // Notification title
|
|
1080
|
+
body: string; // Notification body
|
|
1081
|
+
details?: Record<string, unknown>; // Optional event-specific details
|
|
1082
|
+
timestamp: number; // Unix epoch seconds
|
|
1083
|
+
}
|
|
1084
|
+
```
|
|
1085
|
+
|
|
1086
|
+
### Notification Categories
|
|
1087
|
+
|
|
1088
|
+
| Category | Events | ntfy Priority |
|
|
1089
|
+
|----------|--------|---------------|
|
|
1090
|
+
| transaction | TX_REQUESTED, TX_QUEUED, TX_SUBMITTED, TX_CONFIRMED, TX_FAILED, TX_CANCELLED, TX_DOWNGRADED_DELAY, TX_APPROVAL_REQUIRED, TX_APPROVAL_EXPIRED | 3 (default) |
|
|
1091
|
+
| policy | POLICY_VIOLATION, CUMULATIVE_LIMIT_WARNING | 3 (default) |
|
|
1092
|
+
| security_alert | WALLET_SUSPENDED, KILL_SWITCH_ACTIVATED, KILL_SWITCH_RECOVERED, KILL_SWITCH_ESCALATED, AUTO_STOP_TRIGGERED | **5 (urgent)** |
|
|
1093
|
+
| session | SESSION_EXPIRING_SOON, SESSION_EXPIRED, SESSION_CREATED, SESSION_WALLET_ADDED, SESSION_WALLET_REMOVED | 3 (default) |
|
|
1094
|
+
| owner | OWNER_SET, OWNER_REMOVED, OWNER_VERIFIED | 3 (default) |
|
|
1095
|
+
| system | DAILY_SUMMARY, LOW_BALANCE, APPROVAL_CHANNEL_SWITCHED, UPDATE_AVAILABLE | 3 (default) |
|
|
1096
|
+
|
|
1097
|
+
## 15. Incoming Transactions
|
|
1098
|
+
|
|
1099
|
+
Monitor and query incoming (received) transactions to your wallet. Requires **sessionAuth**.
|
|
1100
|
+
|
|
1101
|
+
### GET /v1/wallet/incoming -- List Incoming Transactions (sessionAuth)
|
|
1102
|
+
|
|
1103
|
+
List incoming transactions with cursor-based pagination and filters. By default, only confirmed transactions are returned.
|
|
1104
|
+
|
|
1105
|
+
```bash
|
|
1106
|
+
curl -s http://localhost:3100/v1/wallet/incoming \
|
|
1107
|
+
-H 'Authorization: Bearer wai_sess_xxx'
|
|
1108
|
+
```
|
|
1109
|
+
|
|
1110
|
+
Query Parameters:
|
|
1111
|
+
- `limit` (optional): Max results, 1-100 (default: 20)
|
|
1112
|
+
- `cursor` (optional): Pagination cursor from previous response
|
|
1113
|
+
- `chain` (optional): Filter by chain (`solana` or `ethereum`)
|
|
1114
|
+
- `network` (optional): Filter by network (e.g., `devnet`, `ethereum-mainnet`)
|
|
1115
|
+
- `status` (optional): `DETECTED` or `CONFIRMED` (default: `CONFIRMED`)
|
|
1116
|
+
- `token` (optional): Filter by token address (omit for native transfers)
|
|
1117
|
+
- `from_address` (optional): Filter by sender address
|
|
1118
|
+
- `since` (optional): Only transactions detected after this epoch (seconds)
|
|
1119
|
+
- `until` (optional): Only transactions detected before this epoch (seconds)
|
|
1120
|
+
- `wallet_id` (optional): Target wallet ID (for multi-wallet sessions)
|
|
1121
|
+
|
|
1122
|
+
Response (200):
|
|
1123
|
+
```json
|
|
1124
|
+
{
|
|
1125
|
+
"data": [
|
|
1126
|
+
{
|
|
1127
|
+
"id": "01958f3a-1234-7000-8000-abcdef123456",
|
|
1128
|
+
"txHash": "5VERv8NMvzbJ...",
|
|
1129
|
+
"walletId": "01958f3a-0000-7000-8000-abcdef000001",
|
|
1130
|
+
"fromAddress": "7xKXtg2CW87d...",
|
|
1131
|
+
"amount": "1000000000",
|
|
1132
|
+
"tokenAddress": null,
|
|
1133
|
+
"chain": "solana",
|
|
1134
|
+
"network": "devnet",
|
|
1135
|
+
"status": "CONFIRMED",
|
|
1136
|
+
"blockNumber": 280000000,
|
|
1137
|
+
"detectedAt": 1707000000,
|
|
1138
|
+
"confirmedAt": 1707000030,
|
|
1139
|
+
"suspicious": false
|
|
1140
|
+
}
|
|
1141
|
+
],
|
|
1142
|
+
"nextCursor": "eyJkIjoxNzA3MDAwMDAwLCJpIjoiMDE5NThmM2EtMTIzNC03MDAwLTgwMDAtYWJjZGVmMTIzNDU2In0",
|
|
1143
|
+
"hasMore": true
|
|
1144
|
+
}
|
|
1145
|
+
```
|
|
1146
|
+
|
|
1147
|
+
### GET /v1/wallet/incoming/summary -- Incoming Transaction Summary (sessionAuth)
|
|
1148
|
+
|
|
1149
|
+
Get period-based aggregated summary of incoming transactions with USD conversion.
|
|
1150
|
+
|
|
1151
|
+
```bash
|
|
1152
|
+
curl -s 'http://localhost:3100/v1/wallet/incoming/summary?period=daily' \
|
|
1153
|
+
-H 'Authorization: Bearer wai_sess_xxx'
|
|
1154
|
+
```
|
|
1155
|
+
|
|
1156
|
+
Query Parameters:
|
|
1157
|
+
- `period` (optional): `daily`, `weekly`, or `monthly` (default: `daily`)
|
|
1158
|
+
- `chain` (optional): Filter by chain
|
|
1159
|
+
- `network` (optional): Filter by network
|
|
1160
|
+
- `since` (optional): Summary start epoch (seconds)
|
|
1161
|
+
- `until` (optional): Summary end epoch (seconds)
|
|
1162
|
+
- `wallet_id` (optional): Target wallet ID
|
|
1163
|
+
|
|
1164
|
+
Response (200):
|
|
1165
|
+
```json
|
|
1166
|
+
{
|
|
1167
|
+
"period": "daily",
|
|
1168
|
+
"entries": [
|
|
1169
|
+
{
|
|
1170
|
+
"date": "2026-02-22",
|
|
1171
|
+
"totalCount": 5,
|
|
1172
|
+
"totalAmountNative": "5500000000",
|
|
1173
|
+
"totalAmountUsd": 825.00,
|
|
1174
|
+
"suspiciousCount": 0
|
|
1175
|
+
}
|
|
1176
|
+
]
|
|
1177
|
+
}
|
|
1178
|
+
```
|
|
1179
|
+
|
|
1180
|
+
### PATCH /v1/wallets/{id} -- Toggle Incoming Monitoring (masterAuth)
|
|
1181
|
+
|
|
1182
|
+
Enable or disable incoming transaction monitoring for a specific wallet.
|
|
1183
|
+
|
|
1184
|
+
```bash
|
|
1185
|
+
curl -s -X PATCH http://localhost:3100/v1/wallets/WALLET_ID \
|
|
1186
|
+
-H 'Content-Type: application/json' \
|
|
1187
|
+
-H 'X-Master-Password: your-master-password' \
|
|
1188
|
+
-d '{"monitorIncoming": true}'
|
|
1189
|
+
```
|
|
1190
|
+
|
|
1191
|
+
Response (200):
|
|
1192
|
+
```json
|
|
1193
|
+
{
|
|
1194
|
+
"id": "01958f3a-0000-7000-8000-abcdef000001",
|
|
1195
|
+
"monitorIncoming": true
|
|
1196
|
+
}
|
|
1197
|
+
```
|
|
1198
|
+
|
|
1199
|
+
### MCP Tools
|
|
1200
|
+
|
|
1201
|
+
- **list_incoming_transactions**: List incoming transaction history with filters and pagination.
|
|
1202
|
+
- **get_incoming_summary**: Get period-based incoming transaction summary (daily/weekly/monthly).
|
|
1203
|
+
|
|
1204
|
+
### SDK Methods
|
|
1205
|
+
|
|
1206
|
+
**TypeScript:**
|
|
1207
|
+
```typescript
|
|
1208
|
+
const incoming = await client.listIncomingTransactions({ limit: 10, status: 'CONFIRMED' });
|
|
1209
|
+
const summary = await client.getIncomingTransactionSummary({ period: 'weekly' });
|
|
1210
|
+
```
|
|
1211
|
+
|
|
1212
|
+
**Python:**
|
|
1213
|
+
```python
|
|
1214
|
+
incoming = await client.list_incoming_transactions(limit=10, status="CONFIRMED")
|
|
1215
|
+
summary = await client.get_incoming_transaction_summary(period="weekly")
|
|
1216
|
+
```
|
package/skills/x402.skill.md
CHANGED
|
@@ -3,7 +3,7 @@ name: "WAIaaS x402"
|
|
|
3
3
|
description: "x402 auto-payment protocol: fetch URLs with automatic cryptocurrency payments"
|
|
4
4
|
category: "api"
|
|
5
5
|
tags: [wallet, blockchain, x402, payments, waiass]
|
|
6
|
-
version: "2.
|
|
6
|
+
version: "2.6.0-rc.1"
|
|
7
7
|
dispatch:
|
|
8
8
|
kind: "tool"
|
|
9
9
|
allowedCommands: ["curl"]
|
|
@@ -21,6 +21,15 @@ http://localhost:3100
|
|
|
21
21
|
|
|
22
22
|
Requires **sessionAuth** via `Authorization: Bearer <token>` header.
|
|
23
23
|
|
|
24
|
+
## Permissions
|
|
25
|
+
|
|
26
|
+
### Agent (sessionAuth)
|
|
27
|
+
- Execute x402 fetch requests with automatic payment
|
|
28
|
+
|
|
29
|
+
### Admin (masterAuth -- prerequisite)
|
|
30
|
+
- Configure X402_ALLOWED_DOMAINS policy to whitelist payment target domains
|
|
31
|
+
- Ensure wallet has USDC balance on the appropriate network
|
|
32
|
+
|
|
24
33
|
## 1. Fetch with Auto-Payment
|
|
25
34
|
|
|
26
35
|
### POST /v1/x402/fetch
|