@mysten/deepbook-v3 2.9.1 → 2.10.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.
Files changed (212) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +21 -0
  3. package/dist/account-bindings/account-registry.d.mts +109 -0
  4. package/dist/account-bindings/account-registry.d.mts.map +1 -0
  5. package/dist/account-bindings/account-registry.mjs +56 -0
  6. package/dist/account-bindings/account-registry.mjs.map +1 -0
  7. package/dist/account-bindings/account.d.mts +176 -0
  8. package/dist/account-bindings/account.d.mts.map +1 -0
  9. package/dist/account-bindings/account.mjs +94 -0
  10. package/dist/account-bindings/account.mjs.map +1 -0
  11. package/dist/account-bindings/latest.d.mts +12 -0
  12. package/dist/account-bindings/latest.d.mts.map +1 -0
  13. package/dist/account-bindings/latest.mjs +19 -0
  14. package/dist/account-bindings/latest.mjs.map +1 -0
  15. package/dist/account.d.mts +46 -3
  16. package/dist/account.d.mts.map +1 -1
  17. package/dist/account.mjs +51 -2
  18. package/dist/account.mjs.map +1 -1
  19. package/dist/client.d.mts +2 -2
  20. package/dist/contracts/account/account.d.mts +25 -97
  21. package/dist/contracts/account/account.d.mts.map +1 -1
  22. package/dist/contracts/account/account.mjs +43 -35
  23. package/dist/contracts/account/account.mjs.map +1 -1
  24. package/dist/contracts/account/account_events.d.mts +20 -20
  25. package/dist/contracts/account/account_events.d.mts.map +1 -1
  26. package/dist/contracts/account/account_registry.d.mts +7 -54
  27. package/dist/contracts/account/account_registry.d.mts.map +1 -1
  28. package/dist/contracts/account/account_registry.mjs +2 -22
  29. package/dist/contracts/account/account_registry.mjs.map +1 -1
  30. package/dist/contracts/deepbook/account.d.mts +18 -18
  31. package/dist/contracts/deepbook/balances.d.mts +4 -4
  32. package/dist/contracts/deepbook/deep_price.d.mts +3 -3
  33. package/dist/contracts/deepbook/order.d.mts +12 -12
  34. package/dist/contracts/deepbook_predict/admin.d.mts +4 -4
  35. package/dist/contracts/deepbook_predict/admin.d.mts.map +1 -1
  36. package/dist/contracts/deepbook_predict/builder_code.d.mts +60 -13
  37. package/dist/contracts/deepbook_predict/builder_code.d.mts.map +1 -1
  38. package/dist/contracts/deepbook_predict/builder_code.mjs +55 -1
  39. package/dist/contracts/deepbook_predict/builder_code.mjs.map +1 -1
  40. package/dist/contracts/deepbook_predict/builder_code_events.d.mts +10 -10
  41. package/dist/contracts/deepbook_predict/config_events.d.mts +88 -84
  42. package/dist/contracts/deepbook_predict/config_events.d.mts.map +1 -1
  43. package/dist/contracts/deepbook_predict/config_events.mjs +8 -0
  44. package/dist/contracts/deepbook_predict/config_events.mjs.map +1 -1
  45. package/dist/contracts/deepbook_predict/expiry_market.d.mts +262 -101
  46. package/dist/contracts/deepbook_predict/expiry_market.d.mts.map +1 -1
  47. package/dist/contracts/deepbook_predict/expiry_market.mjs +320 -41
  48. package/dist/contracts/deepbook_predict/expiry_market.mjs.map +1 -1
  49. package/dist/contracts/deepbook_predict/market_lifecycle_cap.d.mts +5 -5
  50. package/dist/contracts/deepbook_predict/market_lifecycle_cap.d.mts.map +1 -1
  51. package/dist/contracts/deepbook_predict/market_manager.d.mts +27 -27
  52. package/dist/contracts/deepbook_predict/market_manager.d.mts.map +1 -1
  53. package/dist/contracts/deepbook_predict/order_events.d.mts +56 -54
  54. package/dist/contracts/deepbook_predict/order_events.d.mts.map +1 -1
  55. package/dist/contracts/deepbook_predict/order_events.mjs.map +1 -1
  56. package/dist/contracts/deepbook_predict/pause_cap.d.mts +5 -5
  57. package/dist/contracts/deepbook_predict/pause_cap.d.mts.map +1 -1
  58. package/dist/contracts/deepbook_predict/plp.d.mts +74 -74
  59. package/dist/contracts/deepbook_predict/plp.d.mts.map +1 -1
  60. package/dist/contracts/deepbook_predict/pool_valuation_cap.d.mts +5 -5
  61. package/dist/contracts/deepbook_predict/pool_valuation_cap.d.mts.map +1 -1
  62. package/dist/contracts/deepbook_predict/predict_account.d.mts +22 -17
  63. package/dist/contracts/deepbook_predict/predict_account.d.mts.map +1 -1
  64. package/dist/contracts/deepbook_predict/predict_account.mjs +12 -6
  65. package/dist/contracts/deepbook_predict/predict_account.mjs.map +1 -1
  66. package/dist/contracts/deepbook_predict/pricing.d.mts +67 -67
  67. package/dist/contracts/deepbook_predict/pricing.d.mts.map +1 -1
  68. package/dist/contracts/deepbook_predict/protocol_config.d.mts +127 -83
  69. package/dist/contracts/deepbook_predict/protocol_config.d.mts.map +1 -1
  70. package/dist/contracts/deepbook_predict/protocol_config.mjs +59 -1
  71. package/dist/contracts/deepbook_predict/protocol_config.mjs.map +1 -1
  72. package/dist/contracts/deepbook_predict/range_codec.d.mts +2 -2
  73. package/dist/contracts/deepbook_predict/range_codec.d.mts.map +1 -1
  74. package/dist/contracts/deepbook_predict/registry.d.mts +32 -32
  75. package/dist/contracts/deepbook_predict/registry.d.mts.map +1 -1
  76. package/dist/contracts/deepbook_predict/vault_events.d.mts +131 -131
  77. package/dist/contracts/deepbook_predict_math/lazer_price.d.mts +13 -13
  78. package/dist/contracts/deepbook_predict_math/math.d.mts +14 -14
  79. package/dist/contracts/deepbook_predict_orders/delayed_execution_config.d.mts +30 -30
  80. package/dist/contracts/deepbook_predict_orders/deps/deepbook_predict/expiry_market.mjs +6 -0
  81. package/dist/contracts/deepbook_predict_orders/deps/deepbook_predict/expiry_market.mjs.map +1 -1
  82. package/dist/contracts/deepbook_predict_orders/desk.d.mts +28 -28
  83. package/dist/contracts/deepbook_predict_orders/desk.d.mts.map +1 -1
  84. package/dist/contracts/deepbook_predict_orders/order_queue.d.mts +187 -187
  85. package/dist/contracts/deepbook_predict_orders/queue.d.mts +240 -62
  86. package/dist/contracts/deepbook_predict_orders/queue.d.mts.map +1 -1
  87. package/dist/contracts/deepbook_predict_orders/queue.mjs +306 -41
  88. package/dist/contracts/deepbook_predict_orders/queue.mjs.map +1 -1
  89. package/dist/contracts/deepbook_predict_orders/queue_events.d.mts +140 -140
  90. package/dist/contracts/deepbook_sessions/session_config.d.mts +8 -8
  91. package/dist/contracts/deepbook_sessions/sessions.d.mts +271 -31
  92. package/dist/contracts/deepbook_sessions/sessions.d.mts.map +1 -1
  93. package/dist/contracts/deepbook_sessions/sessions.mjs +363 -3
  94. package/dist/contracts/deepbook_sessions/sessions.mjs.map +1 -1
  95. package/dist/deployments/mainnet.mjs.map +1 -1
  96. package/dist/deployments/testnet.d.mts.map +1 -1
  97. package/dist/deployments/testnet.mjs +7 -4
  98. package/dist/deployments/testnet.mjs.map +1 -1
  99. package/dist/predict/bindings/expiry-market.d.mts +57 -7
  100. package/dist/predict/bindings/expiry-market.d.mts.map +1 -1
  101. package/dist/predict/bindings/expiry-market.mjs +48 -2
  102. package/dist/predict/bindings/expiry-market.mjs.map +1 -1
  103. package/dist/predict/bindings/protocol-config.d.mts +5 -5
  104. package/dist/predict/bindings/protocol-config.d.mts.map +1 -1
  105. package/dist/predict/bindings/protocol-config.mjs +4 -1
  106. package/dist/predict/bindings/protocol-config.mjs.map +1 -1
  107. package/dist/predict/bindings/queue.d.mts +30 -0
  108. package/dist/predict/bindings/queue.d.mts.map +1 -0
  109. package/dist/predict/bindings/queue.mjs +59 -0
  110. package/dist/predict/bindings/queue.mjs.map +1 -0
  111. package/dist/predict/bindings/rename.mjs +5 -1
  112. package/dist/predict/bindings/rename.mjs.map +1 -1
  113. package/dist/predict/client.d.mts.map +1 -1
  114. package/dist/predict/client.mjs +11 -5
  115. package/dist/predict/client.mjs.map +1 -1
  116. package/dist/predict/config/generated.d.mts +1 -1
  117. package/dist/predict/config/generated.d.mts.map +1 -1
  118. package/dist/predict/config/generated.mjs +1 -0
  119. package/dist/predict/config/generated.mjs.map +1 -1
  120. package/dist/predict/config/mainnet.mjs +3 -1
  121. package/dist/predict/config/mainnet.mjs.map +1 -1
  122. package/dist/predict/config/testnet.mjs +3 -1
  123. package/dist/predict/config/testnet.mjs.map +1 -1
  124. package/dist/predict/config/types.d.mts +23 -0
  125. package/dist/predict/config/types.d.mts.map +1 -1
  126. package/dist/predict/cost.d.mts +9 -1
  127. package/dist/predict/cost.d.mts.map +1 -1
  128. package/dist/predict/cost.mjs.map +1 -1
  129. package/dist/predict/errors.d.mts.map +1 -1
  130. package/dist/predict/errors.mjs +6 -2
  131. package/dist/predict/errors.mjs.map +1 -1
  132. package/dist/predict/index.d.mts +1 -1
  133. package/dist/predict/index.mjs +2 -2
  134. package/dist/predict/queue.d.mts +8 -4
  135. package/dist/predict/queue.d.mts.map +1 -1
  136. package/dist/predict/queue.mjs +8 -4
  137. package/dist/predict/queue.mjs.map +1 -1
  138. package/dist/predict/reads/balances.mjs +1 -1
  139. package/dist/predict/reads/pricing.d.mts +1 -0
  140. package/dist/predict/reads/pricing.d.mts.map +1 -1
  141. package/dist/predict/reads/queue.d.mts +4 -2
  142. package/dist/predict/reads/queue.d.mts.map +1 -1
  143. package/dist/predict/reads/queue.mjs +5 -4
  144. package/dist/predict/reads/queue.mjs.map +1 -1
  145. package/dist/predict/tx/authed.mjs +1 -1
  146. package/dist/predict/tx/common.d.mts.map +1 -1
  147. package/dist/predict/tx/common.mjs +3 -2
  148. package/dist/predict/tx/common.mjs.map +1 -1
  149. package/dist/predict/tx/trade.d.mts.map +1 -1
  150. package/dist/predict/tx/trade.mjs +3 -2
  151. package/dist/predict/tx/trade.mjs.map +1 -1
  152. package/dist/sessions.d.mts +10 -1
  153. package/dist/sessions.d.mts.map +1 -1
  154. package/dist/sessions.mjs.map +1 -1
  155. package/dist/transactions/balanceManager.d.mts +12 -12
  156. package/dist/transactions/balanceManager.d.mts.map +1 -1
  157. package/dist/transactions/deepbook.d.mts +20 -20
  158. package/dist/transactions/deepbook.d.mts.map +1 -1
  159. package/dist/transactions/deepbookAdmin.d.mts +4 -4
  160. package/dist/transactions/deepbookAdmin.d.mts.map +1 -1
  161. package/dist/transactions/marginAdmin.d.mts +7 -7
  162. package/dist/transactions/marginAdmin.d.mts.map +1 -1
  163. package/dist/transactions/marginLiquidations.d.mts +3 -3
  164. package/dist/transactions/marginMaintainer.d.mts +5 -5
  165. package/dist/transactions/marginMaintainer.d.mts.map +1 -1
  166. package/dist/transactions/marginManager.d.mts +32 -32
  167. package/dist/transactions/marginPool.d.mts +18 -18
  168. package/dist/transactions/marginPool.d.mts.map +1 -1
  169. package/dist/transactions/marginRegistry.d.mts +16 -16
  170. package/dist/transactions/marginTPSL.d.mts +10 -10
  171. package/dist/transactions/poolProxy.d.mts +8 -8
  172. package/dist/transactions/poolProxy.d.mts.map +1 -1
  173. package/dist/utils/constants.d.mts.map +1 -1
  174. package/dist/utils/constants.mjs +1 -1
  175. package/dist/utils/constants.mjs.map +1 -1
  176. package/package.json +2 -2
  177. package/src/account-bindings/account-registry.ts +39 -0
  178. package/src/account-bindings/account.ts +73 -0
  179. package/src/account-bindings/latest.ts +41 -0
  180. package/src/account.ts +89 -5
  181. package/src/contracts/account/account.ts +73 -4
  182. package/src/contracts/account/account_registry.ts +1 -1
  183. package/src/contracts/deepbook_predict/builder_code.ts +94 -2
  184. package/src/contracts/deepbook_predict/config_events.ts +7 -0
  185. package/src/contracts/deepbook_predict/expiry_market.ts +490 -44
  186. package/src/contracts/deepbook_predict/order_events.ts +6 -4
  187. package/src/contracts/deepbook_predict/predict_account.ts +12 -6
  188. package/src/contracts/deepbook_predict/protocol_config.ts +85 -0
  189. package/src/contracts/deepbook_predict_orders/deps/deepbook_predict/expiry_market.ts +14 -0
  190. package/src/contracts/deepbook_predict_orders/order_flow.ts +4 -0
  191. package/src/contracts/deepbook_predict_orders/queue.ts +495 -9
  192. package/src/contracts/deepbook_sessions/sessions.ts +538 -3
  193. package/src/deployments/mainnet.ts +4 -4
  194. package/src/deployments/testnet.ts +18 -7
  195. package/src/deployments/types.ts +14 -0
  196. package/src/predict/bindings/expiry-market.ts +87 -0
  197. package/src/predict/bindings/queue.ts +42 -0
  198. package/src/predict/bindings/rename.ts +5 -1
  199. package/src/predict/client.ts +25 -3
  200. package/src/predict/config/generated.ts +3 -0
  201. package/src/predict/config/mainnet.ts +4 -0
  202. package/src/predict/config/testnet.ts +4 -0
  203. package/src/predict/config/types.ts +23 -0
  204. package/src/predict/cost.ts +9 -1
  205. package/src/predict/errors.ts +11 -1
  206. package/src/predict/index.ts +1 -1
  207. package/src/predict/queue.ts +8 -4
  208. package/src/predict/reads/queue.ts +7 -4
  209. package/src/predict/tx/common.ts +2 -0
  210. package/src/predict/tx/trade.ts +3 -1
  211. package/src/sessions.ts +10 -1
  212. package/src/utils/constants.ts +5 -1
