@typus/typus-sdk 1.1.57 → 1.2.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.
@@ -16,8 +16,7 @@ var __read = (this && this.__read) || function (o, n) {
16
16
  return ar;
17
17
  };
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.getNewStrategyTx = exports.getRebateTx = exports.getTransferBidReceiptTx = exports.getExerciseTx = exports.getNewBidTx = exports.getRedeemTx = exports.getHarvestTx = exports.getClaimTx = exports.getCompoundTx = exports.getUnsubscribeTx = exports.getWithdrawTx = exports.getDepositTx = void 0;
20
- var transactions_1 = require("@mysten/sui.js/transactions");
19
+ exports.getRebateTx = exports.getTransferBidReceiptTx = exports.getExerciseTx = exports.getNewBidTx = exports.getWithdrawHarvestClaimTx = exports.getRedeemTx = exports.getHarvestTx = exports.getClaimTx = exports.getCompoundTx = exports.getUnsubscribeTx = exports.getWithdrawTx = exports.getDepositTx = void 0;
21
20
  var constants_1 = require("../../constants");
22
21
  /**
23
22
  public fun deposit<D_TOKEN, B_TOKEN>(
@@ -30,58 +29,57 @@ var constants_1 = require("../../constants");
30
29
  ctx: &mut TxContext,
31
30
  )
32
31
  */
