@trinaryex/sdk 1.0.0 → 3.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/DESIGN.md CHANGED
@@ -10,8 +10,9 @@ swagger. Remaining: npm publish (CI release workflow ready; needs NPM_TOKEN + pu
10
10
  first module, with room to grow into a higher-level, full-featured client.
11
11
  **Audience:** players and bots trading on Trinary Exchange via an API key.
12
12
  **Target (MVP):** **testnet only**, the **`stillness`** tenant; **only the most-recent (v1)
13
- `triexbook` contracts** are supported. Item↔currency (CRED) markets via `multicoin_pool`
14
- ("pools"); coin-pools are out of scope for now.
13
+ [CLOB contracts](https://github.com/loash-industries/trinary-exchange)** are supported.
14
+ Item↔currency (CRED) markets via `multicoin_pool` ("pools"); coin-pools are out of scope
15
+ for now.
15
16
  **Models after:** [`@trinaryex/keyspace`](https://www.npmjs.com/package/@trinaryex/keyspace)
16
17
  (client + `executor` pattern, `queries`/`transactions` split, zod validation, vite build,
17
18
  semantic-release).
@@ -20,11 +21,11 @@ semantic-release).
20
21
 
21
22
  ## 1. What this SDK is (and isn't)
22
23
 
23
- Trinary Exchange is a Sui-based, DeepBook-style market for an EVE-Frontier game economy.
24
+ Trinary Exchange is a Sui-based order-book market for an EVE-Frontier game economy.
24
25
  Players trade **items** (multicoin balances, priced in the **CRED** trade currency) and
25
26
  **currency** at **trade hubs** (Smart Storage Units / SSUs) through on-chain order books
26
- (the `triexbook` DeepBook fork), settling through a per-player **balance manager** (the
27
- on-chain trading account).
27
+ (the [Trinary Exchange CLOB Move contracts](https://github.com/loash-industries/trinary-exchange)),
28
+ settling through a per-player **balance manager** (the on-chain trading account).
28
29
 
29
30
  The SDK gives a player/bot one object to:
30
31
 
@@ -110,7 +111,7 @@ on the free/standard tier).
110
111
  │ (fetch + x-api-key + zod validate) │ (Postgres read models)
111
112
  │ │
112
113
  │ transactions.ts ──build PTB──► executor() │───► player's wallet / keypair
113
- │ (pure @mysten/sui Transaction builders) │ └─► Sui network (triexbook)
114
+ │ (pure @mysten/sui Transaction builders) │ └─► Sui network (CLOB contracts)
114
115
  └────────────────────────────────────────────┘
115
116
  ```
116
117
 
@@ -139,7 +140,7 @@ executor: (tx) => signAndExecuteTransaction({ transaction: tx })
139
140
 
140
141
  Executor results are **normalized** (`execute.ts`): both the v2 core-client
141
142
  `TransactionResult` and the legacy `{ digest, objectChanges }` shape work, and on-chain
142
- aborts are rethrown as typed `TransactionFailed` errors with the triexbook abort code
143
+ aborts are rethrown as typed `TransactionFailed` errors with the CLOB abort code
143
144
  translated (§11 of TRIEX_SYSTEM_DESIGN). Include `effects` + `objectTypes` (v2) or
144
145
  `objectChanges` (legacy) so created objects — e.g. a freshly-created `BalanceManager` —
145
146
  are captured for read-your-writes.
@@ -216,7 +217,7 @@ const client = new TriexClient({
216
217
  network: 'testnet', // selects package-id bundle
217
218
  executor: (tx) => signAndExecuteTransaction({ transaction: tx, options: { showObjectChanges: true } }),
218
219
  // packageIds optional — resolved from `network` defaults, overridable:
219
- // packageIds: { triexbook, multicoin, warehouseReceipts, credCoinType, clock: '0x6', ... }
220
+ // packageIds: { triex, multicoin, warehouseReceipts, credCoinType, clock: '0x6', ... }
220
221
  })
221
222
  ```
222
223
 
@@ -279,18 +280,18 @@ pure functions `(args) => Transaction`; the facade fills object IDs from indexer
279
280
 
280
281
  | Builder | Move target | Notes |
281
282
  |---|---|---|
282
- | `newBalanceManager` | `${triexbook}::balance_manager::new()` | returns BM; `transferObjects([bm], self)` when freshly created |
283
- | `depositCoin` | `${triexbook}::balance_manager::deposit<T>(bm, coin)` | coin prepared via list/merge/split of wallet coins |
284
- | `depositMulticoinObject` | `${triexbook}::balance_manager::deposit_multicoin(bm, object)` | deposit an owned multicoin `Balance` object (wallet receipts) into BM |
285
- | `withdrawAllCoin` | `${triexbook}::balance_manager::withdraw_all<T>(bm)` → `transferObjects` | #13 |
286
- | `withdrawAllMulticoin` | `${triexbook}::balance_manager::withdraw_all_multicoin(bm, collectionId, assetId)` | #12 step 1 |
283
+ | `newBalanceManager` | `${triex}::balance_manager::new()` | returns BM; `transferObjects([bm], self)` when freshly created |
284
+ | `depositCoin` | `${triex}::balance_manager::deposit<T>(bm, coin)` | coin prepared via list/merge/split of wallet coins |
285
+ | `depositMulticoinObject` | `${triex}::balance_manager::deposit_multicoin(bm, object)` | deposit an owned multicoin `Balance` object (wallet receipts) into BM |
286
+ | `withdrawAllCoin` | `${triex}::balance_manager::withdraw_all<T>(bm)` → `transferObjects` | #13 |
287
+ | `withdrawAllMulticoin` | `${triex}::balance_manager::withdraw_all_multicoin(bm, collectionId, assetId)` | #12 step 1 |
287
288
  | `redeemReceipt` | `${warehouseReceipts}::receipt::redeem_receipt(balance, ssu, character, vaultConfig, collection, isOwner)` | #12 step 2 (BM item → hangar) |
288
- | `ownerProof` | `${triexbook}::balance_manager::generate_proof_as_owner(bm)` | required before placing/withdrawing |
289
- | `placeLimitOrderItem` | `${triexbook}::multicoin_pool::place_limit_order<Quote>(pool, bm, proof, orderType, selfMatch, price, qty, isBid, expireTs, clock)` | items (multicoin) |
290
- | `placeMarketOrderItem` | `${triexbook}::multicoin_pool::place_market_order<Quote>(pool, bm, proof, selfMatch, qty, isBid, clock)` | items (multicoin) |
291
- | `cancelOrderItem` | `${triexbook}::multicoin_pool::cancel_order<Quote>(pool, bm, proof, orderId u64, clock)` | implemented (+ `cancel_all_orders`, `modify_order`) |
292
- | `withdrawCoin` | `${triexbook}::balance_manager::withdraw<T>(bm, amount)` | partial currency withdraw |
293
- | `withdrawSettledAmounts` | `${triexbook}::multicoin_pool::withdraw_settled_amounts<Quote>(pool, bm, proof)` | claim post-fill proceeds into the BM |
289
+ | `ownerProof` | `${triex}::balance_manager::generate_proof_as_owner(bm)` | required before placing/withdrawing |
290
+ | `placeLimitOrderItem` | `${triex}::multicoin_pool::place_limit_order<Quote>(pool, bm, proof, orderType, selfMatch, price, qty, isBid, expireTs, clock)` | items (multicoin) |
291
+ | `placeMarketOrderItem` | `${triex}::multicoin_pool::place_market_order<Quote>(pool, bm, proof, selfMatch, qty, isBid, clock)` | items (multicoin) |
292
+ | `cancelOrderItem` | `${triex}::multicoin_pool::cancel_order<Quote>(pool, bm, proof, orderId u64, clock)` | implemented (+ `cancel_all_orders`, `modify_order`) |
293
+ | `withdrawCoin` | `${triex}::balance_manager::withdraw<T>(bm, amount)` | partial currency withdraw |
294
+ | `withdrawSettledAmounts` | `${triex}::multicoin_pool::withdraw_settled_amounts<Quote>(pool, bm, proof)` | claim post-fill proceeds into the BM |
294
295
 
295
296
  > `<Quote>` is the CRED coin type (`credCoinType`). Item markets are `multicoin_pool`; the
296
297
  > item is identified by `collectionId` + `assetId` (u64), not a Move type parameter.
@@ -351,8 +352,8 @@ back into the SSU/hangar (needs `ssu`, `character`, `vaultConfig`, `collection`,
351
352
 
352
353
  ## 7. Money math (`money.ts`)
353
354
 
354
- - **Coin (currency-pair) pools:** `quote = base * price / TRIEXBOOK_PRICE_SCALING`
355
- where `TRIEXBOOK_PRICE_SCALING = 1_000_000_000` (1e9).
355
+ - **Coin (currency-pair) pools:** `quote = base * price / TRIEX_PRICE_SCALING`
356
+ where `TRIEX_PRICE_SCALING = 1_000_000_000` (1e9).
356
357
  - **Multicoin (item) pools:** scaling factor `1` → `quote = price * quantity` (confirmed
357
358
  against the production app, which passes the unscaled price straight to
358
359
  `place_limit_order`; TRIEX_SYSTEM_DESIGN §7's blanket "all prices ×1e9" describes coin
package/README.md CHANGED
@@ -1,9 +1,19 @@
1
1
  # @trinaryex/sdk
2
2
 
3
- The trading SDK for **Trinary Exchange** — a Sui-based, DeepBook-style market
4
- for the EVE Frontier game economy. Players and bots read market + account data
5
- through the [Trinary Exchange API](https://api.trinary.exchange) and trade by
6
- signing on-chain transactions with their own wallet or keypair.
3
+ [![npm version](https://img.shields.io/npm/v/%40trinaryex%2Fsdk)](https://www.npmjs.com/package/@trinaryex/sdk)
4
+ [![license: MIT](https://img.shields.io/npm/l/%40trinaryex%2Fsdk)](#license)
5
+
6
+ The official TypeScript trading SDK for
7
+ [**Trinary Exchange**](https://trinary.exchange/), the player-built
8
+ **EVE Frontier marketplace** — a Sui-based order-book market for trading
9
+ items and currency across EVE Frontier trade hubs, built on the
10
+ [Trinary Exchange CLOB Move contracts](https://github.com/loash-industries/trinary-exchange).
11
+ Players and bots read live **EVE Frontier market data** through the
12
+ [Trinary Exchange API](https://docs.trinary.exchange/) and trade by signing
13
+ on-chain transactions with their own wallet or keypair.
14
+
15
+ - 🛰️ Browse the markets: **<https://trinary.exchange/>**
16
+ - 📚 Full API documentation: **<https://docs.trinary.exchange/>**
7
17
 
8
18
  Built for exactly the things you'd want to build on an exchange:
9
19
 
@@ -12,9 +22,10 @@ Built for exactly the things you'd want to build on an exchange:
12
22
  - **CLI tools** — everything is plain async TypeScript with typed errors
13
23
  - **agentic trading** — stable error codes plus human-readable on-chain abort translation
14
24
 
15
- > **Status: pre-release.** Reads and the full write surface (deposits,
16
- > withdrawals, orders, cancels, claims) are implemented and unit-tested
17
- > against the production app's transaction composition. Targets **testnet**
25
+ > **Status: v1.0.0 — released.** The full read and write surface (deposits,
26
+ > withdrawals, orders, cancels, claims) is verified end-to-end against the
27
+ > live gateway and chain: a scripted trading lifecycle with real fills, fees,
28
+ > and settled-proceeds claims, on top of 93 unit tests. Targets **testnet**
18
29
  > (the `stillness` world). See [DESIGN.md](./DESIGN.md).
19
30
 
20
31
  ## Two planes, two auth models
@@ -98,7 +109,7 @@ const feed = await ro.discover({ assetId: '70810', side: 'sell' })
98
109
  ### Market analytics
99
110
 
100
111
  ```ts
101
- import { aggregateLevels, midPrice, spread, vwap, bucketTrades, iterateTrades } from '@trinaryex/sdk'
112
+ import { aggregateLevels, midPrice, spread, vwap, iterateTrades } from '@trinaryex/sdk'
102
113
 
103
114
  const book = await ro.orderbook({ storageUnitId, assetId })
104
115
  console.log('mid', midPrice(book), 'spread', spread(book)?.bps, 'bps')
@@ -109,9 +120,8 @@ const history = []
109
120
  for await (const trade of iterateTrades(ro.indexer, balanceManagerId)) {
110
121
  history.push(trade) // { price, baseQuantity, quoteQuantity, fee, side, tradedAt, … }
111
122
  }
112
- // … and chart it: the API has no price-history endpoint, so build candles
113
- // client-side.
114
- const hourly = bucketTrades(history, 60 * 60 * 1000) // OHLCV Candle[]
123
+ // … and summarize it.
124
+ console.log('lifetime VWAP', vwap(history))
115
125
  ```
116
126
 
117
127
  ### Trading bot loop
@@ -197,7 +207,7 @@ explainMoveAbort(rawError) // "No liquidity available (EEmptyOrderbook)" | null
197
207
  | `balances` | `atHub` (items: warehouse/marketplace/hangar) · `currency` (CRED wallet + BM, fullnode) |
198
208
  | `market` | `discover` · `hub` · `itemsAtHub` · `resolvePool` · `orderbook` · `poolMetadata` |
199
209
  | `orders` | `limit` · `market` · `cancel` · `cancelAll` · `modify` · `openOrders` · `fills` · `trades` |
200
- | helpers | `aggregateLevels` · `midPrice` · `spread` · `depth` · `vwap` · `bucketTrades` (OHLCV) · `estimateMarketBuyCost` · `iterateDiscovery/Fills/Trades` · `untilIndexed` · `explainMoveAbort` · `toBase` / `fromBase` |
210
+ | helpers | `aggregateLevels` · `midPrice` · `spread` · `depth` · `vwap` · `estimateMarketBuyCost` · `iterateDiscovery/Fills/Trades` · `untilIndexed` · `explainMoveAbort` · `toBase` / `fromBase` |
201
211
 
202
212
  Runnable examples live in [`examples/`](./examples).
203
213
 
@@ -226,7 +236,7 @@ slots) from the **fullnode**, head-current. Prefer ids returned from writes
226
236
 
227
237
  ```bash
228
238
  npm install
229
- npm run tscheck && npm test # 70 unit tests
239
+ npm run tscheck && npm test # 93 unit tests
230
240
  npm run build
231
241
 
232
242
  # Live verification (needs .env — see .env.sample):
@@ -234,6 +244,19 @@ node --env-file=.env scripts/smoke.mjs # read surface vs the live gateway
234
244
  node --env-file=.env scripts/integration.mjs # write paths on testnet (uses gas)
235
245
  ```
236
246
 
247
+ ## Links
248
+
249
+ - [Trinary Exchange](https://trinary.exchange/) — the EVE Frontier
250
+ marketplace: live order books, trade hubs, and market data for the EVE
251
+ Frontier economy
252
+ - [API documentation](https://docs.trinary.exchange/) — REST reference,
253
+ guides, and [API keys](https://docs.trinary.exchange/docs/api-keys) for the
254
+ Trinary Exchange trading API
255
+ - [Trinary Exchange CLOB contracts](https://github.com/loash-industries/trinary-exchange)
256
+ — the Sui Move order-book contracts this SDK talks to
257
+ - [`@trinaryex/sdk` on npm](https://www.npmjs.com/package/@trinaryex/sdk)
258
+ - [Design notes](./DESIGN.md) — architecture, scope, and verification history
259
+
237
260
  ## License
238
261
 
239
262
  MIT
package/dist/book.d.ts CHANGED
@@ -14,14 +14,3 @@ export declare function spread(book: Orderbook): {
14
14
  } | null;
15
15
  export declare function depth(orders: OrderbookOrder[]): bigint;
16
16
  export declare function vwap(executions: ReadonlyArray<Pick<Fill | Trade, 'baseQuantity' | 'quoteQuantity'>>): bigint | null;
17
- export interface Candle {
18
- openTime: number;
19
- open: bigint;
20
- high: bigint;
21
- low: bigint;
22
- close: bigint;
23
- baseVolume: bigint;
24
- quoteVolume: bigint;
25
- tradeCount: number;
26
- }
27
- export declare function bucketTrades(trades: ReadonlyArray<Pick<Trade, 'price' | 'baseQuantity' | 'quoteQuantity' | 'tradedAt'>>, intervalMs: number): Candle[];
package/dist/index.d.ts CHANGED
@@ -3,15 +3,15 @@ export type { AccountApi, BalancesApi, MarketApi, OrdersApi, } from './TriexClie
3
3
  export { ReadOnlyClient } from './ReadOnlyClient';
4
4
  export { TriexError, TriexClientError, explainMoveAbort } from './errors';
5
5
  export { DEFAULT_INDEXER_URL, CLOCK_ID, STILLNESS_PACKAGE_IDS, NETWORK_PRESETS, resolvePackageIds, } from './config';
6
- export { toBase, fromBase, computeItemQuote, computeBidQuoteDeposit, estimateMarketBuyCost, marketBuyRoundingBuffer, TRIEXBOOK_PRICE_SCALING, MULTICOIN_PRICE_SCALING, FEE_RATE_SCALING, GTC_EXPIRE, } from './money';
6
+ export { toBase, fromBase, computeItemQuote, computeBidQuoteDeposit, estimateMarketBuyCost, marketBuyRoundingBuffer, TRIEX_PRICE_SCALING, MULTICOIN_PRICE_SCALING, FEE_RATE_SCALING, GTC_EXPIRE, } from './money';
7
7
  export { IndexerClient } from './queries';
8
8
  export * as transactions from './transactions';
9
9
  export { getWalletCurrencyBalance, getBalanceManagerCurrencyBalance, getBalanceManagerItemBalance, getRegistryMulticoinCollectionId, findOwnedItemReceipts, fetchCharacterInfo, fetchSsuOwnerInfo, fetchInventorySlotQuantity, toSsuObjectId, getObjectRef, } from './onchain';
10
10
  export { prepareWalletCoinInput, sourceItemsIntoBalanceManager, } from './funding';
11
11
  export { normalizeExecuteResult, executeAndNormalize, findCreatedObject, } from './execute';
12
12
  export type { NormalizedExecution, CreatedObject } from './execute';
13
- export { aggregateLevels, bestBid, bestAsk, midPrice, spread, depth, vwap, bucketTrades, } from './book';
14
- export type { BookLevel, Candle } from './book';
13
+ export { aggregateLevels, bestBid, bestAsk, midPrice, spread, depth, vwap, } from './book';
14
+ export type { BookLevel } from './book';
15
15
  export { iterateDiscovery, iterateFills, iterateTrades } from './paging';
16
16
  export type { IterateOptions } from './paging';
17
17
  export { untilIndexed } from './wait';
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ var r = Object.defineProperty, i = (e, t) => {
10
10
  });
11
11
  return t || r(n, Symbol.toStringTag, { value: "Module" }), n;
12
12
  }, a = "https://api.trinary.exchange", o = "0x6", s = {
13
- triexbook: "0x291b9da738dffedd18d7c5049e5e6792270202e03f3c9d9db4c7097670bf6eb2",
13
+ triex: "0x291b9da738dffedd18d7c5049e5e6792270202e03f3c9d9db4c7097670bf6eb2",
14
14
  triexRegistry: "0x14a58f254b8243bf3f74c057d81cc310498b3d0fe3781650ad58405d7e5f17e4",
15
15
  multicoin: "0x99a4c039477ac7e7affcb5a5609dd23c29ab69e9436e740d94a4e168c2506cfb",
16
16
  warehouseReceipts: "0x0c9d4414aa12eaa1ebf9d32437c1e6403fbf941ffcdca5b9ca16d1769313417e",
@@ -186,7 +186,7 @@ async function T(e, t, n) {
186
186
  include: { json: !0 }
187
187
  }).catch(() => null))?.object?.json, i = S(te(r?.balances)?.id);
188
188
  if (!i) return 0n;
189
- let a = `${t.triexbook}::balance_manager::BalanceKey<${t.credCoinType}>`, o = await C(e).getDynamicField({
189
+ let a = `${t.triex}::balance_manager::BalanceKey<${t.credCoinType}>`, o = await C(e).getDynamicField({
190
190
  parentId: i,
191
191
  name: {
192
192
  type: a,
@@ -196,7 +196,7 @@ async function T(e, t, n) {
196
196
  return o ? BigInt(ee.parse(o.dynamicField.value.bcs)) : 0n;
197
197
  }
198
198
  async function ie(e, t, n, r, i) {
199
- let a = `${t.triexbook}::balance_manager::MultiCoinBalanceKey`, o = await C(e).getDynamicObjectField({
199
+ let a = `${t.triex}::balance_manager::MultiCoinBalanceKey`, o = await C(e).getDynamicObjectField({
200
200
  parentId: n,
201
201
  name: {
202
202
  type: a,
@@ -215,7 +215,7 @@ async function ie(e, t, n, r, i) {
215
215
  };
216
216
  }
217
217
  async function E(e, n) {
218
- let r = `${n.triexbook}::registry::MultiCoinCollectionKey`, i = await C(e).getDynamicField({
218
+ let r = `${n.triex}::registry::MultiCoinCollectionKey`, i = await C(e).getDynamicField({
219
219
  parentId: n.triexRegistry,
220
220
  name: {
221
221
  type: r,
@@ -335,46 +335,46 @@ var ae = /* @__PURE__ */ i({
335
335
  });
336
336
  function j(e, t) {
337
337
  return e.moveCall({
338
- target: `${t.triexbook}::balance_manager::new`,
338
+ target: `${t.triex}::balance_manager::new`,
339
339
  arguments: []
340
340
  });
341
341
  }
342
342
  function M(e, t, n) {
343
343
  return e.moveCall({
344
- target: `${t.triexbook}::balance_manager::generate_proof_as_owner`,
344
+ target: `${t.triex}::balance_manager::generate_proof_as_owner`,
345
345
  arguments: [n]
346
346
  });
347
347
  }
348
348
  function N(e, t, n, r, i = t.credCoinType) {
349
349
  e.moveCall({
350
- target: `${t.triexbook}::balance_manager::deposit`,
350
+ target: `${t.triex}::balance_manager::deposit`,
351
351
  typeArguments: [i],
352
352
  arguments: [n, r]
353
353
  });
354
354
  }
355
355
  function oe(e, t, n, r) {
356
356
  e.moveCall({
357
- target: `${t.triexbook}::balance_manager::deposit_multicoin`,
357
+ target: `${t.triex}::balance_manager::deposit_multicoin`,
358
358
  arguments: [n, e.object(r)]
359
359
  });
360
360
  }
361
361
  function se(e, t, n, r, i = t.credCoinType) {
362
362
  return e.moveCall({
363
- target: `${t.triexbook}::balance_manager::withdraw`,
363
+ target: `${t.triex}::balance_manager::withdraw`,
364
364
  typeArguments: [i],
365
365
  arguments: [n, e.pure.u64(r)]
366
366
  });
367
367
  }
368
368
  function ce(e, t, n, r = t.credCoinType) {
369
369
  return e.moveCall({
370
- target: `${t.triexbook}::balance_manager::withdraw_all`,
370
+ target: `${t.triex}::balance_manager::withdraw_all`,
371
371
  typeArguments: [r],
372
372
  arguments: [n]
373
373
  });
374
374
  }
375
375
  function le(e, t, n, r, i) {
376
376
  return e.moveCall({
377
- target: `${t.triexbook}::balance_manager::withdraw_all_multicoin`,
377
+ target: `${t.triex}::balance_manager::withdraw_all_multicoin`,
378
378
  arguments: [
379
379
  n,
380
380
  e.pure.id(r),
@@ -422,13 +422,13 @@ function P(e, t, n, r) {
422
422
  s
423
423
  ]
424
424
  }), e.moveCall({
425
- target: `${t.triexbook}::balance_manager::deposit_multicoin`,
425
+ target: `${t.triex}::balance_manager::deposit_multicoin`,
426
426
  arguments: [n, c]
427
427
  });
428
428
  }
429
429
  function F(e, t, n) {
430
430
  e.moveCall({
431
- target: `${t.triexbook}::multicoin_pool::place_limit_order`,
431
+ target: `${t.triex}::multicoin_pool::place_limit_order`,
432
432
  typeArguments: [t.credCoinType],
433
433
  arguments: [
434
434
  e.object(n.poolId),
@@ -446,7 +446,7 @@ function F(e, t, n) {
446
446
  }
447
447
  function I(e, t, n) {
448
448
  e.moveCall({
449
- target: `${t.triexbook}::multicoin_pool::place_market_order`,
449
+ target: `${t.triex}::multicoin_pool::place_market_order`,
450
450
  typeArguments: [t.credCoinType],
451
451
  arguments: [
452
452
  e.object(n.poolId),
@@ -461,7 +461,7 @@ function I(e, t, n) {
461
461
  }
462
462
  function L(e, t, n) {
463
463
  e.moveCall({
464
- target: `${t.triexbook}::multicoin_pool::cancel_order`,
464
+ target: `${t.triex}::multicoin_pool::cancel_order`,
465
465
  typeArguments: [t.credCoinType],
466
466
  arguments: [
467
467
  e.object(n.poolId),
@@ -474,7 +474,7 @@ function L(e, t, n) {
474
474
  }
475
475
  function R(e, t, n) {
476
476
  e.moveCall({
477
- target: `${t.triexbook}::multicoin_pool::cancel_all_orders`,
477
+ target: `${t.triex}::multicoin_pool::cancel_all_orders`,
478
478
  typeArguments: [t.credCoinType],
479
479
  arguments: [
480
480
  e.object(n.poolId),
@@ -486,7 +486,7 @@ function R(e, t, n) {
486
486
  }
487
487
  function z(e, t, n) {
488
488
  e.moveCall({
489
- target: `${t.triexbook}::multicoin_pool::modify_order`,
489
+ target: `${t.triex}::multicoin_pool::modify_order`,
490
490
  typeArguments: [t.credCoinType],
491
491
  arguments: [
492
492
  e.object(n.poolId),
@@ -500,7 +500,7 @@ function z(e, t, n) {
500
500
  }
501
501
  function B(e, t, n) {
502
502
  e.moveCall({
503
- target: `${t.triexbook}::multicoin_pool::withdraw_settled_amounts`,
503
+ target: `${t.triex}::multicoin_pool::withdraw_settled_amounts`,
504
504
  typeArguments: [n.quoteCoinType ?? t.credCoinType],
505
505
  arguments: [
506
506
  e.object(n.poolId),
@@ -1099,7 +1099,7 @@ var X = class {
1099
1099
  }
1100
1100
  async resolveBalanceManagerId(e) {
1101
1101
  if (this.cachedBalanceManagerId) return this.cachedBalanceManagerId;
1102
- let t = `${this.ids.triexbook}::balance_manager::BalanceManager`, n = (await this.suiClient.core.listOwnedObjects({
1102
+ let t = `${this.ids.triex}::balance_manager::BalanceManager`, n = (await this.suiClient.core.listOwnedObjects({
1103
1103
  owner: e,
1104
1104
  type: t,
1105
1105
  limit: 1
@@ -1537,27 +1537,9 @@ function Xe(e) {
1537
1537
  for (let r of e) t += r.baseQuantity, n += r.quoteQuantity;
1538
1538
  return t === 0n ? null : n / t;
1539
1539
  }
1540
- function Ze(e, t) {
1541
- if (t <= 0) throw Error("intervalMs must be positive");
1542
- let n = [...e].sort((e, t) => e.tradedAt - t.tradedAt), r = [];
1543
- for (let e of n) {
1544
- let n = Math.floor(e.tradedAt / t) * t, i = r[r.length - 1];
1545
- i && i.openTime === n ? (e.price > i.high && (i.high = e.price), e.price < i.low && (i.low = e.price), i.close = e.price, i.baseVolume += e.baseQuantity, i.quoteVolume += e.quoteQuantity, i.tradeCount++) : r.push({
1546
- openTime: n,
1547
- open: e.price,
1548
- high: e.price,
1549
- low: e.price,
1550
- close: e.price,
1551
- baseVolume: e.baseQuantity,
1552
- quoteVolume: e.quoteQuantity,
1553
- tradeCount: 1
1554
- });
1555
- }
1556
- return r;
1557
- }
1558
1540
  //#endregion
1559
1541
  //#region src/paging.ts
1560
- async function* Qe(e, t, n) {
1542
+ async function* Ze(e, t, n) {
1561
1543
  let r = n?.maxItems ?? 1e4, i = t?.cursor, a = 0;
1562
1544
  for (;;) {
1563
1545
  let n = await e.discovery({
@@ -1569,7 +1551,7 @@ async function* Qe(e, t, n) {
1569
1551
  i = n.nextCursor;
1570
1552
  }
1571
1553
  }
1572
- async function* $e(e, t, n, r) {
1554
+ async function* Qe(e, t, n, r) {
1573
1555
  let i = r?.maxItems ?? 1e4, a = n?.before, o = 0;
1574
1556
  for (;;) {
1575
1557
  let r = await e.fills(t, {
@@ -1581,7 +1563,7 @@ async function* $e(e, t, n, r) {
1581
1563
  a = r.fills[r.fills.length - 1].filledAt;
1582
1564
  }
1583
1565
  }
1584
- async function* et(e, t, n, r) {
1566
+ async function* $e(e, t, n, r) {
1585
1567
  let i = r?.maxItems ?? 1e4, a = n?.before, o = 0;
1586
1568
  for (;;) {
1587
1569
  let r = await e.trades(t, {
@@ -1595,7 +1577,7 @@ async function* et(e, t, n, r) {
1595
1577
  }
1596
1578
  //#endregion
1597
1579
  //#region src/wait.ts
1598
- async function tt(e, t) {
1580
+ async function et(e, t) {
1599
1581
  let n = t?.timeoutMs ?? 3e4, r = t?.intervalMs ?? 2e3, i = Date.now() + n;
1600
1582
  for (;;) {
1601
1583
  let a = await e();
@@ -1605,4 +1587,4 @@ async function tt(e, t) {
1605
1587
  }
1606
1588
  }
1607
1589
  //#endregion
1608
- export { o as CLOCK_ID, a as DEFAULT_INDEXER_URL, W as FEE_RATE_SCALING, fe as GTC_EXPIRE, X as IndexerClient, U as MULTICOIN_PRICE_SCALING, c as NETWORK_PRESETS, Ge as ReadOnlyClient, s as STILLNESS_PACKAGE_IDS, de as TRIEXBOOK_PRICE_SCALING, ze as TriexClient, d as TriexClientError, u as TriexError, Ke as aggregateLevels, $ as bestAsk, Q as bestBid, Ze as bucketTrades, K as computeBidQuoteDeposit, G as computeItemQuote, Ye as depth, ge as estimateMarketBuyCost, m as executeAndNormalize, p as explainMoveAbort, O as fetchCharacterInfo, A as fetchInventorySlotQuantity, k as fetchSsuOwnerInfo, g as findCreatedObject, D as findOwnedItemReceipts, me as fromBase, T as getBalanceManagerCurrencyBalance, ie as getBalanceManagerItemBalance, ne as getObjectRef, E as getRegistryMulticoinCollectionId, re as getWalletCurrencyBalance, Qe as iterateDiscovery, $e as iterateFills, et as iterateTrades, he as marketBuyRoundingBuffer, qe as midPrice, h as normalizeExecuteResult, V as prepareWalletCoinInput, l as resolvePackageIds, H as sourceItemsIntoBalanceManager, Je as spread, pe as toBase, w as toSsuObjectId, ae as transactions, tt as untilIndexed, Xe as vwap };
1590
+ export { o as CLOCK_ID, a as DEFAULT_INDEXER_URL, W as FEE_RATE_SCALING, fe as GTC_EXPIRE, X as IndexerClient, U as MULTICOIN_PRICE_SCALING, c as NETWORK_PRESETS, Ge as ReadOnlyClient, s as STILLNESS_PACKAGE_IDS, de as TRIEX_PRICE_SCALING, ze as TriexClient, d as TriexClientError, u as TriexError, Ke as aggregateLevels, $ as bestAsk, Q as bestBid, K as computeBidQuoteDeposit, G as computeItemQuote, Ye as depth, ge as estimateMarketBuyCost, m as executeAndNormalize, p as explainMoveAbort, O as fetchCharacterInfo, A as fetchInventorySlotQuantity, k as fetchSsuOwnerInfo, g as findCreatedObject, D as findOwnedItemReceipts, me as fromBase, T as getBalanceManagerCurrencyBalance, ie as getBalanceManagerItemBalance, ne as getObjectRef, E as getRegistryMulticoinCollectionId, re as getWalletCurrencyBalance, Ze as iterateDiscovery, Qe as iterateFills, $e as iterateTrades, he as marketBuyRoundingBuffer, qe as midPrice, h as normalizeExecuteResult, V as prepareWalletCoinInput, l as resolvePackageIds, H as sourceItemsIntoBalanceManager, Je as spread, pe as toBase, w as toSsuObjectId, ae as transactions, et as untilIndexed, Xe as vwap };
package/dist/money.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const TRIEXBOOK_PRICE_SCALING = 1000000000n;
1
+ export declare const TRIEX_PRICE_SCALING = 1000000000n;
2
2
  export declare const MULTICOIN_PRICE_SCALING = 1n;
3
3
  export declare const FEE_RATE_SCALING = 1000000000n;
4
4
  export declare const GTC_EXPIRE = 18446744073709551615n;
package/dist/types.d.ts CHANGED
@@ -19,7 +19,7 @@ export interface TxResult {
19
19
  }
20
20
  export type TriexNetwork = 'testnet';
21
21
  export interface PackageIds {
22
- triexbook: string;
22
+ triex: string;
23
23
  triexRegistry: string;
24
24
  multicoin: string;
25
25
  warehouseReceipts: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trinaryex/sdk",
3
- "version": "1.0.0",
3
+ "version": "3.0.0",
4
4
  "description": "Trading SDK for Trinary Exchange — market data, order books, and on-chain trading (Sui) for bots, analytics tools, and CLIs.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -98,7 +98,13 @@
98
98
  "sui",
99
99
  "orderbook",
100
100
  "eve-frontier",
101
- "deepbook"
101
+ "eve-frontier-trading",
102
+ "eve-frontier-market",
103
+ "eve-frontier-marketplace",
104
+ "marketplace",
105
+ "market-data",
106
+ "trading-bot",
107
+ "clob"
102
108
  ],
103
109
  "sideEffects": false,
104
110
  "repository": {