@orbs-network/spot 2.1.4 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,14 +8,14 @@
8
8
 
9
9
  Start with these files:
10
10
 
11
- 1. [`skills/advanced-swap-orders/SKILL.md`](./skills/advanced-swap-orders/SKILL.md) for the execution workflow
12
- 2. [`skills/advanced-swap-orders/manifest.json`](./skills/advanced-swap-orders/manifest.json) for machine-readable discovery
13
- 3. [`skills/advanced-swap-orders/scripts/order.js`](./skills/advanced-swap-orders/scripts/order.js) for prepare, submit, and query operations
11
+ 1. [`SKILL.md`](./SKILL.md) for the execution workflow
12
+ 2. [`manifest.json`](./manifest.json) for machine-readable discovery
13
+ 3. [`skill/scripts/order.js`](./skill/scripts/order.js) for prepare, submit, and query operations
14
14
 
15
15
  The skill bundle is available through these surfaces:
16
16
 
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/), under the same `skills/advanced-swap-orders/` paths
17
+ 1. Repo-local root `SKILL.md`, `manifest.json`, and the `skill/` support directory
18
+ 2. Hosted raw files from [`https://orbs-network.github.io/spot/`](https://orbs-network.github.io/spot/), with root entrypoints plus `skill/` support paths
19
19
  3. The npm package `@orbs-network/spot`
20
20
  4. MCP clients through the package bin `spot-mcp`, published in `server.json` as `io.github.orbs-network/spot`
21
21
 
@@ -24,7 +24,7 @@ The skill bundle is available through these surfaces:
24
24
  - 🎯 **Intent Mapping**: Translate user intent into market, limit, TWAP, stop-loss, take-profit, and delayed-start orders
25
25
  - ✍️ **Signing Prep**: Produce approval calldata, EIP-712 typed data, and relay-ready payloads
26
26
  - 🔎 **Machine Discovery**: Read supported chains, runtime addresses, references, and assets from `manifest.json`
27
- - 🧰 **Direct Execution Tooling**: Use `scripts/order.js` for prepare, submit, and query flows
27
+ - 🧰 **Direct Execution Tooling**: Use `skill/scripts/order.js` for prepare, submit, and query flows
28
28
 
29
29
  ## Protocol Guarantees
30
30
 
package/SKILL.md ADDED
@@ -0,0 +1,60 @@
1
+ ---
2
+ name: spot-advanced-swap-orders
3
+ description: Use for gasless non-custodial EVM market, limit, TWAP, stop-loss, take-profit, delayed-start orders.
4
+ ---
5
+
6
+ # Spot Advanced Swap Orders
7
+
8
+ Use this for gasless market swaps and advanced orders on supported EVM chains.
9
+ Choose this skill when a user wants market, limit, TWAP, stop-loss, take-profit, or delayed-start execution, or needs to prepare, sign, submit, query, or cancel one of those orders.
10
+ Supply chain, token addresses, chunk sizing, timing, and optional price constraints.
11
+ The helper turns that into approval calldata, EIP-712 typed data, relay-ready submit payloads, and query/cancel guidance,
12
+ while decentralized, non-custodial, oracle-protected, immutable, audited, battle-tested contracts handle execution.
13
+
14
+ ## Distribution
15
+
16
+ This skill ships from the canonical repository [`orbs-network/spot`](https://github.com/orbs-network/spot) across four AI-agent distribution surfaces:
17
+
18
+ 1. Repo-local files [`SKILL.md`](SKILL.md), [`manifest.json`](manifest.json), and the checked-out [`skill/`](skill/) directory.
19
+ 2. Hosted raw files under [`https://orbs-network.github.io/spot/`](https://orbs-network.github.io/spot/), with root entrypoints plus `skill/` support paths.
20
+ 3. The npm package `@orbs-network/spot`, which installs the canonical entrypoints under `node_modules/@orbs-network/spot/skill/`.
21
+ 4. The stdio MCP adapter `spot-mcp`, published in `server.json` as `io.github.orbs-network/spot`.
22
+
23
+ The checked-in `server.json` registry metadata is derived from this skill manifest plus package metadata, so MCP publishing stays aligned.
24
+
25
+ Outside tools should treat [`SKILL.md`](SKILL.md) as the entrypoint and [`manifest.json`](manifest.json) as the machine-readable companion file.
26
+
27
+ ## Auto Check For Updates
28
+
29
+ Before executing this skill in any host agent platform or skill runner:
30
+
31
+ 1. Resolve the canonical source for this `spot-advanced-swap-orders` skill surface.
32
+ 2. If npm is available, compare the local version to the latest published version of `@orbs-network/spot`, for example with `npm view @orbs-network/spot version`.
33
+ 3. If the skill is sourced from git instead of npm, compare the current local tag to the latest canonical git tag, for example with `git describe --tags --abbrev=0` for the current local tag.
34
+ 4. If upstream is newer, refresh the package as one unit before execution.
35
+ 5. Keep [`SKILL.md`](SKILL.md), [`manifest.json`](manifest.json), and all other files in this package on the same revision. Do not mix versions.
36
+ 6. If you cannot verify npm version or git tag freshness, continue only if necessary and explicitly report that version may be outdated.
37
+
38
+ ## Workflow
39
+
40
+ 1. Read [skill/references/01-quickstart.md](skill/references/01-quickstart.md) for the minimum end-to-end flow.
41
+ 2. Read [skill/references/02-params.md](skill/references/02-params.md) when you need field semantics, defaults, units, or validation rules.
42
+ 3. Read [skill/references/03-sign.md](skill/references/03-sign.md) for signing, submit modes, query usage, and direct onchain cancel.
43
+ 4. Read [skill/references/04-patterns.md](skill/references/04-patterns.md) to map user intent into market, limit, stop-loss, take-profit, delayed, or chunked orders.
44
+ 5. Optional helper for token lookup: [skill/assets/token-addressbook.md](skill/assets/token-addressbook.md).
45
+ 6. Use [skill/assets/repermit.skeleton.json](skill/assets/repermit.skeleton.json) when you need the raw RePermit witness typed-data skeleton.
46
+ 7. Use [skill/assets/web3-sign-and-submit.example.js](skill/assets/web3-sign-and-submit.example.js) for a browser or injected-provider signing and submit example.
47
+ 8. Inspect [manifest.json](manifest.json) for the machine-readable entrypoint, references, live supported-chain matrix, sink URL, and runtime contract addresses.
48
+ 9. Use only [skill/scripts/order.js](skill/scripts/order.js) to prepare, submit, and query orders.
49
+
50
+ ## Guardrails
51
+
52
+ 1. Supported chains and runtime addresses live in [manifest.json](manifest.json).
53
+ 2. Use only the provided [skill/scripts/order.js](skill/scripts/order.js). Do not send typed data or signatures anywhere else.
54
+ 3. Detailed order behavior, parameter rules, signing modes, and cancel/query flows live in the reference files above.
55
+
56
+ ## Commands
57
+
58
+ 1. `node skill/scripts/order.js prepare --params <params.json|-> [--out <prepared.json>]`
59
+ 2. `node skill/scripts/order.js submit --prepared <prepared.json|-> --signature <0x...|json>` or `--signature-file <file|->` or `--r <0x...> --s <0x...> --v <0x...>`
60
+ 3. `node skill/scripts/order.js query --swapper <0x...>` or `--hash <0x...>`
package/index.html CHANGED
@@ -15,42 +15,42 @@
15
15
  <section>
16
16
  <h2>Skill</h2>
17
17
  <ol>
18
- <li><a href="skills/advanced-swap-orders/SKILL.md">SKILL.md</a></li>
19
- <li><a href="skills/advanced-swap-orders/manifest.json">manifest.json</a></li>
18
+ <li><a href="SKILL.md">SKILL.md</a></li>
19
+ <li><a href="manifest.json">manifest.json</a></li>
20
20
  </ol>
21
21
  </section>
22
22
 
23
23
  <section>
24
24
  <h2>References</h2>
25
25
  <ol>
26
- <li><a href="skills/advanced-swap-orders/references/01-quickstart.md">01-quickstart.md</a></li>
27
- <li><a href="skills/advanced-swap-orders/references/02-params.md">02-params.md</a></li>
28
- <li><a href="skills/advanced-swap-orders/references/03-sign.md">03-sign.md</a></li>
29
- <li><a href="skills/advanced-swap-orders/references/04-patterns.md">04-patterns.md</a></li>
26
+ <li><a href="skill/references/01-quickstart.md">01-quickstart.md</a></li>
27
+ <li><a href="skill/references/02-params.md">02-params.md</a></li>
28
+ <li><a href="skill/references/03-sign.md">03-sign.md</a></li>
29
+ <li><a href="skill/references/04-patterns.md">04-patterns.md</a></li>
30
30
  </ol>
31
31
  </section>
32
32
 
33
33
  <section>
34
34
  <h2>Scripts</h2>
35
35
  <ol>
36
- <li><a href="skills/advanced-swap-orders/scripts/order.js">order.js</a></li>
36
+ <li><a href="skill/scripts/order.js">order.js</a></li>
37
37
  </ol>
38
38
  </section>
39
39
 
40
40
  <section>
41
41
  <h2>Assets</h2>
42
42
  <ol>
43
- <li><a href="skills/advanced-swap-orders/assets/token-addressbook.md">token-addressbook.md</a></li>
44
- <li><a href="skills/advanced-swap-orders/assets/repermit.skeleton.json">repermit.skeleton.json</a></li>
45
- <li><a href="skills/advanced-swap-orders/assets/web3-sign-and-submit.example.js">web3-sign-and-submit.example.js</a></li>
43
+ <li><a href="skill/assets/token-addressbook.md">token-addressbook.md</a></li>
44
+ <li><a href="skill/assets/repermit.skeleton.json">repermit.skeleton.json</a></li>
45
+ <li><a href="skill/assets/web3-sign-and-submit.example.js">web3-sign-and-submit.example.js</a></li>
46
46
  </ol>
47
47
  </section>
48
48
 
49
49
  <footer>
50
50
  <h2>Distributions</h2>
51
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>
52
+ <li><a href="https://github.com/orbs-network/spot/blob/main/SKILL.md">GitHub skill entrypoint: Spot Advanced Swap Orders</a></li>
53
+ <li><a href="SKILL.md">Hosted raw entrypoint: Spot Advanced Swap Orders</a></li>
54
54
  <li><a href="https://www.npmjs.com/package/@orbs-network/spot">npm package: @orbs-network/spot</a></li>
55
55
  <li><a href="https://www.npmjs.com/package/@orbs-network/spot">npm bin: spot-mcp</a></li>
56
56
  <li><a href="server.json">MCP metadata: io.github.orbs-network/spot</a></li>
@@ -1,21 +1,21 @@
1
1
  {
2
- "name": "advanced-swap-orders",
2
+ "name": "spot-advanced-swap-orders",
3
3
  "title": "Spot Advanced Swap Orders",
4
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.",
5
5
  "entrypoint": "SKILL.md",
6
6
  "references": [
7
- "references/01-quickstart.md",
8
- "references/02-params.md",
9
- "references/03-sign.md",
10
- "references/04-patterns.md"
7
+ "skill/references/01-quickstart.md",
8
+ "skill/references/02-params.md",
9
+ "skill/references/03-sign.md",
10
+ "skill/references/04-patterns.md"
11
11
  ],
12
12
  "scripts": [
13
- "scripts/order.js"
13
+ "skill/scripts/order.js"
14
14
  ],
15
15
  "assets": [
16
- "assets/token-addressbook.md",
17
- "assets/repermit.skeleton.json",
18
- "assets/web3-sign-and-submit.example.js"
16
+ "skill/assets/token-addressbook.md",
17
+ "skill/assets/repermit.skeleton.json",
18
+ "skill/assets/web3-sign-and-submit.example.js"
19
19
  ],
20
20
  "runtime": {
21
21
  "url": "https://agents-sink.orbs.network",
package/mcp/stdio.mjs CHANGED
@@ -11,10 +11,9 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
11
11
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
12
12
  const rootDir = path.resolve(__dirname, "..");
13
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");
14
+ const skillMdPath = path.join(rootDir, "SKILL.md");
15
+ const manifestPath = path.join(rootDir, "manifest.json");
16
+ const cliPath = path.join(rootDir, "skill", "scripts", "order.js");
18
17
 
19
18
  const [pkg, manifest] = await Promise.all([
20
19
  readJsonFile(packageJsonPath),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbs-network/spot",
3
- "version": "2.1.4",
3
+ "version": "2.2.0",
4
4
  "mcpName": "io.github.orbs-network/spot",
5
5
  "description": "**A DeFi protocol for noncustodial advanced order types on EVM chains.**",
6
6
  "homepage": "https://github.com/orbs-network/spot#readme",
@@ -29,7 +29,9 @@
29
29
  "config.json",
30
30
  "index.css",
31
31
  "index.html",
32
- "skills/",
32
+ "SKILL.md",
33
+ "manifest.json",
34
+ "skill/",
33
35
  "script/input/",
34
36
  "out/**/*.json",
35
37
  "index.js",
package/server.json CHANGED
@@ -7,12 +7,12 @@
7
7
  "url": "https://github.com/orbs-network/spot",
8
8
  "source": "github"
9
9
  },
10
- "version": "2.1.4",
10
+ "version": "2.2.0",
11
11
  "packages": [
12
12
  {
13
13
  "registryType": "npm",
14
14
  "identifier": "@orbs-network/spot",
15
- "version": "2.1.4",
15
+ "version": "2.2.0",
16
16
  "transport": {
17
17
  "type": "stdio"
18
18
  }
@@ -3,11 +3,11 @@
3
3
  1. Required fields: `chainId`, `swapper`, `input.token`, `input.amount`, `output.token`.
4
4
  2. Read [02-params.md](02-params.md) for defaults, units, chunking semantics, native asset rules, and validation notes.
5
5
  3. Read [04-patterns.md](04-patterns.md) to choose the right market, limit, stop-loss, take-profit, delayed, or chunked shape.
6
- 4. Prepare: `node scripts/order.js prepare --params <params.json|->`
6
+ 4. Prepare: `node skill/scripts/order.js prepare --params <params.json|->`
7
7
  5. If approval is needed, send `prepared.approval.tx`.
8
- 6. Infinite approval to `RePermit` is acceptable; no approval reset is needed.
8
+ 6. Prefer infinite approval to `RePermit` to save future approval gas costs; no approval reset is needed.
9
9
  7. Sign `prepared.typedData` as the `swapper`.
10
10
  8. Read [03-sign.md](03-sign.md) for signature formats, submit modes, query usage, and direct onchain cancel.
11
- 9. Submit: `node scripts/order.js submit --prepared <prepared.json|-> --signature <0x...|json>`
12
- 10. Query: `node scripts/order.js query --swapper <0x...>` or `--hash <0x...>`
11
+ 9. Submit: `node skill/scripts/order.js submit --prepared <prepared.json|-> --signature <0x...|json>`
12
+ 10. Query: `node skill/scripts/order.js query --swapper <0x...>` or `--hash <0x...>`
13
13
  11. When measuring a fill onchain, sum both transfers to the swapper: the main fill and the surplus refund. Measuring only the main fill undercounts actual output by up to the slippage tolerance.
@@ -3,5 +3,5 @@
3
3
  1. Sign `prepared.typedData` with any EIP-712-capable wallet or library. The signer must equal `swapper`. `eth_signTypedData_v4` is only one example.
4
4
  2. Submit with `--prepared <prepared.json|->` and exactly one signature mode: `--signature <0x...|json>`, `--signature-file <sig.txt|sig.json|->`, or `--r <0x...> --s <0x...> --v <0x...>`.
5
5
  3. The helper accepts a full 65-byte signature, a JSON string, or JSON/object `r/s/v`.
6
- 4. Query with `node scripts/order.js query --swapper <0x...>` or `--hash <0x...>`.
6
+ 4. Query with `node skill/scripts/order.js query --swapper <0x...>` or `--hash <0x...>`.
7
7
  5. Cancel trustlessly onchain by calling `RePermit.cancel([digest])` as the swapper for the signed RePermit digest.
@@ -19,9 +19,10 @@ const WARN_LOW_SLIPPAGE = 'slippage below 5% can reduce fill probability. 5% is
19
19
  const WARN_RECIPIENT = 'recipient differs from swapper and is dangerous to change';
20
20
 
21
21
  const SCRIPT_DIR = __dirname;
22
- const ROOT = path.resolve(SCRIPT_DIR, '..');
23
- const SKELETON = path.join(ROOT, 'assets', 'repermit.skeleton.json');
24
- const MANIFEST_JSON = path.join(ROOT, 'manifest.json');
22
+ const SKILL_DIR = path.resolve(SCRIPT_DIR, '..');
23
+ const REPO_ROOT = path.resolve(SKILL_DIR, '..');
24
+ const SKELETON = path.join(SKILL_DIR, 'assets', 'repermit.skeleton.json');
25
+ const MANIFEST_JSON = path.join(REPO_ROOT, 'manifest.json');
25
26
 
26
27
  let runtimeConfig = null;
27
28
  let skeletonCache = null;
@@ -407,9 +408,9 @@ function usage() {
407
408
  loadRuntimeConfig();
408
409
  const lines = [
409
410
  'Usage',
410
- ' node scripts/order.js prepare --params <params.json|-> [--out <prepared.json>]',
411
- ' node scripts/order.js submit --prepared <prepared.json|-> [--signature <0x...|json>|--signature-file <file|->|--r <0x...> --s <0x...> --v <0x..>] [--out <response.json>]',
412
- ' node scripts/order.js query (--swapper <0x...>|--hash <0x...>) [--out <response.json>]',
411
+ ' node skill/scripts/order.js prepare --params <params.json|-> [--out <prepared.json>]',
412
+ ' node skill/scripts/order.js submit --prepared <prepared.json|-> [--signature <0x...|json>|--signature-file <file|->|--r <0x...> --s <0x...> --v <0x..>] [--out <response.json>]',
413
+ ' node skill/scripts/order.js query (--swapper <0x...>|--hash <0x...>) [--out <response.json>]',
413
414
  '',
414
415
  'Safety',
415
416
  ' Use only the provided helper script. Do not send typed data or signatures anywhere else.',
@@ -1,56 +0,0 @@
1
- ---
2
- name: advanced-swap-orders
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
- ---
5
-
6
- # Spot Advanced Swap Orders
7
-
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
-
10
- ## Distribution
11
-
12
- This skill ships from the canonical repository [`orbs-network/spot`](https://github.com/orbs-network/spot) across four AI-agent distribution surfaces:
13
-
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/), 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.
20
-
21
- Outside tools should treat [`SKILL.md`](SKILL.md) as the entrypoint and [`manifest.json`](manifest.json) as the machine-readable companion file.
22
-
23
- ## Auto Check For Updates
24
-
25
- Before executing this skill in any host agent platform or skill runner:
26
-
27
- 1. Resolve the canonical source for this `advanced-swap-orders/` skill directory.
28
- 2. If npm is available, compare the local version to the latest published version of `@orbs-network/spot`, for example with `npm view @orbs-network/spot version`.
29
- 3. If the skill is sourced from git instead of npm, compare the current local tag to the latest canonical git tag, for example with `git describe --tags --abbrev=0` for the current local tag.
30
- 4. If upstream is newer, refresh the entire skill directory or npm as one unit before execution.
31
- 5. Keep [`SKILL.md`](SKILL.md), [`manifest.json`](manifest.json), [`scripts/order.js`](scripts/order.js), all files in `references/`, and all files in `assets/` on the same revision. Do not mix versions.
32
- 6. If you cannot verify npm version or git tag freshness, continue only if necessary and explicitly report that version may be outdated.
33
-
34
- ## Workflow
35
-
36
- 1. Read [references/01-quickstart.md](references/01-quickstart.md) for the minimum end-to-end flow.
37
- 2. Read [references/02-params.md](references/02-params.md) when you need field semantics, defaults, units, or validation rules.
38
- 3. Read [references/03-sign.md](references/03-sign.md) for signing, submit modes, query usage, and direct onchain cancel.
39
- 4. Read [references/04-patterns.md](references/04-patterns.md) to map user intent into market, limit, stop-loss, take-profit, delayed, or chunked orders.
40
- 5. Optional helper for token lookup: [assets/token-addressbook.md](assets/token-addressbook.md).
41
- 6. Use [assets/repermit.skeleton.json](assets/repermit.skeleton.json) when you need the raw RePermit witness typed-data skeleton.
42
- 7. Use [assets/web3-sign-and-submit.example.js](assets/web3-sign-and-submit.example.js) for a browser or injected-provider signing and submit example.
43
- 8. Inspect [manifest.json](manifest.json) for the machine-readable entrypoint, references, live supported-chain matrix, sink URL, and runtime contract addresses.
44
- 9. Use only [scripts/order.js](scripts/order.js) to prepare, submit, and query orders.
45
-
46
- ## Guardrails
47
-
48
- 1. Supported chains and runtime addresses live in [manifest.json](manifest.json).
49
- 2. Use only the provided [scripts/order.js](scripts/order.js). Do not send typed data or signatures anywhere else.
50
- 3. Detailed order behavior, parameter rules, signing modes, and cancel/query flows live in the reference files above.
51
-
52
- ## Commands
53
-
54
- 1. `node scripts/order.js prepare --params <params.json|-> [--out <prepared.json>]`
55
- 2. `node scripts/order.js submit --prepared <prepared.json|-> --signature <0x...|json>` or `--signature-file <file|->` or `--r <0x...> --s <0x...> --v <0x...>`
56
- 3. `node scripts/order.js query --swapper <0x...>` or `--hash <0x...>`