@trinaryex/sdk 3.7.0 → 3.9.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/dist/index.js CHANGED
@@ -28,7 +28,7 @@ function l(e = "testnet", t) {
28
28
  //#endregion
29
29
  //#region src/errors.ts
30
30
  var u = /* @__PURE__ */ function(e) {
31
- return e.ExecutorRequired = "TRIEX_EXECUTOR_REQUIRED", e.AddressRequired = "TRIEX_ADDRESS_REQUIRED", e.ApiKeyRequired = "TRIEX_API_KEY_REQUIRED", e.Unauthorized = "TRIEX_UNAUTHORIZED", e.RateLimited = "TRIEX_RATE_LIMITED", e.IndexerError = "TRIEX_INDEXER_ERROR", e.UnexpectedResponse = "TRIEX_UNEXPECTED_RESPONSE", e.ValidationFailed = "TRIEX_VALIDATION_FAILED", e.InsufficientBalance = "TRIEX_INSUFFICIENT_BALANCE", e.CollectionMismatch = "TRIEX_COLLECTION_MISMATCH", e.BalanceManagerNotFound = "TRIEX_BALANCE_MANAGER_NOT_FOUND", e.PoolNotFound = "TRIEX_POOL_NOT_FOUND", e.HubNotFound = "TRIEX_HUB_NOT_FOUND", e.CharacterNotFound = "TRIEX_CHARACTER_NOT_FOUND", e.TransactionFailed = "TRIEX_TRANSACTION_FAILED", e.Timeout = "TRIEX_TIMEOUT", e.NotImplemented = "TRIEX_NOT_IMPLEMENTED", e;
31
+ return e.ExecutorRequired = "TRIEX_EXECUTOR_REQUIRED", e.AddressRequired = "TRIEX_ADDRESS_REQUIRED", e.ApiKeyRequired = "TRIEX_API_KEY_REQUIRED", e.Unauthorized = "TRIEX_UNAUTHORIZED", e.RateLimited = "TRIEX_RATE_LIMITED", e.IndexerError = "TRIEX_INDEXER_ERROR", e.UnexpectedResponse = "TRIEX_UNEXPECTED_RESPONSE", e.ValidationFailed = "TRIEX_VALIDATION_FAILED", e.InsufficientBalance = "TRIEX_INSUFFICIENT_BALANCE", e.CollectionMismatch = "TRIEX_COLLECTION_MISMATCH", e.BalanceManagerNotFound = "TRIEX_BALANCE_MANAGER_NOT_FOUND", e.PoolNotFound = "TRIEX_POOL_NOT_FOUND", e.HubNotFound = "TRIEX_HUB_NOT_FOUND", e.SolarSystemNotFound = "TRIEX_SOLAR_SYSTEM_NOT_FOUND", e.CharacterNotFound = "TRIEX_CHARACTER_NOT_FOUND", e.TransactionFailed = "TRIEX_TRANSACTION_FAILED", e.Timeout = "TRIEX_TIMEOUT", e.NotImplemented = "TRIEX_NOT_IMPLEMENTED", e;
32
32
  }({}), d = class extends Error {
33
33
  code;
34
34
  cause;
@@ -142,33 +142,33 @@ var ee = t.struct("MultiCoinBalance", {
142
142
  function ne(e) {
143
143
  return e && typeof e == "object" && "fields" in e ? e.fields : e;
144
144
  }
145
- function re(e) {
145
+ function x(e) {
146
146
  if (typeof e == "string") return e;
147
147
  if (e && typeof e == "object") {
148
148
  let t = e;
149
149
  if (typeof t.objectId == "string") return t.objectId;
150
150
  if (typeof t.id == "string") return t.id;
151
151
  if (typeof t.bytes == "string") return t.bytes;
152
- if (t.id) return re(t.id);
152
+ if (t.id) return x(t.id);
153
153
  }
154
154
  return null;
155
155
  }
156
- var x = (e) => e.core;
157
- function S(e) {
156
+ var S = (e) => e.core;
157
+ function C(e) {
158
158
  return "0x" + BigInt(e).toString(16).padStart(64, "0");
159
159
  }
160
- async function ie(e, t) {
161
- let { object: n } = await x(e).getObject({ objectId: t });
160
+ async function w(e, t) {
161
+ let { object: n } = await S(e).getObject({ objectId: t });
162
162
  return {
163
163
  objectId: n.objectId,
164
164
  version: n.version,
165
165
  digest: n.digest
166
166
  };
167
167
  }
168
- async function ae(e, t, n) {
168
+ async function re(e, t, n) {
169
169
  let r = 0n, i;
170
170
  for (let a = 0; a < 40; a++) {
171
- let a = await x(e).listCoins({
171
+ let a = await S(e).listCoins({
172
172
  owner: t,
173
173
  coinType: n,
174
174
  limit: 50,
@@ -180,13 +180,13 @@ async function ae(e, t, n) {
180
180
  }
181
181
  return r;
182
182
  }
183
- async function C(e, t, n) {
184
- let r = (await x(e).getObject({
183
+ async function T(e, t, n) {
184
+ let r = (await S(e).getObject({
185
185
  objectId: n,
186
186
  include: { json: !0 }
187
- }).catch(() => null))?.object?.json, i = re(ne(r?.balances)?.id);
187
+ }).catch(() => null))?.object?.json, i = x(ne(r?.balances)?.id);
188
188
  if (!i) return 0n;
189
- let a = `${t.triex}::balance_manager::BalanceKey<${t.credCoinType}>`, o = await x(e).getDynamicField({
189
+ let a = `${t.triex}::balance_manager::BalanceKey<${t.credCoinType}>`, o = await S(e).getDynamicField({
190
190
  parentId: i,
191
191
  name: {
192
192
  type: a,
@@ -195,8 +195,8 @@ async function C(e, t, n) {
195
195
  }).catch(() => null);
196
196
  return o ? BigInt(te.parse(o.dynamicField.value.bcs)) : 0n;
197
197
  }
198
- async function w(e, t, n, r, i) {
199
- let a = `${t.triex}::balance_manager::MultiCoinBalanceKey`, o = await x(e).getDynamicObjectField({
198
+ async function ie(e, t, n, r, i) {
199
+ let a = `${t.triex}::balance_manager::MultiCoinBalanceKey`, o = await S(e).getDynamicObjectField({
200
200
  parentId: n,
201
201
  name: {
202
202
  type: a,
@@ -214,8 +214,8 @@ async function w(e, t, n, r, i) {
214
214
  balance: BigInt(s.amount)
215
215
  };
216
216
  }
217
- async function T(e, n) {
218
- let r = `${n.triex}::registry::MultiCoinCollectionKey`, i = await x(e).getDynamicField({
217
+ async function ae(e, n) {
218
+ let r = `${n.triex}::registry::MultiCoinCollectionKey`, i = await S(e).getDynamicField({
219
219
  parentId: n.triexRegistry,
220
220
  name: {
221
221
  type: r,
@@ -225,10 +225,10 @@ async function T(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 oe(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
- let t = await x(e).listOwnedObjects({
231
+ let t = await S(e).listOwnedObjects({
232
232
  owner: n,
233
233
  type: i,
234
234
  limit: 50,
@@ -250,18 +250,18 @@ async function oe(e, t, n, r) {
250
250
  }
251
251
  return a;
252
252
  }
253
- async function E(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) {
257
- let r = `${t}::character::PlayerProfile`, i = (await x(e).listOwnedObjects({
257
+ let r = `${t}::character::PlayerProfile`, i = (await S(e).listOwnedObjects({
258
258
  owner: n,
259
259
  type: r,
260
260
  include: { json: !0 },
261
261
  limit: 1
262
262
  }).catch(() => null))?.objects?.[0]?.json, a = typeof i?.character_id == "string" ? i.character_id : null;
263
263
  if (!a) continue;
264
- let o = (await x(e).getObject({
264
+ let o = (await S(e).getObject({
265
265
  objectId: a,
266
266
  include: { json: !0 }
267
267
  }).catch(() => null))?.object?.json?.owner_cap_id;
@@ -272,13 +272,13 @@ async function E(e, t, n) {
272
272
  }
273
273
  return null;
274
274
  }
275
- async function D(e, t, n) {
276
- let r = (await x(e).getObject({
275
+ async function O(e, t, n) {
276
+ let r = (await S(e).getObject({
277
277
  objectId: t,
278
278
  include: { json: !0 }
279
279
  }).catch(() => null))?.object?.json?.owner_cap_id;
280
280
  if (typeof r != "string") return null;
281
- let i = (await x(e).getObject({ objectId: r }).catch(() => null))?.object?.owner;
281
+ let i = (await S(e).getObject({ objectId: r }).catch(() => null))?.object?.owner;
282
282
  if (!i || typeof i != "object") return null;
283
283
  let a = null;
284
284
  if (i.AddressOwner) {
@@ -286,7 +286,7 @@ async function D(e, t, n) {
286
286
  a = i.AddressOwner;
287
287
  } else i.ObjectOwner && (a = i.ObjectOwner);
288
288
  if (!a) return null;
289
- let o = (await x(e).getObject({
289
+ let o = (await S(e).getObject({
290
290
  objectId: a,
291
291
  include: { json: !0 }
292
292
  }).catch(() => null))?.object?.json;
@@ -298,8 +298,8 @@ async function D(e, t, n) {
298
298
  charOwnerCapId: s
299
299
  } : null;
300
300
  }
301
- async function O(e, n, r, i) {
302
- let a = await x(e).getDynamicField({
301
+ async function k(e, n, r, i) {
302
+ let a = await S(e).getDynamicField({
303
303
  parentId: n,
304
304
  name: {
305
305
  type: "0x2::object::ID",
@@ -307,7 +307,7 @@ async function O(e, n, r, i) {
307
307
  }
308
308
  }).catch(() => null);
309
309
  if (!a) return 0n;
310
- let o = (await x(e).getObject({
310
+ let o = (await S(e).getObject({
311
311
  objectId: a.dynamicField.fieldId,
312
312
  include: { json: !0 }
313
313
  }).catch(() => null))?.object?.json?.value?.items?.contents ?? [], s = 0n;
@@ -316,63 +316,63 @@ async function O(e, n, r, i) {
316
316
  }
317
317
  //#endregion
318
318
  //#region src/transactions.ts
319
- var se = /* @__PURE__ */ i({
320
- cancelAllOrdersItem: () => I,
321
- cancelOrderItem: () => F,
322
- depositCoin: () => j,
323
- depositMulticoinObject: () => ce,
324
- generateProofAsOwner: () => A,
325
- modifyOrderItem: () => L,
326
- newBalanceManager: () => k,
327
- placeLimitOrderItem: () => N,
328
- placeMarketOrderItem: () => P,
329
- redeemReceipt: () => fe,
330
- sourceItemsFromHangar: () => M,
331
- withdrawAllCoin: () => ue,
332
- withdrawAllMulticoin: () => de,
333
- withdrawCoin: () => le,
334
- withdrawSettledAmounts: () => R
319
+ var oe = /* @__PURE__ */ i({
320
+ cancelAllOrdersItem: () => N,
321
+ cancelOrderItem: () => he,
322
+ depositCoin: () => M,
323
+ depositMulticoinObject: () => se,
324
+ generateProofAsOwner: () => j,
325
+ modifyOrderItem: () => P,
326
+ newBalanceManager: () => A,
327
+ placeLimitOrderItem: () => pe,
328
+ placeMarketOrderItem: () => me,
329
+ redeemReceipt: () => de,
330
+ sourceItemsFromHangar: () => fe,
331
+ withdrawAllCoin: () => le,
332
+ withdrawAllMulticoin: () => ue,
333
+ withdrawCoin: () => ce,
334
+ withdrawSettledAmounts: () => F
335
335
  });
336
- function k(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 A(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 j(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 ce(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 le(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 ue(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 de(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 de(e, t, n, r, i) {
382
382
  ]
383
383
  });
384
384
  }
385
- function fe(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 fe(e, t, n, r) {
395
395
  ]
396
396
  });
397
397
  }
398
- function M(e, t, n, r) {
398
+ function fe(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 M(e, t, n, r) {
426
426
  arguments: [n, c]
427
427
  });
428
428
  }
429
- function N(e, t, n) {
429
+ function pe(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 N(e, t, n) {
444
444
  ]
445
445
  });
446
446
  }
447
- function P(e, t, n) {
447
+ function me(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 P(e, t, n) {
459
459
  ]
460
460
  });
461
461
  }
462
- function F(e, t, n) {
462
+ function he(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 F(e, t, n) {
472
472
  ]
473
473
  });
474
474
  }
475
- function I(e, t, n) {
475
+ function N(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 I(e, t, n) {
484
484
  ]
485
485
  });
486
486
  }
487
- function L(e, t, n) {
487
+ function P(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 L(e, t, n) {
498
498
  ]
499
499
  });
500
500
  }
501
- function R(e, t, n) {
501
+ function F(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 R(e, t, n) {
511
511
  }
512
512
  //#endregion
513
513
  //#region src/funding.ts
514
- async function z(e, t, n, r, i, a = "Insufficient wallet balance to fund this transaction.") {
514
+ async function I(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,23 +533,23 @@ async function z(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 B(e, t, n, r, i) {
536
+ async function L(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
- let s = i.deficitMode && i.balanceManagerId ? await w(e, n, i.balanceManagerId, i.vaultCollectionId, a) : {
539
+ let s = i.deficitMode && i.balanceManagerId ? await ie(e, n, i.balanceManagerId, i.vaultCollectionId, a) : {
540
540
  hasKey: !1,
541
541
  balance: 0n
542
542
  }, c = i.deficitMode ? o - s.balance : o;
543
543
  if (c <= 0n) return;
544
- let l = await oe(e, n, i.owner, { assetId: a.toString() }), f = (i.vaultCollectionId || await T(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
- ce(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([D(e, i.ssuObjectId, i.owner), E(e, n, i.owner)]), _ = async (o, s, c, l) => {
551
- let u = await ie(e, o);
552
- M(t, n, r, {
550
+ let [h, g] = await Promise.all([O(e, i.ssuObjectId, i.owner), D(e, n, i.owner)]), _ = async (o, s, c, l) => {
551
+ let u = await w(e, o);
552
+ fe(t, n, r, {
553
553
  ssuObjectId: i.ssuObjectId,
554
554
  characterId: c,
555
555
  capRef: u,
@@ -561,13 +561,13 @@ async function B(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([O(e, i.ssuObjectId, h.ssuOwnerCapId, a.toString()), O(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 O(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 B(e, t, n, r, i) {
581
581
  }
582
582
  //#endregion
583
583
  //#region src/money.ts
584
- var pe = 1000000000n, V = 1n, H = 1000000000n, me = 18446744073709551615n;
585
- function he(e, t) {
584
+ var ge = 1000000000n, R = 1n, z = 1000000000n, _e = 18446744073709551615n;
585
+ function ve(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 ge(e, t) {
591
+ function ye(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 U(e, t) {
596
- return e * t * V / 1n;
595
+ function B(e, t) {
596
+ return e * t * R / 1n;
597
597
  }
598
- function _e(e, t, n) {
599
- return U(e, t) * (H + n) / H;
598
+ function V(e, t, n) {
599
+ return B(e, t) * (z + n) / z;
600
600
  }
601
- function ve(e, t) {
602
- return e * t / H + 2n;
601
+ function be(e, t) {
602
+ return e * t / z + 2n;
603
603
  }
604
- function ye(e, t, n) {
604
+ function xe(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 / H;
611
+ let a = i * n / z;
612
612
  return {
613
613
  quote: i,
614
614
  fee: a,
@@ -618,7 +618,7 @@ function ye(e, t, n) {
618
618
  }
619
619
  //#endregion
620
620
  //#region src/schemas.ts
621
- var W = n.union([n.string(), n.number()]).transform((e, t) => {
621
+ var H = 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 W = n.union([n.string(), n.number()]).transform((e, t) => {
627
627
  message: `not an integer: ${e}`
628
628
  }), n.NEVER;
629
629
  }
630
- }), be = n.object({
630
+ }), Se = n.object({
631
631
  pool_id: n.string(),
632
632
  order_id: n.string(),
633
- price: W,
633
+ price: H,
634
634
  is_bid: n.boolean(),
635
635
  balance_manager_id: n.string(),
636
- remaining_quantity: W,
637
- filled_quantity: W,
636
+ remaining_quantity: H,
637
+ filled_quantity: H,
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 W = 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
- })), xe = n.object({
671
- data: n.array(be),
670
+ })), Ce = n.object({
671
+ data: n.array(Se),
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
- })), Se = n.object({ pool_id: n.string().nullable() }).transform((e) => ({ poolId: e.pool_id })), G = n.object({
678
+ })), we = n.object({ pool_id: n.string().nullable() }).transform((e) => ({ poolId: e.pool_id })), U = n.object({
679
679
  encodedOrderId: n.string(),
680
- quantity: W,
681
- filledQuantity: W,
682
- expireTimestamp: W,
683
- lastUpdatedTimestamp: W,
680
+ quantity: H,
681
+ filledQuantity: H,
682
+ expireTimestamp: H,
683
+ lastUpdatedTimestamp: H,
684
684
  status: n.number(),
685
- price: W
685
+ price: H
686
686
  }).transform((e) => ({
687
687
  orderId: e.encodedOrderId,
688
688
  quantity: e.quantity,
@@ -692,10 +692,10 @@ var W = n.union([n.string(), n.number()]).transform((e, t) => {
692
692
  lastUpdatedTimestamp: e.lastUpdatedTimestamp,
693
693
  status: e.status,
694
694
  price: e.price
695
- })), Ce = n.object({
696
- bids: n.array(G),
697
- asks: n.array(G)
698
- }), we = n.object({
695
+ })), Te = n.object({
696
+ bids: n.array(U),
697
+ asks: n.array(U)
698
+ }), Ee = n.object({
699
699
  pool_id: n.string(),
700
700
  pool_name: n.string(),
701
701
  base_asset_symbol: n.string(),
@@ -723,14 +723,14 @@ var W = n.union([n.string(), n.number()]).transform((e, t) => {
723
723
  collectionId: e.collection_id,
724
724
  feeRateScaled: e.fee === null ? 0n : BigInt(e.fee),
725
725
  feeRate: e.fee_rate
726
- })), Te = n.object({
726
+ })), De = n.object({
727
727
  hub_id: n.string(),
728
728
  collection_id: n.string(),
729
729
  vault_config_id: n.string().nullable(),
730
730
  pool_id: n.string().nullable(),
731
- metadata: we.nullable(),
732
- bids: n.array(G),
733
- asks: n.array(G)
731
+ metadata: Ee.nullable(),
732
+ bids: n.array(U),
733
+ asks: n.array(U)
734
734
  }).transform((e) => ({
735
735
  hubId: e.hub_id,
736
736
  collectionId: e.collection_id,
@@ -739,7 +739,7 @@ var W = n.union([n.string(), n.number()]).transform((e, t) => {
739
739
  metadata: e.metadata,
740
740
  bids: e.bids,
741
741
  asks: e.asks
742
- })), Ee = n.object({
742
+ })), Oe = n.object({
743
743
  hub_id: n.string(),
744
744
  collection_id: n.string(),
745
745
  vault_config_id: n.string()
@@ -747,7 +747,7 @@ var W = n.union([n.string(), n.number()]).transform((e, t) => {
747
747
  hubId: e.hub_id,
748
748
  collectionId: e.collection_id,
749
749
  vaultConfigId: e.vault_config_id
750
- })), K = {
750
+ })), W = {
751
751
  hub_id: n.string(),
752
752
  assembly_item_id: n.string(),
753
753
  assembly_tenant: n.string(),
@@ -763,7 +763,7 @@ var W = n.union([n.string(), n.number()]).transform((e, t) => {
763
763
  is_public: n.boolean(),
764
764
  region_id: n.number().nullable()
765
765
  };
766
- function q(e) {
766
+ function G(e) {
767
767
  return {
768
768
  hubId: e.hub_id,
769
769
  assemblyItemId: e.assembly_item_id,
@@ -781,35 +781,35 @@ function q(e) {
781
781
  regionId: e.region_id
782
782
  };
783
783
  }
784
- var De = n.object({
785
- ...K,
784
+ var ke = n.object({
785
+ ...W,
786
786
  solar_system_name: n.string().nullable()
787
787
  }).transform((e) => ({
788
- ...q(e),
788
+ ...G(e),
789
789
  solarSystemName: e.solar_system_name
790
- })), Oe = n.object({
791
- data: n.array(De),
790
+ })), Ae = n.object({
791
+ data: n.array(ke),
792
792
  next_cursor: n.string().nullable()
793
793
  }).transform((e) => ({
794
794
  locations: e.data,
795
795
  nextCursor: e.next_cursor
796
- })), ke = n.object({
797
- ...K,
796
+ })), je = n.object({
797
+ ...W,
798
798
  solar_system_name: n.string().nullable(),
799
799
  distance_ly: n.string()
800
800
  }).transform((e) => ({
801
- ...q(e),
801
+ ...G(e),
802
802
  solarSystemName: e.solar_system_name,
803
803
  distanceLy: e.distance_ly
804
- })), Ae = n.object({
805
- ...K,
804
+ })), Me = n.object({
805
+ ...W,
806
806
  pool_count: n.number(),
807
807
  last_activity_at: n.number().nullable()
808
808
  }).transform((e) => ({
809
- ...q(e),
809
+ ...G(e),
810
810
  poolCount: e.pool_count,
811
811
  lastActivityAt: e.last_activity_at
812
- })), je = n.object({
812
+ })), Ne = n.object({
813
813
  asset_id: n.string(),
814
814
  has_bids: n.boolean(),
815
815
  has_asks: n.boolean()
@@ -817,25 +817,25 @@ var De = n.object({
817
817
  assetId: e.asset_id,
818
818
  hasBids: e.has_bids,
819
819
  hasAsks: e.has_asks
820
- })), Me = n.object({
821
- data: n.array(je),
820
+ })), Pe = n.object({
821
+ data: n.array(Ne),
822
822
  next_cursor: n.string().nullable()
823
823
  }).transform((e) => ({
824
824
  items: e.data,
825
825
  nextCursor: e.next_cursor
826
- })), Ne = n.object({
826
+ })), Fe = n.object({
827
827
  hub_id: n.string(),
828
828
  collection_id: n.string()
829
829
  }).transform((e) => ({
830
830
  hubId: e.hub_id,
831
831
  collectionId: e.collection_id
832
- })), Pe = n.object({
832
+ })), Ie = n.object({
833
833
  assembly_id: n.string(),
834
834
  owner: n.string().nullable()
835
835
  }).transform((e) => ({
836
836
  assemblyId: e.assembly_id,
837
837
  owner: e.owner
838
- })), Fe = n.object({
838
+ })), Le = n.object({
839
839
  assembly_id: n.string(),
840
840
  owner: n.string().nullable(),
841
841
  owner_character_name: n.string().nullable(),
@@ -847,7 +847,7 @@ var De = n.object({
847
847
  ownerCharacterName: e.owner_character_name,
848
848
  ownerCharacterId: e.owner_character_id,
849
849
  assemblyName: e.assembly_name
850
- })), Ie = n.object({
850
+ })), Re = n.object({
851
851
  balance_manager_id: n.string(),
852
852
  owner: n.string().nullable(),
853
853
  owner_name: n.string().nullable(),
@@ -857,49 +857,125 @@ var De = n.object({
857
857
  owner: e.owner,
858
858
  ownerName: e.owner_name,
859
859
  rootOuId: e.root_ou_id
860
- })), Le = n.object({
860
+ })), ze = n.object({
861
861
  solar_system_id: n.number(),
862
862
  solar_system_name: n.string().nullable()
863
863
  }).transform((e) => ({
864
864
  solarSystemId: e.solar_system_id,
865
865
  solarSystemName: e.solar_system_name
866
- })), Re = n.object({
866
+ })), K = n.object({
867
+ x: n.string(),
868
+ y: n.string(),
869
+ z: n.string()
870
+ }).transform((e) => ({
871
+ x: e.x,
872
+ y: e.y,
873
+ z: e.z
874
+ })), Be = n.object({
875
+ solar_system_id: n.number(),
876
+ solar_system_name: n.string(),
877
+ location: K,
878
+ constellation_id: n.number().nullish(),
879
+ region_id: n.number().nullish()
880
+ }).transform((e) => ({
881
+ solarSystemId: e.solar_system_id,
882
+ solarSystemName: e.solar_system_name,
883
+ location: e.location,
884
+ constellationId: e.constellation_id ?? null,
885
+ regionId: e.region_id ?? null
886
+ })), Ve = n.object({
887
+ solar_system_id: n.number(),
888
+ distance_ly: n.string(),
889
+ solar_system_name: n.string().nullish(),
890
+ location: K.nullish()
891
+ }).transform((e) => ({
892
+ solarSystemId: e.solar_system_id,
893
+ distanceLy: e.distance_ly,
894
+ solarSystemName: e.solar_system_name ?? null,
895
+ location: e.location ?? null
896
+ })), He = n.object({
897
+ count: n.number(),
898
+ systems: n.array(Be)
899
+ }).transform((e) => ({
900
+ count: e.count,
901
+ systems: e.systems
902
+ })), Ue = n.object({
903
+ solar_system_id: n.number(),
904
+ solar_system_name: n.string(),
905
+ radius_ly: n.string(),
906
+ count: n.number(),
907
+ systems: n.array(Ve)
908
+ }).transform((e) => ({
909
+ originSolarSystemId: e.solar_system_id,
910
+ originSolarSystemName: e.solar_system_name,
911
+ radiusLy: e.radius_ly,
912
+ count: e.count,
913
+ systems: e.systems
914
+ })), We = n.object({
915
+ location: K,
916
+ radius_ly: n.string(),
917
+ count: n.number(),
918
+ systems: n.array(Ve)
919
+ }).transform((e) => ({
920
+ origin: e.location,
921
+ radiusLy: e.radius_ly,
922
+ count: e.count,
923
+ systems: e.systems
924
+ })), Ge = n.object({
925
+ solar_system_id: n.number(),
926
+ solar_system_name: n.string()
927
+ }).transform((e) => ({
928
+ solarSystemId: e.solar_system_id,
929
+ solarSystemName: e.solar_system_name
930
+ })), Ke = n.object({
931
+ count: n.number(),
932
+ systems: n.array(Ge)
933
+ }).transform((e) => ({
934
+ count: e.count,
935
+ systems: e.systems
936
+ })), qe = n.object({
937
+ total_systems: n.number(),
938
+ status: n.string()
939
+ }).transform((e) => ({
940
+ totalSystems: e.total_systems,
941
+ status: e.status
942
+ })), Je = n.object({
867
943
  asset_id: n.string(),
868
944
  quantity: n.number()
869
945
  }).transform((e) => ({
870
946
  assetId: e.asset_id,
871
947
  quantity: e.quantity
872
- })), ze = n.object({
948
+ })), Ye = n.object({
873
949
  output_quantity: n.number(),
874
- components: n.array(Re)
950
+ components: n.array(Je)
875
951
  }).transform((e) => ({
876
952
  outputQuantity: e.output_quantity,
877
953
  components: e.components
878
- })), Be = n.object({
954
+ })), Xe = n.object({
879
955
  asset_id: n.string(),
880
956
  name: n.string().nullable(),
881
957
  symbol: n.string().nullable(),
882
958
  mass: n.number(),
883
- recipes: n.array(ze)
959
+ recipes: n.array(Ye)
884
960
  }).transform((e) => ({
885
961
  assetId: e.asset_id,
886
962
  name: e.name,
887
963
  symbol: e.symbol,
888
964
  mass: e.mass,
889
965
  recipes: e.recipes
890
- })), Ve = n.object({ data: n.array(Be) }).transform((e) => ({ items: e.data })), J = n.object({
966
+ })), Ze = n.object({ data: n.array(Xe) }).transform((e) => ({ items: e.data })), q = n.object({
891
967
  asset_id: n.string(),
892
- amount: W
968
+ amount: H
893
969
  }).transform((e) => ({
894
970
  assetId: e.asset_id,
895
971
  amount: e.amount
896
- })), He = n.object({
972
+ })), Qe = n.object({
897
973
  storage_unit_id: n.string(),
898
974
  collection_id: n.string(),
899
- warehouse: n.array(J),
900
- marketplace: n.array(J),
901
- hangar: n.array(J),
902
- org_vaults: n.record(n.string(), n.array(J))
975
+ warehouse: n.array(q),
976
+ marketplace: n.array(q),
977
+ hangar: n.array(q),
978
+ org_vaults: n.record(n.string(), n.array(q))
903
979
  }).transform((e) => ({
904
980
  storageUnitId: e.storage_unit_id,
905
981
  collectionId: e.collection_id,
@@ -907,14 +983,14 @@ var De = n.object({
907
983
  marketplace: e.marketplace,
908
984
  hangar: e.hangar,
909
985
  orgVaults: e.org_vaults
910
- })), Ue = n.object({
986
+ })), $e = n.object({
911
987
  pool_id: n.string(),
912
988
  order_id: n.string(),
913
989
  encoded_order_id: n.string().optional(),
914
990
  side: n.enum(["buy", "sell"]),
915
- price: W,
916
- remaining_quantity: W,
917
- filled_quantity: W,
991
+ price: H,
992
+ remaining_quantity: H,
993
+ filled_quantity: H,
918
994
  expires_at: n.number(),
919
995
  updated_at: n.number(),
920
996
  asset_id: n.string(),
@@ -935,21 +1011,21 @@ var De = n.object({
935
1011
  storageUnitId: e.storage_unit_id,
936
1012
  quoteAssetSymbol: e.quote_asset_symbol,
937
1013
  quoteAssetDecimals: e.quote_asset_decimals
938
- })), We = n.object({
939
- data: n.array(Ue),
1014
+ })), et = n.object({
1015
+ data: n.array($e),
940
1016
  next_cursor: n.string().nullable()
941
1017
  }).transform((e) => ({
942
1018
  orders: e.data,
943
1019
  nextCursor: e.next_cursor
944
- })), Ge = n.object({
1020
+ })), tt = n.object({
945
1021
  event_digest: n.string(),
946
1022
  pool_id: n.string(),
947
1023
  order_id: n.string(),
948
1024
  counterparty_balance_manager_id: n.string(),
949
- price: W,
950
- base_quantity: W,
951
- quote_quantity: W,
952
- fee: W,
1025
+ price: H,
1026
+ base_quantity: H,
1027
+ quote_quantity: H,
1028
+ fee: H,
953
1029
  role: n.enum(["maker", "taker"]),
954
1030
  taker_is_bid: n.boolean(),
955
1031
  filled_at: n.number()
@@ -965,21 +1041,21 @@ var De = n.object({
965
1041
  role: e.role,
966
1042
  takerIsBid: e.taker_is_bid,
967
1043
  filledAt: e.filled_at
968
- })), Ke = n.object({
969
- data: n.array(Ge),
1044
+ })), nt = n.object({
1045
+ data: n.array(tt),
970
1046
  next_cursor: n.string().nullable()
971
1047
  }).transform((e) => ({
972
1048
  fills: e.data,
973
1049
  nextCursor: e.next_cursor
974
- })), qe = n.object({
1050
+ })), rt = n.object({
975
1051
  event_digest: n.string(),
976
1052
  pool_id: n.string(),
977
1053
  order_id: n.string(),
978
1054
  counterparty_balance_manager_id: n.string(),
979
- price: W,
980
- base_quantity: W,
981
- quote_quantity: W,
982
- fee: W,
1055
+ price: H,
1056
+ base_quantity: H,
1057
+ quote_quantity: H,
1058
+ fee: H,
983
1059
  role: n.enum(["maker", "taker"]),
984
1060
  side: n.enum(["buy", "sell"]),
985
1061
  traded_at: n.number(),
@@ -999,29 +1075,29 @@ var De = n.object({
999
1075
  tradedAt: e.traded_at,
1000
1076
  assetId: e.asset_id,
1001
1077
  storageUnitId: e.storage_unit_id
1002
- })), Je = n.object({
1003
- data: n.array(qe),
1078
+ })), it = n.object({
1079
+ data: n.array(rt),
1004
1080
  next_cursor: n.string().nullable()
1005
1081
  }).transform((e) => ({
1006
1082
  trades: e.data,
1007
1083
  nextCursor: e.next_cursor
1008
- })), Ye = n.object({
1009
- base: W,
1010
- quote: W,
1011
- cred: W
1084
+ })), at = n.object({
1085
+ base: H,
1086
+ quote: H,
1087
+ cred: H
1012
1088
  }).transform((e) => ({
1013
1089
  base: e.base,
1014
1090
  quote: e.quote,
1015
1091
  cred: e.cred
1016
- })), Xe = n.object({
1092
+ })), ot = n.object({
1017
1093
  pool_id: n.string(),
1018
1094
  collection_id: n.string(),
1019
1095
  asset_id: n.string(),
1020
1096
  quote_asset_id: n.string().nullable(),
1021
1097
  storage_unit_id: n.string(),
1022
1098
  vault_config_id: n.string(),
1023
- settled: Ye,
1024
- owed: Ye,
1099
+ settled: at,
1100
+ owed: at,
1025
1101
  open_order_count: n.number()
1026
1102
  }).transform((e) => ({
1027
1103
  poolId: e.pool_id,
@@ -1033,10 +1109,10 @@ var De = n.object({
1033
1109
  settled: e.settled,
1034
1110
  owed: e.owed,
1035
1111
  openOrderCount: e.open_order_count
1036
- })), Ze = n.object({
1112
+ })), st = n.object({
1037
1113
  collection_id: n.string(),
1038
1114
  asset_id: n.string(),
1039
- amount: W,
1115
+ amount: H,
1040
1116
  storage_unit_id: n.string(),
1041
1117
  vault_config_id: n.string()
1042
1118
  }).transform((e) => ({
@@ -1045,25 +1121,25 @@ var De = n.object({
1045
1121
  amount: e.amount,
1046
1122
  storageUnitId: e.storage_unit_id,
1047
1123
  vaultConfigId: e.vault_config_id
1048
- })), Qe = n.object({
1124
+ })), ct = n.object({
1049
1125
  balance_manager_id: n.string(),
1050
1126
  as_of_checkpoint: n.string().nullable(),
1051
- pools: n.array(Xe),
1052
- items: n.array(Ze)
1127
+ pools: n.array(ot),
1128
+ items: n.array(st)
1053
1129
  }).transform((e) => ({
1054
1130
  balanceManagerId: e.balance_manager_id,
1055
1131
  asOfCheckpoint: e.as_of_checkpoint,
1056
1132
  pools: e.pools,
1057
1133
  items: e.items
1058
1134
  }));
1059
- function Y(e, t, n) {
1135
+ function J(e, t, n) {
1060
1136
  let r = e.safeParse(t);
1061
1137
  if (!r.success) throw new d(u.UnexpectedResponse, `Unexpected indexer response for ${n}: ${r.error.message}`, r.error);
1062
1138
  return r.data;
1063
1139
  }
1064
1140
  //#endregion
1065
1141
  //#region src/queries.ts
1066
- var X = class {
1142
+ var Y = class {
1067
1143
  baseUrl;
1068
1144
  apiKey;
1069
1145
  constructor(e, t) {
@@ -1098,7 +1174,7 @@ var X = class {
1098
1174
  return await i.json();
1099
1175
  }
1100
1176
  async discovery(e) {
1101
- return Y(xe, await this.get("/v1/discovery", {
1177
+ return J(Ce, await this.get("/v1/discovery", {
1102
1178
  storage_unit_ids: e?.storageUnitIds?.join(","),
1103
1179
  asset_id: e?.assetId,
1104
1180
  balance_manager_id: e?.balanceManagerId,
@@ -1109,37 +1185,37 @@ var X = class {
1109
1185
  }), "discovery");
1110
1186
  }
1111
1187
  async resolvePool(e) {
1112
- return Y(Se, await this.get("/v1/pools/resolve", {
1188
+ return J(we, await this.get("/v1/pools/resolve", {
1113
1189
  collection_id: e.collectionId,
1114
1190
  asset_id: e.assetId,
1115
1191
  quote_type: e.quoteType
1116
1192
  }), "resolvePool").poolId;
1117
1193
  }
1118
1194
  async hubItemOrderbook(e) {
1119
- return Y(Te, await this.get(`/v1/hubs/${encodeURIComponent(e.hubId)}/items/${encodeURIComponent(e.assetId)}/orderbook`, { quote_type: e.quoteType }, u.HubNotFound), "hubItemOrderbook");
1195
+ return J(De, await this.get(`/v1/hubs/${encodeURIComponent(e.hubId)}/items/${encodeURIComponent(e.assetId)}/orderbook`, { quote_type: e.quoteType }, u.HubNotFound), "hubItemOrderbook");
1120
1196
  }
1121
1197
  async orderbook(e) {
1122
1198
  return {
1123
1199
  poolId: e,
1124
- ...Y(Ce, await this.get(`/v1/pools/${encodeURIComponent(e)}/orderbook`, void 0, u.PoolNotFound), "orderbook")
1200
+ ...J(Te, await this.get(`/v1/pools/${encodeURIComponent(e)}/orderbook`, void 0, u.PoolNotFound), "orderbook")
1125
1201
  };
1126
1202
  }
1127
1203
  async poolMetadata(e) {
1128
- return Y(we, await this.get(`/v1/pools/${encodeURIComponent(e)}/metadata`, void 0, u.PoolNotFound), "poolMetadata");
1204
+ return J(Ee, await this.get(`/v1/pools/${encodeURIComponent(e)}/metadata`, void 0, u.PoolNotFound), "poolMetadata");
1129
1205
  }
1130
1206
  async hubVault(e) {
1131
- return Y(Ee, await this.get(`/v1/hubs/${encodeURIComponent(e)}/vault`, void 0, u.HubNotFound), "hubVault");
1207
+ return J(Oe, await this.get(`/v1/hubs/${encodeURIComponent(e)}/vault`, void 0, u.HubNotFound), "hubVault");
1132
1208
  }
1133
1209
  async hubLocation(e) {
1134
1210
  try {
1135
- return Y(De, await this.get(`/v1/hubs/${encodeURIComponent(e)}/location`, void 0, u.HubNotFound), "hubLocation");
1211
+ return J(ke, await this.get(`/v1/hubs/${encodeURIComponent(e)}/location`, void 0, u.HubNotFound), "hubLocation");
1136
1212
  } catch (e) {
1137
1213
  if (e instanceof d && e.status === 404) return null;
1138
1214
  throw e;
1139
1215
  }
1140
1216
  }
1141
1217
  async hubLocations(e) {
1142
- return Y(Oe, await this.get("/v1/hubs/locations", {
1218
+ return J(Ae, await this.get("/v1/hubs/locations", {
1143
1219
  limit: e?.limit,
1144
1220
  cursor: e?.cursor,
1145
1221
  solar_system: e?.solarSystemId,
@@ -1148,7 +1224,7 @@ var X = class {
1148
1224
  }), "hubLocations");
1149
1225
  }
1150
1226
  async itemLocations(e, t) {
1151
- return Y(Oe, await this.get(`/v1/items/${encodeURIComponent(e)}/locations`, {
1227
+ return J(Ae, await this.get(`/v1/items/${encodeURIComponent(e)}/locations`, {
1152
1228
  limit: t?.limit,
1153
1229
  cursor: t?.cursor
1154
1230
  }), "itemLocations");
@@ -1158,7 +1234,7 @@ var X = class {
1158
1234
  range: e.rangeLy,
1159
1235
  type_id: e.assetId
1160
1236
  }, u.HubNotFound);
1161
- return Y(n.array(ke), t, "nearbyHubs");
1237
+ return J(n.array(je), t, "nearbyHubs");
1162
1238
  }
1163
1239
  async nearbyHubsBySystem(e) {
1164
1240
  let t = await this.get("/v1/hubs/nearby-by-system", {
@@ -1166,47 +1242,81 @@ var X = class {
1166
1242
  range: e.rangeLy,
1167
1243
  type_id: e.assetId
1168
1244
  });
1169
- return Y(n.array(ke), t, "nearbyHubsBySystem");
1245
+ return J(n.array(je), t, "nearbyHubsBySystem");
1170
1246
  }
1171
1247
  async hubsEnriched(e) {
1172
1248
  if (e.length === 0) return [];
1173
1249
  let t = await this.get("/v1/hubs/enriched", { ids: e.join(",") });
1174
- return Y(n.array(Ae), t, "hubsEnriched");
1250
+ return J(n.array(Me), t, "hubsEnriched");
1175
1251
  }
1176
1252
  async hubItems(e) {
1177
- return Y(Me, await this.get(`/v1/hubs/${encodeURIComponent(e)}/items`, void 0, u.HubNotFound), "hubItems");
1253
+ return J(Pe, await this.get(`/v1/hubs/${encodeURIComponent(e)}/items`, void 0, u.HubNotFound), "hubItems");
1178
1254
  }
1179
1255
  async searchItems(e, t) {
1180
- return Y(Ve, await this.get("/v1/world/items/search", {
1256
+ return J(Ze, await this.get("/v1/world/items/search", {
1181
1257
  q: e,
1182
1258
  limit: t
1183
1259
  }), "searchItems");
1184
1260
  }
1185
1261
  async collectionHub(e) {
1186
- return Y(Ne, await this.get(`/v1/collections/${encodeURIComponent(e)}/hub`, void 0, u.HubNotFound), "collectionHub");
1262
+ return J(Fe, await this.get(`/v1/collections/${encodeURIComponent(e)}/hub`, void 0, u.HubNotFound), "collectionHub");
1187
1263
  }
1188
1264
  async assemblyOwners(e) {
1189
1265
  if (e.length === 0) return [];
1190
1266
  let t = await this.get("/v1/assemblies/owners", { ids: e.join(",") });
1191
- return Y(n.array(Pe), t, "assemblyOwners");
1267
+ return J(n.array(Ie), t, "assemblyOwners");
1192
1268
  }
1193
1269
  async assembliesEnriched(e) {
1194
1270
  if (e.length === 0) return [];
1195
1271
  let t = await this.get("/v1/assemblies/enriched", { ids: e.join(",") });
1196
- return Y(n.array(Fe), t, "assembliesEnriched");
1272
+ return J(n.array(Le), t, "assembliesEnriched");
1197
1273
  }
1198
1274
  async balanceManagerOwners(e) {
1199
1275
  if (e.length === 0) return [];
1200
1276
  let t = await this.get("/v1/balance-managers/owners", { ids: e.join(",") });
1201
- return Y(n.array(Ie), t, "balanceManagerOwners");
1277
+ return J(n.array(Re), t, "balanceManagerOwners");
1202
1278
  }
1203
1279
  async solarSystemNames(e) {
1204
1280
  if (e.length === 0) return [];
1205
1281
  let t = await this.get("/v1/solar-systems/names", { ids: e.join(",") });
1206
- return Y(n.array(Le), t, "solarSystemNames");
1282
+ return J(n.array(ze), t, "solarSystemNames");
1283
+ }
1284
+ async solarSystem(e) {
1285
+ return J(Be, await this.get(`/v1/spatial/systems/${encodeURIComponent(e)}`, void 0, u.SolarSystemNotFound), "solarSystem");
1286
+ }
1287
+ async solarSystems(e) {
1288
+ if (+!!e.solarSystemIds?.length + +!!e.solarSystemNames?.length != 1) throw new d(u.ValidationFailed, "Batch system lookup takes exactly one of solarSystemIds or solarSystemNames.");
1289
+ return J(He, await this.get("/v1/spatial/systems", {
1290
+ solar_system_ids: e.solarSystemIds?.join(","),
1291
+ solar_system_names: e.solarSystemNames?.join(",")
1292
+ }), "solarSystems");
1293
+ }
1294
+ async nearbySystems(e) {
1295
+ return J(Ue, await this.get(`/v1/spatial/systems/${encodeURIComponent(e.solarSystem)}/nearby`, {
1296
+ radius_ly: e.radiusLy,
1297
+ limit: e.limit
1298
+ }, u.SolarSystemNotFound), "nearbySystems");
1299
+ }
1300
+ async systemsNearCoordinates(e) {
1301
+ return J(We, await this.get("/v1/spatial/coordinates/nearby", {
1302
+ x: e.x,
1303
+ y: e.y,
1304
+ z: e.z,
1305
+ radius_ly: e.radiusLy,
1306
+ limit: e.limit
1307
+ }), "systemsNearCoordinates");
1308
+ }
1309
+ async autocompleteSystems(e, t) {
1310
+ return J(Ke, await this.get("/v1/spatial/systems/search/autocomplete", {
1311
+ q: e,
1312
+ limit: t
1313
+ }), "autocompleteSystems");
1314
+ }
1315
+ async spatialStats() {
1316
+ return J(qe, await this.get("/v1/spatial/stats"), "spatialStats");
1207
1317
  }
1208
1318
  async inventoryBalances(e) {
1209
- return Y(He, await this.get("/v1/inventory/balances", {
1319
+ return J(Qe, await this.get("/v1/inventory/balances", {
1210
1320
  storage_unit_id: e.storageUnitId,
1211
1321
  owner_address: e.address,
1212
1322
  balance_manager_id: e.balanceManagerId,
@@ -1215,14 +1325,14 @@ var X = class {
1215
1325
  }, u.HubNotFound), "inventoryBalances");
1216
1326
  }
1217
1327
  async openOrders(e, t) {
1218
- return Y(We, await this.get(`/v1/balance-managers/${encodeURIComponent(e)}/open-orders`, {
1328
+ return J(et, await this.get(`/v1/balance-managers/${encodeURIComponent(e)}/open-orders`, {
1219
1329
  before: t?.before,
1220
1330
  after: t?.after,
1221
1331
  limit: t?.limit
1222
1332
  }, u.BalanceManagerNotFound), "openOrders");
1223
1333
  }
1224
1334
  async fills(e, t) {
1225
- return Y(Ke, await this.get(`/v1/balance-managers/${encodeURIComponent(e)}/fills`, {
1335
+ return J(nt, await this.get(`/v1/balance-managers/${encodeURIComponent(e)}/fills`, {
1226
1336
  before: t?.before,
1227
1337
  after: t?.after,
1228
1338
  limit: t?.limit,
@@ -1231,10 +1341,10 @@ var X = class {
1231
1341
  }, u.BalanceManagerNotFound), "fills");
1232
1342
  }
1233
1343
  async sweepable(e) {
1234
- return Y(Qe, await this.get(`/v1/balance-managers/${encodeURIComponent(e)}/sweepable`, void 0, u.BalanceManagerNotFound), "sweepable");
1344
+ return J(ct, await this.get(`/v1/balance-managers/${encodeURIComponent(e)}/sweepable`, void 0, u.BalanceManagerNotFound), "sweepable");
1235
1345
  }
1236
1346
  async trades(e, t) {
1237
- return Y(Je, await this.get(`/v1/balance-managers/${encodeURIComponent(e)}/trades`, {
1347
+ return J(it, await this.get(`/v1/balance-managers/${encodeURIComponent(e)}/trades`, {
1238
1348
  before: t?.before,
1239
1349
  after: t?.after,
1240
1350
  limit: t?.limit,
@@ -1242,7 +1352,7 @@ var X = class {
1242
1352
  asset_id: t?.assetId
1243
1353
  }, u.BalanceManagerNotFound), "trades");
1244
1354
  }
1245
- }, $e = class {
1355
+ }, lt = class {
1246
1356
  suiClient;
1247
1357
  ids;
1248
1358
  indexer;
@@ -1253,8 +1363,9 @@ var X = class {
1253
1363
  balances;
1254
1364
  market;
1255
1365
  orders;
1366
+ spatial;
1256
1367
  constructor(e) {
1257
- 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 tt(this), this.balances = new nt(this), this.market = new rt(this), this.orders = new it(this);
1368
+ this.suiClient = e.suiClient, this.executor = e.executor, this.address = e.address, this.ids = l(e.network ?? "testnet", e.packageIds), this.indexer = new Y(e.indexerUrl ?? "https://api.trinary.exchange", e.apiKey), this.account = new ut(this), this.balances = new dt(this), this.market = new ft(this), this.orders = new mt(this), this.spatial = new pt(this);
1258
1369
  }
1259
1370
  requireExecutor() {
1260
1371
  if (!this.executor) throw new d(u.ExecutorRequired, "This operation writes on-chain and requires an `executor`.");
@@ -1281,7 +1392,7 @@ var X = class {
1281
1392
  let n = await this.resolveBalanceManagerId(t), r = new e();
1282
1393
  return {
1283
1394
  tx: r,
1284
- bm: n ? r.object(n) : k(r, this.ids)[0],
1395
+ bm: n ? r.object(n) : A(r, this.ids)[0],
1285
1396
  existingBmId: n
1286
1397
  };
1287
1398
  }
@@ -1289,7 +1400,7 @@ var X = class {
1289
1400
  n || e.transferObjects([t], r);
1290
1401
  let i = await m(this.requireExecutor(), e);
1291
1402
  if (!n) {
1292
- let e = et(i);
1403
+ let e = X(i);
1293
1404
  e && this.rememberBalanceManagerId(e);
1294
1405
  }
1295
1406
  return Z(i);
@@ -1300,7 +1411,7 @@ var X = class {
1300
1411
  return t;
1301
1412
  }
1302
1413
  };
1303
- function et(e) {
1414
+ function X(e) {
1304
1415
  return g(e, "::balance_manager::BalanceManager")?.objectId ?? null;
1305
1416
  }
1306
1417
  function Z(e) {
@@ -1310,7 +1421,7 @@ function Z(e) {
1310
1421
  raw: e.raw
1311
1422
  };
1312
1423
  }
1313
- var tt = class {
1424
+ var ut = class {
1314
1425
  c;
1315
1426
  constructor(e) {
1316
1427
  this.c = e;
@@ -1328,9 +1439,9 @@ var tt = class {
1328
1439
  balanceManagerId: r,
1329
1440
  created: !1
1330
1441
  };
1331
- let i = this.c.requireExecutor(), a = new e(), o = k(a, this.c.ids);
1442
+ let i = this.c.requireExecutor(), a = new e(), o = A(a, this.c.ids);
1332
1443
  a.transferObjects([o], n);
1333
- let s = et(await m(i, a));
1444
+ let s = X(await m(i, a));
1334
1445
  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).");
1335
1446
  return this.c.rememberBalanceManagerId(s), {
1336
1447
  balanceManagerId: s,
@@ -1341,14 +1452,14 @@ var tt = class {
1341
1452
  if (e.amount <= 0n) throw new d(u.ValidationFailed, "Deposit amount must be positive.");
1342
1453
  let t = this.c.requireAddress();
1343
1454
  this.c.requireExecutor();
1344
- let { tx: n, bm: r, existingBmId: i } = await this.c.beginBmTx(t), a = await z(this.c.suiClient, n, t, this.c.ids.credCoinType, e.amount, "Insufficient CRED in the wallet for this deposit.");
1345
- return j(n, this.c.ids, r, a), this.c.finishBmTx(n, r, i, t);
1455
+ let { tx: n, bm: r, existingBmId: i } = await this.c.beginBmTx(t), a = await I(this.c.suiClient, n, t, this.c.ids.credCoinType, e.amount, "Insufficient CRED in the wallet for this deposit.");
1456
+ return M(n, this.c.ids, r, a), this.c.finishBmTx(n, r, i, t);
1346
1457
  }
1347
1458
  async depositItems(e) {
1348
1459
  let t = this.c.requireAddress();
1349
1460
  this.c.requireExecutor();
1350
- let n = await this.c.indexer.hubVault(e.storageUnitId), r = S(e.storageUnitId), { tx: i, bm: a, existingBmId: o } = await this.c.beginBmTx(t);
1351
- for (let s of e.items) await B(this.c.suiClient, i, this.c.ids, a, {
1461
+ let n = await this.c.indexer.hubVault(e.storageUnitId), r = C(e.storageUnitId), { tx: i, bm: a, existingBmId: o } = await this.c.beginBmTx(t);
1462
+ for (let s of e.items) await L(this.c.suiClient, i, this.c.ids, a, {
1352
1463
  owner: t,
1353
1464
  ssuObjectId: r,
1354
1465
  vaultConfigId: n.vaultConfigId,
@@ -1361,20 +1472,20 @@ var tt = class {
1361
1472
  return this.c.finishBmTx(i, a, o, t);
1362
1473
  }
1363
1474
  async withdrawCurrency(t) {
1364
- 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 ? ue(a, this.c.ids, o) : le(a, this.c.ids, o, t.amount);
1475
+ 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);
1365
1476
  return a.transferObjects([s], n), Z(await m(i, a));
1366
1477
  }
1367
1478
  async withdrawItems(t) {
1368
- let n = this.c.requireAddress(), r = await this.c.requireBalanceManagerId(n), i = this.c.requireExecutor(), a = await this.c.indexer.hubVault(t.storageUnitId), o = S(t.storageUnitId), s = t.characterId;
1479
+ let n = this.c.requireAddress(), r = await this.c.requireBalanceManagerId(n), i = this.c.requireExecutor(), a = await this.c.indexer.hubVault(t.storageUnitId), o = C(t.storageUnitId), s = t.characterId;
1369
1480
  if (!s) {
1370
- let e = await E(this.c.suiClient, this.c.ids, n);
1481
+ let e = await D(this.c.suiClient, this.c.ids, n);
1371
1482
  if (!e) throw new d(u.CharacterNotFound, `No on-chain character resolved for ${n} — pass characterId explicitly.`);
1372
1483
  s = e.characterId;
1373
1484
  }
1374
- let c = await D(this.c.suiClient, o, n), l = new e(), f = l.object(r);
1485
+ let c = await O(this.c.suiClient, o, n), l = new e(), f = l.object(r);
1375
1486
  for (let e of t.items) {
1376
- let t = de(l, this.c.ids, f, a.collectionId, BigInt(e.assetId));
1377
- fe(l, this.c.ids, t, {
1487
+ let t = ue(l, this.c.ids, f, a.collectionId, BigInt(e.assetId));
1488
+ de(l, this.c.ids, t, {
1378
1489
  ssuObjectId: o,
1379
1490
  characterId: s,
1380
1491
  vaultConfigId: a.vaultConfigId,
@@ -1397,8 +1508,8 @@ var tt = class {
1397
1508
  poolId: e.poolId,
1398
1509
  quoteCoinType: e.quoteAssetId ?? void 0
1399
1510
  })), a.length === 0) throw new d(u.ValidationFailed, "Nothing settled to claim — no pools with claimable balances.");
1400
- let o = new e(), s = o.object(r), c = A(o, this.c.ids, s)[0];
1401
- for (let e of a) R(o, this.c.ids, {
1511
+ let o = new e(), s = o.object(r), c = j(o, this.c.ids, s)[0];
1512
+ for (let e of a) F(o, this.c.ids, {
1402
1513
  poolId: e.poolId,
1403
1514
  bm: s,
1404
1515
  proof: c,
@@ -1406,14 +1517,14 @@ var tt = class {
1406
1517
  });
1407
1518
  return Z(await m(i, o));
1408
1519
  }
1409
- }, nt = class {
1520
+ }, dt = class {
1410
1521
  c;
1411
1522
  constructor(e) {
1412
1523
  this.c = e;
1413
1524
  }
1414
1525
  async atHub(e) {
1415
1526
  let t = e.address ?? this.c.requireAddress(), n = await this.c.resolveBalanceManagerId(t) ?? void 0, r = e.inventoryKey;
1416
- return !r && e.includeHangar && (r = (await E(this.c.suiClient, this.c.ids, t))?.ownerCapId), this.c.indexer.inventoryBalances({
1527
+ return !r && e.includeHangar && (r = (await D(this.c.suiClient, this.c.ids, t))?.ownerCapId), this.c.indexer.inventoryBalances({
1417
1528
  ...e,
1418
1529
  address: t,
1419
1530
  balanceManagerId: n,
@@ -1421,14 +1532,14 @@ var tt = class {
1421
1532
  });
1422
1533
  }
1423
1534
  async currency(e) {
1424
- let t = this.c.requireAddress(e), [n, r] = await Promise.all([ae(this.c.suiClient, t, this.c.ids.credCoinType), this.c.resolveBalanceManagerId(t)]);
1535
+ let t = this.c.requireAddress(e), [n, r] = await Promise.all([re(this.c.suiClient, t, this.c.ids.credCoinType), this.c.resolveBalanceManagerId(t)]);
1425
1536
  return {
1426
1537
  wallet: n,
1427
- balanceManager: r ? await C(this.c.suiClient, this.c.ids, r) : 0n,
1538
+ balanceManager: r ? await T(this.c.suiClient, this.c.ids, r) : 0n,
1428
1539
  balanceManagerId: r
1429
1540
  };
1430
1541
  }
1431
- }, rt = class {
1542
+ }, ft = class {
1432
1543
  c;
1433
1544
  constructor(e) {
1434
1545
  this.c = e;
@@ -1497,7 +1608,30 @@ var tt = class {
1497
1608
  solarSystemNames(e) {
1498
1609
  return this.c.indexer.solarSystemNames(e.solarSystemIds);
1499
1610
  }
1500
- }, it = class {
1611
+ }, pt = class {
1612
+ c;
1613
+ constructor(e) {
1614
+ this.c = e;
1615
+ }
1616
+ system(e) {
1617
+ return this.c.indexer.solarSystem(e);
1618
+ }
1619
+ systems(e) {
1620
+ return this.c.indexer.solarSystems(e);
1621
+ }
1622
+ nearbySystems(e) {
1623
+ return this.c.indexer.nearbySystems(e);
1624
+ }
1625
+ systemsNearCoordinates(e) {
1626
+ return this.c.indexer.systemsNearCoordinates(e);
1627
+ }
1628
+ autocompleteSystems(e, t) {
1629
+ return this.c.indexer.autocompleteSystems(e, t?.limit);
1630
+ }
1631
+ stats() {
1632
+ return this.c.indexer.spatialStats();
1633
+ }
1634
+ }, mt = class {
1501
1635
  c;
1502
1636
  constructor(e) {
1503
1637
  this.c = e;
@@ -1507,9 +1641,9 @@ var tt = class {
1507
1641
  let t = this.c.requireAddress();
1508
1642
  this.c.requireExecutor();
1509
1643
  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);
1510
- if (!n) await B(this.c.suiClient, a, this.c.ids, o, {
1644
+ if (!n) await L(this.c.suiClient, a, this.c.ids, o, {
1511
1645
  owner: t,
1512
- ssuObjectId: S(e.storageUnitId),
1646
+ ssuObjectId: C(e.storageUnitId),
1513
1647
  vaultConfigId: r.vaultConfigId,
1514
1648
  vaultCollectionId: r.collectionId,
1515
1649
  assetId: BigInt(e.assetId),
@@ -1521,13 +1655,13 @@ var tt = class {
1521
1655
  let n = e.quoteDeposit;
1522
1656
  if (n === void 0) {
1523
1657
  let t = await this.c.indexer.poolMetadata(i);
1524
- n = _e(e.price, e.quantity, t.feeRateScaled);
1658
+ n = V(e.price, e.quantity, t.feeRateScaled);
1525
1659
  }
1526
1660
  if (n <= 0n) throw new d(u.ValidationFailed, "Invalid quote deposit amount.");
1527
1661
  await this.depositQuoteDeficit(a, o, s, t, n);
1528
1662
  }
1529
- let c = A(a, this.c.ids, o)[0];
1530
- return N(a, this.c.ids, {
1663
+ let c = j(a, this.c.ids, o)[0];
1664
+ return pe(a, this.c.ids, {
1531
1665
  poolId: i,
1532
1666
  bm: o,
1533
1667
  proof: c,
@@ -1544,9 +1678,9 @@ var tt = class {
1544
1678
  let t = this.c.requireAddress();
1545
1679
  this.c.requireExecutor();
1546
1680
  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);
1547
- if (!n) await B(this.c.suiClient, a, this.c.ids, o, {
1681
+ if (!n) await L(this.c.suiClient, a, this.c.ids, o, {
1548
1682
  owner: t,
1549
- ssuObjectId: S(e.storageUnitId),
1683
+ ssuObjectId: C(e.storageUnitId),
1550
1684
  vaultConfigId: r.vaultConfigId,
1551
1685
  vaultCollectionId: r.collectionId,
1552
1686
  assetId: BigInt(e.assetId),
@@ -1556,11 +1690,11 @@ var tt = class {
1556
1690
  });
1557
1691
  else {
1558
1692
  if (!e.quoteBudget || e.quoteBudget <= 0n) throw new d(u.ValidationFailed, "Market buys require `quoteBudget` (see estimateMarketBuyCost).");
1559
- let n = await this.c.indexer.poolMetadata(i), r = e.quoteBudget + ve(e.quantity, n.feeRateScaled);
1693
+ let n = await this.c.indexer.poolMetadata(i), r = e.quoteBudget + be(e.quantity, n.feeRateScaled);
1560
1694
  await this.depositQuoteDeficit(a, o, s, t, r);
1561
1695
  }
1562
- let c = A(a, this.c.ids, o)[0];
1563
- return P(a, this.c.ids, {
1696
+ let c = j(a, this.c.ids, o)[0];
1697
+ return me(a, this.c.ids, {
1564
1698
  poolId: i,
1565
1699
  bm: o,
1566
1700
  proof: c,
@@ -1570,8 +1704,8 @@ var tt = class {
1570
1704
  }), this.c.finishBmTx(a, o, s, t);
1571
1705
  }
1572
1706
  async cancel(e) {
1573
- let { tx: t, bm: n, poolId: r, execute: i } = await this.beginCancelTx(e), a = A(t, this.c.ids, n)[0];
1574
- return F(t, this.c.ids, {
1707
+ let { tx: t, bm: n, poolId: r, execute: i } = await this.beginCancelTx(e), a = j(t, this.c.ids, n)[0];
1708
+ return he(t, this.c.ids, {
1575
1709
  poolId: r,
1576
1710
  bm: n,
1577
1711
  proof: a,
@@ -1579,8 +1713,8 @@ var tt = class {
1579
1713
  }), i();
1580
1714
  }
1581
1715
  async cancelAll(e) {
1582
- let { tx: t, bm: n, poolId: r, execute: i } = await this.beginCancelTx(e), a = A(t, this.c.ids, n)[0];
1583
- return I(t, this.c.ids, {
1716
+ let { tx: t, bm: n, poolId: r, execute: i } = await this.beginCancelTx(e), a = j(t, this.c.ids, n)[0];
1717
+ return N(t, this.c.ids, {
1584
1718
  poolId: r,
1585
1719
  bm: n,
1586
1720
  proof: a
@@ -1588,8 +1722,8 @@ var tt = class {
1588
1722
  }
1589
1723
  async modify(e) {
1590
1724
  if (e.newQuantity <= 0n) throw new d(u.ValidationFailed, "Modified quantity must be positive.");
1591
- let { tx: t, bm: n, poolId: r, execute: i } = await this.beginCancelTx(e), a = A(t, this.c.ids, n)[0];
1592
- return L(t, this.c.ids, {
1725
+ let { tx: t, bm: n, poolId: r, execute: i } = await this.beginCancelTx(e), a = j(t, this.c.ids, n)[0];
1726
+ return P(t, this.c.ids, {
1593
1727
  poolId: r,
1594
1728
  bm: n,
1595
1729
  proof: a,
@@ -1630,10 +1764,10 @@ var tt = class {
1630
1764
  return n;
1631
1765
  }
1632
1766
  async depositQuoteDeficit(e, t, n, r, i) {
1633
- let a = n ? await C(this.c.suiClient, this.c.ids, n) : 0n, o = i > a ? i - a : 0n;
1767
+ let a = n ? await T(this.c.suiClient, this.c.ids, n) : 0n, o = i > a ? i - a : 0n;
1634
1768
  if (o === 0n) return;
1635
- let s = await z(this.c.suiClient, e, r, this.c.ids.credCoinType, o, "Insufficient CRED to fund the balance manager for this order.");
1636
- j(e, this.c.ids, t, s);
1769
+ let s = await I(this.c.suiClient, e, r, this.c.ids.credCoinType, o, "Insufficient CRED to fund the balance manager for this order.");
1770
+ M(e, this.c.ids, t, s);
1637
1771
  }
1638
1772
  async beginCancelTx(t) {
1639
1773
  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();
@@ -1644,11 +1778,11 @@ var tt = class {
1644
1778
  execute: async () => Z(await m(i, s))
1645
1779
  };
1646
1780
  }
1647
- }, at = class {
1781
+ }, ht = class {
1648
1782
  ids;
1649
1783
  indexer;
1650
1784
  constructor(e) {
1651
- this.ids = l(e.network ?? "testnet", e.packageIds), this.indexer = new X(e.indexerUrl ?? "https://api.trinary.exchange", e.apiKey);
1785
+ this.ids = l(e.network ?? "testnet", e.packageIds), this.indexer = new Y(e.indexerUrl ?? "https://api.trinary.exchange", e.apiKey);
1652
1786
  }
1653
1787
  discover(e) {
1654
1788
  return this.indexer.discovery(e);
@@ -1717,6 +1851,24 @@ var tt = class {
1717
1851
  accountOwners(e) {
1718
1852
  return this.indexer.balanceManagerOwners(e.balanceManagerIds);
1719
1853
  }
1854
+ spatialSystem(e) {
1855
+ return this.indexer.solarSystem(e);
1856
+ }
1857
+ spatialSystems(e) {
1858
+ return this.indexer.solarSystems(e);
1859
+ }
1860
+ spatialNearbySystems(e) {
1861
+ return this.indexer.nearbySystems(e);
1862
+ }
1863
+ spatialSystemsNearCoordinates(e) {
1864
+ return this.indexer.systemsNearCoordinates(e);
1865
+ }
1866
+ spatialAutocompleteSystems(e, t) {
1867
+ return this.indexer.autocompleteSystems(e, t?.limit);
1868
+ }
1869
+ spatialStats() {
1870
+ return this.indexer.spatialStats();
1871
+ }
1720
1872
  balancesAtHub(e) {
1721
1873
  return this.indexer.inventoryBalances(e);
1722
1874
  }
@@ -1735,7 +1887,7 @@ var tt = class {
1735
1887
  };
1736
1888
  //#endregion
1737
1889
  //#region src/book.ts
1738
- function ot(e) {
1890
+ function gt(e) {
1739
1891
  let t = [];
1740
1892
  for (let n of e) {
1741
1893
  let e = t[t.length - 1];
@@ -1753,11 +1905,11 @@ function Q(e) {
1753
1905
  function $(e) {
1754
1906
  return e.asks[0] ?? null;
1755
1907
  }
1756
- function st(e) {
1908
+ function _t(e) {
1757
1909
  let t = Q(e), n = $(e);
1758
1910
  return !t || !n ? null : (t.price + n.price) / 2n;
1759
1911
  }
1760
- function ct(e) {
1912
+ function vt(e) {
1761
1913
  let t = Q(e), n = $(e);
1762
1914
  if (!t || !n) return null;
1763
1915
  let r = n.price - t.price, i = (t.price + n.price) / 2n;
@@ -1769,19 +1921,19 @@ function ct(e) {
1769
1921
  bps: Number(r * 10000n / i)
1770
1922
  };
1771
1923
  }
1772
- function lt(e) {
1924
+ function yt(e) {
1773
1925
  let t = 0n;
1774
1926
  for (let n of e) t += n.remainingQuantity;
1775
1927
  return t;
1776
1928
  }
1777
- function ut(e) {
1929
+ function bt(e) {
1778
1930
  let t = 0n, n = 0n;
1779
1931
  for (let r of e) t += r.baseQuantity, n += r.quoteQuantity;
1780
1932
  return t === 0n ? null : n / t;
1781
1933
  }
1782
1934
  //#endregion
1783
1935
  //#region src/paging.ts
1784
- async function* dt(e, t, n) {
1936
+ async function* xt(e, t, n) {
1785
1937
  let r = n?.maxItems ?? 1e4, i = t?.cursor, a = 0;
1786
1938
  for (;;) {
1787
1939
  let n = await e.discovery({
@@ -1793,7 +1945,7 @@ async function* dt(e, t, n) {
1793
1945
  i = n.nextCursor;
1794
1946
  }
1795
1947
  }
1796
- async function* ft(e, t, n, r) {
1948
+ async function* St(e, t, n, r) {
1797
1949
  let i = r?.maxItems ?? 1e4, a = n?.before, o = 0;
1798
1950
  for (;;) {
1799
1951
  let r = await e.fills(t, {
@@ -1805,7 +1957,7 @@ async function* ft(e, t, n, r) {
1805
1957
  a = r.fills[r.fills.length - 1].filledAt;
1806
1958
  }
1807
1959
  }
1808
- async function* pt(e, t, n, r) {
1960
+ async function* Ct(e, t, n, r) {
1809
1961
  let i = r?.maxItems ?? 1e4, a = n?.before, o = 0;
1810
1962
  for (;;) {
1811
1963
  let r = await e.trades(t, {
@@ -1819,7 +1971,7 @@ async function* pt(e, t, n, r) {
1819
1971
  }
1820
1972
  //#endregion
1821
1973
  //#region src/wait.ts
1822
- async function mt(e, t) {
1974
+ async function wt(e, t) {
1823
1975
  let n = t?.timeoutMs ?? 3e4, r = t?.intervalMs ?? 2e3, i = Date.now() + n;
1824
1976
  for (;;) {
1825
1977
  let a = await e();
@@ -1829,4 +1981,4 @@ async function mt(e, t) {
1829
1981
  }
1830
1982
  }
1831
1983
  //#endregion
1832
- export { o as CLOCK_ID, a as DEFAULT_INDEXER_URL, H as FEE_RATE_SCALING, me as GTC_EXPIRE, X as IndexerClient, V as MULTICOIN_PRICE_SCALING, c as NETWORK_PRESETS, at as ReadOnlyClient, s as STILLNESS_PACKAGE_IDS, pe as TRIEX_PRICE_SCALING, $e as TriexClient, d as TriexClientError, u as TriexError, ot as aggregateLevels, $ as bestAsk, Q as bestBid, _e as computeBidQuoteDeposit, U as computeItemQuote, lt as depth, ye as estimateMarketBuyCost, m as executeAndNormalize, p as explainMoveAbort, E as fetchCharacterInfo, O as fetchInventorySlotQuantity, D as fetchSsuOwnerInfo, g as findCreatedObject, oe as findOwnedItemReceipts, ge as fromBase, C as getBalanceManagerCurrencyBalance, w as getBalanceManagerItemBalance, ie as getObjectRef, T as getRegistryMulticoinCollectionId, ae as getWalletCurrencyBalance, dt as iterateDiscovery, ft as iterateFills, pt as iterateTrades, ve as marketBuyRoundingBuffer, st as midPrice, h as normalizeExecuteResult, z as prepareWalletCoinInput, l as resolvePackageIds, B as sourceItemsIntoBalanceManager, ct as spread, he as toBase, S as toSsuObjectId, se as transactions, mt as untilIndexed, ut as vwap };
1984
+ export { o as CLOCK_ID, a as DEFAULT_INDEXER_URL, z as FEE_RATE_SCALING, _e as GTC_EXPIRE, Y as IndexerClient, R as MULTICOIN_PRICE_SCALING, c as NETWORK_PRESETS, ht as ReadOnlyClient, s as STILLNESS_PACKAGE_IDS, ge as TRIEX_PRICE_SCALING, lt as TriexClient, d as TriexClientError, u as TriexError, gt as aggregateLevels, $ as bestAsk, Q as bestBid, V as computeBidQuoteDeposit, B as computeItemQuote, yt as depth, xe as estimateMarketBuyCost, m as executeAndNormalize, p as explainMoveAbort, D as fetchCharacterInfo, k as fetchInventorySlotQuantity, O as fetchSsuOwnerInfo, g as findCreatedObject, E as findOwnedItemReceipts, ye as fromBase, T as getBalanceManagerCurrencyBalance, ie as getBalanceManagerItemBalance, w as getObjectRef, ae as getRegistryMulticoinCollectionId, re as getWalletCurrencyBalance, xt as iterateDiscovery, St as iterateFills, Ct as iterateTrades, be as marketBuyRoundingBuffer, _t as midPrice, h as normalizeExecuteResult, I as prepareWalletCoinInput, l as resolvePackageIds, L as sourceItemsIntoBalanceManager, vt as spread, ve as toBase, C as toSsuObjectId, oe as transactions, wt as untilIndexed, bt as vwap };