@@ -1,8 +1,9 @@
1
1
  import { AccountConfig as AccountConfig$1 } from "./contracts/account/config-arguments.mjs";
2
2
  import { TESTNET_DEPLOYMENT, TESTNET_UNITS } from "./deployments/testnet.mjs";
3
3
  import { DeployedNetwork, NetworkArg, getDeployment, getUnits } from "./deployments/index.mjs";
4
- import { Account, AccountWrapper, account_d_exports } from "./contracts/account/account.mjs";
5
- import { account_registry_d_exports } from "./contracts/account/account_registry.mjs";
4
+ import { Account, AccountWrapper } from "./contracts/account/account.mjs";
5
+ import { account_d_exports } from "./account-bindings/account.mjs";
6
+ import { account_registry_d_exports } from "./account-bindings/account-registry.mjs";
6
7
  import { account_events_d_exports } from "./contracts/account/account_events.mjs";
7
8
  import { Transaction, TransactionObjectArgument, TransactionResult } from "@mysten/sui/transactions";
8
9
 
@@ -22,10 +23,21 @@ import { Transaction, TransactionObjectArgument, TransactionResult } from "@myst
22
23
  * wrapper-address derivation needs plain ids.
23
24
  */
24
25
  interface AccountConfig extends AccountConfig$1 {
25
- /** The `account` Move package id. */
26
+ /**
27
+ * The ORIGINAL `account` Move package id. Type tags and the derived wrapper address are built
28
+ * from it, so it never moves to an upgraded package: that would derive addresses nothing lives
29
+ * at, and a coin sent to one is lost.
30
+ */
26
31
  accountPackageId: string;
27
32
  /** The shared `AccountRegistry` object id. */
28
33
  accountRegistry: string;
34
+ /**
35
+ * The latest `account` package, once the network has upgraded it: the call target of every
36
+ * builder here. A PTB can't call account at an older version than another package in it links
37
+ * (Predict's Version 5 links account v2), and `receiveCoin` / `receiveCoinAtAccountId` exist
38
+ * only from v2. Absent while the network runs v1: calls then target `accountPackageId`.
39
+ */
40
+ accountPackageIdLatest?: string;
29
41
  }
