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

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.
@@ -10,7 +10,7 @@ export declare class TypusClient {
10
10
  graphQLClient: SuiGraphQLClient;
11
11
  pythClient: PythClient;
12
12
  config: TypusConfig;
13
- constructor(config: TypusConfig, mvr?: Experimental_SuiClientTypes.MvrOptions);
13
+ constructor(config: TypusConfig);
14
14
  getCoins(params: GetCoinsParams): Promise<import("@mysten/sui/client").PaginatedCoins>;
15
15
  getObject(params: GetObjectParams): Promise<import("@mysten/sui/client").SuiObjectResponse>;
16
16
  getOwnedObjects(params: GetOwnedObjectsParams): Promise<import("@mysten/sui/client").PaginatedObjectsResponse>;
@@ -24,4 +24,5 @@ export declare class TypusClient {
24
24
  batchGetObjectsBcs(objectIds: string[]): Promise<(Uint8Array<ArrayBufferLike> | undefined)[]>;
25
25
  getDynamicFieldsBcs(parent: string): Promise<Uint8Array<ArrayBufferLike>[]>;
26
26
  getDynamicObjectFieldsBcs(parent: string): Promise<Uint8Array<ArrayBufferLike>[]>;
27
+ simulateTransaction(transactionBcs: Uint8Array<ArrayBufferLike>): Promise<Experimental_SuiClientTypes.DryRunTransactionResponse>;
27
28
  }
@@ -8,31 +8,35 @@ const utils_1 = require("@typus/typus-sdk/dist/src/utils");
8
8
  const src_1 = require("../src");
9
9
  class TypusClient {
10
10
  // user: string;
11
- constructor(config, mvr) {
11
+ // mvr?: Experimental_SuiClientTypes.MvrOptions
12
+ constructor(config) {
12
13
  this.config = config;
13
14
  const network = config.network.toLowerCase();
15
+ const mvr = {
16
+ overrides: {
17
+ packages: {
18
+ "@typus/perp": src_1.PERP_PUBLISHED_AT,
19
+ "@typus/stake-pool": src_1.STAKE_PUBLISHED_AT,
20
+ },
21
+ // types: {
22
+ // "@typus/perp": PERP_PACKAGE_ID,
23
+ // "@typus/stake-pool": STAKE_PACKAGE_ID,
24
+ // },
25
+ },
26
+ };
14
27
  this.jsonRpcClient = new client_1.SuiClient({
15
28
  network: network,
16
29
  url: config.rpcEndpoint,
17
- mvr: {
18
- overrides: {
19
- packages: {
20
- "@typus/perp": src_1.PERP_PUBLISHED_AT,
21
- "@typus/stake-pool": src_1.STAKE_PUBLISHED_AT,
22
- },
23
- // types: {
24
- // "@typus/perp": PERP_PACKAGE_ID,
25
- // "@typus/stake-pool": STAKE_PACKAGE_ID,
26
- // },
27
- },
28
- },
30
+ mvr,
29
31
  });
30
32
  this.gRpcClient = new grpc_1.SuiGrpcClient({
31
33
  network: network,
32
34
  baseUrl: `https://fullnode.${network}.sui.io:443`,
33
35
  });
34
36
  this.graphQLClient = new graphql_1.SuiGraphQLClient({
37
+ network: network,
35
38
  url: `https://graphql.${network}.sui.io/graphql`,
39
+ mvr,
36
40
  });
37
41
  this.pythClient = (0, utils_1.createPythClient)(this.jsonRpcClient, this.config.network);
38
42
  }
@@ -52,9 +56,25 @@ class TypusClient {
52
56
  return this.jsonRpcClient.multiGetObjects(params);
53
57
  }
54
58
  devInspectTransactionBlock(params) {
59
+ // this.gRpcClient.transactionExecutionService.simulateTransaction({ transaction: { bcs: { value: params.transactionBlock } } });
55
60
  return this.jsonRpcClient.devInspectTransactionBlock(params);
56
61
  }
57
62
  executeTransactionBlock(params) {
63
+ // this.gRpcClient.transactionExecutionService.executeTransaction({
64
+ // transaction: { bcs: { value: params.transactionBlock } },
65
+ // signatures,
66
+ // });
67
+ // this.gRpcClient.transactionExecutionService.executeTransaction({
68
+ // transaction: {
69
+ // bcs: {
70
+ // value: transactionBytes,
71
+ // },
72
+ // },
73
+ // signatures: signatures.map((sig) => ({
74
+ // bcs: { value: fromBase64(sig) },
75
+ // signature: { oneofKind: undefined },
76
+ // })),
77
+ // });
58
78
  return this.jsonRpcClient.executeTransactionBlock(params);
59
79
  }
60
80
  signAndExecuteTransaction(params) {
@@ -104,5 +124,12 @@ class TypusClient {
104
124
  return x_1.childObject?.contents?.value;
105
125
  });
106
126
  }
127
+ simulateTransaction(transactionBcs) {
128
+ return this.gRpcClient.core.dryRunTransaction({ transaction: transactionBcs });
129
+ // return this.gRpcClient.transactionExecutionService.simulateTransaction({
130
+ // transaction: { bcs: { value: transactionBcs } },
131
+ // // checks: 1,
132
+ // });
133
+ }
107
134
  }
108
135
  exports.TypusClient = TypusClient;
@@ -1,5 +1,5 @@
1
1
  import { TOKEN } from "@typus/typus-sdk/dist/src/constants";
2
- import { Position } from "./generated/typus_perp/position";
2
+ import { TradingOrder, Position } from "./generated/typus_perp/position";
3
3
  import { TypusClient } from "../src/client";
4
4
  export declare function getLpPools(client: TypusClient): Promise<{
5
5
  id: {
@@ -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: {
@@ -335,10 +341,14 @@ export declare function getMarkets(client: TypusClient, input: {
335
341
  u64_padding: string[];
336
342
  };
337
343
  }[]][]>;
344
+ export type TradingOrder = (typeof TradingOrder.$inferType);
345
+ export type TradingOrderWithMarketIndex = TradingOrder & {
346
+ marketIndex: number;
347
+ };
338
348
  export declare function getUserOrders(client: TypusClient, input: {
339
349
  user: string;
340
350
  indexes: string[];
341
- }): Promise<void>;
351
+ }): Promise<TradingOrderWithMarketIndex[]>;
342
352
  export declare function getUserPositions(client: TypusClient, input: {
343
353
  user: string;
344
354
  indexes: string[];
@@ -402,7 +412,39 @@ export declare function parseOptionBidReceipts(positions: (typeof Position.$infe
402
412
  export declare function getUserStake(client: TypusClient, input: {
403
413
  user: string;
404
414
  indexes: string[];
405
- }): Promise<any[]>;
415
+ }): Promise<[{
416
+ user: string;
417
+ user_share_id: string;
418
+ stake_ts_ms: string;
419
+ total_shares: string;
420
+ active_shares: string;
421
+ deactivating_shares: {
422
+ shares: string;
423
+ unsubscribed_ts_ms: string;
424
+ unlocked_ts_ms: string;
425
+ unsubscribed_incentive_price_index: {
426
+ contents: {
427
+ key: {
428
+ name: string;
429
+ };
430
+ value: string;
431
+ }[];
432
+ };
433
+ u64_padding: string[];
434
+ }[];
435
+ last_incentive_price_index: {
436
+ contents: {
437
+ key: {
438
+ name: string;
439
+ };
440
+ value: string;
441
+ }[];
442
+ };
443
+ snapshot_ts_ms: string;
444
+ tlp_price: string;
445
+ harvested_amount: string;
446
+ u64_padding: string[];
447
+ } | null, string[]][]>;
406
448
  /**
407
449
  * @returns deactivatingShares[]
408
450
  */
package/dist/src/fetch.js CHANGED
@@ -90,6 +90,10 @@ async function getStakePool(client, objectId) {
90
90
  async function getMarkets(client, input) {
91
91
  let tx = new transactions_1.Transaction();
92
92
  tx.add((0, trading_1.getMarketsBcs)({ arguments: { registry: _1.MARKET, indexes: input.indexes.map((x) => BigInt(x)) } }));
93
+ // tx.setSender(SENDER);
94
+ // let bcs = await tx.build({ client: client.jsonRpcClient, onlyTransactionKind: true });
95
+ // // console.log("bcs", bcs);
96
+ // let res = await client.simulateTransaction(bcs);
93
97
  let devInspectTransactionBlockResult = await client.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: tx });
94
98
  // @ts-ignore
95
99
  let bytes = devInspectTransactionBlockResult.results[0].returnValues[0][0];
@@ -127,31 +131,20 @@ async function getUserOrders(client, input) {
127
131
  }
128
132
  let res = await client.devInspectTransactionBlock({ sender: input.user, transactionBlock: tx });
129
133
  // console.log(res);
130
- res.results?.map((x) => {
134
+ let orders = [];
135
+ for (var x = 0; x < input.indexes.length; x++) {
131
136
  // @ts-ignore
132
- let returnValues = x.returnValues[0][0];
137
+ let returnValues = res.results[x].returnValues[0][0];
133
138
  // console.log(returnValues);
134
139
  let reader = new bcs_1.BcsReader(new Uint8Array(returnValues));
135
- let yy = reader.readVec((reader) => {
140
+ reader.readVec((reader) => {
136
141
  let length = reader.readULEB();
137
142
  let bytes = reader.readBytes(length);
138
143
  let order = position_1.TradingOrder.parse(bytes);
139
- return order;
144
+ orders.push({ ...order, marketIndex: x });
140
145
  });
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;
146
+ }
147
+ return orders;
155
148
  }
156
149
  async function getUserPositions(client, input) {
157
150
  let tx = new transactions_1.Transaction();
@@ -204,13 +197,15 @@ function parseOptionBidReceipts(positions) {
204
197
  async function getUserStake(client, input) {
205
198
  let tx = new transactions_1.Transaction();
206
199
  for (let i of input.indexes) {
207
- tx.add((0, stake_pool_1.allocateIncentive)({
208
- arguments: {
209
- version: _1.STAKE_POOL_VERSION,
210
- registry: _1.STAKE_POOL,
211
- index: BigInt(i),
212
- },
213
- }));
200
+ // tx.add(
201
+ // allocateIncentive({
202
+ // arguments: {
203
+ // version: STAKE_POOL_VERSION,
204
+ // registry: STAKE_POOL,
205
+ // index: BigInt(i),
206
+ // },
207
+ // })
208
+ // );
214
209
  tx.add((0, stake_pool_1.getUserShares)({
215
210
  arguments: {
216
211
  registry: _1.STAKE_POOL,
@@ -225,13 +220,13 @@ async function getUserStake(client, input) {
225
220
  let results = [];
226
221
  for (var x = 0; x < input.indexes.length; x++) {
227
222
  // @ts-ignore
228
- var returnValues = res.results[1].returnValues[0][0];
223
+ var returnValues = res.results[x].returnValues[0][0];
229
224
  // console.log(returnValues);
230
225
  var reader = new bcs_1.BcsReader(new Uint8Array(returnValues));
231
226
  let length = reader.readULEB();
232
227
  console.log(length);
233
228
  if (length == 0) {
234
- results.push([]);
229
+ results.push([null, []]);
235
230
  continue;
236
231
  }
237
232
  // 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
+ }