@orbs-network/spot 2.1.3 → 2.1.4
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 +5 -5
- package/index.css +10 -0
- package/index.html +15 -3
- package/mcp/stdio.mjs +220 -0
- package/package.json +17 -4
- package/server.json +21 -0
- package/skills/advanced-swap-orders/SKILL.md +9 -7
- package/skills/advanced-swap-orders/manifest.json +2 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# Spot — Limit, TWAP, Stop-Loss, Take-Profit Non-Custodial DeFi Protocol
|
|
1
|
+
# Spot — Limit, TWAP, Stop-Loss, Take-Profit Non-Custodial Decentralized DeFi Protocol
|
|
2
2
|
|
|
3
|
-
**Agent-
|
|
3
|
+
**Agent-ready decentralized DeFi protocol for non-custodial advanced order types on EVM chains.**
|
|
4
4
|
|
|
5
5
|
**🔒 [Security Audit Report](./Audit-AstraSec.pdf)** - Smart contracts professionally audited by AstraSec
|
|
6
6
|
|
|
@@ -12,11 +12,12 @@ Start with these files:
|
|
|
12
12
|
2. [`skills/advanced-swap-orders/manifest.json`](./skills/advanced-swap-orders/manifest.json) for machine-readable discovery
|
|
13
13
|
3. [`skills/advanced-swap-orders/scripts/order.js`](./skills/advanced-swap-orders/scripts/order.js) for prepare, submit, and query operations
|
|
14
14
|
|
|
15
|
-
The
|
|
15
|
+
The skill bundle is available through these surfaces:
|
|
16
16
|
|
|
17
17
|
1. Repo-local files under `skills/advanced-swap-orders/`
|
|
18
|
-
2. Hosted raw files from [`https://orbs-network.github.io/spot/`](https://orbs-network.github.io/spot/),
|
|
18
|
+
2. Hosted raw files from [`https://orbs-network.github.io/spot/`](https://orbs-network.github.io/spot/), under the same `skills/advanced-swap-orders/` paths
|
|
19
19
|
3. The npm package `@orbs-network/spot`
|
|
20
|
+
4. MCP clients through the package bin `spot-mcp`, published in `server.json` as `io.github.orbs-network/spot`
|
|
20
21
|
|
|
21
22
|
## Agent Capabilities
|
|
22
23
|
|
|
@@ -24,7 +25,6 @@ The same skill bundle can be consumed through three aligned surfaces:
|
|
|
24
25
|
- ✍️ **Signing Prep**: Produce approval calldata, EIP-712 typed data, and relay-ready payloads
|
|
25
26
|
- 🔎 **Machine Discovery**: Read supported chains, runtime addresses, references, and assets from `manifest.json`
|
|
26
27
|
- 🧰 **Direct Execution Tooling**: Use `scripts/order.js` for prepare, submit, and query flows
|
|
27
|
-
- 📦 **Raw File Access**: Consume the same bundle from repo-local files, the hosted raw-file mirror, or from npm
|
|
28
28
|
|
|
29
29
|
## Protocol Guarantees
|
|
30
30
|
|
package/index.css
CHANGED
|
@@ -65,6 +65,12 @@ section {
|
|
|
65
65
|
border-top: 1px solid rgba(163, 194, 255, 0.14);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
footer {
|
|
69
|
+
margin-top: 32px;
|
|
70
|
+
padding-top: 22px;
|
|
71
|
+
border-top: 1px solid rgba(163, 194, 255, 0.14);
|
|
72
|
+
}
|
|
73
|
+
|
|
68
74
|
h2 {
|
|
69
75
|
margin-bottom: 10px;
|
|
70
76
|
font-size: 0.86rem;
|
|
@@ -77,6 +83,10 @@ ol {
|
|
|
77
83
|
padding-left: 20px;
|
|
78
84
|
}
|
|
79
85
|
|
|
86
|
+
.distribution-list {
|
|
87
|
+
margin-top: 14px;
|
|
88
|
+
}
|
|
89
|
+
|
|
80
90
|
li + li {
|
|
81
91
|
margin-top: 8px;
|
|
82
92
|
}
|
package/index.html
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
<meta charset="utf-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
6
|
<meta name="color-scheme" content="dark">
|
|
7
|
-
<title>Advanced Swap Orders Files</title>
|
|
7
|
+
<title>Spot Advanced Swap Orders Files</title>
|
|
8
8
|
<link rel="stylesheet" href="index.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
11
11
|
<main>
|
|
12
|
-
<h1>Advanced Swap Orders</h1>
|
|
13
|
-
<p>
|
|
12
|
+
<h1>Spot Advanced Swap Orders</h1>
|
|
13
|
+
<p>Hosted raw files for AI agents.</p>
|
|
14
14
|
|
|
15
15
|
<section>
|
|
16
16
|
<h2>Skill</h2>
|
|
@@ -45,6 +45,18 @@
|
|
|
45
45
|
<li><a href="skills/advanced-swap-orders/assets/web3-sign-and-submit.example.js">web3-sign-and-submit.example.js</a></li>
|
|
46
46
|
</ol>
|
|
47
47
|
</section>
|
|
48
|
+
|
|
49
|
+
<footer>
|
|
50
|
+
<h2>Distributions</h2>
|
|
51
|
+
<ol class="distribution-list">
|
|
52
|
+
<li><a href="https://github.com/orbs-network/spot/tree/main/skills/advanced-swap-orders">GitHub bundle: advanced-swap-orders</a></li>
|
|
53
|
+
<li><a href="skills/advanced-swap-orders/SKILL.md">Hosted raw entrypoint: advanced-swap-orders</a></li>
|
|
54
|
+
<li><a href="https://www.npmjs.com/package/@orbs-network/spot">npm package: @orbs-network/spot</a></li>
|
|
55
|
+
<li><a href="https://www.npmjs.com/package/@orbs-network/spot">npm bin: spot-mcp</a></li>
|
|
56
|
+
<li><a href="server.json">MCP metadata: io.github.orbs-network/spot</a></li>
|
|
57
|
+
</ol>
|
|
58
|
+
</footer>
|
|
59
|
+
|
|
48
60
|
</main>
|
|
49
61
|
</body>
|
|
50
62
|
</html>
|
package/mcp/stdio.mjs
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawn } from "node:child_process";
|
|
4
|
+
import { readFile } from "node:fs/promises";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
9
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
10
|
+
|
|
11
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
12
|
+
const rootDir = path.resolve(__dirname, "..");
|
|
13
|
+
const packageJsonPath = path.join(rootDir, "package.json");
|
|
14
|
+
const skillDir = path.join(rootDir, "skills", "advanced-swap-orders");
|
|
15
|
+
const skillMdPath = path.join(skillDir, "SKILL.md");
|
|
16
|
+
const manifestPath = path.join(skillDir, "manifest.json");
|
|
17
|
+
const cliPath = path.join(skillDir, "scripts", "order.js");
|
|
18
|
+
|
|
19
|
+
const [pkg, manifest] = await Promise.all([
|
|
20
|
+
readJsonFile(packageJsonPath),
|
|
21
|
+
readJsonFile(manifestPath),
|
|
22
|
+
]);
|
|
23
|
+
|
|
24
|
+
const mcpName = requiredString(pkg.mcpName, "package.json mcpName");
|
|
25
|
+
const version = requiredString(pkg.version, "package.json version");
|
|
26
|
+
const skillName = requiredString(manifest.name, "skill manifest name");
|
|
27
|
+
const skillTitle = requiredString(manifest.title, "skill manifest title");
|
|
28
|
+
|
|
29
|
+
const server = new McpServer({
|
|
30
|
+
name: mcpName,
|
|
31
|
+
version,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
server.registerResource(
|
|
35
|
+
"spot-skill",
|
|
36
|
+
"spot://skill",
|
|
37
|
+
{
|
|
38
|
+
title: `${skillTitle} skill`,
|
|
39
|
+
description: `Canonical ${skillName} SKILL.md for ${mcpName}`,
|
|
40
|
+
mimeType: "text/markdown",
|
|
41
|
+
},
|
|
42
|
+
async (uri) => ({
|
|
43
|
+
contents: [
|
|
44
|
+
{
|
|
45
|
+
uri: uri.href,
|
|
46
|
+
text: await readFile(skillMdPath, "utf8"),
|
|
47
|
+
mimeType: "text/markdown",
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
}),
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
server.registerResource(
|
|
54
|
+
"spot-manifest",
|
|
55
|
+
"spot://manifest",
|
|
56
|
+
{
|
|
57
|
+
title: `${skillTitle} manifest`,
|
|
58
|
+
description: `Canonical ${skillName} manifest.json for ${mcpName}`,
|
|
59
|
+
mimeType: "application/json",
|
|
60
|
+
},
|
|
61
|
+
async (uri) => ({
|
|
62
|
+
contents: [
|
|
63
|
+
{
|
|
64
|
+
uri: uri.href,
|
|
65
|
+
text: JSON.stringify(manifest, null, 2),
|
|
66
|
+
mimeType: "application/json",
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
}),
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
server.registerTool(
|
|
73
|
+
"prepare_order",
|
|
74
|
+
{
|
|
75
|
+
title: "Prepare order",
|
|
76
|
+
description: "Prepare approval calldata, typed data, submit payload, and query URL.",
|
|
77
|
+
inputSchema: {
|
|
78
|
+
params: z.record(z.string(), z.unknown()),
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
async ({ params }) => runTool(["prepare", "--params", "-"], params),
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
server.registerTool(
|
|
85
|
+
"submit_order",
|
|
86
|
+
{
|
|
87
|
+
title: "Submit order",
|
|
88
|
+
description: "Submit a prepared order with a signature.",
|
|
89
|
+
inputSchema: {
|
|
90
|
+
prepared: z.unknown(),
|
|
91
|
+
signature: z.union([
|
|
92
|
+
z.string(),
|
|
93
|
+
z.object({
|
|
94
|
+
r: z.string(),
|
|
95
|
+
s: z.string(),
|
|
96
|
+
v: z.union([z.string(), z.number()]),
|
|
97
|
+
}),
|
|
98
|
+
]),
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
async ({ prepared, signature }) => {
|
|
102
|
+
const signatureArgs =
|
|
103
|
+
typeof signature === "string"
|
|
104
|
+
? ["--signature", signature]
|
|
105
|
+
: ["--signature", JSON.stringify(signature)];
|
|
106
|
+
|
|
107
|
+
return runTool(["submit", "--prepared", "-", ...signatureArgs], prepared);
|
|
108
|
+
},
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
server.registerTool(
|
|
112
|
+
"query_orders",
|
|
113
|
+
{
|
|
114
|
+
title: "Query orders",
|
|
115
|
+
description: "Query orders by swapper and/or order hash.",
|
|
116
|
+
inputSchema: {
|
|
117
|
+
swapper: z.string().optional(),
|
|
118
|
+
hash: z.string().optional(),
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
async ({ swapper, hash }) => {
|
|
122
|
+
if (!swapper && !hash) {
|
|
123
|
+
return toolError("query_orders requires swapper or hash");
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const args = ["query"];
|
|
127
|
+
if (swapper) {
|
|
128
|
+
args.push("--swapper", swapper);
|
|
129
|
+
}
|
|
130
|
+
if (hash) {
|
|
131
|
+
args.push("--hash", hash);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return runTool(args);
|
|
135
|
+
},
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
await server.connect(new StdioServerTransport());
|
|
139
|
+
|
|
140
|
+
async function readJsonFile(filePath) {
|
|
141
|
+
return JSON.parse(await readFile(filePath, "utf8"));
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function requiredString(value, label) {
|
|
145
|
+
if (typeof value !== "string" || value.trim() === "") {
|
|
146
|
+
throw new Error(`${label} is required`);
|
|
147
|
+
}
|
|
148
|
+
return value;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function runCli(args, stdinJson) {
|
|
152
|
+
return new Promise((resolve, reject) => {
|
|
153
|
+
const child = spawn(process.execPath, [cliPath, ...args], {
|
|
154
|
+
cwd: rootDir,
|
|
155
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
let stdout = "";
|
|
159
|
+
let stderr = "";
|
|
160
|
+
|
|
161
|
+
child.stdout.on("data", (chunk) => {
|
|
162
|
+
stdout += String(chunk);
|
|
163
|
+
});
|
|
164
|
+
child.stderr.on("data", (chunk) => {
|
|
165
|
+
stderr += String(chunk);
|
|
166
|
+
});
|
|
167
|
+
child.on("error", reject);
|
|
168
|
+
|
|
169
|
+
child.on("close", (code) => {
|
|
170
|
+
const out = stdout.trim();
|
|
171
|
+
const err = stderr.trim();
|
|
172
|
+
|
|
173
|
+
if (code !== 0) {
|
|
174
|
+
reject(new Error(err || out || `order.js exited with code ${code}`));
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
try {
|
|
179
|
+
resolve(out ? JSON.parse(out) : {});
|
|
180
|
+
} catch {
|
|
181
|
+
resolve({
|
|
182
|
+
raw: out,
|
|
183
|
+
stderr: err,
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
const payload = stdinJson == null ? "" : `${JSON.stringify(stdinJson)}\n`;
|
|
189
|
+
child.stdin.end(payload);
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
async function runTool(args, stdinJson) {
|
|
194
|
+
try {
|
|
195
|
+
const output = await runCli(args, stdinJson);
|
|
196
|
+
return {
|
|
197
|
+
content: [
|
|
198
|
+
{
|
|
199
|
+
type: "text",
|
|
200
|
+
text: JSON.stringify(output, null, 2),
|
|
201
|
+
},
|
|
202
|
+
],
|
|
203
|
+
structuredContent: output,
|
|
204
|
+
};
|
|
205
|
+
} catch (error) {
|
|
206
|
+
return toolError(String(error?.message ?? error));
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function toolError(message) {
|
|
211
|
+
return {
|
|
212
|
+
isError: true,
|
|
213
|
+
content: [
|
|
214
|
+
{
|
|
215
|
+
type: "text",
|
|
216
|
+
text: message,
|
|
217
|
+
},
|
|
218
|
+
],
|
|
219
|
+
};
|
|
220
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orbs-network/spot",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4",
|
|
4
|
+
"mcpName": "io.github.orbs-network/spot",
|
|
4
5
|
"description": "**A DeFi protocol for noncustodial advanced order types on EVM chains.**",
|
|
5
6
|
"homepage": "https://github.com/orbs-network/spot#readme",
|
|
6
7
|
"bugs": {
|
|
@@ -12,9 +13,15 @@
|
|
|
12
13
|
},
|
|
13
14
|
"license": "MIT",
|
|
14
15
|
"author": "danielz@orbs.com",
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=18"
|
|
18
|
+
},
|
|
19
|
+
"bin": {
|
|
20
|
+
"spot-mcp": "./mcp/stdio.mjs"
|
|
21
|
+
},
|
|
15
22
|
"scripts": {
|
|
16
23
|
"fmt": "forge fmt",
|
|
17
|
-
"build": "forge build --extra-output-files abi",
|
|
24
|
+
"build": "node ./script/sync-mcp.mjs && forge build --extra-output-files abi",
|
|
18
25
|
"test": "forge test",
|
|
19
26
|
"prepublishOnly": "npm run fmt && npm run build && npm run test"
|
|
20
27
|
},
|
|
@@ -25,7 +32,13 @@
|
|
|
25
32
|
"skills/",
|
|
26
33
|
"script/input/",
|
|
27
34
|
"out/**/*.json",
|
|
28
|
-
"index.js"
|
|
35
|
+
"index.js",
|
|
36
|
+
"mcp/",
|
|
37
|
+
"server.json"
|
|
29
38
|
],
|
|
30
|
-
"main": "index.js"
|
|
39
|
+
"main": "index.js",
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@modelcontextprotocol/sdk": "1.27.1",
|
|
42
|
+
"zod": "4.3.6"
|
|
43
|
+
}
|
|
31
44
|
}
|
package/server.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
+
"name": "io.github.orbs-network/spot",
|
|
4
|
+
"title": "Spot Advanced Swap Orders",
|
|
5
|
+
"description": "Create and manage gasless, decentralized, non-custodial, oracle-protected market, limit, TWAP, stop-loss, take-profit, and delayed-start swap orders on supported EVM chains with immutable, audited, battle-tested contracts.",
|
|
6
|
+
"repository": {
|
|
7
|
+
"url": "https://github.com/orbs-network/spot",
|
|
8
|
+
"source": "github"
|
|
9
|
+
},
|
|
10
|
+
"version": "2.1.4",
|
|
11
|
+
"packages": [
|
|
12
|
+
{
|
|
13
|
+
"registryType": "npm",
|
|
14
|
+
"identifier": "@orbs-network/spot",
|
|
15
|
+
"version": "2.1.4",
|
|
16
|
+
"transport": {
|
|
17
|
+
"type": "stdio"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: advanced-swap-orders
|
|
3
|
-
description:
|
|
3
|
+
description: Create and manage gasless, decentralized, non-custodial, oracle-protected market, limit, TWAP, stop-loss, take-profit, and delayed-start swap orders on supported EVM chains with immutable, audited, battle-tested contracts.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Advanced Swap Orders
|
|
6
|
+
# Spot Advanced Swap Orders
|
|
7
7
|
|
|
8
|
-
Use this for any supported gasless swap or advanced order. Supply chain, token addresses, chunk sizing, timing, and optional price constraints; the helper turns that into approval calldata, EIP-712 typed data, relay-ready submit payloads, and query/cancel guidance, while the protocol handles non-custodial, oracle-protected
|
|
8
|
+
Use this for any supported gasless swap or advanced order on supported EVM chains. Supply chain, token addresses, chunk sizing, timing, and optional price constraints; the helper turns that into approval calldata, EIP-712 typed data, relay-ready submit payloads, and query/cancel guidance, while the protocol handles non-custodial, oracle-protected execution for market, limit, TWAP, stop-loss, take-profit, and delayed-start orders.
|
|
9
9
|
|
|
10
10
|
## Distribution
|
|
11
11
|
|
|
12
|
-
This skill
|
|
12
|
+
This skill ships from the canonical repository [`orbs-network/spot`](https://github.com/orbs-network/spot) across four AI-agent distribution surfaces:
|
|
13
13
|
|
|
14
14
|
1. Repo-local files under `skills/advanced-swap-orders/` in a checked-out repository.
|
|
15
|
-
2. Hosted raw files under [`https://orbs-network.github.io/spot/`](https://orbs-network.github.io/spot/),
|
|
16
|
-
3. The npm package `@orbs-network/spot`,
|
|
15
|
+
2. Hosted raw files under [`https://orbs-network.github.io/spot/`](https://orbs-network.github.io/spot/), under the same `skills/advanced-swap-orders/` paths.
|
|
16
|
+
3. The npm package `@orbs-network/spot`, which installs the bundle under `node_modules/@orbs-network/spot/skills/advanced-swap-orders/`.
|
|
17
|
+
4. The stdio MCP adapter `spot-mcp`, published in `server.json` as `io.github.orbs-network/spot`.
|
|
18
|
+
|
|
19
|
+
The checked-in `server.json` registry metadata is derived from this skill manifest plus package metadata, so MCP publishing stays aligned.
|
|
17
20
|
|
|
18
21
|
Outside tools should treat [`SKILL.md`](SKILL.md) as the entrypoint and [`manifest.json`](manifest.json) as the machine-readable companion file.
|
|
19
|
-
The repository [`README.md`](https://github.com/orbs-network/spot/blob/main/README.md) mirrors the repo-local entrypoints first for top-level AI-agent discovery.
|
|
20
22
|
|
|
21
23
|
## Auto Check For Updates
|
|
22
24
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "advanced-swap-orders",
|
|
3
|
-
"
|
|
3
|
+
"title": "Spot Advanced Swap Orders",
|
|
4
|
+
"description": "Create and manage gasless, decentralized, non-custodial, oracle-protected market, limit, TWAP, stop-loss, take-profit, and delayed-start swap orders on supported EVM chains with immutable, audited, battle-tested contracts.",
|
|
4
5
|
"entrypoint": "SKILL.md",
|
|
5
6
|
"references": [
|
|
6
7
|
"references/01-quickstart.md",
|