30
42
  /**
31
43
  * @description The deployed `account` ids for `network`, so a caller does not transcribe
@@ -113,6 +125,37 @@ declare class AccountContract {
113
125
  amount: bigint;
114
126
  coinType: string;
115
127
  }): (tx: Transaction) => TransactionResult;
128
+ /**
129
+ * @description Move a `Coin<T>` that was transferred to an account's wrapper address into
130
+ * the account's stored balance (`receive_coin`). Permissionless: anyone may submit it, and
131
+ * value only enters the account the coin was addressed to. A sender that can only transfer a
132
+ * coin to an address (a bridge mint, for example) sends it to `deriveAccountWrapperId(owner)`.
133
+ * The coin can arrive before the account exists and waits there until the owner creates it.
134
+ * @param {object} params Wrapper id, the received coin's object id (or a `Receiving` input),
135
+ * and its coin type
136
+ * @returns A function that takes a Transaction object
137
+ * @throws if the config has no `accountPackageIdLatest`, i.e. the network still runs account v1
138
+ */
139
+ receiveCoin(params: {
140
+ wrapperId: string;
141
+ coin: string | TransactionObjectArgument;
142
+ coinType: string;
143
+ }): (tx: Transaction) => TransactionResult;
144
+ /**
145
+ * @description `receiveCoin` for a coin sent to the account's canonical ID (`account_id`,
146
+ * the address `account_registry::derived_address` returns) instead of its wrapper address.
147
+ * A `Receiving` input can't name its owner, so pick the call from where the coin sits: the
148
+ * wrong one aborts `EUnableToReceiveObject`. Senders should use the wrapper address.
149
+ * @param {object} params Wrapper id, the received coin's object id (or a `Receiving` input),
150
+ * and its coin type
151
+ * @returns A function that takes a Transaction object
152
+ * @throws if the config has no `accountPackageIdLatest`, i.e. the network still runs account v1
153
+ */
154
+ receiveCoinAtAccountId(params: {
155
+ wrapperId: string;
156
+ coin: string | TransactionObjectArgument;
157
+ coinType: string;
158
+ }): (tx: Transaction) => TransactionResult;
116
159
  /**
117
160
  * @description Borrow the `Account` out of its wrapper — the read-side entry point apps
118
161
  * chain their own getters onto (`account::balance<T>`, an app's own data accessors).
@@ -1 +1 @@
1
- {"version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iBAae,gBAAA,CAAiB,OAAA,EAAS,UAAA,GAAa,aAAA;;;;;;;;;;cAyB1C,eAAA;EAAA;EAiBW;;;cAXX,MAAA,EAAQ,aAAA;EA2BO;;;;;;;EAhB3B,sBAAA,CAAuB,KAAA;EA0CC;;;;;;EA3BxB,YAAA,CAAA,IACS,EAAA,EAAI,WAAA,KAAc,iBAAA;EAgDgD;;;;;;EAtC3E,aAAA,CAAA,IACS,EAAA,EAAI,WAAA;EA0D8C;;;;;;;;;EA3C3D,uBAAA,CAAwB,MAAA;IAAU,IAAA,EAAM,yBAAA;IAA2B,QAAA;EAAA,KAC1D,EAAA,EAAI,WAAA;EAwEc;;;;;;;EAnD3B,YAAA,CAAa,MAAA;IAAU,SAAA;IAAmB,IAAA,EAAM,yBAAA;IAA2B,QAAA;EAAA,KAClE,EAAA,EAAI,WAAA;EA8GD;;;;;;;;EA1FZ,aAAA,CAAc,MAAA;IAAU,SAAA;IAAmB,MAAA;IAAgB,QAAA;EAAA,KAClD,EAAA,EAAI,WAAA,KAAc,iBAAA;;;;;;;;;;;;EAuB3B,WAAA,CAAY,MAAA;IACX,SAAA;IACA,IAAA,WAAe,yBAAA;IACf,QAAA;EAAA,KAGQ,EAAA,EAAI,WAAA,KAAc,iBAAA;;;;;;;;;;;EAuB3B,sBAAA,CAAuB,MAAA;IACtB,SAAA;IACA,IAAA,WAAe,yBAAA;IACf,QAAA;EAAA,KAGQ,EAAA,EAAI,WAAA,KAAc,iBAAA;;;;;;;EA+B3B,WAAA,CAAY,MAAA;IAAU,SAAA;EAAA,KACb,EAAA,EAAI,WAAA,KAAc,iBAAA;;;;;;;;EAW3B,OAAA,CAAQ,MAAA;IAAU,KAAA;IAAe,QAAA;EAAA,KACxB,EAAA,EAAI,WAAA,KAAc,iBAAA;AAAA"}
package/dist/account.mjs CHANGED
@@ -1,5 +1,6 @@
1
- import { Account, AccountWrapper, account_exports, balance, depositFunds, generateAuth, loadAccount, share, withdrawFunds } from "./contracts/account/account.mjs";
2
- import { _new, account_registry_exports } from "./contracts/account/account_registry.mjs";
1
+ import { Account, AccountWrapper } from "./contracts/account/account.mjs";
2
+ import { account_exports, balance, depositFunds, generateAuth, loadAccount, receiveCoin, receiveCoinAtAccountId, share, withdrawFunds } from "./account-bindings/account.mjs";
3
+ import { _new, account_registry_exports } from "./account-bindings/account-registry.mjs";
3
4
  import { MAINNET_ACCOUNT } from "./deployments/mainnet.mjs";
4
5
  import { TESTNET_ACCOUNT, TESTNET_DEPLOYMENT, TESTNET_UNITS } from "./deployments/testnet.mjs";
5
6
  import { getDeployment, getUnits } from "./deployments/index.mjs";
@@ -148,6 +149,54 @@ var AccountContract = class {
148
149
  };
149
150
  }
150
151
  /**
152
+ * @description Move a `Coin<T>` that was transferred to an account's wrapper address into
153
+ * the account's stored balance (`receive_coin`). Permissionless: anyone may submit it, and
154
+ * value only enters the account the coin was addressed to. A sender that can only transfer a
155
+ * coin to an address (a bridge mint, for example) sends it to `deriveAccountWrapperId(owner)`.
156
+ * The coin can arrive before the account exists and waits there until the owner creates it.
157
+ * @param {object} params Wrapper id, the received coin's object id (or a `Receiving` input),
158
+ * and its coin type
159
+ * @returns A function that takes a Transaction object
160
+ * @throws if the config has no `accountPackageIdLatest`, i.e. the network still runs account v1
161
+ */
162
+ receiveCoin(params) {
163
+ const packageId = this.#latestPackage("receiveCoin");
164
+ return (tx) => tx.add(receiveCoin({
165
+ package: packageId,
166
+ arguments: {
167
+ wrapper: params.wrapperId,
168
+ coin: typeof params.coin === "string" ? tx.object(params.coin) : params.coin
169
+ },
170
+ typeArguments: [params.coinType]
171
+ }));
172
+ }
173
+ /**
174
+ * @description `receiveCoin` for a coin sent to the account's canonical ID (`account_id`,
175
+ * the address `account_registry::derived_address` returns) instead of its wrapper address.
176
+ * A `Receiving` input can't name its owner, so pick the call from where the coin sits: the
177
+ * wrong one aborts `EUnableToReceiveObject`. Senders should use the wrapper address.
178
+ * @param {object} params Wrapper id, the received coin's object id (or a `Receiving` input),
179
+ * and its coin type
180
+ * @returns A function that takes a Transaction object
181
+ * @throws if the config has no `accountPackageIdLatest`, i.e. the network still runs account v1
182
+ */
183
+ receiveCoinAtAccountId(params) {
184
+ const packageId = this.#latestPackage("receiveCoinAtAccountId");
185
+ return (tx) => tx.add(receiveCoinAtAccountId({
186
+ package: packageId,
187
+ arguments: {
188
+ wrapper: params.wrapperId,
189
+ coin: typeof params.coin === "string" ? tx.object(params.coin) : params.coin
190
+ },
191
+ typeArguments: [params.coinType]
192
+ }));
193
+ }
194
+ #latestPackage(builder) {
195
+ const latest = this.#config.accountPackageIdLatest;
196
+ if (!latest) throw new Error(`@mysten/deepbook-v3/account: ${builder} calls a function added in account v2, and this config has no \`accountPackageIdLatest\` (the network still runs account v1).`);
197
+ return latest;
198
+ }
199
+ /**
151
200
  * @description Borrow the `Account` out of its wrapper — the read-side entry point apps
152
201
  * chain their own getters onto (`account::balance<T>`, an app's own data accessors).
153
202
  * @param {object} params Wrapper id
@@ -1 +1 @@
1
- {"version":3,"file":"account.mjs","names":["#config","account.generateAuth","accountRegistry._new","account.share","account.depositFunds","account.withdrawFunds","account.loadAccount","account.balance"],"sources":["../src/account.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\nimport { bcs } from '@mysten/sui/bcs';\nimport type {\n\tTransaction,\n\tTransactionObjectArgument,\n\tTransactionResult,\n} from '@mysten/sui/transactions';\nimport { deriveObjectID } from '@mysten/sui/utils';\n\nimport * as account from './contracts/account/account.js';\nimport * as accountRegistry from './contracts/account/account_registry.js';\nimport type { AccountConfig as GeneratedAccountConfig } from './contracts/account/config-arguments.js';\nimport { MAINNET_ACCOUNT } from './deployments/mainnet.js';\nimport { TESTNET_ACCOUNT } from './deployments/testnet.js';\nimport type { NetworkArg } from './deployments/index.js';\n\n// Provenance: which on-chain deployment the ids above came from. Re-exported so a consumer\n// can answer \"which deploy is this build pinned to?\" without reaching for another subpath.\nexport { getDeployment, getUnits, TESTNET_DEPLOYMENT, TESTNET_UNITS } from './deployments/index.js';\nexport type { NetworkArg } from './deployments/index.js';\nexport type { DeployedNetwork } from './deployments/index.js';\n\n/**\n * The deployed ids of the shared `account` package this contract builds against.\n *\n * Kept deliberately minimal — ids only — so any consumer of the shared account primitive\n * (DeepBook core's account wrapper, Predict, …) can drive these builders with its OWN\n * deployment's ids without constructing a full product-SDK config.\n *\n * Extends the codegen-generated config interface so there is exactly one config shape and\n * casing: the generated bindings resolve `options.config` against these same keys, and if\n * codegen adds, drops, or renames a key this file stops compiling instead of silently\n * building a PTB against the wrong object. The ids are narrowed to `string` — codegen types\n * the package id as optional and the registry as the wider `ConfigValue`, but the\n * wrapper-address derivation needs plain ids.\n */\nexport interface AccountConfig extends GeneratedAccountConfig {\n\t/** The `account` Move package id. */\n\taccountPackageId: string;\n\t/** The shared `AccountRegistry` object id. */\n\taccountRegistry: string;\n}\n\n/**\n * @description The deployed `account` ids for `network`, so a caller does not transcribe\n * them. Generated from the deploy manifest — see `src/deployments/`.\n * @throws if the network has no recorded deployment, rather than returning placeholder ids\n * that would fail as a confusing on-chain abort.\n *\n * ```ts\n * const account = new AccountContract(getAccountConfig('testnet'));\n * ```\n */\nexport function getAccountConfig(network: NetworkArg): AccountConfig {\n\tif (network === 'testnet') return TESTNET_ACCOUNT;\n\tif (network === 'mainnet') return MAINNET_ACCOUNT;\n\tthrow new Error(\n\t\t`@mysten/deepbook-v3/account: no account deployment recorded for network '${network}'. ` +\n\t\t\t'The account primitive is recorded for testnet and mainnet; for your own deployment pass ' +\n\t\t\t'`{ accountPackageId, accountRegistry }` to AccountContract directly.',\n\t);\n}\n\n// `AccountWrapperKey(address)` is a one-field positional struct, so its BCS is just the\n// owner's 32-byte address. See `packages/account/sources/account_registry.move`.\nconst AccountWrapperKey = bcs.struct('AccountWrapperKey', {\n\tpos0: bcs.Address,\n});\n\n/**\n * AccountContract — the reusable on-chain account primitive (`packages/account`).\n *\n * An owner has one canonical `AccountWrapper`, a *derived* object of the account registry,\n * so its id is computable off-chain (no read). The wrapper holds an `Account` whose custody\n * balances apps deposit into and withdraw from; app-specific data hangs off it under an\n * app-keyed slot. Authority is a hot-potato `Auth` minted from the tx sender and consumed\n * by the very next account-loading call.\n */\nexport class AccountContract {\n\t#config: AccountConfig;\n\n\t/**\n\t * @param {AccountConfig} config Deployed ids of the shared `account` package\n\t */\n\tconstructor(config: AccountConfig) {\n\t\tthis.#config = config;\n\t}\n\n\t/**\n\t * @description The deterministic id of an owner's canonical account wrapper — no chain\n\t * read needed. The wrapper is a derived object of the account registry, so its id is\n\t * `derive_address(registry, AccountWrapperKey(owner))`.\n\t * @param {string} owner Owner address\n\t * @returns The wrapper object id\n\t */\n\tderiveAccountWrapperId(owner: string): string {\n\t\tconst key = AccountWrapperKey.serialize({ pos0: owner }).toBytes();\n\t\treturn deriveObjectID(\n\t\t\tthis.#config.accountRegistry,\n\t\t\t`${this.#config.accountPackageId}::account_registry::AccountWrapperKey`,\n\t\t\tkey,\n\t\t);\n\t}\n\n\t/**\n\t * @description Mint owner authority for the transaction sender. A hot-potato `Auth`\n\t * consumed by the very next account-loading call (`load_account_mut` inside\n\t * `deposit_funds` / `withdraw_funds` / an app's own entrypoints).\n\t * @returns A function that takes a Transaction object\n\t */\n\tgenerateAuth() {\n\t\treturn (tx: Transaction): TransactionResult =>\n\t\t\ttx.add(account.generateAuth({ config: this.#config }));\n\t}\n\n\t/**\n\t * @description Create the sender's canonical account wrapper and share it. `new` derives\n\t * the wrapper at its deterministic address (see `deriveAccountWrapperId`) and aborts if\n\t * it already exists; `share` publishes the shared object apps borrow against.\n\t * @returns A function that takes a Transaction object\n\t */\n\tcreateAccount() {\n\t\treturn (tx: Transaction): void => {\n\t\t\tconst wrapper = tx.add(accountRegistry._new({ config: this.#config }));\n\t\t\ttx.add(account.share({ config: this.#config, arguments: { self: wrapper } }));\n\t\t};\n\t}\n\n\t/**\n\t * @description First-time funding in ONE PTB: create the sender's wrapper, deposit\n\t * `coin` through the fresh handle, then `share` LAST (once shared, by-value use of the\n\t * handle is over). This cannot be split into `createAccount` + `depositFunds`: an object\n\t * input can only address an object that pre-exists the PTB, so a wrapper created inside\n\t * it is reachable only through `new`'s result handle.\n\t * @param {object} params Coin to deposit and its coin type\n\t * @returns A function that takes a Transaction object\n\t */\n\tcreateAccountAndDeposit(params: { coin: TransactionObjectArgument; coinType: string }) {\n\t\treturn (tx: Transaction): void => {\n\t\t\tconst wrapper = tx.add(accountRegistry._new({ config: this.#config }));\n\t\t\tconst auth = tx.add(this.generateAuth());\n\t\t\ttx.add(\n\t\t\t\taccount.depositFunds({\n\t\t\t\t\tconfig: this.#config,\n\t\t\t\t\targuments: { wrapper, auth, coin: params.coin },\n\t\t\t\t\ttypeArguments: [params.coinType],\n\t\t\t\t}),\n\t\t\t);\n\t\t\ttx.add(account.share({ config: this.#config, arguments: { self: wrapper } }));\n\t\t};\n\t}\n\n\t/**\n\t * @description Deposit a caller-provided `coin` into the account's stored balance via the\n\t * PTB-callable `deposit_funds` (folds settle → authorize → load → deposit; clock and\n\t * accumulator root auto-injected). The caller owns coin sourcing.\n\t * @param {object} params Wrapper id, coin to deposit, and its coin type\n\t * @returns A function that takes a Transaction object\n\t */\n\tdepositFunds(params: { wrapperId: string; coin: TransactionObjectArgument; coinType: string }) {\n\t\treturn (tx: Transaction): void => {\n\t\t\tconst auth = tx.add(this.generateAuth());\n\t\t\ttx.add(\n\t\t\t\taccount.depositFunds({\n\t\t\t\t\tconfig: this.#config,\n\t\t\t\t\targuments: { wrapper: params.wrapperId, auth, coin: params.coin },\n\t\t\t\t\ttypeArguments: [params.coinType],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\t}\n\n\t/**\n\t * @description Withdraw `amount` (raw u64 units) from the account's stored balance via\n\t * the PTB-callable `withdraw_funds` (folds settle → authorize → load → withdraw; clock\n\t * and accumulator root auto-injected), returning the minted `Coin<T>` for the caller to\n\t * transfer or compose.\n\t * @param {object} params Wrapper id, raw amount, and coin type\n\t * @returns A function that takes a Transaction object and returns the `Coin<T>`\n\t */\n\twithdrawFunds(params: { wrapperId: string; amount: bigint; coinType: string }) {\n\t\treturn (tx: Transaction): TransactionResult => {\n\t\t\tconst auth = tx.add(this.generateAuth());\n\t\t\treturn tx.add(\n\t\t\t\taccount.withdrawFunds({\n\t\t\t\t\tconfig: this.#config,\n\t\t\t\t\targuments: { wrapper: params.wrapperId, auth, amount: params.amount },\n\t\t\t\t\ttypeArguments: [params.coinType],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\t}\n\n\t/**\n\t * @description Borrow the `Account` out of its wrapper — the read-side entry point apps\n\t * chain their own getters onto (`account::balance<T>`, an app's own data accessors).\n\t * @param {object} params Wrapper id\n\t * @returns A function that takes a Transaction object and returns the `Account`\n\t */\n\tloadAccount(params: { wrapperId: string }) {\n\t\treturn (tx: Transaction): TransactionResult =>\n\t\t\ttx.add(account.loadAccount({ config: this.#config, arguments: { self: params.wrapperId } }));\n\t}\n\n\t/**\n\t * @description Read an owner's stored custody balance for a coin type: chains\n\t * `load_account(wrapper)` → `balance<T>(account, root, clock)`. Compose in a\n\t * dev-inspect/simulate PTB and read the u64 return of the LAST command.\n\t * @param {object} params Owner address and coin type\n\t * @returns A function that takes a Transaction object\n\t */\n\tbalance(params: { owner: string; coinType: string }) {\n\t\treturn (tx: Transaction): TransactionResult => {\n\t\t\tconst acct = tx.add(\n\t\t\t\tthis.loadAccount({ wrapperId: this.deriveAccountWrapperId(params.owner) }),\n\t\t\t);\n\t\t\treturn tx.add(\n\t\t\t\taccount.balance({\n\t\t\t\t\tconfig: this.#config,\n\t\t\t\t\ttypeArguments: [params.coinType],\n\t\t\t\t\targuments: { self: acct },\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\t}\n}\n\n// === Generated bindings ===\n// The move-call thunks and BCS structs, for consumers composing their own PTBs or\n// parsing account objects/events (e.g. `AccountWrapper.parse`, the event layouts).\n//\n// NOTE: `Account` here is the shared account primitive's custody account\n// (`account::account::Account`). It is deliberately NOT re-exported from this\n// package's root — the root already exports a different `Account`\n// (`@deepbook/core::account::Account`, the per-pool trading account) and the two\n// have unrelated layouts. Keep them separated by subpath.\nexport * as accountMoveCalls from './contracts/account/account.js';\nexport * as accountRegistryMoveCalls from './contracts/account/account_registry.js';\nexport * as accountEvents from './contracts/account/account_events.js';\nexport { Account, AccountWrapper } from './contracts/account/account.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsDA,SAAgB,iBAAiB,SAAoC;AACpE,KAAI,YAAY,UAAW,QAAO;AAClC,KAAI,YAAY,UAAW,QAAO;AAClC,OAAM,IAAI,MACT,4EAA4E,QAAQ,mKAGpF;;AAKF,MAAM,oBAAoB,IAAI,OAAO,qBAAqB,EACzD,MAAM,IAAI,SACV,CAAC;;;;;;;;;;AAWF,IAAa,kBAAb,MAA6B;CAC5B;;;;CAKA,YAAY,QAAuB;AAClC,QAAKA,SAAU;;;;;;;;;CAUhB,uBAAuB,OAAuB;EAC7C,MAAM,MAAM,kBAAkB,UAAU,EAAE,MAAM,OAAO,CAAC,CAAC,SAAS;AAClE,SAAO,eACN,MAAKA,OAAQ,iBACb,GAAG,MAAKA,OAAQ,iBAAiB,wCACjC,IACA;;;;;;;;CASF,eAAe;AACd,UAAQ,OACP,GAAG,IAAIC,aAAqB,EAAE,QAAQ,MAAKD,QAAS,CAAC,CAAC;;;;;;;;CASxD,gBAAgB;AACf,UAAQ,OAA0B;GACjC,MAAM,UAAU,GAAG,IAAIE,KAAqB,EAAE,QAAQ,MAAKF,QAAS,CAAC,CAAC;AACtE,MAAG,IAAIG,MAAc;IAAE,QAAQ,MAAKH;IAAS,WAAW,EAAE,MAAM,SAAS;IAAE,CAAC,CAAC;;;;;;;;;;;;CAa/E,wBAAwB,QAA+D;AACtF,UAAQ,OAA0B;GACjC,MAAM,UAAU,GAAG,IAAIE,KAAqB,EAAE,QAAQ,MAAKF,QAAS,CAAC,CAAC;GACtE,MAAM,OAAO,GAAG,IAAI,KAAK,cAAc,CAAC;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depositFunds","account.withdrawFunds","#latestPackage","account.receiveCoin","account.receiveCoinAtAccountId","account.loadAccount","account.balance"],"sources":["../src/account.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\nimport { bcs } from '@mysten/sui/bcs';\nimport type {\n\tTransaction,\n\tTransactionObjectArgument,\n\tTransactionResult,\n} from '@mysten/sui/transactions';\nimport { deriveObjectID } from '@mysten/sui/utils';\n\nimport * as account from './account-bindings/account.js';\nimport * as accountRegistry from './account-bindings/account-registry.js';\nimport type { AccountConfig as GeneratedAccountConfig } from './contracts/account/config-arguments.js';\nimport { MAINNET_ACCOUNT } from './deployments/mainnet.js';\nimport { TESTNET_ACCOUNT } from './deployments/testnet.js';\nimport type { NetworkArg } from './deployments/index.js';\n\n// Provenance: which on-chain deployment the ids above came from. Re-exported so a consumer\n// can answer \"which deploy is this build pinned to?\" without reaching for another subpath.\nexport { getDeployment, getUnits, TESTNET_DEPLOYMENT, TESTNET_UNITS } from './deployments/index.js';\nexport type { NetworkArg } from './deployments/index.js';\nexport type { DeployedNetwork } from './deployments/index.js';\n\n/**\n * The deployed ids of the shared `account` package this contract builds against.\n *\n * Kept deliberately minimal — ids only — so any consumer of the shared account primitive\n * (DeepBook core's account wrapper, Predict, …) can drive these builders with its OWN\n * deployment's ids without constructing a full product-SDK config.\n *\n * Extends the codegen-generated config interface so there is exactly one config shape and\n * casing: the generated bindings resolve `options.config` against these same keys, and if\n * codegen adds, drops, or renames a key this file stops compiling instead of silently\n * building a PTB against the wrong object. The ids are narrowed to `string` — codegen types\n * the package id as optional and the registry as the wider `ConfigValue`, but the\n * wrapper-address derivation needs plain ids.\n */\nexport interface AccountConfig extends GeneratedAccountConfig {\n\t/**\n\t * The ORIGINAL `account` Move package id. Type tags and the derived wrapper address are built\n\t * from it, so it never moves to an upgraded package: that would derive addresses nothing lives\n\t * at, and a coin sent to one is lost.\n\t */\n\taccountPackageId: string;\n\t/** The shared `AccountRegistry` object id. */\n\taccountRegistry: string;\n\t/**\n\t * The latest `account` package, once the network has upgraded it: the call target of every\n\t * builder here. A PTB can't call account at an older version than another package in it links\n\t * (Predict's Version 5 links account v2), and `receiveCoin` / `receiveCoinAtAccountId` exist\n\t * only from v2. Absent while the network runs v1: calls then target `accountPackageId`.\n\t */\n\taccountPackageIdLatest?: string;\n}\n\n/**\n * @description The deployed `account` ids for `network`, so a caller does not transcribe\n * them. Generated from the deploy manifest — see `src/deployments/`.\n * @throws if the network has no recorded deployment, rather than returning placeholder ids\n * that would fail as a confusing on-chain abort.\n *\n * ```ts\n * const account = new AccountContract(getAccountConfig('testnet'));\n * ```\n */\nexport function getAccountConfig(network: NetworkArg): AccountConfig {\n\tif (network === 'testnet') return TESTNET_ACCOUNT;\n\tif (network === 'mainnet') return MAINNET_ACCOUNT;\n\tthrow new Error(\n\t\t`@mysten/deepbook-v3/account: no account deployment recorded for network '${network}'. ` +\n\t\t\t'The account primitive is recorded for testnet and mainnet; for your own deployment pass ' +\n\t\t\t'`{ accountPackageId, accountRegistry }` to AccountContract directly.',\n\t);\n}\n\n// `AccountWrapperKey(address)` is a one-field positional struct, so its BCS is just the\n// owner's 32-byte address. See `packages/account/sources/account_registry.move`.\nconst AccountWrapperKey = bcs.struct('AccountWrapperKey', {\n\tpos0: bcs.Address,\n});\n\n/**\n * AccountContract — the reusable on-chain account primitive (`packages/account`).\n *\n * An owner has one canonical `AccountWrapper`, a *derived* object of the account registry,\n * so its id is computable off-chain (no read). The wrapper holds an `Account` whose custody\n * balances apps deposit into and withdraw from; app-specific data hangs off it under an\n * app-keyed slot. Authority is a hot-potato `Auth` minted from the tx sender and consumed\n * by the very next account-loading call.\n */\nexport class AccountContract {\n\t#config: AccountConfig;\n\n\t/**\n\t * @param {AccountConfig} config Deployed ids of the shared `account` package\n\t */\n\tconstructor(config: AccountConfig) {\n\t\tthis.#config = config;\n\t}\n\n\t/**\n\t * @description The deterministic id of an owner's canonical account wrapper — no chain\n\t * read needed. The wrapper is a derived object of the account registry, so its id is\n\t * `derive_address(registry, AccountWrapperKey(owner))`.\n\t * @param {string} owner Owner address\n\t * @returns The wrapper object id\n\t */\n\tderiveAccountWrapperId(owner: string): string {\n\t\tconst key = AccountWrapperKey.serialize({ pos0: owner }).toBytes();\n\t\treturn deriveObjectID(\n\t\t\tthis.#config.accountRegistry,\n\t\t\t`${this.#config.accountPackageId}::account_registry::AccountWrapperKey`,\n\t\t\tkey,\n\t\t);\n\t}\n\n\t/**\n\t * @description Mint owner authority for the transaction sender. A hot-potato `Auth`\n\t * consumed by the very next account-loading call (`load_account_mut` inside\n\t * `deposit_funds` / `withdraw_funds` / an app's own entrypoints).\n\t * @returns A function that takes a Transaction object\n\t */\n\tgenerateAuth() {\n\t\treturn (tx: Transaction): TransactionResult =>\n\t\t\ttx.add(account.generateAuth({ config: this.#config }));\n\t}\n\n\t/**\n\t * @description Create the sender's canonical account wrapper and share it. `new` derives\n\t * the wrapper at its deterministic address (see `deriveAccountWrapperId`) and aborts if\n\t * it already exists; `share` publishes the shared object apps borrow against.\n\t * @returns A function that takes a Transaction object\n\t */\n\tcreateAccount() {\n\t\treturn (tx: Transaction): void => {\n\t\t\tconst wrapper = tx.add(accountRegistry._new({ config: this.#config }));\n\t\t\ttx.add(account.share({ config: this.#config, arguments: { self: wrapper } }));\n\t\t};\n\t}\n\n\t/**\n\t * @description First-time funding in ONE PTB: create the sender's wrapper, deposit\n\t * `coin` through the fresh handle, then `share` LAST (once shared, by-value use of the\n\t * handle is over). This cannot be split into `createAccount` + `depositFunds`: an object\n\t * input can only address an object that pre-exists the PTB, so a wrapper created inside\n\t * it is reachable only through `new`'s result handle.\n\t * @param {object} params Coin to deposit and its coin type\n\t * @returns A function that takes a Transaction object\n\t */\n\tcreateAccountAndDeposit(params: { coin: TransactionObjectArgument; coinType: string }) {\n\t\treturn (tx: Transaction): void => {\n\t\t\tconst wrapper = tx.add(accountRegistry._new({ config: this.#config }));\n\t\t\tconst auth = tx.add(this.generateAuth());\n\t\t\ttx.add(\n\t\t\t\taccount.depositFunds({\n\t\t\t\t\tconfig: this.#config,\n\t\t\t\t\targuments: { wrapper, auth, coin: params.coin },\n\t\t\t\t\ttypeArguments: [params.coinType],\n\t\t\t\t}),\n\t\t\t);\n\t\t\ttx.add(account.share({ config: this.#config, arguments: { self: wrapper } }));\n\t\t};\n\t}\n\n\t/**\n\t * @description Deposit a caller-provided `coin` into the account's stored balance via the\n\t * PTB-callable `deposit_funds` (folds settle → authorize → load → deposit; clock and\n\t * accumulator root auto-injected). The caller owns coin sourcing.\n\t * @param {object} params Wrapper id, coin to deposit, and its coin type\n\t * @returns A function that takes a Transaction object\n\t */\n\tdepositFunds(params: { wrapperId: string; coin: TransactionObjectArgument; coinType: string }) {\n\t\treturn (tx: Transaction): void => {\n\t\t\tconst auth = tx.add(this.generateAuth());\n\t\t\ttx.add(\n\t\t\t\taccount.depositFunds({\n\t\t\t\t\tconfig: this.#config,\n\t\t\t\t\targuments: { wrapper: params.wrapperId, auth, coin: params.coin },\n\t\t\t\t\ttypeArguments: [params.coinType],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\t}\n\n\t/**\n\t * @description Withdraw `amount` (raw u64 units) from the account's stored balance via\n\t * the PTB-callable `withdraw_funds` (folds settle → authorize → load → withdraw; clock\n\t * and accumulator root auto-injected), returning the minted `Coin<T>` for the caller to\n\t * transfer or compose.\n\t * @param {object} params Wrapper id, raw amount, and coin type\n\t * @returns A function that takes a Transaction object and returns the `Coin<T>`\n\t */\n\twithdrawFunds(params: { wrapperId: string; amount: bigint; coinType: string }) {\n\t\treturn (tx: Transaction): TransactionResult => {\n\t\t\tconst auth = tx.add(this.generateAuth());\n\t\t\treturn tx.add(\n\t\t\t\taccount.withdrawFunds({\n\t\t\t\t\tconfig: this.#config,\n\t\t\t\t\targuments: { wrapper: params.wrapperId, auth, amount: params.amount },\n\t\t\t\t\ttypeArguments: [params.coinType],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\t}\n\n\t/**\n\t * @description Move a `Coin<T>` that was transferred to an account's wrapper address into\n\t * the account's stored balance (`receive_coin`). Permissionless: anyone may submit it, and\n\t * value only enters the account the coin was addressed to. A sender that can only transfer a\n\t * coin to an address (a bridge mint, for example) sends it to `deriveAccountWrapperId(owner)`.\n\t * The coin can arrive before the account exists and waits there until the owner creates it.\n\t * @param {object} params Wrapper id, the received coin's object id (or a `Receiving` input),\n\t * and its coin type\n\t * @returns A function that takes a Transaction object\n\t * @throws if the config has no `accountPackageIdLatest`, i.e. the network still runs account v1\n\t */\n\treceiveCoin(params: {\n\t\twrapperId: string;\n\t\tcoin: string | TransactionObjectArgument;\n\t\tcoinType: string;\n\t}) {\n\t\tconst packageId = this.#latestPackage('receiveCoin');\n\t\treturn (tx: Transaction): TransactionResult =>\n\t\t\ttx.add(\n\t\t\t\taccount.receiveCoin({\n\t\t\t\t\tpackage: packageId,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\twrapper: params.wrapperId,\n\t\t\t\t\t\tcoin: typeof params.coin === 'string' ? tx.object(params.coin) : params.coin,\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [params.coinType],\n\t\t\t\t}),\n\t\t\t);\n\t}\n\n\t/**\n\t * @description `receiveCoin` for a coin sent to the account's canonical ID (`account_id`,\n\t * the address `account_registry::derived_address` returns) instead of its wrapper address.\n\t * A `Receiving` input can't name its owner, so pick the call from where the coin sits: the\n\t * wrong one aborts `EUnableToReceiveObject`. Senders should use the wrapper address.\n\t * @param {object} params Wrapper id, the received coin's object id (or a `Receiving` input),\n\t * and its coin type\n\t * @returns A function that takes a Transaction object\n\t * @throws if the config has no `accountPackageIdLatest`, i.e. the network still runs account v1\n\t */\n\treceiveCoinAtAccountId(params: {\n\t\twrapperId: string;\n\t\tcoin: string | TransactionObjectArgument;\n\t\tcoinType: string;\n\t}) {\n\t\tconst packageId = this.#latestPackage('receiveCoinAtAccountId');\n\t\treturn (tx: Transaction): TransactionResult =>\n\t\t\ttx.add(\n\t\t\t\taccount.receiveCoinAtAccountId({\n\t\t\t\t\tpackage: packageId,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\twrapper: params.wrapperId,\n\t\t\t\t\t\tcoin: typeof params.coin === 'string' ? tx.object(params.coin) : params.coin,\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [params.coinType],\n\t\t\t\t}),\n\t\t\t);\n\t}\n\n\t// The call target for the functions added in account v2, which v1 doesn't have.\n\t#latestPackage(builder: string): string {\n\t\tconst latest = this.#config.accountPackageIdLatest;\n\t\tif (!latest) {\n\t\t\tthrow new Error(\n\t\t\t\t`@mysten/deepbook-v3/account: ${builder} calls a function added in account v2, and this ` +\n\t\t\t\t\t'config has no `accountPackageIdLatest` (the network still runs account v1).',\n\t\t\t);\n\t\t}\n\t\treturn latest;\n\t}\n\n\t/**\n\t * @description Borrow the `Account` out of its wrapper — the read-side entry point apps\n\t * chain their own getters onto (`account::balance<T>`, an app's own data accessors).\n\t * @param {object} params Wrapper id\n\t * @returns A function that takes a Transaction object and returns the `Account`\n\t */\n\tloadAccount(params: { wrapperId: string }) {\n\t\treturn (tx: Transaction): TransactionResult =>\n\t\t\ttx.add(account.loadAccount({ config: this.#config, arguments: { self: params.wrapperId } }));\n\t}\n\n\t/**\n\t * @description Read an owner's stored custody balance for a coin type: chains\n\t * `load_account(wrapper)` → `balance<T>(account, root, clock)`. Compose in a\n\t * dev-inspect/simulate PTB and read the u64 return of the LAST command.\n\t * @param {object} params Owner address and coin type\n\t * @returns A function that takes a Transaction object\n\t */\n\tbalance(params: { owner: string; coinType: string }) {\n\t\treturn (tx: Transaction): TransactionResult => {\n\t\t\tconst acct = tx.add(\n\t\t\t\tthis.loadAccount({ wrapperId: this.deriveAccountWrapperId(params.owner) }),\n\t\t\t);\n\t\t\treturn tx.add(\n\t\t\t\taccount.balance({\n\t\t\t\t\tconfig: this.#config,\n\t\t\t\t\ttypeArguments: [params.coinType],\n\t\t\t\t\targuments: { self: acct },\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\t}\n}\n\n// === Generated bindings ===\n// The move-call thunks and BCS structs, for consumers composing their own PTBs or\n// parsing account objects/events (e.g. `AccountWrapper.parse`, the event layouts).\n//\n// NOTE: `Account` here is the shared account primitive's custody account\n// (`account::account::Account`). It is deliberately NOT re-exported from this\n// package's root — the root already exports a different `Account`\n// (`@deepbook/core::account::Account`, the per-pool trading account) and the two\n// have unrelated layouts. Keep them separated by subpath.\n// The move calls resolve their package to `config.accountPackageIdLatest` when the config has one\n// (see `account-bindings/latest.ts`); `accountPackageId` stays the original for derivation.\nexport * as accountMoveCalls from './account-bindings/account.js';\nexport * as accountRegistryMoveCalls from './account-bindings/account-registry.js';\nexport * as accountEvents from './contracts/account/account_events.js';\nexport { Account, AccountWrapper } from './contracts/account/account.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAiEA,SAAgB,iBAAiB,SAAoC;AACpE,KAAI,YAAY,UAAW,QAAO;AAClC,KAAI,YAAY,UAAW,QAAO;AAClC,OAAM,IAAI,MACT,4EAA4E,QAAQ,mKAGpF;;AAKF,MAAM,oBAAoB,IAAI,OAAO,qBAAqB,EACzD,MAAM,IAAI,SACV,CAAC;;;;;;;;;;AAWF,IAAa,kBAAb,MAA6B;CAC5B;;;;CAKA,YAAY,QAAuB;AAClC,QAAKA,SAAU;;;;;;;;;CAUhB,uBAAuB,OAAuB;EAC7C,MAAM,MAAM,kBAAkB,UAAU,EAAE,MAAM,OAAO,CAAC,CAAC,SAAS;AAClE,SAAO,eACN,MAAKA,OAAQ,iBACb,GAAG,MAAKA,OAAQ,iBAAiB,wCACjC,IACA;;;;;;;;CASF,eAAe;AACd,UAAQ,OACP,GAAG,IAAIC,aAAqB,EAAE,QAAQ,MAAKD,QAAS,CAAC,CAAC;;;;;;;;CASxD,gBAAgB;AACf,UAAQ,OAA0B;GACjC,MAAM,UAAU,GAAG,IAAIE,KAAqB,EAAE,QAAQ,MAAKF,QAAS,CAAC,CAAC;AACtE,MAAG,IAAIG,M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ACD,eAAe,CAAC,OAAO,SAAS;GAChC,CAAC,CACF;;;;;;;;;;;;CAaH,uBAAuB,QAIpB;EACF,MAAM,YAAY,MAAKD,cAAe,yBAAyB;AAC/D,UAAQ,OACP,GAAG,IACFE,uBAA+B;GAC9B,SAAS;GACT,WAAW;IACV,SAAS,OAAO;IAChB,MAAM,OAAO,OAAO,SAAS,WAAW,GAAG,OAAO,OAAO,KAAK,GAAG,OAAO;IACxE;GACD,eAAe,CAAC,OAAO,SAAS;GAChC,CAAC,CACF;;CAIH,eAAe,SAAyB;EACvC,MAAM,SAAS,MAAKR,OAAQ;AAC5B,MAAI,CAAC,OACJ,OAAM,IAAI,MACT,gCAAgC,QAAQ,+HAExC;AAEF,SAAO;;;;;;;;CASR,YAAY,QAA+B;AAC1C,UAAQ,OACP,GAAG,IAAIS,YAAoB;GAAE,QAAQ,MAAKT;GAAS,WAAW,EAAE,MAAM,OAAO,WAAW;GAAE,CAAC,CAAC;;;;;;;;;CAU9F,QAAQ,QAA6C;AACpD,UAAQ,OAAuC;GAC9C,MAAM,OAAO,GAAG,IACf,KAAK,YAAY,EAAE,WAAW,KAAK,uBAAuB,OAAO,MAAM,EAAE,CAAC,CAC1E;AACD,UAAO,GAAG,IACTU,QAAgB;IACf,QAAQ,MAAKV;IACb,eAAe,CAAC,OAAO,SAAS;IAChC,WAAW,EAAE,MAAM,MAAM;IACzB,CAAC,CACF"}
package/dist/client.d.mts CHANGED
@@ -163,7 +163,7 @@ declare class DeepBookClient {
163
163
  }[] | null>;
