@mysten/deepbook-v3 1.5.9 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/dist/client.d.mts +5 -0
  3. package/dist/client.d.mts.map +1 -1
  4. package/dist/client.mjs +7 -0
  5. package/dist/client.mjs.map +1 -1
  6. package/dist/contracts/deepbook/balance_manager.mjs +413 -0
  7. package/dist/contracts/deepbook/balance_manager.mjs.map +1 -0
  8. package/dist/contracts/deepbook/balances.d.mts +4 -4
  9. package/dist/contracts/deepbook/big_vector.mjs +43 -0
  10. package/dist/contracts/deepbook/big_vector.mjs.map +1 -0
  11. package/dist/contracts/deepbook/book.mjs +29 -0
  12. package/dist/contracts/deepbook/book.mjs.map +1 -0
  13. package/dist/contracts/deepbook/deep_price.d.mts +3 -3
  14. package/dist/contracts/deepbook/deep_price.mjs +1 -1
  15. package/dist/contracts/deepbook/deps/std/type_name.mjs +17 -0
  16. package/dist/contracts/deepbook/deps/std/type_name.mjs.map +1 -0
  17. package/dist/contracts/deepbook/deps/sui/bag.mjs +43 -0
  18. package/dist/contracts/deepbook/deps/sui/bag.mjs.map +1 -0
  19. package/dist/contracts/deepbook/deps/sui/balance.mjs +21 -0
  20. package/dist/contracts/deepbook/deps/sui/balance.mjs.map +1 -0
  21. package/dist/contracts/deepbook/deps/sui/table.mjs +38 -0
  22. package/dist/contracts/deepbook/deps/sui/table.mjs.map +1 -0
  23. package/dist/contracts/deepbook/deps/sui/vec_map.mjs +37 -0
  24. package/dist/contracts/deepbook/deps/sui/vec_map.mjs.map +1 -0
  25. package/dist/contracts/deepbook/deps/sui/versioned.mjs +19 -0
  26. package/dist/contracts/deepbook/deps/sui/versioned.mjs.map +1 -0
  27. package/dist/contracts/deepbook/governance.mjs +49 -0
  28. package/dist/contracts/deepbook/governance.mjs.map +1 -0
  29. package/dist/contracts/deepbook/history.mjs +56 -0
  30. package/dist/contracts/deepbook/history.mjs.map +1 -0
  31. package/dist/contracts/deepbook/order.d.mts +12 -12
  32. package/dist/contracts/deepbook/pool.mjs +1739 -0
  33. package/dist/contracts/deepbook/pool.mjs.map +1 -0
  34. package/dist/contracts/deepbook/registry.mjs +295 -0
  35. package/dist/contracts/deepbook/registry.mjs.map +1 -0
  36. package/dist/contracts/deepbook/state.mjs +89 -0
  37. package/dist/contracts/deepbook/state.mjs.map +1 -0
  38. package/dist/contracts/deepbook/trade_params.mjs +21 -0
  39. package/dist/contracts/deepbook/trade_params.mjs.map +1 -0
  40. package/dist/contracts/deepbook/vault.mjs +42 -0
  41. package/dist/contracts/deepbook/vault.mjs.map +1 -0
  42. package/dist/contracts/deepbook_margin/deps/deepbook/balance_manager.mjs +53 -0
  43. package/dist/contracts/deepbook_margin/deps/deepbook/balance_manager.mjs.map +1 -0
  44. package/dist/contracts/deepbook_margin/deps/std/type_name.mjs +17 -0
  45. package/dist/contracts/deepbook_margin/deps/std/type_name.mjs.map +1 -0
  46. package/dist/contracts/deepbook_margin/deps/sui/bag.mjs +43 -0
  47. package/dist/contracts/deepbook_margin/deps/sui/bag.mjs.map +1 -0
  48. package/dist/contracts/deepbook_margin/deps/sui/balance.mjs +21 -0
  49. package/dist/contracts/deepbook_margin/deps/sui/balance.mjs.map +1 -0
  50. package/dist/contracts/deepbook_margin/deps/sui/table.mjs +38 -0
  51. package/dist/contracts/deepbook_margin/deps/sui/table.mjs.map +1 -0
  52. package/dist/contracts/deepbook_margin/deps/sui/vec_map.mjs +37 -0
  53. package/dist/contracts/deepbook_margin/deps/sui/vec_map.mjs.map +1 -0
  54. package/dist/contracts/deepbook_margin/deps/sui/vec_set.mjs +26 -0
  55. package/dist/contracts/deepbook_margin/deps/sui/vec_set.mjs.map +1 -0
  56. package/dist/contracts/deepbook_margin/deps/sui/versioned.mjs +19 -0
  57. package/dist/contracts/deepbook_margin/deps/sui/versioned.mjs.map +1 -0
  58. package/dist/contracts/deepbook_margin/margin_manager.mjs +989 -0
  59. package/dist/contracts/deepbook_margin/margin_manager.mjs.map +1 -0
  60. package/dist/contracts/deepbook_margin/margin_pool.mjs +550 -0
  61. package/dist/contracts/deepbook_margin/margin_pool.mjs.map +1 -0
  62. package/dist/contracts/deepbook_margin/margin_registry.mjs +786 -0
  63. package/dist/contracts/deepbook_margin/margin_registry.mjs.map +1 -0
  64. package/dist/contracts/deepbook_margin/margin_state.mjs +30 -0
  65. package/dist/contracts/deepbook_margin/margin_state.mjs.map +1 -0
  66. package/dist/contracts/deepbook_margin/oracle.mjs +82 -0
  67. package/dist/contracts/deepbook_margin/oracle.mjs.map +1 -0
  68. package/dist/contracts/deepbook_margin/pool_proxy.mjs +644 -0
  69. package/dist/contracts/deepbook_margin/pool_proxy.mjs.map +1 -0
  70. package/dist/contracts/deepbook_margin/position_manager.mjs +32 -0
  71. package/dist/contracts/deepbook_margin/position_manager.mjs.map +1 -0
  72. package/dist/contracts/deepbook_margin/protocol_config.mjs +122 -0
  73. package/dist/contracts/deepbook_margin/protocol_config.mjs.map +1 -0
  74. package/dist/contracts/deepbook_margin/protocol_fees.mjs +58 -0
  75. package/dist/contracts/deepbook_margin/protocol_fees.mjs.map +1 -0
  76. package/dist/contracts/deepbook_margin/rate_limiter.mjs +26 -0
  77. package/dist/contracts/deepbook_margin/rate_limiter.mjs.map +1 -0
  78. package/dist/contracts/deepbook_margin/tpsl.mjs +171 -0
  79. package/dist/contracts/deepbook_margin/tpsl.mjs.map +1 -0
  80. package/dist/contracts/margin_liquidation/deps/sui/bag.mjs +43 -0
  81. package/dist/contracts/margin_liquidation/deps/sui/bag.mjs.map +1 -0
  82. package/dist/contracts/margin_liquidation/liquidation_vault.mjs +179 -0
  83. package/dist/contracts/margin_liquidation/liquidation_vault.mjs.map +1 -0
  84. package/dist/contracts/utils/index.d.mts +1 -1
  85. package/dist/contracts/utils/index.mjs +92 -3
  86. package/dist/contracts/utils/index.mjs.map +1 -1
  87. package/dist/queries/registryQueries.mjs +13 -0
  88. package/dist/queries/registryQueries.mjs.map +1 -1
  89. package/dist/transactions/balanceManager.d.mts.map +1 -1
  90. package/dist/transactions/balanceManager.mjs +119 -100
  91. package/dist/transactions/balanceManager.mjs.map +1 -1
  92. package/dist/transactions/deepbook.d.mts.map +1 -1
  93. package/dist/transactions/deepbook.mjs +464 -439
  94. package/dist/transactions/deepbook.mjs.map +1 -1
  95. package/dist/transactions/deepbookAdmin.d.mts.map +1 -1
  96. package/dist/transactions/deepbookAdmin.mjs +151 -135
  97. package/dist/transactions/deepbookAdmin.mjs.map +1 -1
  98. package/dist/transactions/flashLoans.d.mts.map +1 -1
  99. package/dist/transactions/flashLoans.mjs +29 -22
  100. package/dist/transactions/flashLoans.mjs.map +1 -1
  101. package/dist/transactions/governance.d.mts.map +1 -1
  102. package/dist/transactions/governance.mjs +34 -33
  103. package/dist/transactions/governance.mjs.map +1 -1
  104. package/dist/transactions/marginAdmin.d.mts +10 -0
  105. package/dist/transactions/marginAdmin.d.mts.map +1 -1
  106. package/dist/transactions/marginAdmin.mjs +186 -169
  107. package/dist/transactions/marginAdmin.mjs.map +1 -1
  108. package/dist/transactions/marginLiquidations.d.mts +3 -3
  109. package/dist/transactions/marginLiquidations.d.mts.map +1 -1
  110. package/dist/transactions/marginLiquidations.mjs +53 -54
  111. package/dist/transactions/marginLiquidations.mjs.map +1 -1
  112. package/dist/transactions/marginMaintainer.d.mts.map +1 -1
  113. package/dist/transactions/marginMaintainer.mjs +83 -83
  114. package/dist/transactions/marginMaintainer.mjs.map +1 -1
  115. package/dist/transactions/marginManager.d.mts.map +1 -1
  116. package/dist/transactions/marginManager.mjs +330 -311
  117. package/dist/transactions/marginManager.mjs.map +1 -1
  118. package/dist/transactions/marginPool.d.mts.map +1 -1
  119. package/dist/transactions/marginPool.mjs +93 -89
  120. package/dist/transactions/marginPool.mjs.map +1 -1
  121. package/dist/transactions/marginRegistry.d.mts +22 -15
  122. package/dist/transactions/marginRegistry.d.mts.map +1 -1
  123. package/dist/transactions/marginRegistry.mjs +101 -68
  124. package/dist/transactions/marginRegistry.mjs.map +1 -1
  125. package/dist/transactions/marginTPSL.d.mts +27 -9
  126. package/dist/transactions/marginTPSL.d.mts.map +1 -1
  127. package/dist/transactions/marginTPSL.mjs +108 -82
  128. package/dist/transactions/marginTPSL.mjs.map +1 -1
  129. package/dist/transactions/poolProxy.d.mts +32 -0
  130. package/dist/transactions/poolProxy.d.mts.map +1 -1
  131. package/dist/transactions/poolProxy.mjs +269 -189
  132. package/dist/transactions/poolProxy.mjs.map +1 -1
  133. package/dist/utils/constants.mjs +4 -4
  134. package/dist/utils/constants.mjs.map +1 -1
  135. package/package.json +2 -2
  136. package/src/client.ts +8 -0
  137. package/src/contracts/deepbook/balance_manager.ts +46 -5
  138. package/src/contracts/deepbook/constants.ts +13 -0
  139. package/src/contracts/deepbook/pool.ts +133 -0
  140. package/src/contracts/deepbook/registry.ts +136 -1
  141. package/src/contracts/deepbook_margin/deps/deepbook/balance_manager.ts +49 -0
  142. package/src/contracts/deepbook_margin/deps/std/type_name.ts +24 -0
  143. package/src/contracts/deepbook_margin/deps/sui/bag.ts +41 -0
  144. package/src/contracts/deepbook_margin/deps/sui/balance.ts +19 -0
  145. package/src/contracts/deepbook_margin/deps/sui/table.ts +36 -0
  146. package/src/contracts/deepbook_margin/deps/sui/vec_map.ts +33 -0
  147. package/src/contracts/deepbook_margin/deps/sui/vec_set.ts +22 -0
  148. package/src/contracts/deepbook_margin/deps/sui/versioned.ts +13 -0
  149. package/src/contracts/deepbook_margin/margin_constants.ts +329 -0
  150. package/src/contracts/deepbook_margin/margin_manager.ts +1772 -0
  151. package/src/contracts/deepbook_margin/margin_pool.ts +1129 -0
  152. package/src/contracts/deepbook_margin/margin_registry.ts +1207 -0
  153. package/src/contracts/deepbook_margin/margin_state.ts +26 -0
  154. package/src/contracts/deepbook_margin/oracle.ts +99 -0
  155. package/src/contracts/deepbook_margin/pool_proxy.ts +1298 -0
  156. package/src/contracts/deepbook_margin/position_manager.ts +28 -0
  157. package/src/contracts/deepbook_margin/protocol_config.ts +163 -0
  158. package/src/contracts/deepbook_margin/protocol_fees.ts +153 -0
  159. package/src/contracts/deepbook_margin/rate_limiter.ts +80 -0
  160. package/src/contracts/deepbook_margin/tpsl.ts +559 -0
  161. package/src/contracts/margin_liquidation/deps/sui/bag.ts +41 -0
  162. package/src/contracts/margin_liquidation/liquidation_vault.ts +401 -0
  163. package/src/queries/registryQueries.ts +15 -0
  164. package/src/transactions/balanceManager.ts +140 -90
  165. package/src/transactions/deepbook.ts +586 -494
  166. package/src/transactions/deepbookAdmin.ts +154 -146
  167. package/src/transactions/flashLoans.ts +29 -20
  168. package/src/transactions/governance.ts +50 -37
  169. package/src/transactions/marginAdmin.ts +247 -188
  170. package/src/transactions/marginLiquidations.ts +70 -55
  171. package/src/transactions/marginMaintainer.ts +106 -88
  172. package/src/transactions/marginManager.ts +414 -348
  173. package/src/transactions/marginPool.ts +140 -103
  174. package/src/transactions/marginRegistry.ts +103 -70
  175. package/src/transactions/marginTPSL.ts +151 -87
  176. package/src/transactions/poolProxy.ts +384 -205
  177. package/src/utils/constants.ts +4 -4
