@trinaryex/sdk 3.0.0 → 3.1.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.
@@ -1,5 +1,5 @@
1
1
  import { IndexerClient } from './queries';
2
- import { BalancesAtHubParams, DiscoveryFilters, DiscoveryResult, FillsPage, FillsParams, HistoryPageParams, HubItemsPage, InventoryBalances, OpenOrdersPage, Orderbook, PackageIds, PoolMetadata, ReadOnlyClientConfig, Sweepable, TradeHubDetail, TradesPage, TradesParams } from './types';
2
+ import { BalancesAtHubParams, DiscoveryFilters, DiscoveryResult, FillsPage, FillsParams, HistoryPageParams, HubItemOrderbook, HubItemsPage, InventoryBalances, OpenOrdersPage, PackageIds, PoolMetadata, ReadOnlyClientConfig, Sweepable, TradeHubDetail, TradesPage, TradesParams } from './types';
3
3
  export declare class ReadOnlyClient {
4
4
  readonly ids: PackageIds;
5
5
  readonly indexer: IndexerClient;
@@ -14,7 +14,7 @@ export declare class ReadOnlyClient {
14
14
  orderbook(params: {
15
15
  storageUnitId: string;
16
16
  assetId: string;
17
- }): Promise<Orderbook>;
17
+ }): Promise<HubItemOrderbook>;
18
18
  poolMetadata(poolId: string): Promise<PoolMetadata>;
