@mysten/deepbook-v3 1.0.12 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @mysten/deepbook-v3
2
2
 
3
+ ## 1.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 380d5b1: Fix getMarginManagerBalanceManagerId
8
+
9
+ ## 1.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 0be1a79: Add support for custom networks (localnet, devnet) via optional `packageIds` parameter
14
+
15
+ ### Patch Changes
16
+
17
+ - 9382cd7: Validations for custom package configs
18
+ - Updated dependencies [9ab9a50]
19
+ - Updated dependencies [1c97aa2]
20
+ - @mysten/sui@2.5.0
21
+
3
22
  ## 1.0.12
4
23
 
5
24
  ### Patch Changes
package/dist/client.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { BalanceManager, CanPlaceLimitOrderParams, CanPlaceMarketOrderParams, MarginManager } from "./types/index.mjs";
2
- import { CoinMap, PoolMap } from "./utils/constants.mjs";
2
+ import { CoinMap, DeepbookPackageIds, PoolMap } from "./utils/constants.mjs";
3
3
  import { BalanceManagerContract } from "./transactions/balanceManager.mjs";
4
4
  import { DeepBookContract } from "./transactions/deepbook.mjs";
5
5
  import { DeepBookAdminContract } from "./transactions/deepbookAdmin.mjs";
@@ -31,6 +31,11 @@ interface DeepBookOptions<Name = 'deepbook'> {
31
31
  adminCap?: string;
32
32
  marginAdminCap?: string;
33
33
  marginMaintainerCap?: string;
34
+ packageIds?: DeepbookPackageIds;
35
+ pyth?: {
36
+ pythStateId: string;
37
+ wormholeStateId: string;
38
+ };
34
39
  name?: Name;
35
40
  }
36
41
  interface DeepBookClientOptions extends DeepBookOptions {
@@ -72,7 +77,9 @@ declare class DeepBookClient {
72
77
  pools,
73
78
  adminCap,
74
79
  marginAdminCap,
75
- marginMaintainerCap
80
+ marginMaintainerCap,
81
+ packageIds,
82
+ pyth
76
83
  }: DeepBookClientOptions);
77
84
  /**
78
85
  * @description Check the balance of a balance manager for a specific coin
@@ -563,10 +570,10 @@ declare class DeepBookClient {
563
570
  getMarginManagerHasBaseDebt(marginManagerKey: string): Promise<boolean>;
564
571
  /**
565
572
  * @description Get the balance manager ID for a margin manager
566
- * @param {string} marginManagerKey The key to identify the margin manager
573
+ * @param {string} marginManagerAddress The object ID of the margin manager
567
574
  * @returns {Promise<string>} The balance manager ID
568
575
  */
569
- getMarginManagerBalanceManagerId(marginManagerKey: string): Promise<string>;
576
+ getMarginManagerBalanceManagerId(marginManagerAddress: string): Promise<string>;
570
577
  /**
571
578
  * @description Calculate assets (base and quote) for a margin manager
572
579
  * @param {string} marginManagerKey The key to identify the margin manager
@@ -677,27 +684,6 @@ declare class DeepBookClient {
677
684
  quote: string;
678
685
  deep: string;
679
686
  }>>;
680
- /**
681
- * @description Get account order details for a margin manager.
682
- * This retrieves the balance manager from the margin manager and returns order details.
683
- * @param {string} marginManagerKey The key to identify the margin manager
684
- * @returns {Promise<Array>} Array of order details
685
- */
686
- getMarginAccountOrderDetails(marginManagerKey: string): Promise<{
687
- balance_manager_id: string;
688
- order_id: string;
689
- client_order_id: string;
690
- quantity: string;
691
- filled_quantity: string;
692
- fee_is_deep: boolean;
693
- order_deep_price: {
694
- asset_is_base: boolean;
695
- deep_per_asset: string;
696
- };
697
- epoch: string;
698
- status: number;
699
- expire_timestamp: string;
700
- }[]>;
701
687
  /**
702
688
  * @description Get all conditional order IDs for a margin manager
703
689
  * @param {string} marginManagerKey The key to identify the margin manager
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.mts","names":[],"sources":["../src/client.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;;UAsCiB,wBAAA,SAAiC;AAAjC,UAEA,eAFyB,CAAA,OAAA,UAAQ,CAAA,CAAA;EAEjC,OAAA,EAAA,MAAA;EAEmB,eAAA,CAAA,EAAA;IACD,CAAA,GAAA,EAAA,MAAA,CA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CAkBjB;;;;;;;;;;2BAyBV;;;;;;2BAmBA;;;;;;6BAkBE,2BAA2B;;;;;;8BAkB1B,4BAA4B;;;;;;;6DAmBG;;;;;;;;;oGA0B9D"}
package/dist/client.mjs CHANGED
@@ -46,7 +46,7 @@ var DeepBookClient = class {
46
46
  /**
47
47
  * Creates a new DeepBookClient instance
48
48
  */