33
- function getDepositTx(tx, typusFrameworkOriginPackageId, typusFrameworkPackageId, packageId, typeArguments, registry, index, coins, amount, receipts, user, usingSponsoredGasCoin) {
34
- if (usingSponsoredGasCoin === void 0) { usingSponsoredGasCoin = false; }
35
- if (!usingSponsoredGasCoin &&
36
- (typeArguments[0] == "0x2::sui::SUI" ||
37
- typeArguments[0] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI")) {
38
- var _a = __read(tx.splitCoins(tx.gas, [tx.pure(amount)]), 1), coin = _a[0];
39
- var result = tx.moveCall({
40
- target: "".concat(packageId, "::tails_staking::deposit"),
41
- typeArguments: typeArguments,
32
+ function getDepositTx(input) {
33
+ if (!input.usingSponsoredGasCoin &&
34
+ (input.typeArguments[0] == "0x2::sui::SUI" ||
35
+ input.typeArguments[0] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI")) {
36
+ var _a = __read(input.tx.splitCoins(input.tx.gas, [input.tx.pure(input.amount)]), 1), coin = _a[0];
37
+ var result = input.tx.moveCall({
38
+ target: "".concat(input.typusDovSinglePackageId, "::tails_staking::deposit"),
39
+ typeArguments: input.typeArguments,
42
40
  arguments: [
43
- tx.object(registry),
44
- tx.pure(index),
45
- tx.makeMoveVec({ objects: [coin] }),
46
- tx.pure(amount),
47
- tx.makeMoveVec({
48
- type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
49
- objects: receipts.map(function (id) { return tx.object(id); }),
41
+ input.tx.object(input.typusDovSingleRegistry),
42
+ input.tx.pure(input.index),
43
+ input.tx.makeMoveVec({ objects: [coin] }),
44
+ input.tx.pure(input.amount),
45
+ input.tx.makeMoveVec({
46
+ type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
47
+ objects: input.receipts.map(function (receipt) { return input.tx.object(receipt); }),
50
48
  }),
51
- tx.pure(constants_1.CLOCK),
49
+ input.tx.pure(constants_1.CLOCK),
52
50
  ],
53
51
  });
54
- tx.moveCall({
55
- target: "".concat(typusFrameworkPackageId, "::utils::transfer_coins"),
56
- typeArguments: [typeArguments[0]],
57
- arguments: [tx.object(result[0]), tx.pure(user)],
52
+ input.tx.moveCall({
53
+ target: "".concat(input.typusFrameworkPackageId, "::utils::transfer_coins"),
54
+ typeArguments: [input.typeArguments[0]],
55
+ arguments: [input.tx.object(result[0]), input.tx.pure(input.user)],
58
56
  });
59
- tx.transferObjects([tx.object(result[1])], user);
57
+ input.tx.transferObjects([input.tx.object(result[1])], input.user);
60
58
  }
61
59
  else {
62
- var result = tx.moveCall({
63
- target: "".concat(packageId, "::tails_staking::deposit"),
64
- typeArguments: typeArguments,
60
+ var result = input.tx.moveCall({
61
+ target: "".concat(input.typusDovSinglePackageId, "::tails_staking::deposit"),
62
+ typeArguments: input.typeArguments,
65
63
  arguments: [
66
- tx.object(registry),
67
- tx.pure(index),
68
- tx.makeMoveVec({ objects: coins.map(function (id) { return tx.object(id); }) }),
69
- tx.pure(amount),
70
- tx.makeMoveVec({
71
- type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
72
- objects: receipts.map(function (id) { return tx.object(id); }),
64
+ input.tx.object(input.typusDovSingleRegistry),
65
+ input.tx.pure(input.index),
66
+ input.tx.makeMoveVec({ objects: input.coins.map(function (coin) { return input.tx.object(coin); }) }),
67
+ input.tx.pure(input.amount),
68
+ input.tx.makeMoveVec({
69
+ type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
70
+ objects: input.receipts.map(function (receipt) { return input.tx.object(receipt); }),
73
71
  }),
74
- tx.pure(constants_1.CLOCK),
72
+ input.tx.pure(constants_1.CLOCK),
75
73
  ],
76
74
  });
77
- tx.moveCall({
78
- target: "".concat(typusFrameworkPackageId, "::utils::transfer_coins"),
79
- typeArguments: [typeArguments[0]],
80
- arguments: [tx.object(result[0]), tx.pure(user)],
75
+ input.tx.moveCall({
76
+ target: "".concat(input.typusFrameworkPackageId, "::utils::transfer_coins"),
77
+ typeArguments: [input.typeArguments[0]],
78
+ arguments: [input.tx.object(result[0]), input.tx.pure(input.user)],
81
79
  });
82
- tx.transferObjects([tx.object(result[1])], user);
80
+ input.tx.transferObjects([input.tx.object(result[1])], input.user);
83
81
  }
84
- return tx;
82
+ return input.tx;
85
83
  }
86
84
  exports.getDepositTx = getDepositTx;
87
85
  /**
@@ -94,31 +92,31 @@ exports.getDepositTx = getDepositTx;
94
92
  ctx: &mut TxContext,
95
93
  )
96
94
  */
97
- function getWithdrawTx(tx, typusFrameworkOriginPackageId, typusFrameworkPackageId, packageId, typeArguments, registry, index, receipts, user, share) {
98
- var result = tx.moveCall({
99
- target: "".concat(packageId, "::tails_staking::withdraw"),
100
- typeArguments: typeArguments,
95
+ function getWithdrawTx(input) {
96
+ var result = input.tx.moveCall({
97
+ target: "".concat(input.typusDovSinglePackageId, "::tails_staking::withdraw"),
98
+ typeArguments: input.typeArguments,
101
99
  arguments: [
102
- tx.object(registry),
103
- tx.pure(index),
104
- tx.makeMoveVec({
105
- type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
106
- objects: receipts.map(function (id) { return tx.object(id); }),
100
+ input.tx.object(input.typusDovSingleRegistry),
101
+ input.tx.pure(input.index),
102
+ input.tx.makeMoveVec({
103
+ type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
104
+ objects: input.receipts.map(function (receipt) { return input.tx.object(receipt); }),
107
105
  }),
108
- tx.pure(share ? [share] : []),
109
- tx.pure(constants_1.CLOCK),
106
+ input.tx.pure(input.share ? [input.share] : []),
107
+ input.tx.pure(constants_1.CLOCK),
110
108
  ],
111
109
  });
112
- tx.moveCall({
113
- target: "".concat(typusFrameworkPackageId, "::utils::transfer_balance"),
114
- typeArguments: [typeArguments[0]],
115
- arguments: [tx.object(result[0]), tx.pure(user)],
110
+ input.tx.moveCall({
111
+ target: "".concat(input.typusFrameworkPackageId, "::utils::transfer_balance"),
112
+ typeArguments: [input.typeArguments[0]],
113
+ arguments: [input.tx.object(result[0]), input.tx.pure(input.user)],
116
114
  });
117
- tx.moveCall({
118
- target: "".concat(typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
119
- arguments: [tx.object(result[1]), tx.pure(user)],
115
+ input.tx.moveCall({
116
+ target: "".concat(input.typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
117
+ arguments: [input.tx.object(result[1]), input.tx.pure(input.user)],
120
118
  });
121
- return tx;
119
+ return input.tx;
122
120
  }
123
121
  exports.getWithdrawTx = getWithdrawTx;
124
122
  /**
@@ -131,23 +129,23 @@ exports.getWithdrawTx = getWithdrawTx;
131
129
  ctx: &mut TxContext,
132
130
  )
133
131
  */
134
- function getUnsubscribeTx(tx, typusFrameworkOriginPackageId, packageId, typeArguments, registry, index, receipts, user, share) {
135
- var result = tx.moveCall({
136
- target: "".concat(packageId, "::tails_staking::unsubscribe"),
137
- typeArguments: typeArguments,
132
+ function getUnsubscribeTx(input) {
133
+ var result = input.tx.moveCall({
134
+ target: "".concat(input.typusDovSinglePackageId, "::tails_staking::unsubscribe"),
135
+ typeArguments: input.typeArguments,
138
136
  arguments: [
139
- tx.object(registry),
140
- tx.pure(index),
141
- tx.makeMoveVec({
142
- type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
143
- objects: receipts.map(function (id) { return tx.object(id); }),
137
+ input.tx.object(input.typusDovSingleRegistry),
138
+ input.tx.pure(input.index),
139
+ input.tx.makeMoveVec({
140
+ type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
141
+ objects: input.receipts.map(function (receipt) { return input.tx.object(receipt); }),
144
142
  }),
145
- tx.pure(share ? [share] : []),
146
- tx.pure(constants_1.CLOCK),
143
+ input.tx.pure(input.share ? [input.share] : []),
144
+ input.tx.pure(constants_1.CLOCK),
147
145
  ],
148
146
  });
149
- tx.transferObjects([tx.object(result[0])], user);
150
- return tx;
147
+ input.tx.transferObjects([input.tx.object(result[0])], input.user);
148
+ return input.tx;
151
149
  }
152
150
  exports.getUnsubscribeTx = getUnsubscribeTx;
153
151
  /**
@@ -159,22 +157,38 @@ exports.getUnsubscribeTx = getUnsubscribeTx;
159
157
  ctx: &mut TxContext,
160
158
  )
161
159
  */
162
- function getCompoundTx(tx, typusFrameworkOriginPackageId, packageId, typeArguments, registry, index, receipts, user) {
163
- var result = tx.moveCall({
164
- target: "".concat(packageId, "::tails_staking::compound"),
165
- typeArguments: typeArguments,
160
+ function getCompoundTx(input) {
161
+ var result = input.tx.moveCall({
162
+ target: "".concat(input.typusDovSinglePackageId, "::tails_staking::compound"),
163
+ typeArguments: input.typeArguments,
166
164
  arguments: [
167
- tx.object(registry),
168
- tx.pure(index),
169
- tx.makeMoveVec({
170
- type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
171
- objects: receipts.map(function (id) { return tx.object(id); }),
165
+ input.tx.object(input.typusDovSingleRegistry),
166
+ input.tx.pure(input.index),
167
+ input.tx.makeMoveVec({
168
+ type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
169
+ objects: input.receipts.map(function (receipt) { return input.tx.object(receipt); }),
172
170
  }),
173
- tx.object(constants_1.CLOCK),
171
+ input.tx.object(constants_1.CLOCK),
174
172
  ],
175
173
  });
176
- tx.transferObjects([tx.object(result[0])], user);
177
- return tx;
174
+ if (input.incentiveToken) {
175
+ input.typeArguments.push(input.incentiveToken);
176
+ input.tx = getRedeemTx({
177
+ tx: input.tx,
178
+ typusFrameworkOriginPackageId: input.typusFrameworkOriginPackageId,
179
+ typusFrameworkPackageId: input.typusFrameworkPackageId,
180
+ typusDovSinglePackageId: input.typusDovSinglePackageId,
181
+ typusDovSingleRegistry: input.typusDovSingleRegistry,
182
+ typeArguments: input.typeArguments,
183
+ index: input.index,
184
+ receipts: [input.tx.object(result[0])],
185
+ user: input.user,
186
+ });
187
+ }
188
+ else {
189
+ input.tx.transferObjects([input.tx.object(result[0])], input.user);
190
+ }
191
+ return input.tx;
178
192
  }
179
193
  exports.getCompoundTx = getCompoundTx;
180
194
  /**
@@ -185,29 +199,29 @@ exports.getCompoundTx = getCompoundTx;
185
199
  ctx: &mut TxContext,
186
200
  )
187
201
  */
188
- function getClaimTx(tx, typusFrameworkOriginPackageId, typusFrameworkPackageId, packageId, typeArguments, registry, index, receipts, user) {
189
- var result = tx.moveCall({
190
- target: "".concat(packageId, "::tds_user_entry::claim"),
191
- typeArguments: typeArguments,
202
+ function getClaimTx(input) {
203
+ var result = input.tx.moveCall({
204
+ target: "".concat(input.typusDovSinglePackageId, "::tds_user_entry::claim"),
205
+ typeArguments: input.typeArguments,
192
206
  arguments: [
193
- tx.object(registry),
194
- tx.pure(index),
195
- tx.makeMoveVec({
196
- type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
197
- objects: receipts.map(function (id) { return tx.object(id); }),
207
+ input.tx.object(input.typusDovSingleRegistry),
208
+ input.tx.pure(input.index),
209
+ input.tx.makeMoveVec({
210
+ type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
211
+ objects: input.receipts.map(function (receipt) { return input.tx.object(receipt); }),
198
212
  }),
199
213
  ],
200
214
  });
201
- tx.moveCall({
202
- target: "".concat(typusFrameworkPackageId, "::utils::transfer_balance"),
203
- typeArguments: [typeArguments[0]],
204
- arguments: [tx.object(result[0]), tx.pure(user)],
215
+ input.tx.moveCall({
216
+ target: "".concat(input.typusFrameworkPackageId, "::utils::transfer_balance"),
217
+ typeArguments: [input.typeArguments[0]],
218
+ arguments: [input.tx.object(result[0]), input.tx.pure(input.user)],
205
219
  });
206
- tx.moveCall({
207
- target: "".concat(typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
208
- arguments: [tx.object(result[1]), tx.pure(user)],
220
+ input.tx.moveCall({
221
+ target: "".concat(input.typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
222
+ arguments: [input.tx.object(result[1]), input.tx.pure(input.user)],
209
223
  });
210
- return tx;
224
+ return input.tx;
211
225
  }
212
226
  exports.getClaimTx = getClaimTx;
213
227
  /**
@@ -218,29 +232,49 @@ exports.getClaimTx = getClaimTx;
218
232
  ctx: &mut TxContext,
219
233
  )
220
234
  */
221
- function getHarvestTx(tx, typusFrameworkOriginPackageId, typusFrameworkPackageId, packageId, typeArguments, registry, index, receipts, user) {
222
- var result = tx.moveCall({
223
- target: "".concat(packageId, "::tds_user_entry::harvest"),
224
- typeArguments: typeArguments,
235
+ function getHarvestTx(input) {
236
+ var result = input.tx.moveCall({
237
+ target: "".concat(input.typusDovSinglePackageId, "::tds_user_entry::harvest"),
238
+ typeArguments: input.typeArguments,
225
239
  arguments: [
226
- tx.object(registry),
227
- tx.pure(index),
228
- tx.makeMoveVec({
229
- type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
230
- objects: receipts.map(function (id) { return tx.object(id); }),
240
+ input.tx.object(input.typusDovSingleRegistry),
241
+ input.tx.pure(input.index),
242
+ input.tx.makeMoveVec({
243
+ type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
244
+ objects: input.receipts.map(function (receipt) { return input.tx.object(receipt); }),
231
245
  }),
232
246
  ],
233
247
  });
234
- tx.moveCall({
235
- target: "".concat(typusFrameworkPackageId, "::utils::transfer_balance"),
236
- typeArguments: [typeArguments[1]],
237
- arguments: [tx.object(result[0]), tx.pure(user)],
238
- });
239
- tx.moveCall({
240
- target: "".concat(typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
241
- arguments: [tx.object(result[1]), tx.pure(user)],
248
+ input.tx.moveCall({
249
+ target: "".concat(input.typusFrameworkPackageId, "::utils::transfer_balance"),
250
+ typeArguments: [input.typeArguments[1]],
251
+ arguments: [input.tx.object(result[0]), input.tx.pure(input.user)],
242
252
  });
243
- return tx;
253
+ if (input.incentiveToken) {
254
+ input.typeArguments.push(input.incentiveToken);
255
+ var receipt = input.tx.moveCall({
256
+ target: "0x1::option::destroy_some",
257
+ arguments: [input.tx.object(result[1])],
258
+ });
259
+ input.tx = getRedeemTx({
260
+ tx: input.tx,
261
+ typusFrameworkOriginPackageId: input.typusFrameworkOriginPackageId,
262
+ typusFrameworkPackageId: input.typusFrameworkPackageId,
263
+ typusDovSinglePackageId: input.typusDovSinglePackageId,
264
+ typusDovSingleRegistry: input.typusDovSingleRegistry,
265
+ typeArguments: input.typeArguments,
266
+ index: input.index,
267
+ receipts: [input.tx.object(receipt)],
268
+ user: input.user,
269
+ });
270
+ }
271
+ else {
272
+ input.tx.moveCall({
273
+ target: "".concat(input.typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
274
+ arguments: [input.tx.object(result[1]), input.tx.pure(input.user)],
275
+ });
276
+ }
277
+ return input.tx;
244
278
  }
245
279
  exports.getHarvestTx = getHarvestTx;
246
280
  /**
@@ -251,31 +285,128 @@ exports.getHarvestTx = getHarvestTx;
251
285
  ctx: &mut TxContext,
252
286
  )
253
287
  */
254
- function getRedeemTx(tx, typusFrameworkOriginPackageId, typusFrameworkPackageId, packageId, typeArguments, registry, index, receipts, user) {
255
- var result = tx.moveCall({
256
- target: "".concat(packageId, "::tds_user_entry::redeem"),
257
- typeArguments: typeArguments,
288
+ function getRedeemTx(input) {
289
+ var result = input.tx.moveCall({
290
+ target: "".concat(input.typusDovSinglePackageId, "::tds_user_entry::redeem"),
291
+ typeArguments: input.typeArguments,
258
292
  arguments: [
259
- tx.object(registry),
260
- tx.pure(index),
261
- tx.makeMoveVec({
262
- type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
263
- objects: receipts.map(function (id) { return tx.object(id); }),
293
+ input.tx.object(input.typusDovSingleRegistry),
294
+ input.tx.pure(input.index),
295
+ input.tx.makeMoveVec({
296
+ type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
297
+ objects: input.receipts.map(function (receipt) { return input.tx.object(receipt); }),
264
298
  }),
265
299
  ],
266
300
  });
267
- tx.moveCall({
268
- target: "".concat(typusFrameworkPackageId, "::utils::transfer_balance"),
269
- typeArguments: [typeArguments[2]],
270
- arguments: [tx.object(result[0]), tx.pure(user)],
301
+ input.tx.moveCall({
302
+ target: "".concat(input.typusFrameworkPackageId, "::utils::transfer_balance"),
303
+ typeArguments: [input.typeArguments[2]],
304
+ arguments: [input.tx.object(result[0]), input.tx.pure(input.user)],
271
305
  });
272
- tx.moveCall({
273
- target: "".concat(typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
274
- arguments: [tx.object(result[1]), tx.pure(user)],
306
+ input.tx.moveCall({
307
+ target: "".concat(input.typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
308
+ arguments: [input.tx.object(result[1]), input.tx.pure(input.user)],
275
309
  });
276
- return tx;
310
+ return input.tx;
277
311
  }
278
312
  exports.getRedeemTx = getRedeemTx;
313
+ function getWithdrawHarvestClaimTx(input) {
314
+ var result = input.withdraw
315
+ ? input.tx.moveCall({
316
+ target: "".concat(input.typusDovSinglePackageId, "::tails_staking::withdraw"),
317
+ typeArguments: input.typeArguments,
318
+ arguments: [
319
+ input.tx.object(input.typusDovSingleRegistry),
320
+ input.tx.pure(input.index),
321
+ input.tx.makeMoveVec({
322
+ type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
323
+ objects: input.receipts.map(function (receipt) { return input.tx.object(receipt); }),
324
+ }),
325
+ input.tx.pure([]),
326
+ input.tx.pure(constants_1.CLOCK),
327
+ ],
328
+ })
329
+ : undefined;
330
+ if (input.withdraw) {
331
+ input.tx.moveCall({
332
+ target: "".concat(input.typusFrameworkPackageId, "::utils::transfer_balance"),
333
+ typeArguments: [input.typeArguments[0]],
334
+ arguments: [input.tx.object(result[0]), input.tx.pure(input.user)],
335
+ });
336
+ }
337
+ result = input.harvest
338
+ ? input.tx.moveCall({
339
+ target: "".concat(input.typusDovSinglePackageId, "::tds_user_entry::harvest"),
340
+ typeArguments: input.typeArguments,
341
+ arguments: [
342
+ input.tx.object(input.typusDovSingleRegistry),
343
+ input.tx.pure(input.index),
344
+ input.tx.makeMoveVec({
345
+ type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
346
+ objects: result ? [result[1]] : input.receipts.map(function (receipt) { return input.tx.object(receipt); }),
347
+ }),
348
+ ],
349
+ })
350
+ : result;
351
+ if (input.harvest) {
352
+ input.tx.moveCall({
353
+ target: "".concat(input.typusFrameworkPackageId, "::utils::transfer_balance"),
354
+ typeArguments: [input.typeArguments[1]],
355
+ arguments: [input.tx.object(result[0]), input.tx.pure(input.user)],
356
+ });
357
+ }
358
+ result = input.claim
359
+ ? input.tx.moveCall({
360
+ target: "".concat(input.typusDovSinglePackageId, "::tds_user_entry::claim"),
361
+ typeArguments: input.typeArguments,
362
+ arguments: [
363
+ input.tx.object(input.typusDovSingleRegistry),
364
+ input.tx.pure(input.index),
365
+ input.tx.makeMoveVec({
366
+ type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
367
+ objects: result ? [result[1]] : input.receipts.map(function (receipt) { return input.tx.object(receipt); }),
368
+ }),
369
+ ],
370
+ })
371
+ : result;
372
+ if (input.claim) {
373
+ input.tx.moveCall({
374
+ target: "".concat(input.typusFrameworkPackageId, "::utils::transfer_balance"),
375
+ typeArguments: [input.typeArguments[0]],
376
+ arguments: [input.tx.object(result[0]), input.tx.pure(input.user)],
377
+ });
378
+ }
379
+ if (input.incentiveToken) {
380
+ input.typeArguments.push(input.incentiveToken);
381
+ var receipts = result
382
+ ? [
383
+ input.tx.object(input.tx.moveCall({
384
+ target: "0x1::option::destroy_some",
385
+ arguments: [input.tx.object(result[1])],
386
+ })),
387
+ ]
388
+ : input.receipts.map(function (receipt) { return input.tx.object(receipt); });
389
+ input.tx = getRedeemTx({
390
+ tx: input.tx,
391
+ typusFrameworkOriginPackageId: input.typusFrameworkOriginPackageId,
392
+ typusFrameworkPackageId: input.typusFrameworkPackageId,
393
+ typusDovSinglePackageId: input.typusDovSinglePackageId,
394
+ typusDovSingleRegistry: input.typusDovSingleRegistry,
395
+ typeArguments: input.typeArguments,
396
+ index: input.index,
397
+ receipts: receipts,
398
+ user: input.user,
399
+ });
400
+ }
401
+ else {
402
+ input.tx.moveCall({
403
+ target: "".concat(input.typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
404
+ arguments: [input.tx.object(result[1]), input.tx.pure(input.user)],
405
+ });
406
+ }
407
+ return input.tx;
408
+ }
409
+ exports.getWithdrawHarvestClaimTx = getWithdrawHarvestClaimTx;
279
410
  /**
280
411
  public(friend) entry fun new_bid<D_TOKEN, B_TOKEN>(
281
412
  registry: &mut Registry,
@@ -286,35 +417,39 @@ exports.getRedeemTx = getRedeemTx;
286
417
  ctx: &mut TxContext,
287
418
  )
288
419
  */
289
- function getNewBidTx(tx, packageId, typeArguments, registry, index, coins, size, premium_required, // fe float * b_token_decimal
290
- user, usingSponsoredGasCoin) {
291
- if (usingSponsoredGasCoin === void 0) { usingSponsoredGasCoin = false; }
292
- if (!usingSponsoredGasCoin &&
293
- (typeArguments[1] == "0x2::sui::SUI" ||
294
- typeArguments[1] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI")) {
295
- var _a = __read(tx.splitCoins(tx.gas, [tx.pure(premium_required)]), 1), coin = _a[0];
296
- var result = tx.moveCall({
297
- target: "".concat(packageId, "::tails_staking::new_bid"),
298
- typeArguments: typeArguments,
299
- arguments: [tx.object(registry), tx.pure(index), tx.makeMoveVec({ objects: [coin] }), tx.pure(size), tx.pure("0x6")],
420
+ function getNewBidTx(input) {
421
+ if (!input.usingSponsoredGasCoin &&
422
+ (input.typeArguments[1] == "0x2::sui::SUI" ||
423
+ input.typeArguments[1] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI")) {
424
+ var _a = __read(input.tx.splitCoins(input.tx.gas, [input.tx.pure(input.premium_required)]), 1), coin = _a[0];
425
+ var result = input.tx.moveCall({
426
+ target: "".concat(input.typusDovSinglePackageId, "::tails_staking::new_bid"),
427
+ typeArguments: input.typeArguments,
428
+ arguments: [
429
+ input.tx.object(input.typusDovSingleRegistry),
430
+ input.tx.pure(input.index),
431
+ input.tx.makeMoveVec({ objects: [coin] }),
432
+ input.tx.pure(input.size),
433
+ input.tx.pure("0x6"),
434
+ ],
300
435
  });
301
- tx.transferObjects([tx.object(result[0])], user);
436
+ input.tx.transferObjects([input.tx.object(result[0])], input.user);
302
437
  }
303
438
  else {
304
- var result = tx.moveCall({
305
- target: "".concat(packageId, "::tails_staking::new_bid"),
306
- typeArguments: typeArguments,
439
+ var result = input.tx.moveCall({
440
+ target: "".concat(input.typusDovSinglePackageId, "::tails_staking::new_bid"),
441
+ typeArguments: input.typeArguments,
307
442
  arguments: [
308
- tx.object(registry),
309
- tx.pure(index),
310
- tx.makeMoveVec({ objects: coins.map(function (id) { return tx.object(id); }) }),
311
- tx.pure(size),
312
- tx.pure("0x6"),
443
+ input.tx.object(input.typusDovSingleRegistry),
444
+ input.tx.pure(input.index),
445
+ input.tx.makeMoveVec({ objects: input.coins.map(function (coin) { return input.tx.object(coin); }) }),
446
+ input.tx.pure(input.size),
447
+ input.tx.pure("0x6"),
313
448
  ],
314
449
  });
315
- tx.transferObjects([tx.object(result[0])], user);
450
+ input.tx.transferObjects([input.tx.object(result[0])], input.user);
316
451
  }
317
- return tx;
452
+ return input.tx;
318
453
  }
319
454
  exports.getNewBidTx = getNewBidTx;
320
455
  /**
@@ -325,25 +460,25 @@ exports.getNewBidTx = getNewBidTx;
325
460
  ctx: &mut TxContext,
326
461
  )
327
462
  */
328
- function getExerciseTx(tx, typusFrameworkOriginPackageId, typusFrameworkPackageId, packageId, typeArguments, registry, index, receipts, user) {
329
- var result = tx.moveCall({
330
- target: "".concat(packageId, "::tds_user_entry::exercise"),
331
- typeArguments: typeArguments,
463
+ function getExerciseTx(input) {
464
+ var result = input.tx.moveCall({
465
+ target: "".concat(input.typusDovSinglePackageId, "::tds_user_entry::exercise"),
466
+ typeArguments: input.typeArguments,
332
467
  arguments: [
333
- tx.object(registry),
334
- tx.pure(index),
335
- tx.makeMoveVec({
336
- type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusBidReceipt"),
337
- objects: receipts.map(function (id) { return tx.object(id); }),
468
+ input.tx.object(input.typusDovSingleRegistry),
469
+ input.tx.pure(input.index),
470
+ input.tx.makeMoveVec({
471
+ type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusBidReceipt"),
472
+ objects: input.receipts.map(function (receipt) { return input.tx.object(receipt); }),
338
473
  }),
339
474
  ],
340
475
  });
341
- tx.moveCall({
342
- target: "".concat(typusFrameworkPackageId, "::utils::transfer_balance"),
343
- typeArguments: [typeArguments[0]],
344
- arguments: [tx.object(result[0]), tx.pure(user)],
476
+ input.tx.moveCall({
477
+ target: "".concat(input.typusFrameworkPackageId, "::utils::transfer_balance"),
478
+ typeArguments: [input.typeArguments[0]],
479
+ arguments: [input.tx.object(result[0]), input.tx.pure(input.user)],
345
480
  });
346
- return tx;
481
+ return input.tx;
347
482
  }
348
483
  exports.getExerciseTx = getExerciseTx;
349
484
  /**
@@ -357,23 +492,21 @@ exports.getExerciseTx = getExerciseTx;
357
492
  ) {
358
493
  */
359
494
  function getTransferBidReceiptTx(input) {
360
- var tx = new transactions_1.TransactionBlock();
361
- tx.moveCall({
362
- target: "".concat(input.packageId, "::tds_user_entry::transfer_bid_receipt"),
495
+ input.tx.moveCall({
496
+ target: "".concat(input.typusDovSinglePackageId, "::tds_user_entry::transfer_bid_receipt"),
363
497
  typeArguments: input.typeArguments,
364
498
  arguments: [
365
- tx.object(input.registry),
366
- tx.pure(input.index),
367
- tx.makeMoveVec({
499
+ input.tx.object(input.typusDovSingleRegistry),
500
+ input.tx.pure(input.index),
501
+ input.tx.makeMoveVec({
368
502
  type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusBidReceipt"),
369
- objects: input.receipts.map(function (id) { return tx.object(id); }),
503
+ objects: input.receipts.map(function (receipt) { return input.tx.object(receipt); }),
370
504
  }),
371
- tx.pure(input.share ? [input.share] : []),
372
- tx.pure(input.recipient),
505
+ input.tx.pure(input.share ? [input.share] : []),
506
+ input.tx.pure(input.recipient),
373
507
  ],
374
508
  });
375
- tx.setGasBudget(input.gasBudget);
376
- return tx;
509
+ return input.tx;
377
510
  }
378
511
  exports.getTransferBidReceiptTx = getTransferBidReceiptTx;
379
512
  /**
@@ -382,75 +515,22 @@ exports.getTransferBidReceiptTx = getTransferBidReceiptTx;
382
515
  ctx: &mut TxContext,
383
516
  )
384
517
  */
385
- function getRebateTx(gasBudget, packageId, typeArguments, registry) {
386
- var tx = new transactions_1.TransactionBlock();
387
- typeArguments.forEach(function (typeArgument) {
388
- tx.moveCall({
389
- target: "".concat(packageId, "::tds_user_entry::rebate"),
390
- typeArguments: [typeArgument],
391
- arguments: [tx.object(registry)],
392
- });
518
+ function getRebateTx(input) {
519
+ var result = input.tx.moveCall({
520
+ target: "".concat(input.typusDovSinglePackageId, "::tds_user_entry::rebate"),
521
+ typeArguments: [input.typeArgument],
522
+ arguments: [input.tx.object(input.typusDovSingleRegistry)],
523
+ });
524
+ var balance = input.tx.moveCall({
525
+ target: "0x1::option::destroy_some",
526
+ typeArguments: ["0x2::balance::Balance<" + input.typeArgument + ">"],
527
+ arguments: [input.tx.object(result[0])],
528
+ });
529
+ input.tx.moveCall({
530
+ target: "".concat(input.typusFrameworkPackageId, "::utils::transfer_balance"),
531
+ typeArguments: [input.typeArgument],
532
+ arguments: [input.tx.object(balance), input.tx.pure(input.user)],
393
533
  });
394
- tx.setGasBudget(gasBudget);
395
- return tx;
534
+ return input.tx;
396
535
  }
397
536
  exports.getRebateTx = getRebateTx;
398
- /**
399
- entry fun new_strategy<B_TOKEN>(
400
- strategy_pool: &mut StrategyPool,
401
- vault_index: u64,
402
- signal_index: u64,
403
- size: u64,
404
- price_percentage: u64,
405
- max_times: u64,
406
- target_rounds: vector<u64>,
407
- coin: Coin<B_TOKEN>,
408
- ctx: &mut TxContext
409
- )
410
- */
411
- function getNewStrategyTx(gasBudget, packageId, typeArguments, // B_TOKEN
412
- strategy_pool, vault_index, signal_index, coins, amount, size, price_percentage, max_times, target_rounds) {
413
- var tx = new transactions_1.TransactionBlock();
414
- if (typeArguments[0] == "0x2::sui::SUI" ||
415
- typeArguments[0] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI") {
416
- var _a = __read(tx.splitCoins(tx.gas, [tx.pure(amount)]), 1), input_coin = _a[0];
417
- tx.moveCall({
418
- target: "".concat(packageId, "::auto_bid::new_strategy"),
419
- typeArguments: typeArguments,
420
- arguments: [
421
- tx.object(strategy_pool),
422
- tx.pure(vault_index),
423
- tx.pure(signal_index),
424
- tx.pure(size),
425
- tx.pure(price_percentage),
426
- tx.pure(max_times),
427
- tx.pure(target_rounds),
428
- input_coin,
429
- ],
430
- });
431
- }
432
- else {
433
- var coin = coins.pop();
434
- if (coins.length > 0) {
435
- tx.mergeCoins(tx.object(coin), coins.map(function (id) { return tx.object(id); }));
436
- }
437
- var _b = __read(tx.splitCoins(tx.object(coin), [tx.pure(amount)]), 1), input_coin = _b[0];
438
- tx.moveCall({
439
- target: "".concat(packageId, "::auto_bid::new_strategy"),
440
- typeArguments: typeArguments,
441
- arguments: [
442
- tx.object(strategy_pool),
443
- tx.pure(vault_index),
444
- tx.pure(signal_index),
445
- tx.pure(size),
446
- tx.pure(price_percentage),
447
- tx.pure(max_times),
448
- tx.pure(target_rounds),
449
- input_coin,
450
- ],
451
- });
452
- }
453
- tx.setGasBudget(gasBudget);
454
- return tx;
455
- }
456
- exports.getNewStrategyTx = getNewStrategyTx;