@elizaos/plugin-polymarket-app 2.0.3-beta.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/LICENSE +21 -0
- package/README.md +82 -0
- package/assets/hero.png +0 -0
- package/assets/hero.svg +47 -0
- package/package.json +75 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Shaw Walters and elizaOS Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# @elizaos/plugin-polymarket-app
|
|
2
|
+
|
|
3
|
+
Native Polymarket app plugin for elizaOS — market discovery, orderbook quote reads, position reads, and trading readiness context.
|
|
4
|
+
|
|
5
|
+
## What it does
|
|
6
|
+
|
|
7
|
+
Adds Polymarket prediction-market capabilities to an Eliza agent:
|
|
8
|
+
|
|
9
|
+
- **Market discovery** — lists active markets from the Polymarket Gamma API with bid/ask prices and 24-hour volume.
|
|
10
|
+
- **Single market detail** — fetches a market by Gamma ID or slug, including all outcome prices and CLOB token IDs.
|
|
11
|
+
- **Orderbook quotes** — reads full CLOB bid/ask depth for a token ID and derives best bid, best ask, midpoint, and spread.
|
|
12
|
+
- **Wallet positions** — returns open positions for a given wallet address from the Polymarket Data API.
|
|
13
|
+
- **Trading readiness** — reports which credentials are configured and why signed order placement is currently disabled.
|
|
14
|
+
- **UI views** — desktop, XR, and TUI views registered in the elizaOS view registry.
|
|
15
|
+
|
|
16
|
+
## Enabling the plugin
|
|
17
|
+
|
|
18
|
+
Add the package to the agent's plugin list:
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { polymarketPlugin } from "@elizaos/plugin-polymarket-app";
|
|
22
|
+
|
|
23
|
+
const agent = {
|
|
24
|
+
plugins: [polymarketPlugin],
|
|
25
|
+
// ...
|
|
26
|
+
};
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
No credentials are required for public reads. Trading configuration is optional (see below).
|
|
30
|
+
|
|
31
|
+
## Agent action: `PREDICTION_MARKET`
|
|
32
|
+
|
|
33
|
+
The plugin registers one agent action. Pass `action` (or `subaction`) and `kind` parameters:
|
|
34
|
+
|
|
35
|
+
| `action` | `kind` | Required params | Description |
|
|
36
|
+
|----------|--------|-----------------|-------------|
|
|
37
|
+
| `read` | `status` | — | Readiness and credential report |
|
|
38
|
+
| `read` | `markets` | — | Active market list (`limit` 1–100, `offset`) |
|
|
39
|
+
| `read` | `market` | `id` or `slug` | Single market detail |
|
|
40
|
+
| `read` | `orderbook` | `tokenId` (CLOB token id) | Full orderbook with best bid/ask |
|
|
41
|
+
| `read` | `positions` | `user` (wallet address) | Open positions for a wallet |
|
|
42
|
+
| `place_order` | — | — | Reports readiness; does not place trades |
|
|
43
|
+
|
|
44
|
+
Legacy action names (`POLYMARKET_READ`, `POLYMARKET_STATUS`, `POLYMARKET_GET_MARKETS`, `POLYMARKET_GET_ORDERBOOK`, `POLYMARKET_PLACE_ORDER`, etc.) are accepted as similes.
|
|
45
|
+
|
|
46
|
+
## API routes
|
|
47
|
+
|
|
48
|
+
The plugin registers these HTTP routes on the agent's API server:
|
|
49
|
+
|
|
50
|
+
| Method | Path | Query params |
|
|
51
|
+
|--------|------|-------------|
|
|
52
|
+
| GET | `/api/polymarket/status` | — |
|
|
53
|
+
| GET | `/api/polymarket/markets` | `limit`, `offset`, `active`, `closed`, `order`, `ascending`, `tag_id` |
|
|
54
|
+
| GET | `/api/polymarket/market` | `id` or `slug` |
|
|
55
|
+
| GET | `/api/polymarket/orderbook` | `token_id` |
|
|
56
|
+
| GET | `/api/polymarket/positions` | `user` |
|
|
57
|
+
| GET / POST | `/api/polymarket/orders` | Returns 501 (disabled) |
|
|
58
|
+
|
|
59
|
+
## Environment variables
|
|
60
|
+
|
|
61
|
+
Public reads (markets, orderbook, positions) require no credentials.
|
|
62
|
+
|
|
63
|
+
Signed CLOB trading is disabled in this app integration. When credentials are present the status endpoint reports readiness; the `place_order` action still returns a readiness report only.
|
|
64
|
+
|
|
65
|
+
| Variable | Alias | Purpose |
|
|
66
|
+
|----------|-------|---------|
|
|
67
|
+
| `POLYMARKET_PRIVATE_KEY` | — | Wallet private key for signed orders |
|
|
68
|
+
| `CLOB_API_KEY` | `POLYMARKET_CLOB_API_KEY` | CLOB API key |
|
|
69
|
+
| `CLOB_API_SECRET` | `POLYMARKET_CLOB_SECRET` | CLOB API secret |
|
|
70
|
+
| `CLOB_API_PASSPHRASE` | `POLYMARKET_CLOB_PASSPHRASE` | CLOB API passphrase |
|
|
71
|
+
|
|
72
|
+
## Orderbook semantics
|
|
73
|
+
|
|
74
|
+
The `/api/polymarket/orderbook` route reads the full CLOB orderbook for a token id and derives best bid, best ask, midpoint, and spread from all returned levels (it does not assume the upstream CLOB response is sorted). Use the CLOB `token_id`, not the Gamma `conditionId` — a market has one condition id but one or more CLOB token ids (one per outcome).
|
|
75
|
+
|
|
76
|
+
## Building
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
bun run --cwd plugins/plugin-polymarket-app build
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
This runs tsup (runtime bundle), Vite (view bundle for desktop/TUI views), and tsc (type declarations).
|
package/assets/hero.png
ADDED
|
Binary file
|
package/assets/hero.svg
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="675" viewBox="0 0 1200 675" role="img" aria-labelledby="title desc">
|
|
2
|
+
<title id="title">Polymarket</title>
|
|
3
|
+
<desc id="desc">Prediction market dashboard hero artwork with market probability cards.</desc>
|
|
4
|
+
<defs>
|
|
5
|
+
<linearGradient id="bg" x1="0" y1="0" x2="1" y2="1">
|
|
6
|
+
<stop offset="0" stop-color="#10291f"/>
|
|
7
|
+
<stop offset="0.58" stop-color="#174335"/>
|
|
8
|
+
<stop offset="1" stop-color="#f0c66f"/>
|
|
9
|
+
</linearGradient>
|
|
10
|
+
<linearGradient id="card" x1="0" y1="0" x2="1" y2="1">
|
|
11
|
+
<stop offset="0" stop-color="#f7fff8" stop-opacity="0.98"/>
|
|
12
|
+
<stop offset="1" stop-color="#e8f5ee" stop-opacity="0.94"/>
|
|
13
|
+
</linearGradient>
|
|
14
|
+
<filter id="shadow" x="-20%" y="-20%" width="140%" height="140%">
|
|
15
|
+
<feDropShadow dx="0" dy="22" stdDeviation="22" flood-color="#07140f" flood-opacity="0.28"/>
|
|
16
|
+
</filter>
|
|
17
|
+
</defs>
|
|
18
|
+
<rect width="1200" height="675" fill="url(#bg)"/>
|
|
19
|
+
<path d="M0 556C176 493 278 526 423 482C582 433 653 315 813 301C969 287 1087 372 1200 335V675H0Z" fill="#0b1d17" opacity="0.42"/>
|
|
20
|
+
<path d="M0 100C123 58 222 91 342 59C475 24 580 -14 706 52C837 121 925 116 1200 42V0H0Z" fill="#ffffff" opacity="0.08"/>
|
|
21
|
+
<g filter="url(#shadow)">
|
|
22
|
+
<rect x="94" y="90" width="420" height="496" rx="32" fill="url(#card)"/>
|
|
23
|
+
<rect x="134" y="136" width="172" height="18" rx="9" fill="#1c3d31"/>
|
|
24
|
+
<rect x="134" y="176" width="300" height="13" rx="6.5" fill="#6b7f76" opacity="0.72"/>
|
|
25
|
+
<rect x="134" y="230" width="332" height="96" rx="22" fill="#ffffff"/>
|
|
26
|
+
<rect x="134" y="352" width="332" height="96" rx="22" fill="#ffffff"/>
|
|
27
|
+
<rect x="134" y="474" width="332" height="58" rx="18" fill="#10291f"/>
|
|
28
|
+
<path d="M168 286C202 264 225 302 256 279C285 258 301 246 336 265C365 281 385 271 430 250" fill="none" stroke="#23a879" stroke-width="8" stroke-linecap="round"/>
|
|
29
|
+
<path d="M168 407C203 390 222 430 258 414C291 399 307 362 344 383C381 404 404 395 430 371" fill="none" stroke="#d49b2b" stroke-width="8" stroke-linecap="round"/>
|
|
30
|
+
<circle cx="430" cy="250" r="12" fill="#23a879"/>
|
|
31
|
+
<circle cx="430" cy="371" r="12" fill="#d49b2b"/>
|
|
32
|
+
<text x="164" y="265" font-family="Inter, Arial, sans-serif" font-size="24" font-weight="700" letter-spacing="0" fill="#10291f">YES 64%</text>
|
|
33
|
+
<text x="164" y="386" font-family="Inter, Arial, sans-serif" font-size="24" font-weight="700" letter-spacing="0" fill="#10291f">NO 36%</text>
|
|
34
|
+
<text x="164" y="511" font-family="Inter, Arial, sans-serif" font-size="22" font-weight="700" letter-spacing="0" fill="#f7fff8">Track position</text>
|
|
35
|
+
</g>
|
|
36
|
+
<g filter="url(#shadow)">
|
|
37
|
+
<rect x="580" y="130" width="520" height="410" rx="34" fill="#f7fff8" opacity="0.96"/>
|
|
38
|
+
<text x="628" y="214" font-family="Inter, Arial, sans-serif" font-size="62" font-weight="800" letter-spacing="0" fill="#10291f">Polymarket</text>
|
|
39
|
+
<text x="632" y="266" font-family="Inter, Arial, sans-serif" font-size="28" font-weight="500" letter-spacing="0" fill="#466158">Prediction markets, resolved cleanly.</text>
|
|
40
|
+
<rect x="632" y="322" width="390" height="18" rx="9" fill="#d9e7df"/>
|
|
41
|
+
<rect x="632" y="322" width="286" height="18" rx="9" fill="#23a879"/>
|
|
42
|
+
<rect x="632" y="374" width="312" height="18" rx="9" fill="#d9e7df"/>
|
|
43
|
+
<rect x="632" y="374" width="122" height="18" rx="9" fill="#d49b2b"/>
|
|
44
|
+
<rect x="632" y="426" width="430" height="52" rx="18" fill="#10291f"/>
|
|
45
|
+
<text x="660" y="460" font-family="Inter, Arial, sans-serif" font-size="22" font-weight="700" letter-spacing="0" fill="#f7fff8">Markets, watchlist, and activity</text>
|
|
46
|
+
</g>
|
|
47
|
+
</svg>
|
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@elizaos/plugin-polymarket-app",
|
|
3
|
+
"version": "2.0.3-beta.2",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"eliza-source": {
|
|
10
|
+
"types": "./src/index.ts",
|
|
11
|
+
"import": "./src/index.ts",
|
|
12
|
+
"default": "./src/index.ts"
|
|
13
|
+
},
|
|
14
|
+
"import": "./dist/index.js",
|
|
15
|
+
"default": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./plugin": {
|
|
18
|
+
"types": "./dist/plugin.d.ts",
|
|
19
|
+
"import": "./dist/plugin.js",
|
|
20
|
+
"default": "./dist/plugin.js"
|
|
21
|
+
},
|
|
22
|
+
"./*.css": "./dist/*.css",
|
|
23
|
+
"./*": {
|
|
24
|
+
"types": "./dist/*.d.ts",
|
|
25
|
+
"eliza-source": {
|
|
26
|
+
"types": "./src/*.ts",
|
|
27
|
+
"import": "./src/*.ts",
|
|
28
|
+
"default": "./src/*.ts"
|
|
29
|
+
},
|
|
30
|
+
"import": "./dist/*.js",
|
|
31
|
+
"default": "./dist/*.js"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@elizaos/app-core": "2.0.3-beta.2",
|
|
36
|
+
"@elizaos/core": "2.0.3-beta.2",
|
|
37
|
+
"@elizaos/shared": "2.0.3-beta.2",
|
|
38
|
+
"@elizaos/ui": "2.0.3-beta.2",
|
|
39
|
+
"lucide-react": "^1.0.0",
|
|
40
|
+
"react": "^19.0.0"
|
|
41
|
+
},
|
|
42
|
+
"elizaos": {
|
|
43
|
+
"app": {
|
|
44
|
+
"heroImage": "assets/hero.png"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public"
|
|
49
|
+
},
|
|
50
|
+
"types": "./dist/index.d.ts",
|
|
51
|
+
"scripts": {
|
|
52
|
+
"build": "bun run build:js && bun run build:views && bun run build:types",
|
|
53
|
+
"clean": "rm -rf dist",
|
|
54
|
+
"test": "vitest run --config vitest.config.ts",
|
|
55
|
+
"build:js": "tsup --config ../tsup.plugin-packages.shared.ts",
|
|
56
|
+
"build:views": "bunx --bun vite build --config vite.config.views.ts",
|
|
57
|
+
"build:types": "tsc --noCheck -p tsconfig.build.json"
|
|
58
|
+
},
|
|
59
|
+
"files": [
|
|
60
|
+
"assets",
|
|
61
|
+
"dist"
|
|
62
|
+
],
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"@testing-library/react": "^16.3.2",
|
|
65
|
+
"@types/react": "^19.0.0",
|
|
66
|
+
"@types/react-dom": "^19.0.0",
|
|
67
|
+
"jsdom": "^29.0.0",
|
|
68
|
+
"react": "^19.0.0",
|
|
69
|
+
"react-dom": "^19.0.0",
|
|
70
|
+
"tsup": "^8.5.1",
|
|
71
|
+
"vite": "^8.0.0",
|
|
72
|
+
"vitest": "^4.1.5"
|
|
73
|
+
},
|
|
74
|
+
"gitHead": "82fe0f44215954c2417328203f5bd6510985c1fc"
|
|
75
|
+
}
|