164
164
  getLevel2Range(poolKey: string, priceLow: number | bigint, priceHigh: number | bigint, isBid: boolean): Promise<Level2Range>;
165
165
  getLevel2TicksFromMid(poolKey: string, ticks: number): Promise<Level2TicksFromMid>;
166
- getAccountOrderDetails(poolKey: string, managerKey: string): Promise<[] | {
166
+ getAccountOrderDetails(poolKey: string, managerKey: string): Promise<{
167
167
  balance_manager_id: string;
168
168
  order_id: string;
169
169
  client_order_id: string;
@@ -177,7 +177,7 @@ declare class DeepBookClient {
177
177
  epoch: string;
178
178
  status: number;
179
179
  expire_timestamp: string;
180
- }[]>;
180
+ }[] | []>;
181
181
  account(poolKey: string, managerKey: string): Promise<AccountInfo>;
182
182
  lockedBalance(poolKey: string, balanceManagerKey: string): Promise<LockedBalances>;
183
183
  getPoolDeepPrice(poolKey: string): Promise<PoolDeepPrice>;
@@ -1,12 +1,8 @@
1
1
  import { MoveStruct, MoveTuple, RawTransactionArgument } from "../utils/index.mjs";
2
2
  import { BcsType } from "@mysten/sui/bcs";
3
- import * as _mysten_sui_transactions0 from "@mysten/sui/transactions";
4
3
  import { Transaction, TransactionArgument } from "@mysten/sui/transactions";
5
4
 
6
5
  //#region src/contracts/account/account.d.ts
7
- declare namespace account_d_exports {
8
- export { Account, AccountIdArguments, AccountIdOptions, AccountWrapper, AttachArguments, AttachOptions, Auth, BalanceArguments, BalanceOptions, BorrowDataArguments, BorrowDataMutArguments, BorrowDataMutOptions, BorrowDataOptions, CoinKey, DataKey, DepositArguments, DepositFundsArguments, DepositFundsOptions, DepositOptions, DetachArguments, DetachOptions, GenerateAuthAsObjectArguments, GenerateAuthAsObjectOptions, GenerateAuthOptions, HasDataArguments, HasDataOptions, IdArguments, IdOptions, LoadAccountArguments, LoadAccountMutArguments, LoadAccountMutOptions, LoadAccountOptions, OwnerArguments, OwnerOptions, ReceiveAddressArguments, ReceiveAddressOptions, ReferrerAccountIdArguments, ReferrerAccountIdOptions, ReferrerReceiveAddressArguments, ReferrerReceiveAddressOptions, SettleArguments, SettleOptions, ShareArguments, ShareOptions, WithdrawArguments, WithdrawFundsArguments, WithdrawFundsOptions, WithdrawOptions, accountId, attach, balance, borrowData, borrowDataMut, deposit, depositFunds, detach, generateAuth, generateAuthAsObject, hasData, id, loadAccount, loadAccountMut, owner, receiveAddress, referrerAccountId, referrerReceiveAddress, settle, share, withdraw, withdrawFunds };
9
- }
10
6
  declare const Account: MoveStruct<{
11
7
  /** Dynamic-field parent for account-owned application data. */account_id: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">; /** EOA address or object-ID-as-address that owns this account. */
12
8
  owner: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">; /** Wrapper-object address used as the accumulator delivery and withdrawal anchor. */
@@ -56,8 +52,6 @@ interface IdOptions {
56
52
  accountPackageId?: string;
57
53
  };
58
54
  }
59
- /** Returns the wrapper object ID. */
60
- declare function id(options: IdOptions): (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
61
55
  interface LoadAccountArguments {
62
56
  self: RawTransactionArgument<string>;
63
57
  }
@@ -68,8 +62,6 @@ interface LoadAccountOptions {
68
62
  accountPackageId?: string;
69
63
  };
70
64
  }
71
- /** Borrows the wrapped account for read-only composition. */
72
- declare function loadAccount(options: LoadAccountOptions): (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
73
65
  interface BalanceArguments {
74
66
  self: TransactionArgument;
75
67
  }
@@ -81,11 +73,6 @@ interface BalanceOptions {
81
73
  };
82
74
  typeArguments: [string];
83
75
  }
84
- /**
85
- * Returns the total balance of `T` available to the account, including funds
86
- * delivered through the ambient accumulator but not yet settled into the account.
87
- */
88
- declare function balance(options: BalanceOptions): (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
89
76
  interface OwnerArguments {
90
77
  self: TransactionArgument;
91
78
  }
@@ -96,11 +83,6 @@ interface OwnerOptions {
96
83
  accountPackageId?: string;
97
84
  };
98
85
  }
99
- /**
100
- * Returns the account owner address. This may be an EOA address or an
101
- * object-ID-as-address.
102
- */
103
- declare function owner(options: OwnerOptions): (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
104
86
  interface AccountIdArguments {
105
87
  self: TransactionArgument;
106
88
  }
@@ -111,8 +93,6 @@ interface AccountIdOptions {
111
93
  accountPackageId?: string;
112
94
  };
113
95
  }
114
- /** Returns the canonical account ID. */
115
- declare function accountId(options: AccountIdOptions): (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
116
96
  interface ReferrerAccountIdArguments {
117
97
  self: TransactionArgument;
118
98
  }
@@ -123,11 +103,6 @@ interface ReferrerAccountIdOptions {
123
103
  accountPackageId?: string;
124
104
  };
125
105
  }
126
- /**
127
- * Returns the canonical referrer account ID recorded at creation for external Move
128
- * composition.
129
- */
130
- declare function referrerAccountId(options: ReferrerAccountIdOptions): (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
131
106
  interface ReferrerReceiveAddressArguments {
132
107
  self: TransactionArgument;
133
108
  }
@@ -138,11 +113,6 @@ interface ReferrerReceiveAddressOptions {
138
113
  accountPackageId?: string;
139
114
  };
140
115
  }
141
- /**
142
- * Returns the referrer's accumulator receive address for external Move
143
- * composition.
144
- */
145
- declare function referrerReceiveAddress(options: ReferrerReceiveAddressOptions): (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
146
116
  interface ReceiveAddressArguments {
147
117
  self: TransactionArgument;
148
118
  }
@@ -153,8 +123,6 @@ interface ReceiveAddressOptions {
153
123
  accountPackageId?: string;
154
124
  };
155
125
  }
156
- /** Returns the accumulator receive address for this account (the wrapper address). */
157
- declare function receiveAddress(options: ReceiveAddressOptions): (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
158
126
  interface GenerateAuthOptions {
159
127
  package?: string;
160
128
  arguments?: [];
@@ -162,8 +130,6 @@ interface GenerateAuthOptions {
162
130
  accountPackageId?: string;
163
131
  };
164
132
  }
165
- /** Creates owner authority bound to the transaction sender. */
166
- declare function generateAuth(options?: GenerateAuthOptions): (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
167
133
  interface GenerateAuthAsObjectArguments {
168
134
  uid: RawTransactionArgument<string>;
169
135
  }
@@ -174,8 +140,6 @@ interface GenerateAuthAsObjectOptions {
174
140
  accountPackageId?: string;
175
141
  };
176
142
  }
177
- /** Creates owner authority bound to an owning object's address. */
178
- declare function generateAuthAsObject(options: GenerateAuthAsObjectOptions): (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
179
143
  interface ShareArguments {
180
144
  self: RawTransactionArgument<string>;
181
145
  }
@@ -186,8 +150,6 @@ interface ShareOptions {
186
150
  accountPackageId?: string;
187
151
  };
188
152
  }
189
- /** Shares a newly created account wrapper. */
190
- declare function share(options: ShareOptions): (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
191
153
  interface LoadAccountMutArguments {
192
154
  self: RawTransactionArgument<string>;
193
155
  auth: TransactionArgument;
@@ -199,12 +161,6 @@ interface LoadAccountMutOptions {
199
161
  accountPackageId?: string;
200
162
  };
201
163
  }
202
- /**
203
- * Consumes owner or app authority and returns the account's full mutable surface.
204
- * Owner authority must match the stored owner; app authority is package-issued
205
- * after registry authorization and carries no owner or operation restriction.
206
- */
207
- declare function loadAccountMut(options: LoadAccountMutOptions): (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
208
164
  interface SettleArguments {
209
165
  wrapper: RawTransactionArgument<string>;
210
166
  }
@@ -216,15 +172,30 @@ interface SettleOptions {
216
172
  };
217
173
  typeArguments: [string];
218
174
  }
219
- /**
220
- * Permissionlessly folds accumulator-delivered `T` at the wrapper address into
221
- * stored account balance. The per-coin timestamp is latched before reading the
222
- * accumulator, preventing duplicate withdrawal and same-timestamp double counting
223
- * even when no funds are available. Only the wrapper UID can authenticate the
224
- * address-balance withdrawal; value leaving the account still requires a mutable
225
- * borrow through `Auth`.
226
- */
227
- declare function settle(options: SettleOptions): (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
175
+ interface ReceiveCoinArguments {
176
+ wrapper: RawTransactionArgument<string>;
177
+ coin: TransactionArgument;
178
+ }
179
+ interface ReceiveCoinOptions {
180
+ package?: string;
181
+ arguments: ReceiveCoinArguments | [wrapper: RawTransactionArgument<string>, coin: TransactionArgument];
182
+ config?: {
183
+ accountPackageId?: string;
184
+ };
185
+ typeArguments: [string];
186
+ }
187
+ interface ReceiveCoinAtAccountIdArguments {
188
+ wrapper: RawTransactionArgument<string>;
189
+ coin: TransactionArgument;
190
+ }
191
+ interface ReceiveCoinAtAccountIdOptions {
192
+ package?: string;
193
+ arguments: ReceiveCoinAtAccountIdArguments | [wrapper: RawTransactionArgument<string>, coin: TransactionArgument];
194
+ config?: {
195
+ accountPackageId?: string;
196
+ };
197
+ typeArguments: [string];
198
+ }
228
199
  interface DepositArguments {
229
200
  self: TransactionArgument;
230
201
  coin: RawTransactionArgument<string>;
@@ -237,11 +208,6 @@ interface DepositOptions {
237
208
  };
238
209
  typeArguments: [string];
239
210
  }
240
- /**
241
- * Deposits into stored balance only; callers that include accumulator funds must
242
- * settle through the wrapper first.
243
- */
244
- declare function deposit(options: DepositOptions): (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
245
211
  interface WithdrawArguments {
246
212
  self: TransactionArgument;
247
213
  amount: RawTransactionArgument<number | bigint>;
@@ -254,11 +220,6 @@ interface WithdrawOptions {
254
220
  };
255
221
  typeArguments: [string];
256
222
  }
257
- /**
258
- * Withdraws from stored balance only; callers that include accumulator funds must
259
- * settle through the wrapper first.
260
- */
261
- declare function withdraw(options: WithdrawOptions): (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
262
223
  interface DepositFundsArguments {
263
224
  wrapper: RawTransactionArgument<string>;
264
225
  auth: TransactionArgument;
@@ -272,11 +233,6 @@ interface DepositFundsOptions {
272
233
  };
273
234
  typeArguments: [string];
274
235
  }
275
- /**
276
- * PTB entrypoint that settles accumulator funds, consumes authority, and deposits
277
- * into stored balance in one call.
278
- */
279
- declare function depositFunds(options: DepositFundsOptions): (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
280
236
  interface WithdrawFundsArguments {
281
237
  wrapper: RawTransactionArgument<string>;
282
238
  auth: TransactionArgument;
@@ -290,11 +246,6 @@ interface WithdrawFundsOptions {
290
246
  };
291
247
  typeArguments: [string];
292
248
  }
293
- /**
294
- * PTB entrypoint that settles accumulator funds, consumes authority, and withdraws
295
- * from stored balance in one call.
296
- */
297
- declare function withdrawFunds(options: WithdrawFundsOptions): (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
298
249
  interface AttachArguments<Data extends BcsType<any>> {
299
250
  self: TransactionArgument;
300
251
  Permit: TransactionArgument;
@@ -308,11 +259,6 @@ interface AttachOptions<Data extends BcsType<any>> {
308
259
  };
309
260
  typeArguments: [string, string];
310
261
  }
311
- /**
312
- * Attach an app's `Data` under its witness namespace. Requires `Permit<App>`.
313
- * Aborts if `App` already has data attached.
314
- */
315
- declare function attach<Data extends BcsType<any>>(options: AttachOptions<Data>): (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
316
262
  interface HasDataArguments {
317
263
  self: TransactionArgument;
318
264
  }
@@ -324,8 +270,6 @@ interface HasDataOptions {
324
270
  };
325
271
  typeArguments: [string];
326
272
  }
327
- /** Whether `App` has data attached to this account. */
328
- declare function hasData(options: HasDataOptions): (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
329
273
  interface BorrowDataArguments {
330
274
  self: TransactionArgument;
331
275
  }
@@ -337,12 +281,6 @@ interface BorrowDataOptions {
337
281
  };
338
282
  typeArguments: [string, string];
339
283
  }
340
- /**
341
- * Borrow an app's attached `Data`. Open (no witness): the slot is namespaced by
342
- * `App` and on-chain state is public, so composing apps can read it. Aborts if
343
- * nothing is attached.
344
- */
345
- declare function borrowData(options: BorrowDataOptions): (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
346
284
  interface BorrowDataMutArguments {
347
285
  self: TransactionArgument;
348
286
  Permit: TransactionArgument;
@@ -355,11 +293,6 @@ interface BorrowDataMutOptions {
355
293
  };
356
294
  typeArguments: [string, string];
357
295
  }
358
- /**
359
- * Mutably borrow an app's attached `Data`. Requires `Permit<App>`. Aborts if
360
- * nothing is attached.
361
- */
362
- declare function borrowDataMut(options: BorrowDataMutOptions): (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
363
296
  interface DetachArguments {
364
297
  self: TransactionArgument;
365
298
  Permit: TransactionArgument;
@@ -372,11 +305,6 @@ interface DetachOptions {
372
305
  };
373
306
  typeArguments: [string, string];
374
307
  }
375
- /**
376
- * Detach and return an app's `Data`. Requires `Permit<App>`. Aborts if nothing is
377
- * attached.
378
- */
379
- declare function detach(options: DetachOptions): (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
380
308
  //#endregion
381
- export { Account, AccountWrapper, account_d_exports };
309
+ export { Account, AccountIdArguments, AccountIdOptions, AccountWrapper, AttachArguments, AttachOptions, Auth, BalanceArguments, BalanceOptions, BorrowDataArguments, BorrowDataMutArguments, BorrowDataMutOptions, BorrowDataOptions, CoinKey, DataKey, DepositArguments, DepositFundsArguments, DepositFundsOptions, DepositOptions, DetachArguments, DetachOptions, GenerateAuthAsObjectArguments, GenerateAuthAsObjectOptions, GenerateAuthOptions, HasDataArguments, HasDataOptions, IdArguments, IdOptions, LoadAccountArguments, LoadAccountMutArguments, LoadAccountMutOptions, LoadAccountOptions, OwnerArguments, OwnerOptions, ReceiveAddressArguments, ReceiveAddressOptions, ReceiveCoinArguments, ReceiveCoinAtAccountIdArguments, ReceiveCoinAtAccountIdOptions, ReceiveCoinOptions, ReferrerAccountIdArguments, ReferrerAccountIdOptions, ReferrerReceiveAddressArguments, ReferrerReceiveAddressOptions, SettleArguments, SettleOptions, ShareArguments, ShareOptions, WithdrawArguments, WithdrawFundsArguments, WithdrawFundsOptions, WithdrawOptions };
382
310
  //# sourceMappingURL=account.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"account.d.mts","names":[],"sources":["../../../src/contracts/account/account.ts"],"mappings":";;;;;;;;;cAyBa,OAAA,EAAO,UAAA;;;;;;;;;;;;;;;cAmBP,cAAA,EAAc,UAAA;;;;;;;;;;;;;;;;;;cAOd,OAAA,EAAO,SAAA,WAAA,OAAA;AAAA,cAIP,OAAA,EAAO,SAAA,WAAA,OAAA;AAAA,cAIP,IAAA,EAAI,UAAA;;;;UAOA,WAAA;EAChB,IAAA,EAAM,sBAAA;AAAA;AAAA,UAEU,SAAA;EAChB,OAAA;EACA,SAAA,EAAW,WAAA,IAAe,IAAA,EAAM,sBAAA;EAChC,MAA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,IAA0B,IAAA,EAAM,mBAAA,EAAqB,MAAA,EAAQ,mBAAA;EACxE,MAAA;IACC,gBAAA;EAAA;EAED,aAAA;AAAA;AAAA,UAoBgB,eAAA;EAChB,IAAA,EAAM,mBAAA;EACN,MAAA,EAAQ,mBAAA;AAAA;AAAA,UAEQ,aAAA;EAChB,OAAA;EACA,SAAA,EAAW,eAAA,IAAmB,IAAA,EAAM,mBAAA,EAAqB,MAAA,EAAQ,mBAAA;EACjE,MAAA;IACC,gBAAA;EAAA;EAED,aAAA;AAAA"}
@@ -1,4 +1,3 @@
1
- import { __exportAll } from "../../_virtual/rolldown_runtime.mjs";
2
1
  import { MoveStruct, MoveTuple, normalizeMoveArguments } from "../utils/index.mjs";
3
2
  import { Bag } from "./deps/sui/bag.mjs";
4
3
  import { bcs } from "@mysten/sui/bcs";
@@ -12,40 +11,11 @@ import { bcs } from "@mysten/sui/bcs";
12
11
  * application-scoped data. Consuming `Auth` is the mutable-borrow boundary: owner
13
12
  * auth is checked against the account, while package-issued app auth yields the
14
13
  * same full `&mut Account` and is not bound to an owner or operation. The wrapper
15
- * address receives accumulator funds; a distinct derived account UID identifies
16
- * the account and anchors app data, while typed balances remain embedded in the
17
- * account. App data is namespaced by witness type, requires `Permit<App>` to
18
- * mutate, and remains publicly readable.
14
+ * address receives accumulator funds and transferred coins; a distinct derived
15
+ * account UID identifies the account and anchors app data, while typed balances
16
+ * remain embedded in the account. App data is namespaced by witness type, requires
17
+ * `Permit<App>` to mutate, and remains publicly readable.
19
18
  */
20
- var account_exports = /* @__PURE__ */ __exportAll({
21
- Account: () => Account,
22
- AccountWrapper: () => AccountWrapper,
23
- Auth: () => Auth,
24
- CoinKey: () => CoinKey,
25
- DataKey: () => DataKey,
26
- accountId: () => accountId,
27
- attach: () => attach,
28
- balance: () => balance,
29
- borrowData: () => borrowData,
30
- borrowDataMut: () => borrowDataMut,
31
- deposit: () => deposit,
32
- depositFunds: () => depositFunds,
33
- detach: () => detach,
34
- generateAuth: () => generateAuth,
35
- generateAuthAsObject: () => generateAuthAsObject,
36
- hasData: () => hasData,
37
- id: () => id,
38
- loadAccount: () => loadAccount,
39
- loadAccountMut: () => loadAccountMut,
40
- owner: () => owner,
41
- receiveAddress: () => receiveAddress,
42
- referrerAccountId: () => referrerAccountId,
43
- referrerReceiveAddress: () => referrerReceiveAddress,
44
- settle: () => settle,
45
- share: () => share,
46
- withdraw: () => withdraw,
47
- withdrawFunds: () => withdrawFunds
48
- });
49
19
  const $moduleName = "@local-pkg/account::account";
50
20
  const Account = new MoveStruct({
51
21
  name: `${$moduleName}::Account`,
@@ -268,6 +238,44 @@ function settle(options) {
268
238
  });
269
239
  }
270
240
  /**
241
+ * Permissionlessly folds a `Coin<T>` transferred to the wrapper address into
242
+ * stored account balance, for senders that can only transfer a coin and owners who
243
+ * have not signed. Value only enters the account, and only the wrapper UID the
244
+ * coin was addressed to can receive it. A coin may arrive before the account
245
+ * exists: `account_registry::derived_wrapper_address` is its recipient.
246
+ */
247
+ function receiveCoin(options) {
248
+ const packageAddress = options.package ?? options.config?.accountPackageId ?? "@local-pkg/account";
249
+ const argumentsTypes = [null, null];
250
+ const parameterNames = ["wrapper", "coin"];
251
+ return (tx) => tx.moveCall({
252
+ package: packageAddress,
253
+ module: "account",
254
+ function: "receive_coin",
255
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
256
+ typeArguments: options.typeArguments
257
+ });
258
+ }
259
+ /**
260
+ * `receive_coin` for a coin sent to the canonical account address, the account's
261
+ * public identity, which can get copied as a destination. Senders should still use
262
+ * the wrapper address, the one that also takes `send_funds`. A `Receiving` cannot
263
+ * reveal its owner, so the caller picks the function from the coin's owner; the
264
+ * wrong one aborts.
265
+ */
266
+ function receiveCoinAtAccountId(options) {
267
+ const packageAddress = options.package ?? options.config?.accountPackageId ?? "@local-pkg/account";
268
+ const argumentsTypes = [null, null];
269
+ const parameterNames = ["wrapper", "coin"];
270
+ return (tx) => tx.moveCall({
271
+ package: packageAddress,
272
+ module: "account",
273
+ function: "receive_coin_at_account_id",
274
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
275
+ typeArguments: options.typeArguments
276
+ });
277
+ }
278
+ /**
271
279
  * Deposits into stored balance only; callers that include accumulator funds must
272
280
  * settle through the wrapper first.
273
281
  */
@@ -439,5 +447,5 @@ function detach(options) {
439
447
  }
440
448
 
441
449
  //#endregion
442
- export { Account, AccountWrapper, account_exports, balance, depositFunds, generateAuth, loadAccount, share, withdrawFunds };
450
+ export { Account, AccountWrapper, Auth, CoinKey, DataKey, accountId, attach, balance, borrowData, borrowDataMut, deposit, depositFunds, detach, generateAuth, generateAuthAsObject, hasData, id, loadAccount, loadAccountMut, owner, receiveAddress, receiveCoin, receiveCoinAtAccountId, referrerAccountId, referrerReceiveAddress, settle, share, withdraw, withdrawFunds };
443
451
  //# sourceMappingURL=account.mjs.map