suprafx-agent-sdk 0.3.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.
Files changed (42) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +452 -0
  3. package/dist/bin/suprafx-mcp.d.ts +15 -0
  4. package/dist/bin/suprafx-mcp.js +238 -0
  5. package/dist/bin/suprafx-mcp.js.map +1 -0
  6. package/dist/src/asset-registry.d.ts +61 -0
  7. package/dist/src/asset-registry.js +118 -0
  8. package/dist/src/asset-registry.js.map +1 -0
  9. package/dist/src/client.d.ts +227 -0
  10. package/dist/src/client.js +282 -0
  11. package/dist/src/client.js.map +1 -0
  12. package/dist/src/derive-ids.d.ts +112 -0
  13. package/dist/src/derive-ids.js +361 -0
  14. package/dist/src/derive-ids.js.map +1 -0
  15. package/dist/src/event-bcs.d.ts +341 -0
  16. package/dist/src/event-bcs.js +767 -0
  17. package/dist/src/event-bcs.js.map +1 -0
  18. package/dist/src/index.d.ts +26 -0
  19. package/dist/src/index.js +26 -0
  20. package/dist/src/index.js.map +1 -0
  21. package/dist/src/mcp/config.d.ts +32 -0
  22. package/dist/src/mcp/config.js +101 -0
  23. package/dist/src/mcp/config.js.map +1 -0
  24. package/dist/src/mcp/lifecycle.d.ts +109 -0
  25. package/dist/src/mcp/lifecycle.js +170 -0
  26. package/dist/src/mcp/lifecycle.js.map +1 -0
  27. package/dist/src/mcp/preflight.d.ts +36 -0
  28. package/dist/src/mcp/preflight.js +291 -0
  29. package/dist/src/mcp/preflight.js.map +1 -0
  30. package/dist/src/mcp/server.d.ts +20 -0
  31. package/dist/src/mcp/server.js +235 -0
  32. package/dist/src/mcp/server.js.map +1 -0
  33. package/dist/src/mcp/tools.d.ts +51 -0
  34. package/dist/src/mcp/tools.js +1022 -0
  35. package/dist/src/mcp/tools.js.map +1 -0
  36. package/dist/src/sign-event.d.ts +185 -0
  37. package/dist/src/sign-event.js +331 -0
  38. package/dist/src/sign-event.js.map +1 -0
  39. package/dist/src/signer.d.ts +89 -0
  40. package/dist/src/signer.js +226 -0
  41. package/dist/src/signer.js.map +1 -0
  42. package/package.json +65 -0