@@ -0,0 +1,43 @@
1
+ import { MoveStruct } from "../../../utils/index.mjs";
2
+ import { bcs } from "@mysten/sui/bcs";
3
+
4
+ //#region src/contracts/deepbook/deps/sui/bag.ts
5
+ /**************************************************************
6
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
7
+ **************************************************************/
8
+ /**
9
+ * A bag is a heterogeneous map-like collection. The collection is similar to
10
+ * `sui::table` in that its keys and values are not stored within the `Bag` value,
11
+ * but instead are stored using Sui's object system. The `Bag` struct acts only as
12
+ * a handle into the object system to retrieve those keys and values. Note that
13
+ * this means that `Bag` values with exactly the same key-value mapping will not be
14
+ * equal, with `==`, at runtime. For example
15
+ *
16
+ * ```
17
+ * let bag1 = bag::new();
18
+ * let bag2 = bag::new();
19
+ * bag::add(&mut bag1, 0, false);
20
+ * bag::add(&mut bag1, 1, true);
21
+ * bag::add(&mut bag2, 0, false);
22
+ * bag::add(&mut bag2, 1, true);
23
+ * // bag1 does not equal bag2, despite having the same entries
24
+ * assert!(&bag1 != &bag2);
25
+ * ```
26
+ *
27
+ * At it's core, `sui::bag` is a wrapper around `UID` that allows for access to
28
+ * `sui::dynamic_field` while preventing accidentally stranding field values. A
29
+ * `UID` can be deleted, even if it has dynamic fields associated with it, but a
30
+ * bag, on the other hand, must be empty to be destroyed.
31
+ */
32
+ const $moduleName = "0x2::bag";
33
+ const Bag = new MoveStruct({
34
+ name: `${$moduleName}::Bag`,
35
+ fields: {
36
+ id: bcs.Address,
37
+ size: bcs.u64()
38
+ }
39
+ });
40
+
41
+ //#endregion
42
+ export { Bag };
43
+ //# sourceMappingURL=bag.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bag.mjs","names":[],"sources":["../../../../../src/contracts/deepbook/deps/sui/bag.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\n\n/**\n * A bag is a heterogeneous map-like collection. The collection is similar to\n * `sui::table` in that its keys and values are not stored within the `Bag` value,\n * but instead are stored using Sui's object system. The `Bag` struct acts only as\n * a handle into the object system to retrieve those keys and values. Note that\n * this means that `Bag` values with exactly the same key-value mapping will not be\n * equal, with `==`, at runtime. For example\n *\n * ```\n * let bag1 = bag::new();\n * let bag2 = bag::new();\n * bag::add(&mut bag1, 0, false);\n * bag::add(&mut bag1, 1, true);\n * bag::add(&mut bag2, 0, false);\n * bag::add(&mut bag2, 1, true);\n * // bag1 does not equal bag2, despite having the same entries\n * assert!(&bag1 != &bag2);\n * ```\n *\n * At it's core, `sui::bag` is a wrapper around `UID` that allows for access to\n * `sui::dynamic_field` while preventing accidentally stranding field values. A\n * `UID` can be deleted, even if it has dynamic fields associated with it, but a\n * bag, on the other hand, must be empty to be destroyed.\n */\n\nimport { MoveStruct } from '../../../utils/index.js';\nimport { bcs } from '@mysten/sui/bcs';\nconst $moduleName = '0x2::bag';\nexport const Bag = new MoveStruct({\n\tname: `${$moduleName}::Bag`,\n\tfields: {\n\t\t/** the ID of this bag */\n\t\tid: bcs.Address,\n\t\t/** the number of key-value pairs in the bag */\n\t\tsize: bcs.u64(),\n\t},\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,cAAc;AACpB,MAAa,MAAM,IAAI,WAAW;CACjC,MAAM,GAAG,YAAY;CACrB,QAAQ;EAEP,IAAI,IAAI;EAER,MAAM,IAAI,KAAK;EACf;CACD,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { MoveStruct } from "../../../utils/index.mjs";
2
+ import { bcs } from "@mysten/sui/bcs";
3
+
4
+ //#region src/contracts/deepbook/deps/sui/balance.ts
5
+ /**************************************************************
6
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
7
+ **************************************************************/
8
+ /**
9
+ * A storable handler for Balances in general. Is used in the `Coin` module to
10
+ * allow balance operations and can be used to implement custom coins with `Supply`
11
+ * and `Balance`s.
12
+ */
13
+ const $moduleName = "0x2::balance";
14
+ const Balance = new MoveStruct({
15
+ name: `${$moduleName}::Balance<phantom T>`,
16
+ fields: { value: bcs.u64() }
17
+ });
18
+
19
+ //#endregion
20
+ export { Balance };
21
+ //# sourceMappingURL=balance.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"balance.mjs","names":[],"sources":["../../../../../src/contracts/deepbook/deps/sui/balance.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\n\n/**\n * A storable handler for Balances in general. Is used in the `Coin` module to\n * allow balance operations and can be used to implement custom coins with `Supply`\n * and `Balance`s.\n */\n\nimport { MoveStruct } from '../../../utils/index.js';\nimport { bcs } from '@mysten/sui/bcs';\nconst $moduleName = '0x2::balance';\nexport const Balance = new MoveStruct({\n\tname: `${$moduleName}::Balance<phantom T>`,\n\tfields: {\n\t\tvalue: bcs.u64(),\n\t},\n});\n"],"mappings":";;;;;;;;;;;;AAYA,MAAM,cAAc;AACpB,MAAa,UAAU,IAAI,WAAW;CACrC,MAAM,GAAG,YAAY;CACrB,QAAQ,EACP,OAAO,IAAI,KAAK,EAChB;CACD,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { MoveStruct } from "../../../utils/index.mjs";
2
+ import { bcs } from "@mysten/sui/bcs";
3
+
4
+ //#region src/contracts/deepbook/deps/sui/table.ts
5
+ /**************************************************************
6
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
7
+ **************************************************************/
8
+ /**
9
+ * A table is a map-like collection. But unlike a traditional collection, it's keys
10
+ * and values are not stored within the `Table` value, but instead are stored using
11
+ * Sui's object system. The `Table` struct acts only as a handle into the object
12
+ * system to retrieve those keys and values. Note that this means that `Table`
13
+ * values with exactly the same key-value mapping will not be equal, with `==`, at
14
+ * runtime. For example
15
+ *
16
+ * ```
17
+ * let table1 = table::new<u64, bool>();
18
+ * let table2 = table::new<u64, bool>();
19
+ * table::add(&mut table1, 0, false);
20
+ * table::add(&mut table1, 1, true);
21
+ * table::add(&mut table2, 0, false);
22
+ * table::add(&mut table2, 1, true);
23
+ * // table1 does not equal table2, despite having the same entries
24
+ * assert!(&table1 != &table2);
25
+ * ```
26
+ */
27
+ const $moduleName = "0x2::table";
28
+ const Table = new MoveStruct({
29
+ name: `${$moduleName}::Table<phantom K, phantom V>`,
30
+ fields: {
31
+ id: bcs.Address,
32
+ size: bcs.u64()
33
+ }
34
+ });
35
+
36
+ //#endregion
37
+ export { Table };
38
+ //# sourceMappingURL=table.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.mjs","names":[],"sources":["../../../../../src/contracts/deepbook/deps/sui/table.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\n\n/**\n * A table is a map-like collection. But unlike a traditional collection, it's keys\n * and values are not stored within the `Table` value, but instead are stored using\n * Sui's object system. The `Table` struct acts only as a handle into the object\n * system to retrieve those keys and values. Note that this means that `Table`\n * values with exactly the same key-value mapping will not be equal, with `==`, at\n * runtime. For example\n *\n * ```\n * let table1 = table::new<u64, bool>();\n * let table2 = table::new<u64, bool>();\n * table::add(&mut table1, 0, false);\n * table::add(&mut table1, 1, true);\n * table::add(&mut table2, 0, false);\n * table::add(&mut table2, 1, true);\n * // table1 does not equal table2, despite having the same entries\n * assert!(&table1 != &table2);\n * ```\n */\n\nimport { MoveStruct } from '../../../utils/index.js';\nimport { bcs } from '@mysten/sui/bcs';\nconst $moduleName = '0x2::table';\nexport const Table = new MoveStruct({\n\tname: `${$moduleName}::Table<phantom K, phantom V>`,\n\tfields: {\n\t\t/** the ID of this table */\n\t\tid: bcs.Address,\n\t\t/** the number of key-value pairs in the table */\n\t\tsize: bcs.u64(),\n\t},\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAM,cAAc;AACpB,MAAa,QAAQ,IAAI,WAAW;CACnC,MAAM,GAAG,YAAY;CACrB,QAAQ;EAEP,IAAI,IAAI;EAER,MAAM,IAAI,KAAK;EACf;CACD,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { MoveStruct } from "../../../utils/index.mjs";
2
+ import { bcs } from "@mysten/sui/bcs";
3
+
4
+ //#region src/contracts/deepbook/deps/sui/vec_map.ts
5
+ /**************************************************************
6
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
7
+ **************************************************************/
8
+ const $moduleName = "0x2::vec_map";
9
+ /** An entry in the map */
10
+ function Entry(...typeParameters) {
11
+ return new MoveStruct({
12
+ name: `${$moduleName}::Entry<${typeParameters[0].name}, ${typeParameters[1].name}>`,
13
+ fields: {
14
+ key: typeParameters[0],
15
+ value: typeParameters[1]
16
+ }
17
+ });
18
+ }
19
+ /**
20
+ * A map data structure backed by a vector. The map is guaranteed not to contain
21
+ * duplicate keys, but entries are _not_ sorted by key--entries are included in
22
+ * insertion order. All operations are O(N) in the size of the map--the intention
23
+ * of this data structure is only to provide the convenience of programming against
24
+ * a map API. Large maps should use handwritten parent/child relationships instead.
25
+ * Maps that need sorted iteration rather than insertion order iteration should
26
+ * also be handwritten.
27
+ */
28
+ function VecMap(...typeParameters) {
29
+ return new MoveStruct({
30
+ name: `${$moduleName}::VecMap<${typeParameters[0].name}, ${typeParameters[1].name}>`,
31
+ fields: { contents: bcs.vector(Entry(typeParameters[0], typeParameters[1])) }
32
+ });
33
+ }
34
+
35
+ //#endregion
36
+ export { VecMap };
37
+ //# sourceMappingURL=vec_map.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vec_map.mjs","names":[],"sources":["../../../../../src/contracts/deepbook/deps/sui/vec_map.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\nimport { type BcsType, bcs } from '@mysten/sui/bcs';\nimport { MoveStruct } from '../../../utils/index.js';\nconst $moduleName = '0x2::vec_map';\n/** An entry in the map */\nexport function Entry<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [K, V]) {\n\treturn new MoveStruct({\n\t\tname: `${$moduleName}::Entry<${typeParameters[0].name as K['name']}, ${typeParameters[1].name as V['name']}>`,\n\t\tfields: {\n\t\t\tkey: typeParameters[0],\n\t\t\tvalue: typeParameters[1],\n\t\t},\n\t});\n}\n/**\n * A map data structure backed by a vector. The map is guaranteed not to contain\n * duplicate keys, but entries are _not_ sorted by key--entries are included in\n * insertion order. All operations are O(N) in the size of the map--the intention\n * of this data structure is only to provide the convenience of programming against\n * a map API. Large maps should use handwritten parent/child relationships instead.\n * Maps that need sorted iteration rather than insertion order iteration should\n * also be handwritten.\n */\nexport function VecMap<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [K, V]) {\n\treturn new MoveStruct({\n\t\tname: `${$moduleName}::VecMap<${typeParameters[0].name as K['name']}, ${typeParameters[1].name as V['name']}>`,\n\t\tfields: {\n\t\t\tcontents: bcs.vector(Entry(typeParameters[0], typeParameters[1])),\n\t\t},\n\t});\n}\n"],"mappings":";;;;;;;AAKA,MAAM,cAAc;;AAEpB,SAAgB,MAAsD,GAAG,gBAAwB;AAChG,QAAO,IAAI,WAAW;EACrB,MAAM,GAAG,YAAY,UAAU,eAAe,GAAG,KAAkB,IAAI,eAAe,GAAG,KAAkB;EAC3G,QAAQ;GACP,KAAK,eAAe;GACpB,OAAO,eAAe;GACtB;EACD,CAAC;;;;;;;;;;;AAWH,SAAgB,OAAuD,GAAG,gBAAwB;AACjG,QAAO,IAAI,WAAW;EACrB,MAAM,GAAG,YAAY,WAAW,eAAe,GAAG,KAAkB,IAAI,eAAe,GAAG,KAAkB;EAC5G,QAAQ,EACP,UAAU,IAAI,OAAO,MAAM,eAAe,IAAI,eAAe,GAAG,CAAC,EACjE;EACD,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { MoveStruct } from "../../../utils/index.mjs";
2
+ import { bcs } from "@mysten/sui/bcs";
3
+
4
+ //#region src/contracts/deepbook/deps/sui/versioned.ts
5
+ /**************************************************************
6
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
7
+ **************************************************************/
8
+ const $moduleName = "0x2::versioned";
9
+ const Versioned = new MoveStruct({
10
+ name: `${$moduleName}::Versioned`,
11
+ fields: {
12
+ id: bcs.Address,
13
+ version: bcs.u64()
14
+ }
15
+ });
16
+
17
+ //#endregion
18
+ export { Versioned };
19
+ //# sourceMappingURL=versioned.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"versioned.mjs","names":[],"sources":["../../../../../src/contracts/deepbook/deps/sui/versioned.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\nimport { MoveStruct } from '../../../utils/index.js';\nimport { bcs } from '@mysten/sui/bcs';\nconst $moduleName = '0x2::versioned';\nexport const Versioned = new MoveStruct({\n\tname: `${$moduleName}::Versioned`,\n\tfields: {\n\t\tid: bcs.Address,\n\t\tversion: bcs.u64(),\n\t},\n});\n"],"mappings":";;;;;;;AAKA,MAAM,cAAc;AACpB,MAAa,YAAY,IAAI,WAAW;CACvC,MAAM,GAAG,YAAY;CACrB,QAAQ;EACP,IAAI,IAAI;EACR,SAAS,IAAI,KAAK;EAClB;CACD,CAAC"}
@@ -0,0 +1,49 @@
1
+ import { MoveStruct } from "../utils/index.mjs";
2
+ import { TradeParams } from "./trade_params.mjs";
3
+ import { VecMap } from "./deps/sui/vec_map.mjs";
4
+ import { bcs } from "@mysten/sui/bcs";
5
+
6
+ //#region src/contracts/deepbook/governance.ts
7
+ /**************************************************************
8
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
9
+ **************************************************************/
10
+ /**
11
+ * Governance module handles the governance of the `Pool` that it's attached to.
12
+ * Users with non zero stake can create proposals and vote on them. Winning
13
+ * proposals are used to set the trade parameters for the next epoch.
14
+ */
15
+ const $moduleName = "@deepbook/core::governance";
16
+ const Proposal = new MoveStruct({
17
+ name: `${$moduleName}::Proposal`,
18
+ fields: {
19
+ taker_fee: bcs.u64(),
20
+ maker_fee: bcs.u64(),
21
+ stake_required: bcs.u64(),
22
+ votes: bcs.u64()
23
+ }
24
+ });
25
+ const Governance = new MoveStruct({
26
+ name: `${$moduleName}::Governance`,
27
+ fields: {
28
+ epoch: bcs.u64(),
29
+ whitelisted: bcs.bool(),
30
+ stable: bcs.bool(),
31
+ proposals: VecMap(bcs.Address, Proposal),
32
+ trade_params: TradeParams,
33
+ next_trade_params: TradeParams,
34
+ voting_power: bcs.u64(),
35
+ quorum: bcs.u64()
36
+ }
37
+ });
38
+ const TradeParamsUpdateEvent = new MoveStruct({
39
+ name: `${$moduleName}::TradeParamsUpdateEvent`,
40
+ fields: {
41
+ taker_fee: bcs.u64(),
42
+ maker_fee: bcs.u64(),
43
+ stake_required: bcs.u64()
44
+ }
45
+ });
46
+
47
+ //#endregion
48
+ export { Governance };
49
+ //# sourceMappingURL=governance.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"governance.mjs","names":["vec_map.VecMap","trade_params.TradeParams"],"sources":["../../../src/contracts/deepbook/governance.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\n\n/**\n * Governance module handles the governance of the `Pool` that it's attached to.\n * Users with non zero stake can create proposals and vote on them. Winning\n * proposals are used to set the trade parameters for the next epoch.\n */\n\nimport { MoveStruct } from '../utils/index.js';\nimport { bcs } from '@mysten/sui/bcs';\nimport * as vec_map from './deps/sui/vec_map.js';\nimport * as trade_params from './trade_params.js';\nconst $moduleName = '@deepbook/core::governance';\nexport const Proposal = new MoveStruct({\n\tname: `${$moduleName}::Proposal`,\n\tfields: {\n\t\ttaker_fee: bcs.u64(),\n\t\tmaker_fee: bcs.u64(),\n\t\tstake_required: bcs.u64(),\n\t\tvotes: bcs.u64(),\n\t},\n});\nexport const Governance = new MoveStruct({\n\tname: `${$moduleName}::Governance`,\n\tfields: {\n\t\t/** Tracks refreshes. */\n\t\tepoch: bcs.u64(),\n\t\t/** If Pool is whitelisted. */\n\t\twhitelisted: bcs.bool(),\n\t\t/** If Pool is stable or volatile. */\n\t\tstable: bcs.bool(),\n\t\t/** List of proposals for the current epoch. */\n\t\tproposals: vec_map.VecMap(bcs.Address, Proposal),\n\t\t/** Trade parameters for the current epoch. */\n\t\ttrade_params: trade_params.TradeParams,\n\t\t/** Trade parameters for the next epoch. */\n\t\tnext_trade_params: trade_params.TradeParams,\n\t\t/** All voting power from the current stakes. */\n\t\tvoting_power: bcs.u64(),\n\t\t/** Quorum for the current epoch. */\n\t\tquorum: bcs.u64(),\n\t},\n});\nexport const TradeParamsUpdateEvent = new MoveStruct({\n\tname: `${$moduleName}::TradeParamsUpdateEvent`,\n\tfields: {\n\t\ttaker_fee: bcs.u64(),\n\t\tmaker_fee: bcs.u64(),\n\t\tstake_required: bcs.u64(),\n\t},\n});\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAM,cAAc;AACpB,MAAa,WAAW,IAAI,WAAW;CACtC,MAAM,GAAG,YAAY;CACrB,QAAQ;EACP,WAAW,IAAI,KAAK;EACpB,WAAW,IAAI,KAAK;EACpB,gBAAgB,IAAI,KAAK;EACzB,OAAO,IAAI,KAAK;EAChB;CACD,CAAC;AACF,MAAa,aAAa,IAAI,WAAW;CACxC,MAAM,GAAG,YAAY;CACrB,QAAQ;EAEP,OAAO,IAAI,KAAK;EAEhB,aAAa,IAAI,MAAM;EAEvB,QAAQ,IAAI,MAAM;EAElB,WAAWA,OAAe,IAAI,SAAS,SAAS;EAEhD,cAAcC;EAEd,mBAAmBA;EAEnB,cAAc,IAAI,KAAK;EAEvB,QAAQ,IAAI,KAAK;EACjB;CACD,CAAC;AACF,MAAa,yBAAyB,IAAI,WAAW;CACpD,MAAM,GAAG,YAAY;CACrB,QAAQ;EACP,WAAW,IAAI,KAAK;EACpB,WAAW,IAAI,KAAK;EACpB,gBAAgB,IAAI,KAAK;EACzB;CACD,CAAC"}
@@ -0,0 +1,56 @@
1
+ import { MoveStruct } from "../utils/index.mjs";
2
+ import { Balances } from "./balances.mjs";
3
+ import { Table } from "./deps/sui/table.mjs";
4
+ import { TradeParams } from "./trade_params.mjs";
5
+ import { bcs } from "@mysten/sui/bcs";
6
+
7
+ //#region src/contracts/deepbook/history.ts
8
+ /**************************************************************
9
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
10
+ **************************************************************/
11
+ /**
12
+ * History module tracks the volume data for the current epoch and past epochs. It
13
+ * also tracks past trade params. Past maker fees are used to calculate fills for
14
+ * old orders. The historic median is used to calculate rebates and burns.
15
+ */
16
+ const $moduleName = "@deepbook/core::history";
17
+ const Volumes = new MoveStruct({
18
+ name: `${$moduleName}::Volumes`,
19
+ fields: {
20
+ total_volume: bcs.u128(),
21
+ total_staked_volume: bcs.u128(),
22
+ total_fees_collected: Balances,
23
+ historic_median: bcs.u128(),
24
+ trade_params: TradeParams
25
+ }
26
+ });
27
+ const History = new MoveStruct({
28
+ name: `${$moduleName}::History`,
29
+ fields: {
30
+ epoch: bcs.u64(),
31
+ epoch_created: bcs.u64(),
32
+ volumes: Volumes,
33
+ historic_volumes: Table,
34
+ balance_to_burn: bcs.u64()
35
+ }
36
+ });
37
+ const EpochData = new MoveStruct({
38
+ name: `${$moduleName}::EpochData`,
39
+ fields: {
40
+ epoch: bcs.u64(),
41
+ pool_id: bcs.Address,
42
+ total_volume: bcs.u128(),
43
+ total_staked_volume: bcs.u128(),
44
+ base_fees_collected: bcs.u64(),
45
+ quote_fees_collected: bcs.u64(),
46
+ deep_fees_collected: bcs.u64(),
47
+ historic_median: bcs.u128(),
48
+ taker_fee: bcs.u64(),
49
+ maker_fee: bcs.u64(),
50
+ stake_required: bcs.u64()
51
+ }
52
+ });
53
+
54
+ //#endregion
55
+ export { History };
56
+ //# sourceMappingURL=history.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"history.mjs","names":["balances.Balances","trade_params.TradeParams","table.Table"],"sources":["../../../src/contracts/deepbook/history.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\n\n/**\n * History module tracks the volume data for the current epoch and past epochs. It\n * also tracks past trade params. Past maker fees are used to calculate fills for\n * old orders. The historic median is used to calculate rebates and burns.\n */\n\nimport { MoveStruct } from '../utils/index.js';\nimport { bcs } from '@mysten/sui/bcs';\nimport * as balances from './balances.js';\nimport * as trade_params from './trade_params.js';\nimport * as table from './deps/sui/table.js';\nconst $moduleName = '@deepbook/core::history';\nexport const Volumes = new MoveStruct({\n\tname: `${$moduleName}::Volumes`,\n\tfields: {\n\t\ttotal_volume: bcs.u128(),\n\t\ttotal_staked_volume: bcs.u128(),\n\t\ttotal_fees_collected: balances.Balances,\n\t\thistoric_median: bcs.u128(),\n\t\ttrade_params: trade_params.TradeParams,\n\t},\n});\nexport const History = new MoveStruct({\n\tname: `${$moduleName}::History`,\n\tfields: {\n\t\tepoch: bcs.u64(),\n\t\tepoch_created: bcs.u64(),\n\t\tvolumes: Volumes,\n\t\thistoric_volumes: table.Table,\n\t\tbalance_to_burn: bcs.u64(),\n\t},\n});\nexport const EpochData = new MoveStruct({\n\tname: `${$moduleName}::EpochData`,\n\tfields: {\n\t\tepoch: bcs.u64(),\n\t\tpool_id: bcs.Address,\n\t\ttotal_volume: bcs.u128(),\n\t\ttotal_staked_volume: bcs.u128(),\n\t\tbase_fees_collected: bcs.u64(),\n\t\tquote_fees_collected: bcs.u64(),\n\t\tdeep_fees_collected: bcs.u64(),\n\t\thistoric_median: bcs.u128(),\n\t\ttaker_fee: bcs.u64(),\n\t\tmaker_fee: bcs.u64(),\n\t\tstake_required: bcs.u64(),\n\t},\n});\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAM,cAAc;AACpB,MAAa,UAAU,IAAI,WAAW;CACrC,MAAM,GAAG,YAAY;CACrB,QAAQ;EACP,cAAc,IAAI,MAAM;EACxB,qBAAqB,IAAI,MAAM;EAC/B,sBAAsBA;EACtB,iBAAiB,IAAI,MAAM;EAC3B,cAAcC;EACd;CACD,CAAC;AACF,MAAa,UAAU,IAAI,WAAW;CACrC,MAAM,GAAG,YAAY;CACrB,QAAQ;EACP,OAAO,IAAI,KAAK;EAChB,eAAe,IAAI,KAAK;EACxB,SAAS;EACT,kBAAkBC;EAClB,iBAAiB,IAAI,KAAK;EAC1B;CACD,CAAC;AACF,MAAa,YAAY,IAAI,WAAW;CACvC,MAAM,GAAG,YAAY;CACrB,QAAQ;EACP,OAAO,IAAI,KAAK;EAChB,SAAS,IAAI;EACb,cAAc,IAAI,MAAM;EACxB,qBAAqB,IAAI,MAAM;EAC/B,qBAAqB,IAAI,KAAK;EAC9B,sBAAsB,IAAI,KAAK;EAC/B,qBAAqB,IAAI,KAAK;EAC9B,iBAAiB,IAAI,MAAM;EAC3B,WAAW,IAAI,KAAK;EACpB,WAAW,IAAI,KAAK;EACpB,gBAAgB,IAAI,KAAK;EACzB;CACD,CAAC"}
@@ -1,22 +1,22 @@
1
1
  import { MoveStruct } from "../utils/index.mjs";
