@typus/typus-perp-sdk 1.2.2 → 1.3.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 (71) hide show
  1. package/dist/src/client.d.ts +22 -3
  2. package/dist/src/client.js +66 -8
  3. package/dist/src/fetch.d.ts +61 -20
  4. package/dist/src/fetch.js +20 -14
  5. package/dist/src/generated/typus_perp/admin.d.ts +65 -21
  6. package/dist/src/generated/typus_perp/admin.js +139 -123
  7. package/dist/src/generated/typus_perp/competition.d.ts +5 -17
  8. package/dist/src/generated/typus_perp/competition.js +63 -39
  9. package/dist/src/generated/typus_perp/deps/std/type_name.d.ts +9 -9
  10. package/dist/src/generated/typus_perp/deps/std/type_name.js +13 -16
  11. package/dist/src/generated/typus_perp/deps/sui/balance.d.ts +2 -2
  12. package/dist/src/generated/typus_perp/deps/sui/balance.js +5 -8
  13. package/dist/src/generated/typus_perp/deps/sui/object.d.ts +8 -0
  14. package/dist/src/generated/typus_perp/deps/sui/object.js +13 -0
  15. package/dist/src/generated/typus_perp/deps/sui/object_table.d.ts +5 -3
  16. package/dist/src/generated/typus_perp/deps/sui/object_table.js +40 -9
  17. package/dist/src/generated/typus_perp/deps/sui/table.d.ts +5 -3
  18. package/dist/src/generated/typus_perp/deps/sui/table.js +40 -9
  19. package/dist/src/generated/typus_perp/deps/sui/vec_set.d.ts +5 -3
  20. package/dist/src/generated/typus_perp/deps/sui/vec_set.js +5 -8
  21. package/dist/src/generated/typus_perp/deps/typus/keyed_big_vector.d.ts +4 -2
  22. package/dist/src/generated/typus_perp/deps/typus/keyed_big_vector.js +9 -12
  23. package/dist/src/generated/typus_perp/deps/typus/linked_object_table.d.ts +12 -6
  24. package/dist/src/generated/typus_perp/deps/typus/linked_object_table.js +41 -10
  25. package/dist/src/generated/typus_perp/deps/typus_framework/vault.d.ts +4 -2
  26. package/dist/src/generated/typus_perp/deps/typus_framework/vault.js +40 -9
  27. package/dist/src/generated/typus_perp/error.d.ts +201 -94
  28. package/dist/src/generated/typus_perp/error.js +300 -273
  29. package/dist/src/generated/typus_perp/escrow.d.ts +14 -6
  30. package/dist/src/generated/typus_perp/escrow.js +38 -37
  31. package/dist/src/generated/typus_perp/lending.d.ts +1 -1
  32. package/dist/src/generated/typus_perp/lending.js +3 -3
  33. package/dist/src/generated/typus_perp/lp_pool.d.ts +438 -392
  34. package/dist/src/generated/typus_perp/lp_pool.js +987 -934
  35. package/dist/src/generated/typus_perp/math.d.ts +13 -16
  36. package/dist/src/generated/typus_perp/math.js +51 -50
  37. package/dist/src/generated/typus_perp/position.d.ts +194 -106
  38. package/dist/src/generated/typus_perp/position.js +714 -733
  39. package/dist/src/generated/typus_perp/profit_vault.d.ts +62 -20
  40. package/dist/src/generated/typus_perp/profit_vault.js +162 -148
  41. package/dist/src/generated/typus_perp/symbol.d.ts +12 -5
  42. package/dist/src/generated/typus_perp/symbol.js +28 -25
  43. package/dist/src/generated/typus_perp/trading.d.ts +956 -139
  44. package/dist/src/generated/typus_perp/trading.js +1577 -1151
  45. package/dist/src/generated/typus_perp/treasury_caps.d.ts +16 -7
  46. package/dist/src/generated/typus_perp/treasury_caps.js +60 -24
  47. package/dist/src/generated/typus_perp/user_account.d.ts +40 -0
  48. package/dist/src/generated/typus_perp/user_account.js +66 -0
  49. package/dist/src/generated/typus_stake_pool/admin.d.ts +144 -10
  50. package/dist/src/generated/typus_stake_pool/admin.js +132 -49
  51. package/dist/src/generated/typus_stake_pool/deps/std/type_name.d.ts +9 -9
  52. package/dist/src/generated/typus_stake_pool/deps/std/type_name.js +13 -16
  53. package/dist/src/generated/typus_stake_pool/deps/sui/object.d.ts +8 -0
  54. package/dist/src/generated/typus_stake_pool/deps/sui/object.js +13 -0
  55. package/dist/src/generated/typus_stake_pool/deps/sui/vec_map.d.ts +36 -0
  56. package/dist/src/generated/typus_stake_pool/deps/sui/vec_map.js +31 -0
  57. package/dist/src/generated/typus_stake_pool/deps/sui/vec_set.d.ts +5 -3
  58. package/dist/src/generated/typus_stake_pool/deps/sui/vec_set.js +5 -8
  59. package/dist/src/generated/typus_stake_pool/stake_pool.d.ts +180 -79
  60. package/dist/src/generated/typus_stake_pool/stake_pool.js +446 -414
  61. package/dist/src/generated/utils/index.d.ts +4 -23
  62. package/dist/src/generated/utils/index.js +34 -54
  63. package/dist/src/index.d.ts +5 -0
  64. package/dist/src/index.js +35 -13
  65. package/dist/src/user/order.d.ts +0 -4
  66. package/dist/src/user/order.js +31 -74
  67. package/dist/src/user/orderWithBidReceipt.d.ts +0 -3
  68. package/dist/src/user/orderWithBidReceipt.js +24 -45
  69. package/dist/src/user/tlp.d.ts +0 -5
  70. package/dist/src/user/tlp.js +28 -73
  71. package/package.json +42 -40
@@ -36,38 +36,41 @@ var __importStar = (this && this.__importStar) || (function () {
36
36
  };
37
37
  })();
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.BurnLpEvent = exports.UpdateLiquidityValueEvent = exports.CompleteRebalancingEvent = exports.RebalanceEvent = exports.RebalanceProcess = exports.ManagerRemoveLiquidityTokenEvent = exports.WithdrawLendingEvent = exports.DepositLendingEvent = exports.ResumeTokenPoolEvent = exports.SuspendTokenPoolEvent = exports.ResumePoolEvent = exports.SuspendPoolEvent = exports.RedeemEvent = exports.SwapEvent = exports.UpdateBorrowInfoEvent = exports.MintLpEvent = exports.UpdateMarginConfigEvent = exports.ManagerEmergencyWithdrawEvent = exports.ManagerEmergencyDepositEvent = exports.UpdateSpotConfigEvent = exports.AddLiquidityTokenEvent = exports.UpdateRebalanceCostThresholdBpEvent = exports.UpdateUnlockCountdownTsMsEvent = exports.NewLiquidityPoolEvent = exports.ManagerDepositReceipt = exports.DeactivatingShares = exports.LiquidityPool = exports.LiquidityPoolInfo = exports.TokenPool = exports.State = exports.Config = exports.MarginConfig = exports.SpotConfig = exports.Registry = void 0;
39
+ exports.MigrateLpOracleIdEvent = exports.BurnLpEvent = exports.UpdateLiquidityValueEvent = exports.CompleteRebalancingEvent = exports.RebalanceEvent = exports.RebalanceProcess = exports.ManagerRemoveLiquidityTokenEvent = exports.ResumeTokenPoolEvent = exports.SuspendTokenPoolEvent = exports.ResumePoolEvent = exports.SuspendPoolEvent = exports.RedeemEvent = exports.SwapEvent = exports.UpdateBorrowInfoEvent = exports.MintLpEvent = exports.UpdateMarginConfigEvent = exports.ManagerEmergencyWithdrawEvent = exports.ManagerEmergencyDepositEvent = exports.UpdateSpotConfigEvent = exports.AddLiquidityTokenEvent = exports.UpdateRebalanceCostThresholdBpEvent = exports.UpdateUnlockCountdownTsMsEvent = exports.NewLiquidityPoolEvent = exports.ManagerDepositReceipt = exports.DeactivatingShares = exports.LiquidityPool = exports.LiquidityPoolInfo = exports.TokenPool = exports.State = exports.Config = exports.MarginConfig = exports.SpotConfig = exports.Registry = void 0;
40
40
  exports.init = init;
41
41
  exports.newLiquidityPool = newLiquidityPool;
42
42
  exports.updateUnlockCountdownTsMs = updateUnlockCountdownTsMs;
43
43
  exports.updateRebalanceCostThresholdBp = updateRebalanceCostThresholdBp;
44
44
  exports.addLiquidityToken = addLiquidityToken;
45
+ exports.addLiquidityTokenV2 = addLiquidityTokenV2;
45
46
  exports.updateSpotConfig = updateSpotConfig;
46
47
  exports.managerEmergencyDeposit = managerEmergencyDeposit;
47
48
  exports.managerEmergencyWithdraw = managerEmergencyWithdraw;
48
49
  exports.updateMarginConfig = updateMarginConfig;
49
50
  exports.mintLp = mintLp;
51
+ exports.mintLpV2 = mintLpV2;
50
52
  exports.updateBorrowInfo = updateBorrowInfo;
51
53
  exports.swap = swap;
54
+ exports.swapV2 = swapV2;
52
55
  exports.redeem = redeem;
53
56
  exports.claim = claim;
57
+ exports.claimV2 = claimV2;
54
58
  exports.suspendPool = suspendPool;
55
59
  exports.resumePool = resumePool;
56
60
  exports.suspendTokenPool = suspendTokenPool;
57
61
  exports.resumeTokenPool = resumeTokenPool;
58
- exports.managerDepositScallop = managerDepositScallop;
59
- exports.managerDepositNavi = managerDepositNavi;
60
- exports.managerWithdrawScallop = managerWithdrawScallop;
61
- exports.managerWithdrawNavi = managerWithdrawNavi;
62
- exports.managerRewardNavi = managerRewardNavi;
63
62
  exports.managerRemoveLiquidityToken = managerRemoveLiquidityToken;
64
63
  exports.checkTokenPoolStatus = checkTokenPoolStatus;
65
64
  exports.tokenPoolIsActive = tokenPoolIsActive;
66
65
  exports.rebalance = rebalance;
66
+ exports.rebalanceV2 = rebalanceV2;
67
67
  exports.completeRebalancing = completeRebalancing;
68
+ exports.completeRebalancingV2 = completeRebalancingV2;
68
69
  exports.managerRemoveAllLiquidity = managerRemoveAllLiquidity;
69
70
  exports.updateLiquidityValue = updateLiquidityValue;
71
+ exports.updateLiquidityValueV2 = updateLiquidityValueV2;
70
72
  exports.getPoolLiquidity = getPoolLiquidity;
73
+ exports.getV2Price = getV2Price;
71
74
  exports.updateTvl = updateTvl;
72
75
  exports.orderFilled = orderFilled;
73
76
  exports.updateReserveAmount = updateReserveAmount;
@@ -78,16 +81,9 @@ exports.getReceiptCollateral = getReceiptCollateral;
78
81
  exports.calculateMintLp = calculateMintLp;
79
82
  exports.calculateBurnLp = calculateBurnLp;
80
83
  exports.calculateLpFee = calculateLpFee;
81
- exports.calculateFee_ = calculateFee_;
82
84
  exports.normalSafetyCheck = normalSafetyCheck;
83
85
  exports.calculateSwapFee = calculateSwapFee;
84
86
  exports.checkTvlUpdated = checkTvlUpdated;
85
- exports.calculateLendingAmountCapped = calculateLendingAmountCapped;
86
- exports.depositScallopBasic = depositScallopBasic;
87
- exports.withdrawScallopBasic = withdrawScallopBasic;
88
- exports.depositNavi = depositNavi;
89
- exports.withdrawNavi = withdrawNavi;
90
- exports.rewardNavi = rewardNavi;
91
87
  exports.burnLp_ = burnLp_;
92
88
  exports.viewSwapResult = viewSwapResult;
93
89
  exports.getReceiptCollateralBcs = getReceiptCollateralBcs;
@@ -106,7 +102,8 @@ exports.checkTradingOrderSizeValid = checkTradingOrderSizeValid;
106
102
  exports.getCumulativeBorrowRate = getCumulativeBorrowRate;
107
103
  exports.getTvlUsd = getTvlUsd;
108
104
  exports.getBorrowRateDecimal = getBorrowRateDecimal;
109
- exports.deprecated = deprecated;
105
+ exports.setAllOracleId = setAllOracleId;
106
+ exports.migrateOracleIdToV2 = migrateOracleIdToV2;
110
107
  exports.getUserDeactivatingShares = getUserDeactivatingShares;
111
108
  /**
112
109
  * The `lp_pool` module is the heart of the TLP (Typus Liquidity Pool) logic. It
@@ -114,54 +111,21 @@ exports.getUserDeactivatingShares = getUserDeactivatingShares;
114
111
  * configurations. It also contains the entry functions for creating pools, adding
115
112
  * liquidity, swapping, and redeeming.
116
113
  */
117
- const index_js_1 = require("../utils/index.js");
114
+ const index_1 = require("../utils/index");
118
115
  const bcs_1 = require("@mysten/sui/bcs");