@@ -0,0 +1,361 @@
1
+ /**
2
+ * Asset + pair ID derivation for council `SubmitRfq` events.
3
+ *
4
+ * The chain treats asset_id and pair_id as opaque 32-byte values —
5
+ * it doesn't validate the derivation, just routes events by ID. So
6
+ * the only invariant is **consistency across calls**: SupraFX must
7
+ * derive the same ID for the same (chain, token) tuple every time,
8
+ * across all users + sessions, otherwise orderbook state diverges
9
+ * (two users referring to "ETH on Sepolia" via different IDs would
10
+ * fail to match).
11
+ *
12
+ * ## Convention (V2 — chain-canonical)
13
+ *
14
+ * `asset_id = BLAKE3-keyed(key=BLAKE3("SUPRAFX-ASSET-V1"),
15
+ * message=[chain_id_len_u8, ...chain_id_utf8,
16
+ * ...token_address_bytes])`
17
+ * `pair_id = BLAKE3("suprafx-pair-v1\n" + base_asset_hex
18
+ * + "\n" + quote_asset_hex)`
19
+ *
20
+ * V2 mirrors `council_bridge::identity::asset_id_from_chain_and_token`
21
+ * byte-for-byte. Required because the bridge credits L1 deposits
22
+ * under THIS asset_id; if the dApp's RFQ uses a different derivation
23
+ * (V1), the chain says "no balance" and the validator gate rejects
24
+ * the trade. The migration is one-time — open RFQs from V1 days
25
+ * remain in the legacy table but are unmatchable on the new orderbook.
26
+ *
27
+ * ## Token address registry
28
+ *
29
+ * The chain stores asset_id under `(canonicalChainId, tokenBytes)`,
30
+ * where tokenBytes is:
31
+ * - `[0u8; 20]` for the native EVM coin (`EVM_NATIVE_TOKEN_BYTES`)
32
+ * - the 20-byte ERC-20 contract address otherwise
33
+ * - `[0u8; 32]` for native Supra
34
+ * The dApp UI thinks in `(uiChain, symbol)` strings. The registry
35
+ * below bridges the two; new tokens MUST be added here AND in the
36
+ * validator's `bridge.eth_chains[*].asset_decimals` operator config
37
+ * before they can be deposited.
38
+ */
39
+ import { blake3 } from "@noble/hashes/blake3.js";
40
+ const ASSET_DST = "SUPRAFX-ASSET-V1";
41
+ const PAIR_DST = "suprafx-pair-v1";
42
+ const ASSET_DST_KEY = blake3(new TextEncoder().encode(ASSET_DST));
43
+ /**
44
+ * Token-address registry — UI `(chain, symbol)` → canonical
45
+ * `(chainId, tokenBytes)` used by the chain. `chainId` is what the
46
+ * bridge observer puts in the deposit's `source_chain` field; the
47
+ * symbol-to-address mapping must match the validator's
48
+ * `asset_decimals` operator config exactly.
49
+ *
50
+ * For untradable / test assets not in this registry, callers fall
51
+ * through to V1 derivation as a soft-compat path (kept so explorer
52
+ * UIs and unit tests don't break).
53
+ */
54
+ const EVM_NATIVE = new Uint8Array(20); // all zeros
55
+ const EVM_NATIVE_HEX = "00".repeat(20);
56
+ const SUPRA_NATIVE = new Uint8Array(32); // all zeros
57
+ function supraAddr32(hex) {
58
+ const s = hex.startsWith("0x") || hex.startsWith("0X") ? hex.slice(2) : hex;
59
+ if (s.length !== 64)
60
+ throw new Error(`supraAddr32: ${hex} not 32 bytes`);
61
+ const out = new Uint8Array(32);
62
+ for (let i = 0; i < 32; i++)
63
+ out[i] = parseInt(s.slice(i * 2, i * 2 + 2), 16);
64
+ return out;
65
+ }
66
+ const TOKEN_REGISTRY = new Map([
67
+ // ────────────────────────────────────────────────────────────────────
68
+ // Sepolia / Supra-testnet (kept for dev + sepolia testing)
69
+ // ────────────────────────────────────────────────────────────────────
70
+ ["sepolia/ETH", { chainId: "eth-sepolia", tokenBytes: EVM_NATIVE }],
71
+ ["eth-sepolia/ETH", { chainId: "eth-sepolia", tokenBytes: EVM_NATIVE }],
72
+ // Sepolia USDC — must match validator config (operator-enabled token).
73
+ // Address per deploy/dev/node-1/node.json asset_decimals.
74
+ [
75
+ "sepolia/USDC",
76
+ {
77
+ chainId: "eth-sepolia",
78
+ tokenBytes: hexAddrToBytes("0x1c7d4b196cb0c7b01d743fbc6116a902379c7238"),
79
+ },
80
+ ],
81
+ [
82
+ "eth-sepolia/USDC",
83
+ {
84
+ chainId: "eth-sepolia",
85
+ tokenBytes: hexAddrToBytes("0x1c7d4b196cb0c7b01d743fbc6116a902379c7238"),
86
+ },
87
+ ],
88
+ ["supra/SUPRA", { chainId: "supra-testnet", tokenBytes: SUPRA_NATIVE }],
89
+ ["supra-testnet/SUPRA", { chainId: "supra-testnet", tokenBytes: SUPRA_NATIVE }],
90
+ // ────────────────────────────────────────────────────────────────────
91
+ // Mainnet beta — 11 assets baked into the suprafx-mainnet-1 genesis
92
+ // (2026-05-27 ceremony, audit.json). Addresses verified live against
93
+ // Etherscan + on-chain Supra RPC. Each entry registered under TWO
94
+ // UI keys: short ("mainnet/X", "supra/X") + canonical chain id
95
+ // ("eth-mainnet/X", "supra-mainnet/X").
96
+ // ────────────────────────────────────────────────────────────────────
97
+ // ETH (native)
98
+ ["mainnet/ETH", { chainId: "eth-mainnet", tokenBytes: EVM_NATIVE }],
99
+ ["eth-mainnet/ETH", { chainId: "eth-mainnet", tokenBytes: EVM_NATIVE }],
100
+ // WBTC — 8 decimals (matches BTC)
101
+ [
102
+ "mainnet/WBTC",
103
+ {
104
+ chainId: "eth-mainnet",
105
+ tokenBytes: hexAddrToBytes("0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"),
106
+ },
107
+ ],
108
+ [
109
+ "eth-mainnet/WBTC",
110
+ {
111
+ chainId: "eth-mainnet",
112
+ tokenBytes: hexAddrToBytes("0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"),
113
+ },
114
+ ],
115
+ // USDC — 6 decimals (Circle)
116
+ [
117
+ "mainnet/USDC",
118
+ {
119
+ chainId: "eth-mainnet",
120
+ tokenBytes: hexAddrToBytes("0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"),
121
+ },
122
+ ],
123
+ [
124
+ "eth-mainnet/USDC",
125
+ {
126
+ chainId: "eth-mainnet",
127
+ tokenBytes: hexAddrToBytes("0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"),
128
+ },
129
+ ],
130
+ // USDT — 6 decimals (Tether)
131
+ [
132
+ "mainnet/USDT",
133
+ {
134
+ chainId: "eth-mainnet",
135
+ tokenBytes: hexAddrToBytes("0xdac17f958d2ee523a2206206994597c13d831ec7"),
136
+ },
137
+ ],
138
+ [
139
+ "eth-mainnet/USDT",
140
+ {
141
+ chainId: "eth-mainnet",
142
+ tokenBytes: hexAddrToBytes("0xdac17f958d2ee523a2206206994597c13d831ec7"),
143
+ },
144
+ ],
145
+ // AAVE — 18 decimals
146
+ [
147
+ "mainnet/AAVE",
148
+ {
149
+ chainId: "eth-mainnet",
150
+ tokenBytes: hexAddrToBytes("0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9"),
151
+ },
152
+ ],
153
+ [
154
+ "eth-mainnet/AAVE",
155
+ {
156
+ chainId: "eth-mainnet",
157
+ tokenBytes: hexAddrToBytes("0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9"),
158
+ },
159
+ ],
160
+ // LINK — 18 decimals (Chainlink)
161
+ [
162
+ "mainnet/LINK",
163
+ {
164
+ chainId: "eth-mainnet",
165
+ tokenBytes: hexAddrToBytes("0x514910771af9ca656af840dff83e8264ecf986ca"),
166
+ },
167
+ ],
168
+ [
169
+ "eth-mainnet/LINK",
170
+ {
171
+ chainId: "eth-mainnet",
172
+ tokenBytes: hexAddrToBytes("0x514910771af9ca656af840dff83e8264ecf986ca"),
173
+ },
174
+ ],
175
+ // UNI — 18 decimals (Uniswap)
176
+ [
177
+ "mainnet/UNI",
178
+ {
179
+ chainId: "eth-mainnet",
180
+ tokenBytes: hexAddrToBytes("0x1f9840a85d5af5bf1d1762f925bdaddc4201f984"),
181
+ },
182
+ ],
183
+ [
184
+ "eth-mainnet/UNI",
185
+ {
186
+ chainId: "eth-mainnet",
187
+ tokenBytes: hexAddrToBytes("0x1f9840a85d5af5bf1d1762f925bdaddc4201f984"),
188
+ },
189
+ ],
190
+ // SUPRA — native Supra mainnet (32-byte zero address)
191
+ ["supra-mainnet/SUPRA", { chainId: "supra-mainnet", tokenBytes: SUPRA_NATIVE }],
192
+ // iAssets — Supra PoEL Fungible Asset Metadata object addresses,
193
+ // pulled directly from Supra mainnet on 2026-05-27 (all 8 decimals,
194
+ // by Supra's iAsset framework convention). Genesis pre-commits these
195
+ // slots; deposit support ships in v1.1 (committee_vault FA refactor).
196
+ //
197
+ // Registry keys are UPPERCASE per `deriveAssetId`'s `.toUpperCase()`
198
+ // normalization — UI labels can still render "iUSDC" / "iWBTC" /
199
+ // "iUSDT"; the lookup just goes through the uppercase form.
200
+ [
201
+ "supra-mainnet/IUSDC",
202
+ {
203
+ chainId: "supra-mainnet",
204
+ tokenBytes: supraAddr32("0x90a8e901e02ac1539af4a865bbe4a6b96edc27375488803cfbbd6875ec57b281"),
205
+ },
206
+ ],
207
+ [
208
+ "supra-mainnet/IUSDT",
209
+ {
210
+ chainId: "supra-mainnet",
211
+ tokenBytes: supraAddr32("0xceff14089bde0d4f512dcd3b6f3df6794346c58115b8d97e043f92ff08cd1fca"),
212
+ },
213
+ ],
214
+ [
215
+ "supra-mainnet/IWBTC",
216
+ {
217
+ chainId: "supra-mainnet",
218
+ tokenBytes: supraAddr32("0xbc8d1fb1ea5f22dd931935cbdcb128bbb205e567a6b5225fe6994f8bafc8702a"),
219
+ },
220
+ ],
221
+ ]);
222
+ function hexAddrToBytes(hex) {
223
+ const s = hex.startsWith("0x") || hex.startsWith("0X") ? hex.slice(2) : hex;
224
+ if (s.length !== 40)
225
+ throw new Error(`hexAddrToBytes: ${hex} not 20 bytes`);
226
+ const out = new Uint8Array(20);
227
+ for (let i = 0; i < 20; i++)
228
+ out[i] = parseInt(s.slice(i * 2, i * 2 + 2), 16);
229
+ return out;
230
+ }
231
+ /**
232
+ * Chain-canonical asset_id. Mirrors
233
+ * `council_bridge::identity::asset_id_from_chain_and_token`.
234
+ *
235
+ * asset_id = blake3-keyed(
236
+ * key = blake3("SUPRAFX-ASSET-V1"),
237
+ * msg = [chain_id.len() as u8, ...chain_id_utf8, ...token_bytes],
238
+ * )
239
+ *
240
+ * `chainId` is the canonical bridge chain identifier (`eth-sepolia`,
241
+ * `supra-testnet`, etc). `tokenBytes` is the L1 token address — 20
242
+ * bytes for EVM (zero for native), 32 bytes for Supra (zero for native).
243
+ */
244
+ export function assetIdFromChainAndToken(chainId, tokenBytes) {
245
+ if (chainId.length > 0xff) {
246
+ throw new Error(`assetIdFromChainAndToken: chainId too long (${chainId.length} > 255)`);
247
+ }
248
+ const chainBytes = new TextEncoder().encode(chainId);
249
+ const msg = new Uint8Array(1 + chainBytes.length + tokenBytes.length);
250
+ msg[0] = chainBytes.length;
251
+ msg.set(chainBytes, 1);
252
+ msg.set(tokenBytes, 1 + chainBytes.length);
253
+ return blake3(msg, { key: ASSET_DST_KEY });
254
+ }
255
+ /**
256
+ * Bridge the SHORT chain ids the venue's `/api/assets` returns
257
+ * (`"ethereum"`, `"supra"`, `"sepolia"`) to the CANONICAL bridge chain
258
+ * ids the on-chain AssetId derivation is keyed on (`"eth-mainnet"`,
259
+ * `"supra-mainnet"`, `"eth-sepolia"`).
260
+ *
261
+ * WHY THIS EXISTS (verified against live `https://suprafx.ai/api/assets`
262
+ * on 2026-09-14). An agent that reads `list_assets` and passes the
263
+ * `chain_id` it got back straight into a trade — the obvious thing to do
264
+ * — used to derive the WRONG AssetId, two different ways, both silent:
265
+ *
266
+ * - `"ethereum"` is in no registry key, so `deriveAssetId` fell through
267
+ * to the legacy V1 hash and produced a phantom id the validator gate
268
+ * rejects.
269
+ * - `"supra"` WAS a registry key — pointing at `supra-testnet`. So a
270
+ * mainnet SUPRA trade derived the TESTNET SUPRA asset: a well-formed
271
+ * id for the wrong chain. Worse than a phantom, because nothing about
272
+ * it looks wrong.
273
+ *
274
+ * Canonical ids map to themselves, so this is an identity for every
275
+ * caller that already passes the long form.
276
+ */
277
+ export function canonicalChain(chain) {
278
+ switch (chain.trim().toLowerCase()) {
279
+ case "ethereum":
280
+ case "eth":
281
+ case "mainnet":
282
+ case "eth-mainnet":
283
+ return "eth-mainnet";
284
+ case "supra":
285
+ case "supra-mainnet":
286
+ return "supra-mainnet";
287
+ case "sepolia":
288
+ case "eth-sepolia":
289
+ return "eth-sepolia";
290
+ case "supra-testnet":
291
+ return "supra-testnet";
292
+ default:
293
+ return chain.trim().toLowerCase();
294
+ }
295
+ }
296
+ /**
297
+ * Derive a 32-byte AssetId from a UI-friendly `(chain, symbol)` tuple.
298
+ *
299
+ * Resolves through TOKEN_REGISTRY to the canonical
300
+ * `(chainId, tokenBytes)` then hashes per
301
+ * [`assetIdFromChainAndToken`]. For tokens not in the registry
302
+ * (test/explorer use cases), falls back to the V1 hash so
303
+ * downstream code that doesn't actually trade these IDs keeps
304
+ * working — but the return value is NOT what the chain expects
305
+ * for the unregistered token, so RFQ submission against it WILL
306
+ * fail at the validator gate.
307
+ */
308
+ export function deriveAssetId(chain, symbol) {
309
+ const key = `${canonicalChain(chain)}/${symbol.toUpperCase()}`;
310
+ const spec = TOKEN_REGISTRY.get(key);
311
+ if (spec) {
312
+ return assetIdFromChainAndToken(spec.chainId, spec.tokenBytes);
313
+ }
314
+ // Soft-compat: legacy V1 hash for unregistered assets.
315
+ const enc = new TextEncoder();
316
+ const msg = enc.encode(`suprafx-asset-v1\n${chain}\n${symbol}`);
317
+ return blake3(msg);
318
+ }
319
+ /**
320
+ * Like `deriveAssetId`, but returns `null` for a `(chain, symbol)`
321
+ * NOT in `TOKEN_REGISTRY` — instead of silently falling through to
322
+ * the V1 hash.
323
+ *
324
+ * Callers that need the REAL chain-canonical AssetId — delegate
325
+ * `asset_caps` (Option B), deposit crediting — MUST use this and
326
+ * treat `null` as "not a tradeable asset yet". Embedding a V1 hash in
327
+ * a delegate's cap map authorizes a phantom id, and the moment the
328
+ * asset is later registered every old session's map goes stale.
329
+ */
330
+ export function registeredAssetId(chain, symbol) {
331
+ const key = `${canonicalChain(chain)}/${symbol.toUpperCase()}`;
332
+ const spec = TOKEN_REGISTRY.get(key);
333
+ return spec ? assetIdFromChainAndToken(spec.chainId, spec.tokenBytes) : null;
334
+ }
335
+ /**
336
+ * Derive a 32-byte PairId from base + quote AssetId values.
337
+ *
338
+ * Order matters: `(ETH, USDC)` produces a different pair than
339
+ * `(USDC, ETH)`. SubmitRfq's `base_asset` is what the user gives
340
+ * up; `quote_asset` is what they receive.
341
+ */
342
+ export function derivePairId(baseAssetId, quoteAssetId) {
343
+ if (baseAssetId.length !== 32 || quoteAssetId.length !== 32) {
344
+ throw new Error(`derivePairId: asset IDs must be 32 bytes (got ${baseAssetId.length}, ${quoteAssetId.length})`);
345
+ }
346
+ const enc = new TextEncoder();
347
+ const baseHex = bytesToHex(baseAssetId);
348
+ const quoteHex = bytesToHex(quoteAssetId);
349
+ const msg = enc.encode(`${PAIR_DST}\n${baseHex}\n${quoteHex}`);
350
+ return blake3(msg);
351
+ }
352
+ /**
353
+ * Convenience: one-call `(chain, symbol)` × 2 → 32-byte PairId.
354
+ */
355
+ export function derivePairIdFromTokens(baseChain, baseSymbol, quoteChain, quoteSymbol) {
356
+ return derivePairId(deriveAssetId(baseChain, baseSymbol), deriveAssetId(quoteChain, quoteSymbol));
357
+ }
358
+ function bytesToHex(b) {
359
+ return Array.from(b, (x) => x.toString(16).padStart(2, "0")).join("");
360
+ }
361
+ //# sourceMappingURL=derive-ids.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"derive-ids.js","sourceRoot":"","sources":["../../src/derive-ids.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,MAAM,SAAS,GAAG,kBAAkB,CAAC;AACrC,MAAM,QAAQ,GAAG,iBAAiB,CAAC;AAEnC,MAAM,aAAa,GAAe,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;AAE9E;;;;;;;;;;GAUG;AACH,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,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