2
- import * as _mysten_sui_bcs32 from "@mysten/sui/bcs";
2
+ import * as _mysten_sui_bcs16 from "@mysten/sui/bcs";
3
3
  import { Transaction, TransactionArgument } from "@mysten/sui/transactions";
4
4
 
5
5
  //#region src/contracts/deepbook/order.d.ts
6
6
  declare const Order: MoveStruct<{
7
- balance_manager_id: _mysten_sui_bcs32.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
8
- order_id: _mysten_sui_bcs32.BcsType<string, string | number | bigint, "u128">;
9
- client_order_id: _mysten_sui_bcs32.BcsType<string, string | number | bigint, "u64">;
10
- quantity: _mysten_sui_bcs32.BcsType<string, string | number | bigint, "u64">;
11
- filled_quantity: _mysten_sui_bcs32.BcsType<string, string | number | bigint, "u64">;
12
- fee_is_deep: _mysten_sui_bcs32.BcsType<boolean, boolean, "bool">;
7
+ balance_manager_id: _mysten_sui_bcs16.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
8
+ order_id: _mysten_sui_bcs16.BcsType<string, string | number | bigint, "u128">;
9
+ client_order_id: _mysten_sui_bcs16.BcsType<string, string | number | bigint, "u64">;
10
+ quantity: _mysten_sui_bcs16.BcsType<string, string | number | bigint, "u64">;
11
+ filled_quantity: _mysten_sui_bcs16.BcsType<string, string | number | bigint, "u64">;
12
+ fee_is_deep: _mysten_sui_bcs16.BcsType<boolean, boolean, "bool">;
13
13
  order_deep_price: MoveStruct<{
14
- asset_is_base: _mysten_sui_bcs32.BcsType<boolean, boolean, "bool">;
15
- deep_per_asset: _mysten_sui_bcs32.BcsType<string, string | number | bigint, "u64">;
14
+ asset_is_base: _mysten_sui_bcs16.BcsType<boolean, boolean, "bool">;
15
+ deep_per_asset: _mysten_sui_bcs16.BcsType<string, string | number | bigint, "u64">;
16
16
  }, "@deepbook/core::deep_price::OrderDeepPrice">;
17
- epoch: _mysten_sui_bcs32.BcsType<string, string | number | bigint, "u64">;
18
- status: _mysten_sui_bcs32.BcsType<number, number, "u8">;
19
- expire_timestamp: _mysten_sui_bcs32.BcsType<string, string | number | bigint, "u64">;
17
+ epoch: _mysten_sui_bcs16.BcsType<string, string | number | bigint, "u64">;
18
+ status: _mysten_sui_bcs16.BcsType<number, number, "u8">;
19
+ expire_timestamp: _mysten_sui_bcs16.BcsType<string, string | number | bigint, "u64">;
20
20
  }, "@deepbook/core::order::Order">;
21
21
  //#endregion
22
22
  export { Order };