@trinaryex/mcp 3.9.0 → 4.0.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
@@ -54,13 +54,69 @@ All configuration is **non-secret** — note the absence of any key, address, or
54
54
 
55
55
  ## Tools
56
56
 
57
- **Read** — `market_discover`, `market_search_items`, `market_hub`, `market_items_at_hub`, `market_orderbook`, `market_pool_metadata`, `account_resolve`, `account_balances_at_hub`, `account_currency_balances`, `account_sweepable`, `orders_open`, `orders_fills`, `orders_trades`.
57
+ **Read** — `market_discover`, `market_search_items`, `market_hub`, `market_items_at_hub`, `market_orderbook`, `market_pool_metadata`, `account_resolve`, `account_balances_at_hub`, `account_currency_balances`, `account_sweepable`, `account_caps`, `orders_fees`, `orders_open`, `orders_fills`, `orders_trades`, `orders_get`, `orders_fill`. `orders_fees` and `account_caps` are head-current fullnode reads: the live fee ladder of an item pool (and, with an address, that account's tier), and the capabilities around a trading account. `orders_get` follows up any order on any pool — open, filled or cancelled, with its fills — and `orders_fill` reads one fill by `eventDigest` with both sides' accounts and fees. `account_balances_at_hub` returns item sections only for the selectors you pass (`tradingAccountId`, `address`, `inventoryKey`, `vaultIds`); name at least one.
58
58
 
59
59
  **Locations** — `market_hub_locations`, `market_item_locations`, `market_nearby_hubs`, `market_nearby_hubs_by_system`, `market_hubs_enriched`, `market_assembly_owners`, `market_assemblies_enriched`, `market_solar_system_names`, `account_owners`. These answer *where is it* and *who owns it*: start from `market_hub_locations` or `market_item_locations` when you hold no hub id, then `market_nearby_hubs` to widen the search. All are read tools.
60
60
 
61
+ **Market feeds & prices** — `market_recent_trades`, `market_display_prices`, `market_display_price`, `market_hub_economics`, `market_top_pools_by_fees`, `market_stats`. Market-wide answers rather than one hub's book: the public tape, plain display prices, hub liquidity and platform aggregates. Two unit traps: the tape's `price`/`quantity`/`feeAmount` are **human-readable decimals**, unlike every other trade read; and display prices carry **no trading fee** — cost a real trade with `orders_fees` and `market_orderbook`.
62
+
63
+ **Players, world & routing** — `characters_get`, `characters_by_address`, `characters_by_name`, `characters_batch`, `characters_tribe`, `world_items`, `world_item`, `world_recipes`, `world_recipes_for`, `routing_route`, `routing_compare`, `routing_stats`. Who is behind an address (`characters_batch` names up to 500 wallets in one call), the static item catalogue and crafting recipes (fetch once and cache), and routes between systems. Routing takes solar system **names only**, and since cycle 7 names are player-reported: a system nobody has named yet fails with `RouteNotFound` even though it exists, so a numeric id is refused at the schema. Find routable names with `spatial_autocomplete_systems`; key results on `solarSystemId`, since `solarSystemName` is null until reported.
64
+
65
+ These reads state their compute-unit cost in their descriptions — from 20 CU for a single lookup up to 300 CU for `routing_compare`, which runs three route searches.
66
+
61
67
  **Spatial (star map)** — `spatial_system`, `spatial_systems`, `spatial_nearby_systems`, `spatial_systems_near_coordinates`, `spatial_autocomplete_systems`, `spatial_stats`. Where solar systems are and what is near what — no account, hub or signer needed. Coordinates are metres and distances light years, both as decimal strings: the values exceed 2^53.
62
68
 
63
- **Prepare** — `prepare_create_account`, `prepare_deposit_currency`, `prepare_deposit_items`, `prepare_withdraw_currency`, `prepare_withdraw_items`, `prepare_claim_settled`, `prepare_limit_order`, `prepare_market_order`, `prepare_cancel_order`, `prepare_cancel_all_orders`, `prepare_modify_order`.
69
+ **Prepare** — `prepare_create_account`, `prepare_register_account`, `prepare_mint_account_cap`, `prepare_revoke_account_cap`, `prepare_deposit_currency`, `prepare_deposit_items`, `prepare_withdraw_currency`, `prepare_withdraw_items`, `prepare_claim_settled`, `prepare_limit_order`, `prepare_market_order`, `prepare_cancel_order`, `prepare_cancel_many_orders`, `prepare_cancel_all_orders`, `prepare_modify_order`, `prepare_create_pool`, `prepare_claim_operator_share`.
70
+
71
+ **Coin markets** — currency-pair pools (`triex::pool::Pool<Base, Quote>`), the coin counterpart of the item markets above. A pool is named by `poolId`, or by `baseCoinType` (+ `quoteCoinType`, default CRED); start from `coins_list`, which turns a symbol into both.
72
+
73
+ - *Read* — `coins_list`, `coins_orderbook`, `coins_trade_params`, `coins_quote`, `coins_estimate_market`, `coins_open_orders`, `coins_account`, `coins_balances`. Everything but `coins_list` is a fullnode simulation, so these need no indexer route and reflect the chain head.
74
+ - *Prepare* — `prepare_coin_deposit`, `prepare_coin_withdraw`, `prepare_coin_limit_order`, `prepare_coin_market_order`, `prepare_coin_swap`, `prepare_coin_cancel_order`, `prepare_coin_cancel_many_orders`, `prepare_coin_cancel_all_orders`, `prepare_coin_modify_order`, `prepare_coin_claim_settled`, `prepare_coin_create_pool`.
75
+
76
+ Coin units differ from item units: every amount is **raw base units of its coin**, and prices are **1e9-scaled raw** (`quote = floor(base × price / 1e9)`), not CRED per item. `worstCaseSpend.asset` on a coin tool is the full normalized coin type, since a pool need not be quoted in CRED. Where the SDK would size a figure from a live read — a bid's deposit, a market buy's budget, a swap's `minOut` — the tool runs that read first and passes the result in, so the amount `intent` declares is the amount the bytes commit to.
77
+
78
+ **Organizations (Armature)** — an organization is a *tree* of DAOs, and almost every question about one is really a question about a specific unit: which board votes, whose treasury, whose shared storage. Any unit id resolves the whole tree, so `orgId` is forgiving, but the answers are per-unit.
79
+
80
+ 97 tools — 22 read, 75 prepare — covering every cycle-7 `orgs.*` and `org.*` method except the closure-taking governance generics (see `EXCLUDED_SDK_PATHS`).
81
+
82
+ - *Identity & discovery* — `org_get`, `org_batch`, `org_directory`, `org_for_player`, `org_search`, `org_seats`, `org_trading_account`, `org_proposals`, `org_accessible_keyspaces`.
83
+ - *Governance reads* — `org_governance` (slots, configs, permission bits, the unit's pause/migration flags and freeze state), `org_proposal` (one proposal's live tally and deadlines; `null` once executed or deleted), `org_expired_proposals`, `org_freeze`, `org_capabilities`, `org_entries`.
84
+ - *Treasury reads* — `org_treasury_balances`, `org_treasury_balance`.
85
+ - *Shared storage reads* — `org_vaults_at_hub`, `org_vaults_at_hub_for_org`, `org_vault_resolve`, `org_vault_info`, `org_vault_balance`.
86
+ - *Create* — `prepare_org_create` (root + officers + members in one transaction), `prepare_org_create_standalone`.
87
+ - *Membership & metadata* — `prepare_org_add_members`, `prepare_org_remove_members`, `prepare_org_set_board` (a `{ add, remove }` diff), `prepare_org_update_metadata`.
88
+ - *Proposal types* — `prepare_org_enable_type`, `prepare_org_disable_type`, `prepare_org_update_type_config`, `prepare_org_enable_composite`, `prepare_org_enable_send_coin`, `prepare_org_enable_send_coin_to_org`, `prepare_org_enable_send_small_payment`, `prepare_org_enable_trading`, `prepare_org_enable_bypass`, `prepare_org_disable_bypass`.
89
+ - *Voting & execution* — `prepare_org_vote`, `prepare_org_execute_proposal`, `prepare_org_delete_expired_proposals`, `prepare_org_delete_exhausted_frame`.
90
+ - *Treasury* — `prepare_org_treasury_deposit`, `prepare_org_treasury_claim`, `prepare_org_treasury_send`, `prepare_org_treasury_send_small`, `prepare_org_treasury_send_to_org`.
91
+ - *Trading as the organization* — `prepare_org_setup_trading`, `prepare_org_limit_order`, `prepare_org_market_order`, `prepare_org_cancel_order`, `prepare_org_buy_from_treasury`, `prepare_org_sell_from_vault`, `prepare_org_deposit_to_trading`, `prepare_org_enable_coin_pair`, `prepare_org_coin_limit_order`, `prepare_org_coin_cancel_order`, `prepare_org_create_pool`, `prepare_org_sweep_coin`, `prepare_org_sweep_items`, `prepare_org_sweep_all`.
92
+ - *Shared storage* — `prepare_org_vault_init`, `prepare_org_vault_deposit`, `prepare_org_vault_withdraw`, `prepare_org_vault_grant`, `prepare_org_vault_revoke`, `prepare_org_vault_rekey`, `prepare_org_vault_deinit`.
93
+ - *Currency* — `prepare_org_currency_enable`, `prepare_org_currency_adopt`, `prepare_org_currency_mint`, `prepare_org_currency_mint_allowance`, `prepare_org_currency_configure_allowance`, `prepare_org_currency_mint_with_allowance`, `prepare_org_currency_burn`, `prepare_org_currency_return_cap`.
94
+ - *Sub-units & lifecycle* — `prepare_org_unit_create`, `prepare_org_unit_pause`, `prepare_org_unit_unpause`, `prepare_org_unit_transfer_cap`, `prepare_org_unit_reclaim_cap`, `prepare_org_unit_spin_out`, `prepare_org_spawn_successor`, `prepare_org_transfer_assets`, `prepare_org_unit_destroy`.
95
+ - *Emergency freeze* — `prepare_org_freeze_type`, `prepare_org_unfreeze_type` (FreezeAdminCap holder, no vote), `prepare_org_unfreeze`, `prepare_org_freeze_set_max_duration`, `prepare_org_freeze_update_exempt`, `prepare_org_freeze_transfer_admin`.
96
+ - *Encrypted entries* (member-gated, no vote) — `prepare_org_entry_publish`, `prepare_org_entry_update`, `prepare_org_entry_edit`, `prepare_org_entries_rotate_epoch`, `prepare_org_entry_remove`. These index ciphertext that is already uploaded; encrypting and decrypting need a wallet-signed Seal session and live in `@trinaryex/keyspace`.
97
+ - *Upgrades* — `prepare_org_upgrade_propose`.
98
+
99
+ `seat` and `unitId` are different things. `seat` is the unit you act *through*, meaning whose board votes. `unitId` is the unit you act *on*. A parent's board can target a child it does not sit on, and the action then routes through the parent's `SubOUControl`. Every governance write also takes `metadataIpfs`, which is recorded on the proposal.
100
+
101
+ ### Governance actions have three outcomes, not one
102
+
103
+ This is the one way the org prepare tools differ from every other prepare tool, and skipping it will cost you.
104
+
105
+ The **same call** resolves differently per caller. For an officer whose lone vote clears quorum it executes now; for someone whose does not it creates a **proposal** the board still has to vote on; for a third caller it is refused outright. So:
106
+
107
+ - `intent.outcome` is `"executed"` or `"proposed"`. **A `proposed` result has not done the thing yet.** The outcome is read off the built bytes: a transaction that calls `board_voting::submit_proposal` or `composite::submit_composite` creates a proposal. Anything else executes. Permissionless, cap-holder and member-gated writes always report `executed`.
108
+ - A refusal returns `prepared: false` with the resolver's `reason` and `code` — an answer, not an error, and there are no bytes to sign.
109
+ - Trading tools never degrade into proposals. A limit order deferred by a week is priced against a book that no longer exists, and a funded buy split into two proposals loses its atomic deposit-then-place guarantee, so they return `prepared: false` instead.
110
+
111
+ `org_governance` is what predicts this: a lone vote clears quorum only when `boardSize × quorum ≤ 10000` and `executionDelayMs` is 0. Pair it with `org_seats` to know which board you are on.
112
+
113
+ ### Two things that bite
114
+
115
+ **Shared storage is keyed by (storage unit, organization).** There is no "the vault at this hub" — anyone can register one at any SSU, so `org_vaults_at_hub` may well list a stranger's. `org_vault_resolve` answers for *your* organization.
116
+
117
+ **Some lifecycle steps cannot be undone.** `prepare_org_unit_spin_out` releases a child from its parent for good. `prepare_org_spawn_successor` puts a unit into `Migrating`, after which only `prepare_org_transfer_assets` runs on it.
118
+
119
+ **Proposals are deleted on-chain once they finish.** Cycle 7 deletes a proposal when it executes and when it is cleaned up after expiry. After that, `org_proposal` returns `null` and only `org_proposals` (the indexer) remembers the outcome. A lapsed proposal shows as `pending` until someone runs `prepare_org_delete_expired_proposals`, which is permissionless and pays the storage rebate to the gas payer.
64
120
 
65
121
  u64-ish values (prices, quantities, amounts) cross the MCP boundary as **decimal strings**, never JSON numbers.
66
122
 
@@ -124,12 +180,19 @@ npm run check:parity # readable lock-step report (builds first)
124
180
  npm run build && npm start
125
181
  ```
126
182
 
183
+ Working against an **unpublished** SDK change? The dependency is a published
184
+ version, so a surface added in a sibling checkout is invisible here — and the
185
+ parity gate would cheerfully report lock-step against a version that predates
186
+ the work. `npm run link:sdk` copies the sibling build in so local checks tell
187
+ the truth; `npm install` restores the published copy.
188
+
127
189
  ### Lock-step with the SDK
128
190
 
129
191
  The tool surface is checked against the SDK's **shipped type declarations**, not against a hand-maintained list. `scripts/sdk-surface.mjs` parses `@trinaryex/sdk`'s `.d.ts` with the TypeScript compiler, which gives four things for free:
130
192
 
131
193
  - `private` helpers are excluded **structurally** — nothing to keep in sync;
132
- - each method's **return type classifies it**: `Promise<TxResult>` (or `EnsureAccountResult`) is a write, everything else is a read;
194
+ - each method's **return type classifies it**: `Promise<TxResult>`, `EnsureAccountResult` or `RunOutcome` is a write, everything else is a read — including intersections like `RunOutcome & { skipped }`;
195
+ - **handle sub-APIs are discovered**, not listed: the org handle's groups (`org.governance`, `org.treasury`, …) come from `OrgHandle`'s own property declarations, so adding a group to the SDK cannot silently escape the gate;
133
196
  - each method's **parameter types resolve** to the property names it accepts, following them into sibling declaration files;
134
197
  - it describes the **published contract**, which is what consumers actually see.
135
198
 
@@ -146,18 +209,19 @@ Two escape hatches exist, and each demands a written reason:
146
209
 
147
210
  The waivers are themselves checked: one naming a real SDK parameter, or one the tool no longer declares, fails as a stale claim.
148
211
 
149
- Read tools resolve against `ReadOnlyClient` as well as the namespaced APIs, since that is the client they actually call.
212
+ Read tools resolve against `ReadOnlyClient` as well as the namespaced APIs, since that is the client they actually call. A group `ReadOnlyClient` exposes whole (`coins`, `orgs`) is the same class on both clients and is not aliased onto its flat methods — otherwise `coins.orderbook` would borrow the item book's `storageUnitId`/`assetId`.
150
213
 
151
214
  `npm run check:parity` prints the full report:
152
215
 
153
216
  ```
154
- SDK surface: 25 methods (14 read, 11 write)
155
- MCP tools: 23 · explicitly excluded: 2
156
- Parameters: 74 across the surface · waivers: 1 global + 0 per-tool
217
+ SDK surface: 199 methods (93 read, 106 write)
218
+ MCP tools: 135 · explicitly excluded: 14
219
+ Parameters: 645 across the surface · waivers: 1 global + 124 per-tool
157
220
 
158
221
  ✓ write orders.limit prepare_limit_order
159
222
  ✓ read market.orderbook market_orderbook
160
223
  – read market.resolvePool (excluded)
224
+ ✓ write coins.swap prepare_coin_swap
161
225
  …
162
226
  MCP covers the SDK surface in lock-step.
163
227
  ```
package/dist/capture.d.ts CHANGED
@@ -15,7 +15,7 @@ export declare class TransactionCaptured extends Error {
15
15
  /**
16
16
  * Raised when an SDK call completed without ever handing a transaction to the
17
17
  * executor — meaning there was nothing to prepare (e.g. `account.ensure()` on
18
- * an address that already has a balance manager).
18
+ * an address that already has a trading account).
19
19
  */
20
20
  export declare class NothingToPrepare extends Error {
21
21
  readonly result: unknown;
package/dist/capture.js CHANGED
@@ -17,7 +17,7 @@ export class TransactionCaptured extends Error {
17
17
  /**
18
18
  * Raised when an SDK call completed without ever handing a transaction to the
19
19
  * executor — meaning there was nothing to prepare (e.g. `account.ensure()` on
20
- * an address that already has a balance manager).
20
+ * an address that already has a trading account).
21
21
  */
22
22
  export class NothingToPrepare extends Error {
23
23
  result;
package/dist/context.d.ts CHANGED
@@ -10,13 +10,21 @@ export interface RequestContext {
10
10
  /** The caller's TriEx API key, taken from the request headers. */
11
11
  readonly apiKey: string;
12
12
  readonly config: ServerConfig;
13
- /** A read client bound to this caller's key. */
13
+ /**
14
+ * A read client bound to this caller's key. It carries the shared fullnode
15
+ * client too, because `coins.*` reads (books, fees, quotes, account state)
16
+ * are on-chain simulations rather than indexer routes.
17
+ */
14
18
  readClient(): ReadOnlyClient;
15
19
  /**
16
20
  * A client capable of *building* writes for `sender`. Its executor is the
17
21
  * capture executor, so it can build but never submit.
22
+ *
23
+ * Omit `sender` for fullnode reads that live only on `TriexClient` and take
24
+ * their address per call (`orders.fees`, `account.caps`): the client then has
25
+ * no configured identity to fall back on.
18
26
  */
19
- writeClient(sender: string): TriexClient;
27
+ writeClient(sender?: string): TriexClient;
20
28
  /**
21
29
  * A Keyspace lookup client bound to this caller's key.
22
30
  *
package/dist/context.js CHANGED
@@ -35,12 +35,13 @@ export function createContext(apiKey, config, suiClientOverride) {
35
35
  readClient: () => new ReadOnlyClient({
36
36
  apiKey,
37
37
  network: config.network,
38
+ suiClient: sui(),
38
39
  ...(config.indexerUrl ? { indexerUrl: config.indexerUrl } : {}),
39
40
  }),
40
41
  writeClient: (sender) => new TriexClient({
41
42
  suiClient: sui(),
42
43
  apiKey,
43
- address: sender,
44
+ ...(sender ? { address: sender } : {}),
44
45
  executor: captureExecutor,
45
46
  network: config.network,
46
47
  ...(config.indexerUrl ? { indexerUrl: config.indexerUrl } : {}),
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAEhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5D,OAAO,EAAE,eAAe,E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AE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAChE,CAAC;QACJ,UAAU,EAAE,GAAG,EAAE,CACf,IAAI,cAAc,CAAC;YACjB,MAAM;YACN,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,SAAS,EAAE,GAAG,EAAE;YAChB,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAChE,CAAC;QACJ,WAAW,EAAE,CAAC,MAAe,EAAE,EAAE,CAC/B,IAAI,WAAW,CAAC;YACd,SAAS,EAAE,GAAG,EAAE;YAChB,MAAM;YACN,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACtC,QAAQ,EAAE,eAAe;YACzB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAChE,CAAC;KACL,CAAA;AACH,CAAC"}
package/dist/registry.js CHANGED
@@ -1,11 +1,23 @@
1
+ import { coinTools } from './tools/coins.js';
2
+ import { coinPrepareTools } from './tools/coinsPrepare.js';
1
3
  import { keyspaceTools } from './tools/keyspace.js';
4
+ import { orgTools } from './tools/org.js';
5
+ import { orgLifecycleTools } from './tools/orgLifecycle.js';
6
+ import { orgPrepareTools } from './tools/orgPrepare.js';
2
7
  import { prepareTools } from './tools/prepare.js';
3
8
  import { readTools } from './tools/read.js';
9
+ import { worldTools } from './tools/world.js';
4
10
  /** Every tool this server can expose, in a stable order. */
5
11
  export const ALL_TOOLS = [
6
12
  ...readTools,
13
+ ...worldTools,
14
+ ...coinTools,
7
15
  ...keyspaceTools,
16
+ ...orgTools,
8
17
  ...prepareTools,
18
+ ...coinPrepareTools,
19
+ ...orgPrepareTools,
20
+ ...orgLifecycleTools,
9
21
  ];
10
22
  /**
11
23
  * Inputs any tool may declare without an SDK counterpart.
@@ -28,9 +40,28 @@ export const GLOBAL_SYNTHETIC_PARAMS = {
28
40
  */
29
41
  export const EXCLUDED_SDK_PATHS = {
30
42
  'market.resolvePool': 'Internal plumbing — pool ids are resolved inside the tools that need them.',
43
+ 'coins.resolvePool': 'Internal plumbing — every coins_* and prepare_coin_* tool takes the pool selector and resolves it itself; coins_list (market.poolId and coin types) and coins_orderbook already answer "which pool trades this pair".',
31
44
  'keyspace.hasAccess': 'A membership check callable from the readPrincipals that keyspace_get_acl already returns; add a tool if callers want it server-side.',
32
45
  'keyspace.getStaleEntries': 'Staleness is already reported per entry by keyspace_get_acl, which returns EntryMeta.isStale for every entry.',
33
46
  'keyspace.isEntryStale': 'Single-entry form of keyspace.getStaleEntries; same reason — keyspace_get_acl already carries isStale.',
47
+ // ─── Armature ─────────────────────────────────────────────────────────────
48
+ //
49
+ // The generic governance entry points take an `OuProposalAction`: an object
50
+ // carrying `buildPayload` / `buildExecute` CLOSURES that write Move calls
51
+ // into a transaction. That cannot cross a JSON boundary, and faking it with a
52
+ // string enum would just be the typed tools with a worse name. The typed
53
+ // wrappers ARE the tool surface — every `prepare_org_*` tool below builds one
54
+ // of these actions and hands it to `run` internally.
55
+ 'org.governance.run': 'Takes an OuProposalAction (closure-bearing); the typed prepare_org_* tools are its JSON-expressible surface.',
56
+ 'org.governance.runBatch': 'Takes OuProposalAction[]; its real callers (types.enableTrading, currency.enable, orders.enableCoinPair) each have their own tool.',
57
+ 'org.governance.runComposite': 'Takes OuProposalAction[] to bundle into one proposal; no JSON encoding for the actions. Revisit if a caller needs agent-driven composites.',
58
+ 'org.governance.resolve': 'Dry-run over an OuProposalAction. The same answer is reachable from org_governance (the type configs) plus org_seats (the boards).',
59
+ 'org.governance.paths': 'Full strategy trace over an OuProposalAction — a debugging view of resolve(); same encoding problem.',
60
+ 'org.governance.canComposite': 'Eligibility check over OuProposalAction[]; same encoding problem as runComposite.',
61
+ 'org.governance.proposals': 'Handle-scoped duplicate of orgs.proposals, which org_proposals already wraps without needing an acting address.',
62
+ // Pure derivations over one org_get, deliberately not multiplied into tools.
63
+ 'orgs.nodes': 'orgs.get flattened into a node list; org_get already returns the tree the flattening walks.',
64
+ 'orgs.seat': 'Singular form of orgs.seats — org_seats returns them highest-authority first, so the first entry is this.',
34
65
  };
35
66
  /**
36
67
  * Tools for a given server mode. `read` mode never even registers the prepare
@@ -38,6 +69,8 @@ export const EXCLUDED_SDK_PATHS = {
38
69
  * `tools/list` says so.
39
70
  */
40
71
  export function toolsForMode(mode) {
41
- return mode === 'read' ? [...readTools, ...keyspaceTools] : ALL_TOOLS;
72
+ return mode === 'read'
73
+ ? [...readTools, ...worldTools, ...coinTools, ...keyspaceTools, ...orgTools]
74
+ : ALL_TOOLS;
42
75
  }
43
76
  //# sourceMappingURL=registry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAI3C,4DAA4D;AAC5D,MAAM,CAAC,MAAM,SAAS,GAAc;IAClC,GAAG,SAAS;IACZ,GAAG,aAAa;IAChB,GAAG,YAAY;CAChB,CAAA;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAA2B;IAC7D,MAAM,EACJ,+GAA+G;CAClH,CAAA;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAA2B;IACxD,oBAAoB,EAClB,4EAA4E;IAC9E,oBAAoB,EAClB,uIAAuI;IACzI,0BAA0B,EACxB,+GAA+G;IACjH,uBAAuB,EACrB,wGAAw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ACjH,uBAAuB,EACrB,wGAAwG;IAE1G,6EAA6E;IAC7E,EAAE;IACF,4EAA4E;IAC5E,0EAA0E;IAC1E,8EAA8E;IAC9E,yEAAyE;IACzE,8EAA8E;IAC9E,qDAAqD;IACrD,oBAAoB,EAClB,8GAA8G;IAChH,yBAAyB,EACvB,oIAAoI;IACtI,6BAA6B,EAC3B,4IAA4I;IAC9I,wBAAwB,EACtB,oIAAoI;IACtI,sBAAsB,EACpB,sGAAsG;IACxG,6BAA6B,EAC3B,mFAAmF;IACrF,0BAA0B,EACxB,iHAAiH;IAEnH,6EAA6E;IAC7E,YAAY,EACV,6FAA6F;IAC/F,WAAW,EACT,2GAA2G;CAC9G,CAAA;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,IAAgB;IAC3C,OAAO,IAAI,KAAK,MAAM;QACpB,CAAC,CAAC,CAAC,GAAG,SAAS,EAAE,GAAG,UAAU,EAAE,GAAG,SAAS,EAAE,GAAG,aAAa,EAAE,GAAG,QAAQ,CAAC;QAC5E,CAAC,CAAC,SAAS,CAAA;AACf,CAAC"}
package/dist/schemas.d.ts CHANGED
@@ -7,6 +7,11 @@ import { z } from 'zod';
7
7
  * acceptable failure mode. This mirrors the relay-api convention.
8
8
  */
9
9
  export declare const u64: z.ZodString;
10
+ /**
11
+ * A Move `u128` as a decimal string — order ids since cycle 7. Past 2^53, so
12
+ * never a JSON number.
13
+ */
14
+ export declare const u128: z.ZodString;
10
15
  /**
11
16
  * A signed integer as a decimal string — star-map coordinates in metres.
12
17
  *
@@ -29,6 +34,23 @@ export declare const hubAssetShape: {
29
34
  storageUnitId: z.ZodString;
30
35
  assetId: z.ZodString;
31
36
  };
37
+ /**
38
+ * A fully-qualified Move coin type, `0x…::module::NAME` — the identity of a
39
+ * coin on the coin-pool surface, where an item's numeric asset id would be on
40
+ * the item surface. The SDK normalizes it, so short addresses (`0x2::sui::SUI`)
41
+ * are fine.
42
+ */
43
+ export declare const coinType: z.ZodString;
44
+ /**
45
+ * Which coin pool a call targets: `poolId`, or `baseCoinType` (+
46
+ * `quoteCoinType`, default CRED). Give all three to skip every lookup — the
47
+ * SDK then trusts the pairing as given.
48
+ */
49
+ export declare const coinPoolSelectorShape: {
50
+ poolId: z.ZodOptional<z.ZodString>;
51
+ baseCoinType: z.ZodOptional<z.ZodString>;
52
+ quoteCoinType: z.ZodOptional<z.ZodString>;
53
+ };
32
54
  /**
33
55
  * Paging comes in two flavours and they are not interchangeable.
34
56
  *
package/dist/schemas.js CHANGED
@@ -9,6 +9,16 @@ import { z } from 'zod';
9
9
  export const u64 = z
10
10
  .string()
11
11
  .regex(/^\d+$/, 'expected a non-negative integer as a decimal string');
12
+ const MAX_U128 = (1n << 128n) - 1n;
13
+ /**
14
+ * A Move `u128` as a decimal string — order ids since cycle 7. Past 2^53, so
15
+ * never a JSON number.
16
+ */
17
+ export const u128 = z
18
+ .string()
19
+ .regex(/^\d+$/, 'expected a non-negative integer as a decimal string')
20
+ // The regex check does not stop later checks, so guard BigInt() here.
21
+ .refine((v) => !/^\d+$/.test(v) || BigInt(v) <= MAX_U128, 'exceeds the u128 range');
12
22
  /**
13
23
  * A signed integer as a decimal string — star-map coordinates in metres.
14
24
  *
@@ -32,6 +42,31 @@ export const hubAssetShape = {
32
42
  storageUnitId: objectId.describe('Trade hub / storage unit object id.'),
33
43
  assetId: z.string().describe('EVE Frontier item asset id, e.g. "70810".'),
34
44
  };
45
+ /**
46
+ * A fully-qualified Move coin type, `0x…::module::NAME` — the identity of a
47
+ * coin on the coin-pool surface, where an item's numeric asset id would be on
48
+ * the item surface. The SDK normalizes it, so short addresses (`0x2::sui::SUI`)
49
+ * are fine.
50
+ */
51
+ export const coinType = z
52
+ .string()
53
+ .regex(/^0x[0-9a-fA-F]{1,64}::[A-Za-z_][A-Za-z0-9_]*::[A-Za-z_][A-Za-z0-9_]*(<.+>)?$/, 'expected a fully-qualified coin type, 0x…::module::NAME');
54
+ /**
55
+ * Which coin pool a call targets: `poolId`, or `baseCoinType` (+
56
+ * `quoteCoinType`, default CRED). Give all three to skip every lookup — the
57
+ * SDK then trusts the pairing as given.
58
+ */
59
+ export const coinPoolSelectorShape = {
60
+ poolId: objectId
61
+ .optional()
62
+ .describe('Coin pool object id. Give this or baseCoinType.'),
63
+ baseCoinType: coinType
64
+ .optional()
65
+ .describe('Base coin type, e.g. "0x…::wbtc::WBTC". Give this or poolId; resolved via the on-chain pool registry.'),
66
+ quoteCoinType: coinType
67
+ .optional()
68
+ .describe('Quote coin type; defaults to CRED, the permissionless quote.'),
69
+ };
35
70
  const limitShape = {
36
71
  limit: z.number().int().positive().max(200).optional(),
37
72
  };
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC;KACjB,MAAM,EAAE;KACR,KAAK,CAAC,OAAO,EAAE,qDAAqD,CAAC,CAAA;AAExE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC;KACxB,MAAM,EAAE;KACR,KAAK,CAAC,SAAS,EAAE,yCAAyC,CAAC,CAAA;AAE9D,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC;KACxB,MAAM,EAAE;KACR,KAAK,CAAC,uBAAuB,EAAE,oCAAoC,CAAC,CAAA;AAEvE,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAA;AAElC,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAA;AAEhD,8EAA8E;AAC9E,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,MAAM,EAAE,UAAU,CAAC,QAAQ,CACzB,kFAAkF,CACnF;CACF,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,aAAa,EAAE,QAAQ,CAA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C/C,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IACtD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC9B,CAAA;AAED,kDAAkD;AAClD,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CAAA;AAE3C,8EAA8E;AAC9E,MAAM,UAAU,GAAG,CAAC,KAAa;IAC/B,OAAO,MAAM,CAAC,KAAK,CAAC,CAAA;AACtB,CAAC;AAED,gEAAgE;AAChE,MAAM,UAAU,MAAM,CAAC,KAAyB;IAC9C,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AACxD,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { ToolDef } from './types.js';
2
+ export declare const coinTools: ToolDef[];
@@ -0,0 +1,146 @@
1
+ import { z } from 'zod';
2
+ import { ok } from '../result.js';
3
+ import { big, bigOpt, coinPoolSelectorShape, coinType, objectId, orderSide, suiAddress, u64, } from '../schemas.js';
4
+ /**
5
+ * Coin-pool (currency-pair) market reads — `triex::pool::Pool<Base, Quote>`,
6
+ * a CLOB between two Move coin types, as opposed to the item markets the
7
+ * `market_*` tools read.
8
+ *
9
+ * Only `coins_list` is an indexer read. Everything else is a head-current
10
+ * fullnode simulation (the coin-pool indexer routes are not on the public
11
+ * gateway), served through the shared, credential-free Sui client the read
12
+ * client carries.
13
+ *
14
+ * Units: every amount is RAW base units of its coin as a decimal string, and
15
+ * prices are 1e9-scaled raw (`quote = floor(base × price / 1e9)`), not the
16
+ * item markets' CRED-per-item.
17
+ */
18
+ const tradingAccountId = objectId.describe('TradingAccount object id — from account_resolve.');
19
+ export const coinTools = [
20
+ {
21
+ name: 'coins_list',
22
+ title: 'List coins',
23
+ description: 'Every coin in the token registry with supply facts and, when it has one, its pool’s market summary (pool id, base/quote coin types and decimals, best bid/ask, last price, entry taker rate) — pooled coins first, most active first. The entry point for coin trading: it turns a symbol into the coin type and pool id every other coins_* and prepare_coin_* tool takes. Supply figures are whole coins; prices and rates are raw 1e9-scaled decimal strings and display-only — use coins_trade_params for live fees.',
24
+ kind: 'read',
25
+ sdkPath: 'coins.list',
26
+ inputShape: {
27
+ coinTypes: z
28
+ .array(coinType)
29
+ .min(1)
30
+ .max(200)
31
+ .optional()
32
+ .describe('Restrict to these coin types (max 200). Omit for all.'),
33
+ },
34
+ handler: async (ctx, args) => ok(await ctx
35
+ .readClient()
36
+ .coins.list(args.coinTypes ? { coinTypes: args.coinTypes } : {})),
37
+ },
38
+ {
39
+ name: 'coins_orderbook',
40
+ title: 'Read a coin order book',
41
+ description: 'The resting book of one coin pool, read on-chain: bids and asks best-first (expired orders excluded) with order ids, plus per-price levels and whether more rests beyond the depth read. Also echoes the resolved poolId and coin types. Prices are 1e9-scaled raw, quantities raw base units. Use before sizing a coin limit or market order.',
42
+ kind: 'read',
43
+ sdkPath: 'coins.orderbook',
44
+ inputShape: {
45
+ ...coinPoolSelectorShape,
46
+ depth: z
47
+ .number()
48
+ .int()
49
+ .positive()
50
+ .max(1000)
51
+ .optional()
52
+ .describe('Orders to read per side (default 100).'),
53
+ },
54
+ handler: async (ctx, args) => ok(await ctx.readClient().coins.orderbook(args)),
55
+ },
56
+ {
57
+ name: 'coins_trade_params',
58
+ title: 'Read coin-pool fees',
59
+ description: 'Live fee state of one coin pool from the on-chain FeePolicy: the pool’s fee class, entry-rung taker/maker rates, the staged schedule and the epoch it takes over, and the share of a bid’s maker-fee escrow kept on cancel. With tradingAccountId, also that account’s tier, turnover and rates. Rates are 1e9-scaled (11000000 = 1.10%). prepare_coin_limit_order funds bids from exactly these rates.',
60
+ kind: 'read',
61
+ sdkPath: 'coins.tradeParams',
62
+ inputShape: {
63
+ ...coinPoolSelectorShape,
64
+ tradingAccountId: tradingAccountId
65
+ .optional()
66
+ .describe('Also resolve this trading account’s own tier and rates.'),
67
+ },
68
+ handler: async (ctx, args) => ok(await ctx.readClient().coins.tradeParams(args)),
69
+ },
70
+ {
71
+ name: 'coins_quote',
72
+ title: 'Quote a coin swap',
73
+ description: 'Dry-run a wallet swap against the live book, fees included: what amountIn buys (side "buy", spending quote) or sells for (side "sell", spending base), and how much of it the book could not absorb. Priced at the entry rung — exactly what prepare_coin_swap is charged — unless tradingAccountId is given. Raw base units as decimal strings; nothing executes.',
74
+ kind: 'read',
75
+ sdkPath: 'coins.quote',
76
+ inputShape: {
77
+ ...coinPoolSelectorShape,
78
+ side: orderSide.describe('"buy" spends quote for base; "sell" the reverse.'),
79
+ amountIn: u64.describe('Raw amount of the coin being spent: quote for buys, base for sells.'),
80
+ tradingAccountId: tradingAccountId
81
+ .optional()
82
+ .describe('Price at this account’s fee tier instead of the entry rung.'),
83
+ },
84
+ handler: async (ctx, args) => ok(await ctx
85
+ .readClient()
86
+ .coins.quote({ ...args, amountIn: big(args.amountIn) })),
87
+ },
88
+ {
89
+ name: 'coins_estimate_market',
90
+ title: 'Estimate a coin market order',
91
+ description: 'Price a coin market order of `quantity` base against the live book exactly as matching will: filled quantity, gross quote, taker fee, average price, and totalQuote — for a buy, the quote the trading account must hold (pass it as quoteBudget to prepare_coin_market_order); for a sell, what it nets. Raw units; prices 1e9-scaled.',
92
+ kind: 'read',
93
+ sdkPath: 'coins.estimateMarket',
94
+ inputShape: {
95
+ ...coinPoolSelectorShape,
96
+ side: orderSide,
97
+ quantity: u64.describe('Base quantity of the market order, raw units.'),
98
+ depth: z
99
+ .number()
100
+ .int()
101
+ .positive()
102
+ .max(1000)
103
+ .optional()
104
+ .describe('Book depth to walk (default 100, the matching limit).'),
105
+ takerFeeRateScaled: u64
106
+ .optional()
107
+ .describe('Taker rate to price at, 1e9-scaled. Defaults to the conservative entry-rung rate.'),
108
+ },
109
+ handler: async (ctx, args) => ok(await ctx.readClient().coins.estimateMarket({
110
+ ...args,
111
+ quantity: big(args.quantity),
112
+ takerFeeRateScaled: bigOpt(args.takerFeeRateScaled),
113
+ })),
114
+ },
115
+ {
116
+ name: 'coins_open_orders',
117
+ title: 'List coin open orders',
118
+ description: 'A trading account’s resting orders in one coin pool, read on-chain — order ids (u128 decimal strings), price, original/filled/remaining quantity, expiry. Empty when it has none. These ids feed prepare_coin_cancel_order and prepare_coin_modify_order.',
119
+ kind: 'read',
120
+ sdkPath: 'coins.openOrders',
121
+ inputShape: { ...coinPoolSelectorShape, tradingAccountId },
122
+ handler: async (ctx, args) => ok(await ctx.readClient().coins.openOrders(args)),
123
+ },
124
+ {
125
+ name: 'coins_account',
126
+ title: 'Read coin-pool account state',
127
+ description: 'A trading account’s state in one coin pool: open order ids, taker/maker volume, settled balances (claimable now via prepare_coin_claim_settled), owed balances, and what its open orders lock. Null when the account has never traded in this pool. Raw base units as decimal strings.',
128
+ kind: 'read',
129
+ sdkPath: 'coins.account',
130
+ inputShape: { ...coinPoolSelectorShape, tradingAccountId },
131
+ handler: async (ctx, args) => ok(await ctx.readClient().coins.account(args)),
132
+ },
133
+ {
134
+ name: 'coins_balances',
135
+ title: 'Check coin balances',
136
+ description: 'Any coin held by an address: loose in the wallet, and deposited inside its trading account — the any-coin form of account_currency_balances. Works for an address with no trading account (tradingAccount "0", tradingAccountId null). Head-current from the fullnode; raw base units as decimal strings.',
137
+ kind: 'read',
138
+ sdkPath: 'coins.balances',
139
+ inputShape: {
140
+ coinType: coinType.describe('Coin type to read, e.g. "0x2::sui::SUI".'),
141
+ address: suiAddress.describe('Sui address whose balances to read.'),
142
+ },
143
+ handler: async (ctx, args) => ok(await ctx.readClient().coins.balances(args)),
144
+ },
145
+ ];
146
+ //# sourceMappingURL=coins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coins.js","sourceRoot":"","sources":["../../src/tools/coins.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE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