119
- const type_name = __importStar(require("./deps/std/type_name.js"));
120
- const type_name_1 = __importStar(require("./deps/std/type_name.js"));
121
- const type_name_2 = __importStar(require("./deps/std/type_name.js"));
122
- const escrow = __importStar(require("./escrow.js"));
123
- const balance = __importStar(require("./deps/sui/balance.js"));
124
- const type_name_3 = __importStar(require("./deps/std/type_name.js"));
125
- const type_name_4 = __importStar(require("./deps/std/type_name.js"));
126
- const type_name_5 = __importStar(require("./deps/std/type_name.js"));
127
- const type_name_6 = __importStar(require("./deps/std/type_name.js"));
128
- const type_name_7 = __importStar(require("./deps/std/type_name.js"));
129
- const type_name_8 = __importStar(require("./deps/std/type_name.js"));
130
- const type_name_9 = __importStar(require("./deps/std/type_name.js"));
131
- const type_name_10 = __importStar(require("./deps/std/type_name.js"));
132
- const type_name_11 = __importStar(require("./deps/std/type_name.js"));
133
- const type_name_12 = __importStar(require("./deps/std/type_name.js"));
134
- const type_name_13 = __importStar(require("./deps/std/type_name.js"));
135
- const type_name_14 = __importStar(require("./deps/std/type_name.js"));
136
- const type_name_15 = __importStar(require("./deps/std/type_name.js"));
137
- const type_name_16 = __importStar(require("./deps/std/type_name.js"));
138
- const type_name_17 = __importStar(require("./deps/std/type_name.js"));
139
- const type_name_18 = __importStar(require("./deps/std/type_name.js"));
140
- const type_name_19 = __importStar(require("./deps/std/type_name.js"));
141
- const type_name_20 = __importStar(require("./deps/std/type_name.js"));
142
- const type_name_21 = __importStar(require("./deps/std/type_name.js"));
143
- const type_name_22 = __importStar(require("./deps/std/type_name.js"));
144
- const type_name_23 = __importStar(require("./deps/std/type_name.js"));
145
- const type_name_24 = __importStar(require("./deps/std/type_name.js"));
146
- const type_name_25 = __importStar(require("./deps/std/type_name.js"));
147
- const type_name_26 = __importStar(require("./deps/std/type_name.js"));
148
- const type_name_27 = __importStar(require("./deps/std/type_name.js"));
149
- const type_name_28 = __importStar(require("./deps/std/type_name.js"));
150
- const type_name_29 = __importStar(require("./deps/std/type_name.js"));
151
- const $moduleName = "@typus/perp::lp_pool";
152
- exports.Registry = new index_js_1.MoveStruct({
153
- name: `${$moduleName}::Registry`,
154
- fields: {
155
- id: bcs_1.bcs.Address,
116
+ const object = __importStar(require("./deps/sui/object"));
117
+ const type_name = __importStar(require("./deps/std/type_name"));
118
+ const escrow = __importStar(require("./escrow"));
119
+ const balance = __importStar(require("./deps/sui/balance"));
120
+ const $moduleName = '@typus/perp::lp_pool';
121
+ exports.Registry = new index_1.MoveStruct({ name: `${$moduleName}::Registry`, fields: {
122
+ id: object.UID,
156
123
  /** The number of pools in the registry. */
157
124
  num_pool: bcs_1.bcs.u64(),
158
125
  /** The UID of the liquidity pool registry. */
159
- liquidity_pool_registry: bcs_1.bcs.Address,
160
- },
161
- });
162
- exports.SpotConfig = new index_js_1.MoveStruct({
163
- name: `${$moduleName}::SpotConfig`,
164
- fields: {
126
+ liquidity_pool_registry: object.UID
127
+ } });
128
+ exports.SpotConfig = new index_1.MoveStruct({ name: `${$moduleName}::SpotConfig`, fields: {
165
129
  /** The minimum deposit amount. */
166
130
  min_deposit: bcs_1.bcs.u64(),
167
131
  /** The maximum capacity of the pool. */
@@ -183,12 +147,9 @@ exports.SpotConfig = new index_js_1.MoveStruct({
183
147
  /** The protocol's share of the lending interest in basis points. */
184
148
  lending_protocol_share_bp: bcs_1.bcs.u64(),
185
149
  /** Padding for future use. */
186
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
187
- },
188
- });
189
- exports.MarginConfig = new index_js_1.MoveStruct({
190
- name: `${$moduleName}::MarginConfig`,
191
- fields: {
150
+ u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
151
+ } });
152
+ exports.MarginConfig = new index_1.MoveStruct({ name: `${$moduleName}::MarginConfig`, fields: {
192
153
  /** The basic borrow rate at utilization 0. */
193
154
  basic_borrow_rate_0: bcs_1.bcs.u64(),
194
155
  /** The basic borrow rate at utilization 1. */
@@ -204,12 +165,9 @@ exports.MarginConfig = new index_js_1.MoveStruct({
204
165
  /** The maximum order reserve ratio in basis points. */
205
166
  max_order_reserve_ratio_bp: bcs_1.bcs.u64(),
206
167
  /** Padding for future use. */
207
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
208
- },
209
- });
210
- exports.Config = new index_js_1.MoveStruct({
211
- name: `${$moduleName}::Config`,
212
- fields: {
168
+ u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
169
+ } });
170
+ exports.Config = new index_1.MoveStruct({ name: `${$moduleName}::Config`, fields: {
213
171
  /** The address of the oracle. */
214
172
  oracle_id: bcs_1.bcs.Address,
215
173
  /** The number of decimals for the liquidity token. */
@@ -219,12 +177,9 @@ exports.Config = new index_js_1.MoveStruct({
219
177
  /** The margin-related configuration for the token pool. */
220
178
  margin_config: exports.MarginConfig,
221
179
  /** Padding for future use. */
222
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
223
- },
224
- });
225
- exports.State = new index_js_1.MoveStruct({
226
- name: `${$moduleName}::State`,
227
- fields: {
180
+ u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
181
+ } });
182
+ exports.State = new index_1.MoveStruct({ name: `${$moduleName}::State`, fields: {
228
183
  /** The amount of liquidity in the pool. */
229
184
  liquidity_amount: bcs_1.bcs.u64(),
230
185
  /** The value of the liquidity in USD. */
@@ -246,23 +201,17 @@ exports.State = new index_js_1.MoveStruct({
246
201
  /** The current lending amount. */
247
202
  current_lending_amount: bcs_1.bcs.vector(bcs_1.bcs.u64()),
248
203
  /** Padding for future use. */
249
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
250
- },
251
- });
252
- exports.TokenPool = new index_js_1.MoveStruct({
253
- name: `${$moduleName}::TokenPool`,
254
- fields: {
204
+ u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
205
+ } });
206
+ exports.TokenPool = new index_1.MoveStruct({ name: `${$moduleName}::TokenPool`, fields: {
255
207
  /** The type name of the token. */
256
208
  token_type: type_name.TypeName,
257
209
  /** The configuration for the token pool. */
258
210
  config: exports.Config,
259
211
  /** The state of the token pool. */
260
- state: exports.State,
261
- },
262
- });
263
- exports.LiquidityPoolInfo = new index_js_1.MoveStruct({
264
- name: `${$moduleName}::LiquidityPoolInfo`,
265
- fields: {
212
+ state: exports.State
213
+ } });
214
+ exports.LiquidityPoolInfo = new index_1.MoveStruct({ name: `${$moduleName}::LiquidityPoolInfo`, fields: {
266
215
  /** The number of decimals for the LP token. */
267
216
  lp_token_decimal: bcs_1.bcs.u64(),
268
217
  /** The total supply of LP tokens. */
@@ -270,23 +219,20 @@ exports.LiquidityPoolInfo = new index_js_1.MoveStruct({
270
219
  /** The total value locked in the pool in USD. */
271
220
  tvl_usd: bcs_1.bcs.u64(),
272
221
  /** Whether the pool is active. */
273
- is_active: bcs_1.bcs.bool(),
274
- },
275
- });
276
- exports.LiquidityPool = new index_js_1.MoveStruct({
277
- name: `${$moduleName}::LiquidityPool`,
278
- fields: {
222
+ is_active: bcs_1.bcs.bool()
223
+ } });
224
+ exports.LiquidityPool = new index_1.MoveStruct({ name: `${$moduleName}::LiquidityPool`, fields: {
279
225
  /**
280
- * The UID of the object. Token balances are dynamic fields under this id with
281
- * TypeName key.
282
- */
283
- id: bcs_1.bcs.Address,
226
+ * The UID of the object. Token balances are dynamic fields under this id with
227
+ * TypeName key.
228
+ */
229
+ id: object.UID,
284
230
  /** The index of the pool. */
285
231
  index: bcs_1.bcs.u64(),
286
232
  /** The type name of the LP token. */
287
- lp_token_type: type_name_1.TypeName,
233
+ lp_token_type: type_name.TypeName,
288
234
  /** A vector of the type names of the liquidity tokens. */
289
- liquidity_tokens: bcs_1.bcs.vector(type_name_2.TypeName),
235
+ liquidity_tokens: bcs_1.bcs.vector(type_name.TypeName),
290
236
  /** A vector of the token pools. */
291
237
  token_pools: bcs_1.bcs.vector(exports.TokenPool),
292
238
  /** Information about the liquidity pool. */
@@ -296,12 +242,9 @@ exports.LiquidityPool = new index_js_1.MoveStruct({
296
242
  /** Padding for future use. */
297
243
  u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
298
244
  /** Padding for future use. */
299
- bcs_padding: bcs_1.bcs.vector(bcs_1.bcs.u8()),
300
- },
301
- });
302
- exports.DeactivatingShares = new index_js_1.MoveStruct({
303
- name: `${$moduleName}::DeactivatingShares<phantom TOKEN>`,
304
- fields: {
245
+ bcs_padding: bcs_1.bcs.vector(bcs_1.bcs.u8())
246
+ } });
247
+ exports.DeactivatingShares = new index_1.MoveStruct({ name: `${$moduleName}::DeactivatingShares`, fields: {
305
248
  /** The balance of the deactivating shares. */
306
249
  balance: balance.Balance,
307
250
  /** The timestamp of the redemption. */
@@ -309,259 +252,164 @@ exports.DeactivatingShares = new index_js_1.MoveStruct({
309
252
  /** The timestamp when the shares can be unlocked. */
310
253
  unlock_ts_ms: bcs_1.bcs.u64(),
311
254
  /** Padding for future use. */
312
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
313
- },
314
- });
315
- exports.ManagerDepositReceipt = new index_js_1.MoveStruct({
316
- name: `${$moduleName}::ManagerDepositReceipt`,
317
- fields: {
318
- id: bcs_1.bcs.Address,
255
+ u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
256
+ } });
257
+ exports.ManagerDepositReceipt = new index_1.MoveStruct({ name: `${$moduleName}::ManagerDepositReceipt`, fields: {
258
+ id: object.UID,
319
259
  /** The index of the pool. */
320
260
  index: bcs_1.bcs.u64(),
321
261
  /** The type name of the token. */
322
- token_type: type_name_3.TypeName,
262
+ token_type: type_name.TypeName,
323
263
  /** The amount of the deposit. */
324
264
  amount: bcs_1.bcs.u64(),
325
265
  /** Padding for future use. */
326
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
327
- },
328
- });
329
- exports.NewLiquidityPoolEvent = new index_js_1.MoveStruct({
330
- name: `${$moduleName}::NewLiquidityPoolEvent`,
331
- fields: {
266
+ u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
267
+ } });
268
+ exports.NewLiquidityPoolEvent = new index_1.MoveStruct({ name: `${$moduleName}::NewLiquidityPoolEvent`, fields: {
332
269
  sender: bcs_1.bcs.Address,
333
270
  index: bcs_1.bcs.u64(),
334
- lp_token_type: type_name_4.TypeName,
271
+ lp_token_type: type_name.TypeName,
335
272
  lp_token_decimal: bcs_1.bcs.u64(),
336
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
337
- },
338
- });
339
- exports.UpdateUnlockCountdownTsMsEvent = new index_js_1.MoveStruct({
340
- name: `${$moduleName}::UpdateUnlockCountdownTsMsEvent`,
341
- fields: {
273
+ u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
274
+ } });
275
+ exports.UpdateUnlockCountdownTsMsEvent = new index_1.MoveStruct({ name: `${$moduleName}::UpdateUnlockCountdownTsMsEvent`, fields: {
342
276
  sender: bcs_1.bcs.Address,
343
277
  index: bcs_1.bcs.u64(),
344
278
  previous_unlock_countdown_ts_ms: bcs_1.bcs.u64(),
345
279
  new_unlock_countdown_ts_ms: bcs_1.bcs.u64(),
346
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
347
- },
348
- });
349
- exports.UpdateRebalanceCostThresholdBpEvent = new index_js_1.MoveStruct({
350
- name: `${$moduleName}::UpdateRebalanceCostThresholdBpEvent`,
351
- fields: {
280
+ u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
281
+ } });
282
+ exports.UpdateRebalanceCostThresholdBpEvent = new index_1.MoveStruct({ name: `${$moduleName}::UpdateRebalanceCostThresholdBpEvent`, fields: {
352
283
  sender: bcs_1.bcs.Address,
353
284
  index: bcs_1.bcs.u64(),
354
285
  previous_rebalance_cost_threshold_bp: bcs_1.bcs.u64(),
355
286
  new_rebalance_cost_threshold_bp: bcs_1.bcs.u64(),
356
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
357
- },
358
- });
359
- exports.AddLiquidityTokenEvent = new index_js_1.MoveStruct({
360
- name: `${$moduleName}::AddLiquidityTokenEvent`,
361
- fields: {
287
+ u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
288
+ } });
289
+ exports.AddLiquidityTokenEvent = new index_1.MoveStruct({ name: `${$moduleName}::AddLiquidityTokenEvent`, fields: {
362
290
  sender: bcs_1.bcs.Address,
363
291
  index: bcs_1.bcs.u64(),
364
- token_type: type_name_5.TypeName,
292
+ token_type: type_name.TypeName,
365
293
  config: exports.Config,
366
294
  state: exports.State,
367
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
368
- },
369
- });
370
- exports.UpdateSpotConfigEvent = new index_js_1.MoveStruct({
371
- name: `${$moduleName}::UpdateSpotConfigEvent`,
372
- fields: {
295
+ u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
296
+ } });
297
+ exports.UpdateSpotConfigEvent = new index_1.MoveStruct({ name: `${$moduleName}::UpdateSpotConfigEvent`, fields: {
373
298
  sender: bcs_1.bcs.Address,
374
299
  index: bcs_1.bcs.u64(),
375
- liquidity_token_type: type_name_6.TypeName,
300
+ liquidity_token_type: type_name.TypeName,
376
301
  previous_spot_config: exports.SpotConfig,
377
302
  new_spot_config: exports.SpotConfig,
378
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
379
- },
380
- });
381
- exports.ManagerEmergencyDepositEvent = new index_js_1.MoveStruct({
382
- name: `${$moduleName}::ManagerEmergencyDepositEvent`,
383
- fields: {
303
+ u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
304
+ } });
305
+ exports.ManagerEmergencyDepositEvent = new index_1.MoveStruct({ name: `${$moduleName}::ManagerEmergencyDepositEvent`, fields: {
384
306
  sender: bcs_1.bcs.Address,
385
307
  index: bcs_1.bcs.u64(),
386
- liquidity_token_type: type_name_7.TypeName,
308
+ liquidity_token_type: type_name.TypeName,
387
309
  amount: bcs_1.bcs.u64(),
388
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
389
- },
390
- });
391
- exports.ManagerEmergencyWithdrawEvent = new index_js_1.MoveStruct({
392
- name: `${$moduleName}::ManagerEmergencyWithdrawEvent`,
393
- fields: {
310
+ u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
311
+ } });
312
+ exports.ManagerEmergencyWithdrawEvent = new index_1.MoveStruct({ name: `${$moduleName}::ManagerEmergencyWithdrawEvent`, fields: {
394
313
  sender: bcs_1.bcs.Address,
395
314
  index: bcs_1.bcs.u64(),
396
- liquidity_token_type: type_name_8.TypeName,
315
+ liquidity_token_type: type_name.TypeName,
397
316
  amount: bcs_1.bcs.u64(),
398
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
399
- },
400
- });
401
- exports.UpdateMarginConfigEvent = new index_js_1.MoveStruct({
402
- name: `${$moduleName}::UpdateMarginConfigEvent`,
403
- fields: {
317
+ u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
318
+ } });
319
+ exports.UpdateMarginConfigEvent = new index_1.MoveStruct({ name: `${$moduleName}::UpdateMarginConfigEvent`, fields: {
404
320
  sender: bcs_1.bcs.Address,
405
321
  index: bcs_1.bcs.u64(),
406
- liquidity_token_type: type_name_9.TypeName,
322
+ liquidity_token_type: type_name.TypeName,
407
323
  previous_margin_config: exports.MarginConfig,
408
324
  new_margin_config: exports.MarginConfig,
409
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
410
- },
411
- });
412
- exports.MintLpEvent = new index_js_1.MoveStruct({
413
- name: `${$moduleName}::MintLpEvent`,
414
- fields: {
325
+ u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
326
+ } });
327
+ exports.MintLpEvent = new index_1.MoveStruct({ name: `${$moduleName}::MintLpEvent`, fields: {
415
328
  sender: bcs_1.bcs.Address,
416
329
  index: bcs_1.bcs.u64(),
417
- liquidity_token_type: type_name_10.TypeName,
330
+ liquidity_token_type: type_name.TypeName,
418
331
  deposit_amount: bcs_1.bcs.u64(),
419
332
  deposit_amount_usd: bcs_1.bcs.u64(),
420
333
  mint_fee_usd: bcs_1.bcs.u64(),
421
- lp_token_type: type_name_11.TypeName,
334
+ lp_token_type: type_name.TypeName,
422
335
  minted_lp_amount: bcs_1.bcs.u64(),
423
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
424
- },
425
- });
426
- exports.UpdateBorrowInfoEvent = new index_js_1.MoveStruct({
427
- name: `${$moduleName}::UpdateBorrowInfoEvent`,
428
- fields: {
336
+ u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
337
+ } });
338
+ exports.UpdateBorrowInfoEvent = new index_1.MoveStruct({ name: `${$moduleName}::UpdateBorrowInfoEvent`, fields: {
429
339
  index: bcs_1.bcs.u64(),
430
- liquidity_token_type: type_name_12.TypeName,
340
+ liquidity_token_type: type_name.TypeName,
431
341
  previous_borrow_ts_ms: bcs_1.bcs.u64(),
432
342
  previous_cumulative_borrow_rate: bcs_1.bcs.u64(),
433
343
  borrow_interval_ts_ms: bcs_1.bcs.u64(),
434
344
  last_borrow_rate_ts_ms: bcs_1.bcs.u64(),
435
345
  last_cumulative_borrow_rate: bcs_1.bcs.u64(),
436
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
437
- },
438
- });
439
- exports.SwapEvent = new index_js_1.MoveStruct({
440
- name: `${$moduleName}::SwapEvent`,
441
- fields: {
346
+ u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
347
+ } });
348
+ exports.SwapEvent = new index_1.MoveStruct({ name: `${$moduleName}::SwapEvent`, fields: {
442
349
  sender: bcs_1.bcs.Address,
443
350
  index: bcs_1.bcs.u64(),
444
- from_token_type: type_name_13.TypeName,
351
+ from_token_type: type_name.TypeName,
445
352
  from_amount: bcs_1.bcs.u64(),
446
- to_token_type: type_name_14.TypeName,
353
+ to_token_type: type_name.TypeName,
447
354
  min_to_amount: bcs_1.bcs.u64(),
448
355
  actual_to_amount: bcs_1.bcs.u64(),
449
356
  fee_amount: bcs_1.bcs.u64(),
450
357
  fee_amount_usd: bcs_1.bcs.u64(),
451
358
  oracle_price_from_token: bcs_1.bcs.u64(),
452
359
  oracle_price_to_token: bcs_1.bcs.u64(),
453
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
454
- },
455
- });
456
- exports.RedeemEvent = new index_js_1.MoveStruct({
457
- name: `${$moduleName}::RedeemEvent`,
458
- fields: {
360
+ u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
361
+ } });
362
+ exports.RedeemEvent = new index_1.MoveStruct({ name: `${$moduleName}::RedeemEvent`, fields: {
459
363
  sender: bcs_1.bcs.Address,
460
364
  index: bcs_1.bcs.u64(),
461
365
  share: bcs_1.bcs.u64(),
462
366
  share_price: bcs_1.bcs.u64(),
463
367
  timestamp_ts_ms: bcs_1.bcs.u64(),
464
368
  unlock_ts_ms: bcs_1.bcs.u64(),
465
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
466
- },
467
- });
468
- exports.SuspendPoolEvent = new index_js_1.MoveStruct({
469
- name: `${$moduleName}::SuspendPoolEvent`,
470
- fields: {
369
+ u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
370
+ } });
371
+ exports.SuspendPoolEvent = new index_1.MoveStruct({ name: `${$moduleName}::SuspendPoolEvent`, fields: {
471
372
  sender: bcs_1.bcs.Address,
472
373
  index: bcs_1.bcs.u64(),
473
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
474
- },
475
- });
476
- exports.ResumePoolEvent = new index_js_1.MoveStruct({
477
- name: `${$moduleName}::ResumePoolEvent`,
478
- fields: {
374
+ u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
375
+ } });
376
+ exports.ResumePoolEvent = new index_1.MoveStruct({ name: `${$moduleName}::ResumePoolEvent`, fields: {
479
377
  sender: bcs_1.bcs.Address,
480
378
  index: bcs_1.bcs.u64(),
481
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
482
- },
483
- });
484
- exports.SuspendTokenPoolEvent = new index_js_1.MoveStruct({
485
- name: `${$moduleName}::SuspendTokenPoolEvent`,
486
- fields: {
379
+ u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
380
+ } });
381
+ exports.SuspendTokenPoolEvent = new index_1.MoveStruct({ name: `${$moduleName}::SuspendTokenPoolEvent`, fields: {
487
382
  sender: bcs_1.bcs.Address,
488
383
  index: bcs_1.bcs.u64(),
489
- liquidity_token: type_name_15.TypeName,
490
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
491
- },
492
- });
493
- exports.ResumeTokenPoolEvent = new index_js_1.MoveStruct({
494
- name: `${$moduleName}::ResumeTokenPoolEvent`,
495
- fields: {
384
+ liquidity_token: type_name.TypeName,
385
+ u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
386
+ } });
387
+ exports.ResumeTokenPoolEvent = new index_1.MoveStruct({ name: `${$moduleName}::ResumeTokenPoolEvent`, fields: {
496
388
  sender: bcs_1.bcs.Address,
497
389
  index: bcs_1.bcs.u64(),
498
- liquidity_token: type_name_16.TypeName,
499
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
500
- },
501
- });
502
- exports.DepositLendingEvent = new index_js_1.MoveStruct({
503
- name: `${$moduleName}::DepositLendingEvent`,
504
- fields: {
505
- index: bcs_1.bcs.u64(),
506
- lending_index: bcs_1.bcs.u64(),
507
- c_token_type: type_name_17.TypeName,
508
- deposit_amount: bcs_1.bcs.u64(),
509
- minted_market_coin_amount: bcs_1.bcs.u64(),
510
- latest_lending_amount: bcs_1.bcs.u64(),
511
- latest_market_coin_amount: bcs_1.bcs.u64(),
512
- latest_reserved_amount: bcs_1.bcs.u64(),
513
- latest_liquidity_amount: bcs_1.bcs.u64(),
514
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
515
- },
516
- });
517
- exports.WithdrawLendingEvent = new index_js_1.MoveStruct({
518
- name: `${$moduleName}::WithdrawLendingEvent`,
519
- fields: {
390
+ liquidity_token: type_name.TypeName,
391
+ u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
392
+ } });
393
+ exports.ManagerRemoveLiquidityTokenEvent = new index_1.MoveStruct({ name: `${$moduleName}::ManagerRemoveLiquidityTokenEvent`, fields: {
520
394
  index: bcs_1.bcs.u64(),
521
- lending_index: bcs_1.bcs.u64(),
522
- c_token_type: type_name_18.TypeName,
523
- r_token_type: type_name_19.TypeName,
524
- withdraw_amount: bcs_1.bcs.u64(),
525
- withdrawn_collateral_amount: bcs_1.bcs.u64(),
526
- latest_lending_amount: bcs_1.bcs.u64(),
527
- latest_market_coin_amount: bcs_1.bcs.u64(),
528
- latest_reserved_amount: bcs_1.bcs.u64(),
529
- latest_liquidity_amount: bcs_1.bcs.u64(),
530
- lending_interest: bcs_1.bcs.u64(),
531
- protocol_share: bcs_1.bcs.u64(),
532
- lending_reward: bcs_1.bcs.u64(),
533
- reward_protocol_share: bcs_1.bcs.u64(),
534
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
535
- },
536
- });
537
- exports.ManagerRemoveLiquidityTokenEvent = new index_js_1.MoveStruct({
538
- name: `${$moduleName}::ManagerRemoveLiquidityTokenEvent`,
539
- fields: {
395
+ liquidity_token: type_name.TypeName,
396
+ u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
397
+ } });
398
+ exports.RebalanceProcess = new index_1.MoveStruct({ name: `${$moduleName}::RebalanceProcess`, fields: {
540
399
  index: bcs_1.bcs.u64(),
541
- liquidity_token: type_name_20.TypeName,
542
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
543
- },
544
- });
545
- exports.RebalanceProcess = new index_js_1.MoveStruct({
546
- name: `${$moduleName}::RebalanceProcess`,
547
- fields: {
548
- index: bcs_1.bcs.u64(),
549
- token_type_a: type_name_21.TypeName,
400
+ token_type_a: type_name.TypeName,
550
401
  token_decimal_a: bcs_1.bcs.u64(),
551
402
  token_amount_a: bcs_1.bcs.u64(),
552
403
  oracle_price_a: bcs_1.bcs.u64(),
553
404
  reduced_usd: bcs_1.bcs.u64(),
554
- token_type_b: type_name_22.TypeName,
405
+ token_type_b: type_name.TypeName,
555
406
  token_decimal_b: bcs_1.bcs.u64(),
556
- oracle_price_b: bcs_1.bcs.u64(),
557
- },
558
- });
559
- exports.RebalanceEvent = new index_js_1.MoveStruct({
560
- name: `${$moduleName}::RebalanceEvent`,
561
- fields: {
407
+ oracle_price_b: bcs_1.bcs.u64()
408
+ } });
409
+ exports.RebalanceEvent = new index_1.MoveStruct({ name: `${$moduleName}::RebalanceEvent`, fields: {
562
410
  index: bcs_1.bcs.u64(),
563
- from_token: type_name_23.TypeName,
564
- to_token: type_name_24.TypeName,
411
+ from_token: type_name.TypeName,
412
+ to_token: type_name.TypeName,
565
413
  rebalance_amount: bcs_1.bcs.u64(),
566
414
  from_token_oracle_price: bcs_1.bcs.u64(),
567
415
  to_token_oracle_price: bcs_1.bcs.u64(),
@@ -569,532 +417,621 @@ exports.RebalanceEvent = new index_js_1.MoveStruct({
569
417
  tvl_usd: bcs_1.bcs.u64(),
570
418
  from_token_liquidity_amount: bcs_1.bcs.u64(),
571
419
  to_token_liquidity_amount: bcs_1.bcs.u64(),
572
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
573
- },
574
- });
575
- exports.CompleteRebalancingEvent = new index_js_1.MoveStruct({
576
- name: `${$moduleName}::CompleteRebalancingEvent`,
577
- fields: {
420
+ u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
421
+ } });
422
+ exports.CompleteRebalancingEvent = new index_1.MoveStruct({ name: `${$moduleName}::CompleteRebalancingEvent`, fields: {
578
423
  index: bcs_1.bcs.u64(),
579
- from_token: type_name_25.TypeName,
580
- to_token: type_name_26.TypeName,
424
+ from_token: type_name.TypeName,
425
+ to_token: type_name.TypeName,
581
426
  from_token_oracle_price: bcs_1.bcs.u64(),
582
427
  to_token_oracle_price: bcs_1.bcs.u64(),
583
428
  swapped_back_usd: bcs_1.bcs.u64(),
584
429
  tvl_usd: bcs_1.bcs.u64(),
585
430
  from_token_liquidity_amount: bcs_1.bcs.u64(),
586
431
  to_token_liquidity_amount: bcs_1.bcs.u64(),
587
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
588
- },
589
- });
590
- exports.UpdateLiquidityValueEvent = new index_js_1.MoveStruct({
591
- name: `${$moduleName}::UpdateLiquidityValueEvent`,
592
- fields: {
432
+ u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
433
+ } });
434
+ exports.UpdateLiquidityValueEvent = new index_1.MoveStruct({ name: `${$moduleName}::UpdateLiquidityValueEvent`, fields: {
593
435
  sender: bcs_1.bcs.Address,
594
436
  index: bcs_1.bcs.u64(),
595
- liquidity_token: type_name_27.TypeName,
437
+ liquidity_token: type_name.TypeName,
596
438
  price: bcs_1.bcs.u64(),
597
439
  value_in_usd: bcs_1.bcs.u64(),
598
440
  lp_pool_tvl_usd: bcs_1.bcs.u64(),
599
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
600
- },
601
- });
602
- exports.BurnLpEvent = new index_js_1.MoveStruct({
603
- name: `${$moduleName}::BurnLpEvent`,
604
- fields: {
441
+ u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
442
+ } });
443
+ exports.BurnLpEvent = new index_1.MoveStruct({ name: `${$moduleName}::BurnLpEvent`, fields: {
605
444
  sender: bcs_1.bcs.Address,
606
445
  index: bcs_1.bcs.u64(),
607
- lp_token_type: type_name_28.TypeName,
446
+ lp_token_type: type_name.TypeName,
608
447
  burn_lp_amount: bcs_1.bcs.u64(),
609
448
  burn_amount_usd: bcs_1.bcs.u64(),
610
449
  burn_fee_usd: bcs_1.bcs.u64(),
611
- liquidity_token_type: type_name_29.TypeName,
450
+ liquidity_token_type: type_name.TypeName,
612
451
  withdraw_token_amount: bcs_1.bcs.u64(),
613
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
614
- },
615
- });
452
+ u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
453
+ } });
454
+ exports.MigrateLpOracleIdEvent = new index_1.MoveStruct({ name: `${$moduleName}::MigrateLpOracleIdEvent`, fields: {
455
+ sender: bcs_1.bcs.Address,
456
+ new_oracle_id: bcs_1.bcs.Address,
457
+ u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
458
+ } });
616
459
  function init(options = {}) {
617
- const packageAddress = options.package ?? "@typus/perp";
460
+ const packageAddress = options.package ?? '@typus/perp';
618
461
  return (tx) => tx.moveCall({
619
462
  package: packageAddress,
620
- module: "lp_pool",
621
- function: "init",
463
+ module: 'lp_pool',
464
+ function: 'init',
622
465
  });
623
466
  }
624
467
  /** [Authorized Function] Creates a new liquidity pool. */
625
468
  function newLiquidityPool(options) {
626
- const packageAddress = options.package ?? "@typus/perp";
627
- const argumentsTypes = [null, null, "u64", "u64"];
469
+ const packageAddress = options.package ?? '@typus/perp';
470
+ const argumentsTypes = [
471
+ `${packageAddress}::admin::Version`,
472
+ `${packageAddress}::lp_pool::Registry`,
473
+ 'u64',
474
+ 'u64'
475
+ ];
628
476
  const parameterNames = ["version", "registry", "lpTokenDecimal", "unlockCountdownTsMs"];
629
477
  return (tx) => tx.moveCall({
630
478
  package: packageAddress,
631
- module: "lp_pool",
632
- function: "new_liquidity_pool",
633
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
634
- typeArguments: options.typeArguments,
479
+ module: 'lp_pool',
480
+ function: 'new_liquidity_pool',
481
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
482
+ typeArguments: options.typeArguments
635
483
  });
636
484
  }
637
485
  /** [Authorized Function] Updates the unlock countdown. */
638
486
  function updateUnlockCountdownTsMs(options) {
639
- const packageAddress = options.package ?? "@typus/perp";
640
- const argumentsTypes = [null, null, "u64", "u64"];
487
+ const packageAddress = options.package ?? '@typus/perp';
488
+ const argumentsTypes = [
489
+ `${packageAddress}::admin::Version`,
490
+ `${packageAddress}::lp_pool::Registry`,
491
+ 'u64',
492
+ 'u64'
493
+ ];
641
494
  const parameterNames = ["version", "registry", "index", "unlockCountdownTsMs"];
642
495
  return (tx) => tx.moveCall({
643
496
  package: packageAddress,
644
- module: "lp_pool",
645
- function: "update_unlock_countdown_ts_ms",
646
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
497
+ module: 'lp_pool',
498
+ function: 'update_unlock_countdown_ts_ms',
499
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
647
500
  });
648
501
  }
649
502
  /** [Authorized Function] Updates the rebalance cost threshold. */
650
503
  function updateRebalanceCostThresholdBp(options) {
651
- const packageAddress = options.package ?? "@typus/perp";
652
- const argumentsTypes = [null, null, "u64", "u64"];
504
+ const packageAddress = options.package ?? '@typus/perp';
505
+ const argumentsTypes = [
506
+ `${packageAddress}::admin::Version`,
507
+ `${packageAddress}::lp_pool::Registry`,
508
+ 'u64',
509
+ 'u64'
510
+ ];
653
511
  const parameterNames = ["version", "registry", "index", "rebalanceCostThresholdBp"];
654
512
  return (tx) => tx.moveCall({
655
513
  package: packageAddress,
656
- module: "lp_pool",
657
- function: "update_rebalance_cost_threshold_bp",
658
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
514
+ module: 'lp_pool',
515
+ function: 'update_rebalance_cost_threshold_bp',
516
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
659
517
  });
660
518
  }
661
- /** [Authorized Function] Adds a new liquidity token to a pool. */
519
+ /** [DEPRECATED] Use `add_liquidity_token_v2` with `&OracleV2` instead. */
662
520
  function addLiquidityToken(options) {
663
- const packageAddress = options.package ?? "@typus/perp";
664
- const argumentsTypes = [
665
- null,
666
- null,
667
- "u64",
668
- null,
669
- "u64",
670
- "u64",
671
- "u64",
672
- "u64",
673
- "u64",
674
- "u64",
675
- "u64",
676
- "u64",
677
- "u64",
678
- "u64",
679
- "u64",
680
- "u64",
681
- "u64",
682
- "u64",
683
- "u64",
684
- "u64",
685
- "u64",
686
- "u64",
687
- "0x2::clock::Clock",
688
- ];
689
- const parameterNames = [
690
- "version",
691
- "registry",
692
- "index",
693
- "oracle",
694
- "tokenDecimal",
695
- "targetWeightBp",
696
- "minDeposit",
697
- "maxCapacity",
698
- "basicMintFeeBp",
699
- "additionalMintFeeBp",
700
- "basicBurnFeeBp",
701
- "additionalBurnFeeBp",
702
- "swapFeeBp",
703
- "swapFeeProtocolShareBp",
704
- "lendingProtocolShareBp",
705
- "basicBorrowRate_0",
706
- "basicBorrowRate_1",
707
- "basicBorrowRate_2",
708
- "utilizationThresholdBp_0",
709
- "utilizationThresholdBp_1",
710
- "borrowIntervalTsMs",
711
- "maxOrderReserveRatioBp",
712
- ];
713
- return (tx) => tx.moveCall({
714
- package: packageAddress,
715
- module: "lp_pool",
716
- function: "add_liquidity_token",
717
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
718
- typeArguments: options.typeArguments,
521
+ const packageAddress = options.package ?? '@typus/perp';
522
+ const argumentsTypes = [
523
+ `${packageAddress}::admin::Version`,
524
+ `${packageAddress}::lp_pool::Registry`,
525
+ 'u64',
526
+ '0xd2e030ab7f0fc956c7e683cf3c6faf3d22868dee81a4aae9f4a10a6d998a8a02::oracle::Oracle',
527
+ 'u64',
528
+ 'u64',
529
+ 'u64',
530
+ 'u64',
531
+ 'u64',
532
+ 'u64',
533
+ 'u64',
534
+ 'u64',
535
+ 'u64',
536
+ 'u64',
537
+ 'u64',
538
+ 'u64',
539
+ 'u64',
540
+ 'u64',
541
+ 'u64',
542
+ 'u64',
543
+ 'u64',
544
+ 'u64',
545
+ '0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock'
546
+ ];
547
+ const parameterNames = ["version", "registry", "index", "oracle", "tokenDecimal", "targetWeightBp", "minDeposit", "maxCapacity", "basicMintFeeBp", "additionalMintFeeBp", "basicBurnFeeBp", "additionalBurnFeeBp", "swapFeeBp", "swapFeeProtocolShareBp", "lendingProtocolShareBp", "basicBorrowRate_0", "basicBorrowRate_1", "basicBorrowRate_2", "utilizationThresholdBp_0", "utilizationThresholdBp_1", "borrowIntervalTsMs", "maxOrderReserveRatioBp"];
548
+ return (tx) => tx.moveCall({
549
+ package: packageAddress,
550
+ module: 'lp_pool',
551
+ function: 'add_liquidity_token',
552
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
553
+ typeArguments: options.typeArguments
554
+ });
555
+ }
556
+ /** [Authorized Function] Adds a new liquidity token to a pool. */
557
+ function addLiquidityTokenV2(options) {
558
+ const packageAddress = options.package ?? '@typus/perp';
559
+ const argumentsTypes = [
560
+ `${packageAddress}::admin::Version`,
561
+ `${packageAddress}::lp_pool::Registry`,
562
+ 'u64',
563
+ '0xd2e030ab7f0fc956c7e683cf3c6faf3d22868dee81a4aae9f4a10a6d998a8a02::oracle_v2::OracleV2',
564
+ 'u64',
565
+ 'u64',
566
+ 'u64',
567
+ 'u64',
568
+ 'u64',
569
+ 'u64',
570
+ 'u64',
571
+ 'u64',
572
+ 'u64',
573
+ 'u64',
574
+ 'u64',
575
+ 'u64',
576
+ 'u64',
577
+ 'u64',
578
+ 'u64',
579
+ 'u64',
580
+ 'u64',
581
+ 'u64',
582
+ '0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock'
583
+ ];
584
+ const parameterNames = ["version", "registry", "index", "oracleV2", "tokenDecimal", "targetWeightBp", "minDeposit", "maxCapacity", "basicMintFeeBp", "additionalMintFeeBp", "basicBurnFeeBp", "additionalBurnFeeBp", "swapFeeBp", "swapFeeProtocolShareBp", "lendingProtocolShareBp", "basicBorrowRate_0", "basicBorrowRate_1", "basicBorrowRate_2", "utilizationThresholdBp_0", "utilizationThresholdBp_1", "borrowIntervalTsMs", "maxOrderReserveRatioBp"];
585
+ return (tx) => tx.moveCall({
586
+ package: packageAddress,
587
+ module: 'lp_pool',
588
+ function: 'add_liquidity_token_v2',
589
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
590
+ typeArguments: options.typeArguments
719
591
  });
720
592
  }
721
593
  /** [Authorized Function] Updates the spot configuration for a token. */
722
594
  function updateSpotConfig(options) {
723
- const packageAddress = options.package ?? "@typus/perp";
724
- const argumentsTypes = [
725
- null,
726
- null,
727
- "u64",
728
- "0x1::option::Option<u64>",
729
- "0x1::option::Option<u64>",
730
- "0x1::option::Option<u64>",
731
- "0x1::option::Option<u64>",
732
- "0x1::option::Option<u64>",
733
- "0x1::option::Option<u64>",
734
- "0x1::option::Option<u64>",
735
- "0x1::option::Option<u64>",
736
- "0x1::option::Option<u64>",
737
- "0x1::option::Option<u64>",
738
- ];
739
- const parameterNames = [
740
- "version",
741
- "registry",
742
- "index",
743
- "targetWeightBp",
744
- "minDeposit",
745
- "maxCapacity",
746
- "basicMintFeeBp",
747
- "additionalMintFeeBp",
748
- "basicBurnFeeBp",
749
- "additionalBurnFeeBp",
750
- "swapFeeBp",
751
- "swapFeeProtocolShareBp",
752
- "lendingProtocolShareBp",
753
- ];
754
- return (tx) => tx.moveCall({
755
- package: packageAddress,
756
- module: "lp_pool",
757
- function: "update_spot_config",
758
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
759
- typeArguments: options.typeArguments,
595
+ const packageAddress = options.package ?? '@typus/perp';
596
+ const argumentsTypes = [
597
+ `${packageAddress}::admin::Version`,
598
+ `${packageAddress}::lp_pool::Registry`,
599
+ 'u64',
600
+ '0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<u64>',
601
+ '0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<u64>',
602
+ '0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<u64>',
603
+ '0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<u64>',
604
+ '0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<u64>',
605
+ '0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<u64>',
606
+ '0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<u64>',
607
+ '0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<u64>',
608
+ '0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<u64>',
609
+ '0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<u64>'
610
+ ];
611
+ const parameterNames = ["version", "registry", "index", "targetWeightBp", "minDeposit", "maxCapacity", "basicMintFeeBp", "additionalMintFeeBp", "basicBurnFeeBp", "additionalBurnFeeBp", "swapFeeBp", "swapFeeProtocolShareBp", "lendingProtocolShareBp"];
612
+ return (tx) => tx.moveCall({
613
+ package: packageAddress,
614
+ module: 'lp_pool',
615
+ function: 'update_spot_config',
616
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
617
+ typeArguments: options.typeArguments
760
618
  });
761
619
  }
762
620
  /** [Authorized Function] Allows a manager to deposit tokens in an emergency. */
763
621
  function managerEmergencyDeposit(options) {
764
- const packageAddress = options.package ?? "@typus/perp";
765
- const argumentsTypes = [null, null, "u64", null];
622
+ const packageAddress = options.package ?? '@typus/perp';
623
+ const argumentsTypes = [
624
+ `${packageAddress}::admin::Version`,
625
+ `${packageAddress}::lp_pool::Registry`,
626
+ 'u64',
627
+ `0x0000000000000000000000000000000000000000000000000000000000000002::coin::Coin<${options.typeArguments[0]}>`
628
+ ];
766
629
  const parameterNames = ["version", "registry", "index", "coin"];
767
630
  return (tx) => tx.moveCall({
768
631
  package: packageAddress,
769
- module: "lp_pool",
770
- function: "manager_emergency_deposit",
771
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
772
- typeArguments: options.typeArguments,
632
+ module: 'lp_pool',
633
+ function: 'manager_emergency_deposit',
634
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
635
+ typeArguments: options.typeArguments
773
636
  });
774
637
  }
775
638
  /** [Authorized Function] Allows a manager to withdraw tokens in an emergency. */
776
639
  function managerEmergencyWithdraw(options) {
777
- const packageAddress = options.package ?? "@typus/perp";
778
- const argumentsTypes = [null, null, "u64", null];
640
+ const packageAddress = options.package ?? '@typus/perp';
641
+ const argumentsTypes = [
642
+ `${packageAddress}::admin::Version`,
643
+ `${packageAddress}::lp_pool::Registry`,
644
+ 'u64',
645
+ `${packageAddress}::lp_pool::ManagerDepositReceipt`
646
+ ];
779
647
  const parameterNames = ["version", "registry", "index", "receipt"];
780
648
  return (tx) => tx.moveCall({
781
649
  package: packageAddress,
782
- module: "lp_pool",
783
- function: "manager_emergency_withdraw",
784
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
785
- typeArguments: options.typeArguments,
650
+ module: 'lp_pool',
651
+ function: 'manager_emergency_withdraw',
652
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
653
+ typeArguments: options.typeArguments
786
654
  });
787
655
  }
788
656
  /** [Authorized Function] Updates the margin configuration for a token. */
789
657
  function updateMarginConfig(options) {
790
- const packageAddress = options.package ?? "@typus/perp";
791
- const argumentsTypes = [
792
- null,
793
- null,
794
- "u64",
795
- "0x1::option::Option<u64>",
796
- "0x1::option::Option<u64>",
797
- "0x1::option::Option<u64>",
798
- "0x1::option::Option<u64>",
799
- "0x1::option::Option<u64>",
800
- "0x1::option::Option<u64>",
801
- "0x1::option::Option<u64>",
802
- ];
803
- const parameterNames = [
804
- "version",
805
- "registry",
806
- "index",
807
- "basicBorrowRate_0",
808
- "basicBorrowRate_1",
809
- "basicBorrowRate_2",
810
- "utilizationThresholdBp_0",
811
- "utilizationThresholdBp_1",
812
- "borrowIntervalTsMs",
813
- "maxOrderReserveRatioBp",
814
- ];
815
- return (tx) => tx.moveCall({
816
- package: packageAddress,
817
- module: "lp_pool",
818
- function: "update_margin_config",
819
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
820
- typeArguments: options.typeArguments,
658
+ const packageAddress = options.package ?? '@typus/perp';
659
+ const argumentsTypes = [
660
+ `${packageAddress}::admin::Version`,
661
+ `${packageAddress}::lp_pool::Registry`,
662
+ 'u64',
663
+ '0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<u64>',
664
+ '0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<u64>',
665
+ '0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<u64>',
666
+ '0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<u64>',
667
+ '0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<u64>',
668
+ '0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<u64>',
669
+ '0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<u64>'
670
+ ];
671
+ const parameterNames = ["version", "registry", "index", "basicBorrowRate_0", "basicBorrowRate_1", "basicBorrowRate_2", "utilizationThresholdBp_0", "utilizationThresholdBp_1", "borrowIntervalTsMs", "maxOrderReserveRatioBp"];
672
+ return (tx) => tx.moveCall({
673
+ package: packageAddress,
674
+ module: 'lp_pool',
675
+ function: 'update_margin_config',
676
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
677
+ typeArguments: options.typeArguments
821
678
  });
822
679
  }
823
- /** [User Function] Mints LP tokens. */
680
+ /** [DEPRECATED] Use `mint_lp_v2` with `&OracleV2` instead. */
824
681
  function mintLp(options) {
825
- const packageAddress = options.package ?? "@typus/perp";
826
- const argumentsTypes = [null, null, null, null, "u64", null, "0x2::clock::Clock"];
682
+ const packageAddress = options.package ?? '@typus/perp';
683
+ const argumentsTypes = [
684
+ `${packageAddress}::admin::Version`,
685
+ `${packageAddress}::lp_pool::Registry`,
686
+ `${packageAddress}::treasury_caps::TreasuryCaps`,
687
+ '0xd2e030ab7f0fc956c7e683cf3c6faf3d22868dee81a4aae9f4a10a6d998a8a02::oracle::Oracle',
688
+ 'u64',
689
+ `0x0000000000000000000000000000000000000000000000000000000000000002::coin::Coin<${options.typeArguments[0]}>`,
690
+ '0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock'
691
+ ];
827
692
  const parameterNames = ["version", "registry", "treasuryCaps", "oracle", "index", "coin"];
828
693
  return (tx) => tx.moveCall({
829
694
  package: packageAddress,
830
- module: "lp_pool",
831
- function: "mint_lp",
832
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
833
- typeArguments: options.typeArguments,
695
+ module: 'lp_pool',
696
+ function: 'mint_lp',
697
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
698
+ typeArguments: options.typeArguments
699
+ });
700
+ }
701
+ /** [User Function] Mints LP tokens. */
702
+ function mintLpV2(options) {
703
+ const packageAddress = options.package ?? '@typus/perp';
704
+ const argumentsTypes = [
705
+ `${packageAddress}::admin::Version`,
706
+ `${packageAddress}::lp_pool::Registry`,
707
+ `${packageAddress}::treasury_caps::TreasuryCaps`,
708
+ '0xd2e030ab7f0fc956c7e683cf3c6faf3d22868dee81a4aae9f4a10a6d998a8a02::oracle_v2::OracleV2',
709
+ 'u64',
710
+ `0x0000000000000000000000000000000000000000000000000000000000000002::coin::Coin<${options.typeArguments[0]}>`,
711
+ '0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock'
712
+ ];
713
+ const parameterNames = ["version", "registry", "treasuryCaps", "oracleV2", "index", "coin"];
714
+ return (tx) => tx.moveCall({
715
+ package: packageAddress,
716
+ module: 'lp_pool',
717
+ function: 'mint_lp_v2',
718
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
719
+ typeArguments: options.typeArguments
834
720
  });
835
721
  }
836
722
  /** [User Function] Updates the borrow information for all tokens in a pool. */
837
723
  function updateBorrowInfo(options) {
838
- const packageAddress = options.package ?? "@typus/perp";
839
- const argumentsTypes = [null, null, "u64", "0x2::clock::Clock"];
724
+ const packageAddress = options.package ?? '@typus/perp';
725
+ const argumentsTypes = [
726
+ `${packageAddress}::admin::Version`,
727
+ `${packageAddress}::lp_pool::Registry`,
728
+ 'u64',
729
+ '0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock'
730
+ ];
840
731
  const parameterNames = ["version", "registry", "index"];
841
732
  return (tx) => tx.moveCall({
842
733
  package: packageAddress,
843
- module: "lp_pool",
844
- function: "update_borrow_info",
845
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
734
+ module: 'lp_pool',
735
+ function: 'update_borrow_info',
736
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
846
737
  });
847
738
  }
848
- /** [User Function] Swaps one token for another. */
739
+ /** [DEPRECATED] Use `swap_v2` with `&OracleV2` instead. */
849
740
  function swap(options) {
850
- const packageAddress = options.package ?? "@typus/perp";
851
- const argumentsTypes = [null, null, "u64", null, null, null, "u64", "0x2::clock::Clock"];
741
+ const packageAddress = options.package ?? '@typus/perp';
742
+ const argumentsTypes = [
743
+ `${packageAddress}::admin::Version`,
744
+ `${packageAddress}::lp_pool::Registry`,
745
+ 'u64',
746
+ '0xd2e030ab7f0fc956c7e683cf3c6faf3d22868dee81a4aae9f4a10a6d998a8a02::oracle::Oracle',
747
+ '0xd2e030ab7f0fc956c7e683cf3c6faf3d22868dee81a4aae9f4a10a6d998a8a02::oracle::Oracle',
748
+ `0x0000000000000000000000000000000000000000000000000000000000000002::coin::Coin<${options.typeArguments[0]}>`,
749
+ 'u64',
750
+ '0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock'
751
+ ];
852
752
  const parameterNames = ["version", "registry", "index", "oracleFromToken", "oracleToToken", "fromCoin", "minToAmount"];
853
753
  return (tx) => tx.moveCall({
854
754
  package: packageAddress,
855
- module: "lp_pool",
856
- function: "swap",
857
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
858
- typeArguments: options.typeArguments,
755
+ module: 'lp_pool',
756
+ function: 'swap',
757
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
758
+ typeArguments: options.typeArguments
759
+ });
760
+ }
761
+ /** [User Function] Swaps one token for another. */
762
+ function swapV2(options) {
763
+ const packageAddress = options.package ?? '@typus/perp';
764
+ const argumentsTypes = [
765
+ `${packageAddress}::admin::Version`,
766
+ `${packageAddress}::lp_pool::Registry`,
767
+ 'u64',
768
+ '0xd2e030ab7f0fc956c7e683cf3c6faf3d22868dee81a4aae9f4a10a6d998a8a02::oracle_v2::OracleV2',
769
+ `0x0000000000000000000000000000000000000000000000000000000000000002::coin::Coin<${options.typeArguments[0]}>`,
770
+ 'u64',
771
+ '0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock'
772
+ ];
773
+ const parameterNames = ["version", "registry", "index", "oracleV2", "fromCoin", "minToAmount"];
774
+ return (tx) => tx.moveCall({
775
+ package: packageAddress,
776
+ module: 'lp_pool',
777
+ function: 'swap_v2',
778
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
779
+ typeArguments: options.typeArguments
859
780
  });
860
781
  }
861
782
  /** [User Function] Redeems LP tokens for underlying assets. */
862
783
  function redeem(options) {
863
- const packageAddress = options.package ?? "@typus/perp";
864
- const argumentsTypes = [null, null, "u64", null, "0x2::clock::Clock"];
784
+ const packageAddress = options.package ?? '@typus/perp';
785
+ const argumentsTypes = [
786
+ `${packageAddress}::admin::Version`,
787
+ `${packageAddress}::lp_pool::Registry`,
788
+ 'u64',
789
+ `0x0000000000000000000000000000000000000000000000000000000000000002::balance::Balance<${options.typeArguments[0]}>`,
790
+ '0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock'
791
+ ];
865
792
  const parameterNames = ["version", "registry", "index", "balance"];
866
793
  return (tx) => tx.moveCall({
867
794
  package: packageAddress,
868
- module: "lp_pool",
869
- function: "redeem",
870
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
871
- typeArguments: options.typeArguments,
795
+ module: 'lp_pool',
796
+ function: 'redeem',
797
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
798
+ typeArguments: options.typeArguments
872
799
  });
873
800
  }
874
- /** [User Function] Claims underlying assets from redeemed LP tokens. */
801
+ /** [DEPRECATED] Use `claim_v2` with `&OracleV2` instead. */
875
802
  function claim(options) {
876
- const packageAddress = options.package ?? "@typus/perp";
877
- const argumentsTypes = [null, null, "u64", null, null, "0x2::clock::Clock"];
803
+ const packageAddress = options.package ?? '@typus/perp';
804
+ const argumentsTypes = [
805
+ `${packageAddress}::admin::Version`,
806
+ `${packageAddress}::lp_pool::Registry`,
807
+ 'u64',
808
+ `${packageAddress}::treasury_caps::TreasuryCaps`,
809
+ '0xd2e030ab7f0fc956c7e683cf3c6faf3d22868dee81a4aae9f4a10a6d998a8a02::oracle::Oracle',
810
+ '0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock'
811
+ ];
878
812
  const parameterNames = ["version", "registry", "index", "treasuryCaps", "oracle"];
879
813
  return (tx) => tx.moveCall({
880
814
  package: packageAddress,
881
- module: "lp_pool",
882
- function: "claim",
883
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
884
- typeArguments: options.typeArguments,
815
+ module: 'lp_pool',
816
+ function: 'claim',
817
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
818
+ typeArguments: options.typeArguments
819
+ });
820
+ }
821
+ /** [User Function] Claims underlying assets from redeemed LP tokens. */
822
+ function claimV2(options) {
823
+ const packageAddress = options.package ?? '@typus/perp';
824
+ const argumentsTypes = [
825
+ `${packageAddress}::admin::Version`,
826
+ `${packageAddress}::lp_pool::Registry`,
827
+ 'u64',
828
+ `${packageAddress}::treasury_caps::TreasuryCaps`,
829
+ '0xd2e030ab7f0fc956c7e683cf3c6faf3d22868dee81a4aae9f4a10a6d998a8a02::oracle_v2::OracleV2',
830
+ '0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock'
831
+ ];
832
+ const parameterNames = ["version", "registry", "index", "treasuryCaps", "oracleV2"];
833
+ return (tx) => tx.moveCall({
834
+ package: packageAddress,
835
+ module: 'lp_pool',
836
+ function: 'claim_v2',
837
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
838
+ typeArguments: options.typeArguments
885
839
  });
886
840
  }
887
841
  /** [Authorized Function] Suspends a liquidity pool. */
888
842
  function suspendPool(options) {
889
- const packageAddress = options.package ?? "@typus/perp";
890
- const argumentsTypes = [null, null, "u64"];
843
+ const packageAddress = options.package ?? '@typus/perp';
844
+ const argumentsTypes = [
845
+ `${packageAddress}::admin::Version`,
846
+ `${packageAddress}::lp_pool::Registry`,
847
+ 'u64'
848
+ ];
891
849
  const parameterNames = ["version", "registry", "index"];
892
850
  return (tx) => tx.moveCall({
893
851
  package: packageAddress,
894
- module: "lp_pool",
895
- function: "suspend_pool",
896
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
852
+ module: 'lp_pool',
853
+ function: 'suspend_pool',
854
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
897
855
  });
898
856
  }
899
857
  /** [Authorized Function] Resumes a liquidity pool. */
900
858
  function resumePool(options) {
901
- const packageAddress = options.package ?? "@typus/perp";
902
- const argumentsTypes = [null, null, "u64"];
859
+ const packageAddress = options.package ?? '@typus/perp';
860
+ const argumentsTypes = [
861
+ `${packageAddress}::admin::Version`,
862
+ `${packageAddress}::lp_pool::Registry`,
863
+ 'u64'
864
+ ];
903
865
  const parameterNames = ["version", "registry", "index"];
904
866
  return (tx) => tx.moveCall({
905
867
  package: packageAddress,
906
- module: "lp_pool",
907
- function: "resume_pool",
908
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
868
+ module: 'lp_pool',
869
+ function: 'resume_pool',
870
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
909
871
  });
910
872
  }
911
873
  /** [Authorized Function] Suspends a token pool. */
912
874
  function suspendTokenPool(options) {
913
- const packageAddress = options.package ?? "@typus/perp";
914
- const argumentsTypes = [null, null, "u64"];
875
+ const packageAddress = options.package ?? '@typus/perp';
876
+ const argumentsTypes = [
877
+ `${packageAddress}::admin::Version`,
878
+ `${packageAddress}::lp_pool::Registry`,
879
+ 'u64'
880
+ ];
915
881
  const parameterNames = ["version", "registry", "index"];
916
882
  return (tx) => tx.moveCall({
917
883
  package: packageAddress,
918
- module: "lp_pool",
919
- function: "suspend_token_pool",
920
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
921
- typeArguments: options.typeArguments,
884
+ module: 'lp_pool',
885
+ function: 'suspend_token_pool',
886
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
887
+ typeArguments: options.typeArguments
922
888
  });
923
889
  }
924
890
  /** [Authorized Function] Resumes a token pool. */
925
891
  function resumeTokenPool(options) {
926
- const packageAddress = options.package ?? "@typus/perp";
927
- const argumentsTypes = [null, null, "u64"];
892
+ const packageAddress = options.package ?? '@typus/perp';
893
+ const argumentsTypes = [
894
+ `${packageAddress}::admin::Version`,
895
+ `${packageAddress}::lp_pool::Registry`,
896
+ 'u64'
897
+ ];
928
898
  const parameterNames = ["version", "registry", "index"];
929
899
  return (tx) => tx.moveCall({
930
900
  package: packageAddress,
931
- module: "lp_pool",
932
- function: "resume_token_pool",
933
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
934
- typeArguments: options.typeArguments,
901
+ module: 'lp_pool',
902
+ function: 'resume_token_pool',
903
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
904
+ typeArguments: options.typeArguments
935
905
  });
936
906
  }
937
- /** [Authorized Function] Manager deposits to Scallop. */
938
- function managerDepositScallop(options) {
939
- const packageAddress = options.package ?? "@typus/perp";
940
- const argumentsTypes = [null, null, "u64", null, null, "0x2::clock::Clock", "0x1::option::Option<u64>"];
941
- const parameterNames = ["version", "registry", "index", "scallopVersion", "scallopMarket", "lendingAmount"];
942
- return (tx) => tx.moveCall({
943
- package: packageAddress,
944
- module: "lp_pool",
945
- function: "manager_deposit_scallop",
946
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
947
- typeArguments: options.typeArguments,
948
- });
949
- }
950
- function managerDepositNavi(options) {
951
- const packageAddress = options.package ?? "@typus/perp";
952
- const argumentsTypes = [null, null, "u64", null, null, "u8", null, null, "0x2::clock::Clock", "0x1::option::Option<u64>"];
953
- const parameterNames = ["version", "registry", "index", "storage", "pool", "asset", "incentiveV2", "incentiveV3", "lendingAmount"];
954
- return (tx) => tx.moveCall({
955
- package: packageAddress,
956
- module: "lp_pool",
957
- function: "manager_deposit_navi",
958
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
959
- typeArguments: options.typeArguments,
960
- });
961
- }
962
- /** [Authorized Function] Manager withdraws from Scallop. */
963
- function managerWithdrawScallop(options) {
964
- const packageAddress = options.package ?? "@typus/perp";
965
- const argumentsTypes = [null, null, "u64", null, null, "0x2::clock::Clock", "0x1::option::Option<u64>"];
966
- const parameterNames = ["version", "registry", "index", "scallopVersion", "scallopMarket", "withdrawAmount"];
967
- return (tx) => tx.moveCall({
968
- package: packageAddress,
969
- module: "lp_pool",
970
- function: "manager_withdraw_scallop",
971
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
972
- typeArguments: options.typeArguments,
973
- });
974
- }
975
- function managerWithdrawNavi(options) {
976
- const packageAddress = options.package ?? "@typus/perp";
907
+ /** [Authorized Function] Manager removes a liquidity token. */
908
+ function managerRemoveLiquidityToken(options) {
909
+ const packageAddress = options.package ?? '@typus/perp';
977
910
  const argumentsTypes = [
978
- null,
979
- null,
980
- "u64",
981
- null,
982
- null,
983
- null,
984
- null,
985
- "address",
986
- null,
987
- null,
988
- "u8",
989
- null,
990
- null,
991
- "0x2::clock::Clock",
992
- ];
993
- const parameterNames = [
994
- "version",
995
- "registry",
996
- "index",
997
- "oracleConfig",
998
- "priceOracle",
999
- "supraOracleHolder",
1000
- "pythPriceInfo",
1001
- "feedAddress",
1002
- "storage",
1003
- "pool",
1004
- "asset",
1005
- "incentiveV2",
1006
- "incentiveV3",
911
+ `${packageAddress}::admin::Version`,
912
+ `${packageAddress}::lp_pool::Registry`,
913
+ 'u64'
1007
914
  ];
915
+ const parameterNames = ["version", "registry", "index"];
1008
916
  return (tx) => tx.moveCall({
1009
917
  package: packageAddress,
1010
- module: "lp_pool",
1011
- function: "manager_withdraw_navi",
1012
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1013
- typeArguments: options.typeArguments,
918
+ module: 'lp_pool',
919
+ function: 'manager_remove_liquidity_token',
920
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
921
+ typeArguments: options.typeArguments
1014
922
  });
1015
923
  }
1016
- function managerRewardNavi(options) {
1017
- const packageAddress = options.package ?? "@typus/perp";
924
+ function checkTokenPoolStatus(options) {
925
+ const packageAddress = options.package ?? '@typus/perp';
1018
926
  const argumentsTypes = [
1019
- null,
1020
- null,
1021
- "u64",
1022
- null,
1023
- null,
1024
- "vector<0x1::string::String>",
1025
- "vector<address>",
1026
- null,
1027
- "0x2::clock::Clock",
927
+ `${packageAddress}::lp_pool::Registry`,
928
+ 'u64',
929
+ 'bool'
1028
930
  ];
1029
- const parameterNames = ["version", "registry", "index", "storage", "rewardFund", "coinTypes", "ruleIds", "incentiveV3"];
931
+ const parameterNames = ["registry", "index", "assertActive"];
1030
932
  return (tx) => tx.moveCall({
1031
933
  package: packageAddress,
1032
- module: "lp_pool",
1033
- function: "manager_reward_navi",
1034
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1035
- typeArguments: options.typeArguments,
934
+ module: 'lp_pool',
935
+ function: 'check_token_pool_status',
936
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
937
+ typeArguments: options.typeArguments
1036
938
  });
1037
939
  }
1038
- /** [Authorized Function] Manager removes a liquidity token. */
1039
- function managerRemoveLiquidityToken(options) {
1040
- const packageAddress = options.package ?? "@typus/perp";
1041
- const argumentsTypes = [null, null, "u64"];
1042
- const parameterNames = ["version", "registry", "index"];
940
+ function tokenPoolIsActive(options) {
941
+ const packageAddress = options.package ?? '@typus/perp';
942
+ const argumentsTypes = [
943
+ `${packageAddress}::lp_pool::TokenPool`
944
+ ];
945
+ const parameterNames = ["tokenPool"];
1043
946
  return (tx) => tx.moveCall({
1044
947
  package: packageAddress,
1045
- module: "lp_pool",
1046
- function: "manager_remove_liquidity_token",
1047
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1048
- typeArguments: options.typeArguments,
948
+ module: 'lp_pool',
949
+ function: 'token_pool_is_active',
950
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1049
951
  });
1050
952
  }
1051
- function checkTokenPoolStatus(options) {
1052
- const packageAddress = options.package ?? "@typus/perp";
1053
- const argumentsTypes = [null, "u64", "bool"];
1054
- const parameterNames = ["registry", "index", "assertActive"];
953
+ /** [DEPRECATED] Use `rebalance_v2` with `&OracleV2` instead. */
954
+ function rebalance(options) {
955
+ const packageAddress = options.package ?? '@typus/perp';
956
+ const argumentsTypes = [
957
+ `${packageAddress}::admin::Version`,
958
+ `${packageAddress}::lp_pool::Registry`,
959
+ 'u64',
960
+ '0xd2e030ab7f0fc956c7e683cf3c6faf3d22868dee81a4aae9f4a10a6d998a8a02::oracle::Oracle',
961
+ '0xd2e030ab7f0fc956c7e683cf3c6faf3d22868dee81a4aae9f4a10a6d998a8a02::oracle::Oracle',
962
+ 'u64',
963
+ '0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock'
964
+ ];
965
+ const parameterNames = ["version", "registry", "index", "oracleTokenA", "oracleTokenB", "rebalanceAmount"];
1055
966
  return (tx) => tx.moveCall({
1056
967
  package: packageAddress,
1057
- module: "lp_pool",
1058
- function: "check_token_pool_status",
1059
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1060
- typeArguments: options.typeArguments,
968
+ module: 'lp_pool',
969
+ function: 'rebalance',
970
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
971
+ typeArguments: options.typeArguments
1061
972
  });
1062
973
  }
1063
- function tokenPoolIsActive(options) {
1064
- const packageAddress = options.package ?? "@typus/perp";
1065
- const argumentsTypes = [null];
1066
- const parameterNames = ["tokenPool"];
974
+ /** [Authorized Function] Manager take the liquidity token A to swap. */
975
+ function rebalanceV2(options) {
976
+ const packageAddress = options.package ?? '@typus/perp';
977
+ const argumentsTypes = [
978
+ `${packageAddress}::admin::Version`,
979
+ `${packageAddress}::lp_pool::Registry`,
980
+ 'u64',
981
+ '0xd2e030ab7f0fc956c7e683cf3c6faf3d22868dee81a4aae9f4a10a6d998a8a02::oracle_v2::OracleV2',
982
+ 'u64',
983
+ '0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock'
984
+ ];
985
+ const parameterNames = ["version", "registry", "index", "oracleV2", "rebalanceAmount"];
1067
986
  return (tx) => tx.moveCall({
1068
987
  package: packageAddress,
1069
- module: "lp_pool",
1070
- function: "token_pool_is_active",
1071
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
988
+ module: 'lp_pool',
989
+ function: 'rebalance_v2',
990
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
991
+ typeArguments: options.typeArguments
1072
992
  });
1073
993
  }
1074
- /** [Authorized Function] Manager take the liquidity token A to swap. */
1075
- function rebalance(options) {
1076
- const packageAddress = options.package ?? "@typus/perp";
1077
- const argumentsTypes = [null, null, "u64", null, null, "u64", "0x2::clock::Clock"];
1078
- const parameterNames = ["version", "registry", "index", "oracleTokenA", "oracleTokenB", "rebalanceAmount"];
994
+ /** [DEPRECATED] Use `complete_rebalancing_v2` with `&OracleV2` instead. */
995
+ function completeRebalancing(options) {
996
+ const packageAddress = options.package ?? '@typus/perp';
997
+ const argumentsTypes = [
998
+ `${packageAddress}::admin::Version`,
999
+ `${packageAddress}::lp_pool::Registry`,
1000
+ 'u64',
1001
+ '0xd2e030ab7f0fc956c7e683cf3c6faf3d22868dee81a4aae9f4a10a6d998a8a02::oracle::Oracle',
1002
+ '0xd2e030ab7f0fc956c7e683cf3c6faf3d22868dee81a4aae9f4a10a6d998a8a02::oracle::Oracle',
1003
+ `0x0000000000000000000000000000000000000000000000000000000000000002::balance::Balance<${options.typeArguments[1]}>`,
1004
+ `${packageAddress}::lp_pool::RebalanceProcess`,
1005
+ '0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock'
1006
+ ];
1007
+ const parameterNames = ["version", "registry", "index", "oracleTokenA", "oracleTokenB", "swappedBackBalance", "rebalanceProcess"];
1079
1008
  return (tx) => tx.moveCall({
1080
1009
  package: packageAddress,
1081
- module: "lp_pool",
1082
- function: "rebalance",
1083
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1084
- typeArguments: options.typeArguments,
1010
+ module: 'lp_pool',
1011
+ function: 'complete_rebalancing',
1012
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1013
+ typeArguments: options.typeArguments
1085
1014
  });
1086
1015
  }
1087
1016
  /** [Authorized Function] Manager swap back the liquidity token from A to B. */
1088
- function completeRebalancing(options) {
1089
- const packageAddress = options.package ?? "@typus/perp";
1090
- const argumentsTypes = [null, null, "u64", null, null, null, null, "0x2::clock::Clock"];
1091
- const parameterNames = ["version", "registry", "index", "oracleTokenA", "oracleTokenB", "swappedBackBalance", "rebalanceProcess"];
1017
+ function completeRebalancingV2(options) {
1018
+ const packageAddress = options.package ?? '@typus/perp';
1019
+ const argumentsTypes = [
1020
+ `${packageAddress}::admin::Version`,
1021
+ `${packageAddress}::lp_pool::Registry`,
1022
+ 'u64',
1023
+ '0xd2e030ab7f0fc956c7e683cf3c6faf3d22868dee81a4aae9f4a10a6d998a8a02::oracle_v2::OracleV2',
1024
+ `0x0000000000000000000000000000000000000000000000000000000000000002::balance::Balance<${options.typeArguments[1]}>`,
1025
+ `${packageAddress}::lp_pool::RebalanceProcess`,
1026
+ '0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock'
1027
+ ];
1028
+ const parameterNames = ["version", "registry", "index", "oracleV2", "swappedBackBalance", "rebalanceProcess"];
1092
1029
  return (tx) => tx.moveCall({
1093
1030
  package: packageAddress,
1094
- module: "lp_pool",
1095
- function: "complete_rebalancing",
1096
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1097
- typeArguments: options.typeArguments,
1031
+ module: 'lp_pool',
1032
+ function: 'complete_rebalancing_v2',
1033
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1034
+ typeArguments: options.typeArguments
1098
1035
  });
1099
1036
  }
1100
1037
  /**
@@ -1102,28 +1039,57 @@ function completeRebalancing(options) {
1102
1039
  * [Authorized Function] Manager remove all liquidity of a token.
1103
1040
  */
1104
1041
  function managerRemoveAllLiquidity(options) {
1105
- const packageAddress = options.package ?? "@typus/perp";
1106
- const argumentsTypes = [null, null, "u64"];
1042
+ const packageAddress = options.package ?? '@typus/perp';
1043
+ const argumentsTypes = [
1044
+ `${packageAddress}::admin::Version`,
1045
+ `${packageAddress}::lp_pool::Registry`,
1046
+ 'u64'
1047
+ ];
1107
1048
  const parameterNames = ["version", "registry", "index"];
1108
1049
  return (tx) => tx.moveCall({
1109
1050
  package: packageAddress,
1110
- module: "lp_pool",
1111
- function: "manager_remove_all_liquidity",
1112
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1113
- typeArguments: options.typeArguments,
1051
+ module: 'lp_pool',
1052
+ function: 'manager_remove_all_liquidity',
1053
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1054
+ typeArguments: options.typeArguments
1114
1055
  });
1115
1056
  }
1116
- /** [User Function] Update the liquidity value with oracle. */
1057
+ /** [DEPRECATED] Use `update_liquidity_value_v2` with `&OracleV2` instead. */
1117
1058
  function updateLiquidityValue(options) {
1118
- const packageAddress = options.package ?? "@typus/perp";
1119
- const argumentsTypes = [null, null, "u64", null, "0x2::clock::Clock"];
1059
+ const packageAddress = options.package ?? '@typus/perp';
1060
+ const argumentsTypes = [
1061
+ `${packageAddress}::admin::Version`,
1062
+ `${packageAddress}::lp_pool::Registry`,
1063
+ 'u64',
1064
+ '0xd2e030ab7f0fc956c7e683cf3c6faf3d22868dee81a4aae9f4a10a6d998a8a02::oracle::Oracle',
1065
+ '0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock'
1066
+ ];
1120
1067
  const parameterNames = ["version", "registry", "index", "oracle"];
1121
1068
  return (tx) => tx.moveCall({
1122
1069
  package: packageAddress,
1123
- module: "lp_pool",
1124
- function: "update_liquidity_value",
1125
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1126
- typeArguments: options.typeArguments,
1070
+ module: 'lp_pool',
1071
+ function: 'update_liquidity_value',
1072
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1073
+ typeArguments: options.typeArguments
1074
+ });
1075
+ }
1076
+ /** [User Function] Update the liquidity value with oracle. */
1077
+ function updateLiquidityValueV2(options) {
1078
+ const packageAddress = options.package ?? '@typus/perp';
1079
+ const argumentsTypes = [
1080
+ `${packageAddress}::admin::Version`,
1081
+ `${packageAddress}::lp_pool::Registry`,
1082
+ 'u64',
1083
+ '0xd2e030ab7f0fc956c7e683cf3c6faf3d22868dee81a4aae9f4a10a6d998a8a02::oracle_v2::OracleV2',
1084
+ '0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock'
1085
+ ];
1086
+ const parameterNames = ["version", "registry", "index", "oracleV2"];
1087
+ return (tx) => tx.moveCall({
1088
+ package: packageAddress,
1089
+ module: 'lp_pool',
1090
+ function: 'update_liquidity_value_v2',
1091
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1092
+ typeArguments: options.typeArguments
1127
1093
  });
1128
1094
  }
1129
1095
  /**
@@ -1131,473 +1097,560 @@ function updateLiquidityValue(options) {
1131
1097
  * [total_share_supply, tvl_usd, token_types, amounts, usds]
1132
1098
  */
1133
1099
  function getPoolLiquidity(options) {
1134
- const packageAddress = options.package ?? "@typus/perp";
1135
- const argumentsTypes = [null, null, "u64"];
1100
+ const packageAddress = options.package ?? '@typus/perp';
1101
+ const argumentsTypes = [
1102
+ `${packageAddress}::admin::Version`,
1103
+ `${packageAddress}::lp_pool::Registry`,
1104
+ 'u64'
1105
+ ];
1136
1106
  const parameterNames = ["version", "registry", "index"];
1137
1107
  return (tx) => tx.moveCall({
1138
1108
  package: packageAddress,
1139
- module: "lp_pool",
1140
- function: "get_pool_liquidity",
1141
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1109
+ module: 'lp_pool',
1110
+ function: 'get_pool_liquidity',
1111
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1112
+ });
1113
+ }
1114
+ function getV2Price(options) {
1115
+ const packageAddress = options.package ?? '@typus/perp';
1116
+ const argumentsTypes = [
1117
+ '0xd2e030ab7f0fc956c7e683cf3c6faf3d22868dee81a4aae9f4a10a6d998a8a02::oracle_v2::OracleV2',
1118
+ '0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName',
1119
+ '0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock'
1120
+ ];
1121
+ const parameterNames = ["oracleV2", "tokenType"];
1122
+ return (tx) => tx.moveCall({
1123
+ package: packageAddress,
1124
+ module: 'lp_pool',
1125
+ function: 'get_v2_price',
1126
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1142
1127
  });
1143
1128
  }
1144
1129
  function updateTvl(options) {
1145
- const packageAddress = options.package ?? "@typus/perp";
1146
- const argumentsTypes = [null, null, null, null, "0x2::clock::Clock"];
1147
- const parameterNames = ["version", "liquidityPool", "tokenType", "oracle"];
1130
+ const packageAddress = options.package ?? '@typus/perp';
1131
+ const argumentsTypes = [
1132
+ `${packageAddress}::admin::Version`,
1133
+ `${packageAddress}::lp_pool::LiquidityPool`,
1134
+ '0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName',
1135
+ '0xd2e030ab7f0fc956c7e683cf3c6faf3d22868dee81a4aae9f4a10a6d998a8a02::oracle_v2::OracleV2',
1136
+ '0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock'
1137
+ ];
1138
+ const parameterNames = ["version", "liquidityPool", "tokenType", "oracleV2"];
1148
1139
  return (tx) => tx.moveCall({
1149
1140
  package: packageAddress,
1150
- module: "lp_pool",
1151
- function: "update_tvl",
1152
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1141
+ module: 'lp_pool',
1142
+ function: 'update_tvl',
1143
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1153
1144
  });
1154
1145
  }
1155
1146
  function orderFilled(options) {
1156
- const packageAddress = options.package ?? "@typus/perp";
1157
- const argumentsTypes = [null, "bool", "u64", null];
1147
+ const packageAddress = options.package ?? '@typus/perp';
1148
+ const argumentsTypes = [
1149
+ `${packageAddress}::lp_pool::LiquidityPool`,
1150
+ 'bool',
1151
+ 'u64',
1152
+ `0x0000000000000000000000000000000000000000000000000000000000000002::balance::Balance<${options.typeArguments[0]}>`
1153
+ ];
1158
1154
  const parameterNames = ["liquidityPool", "addReserve", "dReserve", "feeBalance"];
1159
1155
  return (tx) => tx.moveCall({
1160
1156
  package: packageAddress,
1161
- module: "lp_pool",
1162
- function: "order_filled",
1163
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1164
- typeArguments: options.typeArguments,
1157
+ module: 'lp_pool',
1158
+ function: 'order_filled',
1159
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1160
+ typeArguments: options.typeArguments
1165
1161
  });
1166
1162
  }
1167
1163
  function updateReserveAmount(options) {
1168
- const packageAddress = options.package ?? "@typus/perp";
1169
- const argumentsTypes = [null, "bool", "u64"];
1164
+ const packageAddress = options.package ?? '@typus/perp';
1165
+ const argumentsTypes = [
1166
+ `${packageAddress}::lp_pool::LiquidityPool`,
1167
+ 'bool',
1168
+ 'u64'
1169
+ ];
1170
1170
  const parameterNames = ["liquidityPool", "addReserve", "dReserve"];
1171
1171
  return (tx) => tx.moveCall({
1172
1172
  package: packageAddress,
1173
- module: "lp_pool",
1174
- function: "update_reserve_amount",
1175
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1176
- typeArguments: options.typeArguments,
1173
+ module: 'lp_pool',
1174
+ function: 'update_reserve_amount',
1175
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1176
+ typeArguments: options.typeArguments
1177
1177
  });
1178
1178
  }
1179
1179
  function putCollateral(options) {
1180
- const packageAddress = options.package ?? "@typus/perp";
1181
- const argumentsTypes = [null, null, "u64", "u64"];
1180
+ const packageAddress = options.package ?? '@typus/perp';
1181
+ const argumentsTypes = [
1182
+ `${packageAddress}::lp_pool::LiquidityPool`,
1183
+ `0x0000000000000000000000000000000000000000000000000000000000000002::balance::Balance<${options.typeArguments[0]}>`,
1184
+ 'u64',
1185
+ 'u64'
1186
+ ];
1182
1187
  const parameterNames = ["liquidityPool", "collateral", "collateralOraclePrice", "collateralOraclePriceDecimal"];
1183
1188
  return (tx) => tx.moveCall({
1184
1189
  package: packageAddress,
1185
- module: "lp_pool",
1186
- function: "put_collateral",
1187
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1188
- typeArguments: options.typeArguments,
1190
+ module: 'lp_pool',
1191
+ function: 'put_collateral',
1192
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1193
+ typeArguments: options.typeArguments
1189
1194
  });
1190
1195
  }
1191
1196
  function requestCollateral(options) {
1192
- const packageAddress = options.package ?? "@typus/perp";
1193
- const argumentsTypes = [null, "u64", "u64", "u64"];
1197
+ const packageAddress = options.package ?? '@typus/perp';
1198
+ const argumentsTypes = [
1199
+ `${packageAddress}::lp_pool::LiquidityPool`,
1200
+ 'u64',
1201
+ 'u64',
1202
+ 'u64'
1203
+ ];
1194
1204
  const parameterNames = ["liquidityPool", "collateralAmount", "collateralOraclePrice", "collateralOraclePriceDecimal"];
1195
1205
  return (tx) => tx.moveCall({
1196
1206
  package: packageAddress,
1197
- module: "lp_pool",
1198
- function: "request_collateral",
1199
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1200
- typeArguments: options.typeArguments,
1207
+ module: 'lp_pool',
1208
+ function: 'request_collateral',
1209
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1210
+ typeArguments: options.typeArguments
1201
1211
  });
1202
1212
  }
1203
1213
  function putReceiptCollaterals(options) {
1204
- const packageAddress = options.package ?? "@typus/perp";
1205
- const argumentsTypes = [null, "vector<null>"];
1214
+ const packageAddress = options.package ?? '@typus/perp';
1215
+ const argumentsTypes = [
1216
+ `${packageAddress}::lp_pool::LiquidityPool`,
1217
+ `vector<${packageAddress}::escrow::UnsettledBidReceipt>`
1218
+ ];
1206
1219
  const parameterNames = ["liquidityPool", "unsettledBidReceipts"];
1207
1220
  return (tx) => tx.moveCall({
1208
1221
  package: packageAddress,
1209
- module: "lp_pool",
1210
- function: "put_receipt_collaterals",
1211
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1222
+ module: 'lp_pool',
1223
+ function: 'put_receipt_collaterals',
1224
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1212
1225
  });
1213
1226
  }
1214
1227
  function getReceiptCollateral(options) {
1215
- const packageAddress = options.package ?? "@typus/perp";
1216
- const argumentsTypes = [null];
1228
+ const packageAddress = options.package ?? '@typus/perp';
1229
+ const argumentsTypes = [
1230
+ `${packageAddress}::lp_pool::LiquidityPool`
1231
+ ];
1217
1232
  const parameterNames = ["liquidityPool"];
1218
1233
  return (tx) => tx.moveCall({
1219
1234
  package: packageAddress,
1220
- module: "lp_pool",
1221
- function: "get_receipt_collateral",
1222
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1235
+ module: 'lp_pool',
1236
+ function: 'get_receipt_collateral',
1237
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1223
1238
  });
1224
1239
  }
1225
1240
  function calculateMintLp(options) {
1226
- const packageAddress = options.package ?? "@typus/perp";
1227
- const argumentsTypes = [null, "u64", null, "u64", "u64", "u64"];
1241
+ const packageAddress = options.package ?? '@typus/perp';
1242
+ const argumentsTypes = [
1243
+ `${packageAddress}::lp_pool::Registry`,
1244
+ 'u64',
1245
+ '0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName',
1246
+ 'u64',
1247
+ 'u64',
1248
+ 'u64'
1249
+ ];
1228
1250
  const parameterNames = ["registry", "index", "tokenType", "price", "priceDecimal", "depositAmount"];
1229
1251
  return (tx) => tx.moveCall({
1230
1252
  package: packageAddress,
1231
- module: "lp_pool",
1232
- function: "calculate_mint_lp",
1233
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1253
+ module: 'lp_pool',
1254
+ function: 'calculate_mint_lp',
1255
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1234
1256
  });
1235
1257
  }
1236
1258
  function calculateBurnLp(options) {
1237
- const packageAddress = options.package ?? "@typus/perp";
1238
- const argumentsTypes = [null, "u64", null, "u64", "u64", "u64"];
1259
+ const packageAddress = options.package ?? '@typus/perp';
1260
+ const argumentsTypes = [
1261
+ `${packageAddress}::lp_pool::Registry`,
1262
+ 'u64',
1263
+ '0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName',
1264
+ 'u64',
1265
+ 'u64',
1266
+ 'u64'
1267
+ ];
1239
1268
  const parameterNames = ["registry", "index", "tokenType", "price", "priceDecimal", "burnAmount"];
1240
1269
  return (tx) => tx.moveCall({
1241
1270
  package: packageAddress,
1242
- module: "lp_pool",
1243
- function: "calculate_burn_lp",
1244
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1271
+ module: 'lp_pool',
1272
+ function: 'calculate_burn_lp',
1273
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1245
1274
  });
1246
1275
  }
1247
1276
  function calculateLpFee(options) {
1248
- const packageAddress = options.package ?? "@typus/perp";
1249
- const argumentsTypes = [null, null, "u64", "u64", "bool"];
1277
+ const packageAddress = options.package ?? '@typus/perp';
1278
+ const argumentsTypes = [
1279
+ `${packageAddress}::lp_pool::LiquidityPool`,
1280
+ '0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName',
1281
+ 'u64',
1282
+ 'u64',
1283
+ 'bool'
1284
+ ];
1250
1285
  const parameterNames = ["liquidityPool", "tokenType", "depositAmount", "depositAmountUsd", "isMint"];
1251
1286
  return (tx) => tx.moveCall({
1252
1287
  package: packageAddress,
1253
- module: "lp_pool",
1254
- function: "calculate_lp_fee",
1255
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1256
- });
1257
- }
1258
- function calculateFee_(options) {
1259
- const packageAddress = options.package ?? "@typus/perp";
1260
- const argumentsTypes = [null, null, "u64", "u64", "bool", "u64", "u64"];
1261
- const parameterNames = ["liquidityPool", "tokenType", "depositAmount", "depositAmountUsd", "flowIn", "basicFeeBp", "additionalFeeBp"];
1262
- return (tx) => tx.moveCall({
1263
- package: packageAddress,
1264
- module: "lp_pool",
1265
- function: "calculate_fee_",
1266
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1288
+ module: 'lp_pool',
1289
+ function: 'calculate_lp_fee',
1290
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1267
1291
  });
1268
1292
  }
1269
1293
  function normalSafetyCheck(options) {
1270
- const packageAddress = options.package ?? "@typus/perp";
1271
- const argumentsTypes = [null, null, "u64", null, "0x2::clock::Clock"];
1272
- const parameterNames = ["version", "registry", "index", "oracle"];
1294
+ const packageAddress = options.package ?? '@typus/perp';
1295
+ const argumentsTypes = [
1296
+ `${packageAddress}::admin::Version`,
1297
+ `${packageAddress}::lp_pool::Registry`,
1298
+ 'u64',
1299
+ '0xd2e030ab7f0fc956c7e683cf3c6faf3d22868dee81a4aae9f4a10a6d998a8a02::oracle_v2::OracleV2',
1300
+ '0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock'
1301
+ ];
1302
+ const parameterNames = ["version", "registry", "index", "oracleV2"];
1273
1303
  return (tx) => tx.moveCall({
1274
1304
  package: packageAddress,
1275
- module: "lp_pool",
1276
- function: "normal_safety_check",
1277
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1278
- typeArguments: options.typeArguments,
1305
+ module: 'lp_pool',
1306
+ function: 'normal_safety_check',
1307
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1308
+ typeArguments: options.typeArguments
1279
1309
  });
1280
1310
  }
1281
1311
  function calculateSwapFee(options) {
1282
- const packageAddress = options.package ?? "@typus/perp";
1283
- const argumentsTypes = [null, null, "u64", "u64", "bool"];
1312
+ const packageAddress = options.package ?? '@typus/perp';
1313
+ const argumentsTypes = [
1314
+ `${packageAddress}::lp_pool::LiquidityPool`,
1315
+ '0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName',
1316
+ 'u64',
1317
+ 'u64',
1318
+ 'bool'
1319
+ ];
1284
1320
  const parameterNames = ["liquidityPool", "tokenType", "amount", "amountUsd", "swapIn"];
1285
1321
  return (tx) => tx.moveCall({
1286
1322
  package: packageAddress,
1287
- module: "lp_pool",
1288
- function: "calculate_swap_fee",
1289
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1323
+ module: 'lp_pool',
1324
+ function: 'calculate_swap_fee',
1325
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1290
1326
  });
1291
1327
  }
1292
1328
  function checkTvlUpdated(options) {
1293
- const packageAddress = options.package ?? "@typus/perp";
1294
- const argumentsTypes = [null, "0x2::clock::Clock"];
1295
- const parameterNames = ["liquidityPool"];
1296
- return (tx) => tx.moveCall({
1297
- package: packageAddress,
1298
- module: "lp_pool",
1299
- function: "check_tvl_updated",
1300
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1301
- });
1302
- }
1303
- function calculateLendingAmountCapped(options) {
1304
- const packageAddress = options.package ?? "@typus/perp";
1305
- const argumentsTypes = [null, "0x1::option::Option<u64>"];
1306
- const parameterNames = ["tokenPool", "lendingAmount"];
1307
- return (tx) => tx.moveCall({
1308
- package: packageAddress,
1309
- module: "lp_pool",
1310
- function: "calculate_lending_amount_capped",
1311
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1312
- });
1313
- }
1314
- function depositScallopBasic(options) {
1315
- const packageAddress = options.package ?? "@typus/perp";
1316
- const argumentsTypes = [null, null, null, "0x2::clock::Clock", "u64"];
1317
- const parameterNames = ["liquidityPool", "scallopVersion", "scallopMarket", "depositAmount"];
1318
- return (tx) => tx.moveCall({
1319
- package: packageAddress,
1320
- module: "lp_pool",
1321
- function: "deposit_scallop_basic",
1322
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1323
- typeArguments: options.typeArguments,
1324
- });
1325
- }
1326
- function withdrawScallopBasic(options) {
1327
- const packageAddress = options.package ?? "@typus/perp";
1328
- const argumentsTypes = [null, null, null, null, "0x2::clock::Clock", "u64"];
1329
- const parameterNames = ["version", "liquidityPool", "scallopVersion", "scallopMarket", "withdrawAmount"];
1330
- return (tx) => tx.moveCall({
1331
- package: packageAddress,
1332
- module: "lp_pool",
1333
- function: "withdraw_scallop_basic",
1334
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1335
- typeArguments: options.typeArguments,
1336
- });
1337
- }
1338
- function depositNavi(options) {
1339
- const packageAddress = options.package ?? "@typus/perp";
1340
- const argumentsTypes = [null, null, null, "u8", null, null, "0x2::clock::Clock", "u64"];
1341
- const parameterNames = ["liquidityPool", "storage", "pool", "asset", "incentiveV2", "incentiveV3", "depositAmount"];
1342
- return (tx) => tx.moveCall({
1343
- package: packageAddress,
1344
- module: "lp_pool",
1345
- function: "deposit_navi",
1346
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1347
- typeArguments: options.typeArguments,
1348
- });
1349
- }
1350
- function withdrawNavi(options) {
1351
- const packageAddress = options.package ?? "@typus/perp";
1352
- const argumentsTypes = [null, null, null, null, null, null, "address", null, null, "u8", null, null, "0x2::clock::Clock"];
1353
- const parameterNames = [
1354
- "version",
1355
- "liquidityPool",
1356
- "oracleConfig",
1357
- "priceOracle",
1358
- "supraOracleHolder",
1359
- "pythPriceInfo",
1360
- "feedAddress",
1361
- "storage",
1362
- "pool",
1363
- "asset",
1364
- "incentiveV2",
1365
- "incentiveV3",
1329
+ const packageAddress = options.package ?? '@typus/perp';
1330
+ const argumentsTypes = [
1331
+ `${packageAddress}::lp_pool::LiquidityPool`,
1332
+ '0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock'
1366
1333
  ];
1334
+ const parameterNames = ["liquidityPool"];
1367
1335
  return (tx) => tx.moveCall({
1368
1336
  package: packageAddress,
1369
- module: "lp_pool",
1370
- function: "withdraw_navi",
1371
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1372
- typeArguments: options.typeArguments,
1373
- });
1374
- }
1375
- function rewardNavi(options) {
1376
- const packageAddress = options.package ?? "@typus/perp";
1377
- const argumentsTypes = [null, null, null, null, "vector<0x1::string::String>", "vector<address>", null, "0x2::clock::Clock"];
1378
- const parameterNames = ["version", "liquidityPool", "storage", "rewardFund", "coinTypes", "ruleIds", "incentiveV3"];
1379
- return (tx) => tx.moveCall({
1380
- package: packageAddress,
1381
- module: "lp_pool",
1382
- function: "reward_navi",
1383
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1384
- typeArguments: options.typeArguments,
1337
+ module: 'lp_pool',
1338
+ function: 'check_tvl_updated',
1339
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1385
1340
  });
1386
1341
  }
1387
1342
  function burnLp_(options) {
1388
- const packageAddress = options.package ?? "@typus/perp";
1389
- const argumentsTypes = [null, null, "u64", null, null, null, "0x2::clock::Clock"];
1390
- const parameterNames = ["version", "registry", "index", "treasuryCaps", "oracle", "burnLpBalance"];
1343
+ const packageAddress = options.package ?? '@typus/perp';
1344
+ const argumentsTypes = [
1345
+ `${packageAddress}::admin::Version`,
1346
+ `${packageAddress}::lp_pool::Registry`,
1347
+ 'u64',
1348
+ `${packageAddress}::treasury_caps::TreasuryCaps`,
1349
+ '0xd2e030ab7f0fc956c7e683cf3c6faf3d22868dee81a4aae9f4a10a6d998a8a02::oracle_v2::OracleV2',
1350
+ `0x0000000000000000000000000000000000000000000000000000000000000002::balance::Balance<${options.typeArguments[0]}>`,
1351
+ '0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock'
1352
+ ];
1353
+ const parameterNames = ["version", "registry", "index", "treasuryCaps", "oracleV2", "burnLpBalance"];
1391
1354
  return (tx) => tx.moveCall({
1392
1355
  package: packageAddress,
1393
- module: "lp_pool",
1394
- function: "burn_lp_",
1395
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1396
- typeArguments: options.typeArguments,
1356
+ module: 'lp_pool',
1357
+ function: 'burn_lp_',
1358
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1359
+ typeArguments: options.typeArguments
1397
1360
  });
1398
1361
  }
1399
1362
  function viewSwapResult(options) {
1400
- const packageAddress = options.package ?? "@typus/perp";
1401
- const argumentsTypes = [null, null, "u64", null, null, "u64", "0x2::clock::Clock"];
1402
- const parameterNames = ["version", "registry", "index", "oracleFromToken", "oracleToToken", "fromAmount"];
1363
+ const packageAddress = options.package ?? '@typus/perp';
1364
+ const argumentsTypes = [
1365
+ `${packageAddress}::admin::Version`,
1366
+ `${packageAddress}::lp_pool::Registry`,
1367
+ 'u64',
1368
+ '0xd2e030ab7f0fc956c7e683cf3c6faf3d22868dee81a4aae9f4a10a6d998a8a02::oracle_v2::OracleV2',
1369
+ 'u64',
1370
+ '0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock'
1371
+ ];
1372
+ const parameterNames = ["version", "registry", "index", "oracleV2", "fromAmount"];
1403
1373
  return (tx) => tx.moveCall({
1404
1374
  package: packageAddress,
1405
- module: "lp_pool",
1406
- function: "view_swap_result",
1407
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1408
- typeArguments: options.typeArguments,
1375
+ module: 'lp_pool',
1376
+ function: 'view_swap_result',
1377
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1378
+ typeArguments: options.typeArguments
1409
1379
  });
1410
1380
  }
1411
1381
  function getReceiptCollateralBcs(options) {
1412
- const packageAddress = options.package ?? "@typus/perp";
1413
- const argumentsTypes = [null, "u64"];
1382
+ const packageAddress = options.package ?? '@typus/perp';
1383
+ const argumentsTypes = [
1384
+ `${packageAddress}::lp_pool::Registry`,
1385
+ 'u64'
1386
+ ];
1414
1387
  const parameterNames = ["registry", "index"];
1415
1388
  return (tx) => tx.moveCall({
1416
1389
  package: packageAddress,
1417
- module: "lp_pool",
1418
- function: "get_receipt_collateral_bcs",
1419
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1390
+ module: 'lp_pool',
1391
+ function: 'get_receipt_collateral_bcs',
1392
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1420
1393
  });
1421
1394
  }
1422
1395
  function getExpiredReceiptCollateralBcs(options) {
1423
- const packageAddress = options.package ?? "@typus/perp";
1424
- const argumentsTypes = [null, null, "u64"];
1396
+ const packageAddress = options.package ?? '@typus/perp';
1397
+ const argumentsTypes = [
1398
+ `${packageAddress}::lp_pool::Registry`,
1399
+ '0x02821e55ac15f878ebc46f5bbd611de4d683c70e6308abb78880fd7f9d1d98ed::typus_dov_single::Registry',
1400
+ 'u64'
1401
+ ];
1425
1402
  const parameterNames = ["registry", "dovRegistry", "index"];
1426
1403
  return (tx) => tx.moveCall({
1427
1404
  package: packageAddress,
1428
- module: "lp_pool",
1429
- function: "get_expired_receipt_collateral_bcs",
1430
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1405
+ module: 'lp_pool',
1406
+ function: 'get_expired_receipt_collateral_bcs',
1407
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1431
1408
  });
1432
1409
  }
1433
1410
  function getLiquidityPool(options) {
1434
- const packageAddress = options.package ?? "@typus/perp";
1435
- const argumentsTypes = [null, "u64"];
1411
+ const packageAddress = options.package ?? '@typus/perp';
1412
+ const argumentsTypes = [
1413
+ `${packageAddress}::lp_pool::Registry`,
1414
+ 'u64'
1415
+ ];
1436
1416
  const parameterNames = ["registry", "index"];
1437
1417
  return (tx) => tx.moveCall({
1438
1418
  package: packageAddress,
1439
- module: "lp_pool",
1440
- function: "get_liquidity_pool",
1441
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1419
+ module: 'lp_pool',
1420
+ function: 'get_liquidity_pool',
1421
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1442
1422
  });
1443
1423
  }
1444
1424
  function getMutLiquidityPool(options) {
1445
- const packageAddress = options.package ?? "@typus/perp";
1446
- const argumentsTypes = [null, "u64"];
1425
+ const packageAddress = options.package ?? '@typus/perp';
1426
+ const argumentsTypes = [
1427
+ `${packageAddress}::lp_pool::Registry`,
1428
+ 'u64'
1429
+ ];
1447
1430
  const parameterNames = ["registry", "index"];
1448
1431
  return (tx) => tx.moveCall({
1449
1432
  package: packageAddress,
1450
- module: "lp_pool",
1451
- function: "get_mut_liquidity_pool",
1452
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1433
+ module: 'lp_pool',
1434
+ function: 'get_mut_liquidity_pool',
1435
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1453
1436
  });
1454
1437
  }
1455
1438
  function safetyCheck(options) {
1456
- const packageAddress = options.package ?? "@typus/perp";
1457
- const argumentsTypes = [null, null, "address"];
1439
+ const packageAddress = options.package ?? '@typus/perp';
1440
+ const argumentsTypes = [
1441
+ `${packageAddress}::lp_pool::LiquidityPool`,
1442
+ '0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName',
1443
+ 'address'
1444
+ ];
1458
1445
  const parameterNames = ["liquidityPool", "tokenType", "oracleId"];
1459
1446
  return (tx) => tx.moveCall({
1460
1447
  package: packageAddress,
1461
- module: "lp_pool",
1462
- function: "safety_check",
1463
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1448
+ module: 'lp_pool',
1449
+ function: 'safety_check',
1450
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1464
1451
  });
1465
1452
  }
1466
1453
  function checkActive(options) {
1467
- const packageAddress = options.package ?? "@typus/perp";
1468
- const argumentsTypes = [null];
1454
+ const packageAddress = options.package ?? '@typus/perp';
1455
+ const argumentsTypes = [
1456
+ `${packageAddress}::lp_pool::LiquidityPool`
1457
+ ];
1469
1458
  const parameterNames = ["liquidityPool"];
1470
1459
  return (tx) => tx.moveCall({
1471
1460
  package: packageAddress,
1472
- module: "lp_pool",
1473
- function: "check_active",
1474
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1461
+ module: 'lp_pool',
1462
+ function: 'check_active',
1463
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1475
1464
  });
1476
1465
  }
1477
1466
  function oracleMatched(options) {
1478
- const packageAddress = options.package ?? "@typus/perp";
1479
- const argumentsTypes = [null, null, "address"];
1467
+ const packageAddress = options.package ?? '@typus/perp';
1468
+ const argumentsTypes = [
1469
+ `${packageAddress}::lp_pool::LiquidityPool`,
1470
+ '0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName',
1471
+ 'address'
1472
+ ];
1480
1473
  const parameterNames = ["liquidityPool", "tokenType", "oracleId"];
1481
1474
  return (tx) => tx.moveCall({
1482
1475
  package: packageAddress,
1483
- module: "lp_pool",
1484
- function: "oracle_matched",
1485
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1476
+ module: 'lp_pool',
1477
+ function: 'oracle_matched',
1478
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1486
1479
  });
1487
1480
  }
1488
1481
  function getTokenPool(options) {
1489
- const packageAddress = options.package ?? "@typus/perp";
1490
- const argumentsTypes = [null, null];
1482
+ const packageAddress = options.package ?? '@typus/perp';
1483
+ const argumentsTypes = [
1484
+ `${packageAddress}::lp_pool::LiquidityPool`,
1485
+ '0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName'
1486
+ ];
1491
1487
  const parameterNames = ["liquidityPool", "tokenType"];
1492
1488
  return (tx) => tx.moveCall({
1493
1489
  package: packageAddress,
1494
- module: "lp_pool",
1495
- function: "get_token_pool",
1496
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1490
+ module: 'lp_pool',
1491
+ function: 'get_token_pool',
1492
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1497
1493
  });
1498
1494
  }
1499
1495
  function getMutTokenPool(options) {
1500
- const packageAddress = options.package ?? "@typus/perp";
1501
- const argumentsTypes = [null, null];
1496
+ const packageAddress = options.package ?? '@typus/perp';
1497
+ const argumentsTypes = [
1498
+ `${packageAddress}::lp_pool::LiquidityPool`,
1499
+ '0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName'
1500
+ ];
1502
1501
  const parameterNames = ["liquidityPool", "tokenType"];
1503
1502
  return (tx) => tx.moveCall({
1504
1503
  package: packageAddress,
1505
- module: "lp_pool",
1506
- function: "get_mut_token_pool",
1507
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1504
+ module: 'lp_pool',
1505
+ function: 'get_mut_token_pool',
1506
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1508
1507
  });
1509
1508
  }
1510
1509
  function getLpTokenType(options) {
1511
- const packageAddress = options.package ?? "@typus/perp";
1512
- const argumentsTypes = [null, "u64"];
1510
+ const packageAddress = options.package ?? '@typus/perp';
1511
+ const argumentsTypes = [
1512
+ `${packageAddress}::lp_pool::Registry`,
1513
+ 'u64'
1514
+ ];
1513
1515
  const parameterNames = ["registry", "index"];
1514
1516
  return (tx) => tx.moveCall({
1515
1517
  package: packageAddress,
1516
- module: "lp_pool",
1517
- function: "get_lp_token_type",
1518
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1518
+ module: 'lp_pool',
1519
+ function: 'get_lp_token_type',
1520
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1519
1521
  });
1520
1522
  }
1521
1523
  function getLiquidityTokenDecimal(options) {
1522
- const packageAddress = options.package ?? "@typus/perp";
1523
- const argumentsTypes = [null, "u64", null];
1524
+ const packageAddress = options.package ?? '@typus/perp';
1525
+ const argumentsTypes = [
1526
+ `${packageAddress}::lp_pool::Registry`,
1527
+ 'u64',
1528
+ '0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName'
1529
+ ];
1524
1530
  const parameterNames = ["registry", "index", "liquidityToken"];
1525
1531
  return (tx) => tx.moveCall({
1526
1532
  package: packageAddress,
1527
- module: "lp_pool",
1528
- function: "get_liquidity_token_decimal",
1529
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1533
+ module: 'lp_pool',
1534
+ function: 'get_liquidity_token_decimal',
1535
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1530
1536
  });
1531
1537
  }
1532
1538
  function getTokenPoolState(options) {
1533
- const packageAddress = options.package ?? "@typus/perp";
1534
- const argumentsTypes = [null, null];
1539
+ const packageAddress = options.package ?? '@typus/perp';
1540
+ const argumentsTypes = [
1541
+ `${packageAddress}::lp_pool::LiquidityPool`,
1542
+ '0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName'
1543
+ ];
1535
1544
  const parameterNames = ["liquidityPool", "liquidityToken"];
1536
1545
  return (tx) => tx.moveCall({
1537
1546
  package: packageAddress,
1538
- module: "lp_pool",
1539
- function: "get_token_pool_state",
1540
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1547
+ module: 'lp_pool',
1548
+ function: 'get_token_pool_state',
1549
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1541
1550
  });
1542
1551
  }
1543
1552
  function checkTradingOrderSizeValid(options) {
1544
- const packageAddress = options.package ?? "@typus/perp";
1545
- const argumentsTypes = [null, null, "u64"];
1553
+ const packageAddress = options.package ?? '@typus/perp';
1554
+ const argumentsTypes = [
1555
+ `${packageAddress}::lp_pool::LiquidityPool`,
1556
+ '0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName',
1557
+ 'u64'
1558
+ ];
1546
1559
  const parameterNames = ["liquidityPool", "liquidityToken", "reserveAmount"];
1547
1560
  return (tx) => tx.moveCall({
1548
1561
  package: packageAddress,
1549
- module: "lp_pool",
1550
- function: "check_trading_order_size_valid",
1551
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1562
+ module: 'lp_pool',
1563
+ function: 'check_trading_order_size_valid',
1564
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1552
1565
  });
1553
1566
  }
1554
1567
  function getCumulativeBorrowRate(options) {
1555
- const packageAddress = options.package ?? "@typus/perp";
1556
- const argumentsTypes = [null, null];
1568
+ const packageAddress = options.package ?? '@typus/perp';
1569
+ const argumentsTypes = [
1570
+ `${packageAddress}::lp_pool::LiquidityPool`,
1571
+ '0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName'
1572
+ ];
1557
1573
  const parameterNames = ["liquidityPool", "liquidityToken"];
1558
1574
  return (tx) => tx.moveCall({
1559
1575
  package: packageAddress,
1560
- module: "lp_pool",
1561
- function: "get_cumulative_borrow_rate",
1562
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1576
+ module: 'lp_pool',
1577
+ function: 'get_cumulative_borrow_rate',
1578
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1563
1579
  });
1564
1580
  }
1565
1581
  function getTvlUsd(options) {
1566
- const packageAddress = options.package ?? "@typus/perp";
1567
- const argumentsTypes = [null];
1582
+ const packageAddress = options.package ?? '@typus/perp';
1583
+ const argumentsTypes = [
1584
+ `${packageAddress}::lp_pool::LiquidityPool`
1585
+ ];
1568
1586
  const parameterNames = ["liquidityPool"];
1569
1587
  return (tx) => tx.moveCall({
1570
1588
  package: packageAddress,
1571
- module: "lp_pool",
1572
- function: "get_tvl_usd",
1573
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1589
+ module: 'lp_pool',
1590
+ function: 'get_tvl_usd',
1591
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1574
1592
  });
1575
1593
  }
1576
1594
  function getBorrowRateDecimal(options = {}) {
1577
- const packageAddress = options.package ?? "@typus/perp";
1595
+ const packageAddress = options.package ?? '@typus/perp';
1578
1596
  return (tx) => tx.moveCall({
1579
1597
  package: packageAddress,
1580
- module: "lp_pool",
1581
- function: "get_borrow_rate_decimal",
1598
+ module: 'lp_pool',
1599
+ function: 'get_borrow_rate_decimal',
1582
1600
  });
1583
1601
  }
1584
- function deprecated(options = {}) {
1585
- const packageAddress = options.package ?? "@typus/perp";
1602
+ /**
1603
+ * [Migration helper] Overwrite every TokenPool's `oracle_id` with the new OracleV2
1604
+ * object id. Iterates all liquidity pools in the registry and all TokenPools
1605
+ * within each.
1606
+ */
1607
+ function setAllOracleId(options) {
1608
+ const packageAddress = options.package ?? '@typus/perp';
1609
+ const argumentsTypes = [
1610
+ `${packageAddress}::lp_pool::Registry`,
1611
+ 'address'
1612
+ ];
1613
+ const parameterNames = ["registry", "newOracleId"];
1586
1614
  return (tx) => tx.moveCall({
1587
1615
  package: packageAddress,
1588
- module: "lp_pool",
1589
- function: "deprecated",
1616
+ module: 'lp_pool',
1617
+ function: 'set_all_oracle_id',
1618
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1619
+ });
1620
+ }
1621
+ /**
1622
+ * [Authorized Function] Overwrite every TokenPool's `oracle_id` with the live
1623
+ * `OracleV2` id. Run once after upgrading typus_perp to point all LP token configs
1624
+ * at the redeployed OracleV2.
1625
+ */
1626
+ function migrateOracleIdToV2(options) {
1627
+ const packageAddress = options.package ?? '@typus/perp';
1628
+ const argumentsTypes = [
1629
+ `${packageAddress}::admin::Version`,
1630
+ `${packageAddress}::lp_pool::Registry`,
1631
+ '0xd2e030ab7f0fc956c7e683cf3c6faf3d22868dee81a4aae9f4a10a6d998a8a02::oracle_v2::OracleV2'
1632
+ ];
1633
+ const parameterNames = ["version", "registry", "oracleV2"];
1634
+ return (tx) => tx.moveCall({
1635
+ package: packageAddress,
1636
+ module: 'lp_pool',
1637
+ function: 'migrate_oracle_id_to_v2',
1638
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1590
1639
  });
1591
1640
  }
1592
1641
  function getUserDeactivatingShares(options) {
1593
- const packageAddress = options.package ?? "@typus/perp";
1594
- const argumentsTypes = [null, "u64", "address"];
1642
+ const packageAddress = options.package ?? '@typus/perp';
1643
+ const argumentsTypes = [
1644
+ `${packageAddress}::lp_pool::Registry`,
1645
+ 'u64',
1646
+ 'address'
1647
+ ];
1595
1648
  const parameterNames = ["registry", "index", "user"];
1596
1649
  return (tx) => tx.moveCall({
1597
1650
  package: packageAddress,
1598
- module: "lp_pool",
1599
- function: "get_user_deactivating_shares",
1600
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1601
- typeArguments: options.typeArguments,
1651
+ module: 'lp_pool',
1652
+ function: 'get_user_deactivating_shares',
1653
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
1654
+ typeArguments: options.typeArguments
1602
1655
  });
1603
1656
  }