49
- constructor({ client, address, network, balanceManagers, marginManagers, coins, pools, adminCap, marginAdminCap, marginMaintainerCap }) {
49
+ constructor({ client, address, network, balanceManagers, marginManagers, coins, pools, adminCap, marginAdminCap, marginMaintainerCap, packageIds, pyth }) {
50
50
  this.#client = client;
51
51
  this.#address = normalizeSuiAddress(address);
52
52
  this.#config = new DeepBookConfig({
@@ -58,7 +58,9 @@ var DeepBookClient = class {
58
58
  pools,
59
59
  adminCap,
60
60
  marginAdminCap,
61
- marginMaintainerCap
61
+ marginMaintainerCap,
62
+ packageIds,
63
+ pyth
62
64
  });
63
65
  this.balanceManager = new BalanceManagerContract(this.#config);
64
66
  this.deepBook = new DeepBookContract(this.#config);
@@ -806,6 +808,7 @@ var DeepBookClient = class {
806
808
  }
807
809
  }
808
810
  async getPriceInfoObject(tx, coinKey) {
811
+ this.#config.requirePyth();
809
812
  const currentTime = Date.now();
810
813
  const priceInfoObjectAge = await this.getPriceInfoObjectAge(coinKey);
811
814
  if (priceInfoObjectAge && currentTime - priceInfoObjectAge * 1e3 < PRICE_INFO_OBJECT_MAX_AGE_MS) return await this.#config.getCoin(coinKey).priceInfoObjectId;
@@ -826,6 +829,7 @@ var DeepBookClient = class {
826
829
  * @returns {Promise<Record<string, string>>} Map of coinKey -> priceInfoObjectId
827
830
  */
828
831
  async getPriceInfoObjects(tx, coinKeys) {
832
+ this.#config.requirePyth();
829
833
  if (coinKeys.length === 0) return {};
830
834
  const currentTime = Date.now();
831
835
  const coinToObjectId = {};
@@ -1284,21 +1288,22 @@ var DeepBookClient = class {
1284
1288
  }
1285
1289
  /**
1286
1290
  * @description Get the balance manager ID for a margin manager
1287
- * @param {string} marginManagerKey The key to identify the margin manager
1291
+ * @param {string} marginManagerAddress The object ID of the margin manager
1288
1292
  * @returns {Promise<string>} The balance manager ID
1289
1293
  */
1290
- async getMarginManagerBalanceManagerId(marginManagerKey) {
1291
- const manager = this.#config.getMarginManager(marginManagerKey);
1292
- const tx = new Transaction();
1293
- tx.add(this.marginManager.balanceManager(manager.poolKey, manager.address));
1294
- const bytes = (await this.#client.core.simulateTransaction({
1295
- transaction: tx,
1296
- include: {
1297
- commandResults: true,
1298
- effects: true
1299
- }
1300
- })).commandResults[0].returnValues[0].bcs;
1301
- return normalizeSuiAddress(bcs.Address.parse(bytes));
1294
+ async getMarginManagerBalanceManagerId(marginManagerAddress) {
1295
+ const res = await this.#client.core.getObject({
1296
+ objectId: marginManagerAddress,
1297
+ include: { content: true }
1298
+ });
1299
+ if (!res.object?.content) throw new Error(`Margin manager not found: ${marginManagerAddress}`);
1300
+ return normalizeSuiAddress(bcs.struct("MarginManagerBalanceManagerId", {
1301
+ id: bcs.Address,
1302
+ owner: bcs.Address,
1303
+ deepbook_pool: bcs.Address,
1304
+ margin_pool_id: bcs.option(bcs.Address),
1305
+ balance_manager_id: bcs.Address
1306
+ }).parse(res.object.content).balance_manager_id);
1302
1307
  }
1303
1308
  /**
1304
1309
  * @description Calculate assets (base and quote) for a margin manager
@@ -1600,33 +1605,6 @@ var DeepBookClient = class {
1600
1605
  return results;
1601
1606
  }
1602
1607
  /**
1603
- * @description Get account order details for a margin manager.
1604
- * This retrieves the balance manager from the margin manager and returns order details.
1605
- * @param {string} marginManagerKey The key to identify the margin manager
1606
- * @returns {Promise<Array>} Array of order details
1607
- */
1608
- async getMarginAccountOrderDetails(marginManagerKey) {
1609
- const manager = this.#config.getMarginManager(marginManagerKey);
1610
- const tx = new Transaction();
1611
- tx.add(this.marginManager.getMarginAccountOrderDetails(manager.poolKey, manager.address));
1612
- tx.setSenderIfNotSet(normalizeSuiAddress(this.#address));
1613
- const res = await this.#client.core.simulateTransaction({
1614
- transaction: tx,
1615
- include: {
1616
- commandResults: true,
1617
- effects: true
1618
- }
1619
- });
1620
- if (res.FailedTransaction) throw new Error(`Transaction failed: ${res.FailedTransaction.status.error?.message || "Unknown error"}`);
1621
- if (!res.commandResults || !res.commandResults[0] || !res.commandResults[0].returnValues) throw new Error(`Failed to get conditional order IDs: Unknown error`);
1622
- try {
1623
- const bytes = res.commandResults[1].returnValues[0].bcs;
1624
- return bcs.vector(Order).parse(bytes);
1625
- } catch {
1626
- return [];
1627
- }
1628
- }
1629
- /**
1630
1608
  * @description Get all conditional order IDs for a margin manager
1631
1609
  * @param {string} marginManagerKey The key to identify the margin manager
1632
1610
  * @returns {Promise<string[]>} Array of conditional order IDs