19
19
  balancesAtHub(params: BalancesAtHubParams & {
20
20
  balanceManagerId?: string;
@@ -1,7 +1,7 @@
1
1
  import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
2
2
  import { ClientWithCoreApi } from '@mysten/sui/client';
3
3
  import { IndexerClient } from './queries';
4
- import { BalancesAtHubParams, CancelAllOrdersParams, CancelOrderParams, ClaimSettledParams, CurrencyBalances, DepositCurrencyParams, DepositItemsParams, DiscoveryFilters, DiscoveryResult, EnsureAccountResult, FillsPage, FillsParams, HistoryPageParams, HubItemsPage, InventoryBalances, LimitOrderParams, MarketOrderParams, ModifyOrderParams, OpenOrdersPage, Orderbook, PackageIds, PoolMetadata, Sweepable, TradeHubDetail, TradesPage, TradesParams, TradingAccount, TransactionExecutor, TriexClientConfig, TxResult, WithdrawCurrencyParams, WithdrawItemsParams } from './types';
4
+ import { BalancesAtHubParams, CancelAllOrdersParams, CancelOrderParams, ClaimSettledParams, CurrencyBalances, DepositCurrencyParams, DepositItemsParams, DiscoveryFilters, DiscoveryResult, EnsureAccountResult, FillsPage, FillsParams, HistoryPageParams, HubItemOrderbook, HubItemsPage, InventoryBalances, LimitOrderParams, MarketOrderParams, ModifyOrderParams, OpenOrdersPage, PackageIds, PoolMetadata, Sweepable, TradeHubDetail, TradesPage, TradesParams, TradingAccount, TransactionExecutor, TriexClientConfig, TxResult, WithdrawCurrencyParams, WithdrawItemsParams } from './types';
5
5
  export declare class TriexClient {
6
6
  readonly suiClient: ClientWithCoreApi;
7
7
  readonly ids: PackageIds;
@@ -59,7 +59,7 @@ declare class MarketApi {
59
59
  orderbook(params: {
60
60
  storageUnitId: string;
61
61
  assetId: string;
62
- }): Promise<Orderbook>;
62
+ }): Promise<HubItemOrderbook>;
63
63
  poolMetadata(poolId: string): Promise<PoolMetadata>;
64
64
  }
65
65
  declare class OrdersApi {
package/dist/index.d.ts CHANGED
@@ -15,5 +15,5 @@ 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';
18
- export type { TriexNetwork, PackageIds, TriexClientConfig, ReadOnlyClientConfig, TransactionExecutor, ObjectChange, TxResult, OrderSide, TradingAccount, CurrencyBalances, AssetBalance, InventoryBalances, TradeHubDetail, HubVaultInfo, HubLocation, HubItem, HubItemsPage, CollectionHub, Orderbook, OrderbookOrder, PoolMetadata, DiscoveryOrder, DiscoveryResult, DiscoveryFilters, OpenOrder, OpenOrdersPage, Fill, FillsPage, Trade, TradesPage, BalancesAtHubParams, HistoryPageParams, FillsParams, TradesParams, Sweepable, SweepablePool, SweepableItem, EnsureAccountResult, DepositCurrencyParams, DepositItemsParams, WithdrawCurrencyParams, WithdrawItemsParams, LimitOrderParams, MarketOrderParams, CancelOrderParams, CancelAllOrdersParams, ModifyOrderParams, ClaimSettledParams, } from './types';
18
+ export type { TriexNetwork, PackageIds, TriexClientConfig, ReadOnlyClientConfig, TransactionExecutor, ObjectChange, TxResult, OrderSide, TradingAccount, CurrencyBalances, AssetBalance, InventoryBalances, TradeHubDetail, HubVaultInfo, HubLocation, HubItem, HubItemsPage, CollectionHub, Orderbook, HubItemOrderbook, HubItemMarket, OrderbookOrder, PoolMetadata, DiscoveryOrder, DiscoveryResult, DiscoveryFilters, OpenOrder, OpenOrdersPage, Fill, FillsPage, Trade, TradesPage, BalancesAtHubParams, HistoryPageParams, FillsParams, TradesParams, Sweepable, SweepablePool, SweepableItem, EnsureAccountResult, DepositCurrencyParams, DepositItemsParams, WithdrawCurrencyParams, WithdrawItemsParams, LimitOrderParams, MarketOrderParams, CancelOrderParams, CancelAllOrdersParams, ModifyOrderParams, ClaimSettledParams, } from './types';
19
19
  export type { OwnedItemReceipt, CharacterInfo, SsuOwnerInfo, ObjectRef, } from './onchain';
package/dist/index.js CHANGED
@@ -214,7 +214,7 @@ async function ie(e, t, n, r, i) {
214
214
  balance: BigInt(s.amount)
215
215
  };
216
216
  }
217
- async function E(e, n) {
217
+ async function ae(e, n) {
218
218
  let r = `${n.triex}::registry::MultiCoinCollectionKey`, i = await C(e).getDynamicField({
219
219
  parentId: n.triexRegistry,
220
220
  name: {
@@ -225,7 +225,7 @@ async function E(e, n) {
225
225
  if (!i) throw Error("Registry MultiCoin collection id not found (registry not initialized?).");
226
226
  return t.Address.parse(i.dynamicField.value.bcs);
227
227
  }
228
- async function D(e, t, n, r) {
228
+ async function E(e, t, n, r) {
229
229
  let i = `${t.multicoin}::multicoin::Balance`, a = [], o;
230
230
  for (let t = 0; t < 40; t++) {
231
231
  let t = await C(e).listOwnedObjects({
@@ -250,7 +250,7 @@ async function D(e, t, n, r) {
250
250
  }
251
251
  return a;
252
252
  }
253
- async function O(e, t, n) {
253
+ async function D(e, t, n) {
254
254
  let r = [t.worldOriginal];
255
255
  t.world !== t.worldOriginal && r.push(t.world);
256
256
  for (let t of r) {
@@ -272,7 +272,7 @@ async function O(e, t, n) {
272
272
  }
273
273
  return null;
274
274
  }
275
- async function k(e, t, n) {
275
+ async function O(e, t, n) {
276
276
  let r = (await C(e).getObject({
277
277
  objectId: t,
278
278
  include: { json: !0 }
@@ -298,7 +298,7 @@ async function k(e, t, n) {
298
298
  charOwnerCapId: s
299
299
  } : null;
300
300
  }
301
- async function A(e, n, r, i) {
301
+ async function k(e, n, r, i) {
302
302
  let a = await C(e).getDynamicField({
303
303
  parentId: n,
304
304
  name: {
@@ -316,63 +316,63 @@ async function A(e, n, r, i) {
316
316
  }
317
317
  //#endregion
318
318
  //#region src/transactions.ts
319
- var ae = /* @__PURE__ */ i({
320
- cancelAllOrdersItem: () => R,
321
- cancelOrderItem: () => L,
322
- depositCoin: () => N,
323
- depositMulticoinObject: () => oe,
324
- generateProofAsOwner: () => M,
325
- modifyOrderItem: () => z,
326
- newBalanceManager: () => j,
327
- placeLimitOrderItem: () => F,
328
- placeMarketOrderItem: () => I,
329
- redeemReceipt: () => ue,
330
- sourceItemsFromHangar: () => P,
331
- withdrawAllCoin: () => ce,
332
- withdrawAllMulticoin: () => le,
333
- withdrawCoin: () => se,
334
- withdrawSettledAmounts: () => B
319
+ var oe = /* @__PURE__ */ i({
320
+ cancelAllOrdersItem: () => L,
321
+ cancelOrderItem: () => I,
322
+ depositCoin: () => M,
323
+ depositMulticoinObject: () => se,
324
+ generateProofAsOwner: () => j,
325
+ modifyOrderItem: () => R,
326
+ newBalanceManager: () => A,
327
+ placeLimitOrderItem: () => P,
328
+ placeMarketOrderItem: () => F,
329
+ redeemReceipt: () => de,
330
+ sourceItemsFromHangar: () => N,
331
+ withdrawAllCoin: () => le,
332
+ withdrawAllMulticoin: () => ue,
333
+ withdrawCoin: () => ce,
334
+ withdrawSettledAmounts: () => z
335
335
  });
336
- function j(e, t) {
336
+ function A(e, t) {
337
337
  return e.moveCall({
338
338
  target: `${t.triex}::balance_manager::new`,
339
339
  arguments: []
340
340
  });
341
341
  }
342
- function M(e, t, n) {
342
+ function j(e, t, n) {
343
343
  return e.moveCall({
344
344
  target: `${t.triex}::balance_manager::generate_proof_as_owner`,
345
345
  arguments: [n]
346
346
  });
347
347
  }
348
- function N(e, t, n, r, i = t.credCoinType) {
348
+ function M(e, t, n, r, i = t.credCoinType) {
349
349
  e.moveCall({
350
350
  target: `${t.triex}::balance_manager::deposit`,
351
351
  typeArguments: [i],
352
352
  arguments: [n, r]
353
353
  });
354
354
  }
355
- function oe(e, t, n, r) {
355
+ function se(e, t, n, r) {
356
356
  e.moveCall({
357
357
  target: `${t.triex}::balance_manager::deposit_multicoin`,
358
358
  arguments: [n, e.object(r)]
359
359
  });
360
360
  }
361
- function se(e, t, n, r, i = t.credCoinType) {
361
+ function ce(e, t, n, r, i = t.credCoinType) {
362
362
  return e.moveCall({
363
363
  target: `${t.triex}::balance_manager::withdraw`,
364
364
  typeArguments: [i],
365
365
  arguments: [n, e.pure.u64(r)]
366
366
  });
367
367
  }
368
- function ce(e, t, n, r = t.credCoinType) {
368
+ function le(e, t, n, r = t.credCoinType) {
369
369
  return e.moveCall({
370
370
  target: `${t.triex}::balance_manager::withdraw_all`,
371
371
  typeArguments: [r],
372
372
  arguments: [n]
373
373
  });
374
374
  }
375
- function le(e, t, n, r, i) {
375
+ function ue(e, t, n, r, i) {
376
376
  return e.moveCall({
377
377
  target: `${t.triex}::balance_manager::withdraw_all_multicoin`,
378
378
  arguments: [
@@ -382,7 +382,7 @@ function le(e, t, n, r, i) {
382
382
  ]
383
383
  });
384
384
  }
385
- function ue(e, t, n, r) {
385
+ function de(e, t, n, r) {
386
386
  e.moveCall({
387
387
  target: `${t.warehouseReceipts}::receipt::redeem_receipt`,
388
388
  arguments: [
@@ -395,7 +395,7 @@ function ue(e, t, n, r) {
395
395
  ]
396
396
  });
397
397
  }
398
- function P(e, t, n, r) {
398
+ function N(e, t, n, r) {
399
399
  let i = e.object(r.characterId), a = e.moveCall({
400
400
  target: `${t.world}::character::borrow_owner_cap`,
401
401
  typeArguments: [r.capTypeArg],
@@ -426,7 +426,7 @@ function P(e, t, n, r) {
426
426
  arguments: [n, c]
427
427
  });
428
428
  }
429
- function F(e, t, n) {
429
+ function P(e, t, n) {
430
430
  e.moveCall({
431
431
  target: `${t.triex}::multicoin_pool::place_limit_order`,
432
432
  typeArguments: [t.credCoinType],
@@ -444,7 +444,7 @@ function F(e, t, n) {
444
444
  ]
445
445
  });
446
446
  }
447
- function I(e, t, n) {
447
+ function F(e, t, n) {
448
448
  e.moveCall({
449
449
  target: `${t.triex}::multicoin_pool::place_market_order`,
450
450
  typeArguments: [t.credCoinType],
@@ -459,7 +459,7 @@ function I(e, t, n) {
459
459
  ]
460
460
  });
461
461
  }
462
- function L(e, t, n) {
462
+ function I(e, t, n) {
463
463
  e.moveCall({
464
464
  target: `${t.triex}::multicoin_pool::cancel_order`,
465
465
  typeArguments: [t.credCoinType],
@@ -472,7 +472,7 @@ function L(e, t, n) {
472
472
  ]
473
473
  });
474
474
  }
475
- function R(e, t, n) {
475
+ function L(e, t, n) {
476
476
  e.moveCall({
477
477
  target: `${t.triex}::multicoin_pool::cancel_all_orders`,
478
478
  typeArguments: [t.credCoinType],
@@ -484,7 +484,7 @@ function R(e, t, n) {
484
484
  ]
485
485
  });
486
486
  }
487
- function z(e, t, n) {
487
+ function R(e, t, n) {
488
488
  e.moveCall({
489
489
  target: `${t.triex}::multicoin_pool::modify_order`,
490
490
  typeArguments: [t.credCoinType],
@@ -498,7 +498,7 @@ function z(e, t, n) {
498
498
  ]
499
499
  });
500
500
  }
501
- function B(e, t, n) {
501
+ function z(e, t, n) {
502
502
  e.moveCall({
503
503
  target: `${t.triex}::multicoin_pool::withdraw_settled_amounts`,
504
504
  typeArguments: [n.quoteCoinType ?? t.credCoinType],
@@ -511,7 +511,7 @@ function B(e, t, n) {
511
511
  }
512
512
  //#endregion
513
513
  //#region src/funding.ts
514
- async function V(e, t, n, r, i, a = "Insufficient wallet balance to fund this transaction.") {
514
+ async function B(e, t, n, r, i, a = "Insufficient wallet balance to fund this transaction.") {
515
515
  let o = e.core, s = [], c = 0n, l;
516
516
  for (let e = 0; e < 40 && c < i; e++) {
517
517
  let e = await o.listCoins({
@@ -533,7 +533,7 @@ async function V(e, t, n, r, i, a = "Insufficient wallet balance to fund this tr
533
533
  let [p] = t.splitCoins(f, [t.pure.u64(i)]);
534
534
  return p;
535
535
  }
536
- async function H(e, t, n, r, i) {
536
+ async function V(e, t, n, r, i) {
537
537
  let { assetId: a, amount: o } = i;
538
538
  if (o <= 0n) throw new d(u.ValidationFailed, "Item amount must be positive.");
539
539
  let s = i.deficitMode && i.balanceManagerId ? await ie(e, n, i.balanceManagerId, i.vaultCollectionId, a) : {
@@ -541,15 +541,15 @@ async function H(e, t, n, r, i) {
541
541
  balance: 0n
542
542
  }, c = i.deficitMode ? o - s.balance : o;
543
543
  if (c <= 0n) return;
544
- let l = await D(e, n, i.owner, { assetId: a.toString() }), f = (i.vaultCollectionId || await E(e, n)).trim().toLowerCase(), p = l.filter((e) => e.amount > 0n && (!e.collectionId || e.collectionId.toLowerCase() === f)).sort((e, t) => e.amount > t.amount ? -1 : 1), m = 0n;
544
+ let l = await E(e, n, i.owner, { assetId: a.toString() }), f = (i.vaultCollectionId || await ae(e, n)).trim().toLowerCase(), p = l.filter((e) => e.amount > 0n && (!e.collectionId || e.collectionId.toLowerCase() === f)).sort((e, t) => e.amount > t.amount ? -1 : 1), m = 0n;
545
545
  for (let e of p) {
546
546
  if (m >= c) break;
547
- oe(t, n, r, e.objectId), m += e.amount;
547
+ se(t, n, r, e.objectId), m += e.amount;
548
548
  }
549
549
  if (c -= m, c <= 0n) return;
550
- let [h, g] = await Promise.all([k(e, i.ssuObjectId, i.owner), O(e, n, i.owner)]), _ = async (o, s, c, l) => {
550
+ let [h, g] = await Promise.all([O(e, i.ssuObjectId, i.owner), D(e, n, i.owner)]), _ = async (o, s, c, l) => {
551
551
  let u = await ne(e, o);
552
- P(t, n, r, {
552
+ N(t, n, r, {
553
553
  ssuObjectId: i.ssuObjectId,
554
554
  characterId: c,
555
555
  capRef: u,
@@ -561,13 +561,13 @@ async function H(e, t, n, r, i) {
561
561
  });
562
562
  }, v = `${n.worldOriginal}::storage_unit::StorageUnit`, y = `${n.worldOriginal}::character::Character`;
563
563
  if (h) {
564
- let [t, n] = await Promise.all([A(e, i.ssuObjectId, h.ssuOwnerCapId, a.toString()), A(e, i.ssuObjectId, h.charOwnerCapId, a.toString())]), r = t >= c ? c : t, o = c - r, s = o <= n ? o : n;
564
+ let [t, n] = await Promise.all([k(e, i.ssuObjectId, h.ssuOwnerCapId, a.toString()), k(e, i.ssuObjectId, h.charOwnerCapId, a.toString())]), r = t >= c ? c : t, o = c - r, s = o <= n ? o : n;
565
565
  if (r + s < c) throw new d(u.InsufficientBalance, `Insufficient items in the hub inventory (SSU slot: ${t}, character slot: ${n}, needed: ${c}).`);
566
566
  r > 0n && await _(h.ssuOwnerCapId, v, h.characterId, r), s > 0n && await _(h.charOwnerCapId, y, h.characterId, s);
567
567
  return;
568
568
  }
569
569
  if (g) {
570
- let t = await A(e, i.ssuObjectId, g.ownerCapId, a.toString());
570
+ let t = await k(e, i.ssuObjectId, g.ownerCapId, a.toString());
571
571
  if (t < c) throw new d(u.InsufficientBalance, `Insufficient items (need ${o}, BM holds ${s.balance}, wallet receipts cover ${m}, hangar slot holds ${t}).`);
572
572
  await _(g.ownerCapId, y, g.characterId, c);
573
573
  return;
@@ -581,34 +581,34 @@ async function H(e, t, n, r, i) {
581
581
  }
582
582
  //#endregion
583
583
  //#region src/money.ts
584
- var de = 1000000000n, U = 1n, W = 1000000000n, fe = 18446744073709551615n;
585
- function pe(e, t) {
584
+ var fe = 1000000000n, H = 1n, U = 1000000000n, pe = 18446744073709551615n;
585
+ function me(e, t) {
586
586
  let n = typeof e == "number" ? e.toString() : e.trim();
587
587
  if (!/^\d+(\.\d+)?$/.test(n)) throw Error(`toBase: invalid amount "${e}"`);
588
588
  let [r, i = ""] = n.split("."), a = (i + "0".repeat(t)).slice(0, t);
589
589
  return BigInt(r) * 10n ** BigInt(t) + BigInt(a || "0");
590
590
  }
591
- function me(e, t) {
591
+ function he(e, t) {
592
592
  let n = e < 0n, r = n ? -e : e, i = 10n ** BigInt(t), a = r / i, o = (r % i).toString().padStart(t, "0").replace(/0+$/, ""), s = n ? "-" : "";
593
593
  return o ? `${s}${a}.${o}` : `${s}${a}`;
594
594
  }
595
- function G(e, t) {
596
- return e * t * U / 1n;
595
+ function W(e, t) {
596
+ return e * t * H / 1n;
597
597
  }
598
- function K(e, t, n) {
599
- return G(e, t) * (W + n) / W;
598
+ function G(e, t, n) {
599
+ return W(e, t) * (U + n) / U;
600
600
  }
601
- function he(e, t) {
602
- return e * t / W + 2n;
601
+ function ge(e, t) {
602
+ return e * t / U + 2n;
603
603
  }
604
- function ge(e, t, n) {
604
+ function _e(e, t, n) {
605
605
  let r = t, i = 0n;
606
606
  for (let t of e) {
607
607
  if (r <= 0n) break;
608
608
  let e = t.remainingQuantity < r ? t.remainingQuantity : r;
609
609
  i += e * t.price, r -= e;
610
610
  }
611
- let a = i * n / W;
611
+ let a = i * n / U;
612
612
  return {
613
613
  quote: i,
614
614
  fee: a,
@@ -618,7 +618,7 @@ function ge(e, t, n) {
618
618
  }
619
619
  //#endregion
620
620
  //#region src/schemas.ts
621
- var q = n.union([n.string(), n.number()]).transform((e, t) => {
621
+ var K = n.union([n.string(), n.number()]).transform((e, t) => {
622
622
  try {
623
623
  return BigInt(e);
624
624
  } catch {
@@ -627,14 +627,14 @@ var q = n.union([n.string(), n.number()]).transform((e, t) => {
627
627
  message: `not an integer: ${e}`
628
628
  }), n.NEVER;
629
629
  }
630
- }), _e = n.object({
630
+ }), ve = n.object({
631
631
  pool_id: n.string(),
632
632
  order_id: n.string(),
633
- price: q,
633
+ price: K,
634
634
  is_bid: n.boolean(),
635
635
  balance_manager_id: n.string(),
636
- remaining_quantity: q,
637
- filled_quantity: q,
636
+ remaining_quantity: K,
637
+ filled_quantity: K,
638
638
  expires_at: n.number().nullable(),
639
639
  last_activity_at: n.number(),
640
640
  asset_id: n.string(),
@@ -667,22 +667,22 @@ var q = n.union([n.string(), n.number()]).transform((e, t) => {
667
667
  quoteAssetDecimals: e.quote_asset_decimals,
668
668
  traderAddress: e.trader_address,
669
669
  traderName: e.trader_name
670
- })), ve = n.object({
671
- data: n.array(_e),
670
+ })), ye = n.object({
671
+ data: n.array(ve),
672
672
  next_cursor: n.string().nullable(),
673
673
  prev_cursor: n.string().nullable()
674
674
  }).transform((e) => ({
675
675
  orders: e.data,
676
676
  nextCursor: e.next_cursor,
677
677
  prevCursor: e.prev_cursor
678
- })), ye = n.object({ pool_id: n.string().nullable() }).transform((e) => ({ poolId: e.pool_id })), be = n.object({
678
+ })), be = n.object({ pool_id: n.string().nullable() }).transform((e) => ({ poolId: e.pool_id })), q = n.object({
679
679
  encodedOrderId: n.string(),
680
- quantity: q,
681
- filledQuantity: q,
682
- expireTimestamp: q,
683
- lastUpdatedTimestamp: q,
680
+ quantity: K,
681
+ filledQuantity: K,
682
+ expireTimestamp: K,
683
+ lastUpdatedTimestamp: K,
684
684
  status: n.number(),
685
- price: q
685
+ price: K
686
686
  }).transform((e) => ({
687
687
  orderId: e.encodedOrderId,
688
688
  quantity: e.quantity,
@@ -693,8 +693,8 @@ var q = n.union([n.string(), n.number()]).transform((e, t) => {
693
693
  status: e.status,
694
694
  price: e.price
695
695
  })), xe = n.object({
696
- bids: n.array(be),
697
- asks: n.array(be)
696
+ bids: n.array(q),
697
+ asks: n.array(q)
698
698
  }), Se = n.object({
699
699
  pool_id: n.string(),
700
700
  pool_name: n.string(),
@@ -724,6 +724,22 @@ var q = n.union([n.string(), n.number()]).transform((e, t) => {
724
724
  feeRateScaled: e.fee === null ? 0n : BigInt(e.fee),
725
725
  feeRate: e.fee_rate
726
726
  })), Ce = n.object({
727
+ hub_id: n.string(),
728
+ collection_id: n.string(),
729
+ vault_config_id: n.string().nullable(),
730
+ pool_id: n.string().nullable(),
731
+ metadata: Se.nullable(),
732
+ bids: n.array(q),
733
+ asks: n.array(q)
734
+ }).transform((e) => ({
735
+ hubId: e.hub_id,
736
+ collectionId: e.collection_id,
737
+ vaultConfigId: e.vault_config_id,
738
+ poolId: e.pool_id,
739
+ metadata: e.metadata,
740
+ bids: e.bids,
741
+ asks: e.asks
742
+ })), we = n.object({
727
743
  hub_id: n.string(),
728
744
  collection_id: n.string(),
729
745
  vault_config_id: n.string()
@@ -731,7 +747,7 @@ var q = n.union([n.string(), n.number()]).transform((e, t) => {
731
747
  hubId: e.hub_id,
732
748
  collectionId: e.collection_id,
733
749
  vaultConfigId: e.vault_config_id
734
- })), we = n.object({
750
+ })), Te = n.object({
735
751
  hub_id: n.string(),
736
752
  assembly_item_id: n.string(),
737
753
  assembly_tenant: n.string(),
@@ -763,7 +779,7 @@ var q = n.union([n.string(), n.number()]).transform((e, t) => {
763
779
  isPublic: e.is_public,
764
780
  regionId: e.region_id,
765
781
  solarSystemName: e.solar_system_name
766
- })), Te = n.object({
782
+ })), Ee = n.object({
767
783
  asset_id: n.string(),
768
784
  has_bids: n.boolean(),
769
785
  has_asks: n.boolean()
@@ -771,13 +787,13 @@ var q = n.union([n.string(), n.number()]).transform((e, t) => {
771
787
  assetId: e.asset_id,
772
788
  hasBids: e.has_bids,
773
789
  hasAsks: e.has_asks
774
- })), Ee = n.object({
775
- data: n.array(Te),
790
+ })), De = n.object({
791
+ data: n.array(Ee),
776
792
  next_cursor: n.string().nullable()
777
793
  }).transform((e) => ({
778
794
  items: e.data,
779
795
  nextCursor: e.next_cursor
780
- })), De = n.object({
796
+ })), Oe = n.object({
781
797
  hub_id: n.string(),
782
798
  collection_id: n.string()
783
799
  }).transform((e) => ({
@@ -785,11 +801,11 @@ var q = n.union([n.string(), n.number()]).transform((e, t) => {
785
801
  collectionId: e.collection_id
786
802
  })), J = n.object({
787
803
  asset_id: n.string(),
788
- amount: q
804
+ amount: K
789
805
  }).transform((e) => ({
790
806
  assetId: e.asset_id,
791
807
  amount: e.amount
792
- })), Oe = n.object({
808
+ })), ke = n.object({
793
809
  storage_unit_id: n.string(),
794
810
  collection_id: n.string(),
795
811
  warehouse: n.array(J),
@@ -803,14 +819,14 @@ var q = n.union([n.string(), n.number()]).transform((e, t) => {
803
819
  marketplace: e.marketplace,
804
820
  hangar: e.hangar,
805
821
  orgVaults: e.org_vaults
806
- })), ke = n.object({
822
+ })), Ae = n.object({
807
823
  pool_id: n.string(),
808
824
  order_id: n.string(),
809
825
  encoded_order_id: n.string().optional(),
810
826
  side: n.enum(["buy", "sell"]),
811
- price: q,
812
- remaining_quantity: q,
813
- filled_quantity: q,
827
+ price: K,
828
+ remaining_quantity: K,
829
+ filled_quantity: K,
814
830
  expires_at: n.number(),
815
831
  updated_at: n.number(),
816
832
  asset_id: n.string(),
@@ -831,21 +847,21 @@ var q = n.union([n.string(), n.number()]).transform((e, t) => {
831
847
  storageUnitId: e.storage_unit_id,
832
848
  quoteAssetSymbol: e.quote_asset_symbol,
833
849
  quoteAssetDecimals: e.quote_asset_decimals
834
- })), Ae = n.object({
835
- data: n.array(ke),
850
+ })), je = n.object({
851
+ data: n.array(Ae),
836
852
  next_cursor: n.string().nullable()
837
853
  }).transform((e) => ({
838
854
  orders: e.data,
839
855
  nextCursor: e.next_cursor
840
- })), je = n.object({
856
+ })), Me = n.object({
841
857
  event_digest: n.string(),
842
858
  pool_id: n.string(),
843
859
  order_id: n.string(),
844
860
  counterparty_balance_manager_id: n.string(),
845
- price: q,
846
- base_quantity: q,
847
- quote_quantity: q,
848
- fee: q,
861
+ price: K,
862
+ base_quantity: K,
863
+ quote_quantity: K,
864
+ fee: K,
849
865
  role: n.enum(["maker", "taker"]),
850
866
  taker_is_bid: n.boolean(),
851
867
  filled_at: n.number()
@@ -861,21 +877,21 @@ var q = n.union([n.string(), n.number()]).transform((e, t) => {
861
877
  role: e.role,
862
878
  takerIsBid: e.taker_is_bid,
863
879
  filledAt: e.filled_at
864
- })), Me = n.object({
865
- data: n.array(je),
880
+ })), Ne = n.object({
881
+ data: n.array(Me),
866
882
  next_cursor: n.string().nullable()
867
883
  }).transform((e) => ({
868
884
  fills: e.data,
869
885
  nextCursor: e.next_cursor
870
- })), Ne = n.object({
886
+ })), Pe = n.object({
871
887
  event_digest: n.string(),
872
888
  pool_id: n.string(),
873
889
  order_id: n.string(),
874
890
  counterparty_balance_manager_id: n.string(),
875
- price: q,
876
- base_quantity: q,
877
- quote_quantity: q,
878
- fee: q,
891
+ price: K,
892
+ base_quantity: K,
893
+ quote_quantity: K,
894
+ fee: K,
879
895
  role: n.enum(["maker", "taker"]),
880
896
  side: n.enum(["buy", "sell"]),
881
897
  traded_at: n.number(),
@@ -895,29 +911,29 @@ var q = n.union([n.string(), n.number()]).transform((e, t) => {
895
911
  tradedAt: e.traded_at,
896
912
  assetId: e.asset_id,
897
913
  storageUnitId: e.storage_unit_id
898
- })), Pe = n.object({
899
- data: n.array(Ne),
914
+ })), Fe = n.object({
915
+ data: n.array(Pe),
900
916
  next_cursor: n.string().nullable()
901
917
  }).transform((e) => ({
902
918
  trades: e.data,
903
919
  nextCursor: e.next_cursor
904
- })), Fe = n.object({
905
- base: q,
906
- quote: q,
907
- cred: q
920
+ })), Ie = n.object({
921
+ base: K,
922
+ quote: K,
923
+ cred: K
908
924
  }).transform((e) => ({
909
925
  base: e.base,
910
926
  quote: e.quote,
911
927
  cred: e.cred
912
- })), Ie = n.object({
928
+ })), Le = n.object({
913
929
  pool_id: n.string(),
914
930
  collection_id: n.string(),
915
931
  asset_id: n.string(),
916
932
  quote_asset_id: n.string().nullable(),
917
933
  storage_unit_id: n.string(),
918
934
  vault_config_id: n.string(),
919
- settled: Fe,
920
- owed: Fe,
935
+ settled: Ie,
936
+ owed: Ie,
921
937
  open_order_count: n.number()
922
938
  }).transform((e) => ({
923
939
  poolId: e.pool_id,
@@ -929,10 +945,10 @@ var q = n.union([n.string(), n.number()]).transform((e, t) => {
929
945
  settled: e.settled,
930
946
  owed: e.owed,
931
947
  openOrderCount: e.open_order_count
932
- })), Le = n.object({
948
+ })), Re = n.object({
933
949
  collection_id: n.string(),
934
950
  asset_id: n.string(),
935
- amount: q,
951
+ amount: K,
936
952
  storage_unit_id: n.string(),
937
953
  vault_config_id: n.string()
938
954
  }).transform((e) => ({
@@ -941,11 +957,11 @@ var q = n.union([n.string(), n.number()]).transform((e, t) => {
941
957
  amount: e.amount,
942
958
  storageUnitId: e.storage_unit_id,
943
959
  vaultConfigId: e.vault_config_id
944
- })), Re = n.object({
960
+ })), ze = n.object({
945
961
  balance_manager_id: n.string(),
946
962
  as_of_checkpoint: n.string().nullable(),
947
- pools: n.array(Ie),
948
- items: n.array(Le)
963
+ pools: n.array(Le),
964
+ items: n.array(Re)
949
965
  }).transform((e) => ({
950
966
  balanceManagerId: e.balance_manager_id,
951
967
  asOfCheckpoint: e.as_of_checkpoint,
@@ -994,7 +1010,7 @@ var X = class {
994
1010
  return await i.json();
995
1011
  }
996
1012
  async discovery(e) {
997
- return Y(ve, await this.get("/v1/discovery", {
1013
+ return Y(ye, await this.get("/v1/discovery", {
998
1014
  storage_unit_ids: e?.storageUnitIds?.join(","),
999
1015
  asset_id: e?.assetId,
1000
1016
  balance_manager_id: e?.balanceManagerId,
@@ -1005,12 +1021,15 @@ var X = class {
1005
1021
  }), "discovery");
1006
1022
  }
1007
1023
  async resolvePool(e) {
1008
- return Y(ye, await this.get("/v1/pools/resolve", {
1024
+ return Y(be, await this.get("/v1/pools/resolve", {
1009
1025
  collection_id: e.collectionId,
1010
1026
  asset_id: e.assetId,
1011
1027
  quote_type: e.quoteType
1012
1028
  }), "resolvePool").poolId;
1013
1029
  }
1030
+ async hubItemOrderbook(e) {
1031
+ return Y(Ce, await this.get(`/v1/hubs/${encodeURIComponent(e.hubId)}/items/${encodeURIComponent(e.assetId)}/orderbook`, { quote_type: e.quoteType }, u.HubNotFound), "hubItemOrderbook");
1032
+ }
1014
1033
  async orderbook(e) {
1015
1034
  return {
1016
1035
  poolId: e,
@@ -1021,24 +1040,24 @@ var X = class {
1021
1040
  return Y(Se, await this.get(`/v1/pools/${encodeURIComponent(e)}/metadata`, void 0, u.PoolNotFound), "poolMetadata");
1022
1041
  }
1023
1042
  async hubVault(e) {
1024
- return Y(Ce, await this.get(`/v1/hubs/${encodeURIComponent(e)}/vault`, void 0, u.HubNotFound), "hubVault");
1043
+ return Y(we, await this.get(`/v1/hubs/${encodeURIComponent(e)}/vault`, void 0, u.HubNotFound), "hubVault");
1025
1044
  }
1026
1045
  async hubLocation(e) {
1027
1046
  try {
1028
- return Y(we, await this.get(`/v1/hubs/${encodeURIComponent(e)}/location`, void 0, u.HubNotFound), "hubLocation");
1047
+ return Y(Te, await this.get(`/v1/hubs/${encodeURIComponent(e)}/location`, void 0, u.HubNotFound), "hubLocation");
1029
1048
  } catch (e) {
1030
1049
  if (e instanceof d && e.status === 404) return null;
1031
1050
  throw e;
1032
1051
  }
1033
1052
  }
1034
1053
  async hubItems(e) {
1035
- return Y(Ee, await this.get(`/v1/hubs/${encodeURIComponent(e)}/items`, void 0, u.HubNotFound), "hubItems");
1054
+ return Y(De, await this.get(`/v1/hubs/${encodeURIComponent(e)}/items`, void 0, u.HubNotFound), "hubItems");
1036
1055
  }
1037
1056
  async collectionHub(e) {
1038
- return Y(De, await this.get(`/v1/collections/${encodeURIComponent(e)}/hub`, void 0, u.HubNotFound), "collectionHub");
1057
+ return Y(Oe, await this.get(`/v1/collections/${encodeURIComponent(e)}/hub`, void 0, u.HubNotFound), "collectionHub");
1039
1058
  }
1040
1059
  async inventoryBalances(e) {
1041
- return Y(Oe, await this.get("/v1/inventory/balances", {
1060
+ return Y(ke, await this.get("/v1/inventory/balances", {
1042
1061
  storage_unit_id: e.storageUnitId,
1043
1062
  owner_address: e.address,
1044
1063
  balance_manager_id: e.balanceManagerId,
@@ -1047,14 +1066,14 @@ var X = class {
1047
1066
  }, u.HubNotFound), "inventoryBalances");
1048
1067
  }
1049
1068
  async openOrders(e, t) {
1050
- return Y(Ae, await this.get(`/v1/balance-managers/${encodeURIComponent(e)}/open-orders`, {
1069
+ return Y(je, await this.get(`/v1/balance-managers/${encodeURIComponent(e)}/open-orders`, {
1051
1070
  before: t?.before,
1052
1071
  after: t?.after,
1053
1072
  limit: t?.limit
1054
1073
  }, u.BalanceManagerNotFound), "openOrders");
1055
1074
  }
1056
1075
  async fills(e, t) {
1057
- return Y(Me, await this.get(`/v1/balance-managers/${encodeURIComponent(e)}/fills`, {
1076
+ return Y(Ne, await this.get(`/v1/balance-managers/${encodeURIComponent(e)}/fills`, {
1058
1077
  before: t?.before,
1059
1078
  after: t?.after,
1060
1079
  limit: t?.limit,
@@ -1063,10 +1082,10 @@ var X = class {
1063
1082
  }, u.BalanceManagerNotFound), "fills");
1064
1083
  }
1065
1084
  async sweepable(e) {
1066
- return Y(Re, await this.get(`/v1/balance-managers/${encodeURIComponent(e)}/sweepable`, void 0, u.BalanceManagerNotFound), "sweepable");
1085
+ return Y(ze, await this.get(`/v1/balance-managers/${encodeURIComponent(e)}/sweepable`, void 0, u.BalanceManagerNotFound), "sweepable");
1067
1086
  }
1068
1087
  async trades(e, t) {
1069
- return Y(Pe, await this.get(`/v1/balance-managers/${encodeURIComponent(e)}/trades`, {
1088
+ return Y(Fe, await this.get(`/v1/balance-managers/${encodeURIComponent(e)}/trades`, {
1070
1089
  before: t?.before,
1071
1090
  after: t?.after,
1072
1091
  limit: t?.limit,
@@ -1074,7 +1093,7 @@ var X = class {
1074
1093
  asset_id: t?.assetId
1075
1094
  }, u.BalanceManagerNotFound), "trades");
1076
1095
  }
1077
- }, ze = class {
1096
+ }, Be = class {
1078
1097
  suiClient;
1079
1098
  ids;
1080
1099
  indexer;
@@ -1086,7 +1105,7 @@ var X = class {
1086
1105
  market;
1087
1106
  orders;
1088
1107
  constructor(e) {
1089
- this.suiClient = e.suiClient, this.executor = e.executor, this.address = e.address, this.ids = l(e.network ?? "testnet", e.packageIds), this.indexer = new X(e.indexerUrl ?? "https://api.trinary.exchange", e.apiKey), this.account = new Ve(this), this.balances = new He(this), this.market = new Ue(this), this.orders = new We(this);
1108
+ this.suiClient = e.suiClient, this.executor = e.executor, this.address = e.address, this.ids = l(e.network ?? "testnet", e.packageIds), this.indexer = new X(e.indexerUrl ?? "https://api.trinary.exchange", e.apiKey), this.account = new He(this), this.balances = new Ue(this), this.market = new We(this), this.orders = new Ge(this);
1090
1109
  }
1091
1110
  requireExecutor() {
1092
1111
  if (!this.executor) throw new d(u.ExecutorRequired, "This operation writes on-chain and requires an `executor`.");
@@ -1113,7 +1132,7 @@ var X = class {
1113
1132
  let n = await this.resolveBalanceManagerId(t), r = new e();
1114
1133
  return {
1115
1134
  tx: r,
1116
- bm: n ? r.object(n) : j(r, this.ids)[0],
1135
+ bm: n ? r.object(n) : A(r, this.ids)[0],
1117
1136
  existingBmId: n
1118
1137
  };
1119
1138
  }
@@ -1121,7 +1140,7 @@ var X = class {
1121
1140
  n || e.transferObjects([t], r);
1122
1141
  let i = await m(this.requireExecutor(), e);
1123
1142
  if (!n) {
1124
- let e = Be(i);
1143
+ let e = Ve(i);
1125
1144
  e && this.rememberBalanceManagerId(e);
1126
1145
  }
1127
1146
  return Z(i);
@@ -1132,7 +1151,7 @@ var X = class {
1132
1151
  return t;
1133
1152
  }
1134
1153
  };
1135
- function Be(e) {
1154
+ function Ve(e) {
1136
1155
  return g(e, "::balance_manager::BalanceManager")?.objectId ?? null;
1137
1156
  }
1138
1157
  function Z(e) {
@@ -1142,7 +1161,7 @@ function Z(e) {
1142
1161
  raw: e.raw
1143
1162
  };
1144
1163
  }
1145
- var Ve = class {
1164
+ var He = class {
1146
1165
  c;
1147
1166
  constructor(e) {
1148
1167
  this.c = e;
@@ -1160,9 +1179,9 @@ var Ve = class {
1160
1179
  balanceManagerId: r,
1161
1180
  created: !1
1162
1181
  };
1163
- let i = this.c.requireExecutor(), a = new e(), o = j(a, this.c.ids);
1182
+ let i = this.c.requireExecutor(), a = new e(), o = A(a, this.c.ids);
1164
1183
  a.transferObjects([o], n);
1165
- let s = Be(await m(i, a));
1184
+ let s = Ve(await m(i, a));
1166
1185
  if (!s) throw new d(u.UnexpectedResponse, "Balance manager created but no created-object info found — have the executor include effects+objectTypes (v2) or objectChanges (legacy).");
1167
1186
  return this.c.rememberBalanceManagerId(s), {
1168
1187
  balanceManagerId: s,
@@ -1173,14 +1192,14 @@ var Ve = class {
1173
1192
  if (e.amount <= 0n) throw new d(u.ValidationFailed, "Deposit amount must be positive.");
1174
1193
  let t = this.c.requireAddress();
1175
1194
  this.c.requireExecutor();
1176
- let { tx: n, bm: r, existingBmId: i } = await this.c.beginBmTx(t), a = await V(this.c.suiClient, n, t, this.c.ids.credCoinType, e.amount, "Insufficient CRED in the wallet for this deposit.");
1177
- return N(n, this.c.ids, r, a), this.c.finishBmTx(n, r, i, t);
1195
+ let { tx: n, bm: r, existingBmId: i } = await this.c.beginBmTx(t), a = await B(this.c.suiClient, n, t, this.c.ids.credCoinType, e.amount, "Insufficient CRED in the wallet for this deposit.");
1196
+ return M(n, this.c.ids, r, a), this.c.finishBmTx(n, r, i, t);
1178
1197
  }
1179
1198
  async depositItems(e) {
1180
1199
  let t = this.c.requireAddress();
1181
1200
  this.c.requireExecutor();
1182
1201
  let n = await this.c.indexer.hubVault(e.storageUnitId), r = w(e.storageUnitId), { tx: i, bm: a, existingBmId: o } = await this.c.beginBmTx(t);
1183
- for (let s of e.items) await H(this.c.suiClient, i, this.c.ids, a, {
1202
+ for (let s of e.items) await V(this.c.suiClient, i, this.c.ids, a, {
1184
1203
  owner: t,
1185
1204
  ssuObjectId: r,
1186
1205
  vaultConfigId: n.vaultConfigId,
@@ -1193,20 +1212,20 @@ var Ve = class {
1193
1212
  return this.c.finishBmTx(i, a, o, t);
1194
1213
  }
1195
1214
  async withdrawCurrency(t) {
1196
- let n = this.c.requireAddress(), r = await this.c.requireBalanceManagerId(n), i = this.c.requireExecutor(), a = new e(), o = a.object(r), s = t?.amount === void 0 ? ce(a, this.c.ids, o) : se(a, this.c.ids, o, t.amount);
1215
+ let n = this.c.requireAddress(), r = await this.c.requireBalanceManagerId(n), i = this.c.requireExecutor(), a = new e(), o = a.object(r), s = t?.amount === void 0 ? le(a, this.c.ids, o) : ce(a, this.c.ids, o, t.amount);
1197
1216
  return a.transferObjects([s], n), Z(await m(i, a));
1198
1217
  }
1199
1218
  async withdrawItems(t) {
1200
1219
  let n = this.c.requireAddress(), r = await this.c.requireBalanceManagerId(n), i = this.c.requireExecutor(), a = await this.c.indexer.hubVault(t.storageUnitId), o = w(t.storageUnitId), s = t.characterId;
1201
1220
  if (!s) {
1202
- let e = await O(this.c.suiClient, this.c.ids, n);
1221
+ let e = await D(this.c.suiClient, this.c.ids, n);
1203
1222
  if (!e) throw new d(u.CharacterNotFound, `No on-chain character resolved for ${n} — pass characterId explicitly.`);
1204
1223
  s = e.characterId;
1205
1224
  }
1206
- let c = await k(this.c.suiClient, o, n), l = new e(), f = l.object(r);
1225
+ let c = await O(this.c.suiClient, o, n), l = new e(), f = l.object(r);
1207
1226
  for (let e of t.items) {
1208
- let t = le(l, this.c.ids, f, a.collectionId, BigInt(e.assetId));
1209
- ue(l, this.c.ids, t, {
1227
+ let t = ue(l, this.c.ids, f, a.collectionId, BigInt(e.assetId));
1228
+ de(l, this.c.ids, t, {
1210
1229
  ssuObjectId: o,
1211
1230
  characterId: s,
1212
1231
  vaultConfigId: a.vaultConfigId,
@@ -1226,8 +1245,8 @@ var Ve = class {
1226
1245
  poolId: e.poolId,
1227
1246
  quoteCoinType: e.quoteAssetId ?? void 0
1228
1247
  })), a.length === 0) throw new d(u.ValidationFailed, "Nothing settled to claim — no pools with claimable balances.");
1229
- let o = new e(), s = o.object(r), c = M(o, this.c.ids, s)[0];
1230
- for (let e of a) B(o, this.c.ids, {
1248
+ let o = new e(), s = o.object(r), c = j(o, this.c.ids, s)[0];
1249
+ for (let e of a) z(o, this.c.ids, {
1231
1250
  poolId: e.poolId,
1232
1251
  bm: s,
1233
1252
  proof: c,
@@ -1235,14 +1254,14 @@ var Ve = class {
1235
1254
  });
1236
1255
  return Z(await m(i, o));
1237
1256
  }
1238
- }, He = class {
1257
+ }, Ue = class {
1239
1258
  c;
1240
1259
  constructor(e) {
1241
1260
  this.c = e;
1242
1261
  }
1243
1262
  async atHub(e) {
1244
1263
  let t = e.address ?? this.c.requireAddress(), n = await this.c.resolveBalanceManagerId(t) ?? void 0, r = e.inventoryKey;
1245
- return !r && e.includeHangar && (r = (await O(this.c.suiClient, this.c.ids, t))?.ownerCapId), this.c.indexer.inventoryBalances({
1264
+ return !r && e.includeHangar && (r = (await D(this.c.suiClient, this.c.ids, t))?.ownerCapId), this.c.indexer.inventoryBalances({
1246
1265
  ...e,
1247
1266
  address: t,
1248
1267
  balanceManagerId: n,
@@ -1257,7 +1276,7 @@ var Ve = class {
1257
1276
  balanceManagerId: r
1258
1277
  };
1259
1278
  }
1260
- }, Ue = class {
1279
+ }, We = class {
1261
1280
  c;
1262
1281
  constructor(e) {
1263
1282
  this.c = e;
@@ -1286,13 +1305,20 @@ var Ve = class {
1286
1305
  return n;
1287
1306
  }
1288
1307
  async orderbook(e) {
1289
- let t = await this.resolvePool(e);
1290
- return this.c.indexer.orderbook(t);
1308
+ let t = await this.c.indexer.hubItemOrderbook({
1309
+ hubId: e.storageUnitId,
1310
+ assetId: e.assetId
1311
+ });
1312
+ if (!t.poolId) throw new d(u.PoolNotFound, `No pool for item ${e.assetId} at hub ${e.storageUnitId}.`);
1313
+ return {
1314
+ ...t,
1315
+ poolId: t.poolId
1316
+ };
1291
1317
  }
1292
1318
  poolMetadata(e) {
1293
1319
  return this.c.indexer.poolMetadata(e);
1294
1320
  }
1295
- }, We = class {
1321
+ }, Ge = class {
1296
1322
  c;
1297
1323
  constructor(e) {
1298
1324
  this.c = e;
@@ -1302,7 +1328,7 @@ var Ve = class {
1302
1328
  let t = this.c.requireAddress();
1303
1329
  this.c.requireExecutor();
1304
1330
  let n = e.side === "buy", r = await this.c.indexer.hubVault(e.storageUnitId), i = await this.requirePool(r.collectionId, e), { tx: a, bm: o, existingBmId: s } = await this.c.beginBmTx(t);
1305
- if (!n) await H(this.c.suiClient, a, this.c.ids, o, {
1331
+ if (!n) await V(this.c.suiClient, a, this.c.ids, o, {
1306
1332
  owner: t,
1307
1333
  ssuObjectId: w(e.storageUnitId),
1308
1334
  vaultConfigId: r.vaultConfigId,
@@ -1316,13 +1342,13 @@ var Ve = class {
1316
1342
  let n = e.quoteDeposit;
1317
1343
  if (n === void 0) {
1318
1344
  let t = await this.c.indexer.poolMetadata(i);
1319
- n = K(e.price, e.quantity, t.feeRateScaled);
1345
+ n = G(e.price, e.quantity, t.feeRateScaled);
1320
1346
  }
1321
1347
  if (n <= 0n) throw new d(u.ValidationFailed, "Invalid quote deposit amount.");
1322
1348
  await this.depositQuoteDeficit(a, o, s, t, n);
1323
1349
  }
1324
- let c = M(a, this.c.ids, o)[0];
1325
- return F(a, this.c.ids, {
1350
+ let c = j(a, this.c.ids, o)[0];
1351
+ return P(a, this.c.ids, {
1326
1352
  poolId: i,
1327
1353
  bm: o,
1328
1354
  proof: c,
@@ -1339,7 +1365,7 @@ var Ve = class {
1339
1365
  let t = this.c.requireAddress();
1340
1366
  this.c.requireExecutor();
1341
1367
  let n = e.side === "buy", r = await this.c.indexer.hubVault(e.storageUnitId), i = await this.requirePool(r.collectionId, e), { tx: a, bm: o, existingBmId: s } = await this.c.beginBmTx(t);
1342
- if (!n) await H(this.c.suiClient, a, this.c.ids, o, {
1368
+ if (!n) await V(this.c.suiClient, a, this.c.ids, o, {
1343
1369
  owner: t,
1344
1370
  ssuObjectId: w(e.storageUnitId),
1345
1371
  vaultConfigId: r.vaultConfigId,
@@ -1351,11 +1377,11 @@ var Ve = class {
1351
1377
  });
1352
1378
  else {
1353
1379
  if (!e.quoteBudget || e.quoteBudget <= 0n) throw new d(u.ValidationFailed, "Market buys require `quoteBudget` (see estimateMarketBuyCost).");
1354
- let n = await this.c.indexer.poolMetadata(i), r = e.quoteBudget + he(e.quantity, n.feeRateScaled);
1380
+ let n = await this.c.indexer.poolMetadata(i), r = e.quoteBudget + ge(e.quantity, n.feeRateScaled);
1355
1381
  await this.depositQuoteDeficit(a, o, s, t, r);
1356
1382
  }
1357
- let c = M(a, this.c.ids, o)[0];
1358
- return I(a, this.c.ids, {
1383
+ let c = j(a, this.c.ids, o)[0];
1384
+ return F(a, this.c.ids, {
1359
1385
  poolId: i,
1360
1386
  bm: o,
1361
1387
  proof: c,
@@ -1365,8 +1391,8 @@ var Ve = class {
1365
1391
  }), this.c.finishBmTx(a, o, s, t);
1366
1392
  }
1367
1393
  async cancel(e) {
1368
- let { tx: t, bm: n, poolId: r, execute: i } = await this.beginCancelTx(e), a = M(t, this.c.ids, n)[0];
1369
- return L(t, this.c.ids, {
1394
+ let { tx: t, bm: n, poolId: r, execute: i } = await this.beginCancelTx(e), a = j(t, this.c.ids, n)[0];
1395
+ return I(t, this.c.ids, {
1370
1396
  poolId: r,
1371
1397
  bm: n,
1372
1398
  proof: a,
@@ -1374,8 +1400,8 @@ var Ve = class {
1374
1400
  }), i();
1375
1401
  }
1376
1402
  async cancelAll(e) {
1377
- let { tx: t, bm: n, poolId: r, execute: i } = await this.beginCancelTx(e), a = M(t, this.c.ids, n)[0];
1378
- return R(t, this.c.ids, {
1403
+ let { tx: t, bm: n, poolId: r, execute: i } = await this.beginCancelTx(e), a = j(t, this.c.ids, n)[0];
1404
+ return L(t, this.c.ids, {
1379
1405
  poolId: r,
1380
1406
  bm: n,
1381
1407
  proof: a
@@ -1383,8 +1409,8 @@ var Ve = class {
1383
1409
  }
1384
1410
  async modify(e) {
1385
1411
  if (e.newQuantity <= 0n) throw new d(u.ValidationFailed, "Modified quantity must be positive.");
1386
- let { tx: t, bm: n, poolId: r, execute: i } = await this.beginCancelTx(e), a = M(t, this.c.ids, n)[0];
1387
- return z(t, this.c.ids, {
1412
+ let { tx: t, bm: n, poolId: r, execute: i } = await this.beginCancelTx(e), a = j(t, this.c.ids, n)[0];
1413
+ return R(t, this.c.ids, {
1388
1414
  poolId: r,
1389
1415
  bm: n,
1390
1416
  proof: a,
@@ -1427,8 +1453,8 @@ var Ve = class {
1427
1453
  async depositQuoteDeficit(e, t, n, r, i) {
1428
1454
  let a = n ? await T(this.c.suiClient, this.c.ids, n) : 0n, o = i > a ? i - a : 0n;
1429
1455
  if (o === 0n) return;
1430
- let s = await V(this.c.suiClient, e, r, this.c.ids.credCoinType, o, "Insufficient CRED to fund the balance manager for this order.");
1431
- N(e, this.c.ids, t, s);
1456
+ let s = await B(this.c.suiClient, e, r, this.c.ids.credCoinType, o, "Insufficient CRED to fund the balance manager for this order.");
1457
+ M(e, this.c.ids, t, s);
1432
1458
  }
1433
1459
  async beginCancelTx(t) {
1434
1460
  let n = this.c.requireAddress(), r = await this.c.requireBalanceManagerId(n), i = this.c.requireExecutor(), a = await this.c.indexer.hubVault(t.storageUnitId), o = await this.requirePool(a.collectionId, t), s = new e();
@@ -1439,7 +1465,7 @@ var Ve = class {
1439
1465
  execute: async () => Z(await m(i, s))
1440
1466
  };
1441
1467
  }
1442
- }, Ge = class {
1468
+ }, Ke = class {
1443
1469
  ids;
1444
1470
  indexer;
1445
1471
  constructor(e) {
@@ -1469,8 +1495,15 @@ var Ve = class {
1469
1495
  return n;
1470
1496
  }
1471
1497
  async orderbook(e) {
1472
- let t = await this.resolvePool(e);
1473
- return this.indexer.orderbook(t);
1498
+ let t = await this.indexer.hubItemOrderbook({
1499
+ hubId: e.storageUnitId,
1500
+ assetId: e.assetId
1501
+ });
1502
+ if (!t.poolId) throw new d(u.PoolNotFound, `No pool for item ${e.assetId} at hub ${e.storageUnitId}.`);
1503
+ return {
1504
+ ...t,
1505
+ poolId: t.poolId
1506
+ };
1474
1507
  }
1475
1508
  poolMetadata(e) {
1476
1509
  return this.indexer.poolMetadata(e);
@@ -1493,7 +1526,7 @@ var Ve = class {
1493
1526
  };
1494
1527
  //#endregion
1495
1528
  //#region src/book.ts
1496
- function Ke(e) {
1529
+ function qe(e) {
1497
1530
  let t = [];
1498
1531
  for (let n of e) {
1499
1532
  let e = t[t.length - 1];
@@ -1511,11 +1544,11 @@ function Q(e) {
1511
1544
  function $(e) {
1512
1545
  return e.asks[0] ?? null;
1513
1546
  }
1514
- function qe(e) {
1547
+ function Je(e) {
1515
1548
  let t = Q(e), n = $(e);
1516
1549
  return !t || !n ? null : (t.price + n.price) / 2n;
1517
1550
  }
1518
- function Je(e) {
1551
+ function Ye(e) {
1519
1552
  let t = Q(e), n = $(e);
1520
1553
  if (!t || !n) return null;
1521
1554
  let r = n.price - t.price, i = (t.price + n.price) / 2n;
@@ -1527,19 +1560,19 @@ function Je(e) {
1527
1560
  bps: Number(r * 10000n / i)
1528
1561
  };
1529
1562
  }
1530
- function Ye(e) {
1563
+ function Xe(e) {
1531
1564
  let t = 0n;
1532
1565
  for (let n of e) t += n.remainingQuantity;
1533
1566
  return t;
1534
1567
  }
1535
- function Xe(e) {
1568
+ function Ze(e) {
1536
1569
  let t = 0n, n = 0n;
1537
1570
  for (let r of e) t += r.baseQuantity, n += r.quoteQuantity;
1538
1571
  return t === 0n ? null : n / t;
1539
1572
  }
1540
1573
  //#endregion
1541
1574
  //#region src/paging.ts
1542
- async function* Ze(e, t, n) {
1575
+ async function* Qe(e, t, n) {
1543
1576
  let r = n?.maxItems ?? 1e4, i = t?.cursor, a = 0;
1544
1577
  for (;;) {
1545
1578
  let n = await e.discovery({
@@ -1551,7 +1584,7 @@ async function* Ze(e, t, n) {
1551
1584
  i = n.nextCursor;
1552
1585
  }
1553
1586
  }
1554
- async function* Qe(e, t, n, r) {
1587
+ async function* $e(e, t, n, r) {
1555
1588
  let i = r?.maxItems ?? 1e4, a = n?.before, o = 0;
1556
1589
  for (;;) {
1557
1590
  let r = await e.fills(t, {
@@ -1563,7 +1596,7 @@ async function* Qe(e, t, n, r) {
1563
1596
  a = r.fills[r.fills.length - 1].filledAt;
1564
1597
  }
1565
1598
  }
1566
- async function* $e(e, t, n, r) {
1599
+ async function* et(e, t, n, r) {
1567
1600
  let i = r?.maxItems ?? 1e4, a = n?.before, o = 0;
1568
1601
  for (;;) {
1569
1602
  let r = await e.trades(t, {
@@ -1577,7 +1610,7 @@ async function* $e(e, t, n, r) {
1577
1610
  }
1578
1611
  //#endregion
1579
1612
  //#region src/wait.ts
1580
- async function et(e, t) {
1613
+ async function tt(e, t) {
1581
1614
  let n = t?.timeoutMs ?? 3e4, r = t?.intervalMs ?? 2e3, i = Date.now() + n;
1582
1615
  for (;;) {
1583
1616
  let a = await e();
@@ -1587,4 +1620,4 @@ async function et(e, t) {
1587
1620
  }
1588
1621
  }
1589
1622
  //#endregion
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 };
1623
+ export { o as CLOCK_ID, a as DEFAULT_INDEXER_URL, U as FEE_RATE_SCALING, pe as GTC_EXPIRE, X as IndexerClient, H as MULTICOIN_PRICE_SCALING, c as NETWORK_PRESETS, Ke as ReadOnlyClient, s as STILLNESS_PACKAGE_IDS, fe as TRIEX_PRICE_SCALING, Be as TriexClient, d as TriexClientError, u as TriexError, qe as aggregateLevels, $ as bestAsk, Q as bestBid, G as computeBidQuoteDeposit, W as computeItemQuote, Xe as depth, _e as estimateMarketBuyCost, m as executeAndNormalize, p as explainMoveAbort, D as fetchCharacterInfo, k as fetchInventorySlotQuantity, O as fetchSsuOwnerInfo, g as findCreatedObject, E as findOwnedItemReceipts, he as fromBase, T as getBalanceManagerCurrencyBalance, ie as getBalanceManagerItemBalance, ne as getObjectRef, ae as getRegistryMulticoinCollectionId, re as getWalletCurrencyBalance, Qe as iterateDiscovery, $e as iterateFills, et as iterateTrades, ge as marketBuyRoundingBuffer, Je as midPrice, h as normalizeExecuteResult, B as prepareWalletCoinInput, l as resolvePackageIds, V as sourceItemsIntoBalanceManager, Ye as spread, me as toBase, w as toSsuObjectId, oe as transactions, tt as untilIndexed, Ze as vwap };
package/dist/queries.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { BalancesAtHubParams, CollectionHub, DiscoveryFilters, DiscoveryResult, FillsPage, FillsParams, HistoryPageParams, HubItemsPage, HubLocation, HubVaultInfo, InventoryBalances, OpenOrdersPage, Orderbook, PoolMetadata, Sweepable, TradesPage, TradesParams } from './types';
1
+ import { BalancesAtHubParams, CollectionHub, DiscoveryFilters, DiscoveryResult, FillsPage, FillsParams, HistoryPageParams, HubItemMarket, HubItemsPage, HubLocation, HubVaultInfo, InventoryBalances, OpenOrdersPage, Orderbook, PoolMetadata, Sweepable, TradesPage, TradesParams } from './types';
2
2
  export declare class IndexerClient {
3
3
  private readonly baseUrl;
4
4
  private readonly apiKey;
@@ -10,6 +10,11 @@ export declare class IndexerClient {
10
10
  assetId: string;
11
11
  quoteType?: string;
12
12
  }): Promise<string | null>;
13
+ hubItemOrderbook(params: {
14
+ hubId: string;
15
+ assetId: string;
16
+ quoteType?: string;
17
+ }): Promise<HubItemMarket>;
13
18
  orderbook(poolId: string): Promise<Orderbook>;
14
19
  poolMetadata(poolId: string): Promise<PoolMetadata>;
15
20
  hubVault(hubId: string): Promise<HubVaultInfo>;
package/dist/schemas.d.ts CHANGED
@@ -304,6 +304,187 @@ export declare const PoolMetadataSchema: z.ZodPipe<z.ZodObject<{
304
304
  fee: string | null;
305
305
  fee_rate: number | null;
306
306
  }>>;
307
+ export declare const HubItemOrderbookSchema: z.ZodPipe<z.ZodObject<{
308
+ hub_id: z.ZodString;
309
+ collection_id: z.ZodString;
310
+ vault_config_id: z.ZodNullable<z.ZodString>;
311
+ pool_id: z.ZodNullable<z.ZodString>;
312
+ metadata: z.ZodNullable<z.ZodPipe<z.ZodObject<{
313
+ pool_id: z.ZodString;
314
+ pool_name: z.ZodString;
315
+ base_asset_symbol: z.ZodString;
316
+ base_asset_name: z.ZodNullable<z.ZodString>;
317
+ base_asset_decimals: z.ZodNumber;
318
+ quote_asset_symbol: z.ZodString;
319
+ quote_asset_name: z.ZodNullable<z.ZodString>;
320
+ quote_asset_decimals: z.ZodNumber;
321
+ storage_unit_id: z.ZodNullable<z.ZodString>;
322
+ asset_id: z.ZodNullable<z.ZodString>;
323
+ collection_id: z.ZodNullable<z.ZodString>;
324
+ fee: z.ZodNullable<z.ZodString>;
325
+ fee_rate: z.ZodNullable<z.ZodNumber>;
326
+ }, z.core.$strip>, z.ZodTransform<{
327
+ poolId: string;
328
+ poolName: string;
329
+ baseAssetSymbol: string;
330
+ baseAssetName: string | null;
331
+ baseAssetDecimals: number;
332
+ quoteAssetSymbol: string;
333
+ quoteAssetName: string | null;
334
+ quoteAssetDecimals: number;
335
+ storageUnitId: string | null;
336
+ assetId: string | null;
337
+ collectionId: string | null;
338
+ feeRateScaled: bigint;
339
+ feeRate: number | null;
340
+ }, {
341
+ pool_id: string;
342
+ pool_name: string;
343
+ base_asset_symbol: string;
344
+ base_asset_name: string | null;
345
+ base_asset_decimals: number;
346
+ quote_asset_symbol: string;
347
+ quote_asset_name: string | null;
348
+ quote_asset_decimals: number;
349
+ storage_unit_id: string | null;
350
+ asset_id: string | null;
351
+ collection_id: string | null;
352
+ fee: string | null;
353
+ fee_rate: number | null;
354
+ }>>>;
355
+ bids: z.ZodArray<z.ZodPipe<z.ZodObject<{
356
+ encodedOrderId: z.ZodString;
357
+ quantity: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<bigint, string | number>>;
358
+ filledQuantity: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<bigint, string | number>>;
359
+ expireTimestamp: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<bigint, string | number>>;
360
+ lastUpdatedTimestamp: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<bigint, string | number>>;
361
+ status: z.ZodNumber;
362
+ price: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<bigint, string | number>>;
363
+ }, z.core.$strip>, z.ZodTransform<{
364
+ orderId: string;
365
+ quantity: bigint;
366
+ filledQuantity: bigint;
367
+ remainingQuantity: bigint;
368
+ expireTimestamp: bigint;
369
+ lastUpdatedTimestamp: bigint;
370
+ status: number;
371
+ price: bigint;
372
+ }, {
373
+ encodedOrderId: string;
374
+ quantity: bigint;
375
+ filledQuantity: bigint;
376
+ expireTimestamp: bigint;
377
+ lastUpdatedTimestamp: bigint;
378
+ status: number;
379
+ price: bigint;
380
+ }>>>;
381
+ asks: z.ZodArray<z.ZodPipe<z.ZodObject<{
382
+ encodedOrderId: z.ZodString;
383
+ quantity: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<bigint, string | number>>;
384
+ filledQuantity: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<bigint, string | number>>;
385
+ expireTimestamp: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<bigint, string | number>>;
386
+ lastUpdatedTimestamp: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<bigint, string | number>>;
387
+ status: z.ZodNumber;
388
+ price: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<bigint, string | number>>;
389
+ }, z.core.$strip>, z.ZodTransform<{
390
+ orderId: string;
391
+ quantity: bigint;
392
+ filledQuantity: bigint;
393
+ remainingQuantity: bigint;
394
+ expireTimestamp: bigint;
395
+ lastUpdatedTimestamp: bigint;
396
+ status: number;
397
+ price: bigint;
398
+ }, {
399
+ encodedOrderId: string;
400
+ quantity: bigint;
401
+ filledQuantity: bigint;
402
+ expireTimestamp: bigint;
403
+ lastUpdatedTimestamp: bigint;
404
+ status: number;
405
+ price: bigint;
406
+ }>>>;
407
+ }, z.core.$strip>, z.ZodTransform<{
408
+ hubId: string;
409
+ collectionId: string;
410
+ vaultConfigId: string | null;
411
+ poolId: string | null;
412
+ metadata: {
413
+ poolId: string;
414
+ poolName: string;
415
+ baseAssetSymbol: string;
416
+ baseAssetName: string | null;
417
+ baseAssetDecimals: number;
418
+ quoteAssetSymbol: string;
419
+ quoteAssetName: string | null;
420
+ quoteAssetDecimals: number;
421
+ storageUnitId: string | null;
422
+ assetId: string | null;
423
+ collectionId: string | null;
424
+ feeRateScaled: bigint;
425
+ feeRate: number | null;
426
+ } | null;
427
+ bids: {
428
+ orderId: string;
429
+ quantity: bigint;
430
+ filledQuantity: bigint;
431
+ remainingQuantity: bigint;
432
+ expireTimestamp: bigint;
433
+ lastUpdatedTimestamp: bigint;
434
+ status: number;
435
+ price: bigint;
436
+ }[];
437
+ asks: {
438
+ orderId: string;
439
+ quantity: bigint;
440
+ filledQuantity: bigint;
441
+ remainingQuantity: bigint;
442
+ expireTimestamp: bigint;
443
+ lastUpdatedTimestamp: bigint;
444
+ status: number;
445
+ price: bigint;
446
+ }[];
447
+ }, {
448
+ hub_id: string;
449
+ collection_id: string;
450
+ vault_config_id: string | null;
451
+ pool_id: string | null;
452
+ metadata: {
453
+ poolId: string;
454
+ poolName: string;
455
+ baseAssetSymbol: string;
456
+ baseAssetName: string | null;
457
+ baseAssetDecimals: number;
458
+ quoteAssetSymbol: string;
459
+ quoteAssetName: string | null;
460
+ quoteAssetDecimals: number;
461
+ storageUnitId: string | null;
462
+ assetId: string | null;
463
+ collectionId: string | null;
464
+ feeRateScaled: bigint;
465
+ feeRate: number | null;
466
+ } | null;
467
+ bids: {
468
+ orderId: string;
469
+ quantity: bigint;
470
+ filledQuantity: bigint;
471
+ remainingQuantity: bigint;
472
+ expireTimestamp: bigint;
473
+ lastUpdatedTimestamp: bigint;
474
+ status: number;
475
+ price: bigint;
476
+ }[];
477
+ asks: {
478
+ orderId: string;
479
+ quantity: bigint;
480
+ filledQuantity: bigint;
481
+ remainingQuantity: bigint;
482
+ expireTimestamp: bigint;
483
+ lastUpdatedTimestamp: bigint;
484
+ status: number;
485
+ price: bigint;
486
+ }[];
487
+ }>>;
307
488
  export declare const HubVaultSchema: z.ZodPipe<z.ZodObject<{
308
489
  hub_id: z.ZodString;
309
490
  collection_id: z.ZodString;
package/dist/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Transaction } from '@mysten/sui/transactions';
2
2
  import { ClientWithCoreApi } from '@mysten/sui/client';
3
3
  import { z } from 'zod';
4
- import { AssetBalanceSchema, CollectionHubSchema, DiscoveryOrderSchema, DiscoveryResultSchema, FillSchema, FillsPageSchema, HubItemSchema, HubItemsPageSchema, HubLocationSchema, HubVaultSchema, InventoryBalancesSchema, OpenOrderSchema, OpenOrdersPageSchema, OrderbookOrderSchema, PoolMetadataSchema, SweepableItemSchema, SweepablePoolSchema, SweepableSchema, TradeSchema, TradesPageSchema } from './schemas';
4
+ import { AssetBalanceSchema, CollectionHubSchema, DiscoveryOrderSchema, DiscoveryResultSchema, FillSchema, FillsPageSchema, HubItemOrderbookSchema, HubItemSchema, HubItemsPageSchema, HubLocationSchema, HubVaultSchema, InventoryBalancesSchema, OpenOrderSchema, OpenOrdersPageSchema, OrderbookOrderSchema, PoolMetadataSchema, SweepableItemSchema, SweepablePoolSchema, SweepableSchema, TradeSchema, TradesPageSchema } from './schemas';
5
5
  export interface ObjectChange {
6
6
  type: string;
7
7
  objectId?: string;
@@ -69,6 +69,13 @@ export interface Orderbook {
69
69
  bids: OrderbookOrder[];
70
70
  asks: OrderbookOrder[];
71
71
  }
72
+ export type HubItemMarket = z.output<typeof HubItemOrderbookSchema>;
73
+ export interface HubItemOrderbook extends Orderbook {
74
+ hubId: string;
75
+ collectionId: string;
76
+ vaultConfigId: string | null;
77
+ metadata: PoolMetadata | null;
78
+ }
72
79
  export interface TradeHubDetail {
73
80
  hubId: string;
74
81
  collectionId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trinaryex/sdk",
3
- "version": "3.0.0",
3
+ "version": "3.1.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",