@typus/typus-perp-sdk 1.1.32-codegen-exp2 → 1.1.32-codegen-exp3

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.
@@ -191,10 +191,13 @@ export declare function getStakePools(client: TypusClient): Promise<{
191
191
  next_user_share_id: string;
192
192
  total_share: string;
193
193
  active: boolean;
194
+ new_tlp_price: string;
195
+ depositors_count: string;
194
196
  u64_padding: string[];
195
197
  };
196
198
  config: {
197
199
  unlock_countdown_ts_ms: string;
200
+ usd_per_exp: string;
198
201
  u64_padding: string[];
199
202
  };
200
203
  incentives: {
@@ -228,10 +231,13 @@ export declare function getStakePool(client: TypusClient, objectId: string): Pro
228
231
  next_user_share_id: string;
229
232
  total_share: string;
230
233
  active: boolean;
234
+ new_tlp_price: string;
235
+ depositors_count: string;
231
236
  u64_padding: string[];
232
237
  };
233
238
  config: {
234
239
  unlock_countdown_ts_ms: string;
240
+ usd_per_exp: string;
235
241
  u64_padding: string[];
236
242
  };
237
243
  incentives: {
@@ -338,7 +344,36 @@ export declare function getMarkets(client: TypusClient, input: {
338
344
  export declare function getUserOrders(client: TypusClient, input: {
339
345
  user: string;
340
346
  indexes: string[];
341
- }): Promise<void>;
347
+ }): Promise<{
348
+ id: {
349
+ id: string;
350
+ };
351
+ create_ts_ms: string;
352
+ order_id: string;
353
+ linked_position_id: string | null;
354
+ user: string;
355
+ collateral_token: {
356
+ name: string;
357
+ };
358
+ collateral_token_decimal: string;
359
+ symbol: {
360
+ base_token: {
361
+ name: string;
362
+ };
363
+ quote_token: {
364
+ name: string;
365
+ };
366
+ };
367
+ leverage_mbp: string;
368
+ reduce_only: boolean;
369
+ is_long: boolean;
370
+ is_stop_order: boolean;
371
+ size: string;
372
+ size_decimal: string;
373
+ trigger_price: string;
374
+ oracle_price_when_placing: string;
375
+ u64_padding: string[];
376
+ }[]>;
342
377
  export declare function getUserPositions(client: TypusClient, input: {
343
378
  user: string;
344
379
  indexes: string[];
@@ -402,7 +437,39 @@ export declare function parseOptionBidReceipts(positions: (typeof Position.$infe
402
437
  export declare function getUserStake(client: TypusClient, input: {
403
438
  user: string;
404
439
  indexes: string[];
405
- }): Promise<any[]>;
440
+ }): Promise<[{
441
+ user: string;
442
+ user_share_id: string;
443
+ stake_ts_ms: string;
444
+ total_shares: string;
445
+ active_shares: string;
446
+ deactivating_shares: {
447
+ shares: string;
448
+ unsubscribed_ts_ms: string;
449
+ unlocked_ts_ms: string;
450
+ unsubscribed_incentive_price_index: {
451
+ contents: {
452
+ key: {
453
+ name: string;
454
+ };
455
+ value: string;
456
+ }[];
457
+ };
458
+ u64_padding: string[];
459
+ }[];
460
+ last_incentive_price_index: {
461
+ contents: {
462
+ key: {
463
+ name: string;
464
+ };
465
+ value: string;
466
+ }[];
467
+ };
468
+ snapshot_ts_ms: string;
469
+ tlp_price: string;
470
+ harvested_amount: string;
471
+ u64_padding: string[];
472
+ } | null, string[]][]>;
406
473
  /**
407
474
  * @returns deactivatingShares[]
408
475
  */
package/dist/src/fetch.js CHANGED
@@ -127,31 +127,20 @@ async function getUserOrders(client, input) {
127
127
  }
128
128
  let res = await client.devInspectTransactionBlock({ sender: input.user, transactionBlock: tx });
129
129
  // console.log(res);
130
- res.results?.map((x) => {
130
+ let orders = [];
131
+ for (var x = 0; x < input.indexes.length; x++) {
131
132
  // @ts-ignore
132
- let returnValues = x.returnValues[0][0];
133
+ let returnValues = res.results[x].returnValues[0][0];
133
134
  // console.log(returnValues);
134
135
  let reader = new bcs_1.BcsReader(new Uint8Array(returnValues));
135
- let yy = reader.readVec((reader) => {
136
+ reader.readVec((reader) => {
136
137
  let length = reader.readULEB();
137
138
  let bytes = reader.readBytes(length);
138
139
  let order = position_1.TradingOrder.parse(bytes);
139
- return order;
140
+ orders.push(order);
140
141
  });
141
- });
142
- // for (var x = 0; x < input.indexes.length; x++) {
143
- // // @ts-ignore
144
- // let returnValues = res.results[x].returnValues[0][0];
145
- // // console.log(returnValues);
146
- // let reader = new BcsReader(new Uint8Array(returnValues));
147
- // reader.readVec((reader) => {
148
- // let length = reader.readULEB();
149
- // let bytes = reader.readBytes(length);
150
- // let order = TradingOrder.parse(bytes);
151
- // orders.push(order);
152
- // });
153
- // }
154
- // return orders;
142
+ }
143
+ return orders;
155
144
  }
156
145
  async function getUserPositions(client, input) {
157
146
  let tx = new transactions_1.Transaction();
@@ -231,7 +220,7 @@ async function getUserStake(client, input) {
231
220
  let length = reader.readULEB();
232
221
  console.log(length);
233
222
  if (length == 0) {
234
- results.push([]);
223
+ results.push([null, []]);
235
224
  continue;
236
225
  }
237
226
  // let lpShare = LpUserShare.fromFields(LpUserShare.bcs.read(reader));
@@ -5,7 +5,8 @@
5
5
  * The `admin` module provides administrative functionalities for the Typus Stake
6
6
  * Pool. It includes version management, authority control, and fee handling.
7
7
  */
8
- import { MoveStruct } from "../utils/index";
8
+ import { MoveStruct, type RawTransactionArgument } from "../utils/index";
9
+ import { type Transaction } from "@mysten/sui/transactions";
9
10
  export declare const FeeInfo: MoveStruct<{
10
11
  /** The type name of the token. */
11
12
  token: MoveStruct<{
@@ -98,3 +99,136 @@ export declare const SendFeeEvent: MoveStruct<{
98
99
  /** The amount of fees sent. */
99
100
  amount: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
100
101
  }, "@typus/stake-pool::admin::SendFeeEvent">;
102
+ export interface VersionCheckArguments {
103
+ version: RawTransactionArgument<string>;
104
+ }
105
+ export interface VersionCheckOptions {
106
+ package?: string;
107
+ arguments: VersionCheckArguments | [version: RawTransactionArgument<string>];
108
+ }
109
+ /** Checks if the contract version is valid. */
110
+ export declare function versionCheck(options: VersionCheckOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
111
+ export interface UpgradeArguments {
112
+ version: RawTransactionArgument<string>;
113
+ }
114
+ export interface UpgradeOptions {
115
+ package?: string;
116
+ arguments: UpgradeArguments | [version: RawTransactionArgument<string>];
117
+ }
118
+ /** Upgrades the contract version. WARNING: no authority check inside */
119
+ export declare function upgrade(options: UpgradeOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
120
+ export interface InitOptions {
121
+ package?: string;
122
+ arguments?: [];
123
+ }
124
+ /** Initializes the contract. */
125
+ export declare function init(options?: InitOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
126
+ export interface VerifyArguments {
127
+ version: RawTransactionArgument<string>;
128
+ }
129
+ export interface VerifyOptions {
130
+ package?: string;
131
+ arguments: VerifyArguments | [version: RawTransactionArgument<string>];
132
+ }
133
+ /** [Authorized Function] Verifies if the sender is an authorized user. */
134
+ export declare function verify(options: VerifyOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
135
+ export interface AddAuthorizedUserArguments {
136
+ version: RawTransactionArgument<string>;
137
+ userAddress: RawTransactionArgument<string>;
138
+ }
139
+ export interface AddAuthorizedUserOptions {
140
+ package?: string;
141
+ arguments: AddAuthorizedUserArguments | [version: RawTransactionArgument<string>, userAddress: RawTransactionArgument<string>];
142
+ }
143
+ /** [Authorized Function] Adds an authorized user. */
144
+ export declare function addAuthorizedUser(options: AddAuthorizedUserOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
145
+ export interface RemoveAuthorizedUserArguments {
146
+ version: RawTransactionArgument<string>;
147
+ userAddress: RawTransactionArgument<string>;
148
+ }
149
+ export interface RemoveAuthorizedUserOptions {
150
+ package?: string;
151
+ arguments: RemoveAuthorizedUserArguments | [version: RawTransactionArgument<string>, userAddress: RawTransactionArgument<string>];
152
+ }
153
+ /** [Authorized Function] Removes an authorized user. */
154
+ export declare function removeAuthorizedUser(options: RemoveAuthorizedUserOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
155
+ export interface InstallEcosystemManagerCapEntryArguments {
156
+ version: RawTransactionArgument<string>;
157
+ typusEcosystemVersion: RawTransactionArgument<string>;
158
+ }
159
+ export interface InstallEcosystemManagerCapEntryOptions {
160
+ package?: string;
161
+ arguments: InstallEcosystemManagerCapEntryArguments | [version: RawTransactionArgument<string>, typusEcosystemVersion: RawTransactionArgument<string>];
162
+ }
163
+ /**
164
+ * [Authorized Function] Installs the ecosystem manager cap. TODO: can be remove
165
+ * after install
166
+ */
167
+ export declare function installEcosystemManagerCapEntry(options: InstallEcosystemManagerCapEntryOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
168
+ export interface AddTailsExpAmountArguments {
169
+ version: RawTransactionArgument<string>;
170
+ typusEcosystemVersion: RawTransactionArgument<string>;
171
+ typusUserRegistry: RawTransactionArgument<string>;
172
+ user: RawTransactionArgument<string>;
173
+ amount: RawTransactionArgument<number | bigint>;
174
+ }
175
+ export interface AddTailsExpAmountOptions {
176
+ package?: string;
177
+ arguments: AddTailsExpAmountArguments | [
178
+ version: RawTransactionArgument<string>,
179
+ typusEcosystemVersion: RawTransactionArgument<string>,
180
+ typusUserRegistry: RawTransactionArgument<string>,
181
+ user: RawTransactionArgument<string>,
182
+ amount: RawTransactionArgument<number | bigint>
183
+ ];
184
+ }
185
+ /** Adds tails experience points to a user. */
186
+ export declare function addTailsExpAmount(options: AddTailsExpAmountOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
187
+ export interface SendFeeArguments {
188
+ version: RawTransactionArgument<string>;
189
+ }
190
+ export interface SendFeeOptions {
191
+ package?: string;
192
+ arguments: SendFeeArguments | [version: RawTransactionArgument<string>];
193
+ typeArguments: [string];
194
+ }
195
+ /**
196
+ * Sends the collected fees to the fee address. Safe with constant address as
197
+ * receiver
198
+ */
199
+ export declare function sendFee(options: SendFeeOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
200
+ export interface ChargeFeeArguments {
201
+ version: RawTransactionArgument<string>;
202
+ balance: RawTransactionArgument<string>;
203
+ }
204
+ export interface ChargeFeeOptions {
205
+ package?: string;
206
+ arguments: ChargeFeeArguments | [version: RawTransactionArgument<string>, balance: RawTransactionArgument<string>];
207
+ typeArguments: [string];
208
+ }
209
+ /** Charges a protocol fee. WARNING: no authority check inside */
210
+ export declare function chargeFee(options: ChargeFeeOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
211
+ export interface SendLiquidatorFeeArguments {
212
+ version: RawTransactionArgument<string>;
213
+ }
214
+ export interface SendLiquidatorFeeOptions {
215
+ package?: string;
216
+ arguments: SendLiquidatorFeeArguments | [version: RawTransactionArgument<string>];
217
+ typeArguments: [string];
218
+ }
219
+ /**
220
+ * Sends the liquidator fees to the fee address. Safe with constant address as
221
+ * receiver
222
+ */
223
+ export declare function sendLiquidatorFee(options: SendLiquidatorFeeOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
224
+ export interface ChargeLiquidatorFeeArguments {
225
+ version: RawTransactionArgument<string>;
226
+ balance: RawTransactionArgument<string>;
227
+ }
228
+ export interface ChargeLiquidatorFeeOptions {
229
+ package?: string;
230
+ arguments: ChargeLiquidatorFeeArguments | [version: RawTransactionArgument<string>, balance: RawTransactionArgument<string>];
231
+ typeArguments: [string];
232
+ }
233
+ /** Charges a liquidator fee. WARNING: no authority check inside */
234
+ export declare function chargeLiquidatorFee(options: ChargeLiquidatorFeeOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
@@ -37,6 +37,18 @@ var __importStar = (this && this.__importStar) || (function () {
37
37
  })();
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.SendFeeEvent = exports.Version = exports.FeePool = exports.FeeInfo = void 0;
40
+ exports.versionCheck = versionCheck;
41
+ exports.upgrade = upgrade;
42
+ exports.init = init;
43
+ exports.verify = verify;
44
+ exports.addAuthorizedUser = addAuthorizedUser;
45
+ exports.removeAuthorizedUser = removeAuthorizedUser;
46
+ exports.installEcosystemManagerCapEntry = installEcosystemManagerCapEntry;
47
+ exports.addTailsExpAmount = addTailsExpAmount;
48
+ exports.sendFee = sendFee;
49
+ exports.chargeFee = chargeFee;
50
+ exports.sendLiquidatorFee = sendLiquidatorFee;
51
+ exports.chargeLiquidatorFee = chargeLiquidatorFee;
40
52
  /**
41
53
  * The `admin` module provides administrative functionalities for the Typus Stake
42
54
  * Pool. It includes version management, authority control, and fee handling.
@@ -89,3 +101,172 @@ exports.SendFeeEvent = new index_1.MoveStruct({
89
101
  amount: bcs_1.bcs.u64(),
90
102
  },
91
103
  });
104
+ /** Checks if the contract version is valid. */
105
+ function versionCheck(options) {
106
+ const packageAddress = options.package ?? "@typus/stake-pool";
107
+ const argumentsTypes = [`${packageAddress}::admin::Version`];
108
+ const parameterNames = ["version"];
109
+ return (tx) => tx.moveCall({
110
+ package: packageAddress,
111
+ module: "admin",
112
+ function: "version_check",
113
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
114
+ });
115
+ }
116
+ /** Upgrades the contract version. WARNING: no authority check inside */
117
+ function upgrade(options) {
118
+ const packageAddress = options.package ?? "@typus/stake-pool";
119
+ const argumentsTypes = [`${packageAddress}::admin::Version`];
120
+ const parameterNames = ["version"];
121
+ return (tx) => tx.moveCall({
122
+ package: packageAddress,
123
+ module: "admin",
124
+ function: "upgrade",
125
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
126
+ });
127
+ }
128
+ /** Initializes the contract. */
129
+ function init(options = {}) {
130
+ const packageAddress = options.package ?? "@typus/stake-pool";
131
+ return (tx) => tx.moveCall({
132
+ package: packageAddress,
133
+ module: "admin",
134
+ function: "init",
135
+ });
136
+ }
137
+ /** [Authorized Function] Verifies if the sender is an authorized user. */
138
+ function verify(options) {
139
+ const packageAddress = options.package ?? "@typus/stake-pool";
140
+ const argumentsTypes = [`${packageAddress}::admin::Version`];
141
+ const parameterNames = ["version"];
142
+ return (tx) => tx.moveCall({
143
+ package: packageAddress,
144
+ module: "admin",
145
+ function: "verify",
146
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
147
+ });
148
+ }
149
+ /** [Authorized Function] Adds an authorized user. */
150
+ function addAuthorizedUser(options) {
151
+ const packageAddress = options.package ?? "@typus/stake-pool";
152
+ const argumentsTypes = [`${packageAddress}::admin::Version`, "address"];
153
+ const parameterNames = ["version", "userAddress"];
154
+ return (tx) => tx.moveCall({
155
+ package: packageAddress,
156
+ module: "admin",
157
+ function: "add_authorized_user",
158
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
159
+ });
160
+ }
161
+ /** [Authorized Function] Removes an authorized user. */
162
+ function removeAuthorizedUser(options) {
163
+ const packageAddress = options.package ?? "@typus/stake-pool";
164
+ const argumentsTypes = [`${packageAddress}::admin::Version`, "address"];
165
+ const parameterNames = ["version", "userAddress"];
166
+ return (tx) => tx.moveCall({
167
+ package: packageAddress,
168
+ module: "admin",
169
+ function: "remove_authorized_user",
170
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
171
+ });
172
+ }
173
+ /**
174
+ * [Authorized Function] Installs the ecosystem manager cap. TODO: can be remove
175
+ * after install
176
+ */
177
+ function installEcosystemManagerCapEntry(options) {
178
+ const packageAddress = options.package ?? "@typus/stake-pool";
179
+ const argumentsTypes = [
180
+ `${packageAddress}::admin::Version`,
181
+ "0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277::ecosystem::Version",
182
+ ];
183
+ const parameterNames = ["version", "typusEcosystemVersion"];
184
+ return (tx) => tx.moveCall({
185
+ package: packageAddress,
186
+ module: "admin",
187
+ function: "install_ecosystem_manager_cap_entry",
188
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
189
+ });
190
+ }
191
+ /** Adds tails experience points to a user. */
192
+ function addTailsExpAmount(options) {
193
+ const packageAddress = options.package ?? "@typus/stake-pool";
194
+ const argumentsTypes = [
195
+ `${packageAddress}::admin::Version`,
196
+ "0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277::ecosystem::Version",
197
+ "0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277::user::TypusUserRegistry",
198
+ "address",
199
+ "u64",
200
+ ];
201
+ const parameterNames = ["version", "typusEcosystemVersion", "typusUserRegistry", "user", "amount"];
202
+ return (tx) => tx.moveCall({
203
+ package: packageAddress,
204
+ module: "admin",
205
+ function: "add_tails_exp_amount",
206
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
207
+ });
208
+ }
209
+ /**
210
+ * Sends the collected fees to the fee address. Safe with constant address as
211
+ * receiver
212
+ */
213
+ function sendFee(options) {
214
+ const packageAddress = options.package ?? "@typus/stake-pool";
215
+ const argumentsTypes = [`${packageAddress}::admin::Version`];
216
+ const parameterNames = ["version"];
217
+ return (tx) => tx.moveCall({
218
+ package: packageAddress,
219
+ module: "admin",
220
+ function: "send_fee",
221
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
222
+ typeArguments: options.typeArguments,
223
+ });
224
+ }
225
+ /** Charges a protocol fee. WARNING: no authority check inside */
226
+ function chargeFee(options) {
227
+ const packageAddress = options.package ?? "@typus/stake-pool";
228
+ const argumentsTypes = [
229
+ `${packageAddress}::admin::Version`,
230
+ `0x0000000000000000000000000000000000000000000000000000000000000002::balance::Balance<${options.typeArguments[0]}>`,
231
+ ];
232
+ const parameterNames = ["version", "balance"];
233
+ return (tx) => tx.moveCall({
234
+ package: packageAddress,
235
+ module: "admin",
236
+ function: "charge_fee",
237
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
238
+ typeArguments: options.typeArguments,
239
+ });
240
+ }
241
+ /**
242
+ * Sends the liquidator fees to the fee address. Safe with constant address as
243
+ * receiver
244
+ */
245
+ function sendLiquidatorFee(options) {
246
+ const packageAddress = options.package ?? "@typus/stake-pool";
247
+ const argumentsTypes = [`${packageAddress}::admin::Version`];
248
+ const parameterNames = ["version"];
249
+ return (tx) => tx.moveCall({
250
+ package: packageAddress,
251
+ module: "admin",
252
+ function: "send_liquidator_fee",
253
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
254
+ typeArguments: options.typeArguments,
255
+ });
256
+ }
257
+ /** Charges a liquidator fee. WARNING: no authority check inside */
258
+ function chargeLiquidatorFee(options) {
259
+ const packageAddress = options.package ?? "@typus/stake-pool";
260
+ const argumentsTypes = [
261
+ `${packageAddress}::admin::Version`,
262
+ `0x0000000000000000000000000000000000000000000000000000000000000002::balance::Balance<${options.typeArguments[0]}>`,
263
+ ];
264
+ const parameterNames = ["version", "balance"];
265
+ return (tx) => tx.moveCall({
266
+ package: packageAddress,
267
+ module: "admin",
268
+ function: "charge_liquidator_fee",
269
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
270
+ typeArguments: options.typeArguments,
271
+ });
272
+ }
@@ -23,10 +23,11 @@ export declare const StakePoolInfo: MoveStruct<{
23
23
  total_share: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
24
24
  /** Whether the pool is active. */
25
25
  active: import("@mysten/sui/bcs").BcsType<boolean, boolean, "bool">;
26
- /**
27
- * Padding for future use. [new_tlp_price (decimal 4), usd_per_exp,
28
- * depositors_count]
29
- */
26
+ /** tlp price (decimal 4) */
27
+ new_tlp_price: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
28
+ /** number of depositor */
29
+ depositors_count: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
30
+ /** Padding for future use. */
30
31
  u64_padding: import("@mysten/sui/bcs").BcsType<string[], Iterable<string | number | bigint> & {
31
32
  length: number;
32
33
  }, string>;
@@ -34,6 +35,8 @@ export declare const StakePoolInfo: MoveStruct<{
34
35
  export declare const StakePoolConfig: MoveStruct<{
35
36
  /** The unlock countdown in milliseconds. */
36
37
  unlock_countdown_ts_ms: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
38
+ /** for exp calculation */
39
+ usd_per_exp: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
37
40
  /** Padding for future use. */
38
41
  u64_padding: import("@mysten/sui/bcs").BcsType<string[], Iterable<string | number | bigint> & {
39
42
  length: number;
@@ -113,10 +116,11 @@ export declare const StakePool: MoveStruct<{
113
116
  total_share: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
114
117
  /** Whether the pool is active. */
115
118
  active: import("@mysten/sui/bcs").BcsType<boolean, boolean, "bool">;
116
- /**
117
- * Padding for future use. [new_tlp_price (decimal 4), usd_per_exp,
118
- * depositors_count]
119
- */
119
+ /** tlp price (decimal 4) */
120
+ new_tlp_price: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
121
+ /** number of depositor */
122
+ depositors_count: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
123
+ /** Padding for future use. */
120
124
  u64_padding: import("@mysten/sui/bcs").BcsType<string[], Iterable<string | number | bigint> & {
121
125
  length: number;
122
126
  }, string>;
@@ -125,6 +129,8 @@ export declare const StakePool: MoveStruct<{
125
129
  config: MoveStruct<{
126
130
  /** The unlock countdown in milliseconds. */
127
131
  unlock_countdown_ts_ms: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
132
+ /** for exp calculation */
133
+ usd_per_exp: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
128
134
  /** Padding for future use. */
129
135
  u64_padding: import("@mysten/sui/bcs").BcsType<string[], Iterable<string | number | bigint> & {
130
136
  length: number;
@@ -264,10 +270,13 @@ export declare const LpUserShare: MoveStruct<{
264
270
  length: number;
265
271
  }, string>;
266
272
  }, "0x2::vec_map::VecMap<std::type_name::TypeName, u64>">;
267
- /**
268
- * Padding for future use. [snapshot_ts_ms, old_tlp_price (decimal 4),
269
- * is_auto_compound(deprecated), harvested_amount]
270
- */
273
+ /** The last snapshot ts for exp. */
274
+ snapshot_ts_ms: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
275
+ /** old tlp price for exp with decimal 4 */
276
+ tlp_price: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
277
+ /** accumulated harvested amount */
278
+ harvested_amount: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
279
+ /** Padding for future use. */
271
280
  u64_padding: import("@mysten/sui/bcs").BcsType<string[], Iterable<string | number | bigint> & {
272
281
  length: number;
273
282
  }, string>;
@@ -287,10 +296,11 @@ export declare const NewStakePoolEvent: MoveStruct<{
287
296
  total_share: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
288
297
  /** Whether the pool is active. */
289
298
  active: import("@mysten/sui/bcs").BcsType<boolean, boolean, "bool">;
290
- /**
291
- * Padding for future use. [new_tlp_price (decimal 4), usd_per_exp,
292
- * depositors_count]
293
- */
299
+ /** tlp price (decimal 4) */
300
+ new_tlp_price: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
301
+ /** number of depositor */
302
+ depositors_count: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
303
+ /** Padding for future use. */
294
304
  u64_padding: import("@mysten/sui/bcs").BcsType<string[], Iterable<string | number | bigint> & {
295
305
  length: number;
296
306
  }, string>;
@@ -298,6 +308,8 @@ export declare const NewStakePoolEvent: MoveStruct<{
298
308
  stake_pool_config: MoveStruct<{
299
309
  /** The unlock countdown in milliseconds. */
300
310
  unlock_countdown_ts_ms: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
311
+ /** for exp calculation */
312
+ usd_per_exp: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
301
313
  /** Padding for future use. */
302
314
  u64_padding: import("@mysten/sui/bcs").BcsType<string[], Iterable<string | number | bigint> & {
303
315
  length: number;
@@ -732,7 +744,6 @@ export interface StakeArguments {
732
744
  registry: RawTransactionArgument<string>;
733
745
  index: RawTransactionArgument<number | bigint>;
734
746
  lpToken: RawTransactionArgument<string>;
735
- UserShareId: RawTransactionArgument<number | bigint | null>;
736
747
  }
737
748
  export interface StakeOptions {
738
749
  package?: string;
@@ -740,8 +751,7 @@ export interface StakeOptions {
740
751
  version: RawTransactionArgument<string>,
741
752
  registry: RawTransactionArgument<string>,
742
753
  index: RawTransactionArgument<number | bigint>,
743
- lpToken: RawTransactionArgument<string>,
744
- UserShareId: RawTransactionArgument<number | bigint | null>
754
+ lpToken: RawTransactionArgument<string>
745
755
  ];
746
756
  typeArguments: [string];
747
757
  }
@@ -766,30 +776,12 @@ export interface UpdatePoolInfoU64PaddingOptions {
766
776
  }
767
777
  /** [Authorized Function] Update TLP price for calculating staking exp */
768
778
  export declare function updatePoolInfoU64Padding(options: UpdatePoolInfoU64PaddingOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
769
- export interface HotfixPoolInfoU64PaddingArguments {
770
- version: RawTransactionArgument<string>;
771
- registry: RawTransactionArgument<string>;
772
- index: RawTransactionArgument<number | bigint>;
773
- u64Padding: RawTransactionArgument<number | bigint[]>;
774
- }
775
- export interface HotfixPoolInfoU64PaddingOptions {
776
- package?: string;
777
- arguments: HotfixPoolInfoU64PaddingArguments | [
778
- version: RawTransactionArgument<string>,
779
- registry: RawTransactionArgument<string>,
780
- index: RawTransactionArgument<number | bigint>,
781
- u64Padding: RawTransactionArgument<number | bigint[]>
782
- ];
783
- }
784
- /** [Authorized Function] Update TLP price for calculating staking exp */
785
- export declare function hotfixPoolInfoU64Padding(options: HotfixPoolInfoU64PaddingOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
786
779
  export interface SnapshotArguments {
787
780
  version: RawTransactionArgument<string>;
788
781
  registry: RawTransactionArgument<string>;
789
782
  typusEcosystemVersion: RawTransactionArgument<string>;
790
783
  typusUserRegistry: RawTransactionArgument<string>;
791
784
  index: RawTransactionArgument<number | bigint>;
792
- UserShareId: RawTransactionArgument<number | bigint>;
793
785
  }
794
786
  export interface SnapshotOptions {
795
787
  package?: string;
@@ -798,8 +790,7 @@ export interface SnapshotOptions {
798
790
  registry: RawTransactionArgument<string>,
799
791
  typusEcosystemVersion: RawTransactionArgument<string>,
800
792
  typusUserRegistry: RawTransactionArgument<string>,
801
- index: RawTransactionArgument<number | bigint>,
802
- UserShareId: RawTransactionArgument<number | bigint>
793
+ index: RawTransactionArgument<number | bigint>
803
794
  ];
804
795
  }
805
796
  /** [User Function] Get the staking exp */
@@ -808,7 +799,6 @@ export interface UnsubscribeArguments {
808
799
  version: RawTransactionArgument<string>;
809
800
  registry: RawTransactionArgument<string>;
810
801
  index: RawTransactionArgument<number | bigint>;
811
- UserShareId: RawTransactionArgument<number | bigint>;
812
802
  unsubscribedShares: RawTransactionArgument<number | bigint | null>;
813
803
  }
814
804
  export interface UnsubscribeOptions {
@@ -817,7 +807,6 @@ export interface UnsubscribeOptions {
817
807
  version: RawTransactionArgument<string>,
818
808
  registry: RawTransactionArgument<string>,
819
809
  index: RawTransactionArgument<number | bigint>,
820
- UserShareId: RawTransactionArgument<number | bigint>,
821
810
  unsubscribedShares: RawTransactionArgument<number | bigint | null>
822
811
  ];
823
812
  typeArguments: [string];
@@ -828,15 +817,13 @@ export interface UnstakeArguments {
828
817
  version: RawTransactionArgument<string>;
829
818
  registry: RawTransactionArgument<string>;
830
819
  index: RawTransactionArgument<number | bigint>;
831
- UserShareId: RawTransactionArgument<number | bigint>;
832
820
  }
833
821
  export interface UnstakeOptions {
834
822
  package?: string;
835
823
  arguments: UnstakeArguments | [
836
824
  version: RawTransactionArgument<string>,
837
825
  registry: RawTransactionArgument<string>,
838
- index: RawTransactionArgument<number | bigint>,
839
- UserShareId: RawTransactionArgument<number | bigint>
826
+ index: RawTransactionArgument<number | bigint>
840
827
  ];
841
828
  typeArguments: [string];
842
829
  }
@@ -869,15 +856,13 @@ export interface HarvestPerUserShareArguments {
869
856
  version: RawTransactionArgument<string>;
870
857
  registry: RawTransactionArgument<string>;
871
858
  index: RawTransactionArgument<number | bigint>;
872
- UserShareId: RawTransactionArgument<number | bigint>;
873
859
  }
874
860
  export interface HarvestPerUserShareOptions {
875
861
  package?: string;
876
862
  arguments: HarvestPerUserShareArguments | [
877
863
  version: RawTransactionArgument<string>,
878
864
  registry: RawTransactionArgument<string>,
879
- index: RawTransactionArgument<number | bigint>,
880
- UserShareId: RawTransactionArgument<number | bigint>
865
+ index: RawTransactionArgument<number | bigint>
881
866
  ];
882
867
  typeArguments: [string];
883
868
  }
@@ -999,25 +984,3 @@ export interface GetLastIncentivePriceIndexOptions {
999
984
  arguments: GetLastIncentivePriceIndexArguments | [stakePool: RawTransactionArgument<string>];
1000
985
  }
1001
986
  export declare function getLastIncentivePriceIndex(options: GetLastIncentivePriceIndexOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
1002
- export interface WithdrawIncentiveArguments {
1003
- version: RawTransactionArgument<string>;
1004
- registry: RawTransactionArgument<string>;
1005
- index: RawTransactionArgument<number | bigint>;
1006
- amount: RawTransactionArgument<number | bigint | null>;
1007
- }
1008
- export interface WithdrawIncentiveOptions {
1009
- package?: string;
1010
- arguments: WithdrawIncentiveArguments | [
1011
- version: RawTransactionArgument<string>,
1012
- registry: RawTransactionArgument<string>,
1013
- index: RawTransactionArgument<number | bigint>,
1014
- amount: RawTransactionArgument<number | bigint | null>
1015
- ];
1016
- typeArguments: [string];
1017
- }
1018
- export declare function withdrawIncentive(options: WithdrawIncentiveOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
1019
- export interface DeprecatedOptions {
1020
- package?: string;
1021
- arguments?: [];
1022
- }
1023
- export declare function deprecated(options?: DeprecatedOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
@@ -48,7 +48,6 @@ exports.depositIncentive = depositIncentive;
48
48
  exports.withdrawIncentiveV2 = withdrawIncentiveV2;
49
49
  exports.stake = stake;
50
50
  exports.updatePoolInfoU64Padding = updatePoolInfoU64Padding;
51
- exports.hotfixPoolInfoU64Padding = hotfixPoolInfoU64Padding;
52
51
  exports.snapshot = snapshot;
53
52
  exports.unsubscribe = unsubscribe;
54
53
  exports.unstake = unstake;
@@ -67,8 +66,6 @@ exports.getIncentive = getIncentive;
67
66
  exports.getMutIncentive = getMutIncentive;
68
67
  exports.removeIncentive = removeIncentive;
69
68
  exports.getLastIncentivePriceIndex = getLastIncentivePriceIndex;
70
- exports.withdrawIncentive = withdrawIncentive;
71
- exports.deprecated = deprecated;
72
69
  /**************************************************************
73
70
  * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
74
71
  **************************************************************/
@@ -99,10 +96,11 @@ exports.StakePoolInfo = new index_1.MoveStruct({
99
96
  total_share: bcs_1.bcs.u64(),
100
97
  /** Whether the pool is active. */
101
98
  active: bcs_1.bcs.bool(),
102
- /**
103
- * Padding for future use. [new_tlp_price (decimal 4), usd_per_exp,
104
- * depositors_count]
105
- */
99
+ /** tlp price (decimal 4) */
100
+ new_tlp_price: bcs_1.bcs.u64(),
101
+ /** number of depositor */
102
+ depositors_count: bcs_1.bcs.u64(),
103
+ /** Padding for future use. */
106
104
  u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
107
105
  },
108
106
  });
@@ -111,6 +109,8 @@ exports.StakePoolConfig = new index_1.MoveStruct({
111
109
  fields: {
112
110
  /** The unlock countdown in milliseconds. */
113
111
  unlock_countdown_ts_ms: bcs_1.bcs.u64(),
112
+ /** for exp calculation */
113
+ usd_per_exp: bcs_1.bcs.u64(),
114
114
  /** Padding for future use. */
115
115
  u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
116
116
  },
@@ -198,10 +198,13 @@ exports.LpUserShare = new index_1.MoveStruct({
198
198
  deactivating_shares: bcs_1.bcs.vector(exports.DeactivatingShares),
199
199
  /** The last incentive price index. */
200
200
  last_incentive_price_index: vec_map.VecMap(type_name.TypeName, bcs_1.bcs.u64()),
201
- /**
202
- * Padding for future use. [snapshot_ts_ms, old_tlp_price (decimal 4),
203
- * is_auto_compound(deprecated), harvested_amount]
204
- */
201
+ /** The last snapshot ts for exp. */
202
+ snapshot_ts_ms: bcs_1.bcs.u64(),
203
+ /** old tlp price for exp with decimal 4 */
204
+ tlp_price: bcs_1.bcs.u64(),
205
+ /** accumulated harvested amount */
206
+ harvested_amount: bcs_1.bcs.u64(),
207
+ /** Padding for future use. */
205
208
  u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
206
209
  },
207
210
  });
@@ -592,10 +595,9 @@ function stake(options) {
592
595
  `${packageAddress}::stake_pool::StakePoolRegistry`,
593
596
  "u64",
594
597
  `0x0000000000000000000000000000000000000000000000000000000000000002::coin::Coin<${options.typeArguments[0]}>`,
595
- "0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<u64>",
596
598
  "0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
597
599
  ];
598
- const parameterNames = ["version", "registry", "index", "lpToken", "UserShareId"];
600
+ const parameterNames = ["version", "registry", "index", "lpToken"];
599
601
  return (tx) => tx.moveCall({
600
602
  package: packageAddress,
601
603
  module: "stake_pool",
@@ -622,36 +624,18 @@ function updatePoolInfoU64Padding(options) {
622
624
  arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
623
625
  });
624
626
  }
625
- /** [Authorized Function] Update TLP price for calculating staking exp */
626
- function hotfixPoolInfoU64Padding(options) {
627
- const packageAddress = options.package ?? "@typus/stake-pool";
628
- const argumentsTypes = [
629
- `${packageAddress}::admin::Version`,
630
- `${packageAddress}::stake_pool::StakePoolRegistry`,
631
- "u64",
632
- "vector<u64>",
633
- ];
634
- const parameterNames = ["version", "registry", "index", "u64Padding"];
635
- return (tx) => tx.moveCall({
636
- package: packageAddress,
637
- module: "stake_pool",
638
- function: "hotfix_pool_info_u64_padding",
639
- arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
640
- });
641
- }
642
627
  /** [User Function] Get the staking exp */
643
628
  function snapshot(options) {
644
629
  const packageAddress = options.package ?? "@typus/stake-pool";
645
630
  const argumentsTypes = [
646
631
  `${packageAddress}::admin::Version`,
647
632
  `${packageAddress}::stake_pool::StakePoolRegistry`,
648
- "0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a::ecosystem::Version",
649
- "0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a::user::TypusUserRegistry",
650
- "u64",
633
+ "0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277::ecosystem::Version",
634
+ "0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277::user::TypusUserRegistry",
651
635
  "u64",
652
636
  "0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
653
637
  ];
654
- const parameterNames = ["version", "registry", "typusEcosystemVersion", "typusUserRegistry", "index", "UserShareId"];
638
+ const parameterNames = ["version", "registry", "typusEcosystemVersion", "typusUserRegistry", "index"];
655
639
  return (tx) => tx.moveCall({
656
640
  package: packageAddress,
657
641
  module: "stake_pool",
@@ -666,11 +650,10 @@ function unsubscribe(options) {
666
650
  `${packageAddress}::admin::Version`,
667
651
  `${packageAddress}::stake_pool::StakePoolRegistry`,
668
652
  "u64",
669
- "u64",
670
653
  "0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<u64>",
671
654
  "0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
672
655
  ];
673
- const parameterNames = ["version", "registry", "index", "UserShareId", "unsubscribedShares"];
656
+ const parameterNames = ["version", "registry", "index", "unsubscribedShares"];
674
657
  return (tx) => tx.moveCall({
675
658
  package: packageAddress,
676
659
  module: "stake_pool",
@@ -686,10 +669,9 @@ function unstake(options) {
686
669
  `${packageAddress}::admin::Version`,
687
670
  `${packageAddress}::stake_pool::StakePoolRegistry`,
688
671
  "u64",
689
- "u64",
690
672
  "0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
691
673
  ];
692
- const parameterNames = ["version", "registry", "index", "UserShareId"];
674
+ const parameterNames = ["version", "registry", "index"];
693
675
  return (tx) => tx.moveCall({
694
676
  package: packageAddress,
695
677
  module: "stake_pool",
@@ -731,10 +713,9 @@ function harvestPerUserShare(options) {
731
713
  `${packageAddress}::admin::Version`,
732
714
  `${packageAddress}::stake_pool::StakePoolRegistry`,
733
715
  "u64",
734
- "u64",
735
716
  "0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
736
717
  ];
737
- const parameterNames = ["version", "registry", "index", "UserShareId"];
718
+ const parameterNames = ["version", "registry", "index"];
738
719
  return (tx) => tx.moveCall({
739
720
  package: packageAddress,
740
721
  module: "stake_pool",
@@ -891,28 +872,3 @@ function getLastIncentivePriceIndex(options) {
891
872
  arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
892
873
  });
893
874
  }
894
- function withdrawIncentive(options) {
895
- const packageAddress = options.package ?? "@typus/stake-pool";
896
- const argumentsTypes = [
897
- `${packageAddress}::admin::Version`,
898
- `${packageAddress}::stake_pool::StakePoolRegistry`,
899
- "u64",
900
- "0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<u64>",
901
- ];
902
- const parameterNames = ["version", "registry", "index", "amount"];
903
- return (tx) => tx.moveCall({
904
- package: packageAddress,
905
- module: "stake_pool",
906
- function: "withdraw_incentive",
907
- arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
908
- typeArguments: options.typeArguments,
909
- });
910
- }
911
- function deprecated(options = {}) {
912
- const packageAddress = options.package ?? "@typus/stake-pool";
913
- return (tx) => tx.moveCall({
914
- package: packageAddress,
915
- module: "stake_pool",
916
- function: "deprecated",
917
- });
918
- }
package/dist/src/index.js CHANGED
@@ -36,13 +36,13 @@ exports.PERP_PKG_V1 = exports.NETWORK == "MAINNET"
36
36
  : "0x29d1dcc803ec1cc1b4c98a8c818c655ecf432ebd2f85757bffc21806d329e240";
37
37
  exports.STAKE_PACKAGE_ID = exports.NETWORK == "MAINNET"
38
38
  ? "0xc427209145715a00a93d7e674a95c556a7147d79fda1bbaeb1a1cac5f9923966"
39
- : "0xcfe3d323fec2dde129480328dbcf075bc47bac50f916f33746d74f1c875acd2e";
39
+ : "0xa59d5f571a6f57ee5faf842ec633245afb78ca3721b8b1194052c69ad6a12230";
40
40
  exports.STAKE_PUBLISHED_AT = exports.NETWORK == "MAINNET"
41
41
  ? "0xdf96424bc1ba70a6e53c07b2b55c597eccb8a21f722a917a5b4c9d8514b2d858"
42
- : "0xcfe3d323fec2dde129480328dbcf075bc47bac50f916f33746d74f1c875acd2e";
42
+ : "0xa59d5f571a6f57ee5faf842ec633245afb78ca3721b8b1194052c69ad6a12230";
43
43
  exports.STAKE_PKG_V1 = exports.NETWORK == "MAINNET"
44
44
  ? "0xc427209145715a00a93d7e674a95c556a7147d79fda1bbaeb1a1cac5f9923966"
45
- : "0xcfe3d323fec2dde129480328dbcf075bc47bac50f916f33746d74f1c875acd2e";
45
+ : "0xa59d5f571a6f57ee5faf842ec633245afb78ca3721b8b1194052c69ad6a12230";
46
46
  // lp_pool::Registry
47
47
  exports.LP_POOL = exports.NETWORK == "MAINNET"
48
48
  ? "0xfee68e535bf24702be28fa38ea2d5946e617e0035027d5ca29dbed99efd82aaa"
@@ -64,10 +64,10 @@ exports.TLP_TREASURY_CAP = exports.NETWORK == "MAINNET"
64
64
  // StakePoolRegistry
65
65
  exports.STAKE_POOL = exports.NETWORK == "MAINNET"
66
66
  ? "0x2cdf93717f87a8a7aeb98b27777b3b643f0ae2b277f44e6bcda0fc655a47d3e0"
67
- : "0xc48d38a6cd76ac6628ba98f1bdad7ade8d4b5273066aa4408a81e5e00a92363e";
67
+ : "0xa43479d938b1d46e2dc3ae0558a54c2ab32312a1da8eeaa8d5b49238e739b2fa";
68
68
  exports.STAKE_POOL_VERSION = exports.NETWORK == "MAINNET"
69
69
  ? "0xdf3ed1599218b2415b2cd7fa06296f7f647676019b2873ec18e55a626c584f1b"
70
- : "0x138583562f9f8fc6261e8fd752a105eb42c8887f83efaba87b42a757f3d98765";
70
+ : "0x57221de2517aee3d628be7fcf07afb9f6021edb06b519e57bd84ec5d37fff6f5";
71
71
  exports.COMPETITION_CONFIG = exports.NETWORK == "MAINNET"
72
72
  ? "0x36056abf9adde86f81667dad680a8ac98868c9fc1cb4d519fd2222d5d4522906"
73
73
  : "0xbb246d6ee24d7c751777d81cbf95ffcfcda26910fecfdcfedab81b2b8e48dfe5";
@@ -3,6 +3,7 @@ import { TOKEN } from "@typus/typus-sdk/dist/src/constants";
3
3
  import { Transaction } from "@mysten/sui/transactions";
4
4
  import { TypusClient } from "../../src/client";
5
5
  export declare function createTradingOrder(client: TypusClient, tx: Transaction, input: {
6
+ perpIndex: string;
6
7
  coins: string[];
7
8
  cToken: TOKEN;
8
9
  amount: string;
@@ -17,21 +18,25 @@ export declare function createTradingOrder(client: TypusClient, tx: Transaction,
17
18
  }): Promise<Transaction>;
18
19
  export declare function zeroCoin(tx: Transaction, typeArgs: [string]): import("@mysten/sui/transactions").TransactionResult;
19
20
  export declare function cancelTradingOrder(client: TypusClient, tx: Transaction, input: {
21
+ perpIndex: string;
20
22
  order: typeof TradingOrder.$inferType;
21
23
  user: string;
22
24
  }): Promise<Transaction>;
23
25
  export declare function increaseCollateral(client: TypusClient, tx: Transaction, input: {
26
+ perpIndex: string;
24
27
  coins: string[];
25
28
  amount: string;
26
29
  position: typeof Position.$inferType;
27
30
  suiCoins?: string[];
28
31
  }): Promise<Transaction>;
29
32
  export declare function releaseCollateral(client: TypusClient, tx: Transaction, input: {
33
+ perpIndex: string;
30
34
  position: typeof Position.$inferType;
31
35
  amount: string;
32
36
  suiCoins?: string[];
33
37
  }): Promise<Transaction>;
34
38
  export declare function collectPositionFundingFee(client: TypusClient, tx: Transaction, input: {
39
+ perpIndex: string;
35
40
  position: typeof Position.$inferType;
36
41
  suiCoins?: string[];
37
42
  }): Promise<Transaction>;
@@ -40,8 +40,8 @@ async function createTradingOrder(client, tx, input) {
40
40
  version: __1.PERP_VERSION,
41
41
  registry: __1.MARKET,
42
42
  poolRegistry: __1.LP_POOL,
43
- marketIndex: BigInt(0),
44
- poolIndex: BigInt(0),
43
+ marketIndex: BigInt(input.perpIndex),
44
+ poolIndex: BigInt(input.perpIndex),
45
45
  typusOracleCToken: constants_1.oracle[__1.NETWORK][TOKEN],
46
46
  typusOracleTradingSymbol: constants_1.oracle[__1.NETWORK][BASE_TOKEN],
47
47
  typusEcosystemVersion: client.config.version.typus,
@@ -75,7 +75,7 @@ async function cancelTradingOrder(client, tx, input) {
75
75
  arguments: {
76
76
  version: __1.PERP_VERSION,
77
77
  registry: __1.MARKET,
78
- marketIndex: BigInt(0),
78
+ marketIndex: BigInt(input.perpIndex),
79
79
  orderId: BigInt(input.order.order_id),
80
80
  triggerPrice: BigInt(input.order.trigger_price),
81
81
  orderUser: null,
@@ -115,8 +115,8 @@ async function increaseCollateral(client, tx, input) {
115
115
  version: __1.PERP_VERSION,
116
116
  registry: __1.MARKET,
117
117
  poolRegistry: __1.LP_POOL,
118
- marketIndex: BigInt(0),
119
- poolIndex: BigInt(0),
118
+ marketIndex: BigInt(input.perpIndex),
119
+ poolIndex: BigInt(input.perpIndex),
120
120
  typusOracleCToken: constants_1.oracle[__1.NETWORK][TOKEN],
121
121
  typusOracleTradingSymbol: constants_1.oracle[__1.NETWORK][BASE_TOKEN],
122
122
  positionId: BigInt(input.position.position_id),
@@ -146,8 +146,8 @@ async function releaseCollateral(client, tx, input) {
146
146
  version: __1.PERP_VERSION,
147
147
  registry: __1.MARKET,
148
148
  poolRegistry: __1.LP_POOL,
149
- marketIndex: BigInt(0),
150
- poolIndex: BigInt(0),
149
+ marketIndex: BigInt(input.perpIndex),
150
+ poolIndex: BigInt(input.perpIndex),
151
151
  typusOracleCToken: constants_1.oracle[__1.NETWORK][TOKEN],
152
152
  typusOracleTradingSymbol: constants_1.oracle[__1.NETWORK][BASE_TOKEN],
153
153
  positionId: BigInt(input.position.position_id),
@@ -178,8 +178,8 @@ async function collectPositionFundingFee(client, tx, input) {
178
178
  version: __1.PERP_VERSION,
179
179
  registry: __1.MARKET,
180
180
  poolRegistry: __1.LP_POOL,
181
- marketIndex: BigInt(0),
182
- poolIndex: BigInt(0),
181
+ marketIndex: BigInt(input.perpIndex),
182
+ poolIndex: BigInt(input.perpIndex),
183
183
  typusOracleCToken: constants_1.oracle[__1.NETWORK][TOKEN],
184
184
  typusOracleTradingSymbol: constants_1.oracle[__1.NETWORK][BASE_TOKEN],
185
185
  positionId: BigInt(input.position.position_id),
@@ -4,8 +4,7 @@ import { StakePool } from "../../src/generated/typus_stake_pool/stake_pool";
4
4
  import { LiquidityPool } from "../../src/generated/typus_perp/lp_pool";
5
5
  import { TypusClient } from "../../src/client";
6
6
  export declare function snapshot(client: TypusClient, tx: Transaction, input: {
7
- userShareId: string;
8
- perpIndex?: number;
7
+ perpIndex: string;
9
8
  }): Promise<Transaction>;
10
9
  export declare function mintStakeLp(client: TypusClient, tx: Transaction, input: {
11
10
  lpPool: typeof LiquidityPool.$inferType;
@@ -18,7 +17,6 @@ export declare function mintStakeLp(client: TypusClient, tx: Transaction, input:
18
17
  user: string;
19
18
  stake: boolean;
20
19
  suiCoins?: string[];
21
- perpIndex?: number;
22
20
  }): Promise<Transaction>;
23
21
  export declare function stakeLp(client: TypusClient, tx: Transaction, input: {
24
22
  stakePool: typeof StakePool.$inferType;
@@ -26,7 +24,6 @@ export declare function stakeLp(client: TypusClient, tx: Transaction, input: {
26
24
  amount: string;
27
25
  userShareId: string | null;
28
26
  user: string;
29
- perpIndex?: number;
30
27
  }): Promise<Transaction>;
31
28
  export declare function unstake(client: TypusClient, tx: Transaction, input: {
32
29
  lpPool: typeof LiquidityPool.$inferType;
@@ -34,7 +31,6 @@ export declare function unstake(client: TypusClient, tx: Transaction, input: {
34
31
  userShareId: string;
35
32
  share: string | null;
36
33
  user: string;
37
- perpIndex?: number;
38
34
  }): Promise<Transaction>;
39
35
  export declare function unstakeRedeem(client: TypusClient, tx: Transaction, input: {
40
36
  lpPool: typeof LiquidityPool.$inferType;
@@ -43,7 +39,6 @@ export declare function unstakeRedeem(client: TypusClient, tx: Transaction, inpu
43
39
  share: string | null;
44
40
  user: string;
45
41
  suiCoins?: string[];
46
- perpIndex?: number;
47
42
  }): Promise<Transaction>;
48
43
  export declare function redeemTlp(client: TypusClient, tx: Transaction, input: {
49
44
  lpPool: typeof LiquidityPool.$inferType;
@@ -51,7 +46,6 @@ export declare function redeemTlp(client: TypusClient, tx: Transaction, input: {
51
46
  share: string | null;
52
47
  user: string;
53
48
  suiCoins?: string[];
54
- perpIndex?: number;
55
49
  }): Promise<Transaction>;
56
50
  export declare function claim(client: TypusClient, tx: Transaction, input: {
57
51
  lpPool: typeof LiquidityPool.$inferType;
@@ -59,7 +53,6 @@ export declare function claim(client: TypusClient, tx: Transaction, input: {
59
53
  cTOKEN: TOKEN;
60
54
  user: string;
61
55
  suiCoins?: string[];
62
- perpIndex?: number;
63
56
  }): Promise<Transaction>;
64
57
  export declare function swap(client: TypusClient, tx: Transaction, input: {
65
58
  coins: string[];
@@ -67,12 +60,11 @@ export declare function swap(client: TypusClient, tx: Transaction, input: {
67
60
  TO_TOKEN: TOKEN;
68
61
  amount: string;
69
62
  user: string;
63
+ perpIndex: number;
70
64
  suiCoins?: string[];
71
- perpIndex?: number;
72
65
  }): Promise<Transaction>;
73
66
  export declare function harvestStakeReward(client: TypusClient, tx: Transaction, input: {
74
67
  stakePool: typeof StakePool.$inferType;
75
68
  userShareId: string;
76
69
  user: string;
77
- perpIndex?: number;
78
70
  }): Promise<Transaction>;
@@ -20,8 +20,7 @@ async function snapshot(client, tx, input) {
20
20
  arguments: {
21
21
  version: __1.STAKE_POOL_VERSION,
22
22
  registry: __1.STAKE_POOL,
23
- index: BigInt(input.perpIndex ?? 0),
24
- UserShareId: BigInt(input.userShareId),
23
+ index: BigInt(input.perpIndex),
25
24
  typusEcosystemVersion: client.config.version.typus,
26
25
  typusUserRegistry: client.config.registry.typus.user,
27
26
  },
@@ -54,7 +53,7 @@ async function mintStakeLp(client, tx, input) {
54
53
  arguments: {
55
54
  version: __1.PERP_VERSION,
56
55
  registry: __1.LP_POOL,
57
- index: BigInt(input.perpIndex ?? 0),
56
+ index: BigInt(input.stakePool.pool_info.index),
58
57
  oracle: constants_1.oracle[__1.NETWORK][token],
59
58
  },
60
59
  typeArguments: [constants_1.tokenType[__1.NETWORK][token]],
@@ -70,7 +69,7 @@ async function mintStakeLp(client, tx, input) {
70
69
  version: __1.PERP_VERSION,
71
70
  registry: __1.LP_POOL,
72
71
  treasuryCaps: __1.TLP_TREASURY_CAP,
73
- index: BigInt(input.perpIndex ?? 0),
72
+ index: BigInt(input.stakePool.pool_info.index),
74
73
  oracle: constants_1.oracle[__1.NETWORK][input.cTOKEN],
75
74
  coin,
76
75
  },
@@ -81,9 +80,8 @@ async function mintStakeLp(client, tx, input) {
81
80
  arguments: {
82
81
  version: __1.STAKE_POOL_VERSION,
83
82
  registry: __1.STAKE_POOL,
84
- index: BigInt(input.perpIndex ?? 0),
83
+ index: BigInt(input.stakePool.pool_info.index),
85
84
  lpToken: lpCoin,
86
- UserShareId: null,
87
85
  },
88
86
  typeArguments: [lpToken],
89
87
  }));
@@ -108,9 +106,8 @@ async function stakeLp(client, tx, input) {
108
106
  arguments: {
109
107
  version: __1.STAKE_POOL_VERSION,
110
108
  registry: __1.STAKE_POOL,
111
- index: BigInt(input.perpIndex ?? 0),
109
+ index: BigInt(input.stakePool.pool_info.index),
112
110
  lpToken: lpCoin,
113
- UserShareId: null,
114
111
  },
115
112
  typeArguments: [(0, utils_1.normalizeStructTag)(input.stakePool.pool_info.stake_token.name)],
116
113
  }));
@@ -123,9 +120,8 @@ async function unstake(client, tx, input) {
123
120
  arguments: {
124
121
  version: __1.STAKE_POOL_VERSION,
125
122
  registry: __1.STAKE_POOL,
126
- index: BigInt(input.perpIndex ?? 0),
123
+ index: BigInt(input.stakePool.pool_info.index),
127
124
  unsubscribedShares: input.share ? BigInt(input.share) : null,
128
- UserShareId: BigInt(input.userShareId),
129
125
  },
130
126
  typeArguments: [lpToken],
131
127
  }));
@@ -133,8 +129,7 @@ async function unstake(client, tx, input) {
133
129
  arguments: {
134
130
  version: __1.STAKE_POOL_VERSION,
135
131
  registry: __1.STAKE_POOL,
136
- index: BigInt(input.perpIndex ?? 0),
137
- UserShareId: BigInt(input.userShareId),
132
+ index: BigInt(input.stakePool.pool_info.index),
138
133
  },
139
134
  typeArguments: [lpToken],
140
135
  }));
@@ -152,7 +147,12 @@ async function unstakeRedeem(client, tx, input) {
152
147
  for (let token of tokens) {
153
148
  (0, utils_2.updateOracleWithPythUsd)(client.pythClient, tx, client.config.package.oracle, token);
154
149
  (0, lp_pool_1.updateLiquidityValue)({
155
- arguments: { version: __1.PERP_VERSION, registry: __1.LP_POOL, index: BigInt(input.perpIndex ?? 0), oracle: constants_1.oracle[__1.NETWORK][token] },
150
+ arguments: {
151
+ version: __1.PERP_VERSION,
152
+ registry: __1.LP_POOL,
153
+ index: BigInt(input.stakePool.pool_info.index),
154
+ oracle: constants_1.oracle[__1.NETWORK][token],
155
+ },
156
156
  typeArguments: [constants_1.tokenType[__1.NETWORK][token]],
157
157
  })(tx);
158
158
  }
@@ -162,9 +162,8 @@ async function unstakeRedeem(client, tx, input) {
162
162
  arguments: {
163
163
  version: __1.STAKE_POOL_VERSION,
164
164
  registry: __1.STAKE_POOL,
165
- index: BigInt(input.perpIndex ?? 0),
165
+ index: BigInt(input.stakePool.pool_info.index),
166
166
  unsubscribedShares: input.share ? BigInt(input.share) : null,
167
- UserShareId: BigInt(input.userShareId),
168
167
  },
169
168
  typeArguments: [lpToken],
170
169
  }));
@@ -172,8 +171,7 @@ async function unstakeRedeem(client, tx, input) {
172
171
  arguments: {
173
172
  version: __1.STAKE_POOL_VERSION,
174
173
  registry: __1.STAKE_POOL,
175
- index: BigInt(input.perpIndex ?? 0),
176
- UserShareId: BigInt(input.userShareId),
174
+ index: BigInt(input.stakePool.pool_info.index),
177
175
  },
178
176
  typeArguments: [lpToken],
179
177
  }));
@@ -186,7 +184,7 @@ async function unstakeRedeem(client, tx, input) {
186
184
  arguments: {
187
185
  version: __1.PERP_VERSION,
188
186
  registry: __1.LP_POOL,
189
- index: BigInt(input.perpIndex ?? 0),
187
+ index: BigInt(input.stakePool.pool_info.index),
190
188
  balance,
191
189
  },
192
190
  typeArguments: [input.lpPool.lp_token_type.name],
@@ -207,7 +205,7 @@ async function redeemTlp(client, tx, input) {
207
205
  arguments: {
208
206
  version: __1.PERP_VERSION,
209
207
  registry: __1.LP_POOL,
210
- index: BigInt(input.perpIndex ?? 0),
208
+ index: BigInt(input.lpPool.index),
211
209
  oracle: constants_1.oracle[__1.NETWORK][token],
212
210
  },
213
211
  typeArguments: [constants_1.tokenType[__1.NETWORK][token]],
@@ -235,7 +233,7 @@ async function redeemTlp(client, tx, input) {
235
233
  arguments: {
236
234
  version: __1.PERP_VERSION,
237
235
  registry: __1.LP_POOL,
238
- index: BigInt(input.perpIndex ?? 0),
236
+ index: BigInt(input.lpPool.index),
239
237
  balance,
240
238
  },
241
239
  typeArguments: [lpToken],
@@ -253,7 +251,12 @@ async function claim(client, tx, input) {
253
251
  for (let token of tokens) {
254
252
  (0, utils_2.updateOracleWithPythUsd)(client.pythClient, tx, client.config.package.oracle, token);
255
253
  (0, lp_pool_1.updateLiquidityValue)({
256
- arguments: { version: __1.PERP_VERSION, registry: __1.LP_POOL, index: BigInt(input.perpIndex ?? 0), oracle: constants_1.oracle[__1.NETWORK][token] },
254
+ arguments: {
255
+ version: __1.PERP_VERSION,
256
+ registry: __1.LP_POOL,
257
+ index: BigInt(input.stakePool.pool_info.index),
258
+ oracle: constants_1.oracle[__1.NETWORK][token],
259
+ },
257
260
  typeArguments: [constants_1.tokenType[__1.NETWORK][token]],
258
261
  })(tx);
259
262
  }
@@ -262,7 +265,7 @@ async function claim(client, tx, input) {
262
265
  arguments: {
263
266
  version: __1.PERP_VERSION,
264
267
  registry: __1.LP_POOL,
265
- index: BigInt(input.perpIndex ?? 0),
268
+ index: BigInt(input.stakePool.pool_info.index),
266
269
  treasuryCaps: __1.TLP_TREASURY_CAP,
267
270
  oracle: constants_1.oracle[__1.NETWORK][input.cTOKEN],
268
271
  },
@@ -295,7 +298,7 @@ async function swap(client, tx, input) {
295
298
  arguments: {
296
299
  version: __1.PERP_VERSION,
297
300
  registry: __1.LP_POOL,
298
- index: BigInt(input.perpIndex ?? 0),
301
+ index: BigInt(input.perpIndex),
299
302
  oracleFromToken: constants_1.oracle[__1.NETWORK][input.FROM_TOKEN],
300
303
  oracleToToken: constants_1.oracle[__1.NETWORK][input.TO_TOKEN],
301
304
  fromCoin: coin,
@@ -308,15 +311,14 @@ async function swap(client, tx, input) {
308
311
  }
309
312
  async function harvestStakeReward(client, tx, input) {
310
313
  let iTokens = input.stakePool.incentives.map((i) => i.token_type.name);
311
- snapshot(client, tx, { userShareId: input.userShareId });
314
+ snapshot(client, tx, { perpIndex: input.stakePool.pool_info.index });
312
315
  for (let iToken of iTokens) {
313
316
  // console.log(iToken);
314
317
  let iCoin = tx.add((0, stake_pool_1.harvestPerUserShare)({
315
318
  arguments: {
316
319
  version: __1.STAKE_POOL_VERSION,
317
320
  registry: __1.STAKE_POOL,
318
- index: BigInt(input.perpIndex ?? 0),
319
- UserShareId: BigInt(input.userShareId),
321
+ index: BigInt(input.stakePool.pool_info.index),
320
322
  },
321
323
  typeArguments: [iToken],
322
324
  }));
@@ -326,9 +328,8 @@ async function harvestStakeReward(client, tx, input) {
326
328
  arguments: {
327
329
  version: __1.STAKE_POOL_VERSION,
328
330
  registry: __1.STAKE_POOL,
329
- index: BigInt(input.perpIndex ?? 0),
331
+ index: BigInt(input.stakePool.pool_info.index),
330
332
  lpToken: iCoin,
331
- UserShareId: BigInt(input.userShareId),
332
333
  },
333
334
  typeArguments: [(0, utils_1.normalizeStructTag)(input.stakePool.pool_info.stake_token.name)],
334
335
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typus/typus-perp-sdk",
3
- "version": "1.1.32-codegen-exp2",
3
+ "version": "1.1.32-codegen-exp3",
4
4
  "repository": "https://github.com/Typus-Lab/typus-perp-sdk.git",
5
5
  "author": "Typus",
6
6
  "description": "typus perp sdk",
@@ -8,7 +8,7 @@
8
8
  "dependencies": {
9
9
  "@mysten/bcs": "1.9.2",
10
10
  "@mysten/sui": "1.44.0",
11
- "@typus/typus-sdk": "1.8.21"
11
+ "@typus/typus-sdk": "1.8.25"
12
12
  },
13
13
  "resolutions": {
14
14
  "@mysten/bcs": "1.9.2",