@typus/typus-sdk 1.3.1 → 1.3.2-tails-staking-merged-main

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.
@@ -1,661 +1,620 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- var __read = (this && this.__read) || function (o, n) {
39
- var m = typeof Symbol === "function" && o[Symbol.iterator];
40
- if (!m) return o;
41
- var i = m.call(o), r, ar = [], e;
42
- try {
43
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
44
- }
45
- catch (error) { e = { error: error }; }
46
- finally {
47
- try {
48
- if (r && !r.done && (m = i["return"])) m.call(i);
49
- }
50
- finally { if (e) throw e.error; }
51
- }
52
- return ar;
53
- };
54
- Object.defineProperty(exports, "__esModule", { value: true });
55
- exports.getClaimProfitSharingTx = exports.consumeExpCoinStakedTx = exports.consumeExpCoinUnstakedTx = exports.getLevelUpTx = exports.getUnsubscribeTx = exports.getWithdrawTx = exports.getCompoundTx = exports.getDepositTx = exports.getNewBidTx = exports.getSnapshotTx = exports.getDailyAttendTx = exports.getUnstakeNftTx = exports.getCreateKioskAndLockNftTx = exports.getSwitchNftTx = exports.getStakeNftTx = exports.getTransferNftsTx = exports.getTransferNftTx = void 0;
56
- var transactions_1 = require("@mysten/sui.js/transactions");
57
- var constants_1 = require("../../constants");
58
- var kiosk_1 = require("@mysten/kiosk");
59
- /**
60
- entry fun transfer_nft(
61
- registry: &mut Registry,
62
- from_kiosk: &mut Kiosk,
63
- from_kiosk_cap: &KioskOwnerCap,
64
- id: ID,
65
- receiver: address,
66
- ctx: &mut TxContext
67
- )
68
- */
69
- function getTransferNftTx(gasBudget, nftPackageId, registry, personalKioskPackageId, tails_id, receiver) {
70
- return __awaiter(this, void 0, void 0, function () {
71
- var tx, _a, coin, _b, personalKioskCap, borrow;
72
- return __generator(this, function (_c) {
73
- tx = new transactions_1.TransactionBlock();
74
- _a = __read(tx.splitCoins(tx.gas, [tx.pure(10000000)]), 1), coin = _a[0];
75
- if (tails_id.isPersonal) {
76
- _b = __read(tx.moveCall({
77
- target: "".concat(personalKioskPackageId, "::personal_kiosk::borrow_val"),
78
- arguments: [tx.object(tails_id.kioskCap)],
79
- }), 2), personalKioskCap = _b[0], borrow = _b[1];
80
- tx.moveCall({
81
- target: "".concat(nftPackageId, "::tails_staking::transfer_nft"),
82
- typeArguments: [],
83
- arguments: [tx.object(registry), tx.object(tails_id.kiosk), personalKioskCap, tx.pure(tails_id.nftId), tx.pure(receiver), coin],
84
- });
85
- tx.moveCall({
86
- target: "".concat(personalKioskPackageId, "::personal_kiosk::return_val"),
87
- arguments: [tx.object(tails_id.kioskCap), personalKioskCap, borrow],
88
- });
89
- }
90
- else {
91
- tx.moveCall({
92
- target: "".concat(nftPackageId, "::tails_staking::transfer_nft"),
93
- typeArguments: [],
94
- arguments: [
95
- tx.object(registry),
96
- tx.object(tails_id.kiosk),
97
- tx.object(tails_id.kioskCap),
98
- tx.pure(tails_id.nftId),
99
- tx.pure(receiver),
100
- coin,
101
- ],
102
- });
103
- }
104
- tx.setGasBudget(gasBudget);
105
- return [2 /*return*/, tx];
106
- });
107
- });
108
- }
109
- exports.getTransferNftTx = getTransferNftTx;
110
- function getTransferNftsTx(gasBudget, nftPackageId, personalKioskPackageId, registry, tailsIds, receiver) {
111
- return __awaiter(this, void 0, void 0, function () {
112
- var tx, i, _a, coin, _b, personalKioskCap, borrow;
113
- return __generator(this, function (_c) {
114
- tx = new transactions_1.TransactionBlock();
115
- i = 0;
116
- while (i < tailsIds.length) {
117
- _a = __read(tx.splitCoins(tx.gas, [tx.pure(10000000)]), 1), coin = _a[0];
118
- if (tailsIds[i].isPersonal) {
119
- _b = __read(tx.moveCall({
120
- target: "".concat(personalKioskPackageId, "::personal_kiosk::borrow_val"),
121
- arguments: [tx.object(tailsIds[i].kioskCap)],
122
- }), 2), personalKioskCap = _b[0], borrow = _b[1];
123
- tx.moveCall({
124
- target: "".concat(nftPackageId, "::tails_staking::transfer_nft"),
125
- typeArguments: [],
126
- arguments: [
127
- tx.object(registry),
128
- tx.object(tailsIds[i].kiosk),
129
- personalKioskCap,
130
- tx.pure(tailsIds[i].nftId),
131
- tx.pure(receiver),
132
- coin,
133
- ],
134
- });
135
- tx.moveCall({
136
- target: "".concat(personalKioskPackageId, "::personal_kiosk::return_val"),
137
- arguments: [tx.object(tailsIds[i].kioskCap), personalKioskCap, borrow],
138
- });
139
- }
140
- else {
141
- tx.moveCall({
142
- target: "".concat(nftPackageId, "::tails_staking::transfer_nft"),
143
- typeArguments: [],
144
- arguments: [
145
- tx.object(registry),
146
- tx.object(tailsIds[i].kiosk),
147
- tx.object(tailsIds[i].kioskCap),
148
- tx.pure(tailsIds[i].nftId),
149
- tx.pure(receiver),
150
- coin,
151
- ],
152
- });
153
- }
154
- i += 1;
155
- }
156
- tx.setGasBudget(gasBudget);
157
- return [2 /*return*/, tx];
158
- });
159
- });
160
- }
161
- exports.getTransferNftsTx = getTransferNftsTx;
162
- /**
163
- public fun stake_nft(
164
- registry: &mut Registry,
165
- kiosk: &mut Kiosk,
166
- kiosk_cap: &KioskOwnerCap,
167
- id: ID,
168
- clock: &Clock,
169
- ctx: &mut TxContext
170
- )
171
- */
172
- function getStakeNftTx(gasBudget, nftPackageId, registry, personalKioskPackageId, tails_id) {
173
- return __awaiter(this, void 0, void 0, function () {
174
- var tx, _a, coin, _b, personalKioskCap, borrow;
175
- return __generator(this, function (_c) {
176
- tx = new transactions_1.TransactionBlock();
177
- _a = __read(tx.splitCoins(tx.gas, [tx.pure(50000000)]), 1), coin = _a[0];
178
- if (tails_id.isPersonal) {
179
- _b = __read(tx.moveCall({
180
- target: "".concat(personalKioskPackageId, "::personal_kiosk::borrow_val"),
181
- arguments: [tx.object(tails_id.kioskCap)],
182
- }), 2), personalKioskCap = _b[0], borrow = _b[1];
183
- tx.moveCall({
184
- target: "".concat(nftPackageId, "::tails_staking::stake_nft"),
185
- typeArguments: [],
186
- arguments: [tx.object(registry), tx.object(tails_id.kiosk), personalKioskCap, tx.pure(tails_id.nftId), tx.object(constants_1.CLOCK), coin],
187
- });
188
- tx.moveCall({
189
- target: "".concat(personalKioskPackageId, "::personal_kiosk::return_val"),
190
- arguments: [tx.object(tails_id.kioskCap), personalKioskCap, borrow],
191
- });
192
- }
193
- else {
194
- tx.moveCall({
195
- target: "".concat(nftPackageId, "::tails_staking::stake_nft"),
196
- typeArguments: [],
197
- arguments: [
198
- tx.object(registry),
199
- tx.object(tails_id.kiosk),
200
- tx.object(tails_id.kioskCap),
201
- tx.pure(tails_id.nftId),
202
- tx.object(constants_1.CLOCK),
203
- coin,
204
- ],
205
- });
206
- }
207
- tx.setGasBudget(gasBudget);
208
- return [2 /*return*/, tx];
209
- });
210
- });
211
- }
212
- exports.getStakeNftTx = getStakeNftTx;
213
- function getSwitchNftTx(gasBudget, nftPackageId, registry, personalKioskPackageId, tails_id, typeArguments) {
214
- return __awaiter(this, void 0, void 0, function () {
215
- var tx, _a, coin, _b, personalKioskCap, borrow;
216
- return __generator(this, function (_c) {
217
- tx = new transactions_1.TransactionBlock();
218
- _a = __read(tx.splitCoins(tx.gas, [tx.pure(50000000)]), 1), coin = _a[0];
219
- // tx.moveCall({
220
- // target: `${nftPackageId}::tails_staking::snapshot`,
221
- // typeArguments: [],
222
- // arguments: [tx.object(registry), tx.object(CLOCK)],
223
- // });
224
- tx.moveCall({
225
- target: "".concat(nftPackageId, "::tails_staking::claim_profit_sharing"),
226
- typeArguments: typeArguments,
227
- arguments: [tx.object(registry), tx.pure("dice_profit")],
228
- });
229
- tx.moveCall({
230
- target: "".concat(nftPackageId, "::tails_staking::claim_profit_sharing"),
231
- typeArguments: typeArguments,
232
- arguments: [tx.object(registry), tx.pure("exp_profit")],
233
- });
234
- if (tails_id.isPersonal) {
235
- _b = __read(tx.moveCall({
236
- target: "".concat(personalKioskPackageId, "::personal_kiosk::borrow_val"),
237
- arguments: [tx.object(tails_id.kioskCap)],
238
- }), 2), personalKioskCap = _b[0], borrow = _b[1];
239
- tx.moveCall({
240
- target: "".concat(nftPackageId, "::tails_staking::switch_nft"),
241
- typeArguments: [],
242
- arguments: [tx.object(registry), tx.object(tails_id.kiosk), personalKioskCap, tx.pure(tails_id.nftId), tx.object(constants_1.CLOCK), coin],
243
- });
244
- tx.moveCall({
245
- target: "".concat(personalKioskPackageId, "::personal_kiosk::return_val"),
246
- arguments: [tx.object(tails_id.kioskCap), personalKioskCap, borrow],
247
- });
248
- }
249
- else {
250
- tx.moveCall({
251
- target: "".concat(nftPackageId, "::tails_staking::switch_nft"),
252
- typeArguments: [],
253
- arguments: [
254
- tx.object(registry),
255
- tx.object(tails_id.kiosk),
256
- tx.object(tails_id.kioskCap),
257
- tx.pure(tails_id.nftId),
258
- tx.object(constants_1.CLOCK),
259
- coin,
260
- ],
261
- });
262
- }
263
- tx.setGasBudget(gasBudget);
264
- return [2 /*return*/, tx];
265
- });
266
- });
267
- }
268
- exports.getSwitchNftTx = getSwitchNftTx;
269
- function getCreateKioskAndLockNftTx(kioskClient, gasBudget, nftPackageId, policy, nft_id, singer) {
270
- return __awaiter(this, void 0, void 0, function () {
271
- var tx, kioskTx, kiosk, kioskCap;
272
- return __generator(this, function (_a) {
273
- tx = new transactions_1.TransactionBlock();
274
- kioskTx = new kiosk_1.KioskTransaction({ transactionBlock: tx, kioskClient: kioskClient });
275
- kioskTx.create();
276
- // @ts-ignore
277
- kioskTx.lock({ itemType: "".concat(nftPackageId, "::typus_nft::Tails"), itemId: nft_id, policy: policy, item: nft_id });
278
- kiosk = kioskTx.kiosk, kioskCap = kioskTx.kioskCap;
279
- if (kiosk && kioskCap) {
280
- tx.moveCall({
281
- target: "0x2::transfer::public_share_object",
282
- typeArguments: [kiosk_1.KIOSK_TYPE],
283
- arguments: [kiosk],
284
- });
285
- tx.transferObjects([kioskCap], tx.pure(singer));
286
- tx.setGasBudget(gasBudget);
287
- }
288
- else {
289
- console.error("Fail to Create Kiosk Tx!!");
290
- }
291
- return [2 /*return*/, tx];
292
- });
293
- });
294
- }
295
- exports.getCreateKioskAndLockNftTx = getCreateKioskAndLockNftTx;
296
- /**
297
- public fun unstake_nft(
298
- registry: &mut Registry,
299
- kiosk: &mut Kiosk,
300
- kiosk_cap: &KioskOwnerCap,
301
- coin: Coin<SUI>,
302
- ctx: &mut TxContext
303
- )
304
- */
305
- function getUnstakeNftTx(gasBudget, nftPackageId, registry, typeArguments, kioskOwnerCap, personalKioskPackageId) {
306
- return __awaiter(this, void 0, void 0, function () {
307
- var tx, _a, personalKioskCap, borrow;
308
- return __generator(this, function (_b) {
309
- tx = new transactions_1.TransactionBlock();
310
- // tx.moveCall({
311
- // target: `${nftPackageId}::tails_staking::snapshot`,
312
- // typeArguments: [],
313
- // arguments: [tx.object(registry), tx.object(CLOCK)],
314
- // });
315
- tx.moveCall({
316
- target: "".concat(nftPackageId, "::tails_staking::claim_profit_sharing"),
317
- typeArguments: typeArguments,
318
- arguments: [tx.object(registry), tx.pure("dice_profit")],
319
- });
320
- tx.moveCall({
321
- target: "".concat(nftPackageId, "::tails_staking::claim_profit_sharing"),
322
- typeArguments: typeArguments,
323
- arguments: [tx.object(registry), tx.pure("exp_profit")],
324
- });
325
- if (kioskOwnerCap.isPersonal) {
326
- _a = __read(tx.moveCall({
327
- target: "".concat(personalKioskPackageId, "::personal_kiosk::borrow_val"),
328
- arguments: [tx.object(kioskOwnerCap.objectId)],
329
- }), 2), personalKioskCap = _a[0], borrow = _a[1];
330
- tx.moveCall({
331
- target: "".concat(nftPackageId, "::tails_staking::unstake_nft"),
332
- typeArguments: [],
333
- arguments: [tx.object(registry), tx.object(kioskOwnerCap.kioskId), tx.object(personalKioskCap)],
334
- });
335
- tx.moveCall({
336
- target: "".concat(personalKioskPackageId, "::personal_kiosk::return_val"),
337
- arguments: [tx.object(kioskOwnerCap.objectId), personalKioskCap, borrow],
338
- });
339
- }
340
- else {
341
- tx.moveCall({
342
- target: "".concat(nftPackageId, "::tails_staking::unstake_nft"),
343
- typeArguments: [],
344
- arguments: [tx.object(registry), tx.object(kioskOwnerCap.kioskId), tx.object(kioskOwnerCap.objectId)],
345
- });
346
- }
347
- tx.setGasBudget(gasBudget);
348
- return [2 /*return*/, tx];
349
- });
350
- });
351
- }
352
- exports.getUnstakeNftTx = getUnstakeNftTx;
353
- /**
354
- public fun daily_attend(
355
- registry: &mut Registry,
356
- clock: &Clock,
357
- ctx: &mut TxContext
358
- )
359
- */
360
- function getDailyAttendTx(gasBudget, nftPackageId, registry) {
361
- return __awaiter(this, void 0, void 0, function () {
362
- var tx;
363
- return __generator(this, function (_a) {
364
- tx = new transactions_1.TransactionBlock();
365
- tx.moveCall({
366
- target: "".concat(nftPackageId, "::tails_staking::daily_attend"),
367
- typeArguments: [],
368
- arguments: [tx.object(registry), tx.object(constants_1.CLOCK)],
369
- });
370
- tx.setGasBudget(gasBudget);
371
- return [2 /*return*/, tx];
372
- });
373
- });
374
- }
375
- exports.getDailyAttendTx = getDailyAttendTx;
376
- /**
377
- entry fun snapshot(
378
- registry: &mut Registry,
379
- clock: &Clock,
380
- ctx: &mut TxContext
381
- )
382
- */
383
- function getSnapshotTx(gasBudget, typusEcosystemVersion, typusUserRegistry, typusDovSinglePackageId, registry, amount) {
384
- return __awaiter(this, void 0, void 0, function () {
385
- var tx;
386
- return __generator(this, function (_a) {
387
- tx = new transactions_1.TransactionBlock();
388
- tx.moveCall({
389
- target: "".concat(typusDovSinglePackageId, "::tails_staking::snapshot"),
390
- typeArguments: [],
391
- arguments: [tx.object(typusEcosystemVersion), tx.object(typusUserRegistry), tx.object(registry), tx.pure(amount)],
392
- });
393
- tx.setGasBudget(gasBudget);
394
- return [2 /*return*/, tx];
395
- });
396
- });
397
- }
398
- exports.getSnapshotTx = getSnapshotTx;
399
- function getNewBidTx(gasBudget_1, packageId_1, typeArguments_1, registry_1, additional_config_registry_1, index_1, priceOracle_1, coins_1, size_1, premium_required_1) {
400
- return __awaiter(this, arguments, void 0, function (gasBudget, packageId, typeArguments, registry, additional_config_registry, index, priceOracle, coins, size, premium_required, // fe float * b_token_decimal
401
- usingSponsoredGasCoin) {
402
- var tx, _a, coin;
403
- if (usingSponsoredGasCoin === void 0) { usingSponsoredGasCoin = false; }
404
- return __generator(this, function (_b) {
405
- tx = new transactions_1.TransactionBlock();
406
- if (!usingSponsoredGasCoin &&
407
- (typeArguments[1] == "0x2::sui::SUI" ||
408
- typeArguments[1] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI")) {
409
- _a = __read(tx.splitCoins(tx.gas, [tx.pure(premium_required)]), 1), coin = _a[0];
410
- tx.moveCall({
411
- target: "".concat(packageId, "::tails_staking::new_bid"),
412
- typeArguments: typeArguments,
413
- arguments: [
414
- tx.pure(registry),
415
- tx.pure(additional_config_registry),
416
- tx.pure(index),
417
- tx.pure(priceOracle),
418
- tx.pure("0x6"),
419
- tx.makeMoveVec({ objects: [coin] }),
420
- tx.pure(size),
421
- ],
422
- });
423
- }
424
- else {
425
- tx.moveCall({
426
- target: "".concat(packageId, "::tails_staking::new_bid"),
427
- typeArguments: typeArguments,
428
- arguments: [
429
- tx.pure(registry),
430
- tx.pure(additional_config_registry),
431
- tx.pure(index),
432
- tx.pure(priceOracle),
433
- tx.pure("0x6"),
434
- tx.makeMoveVec({ objects: coins.map(function (id) { return tx.object(id); }) }),
435
- tx.pure(size),
436
- ],
437
- });
438
- }
439
- tx.setGasBudget(gasBudget);
440
- return [2 /*return*/, tx];
441
- });
442
- });
443
- }
444
- exports.getNewBidTx = getNewBidTx;
445
- function getDepositTx(gasBudget_1, packageId_1, typeArguments_1, registry_1, additional_config_registry_1, index_1, coins_1, amount_1) {
446
- return __awaiter(this, arguments, void 0, function (gasBudget, packageId, typeArguments, registry, additional_config_registry, index, coins, amount, usingSponsoredGasCoin) {
447
- var tx, _a, coin;
448
- if (usingSponsoredGasCoin === void 0) { usingSponsoredGasCoin = false; }
449
- return __generator(this, function (_b) {
450
- tx = new transactions_1.TransactionBlock();
451
- if (!usingSponsoredGasCoin &&
452
- (typeArguments[0] == "0x2::sui::SUI" ||
453
- typeArguments[0] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI")) {
454
- _a = __read(tx.splitCoins(tx.gas, [tx.pure(amount)]), 1), coin = _a[0];
455
- tx.moveCall({
456
- target: "".concat(packageId, "::tails_staking::deposit"),
457
- typeArguments: typeArguments,
458
- arguments: [
459
- tx.pure(registry),
460
- tx.pure(additional_config_registry),
461
- tx.pure(index),
462
- tx.makeMoveVec({ objects: [coin] }),
463
- tx.pure(amount),
464
- tx.object(constants_1.CLOCK),
465
- ],
466
- });
467
- }
468
- else {
469
- tx.moveCall({
470
- target: "".concat(packageId, "::tails_staking::deposit"),
471
- typeArguments: typeArguments,
472
- arguments: [
473
- tx.pure(registry),
474
- tx.pure(additional_config_registry),
475
- tx.pure(index),
476
- tx.makeMoveVec({ objects: coins.map(function (id) { return tx.object(id); }) }),
477
- tx.pure(amount),
478
- tx.object(constants_1.CLOCK),
479
- ],
480
- });
481
- }
482
- tx.setGasBudget(gasBudget);
483
- return [2 /*return*/, tx];
484
- });
485
- });
486
- }
487
- exports.getDepositTx = getDepositTx;
488
- function getCompoundTx(gasBudget, packageId, typeArguments, registry, additional_config_registry, index) {
489
- return __awaiter(this, void 0, void 0, function () {
490
- var tx;
491
- return __generator(this, function (_a) {
492
- tx = new transactions_1.TransactionBlock();
493
- tx.moveCall({
494
- target: "".concat(packageId, "::tails_staking::compound"),
495
- typeArguments: typeArguments,
496
- arguments: [tx.pure(registry), tx.pure(additional_config_registry), tx.pure(index), tx.object(constants_1.CLOCK)],
497
- });
498
- tx.setGasBudget(gasBudget);
499
- return [2 /*return*/, tx];
500
- });
501
- });
502
- }
503
- exports.getCompoundTx = getCompoundTx;
504
- function getWithdrawTx(gasBudget, packageId, typeArguments, registry, additional_config_registry, index, share) {
505
- return __awaiter(this, void 0, void 0, function () {
506
- var tx;
507
- return __generator(this, function (_a) {
508
- tx = new transactions_1.TransactionBlock();
509
- tx.moveCall({
510
- target: "".concat(packageId, "::tails_staking::withdraw"),
511
- typeArguments: typeArguments,
512
- arguments: [
513
- tx.pure(registry),
514
- tx.pure(additional_config_registry),
515
- tx.pure(index),
516
- tx.pure(share ? [share] : []),
517
- tx.object(constants_1.CLOCK),
518
- ],
519
- });
520
- tx.setGasBudget(gasBudget);
521
- return [2 /*return*/, tx];
522
- });
523
- });
524
- }
525
- exports.getWithdrawTx = getWithdrawTx;
526
- function getUnsubscribeTx(gasBudget, packageId, typeArguments, registry, additional_config_registry, index, share) {
527
- return __awaiter(this, void 0, void 0, function () {
528
- var tx;
529
- return __generator(this, function (_a) {
530
- tx = new transactions_1.TransactionBlock();
531
- tx.moveCall({
532
- target: "".concat(packageId, "::tails_staking::unsubscribe"),
533
- typeArguments: typeArguments,
534
- arguments: [
535
- tx.pure(registry),
536
- tx.pure(additional_config_registry),
537
- tx.pure(index),
538
- tx.pure(share ? [share] : []),
539
- tx.object(constants_1.CLOCK),
540
- ],
541
- });
542
- tx.setGasBudget(gasBudget);
543
- return [2 /*return*/, tx];
544
- });
545
- });
546
- }
547
- exports.getUnsubscribeTx = getUnsubscribeTx;
548
- /**
549
- public fun level_up(
550
- registry: &mut Registry,
551
- ctx: &mut TxContext
552
- )
553
- */
554
- function getLevelUpTx(gasBudget, nftPackageId, registry) {
555
- return __awaiter(this, void 0, void 0, function () {
556
- var tx;
557
- return __generator(this, function (_a) {
558
- tx = new transactions_1.TransactionBlock();
559
- tx.moveCall({
560
- target: "".concat(nftPackageId, "::tails_staking::level_up"),
561
- typeArguments: [],
562
- arguments: [tx.object(registry)],
563
- });
564
- tx.setGasBudget(gasBudget);
565
- return [2 /*return*/, tx];
566
- });
567
- });
568
- }
569
- exports.getLevelUpTx = getLevelUpTx;
570
- /**
571
- entry fun consume_exp_coin_unstaked<EXP_COIN>(
572
- registry: &mut Registry,
573
- kiosk: &mut Kiosk,
574
- kiosk_cap: &KioskOwnerCap,
575
- id: ID,
576
- exp_coin: Coin<EXP_COIN>,
577
- ctx: &mut TxContext
578
- )
579
- */
580
- function consumeExpCoinUnstakedTx(gasBudget, nftPackageId, typeArguments, registry, personalKioskPackageId, tails_id, exp_coins, amount) {
581
- return __awaiter(this, void 0, void 0, function () {
582
- var tx, coin, _a, input_coin, _b, personalKioskCap, borrow;
583
- return __generator(this, function (_c) {
584
- tx = new transactions_1.TransactionBlock();
585
- coin = exp_coins.pop();
586
- if (exp_coins.length > 0) {
587
- tx.mergeCoins(tx.object(coin), exp_coins.map(function (id) { return tx.object(id); }));
588
- }
589
- _a = __read(tx.splitCoins(tx.object(coin), [tx.pure(amount)]), 1), input_coin = _a[0];
590
- if (tails_id.isPersonal) {
591
- _b = __read(tx.moveCall({
592
- target: "".concat(personalKioskPackageId, "::personal_kiosk::borrow_val"),
593
- arguments: [tx.object(tails_id.kioskCap)],
594
- }), 2), personalKioskCap = _b[0], borrow = _b[1];
595
- tx.moveCall({
596
- target: "".concat(nftPackageId, "::tails_staking::consume_exp_coin_unstaked"),
597
- typeArguments: typeArguments,
598
- arguments: [tx.object(registry), tx.object(tails_id.kiosk), personalKioskCap, tx.pure(tails_id.nftId), input_coin],
599
- });
600
- tx.moveCall({
601
- target: "".concat(personalKioskPackageId, "::personal_kiosk::return_val"),
602
- arguments: [tx.object(tails_id.kioskCap), personalKioskCap, borrow],
603
- });
604
- }
605
- else {
606
- tx.moveCall({
607
- target: "".concat(nftPackageId, "::tails_staking::consume_exp_coin_unstaked"),
608
- typeArguments: typeArguments,
609
- arguments: [tx.object(registry), tx.object(tails_id.kiosk), tx.object(tails_id.kioskCap), tx.pure(tails_id.nftId), input_coin],
610
- });
611
- }
612
- tx.setGasBudget(gasBudget);
613
- return [2 /*return*/, tx];
614
- });
615
- });
616
- }
617
- exports.consumeExpCoinUnstakedTx = consumeExpCoinUnstakedTx;
618
- /**
619
- entry fun consume_exp_coin_staked<EXP_COIN>(
620
- registry: &mut Registry,
621
- exp_coin: Coin<EXP_COIN>,
622
- ctx: &mut TxContext
623
- )
624
- */
625
- function consumeExpCoinStakedTx(gasBudget, nftPackageId, typeArguments, registry, exp_coins, amount) {
626
- return __awaiter(this, void 0, void 0, function () {
627
- var tx, coin, _a, input_coin;
628
- return __generator(this, function (_b) {
629
- tx = new transactions_1.TransactionBlock();
630
- coin = exp_coins.pop();
631
- if (exp_coins.length > 0) {
632
- tx.mergeCoins(tx.object(coin), exp_coins.map(function (id) { return tx.object(id); }));
633
- }
634
- _a = __read(tx.splitCoins(tx.object(coin), [tx.pure(amount)]), 1), input_coin = _a[0];
635
- tx.moveCall({
636
- target: "".concat(nftPackageId, "::tails_staking::consume_exp_coin_staked"),
637
- typeArguments: typeArguments,
638
- arguments: [tx.object(registry), input_coin],
639
- });
640
- tx.setGasBudget(gasBudget);
641
- return [2 /*return*/, tx];
642
- });
643
- });
644
- }
645
- exports.consumeExpCoinStakedTx = consumeExpCoinStakedTx;
646
- function getClaimProfitSharingTx(gasBudget, packageId, registry, name, typeArguments) {
647
- return __awaiter(this, void 0, void 0, function () {
648
- var tx;
649
- return __generator(this, function (_a) {
650
- tx = new transactions_1.TransactionBlock();
651
- tx.moveCall({
652
- target: "".concat(packageId, "::tails_staking::claim_profit_sharing"),
653
- typeArguments: typeArguments,
654
- arguments: [tx.object(registry), tx.pure(name)],
655
- });
656
- tx.setGasBudget(gasBudget);
657
- return [2 /*return*/, tx];
658
- });
659
- });
660
- }
661
- exports.getClaimProfitSharingTx = getClaimProfitSharingTx;
2
+ // import { TransactionBlock } from "@mysten/sui.js/transactions";
3
+ // import { CLOCK } from "../../constants";
4
+ // import { KIOSK_TYPE, KioskClient, Network, KioskTransaction } from "@mysten/kiosk";
5
+ // import { SuiClient } from "@mysten/sui.js/client";
6
+ // import { TailsId, kioskOwnerCap } from "../typus-nft/fetch";
7
+ // /**
8
+ // entry fun transfer_nft(
9
+ // registry: &mut Registry,
10
+ // from_kiosk: &mut Kiosk,
11
+ // from_kiosk_cap: &KioskOwnerCap,
12
+ // id: ID,
13
+ // receiver: address,
14
+ // ctx: &mut TxContext
15
+ // )
16
+ // */
17
+ // // export async function getTransferNftTx(
18
+ // // gasBudget: number,
19
+ // // nftPackageId: string,
20
+ // // registry: string,
21
+ // // personalKioskPackageId: string,
22
+ // // tails_id: TailsId,
23
+ // // receiver: string
24
+ // // ) {
25
+ // // let tx = new TransactionBlock();
26
+ // // let [coin] = tx.splitCoins(tx.gas, [tx.pure(10000000)]);
27
+ // // if (tails_id.isPersonal) {
28
+ // // const [personalKioskCap, borrow] = tx.moveCall({
29
+ // // target: `${personalKioskPackageId}::personal_kiosk::borrow_val`,
30
+ // // arguments: [tx.object(tails_id.kioskCap)],
31
+ // // });
32
+ // // tx.moveCall({
33
+ // // target: `${nftPackageId}::tails_staking::transfer_nft`,
34
+ // // typeArguments: [],
35
+ // // arguments: [tx.object(registry), tx.object(tails_id.kiosk), personalKioskCap, tx.pure(tails_id.nftId), tx.pure(receiver), coin],
36
+ // // });
37
+ // // tx.moveCall({
38
+ // // target: `${personalKioskPackageId}::personal_kiosk::return_val`,
39
+ // // arguments: [tx.object(tails_id.kioskCap), personalKioskCap, borrow],
40
+ // // });
41
+ // // } else {
42
+ // // tx.moveCall({
43
+ // // target: `${nftPackageId}::tails_staking::transfer_nft`,
44
+ // // typeArguments: [],
45
+ // // arguments: [
46
+ // // tx.object(registry),
47
+ // // tx.object(tails_id.kiosk),
48
+ // // tx.object(tails_id.kioskCap),
49
+ // // tx.pure(tails_id.nftId),
50
+ // // tx.pure(receiver),
51
+ // // coin,
52
+ // // ],
53
+ // // });
54
+ // // }
55
+ // // tx.setGasBudget(gasBudget);
56
+ // // return tx;
57
+ // // }
58
+ // // export async function getTransferNftsTx(
59
+ // // gasBudget: number,
60
+ // // nftPackageId: string,
61
+ // // personalKioskPackageId: string,
62
+ // // registry: string,
63
+ // // tailsIds: TailsId[],
64
+ // // receiver: string
65
+ // // ) {
66
+ // // let tx = new TransactionBlock();
67
+ // // var i = 0;
68
+ // // while (i < tailsIds.length) {
69
+ // // let [coin] = tx.splitCoins(tx.gas, [tx.pure(10000000)]);
70
+ // // if (tailsIds[i].isPersonal) {
71
+ // // const [personalKioskCap, borrow] = tx.moveCall({
72
+ // // target: `${personalKioskPackageId}::personal_kiosk::borrow_val`,
73
+ // // arguments: [tx.object(tailsIds[i].kioskCap)],
74
+ // // });
75
+ // // tx.moveCall({
76
+ // // target: `${nftPackageId}::tails_staking::transfer_nft`,
77
+ // // typeArguments: [],
78
+ // // arguments: [
79
+ // // tx.object(registry),
80
+ // // tx.object(tailsIds[i].kiosk),
81
+ // // personalKioskCap,
82
+ // // tx.pure(tailsIds[i].nftId),
83
+ // // tx.pure(receiver),
84
+ // // coin,
85
+ // // ],
86
+ // // });
87
+ // // tx.moveCall({
88
+ // // target: `${personalKioskPackageId}::personal_kiosk::return_val`,
89
+ // // arguments: [tx.object(tailsIds[i].kioskCap), personalKioskCap, borrow],
90
+ // // });
91
+ // // } else {
92
+ // // tx.moveCall({
93
+ // // target: `${nftPackageId}::tails_staking::transfer_nft`,
94
+ // // typeArguments: [],
95
+ // // arguments: [
96
+ // // tx.object(registry),
97
+ // // tx.object(tailsIds[i].kiosk),
98
+ // // tx.object(tailsIds[i].kioskCap),
99
+ // // tx.pure(tailsIds[i].nftId),
100
+ // // tx.pure(receiver),
101
+ // // coin,
102
+ // // ],
103
+ // // });
104
+ // // }
105
+ // // i += 1;
106
+ // // }
107
+ // // tx.setGasBudget(gasBudget);
108
+ // // return tx;
109
+ // // }
110
+ // /**
111
+ // public fun stake_nft(
112
+ // registry: &mut Registry,
113
+ // kiosk: &mut Kiosk,
114
+ // kiosk_cap: &KioskOwnerCap,
115
+ // id: ID,
116
+ // clock: &Clock,
117
+ // ctx: &mut TxContext
118
+ // )
119
+ // */
120
+ // // export async function getStakeNftTx(
121
+ // // gasBudget: number,
122
+ // // nftPackageId: string,
123
+ // // registry: string,
124
+ // // personalKioskPackageId: string,
125
+ // // tails_id: TailsId
126
+ // // ) {
127
+ // // let tx = new TransactionBlock();
128
+ // // let [coin] = tx.splitCoins(tx.gas, [tx.pure(50000000)]);
129
+ // // if (tails_id.isPersonal) {
130
+ // // const [personalKioskCap, borrow] = tx.moveCall({
131
+ // // target: `${personalKioskPackageId}::personal_kiosk::borrow_val`,
132
+ // // arguments: [tx.object(tails_id.kioskCap)],
133
+ // // });
134
+ // // tx.moveCall({
135
+ // // target: `${nftPackageId}::tails_staking::stake_nft`,
136
+ // // typeArguments: [],
137
+ // // arguments: [tx.object(registry), tx.object(tails_id.kiosk), personalKioskCap, tx.pure(tails_id.nftId), tx.object(CLOCK), coin],
138
+ // // });
139
+ // // tx.moveCall({
140
+ // // target: `${personalKioskPackageId}::personal_kiosk::return_val`,
141
+ // // arguments: [tx.object(tails_id.kioskCap), personalKioskCap, borrow],
142
+ // // });
143
+ // // } else {
144
+ // // tx.moveCall({
145
+ // // target: `${nftPackageId}::tails_staking::stake_nft`,
146
+ // // typeArguments: [],
147
+ // // arguments: [
148
+ // // tx.object(registry),
149
+ // // tx.object(tails_id.kiosk),
150
+ // // tx.object(tails_id.kioskCap),
151
+ // // tx.pure(tails_id.nftId),
152
+ // // tx.object(CLOCK),
153
+ // // coin,
154
+ // // ],
155
+ // // });
156
+ // // }
157
+ // // tx.setGasBudget(gasBudget);
158
+ // // return tx;
159
+ // // }
160
+ // // export async function getSwitchNftTx(
161
+ // // gasBudget: number,
162
+ // // nftPackageId: string,
163
+ // // registry: string,
164
+ // // personalKioskPackageId: string,
165
+ // // tails_id: TailsId,
166
+ // // typeArguments: string[]
167
+ // // ) {
168
+ // // let tx = new TransactionBlock();
169
+ // // let [coin] = tx.splitCoins(tx.gas, [tx.pure(50000000)]);
170
+ // // // tx.moveCall({
171
+ // // // target: `${nftPackageId}::tails_staking::snapshot`,
172
+ // // // typeArguments: [],
173
+ // // // arguments: [tx.object(registry), tx.object(CLOCK)],
174
+ // // // });
175
+ // // tx.moveCall({
176
+ // // target: `${nftPackageId}::tails_staking::claim_profit_sharing`,
177
+ // // typeArguments,
178
+ // // arguments: [tx.object(registry), tx.pure("dice_profit")],
179
+ // // });
180
+ // // tx.moveCall({
181
+ // // target: `${nftPackageId}::tails_staking::claim_profit_sharing`,
182
+ // // typeArguments,
183
+ // // arguments: [tx.object(registry), tx.pure("exp_profit")],
184
+ // // });
185
+ // // if (tails_id.isPersonal) {
186
+ // // const [personalKioskCap, borrow] = tx.moveCall({
187
+ // // target: `${personalKioskPackageId}::personal_kiosk::borrow_val`,
188
+ // // arguments: [tx.object(tails_id.kioskCap)],
189
+ // // });
190
+ // // tx.moveCall({
191
+ // // target: `${nftPackageId}::tails_staking::switch_nft`,
192
+ // // typeArguments: [],
193
+ // // arguments: [tx.object(registry), tx.object(tails_id.kiosk), personalKioskCap, tx.pure(tails_id.nftId), tx.object(CLOCK), coin],
194
+ // // });
195
+ // // tx.moveCall({
196
+ // // target: `${personalKioskPackageId}::personal_kiosk::return_val`,
197
+ // // arguments: [tx.object(tails_id.kioskCap), personalKioskCap, borrow],
198
+ // // });
199
+ // // } else {
200
+ // // tx.moveCall({
201
+ // // target: `${nftPackageId}::tails_staking::switch_nft`,
202
+ // // typeArguments: [],
203
+ // // arguments: [
204
+ // // tx.object(registry),
205
+ // // tx.object(tails_id.kiosk),
206
+ // // tx.object(tails_id.kioskCap),
207
+ // // tx.pure(tails_id.nftId),
208
+ // // tx.object(CLOCK),
209
+ // // coin,
210
+ // // ],
211
+ // // });
212
+ // // }
213
+ // // tx.setGasBudget(gasBudget);
214
+ // // return tx;
215
+ // // }
216
+ // // export async function getCreateKioskAndLockNftTx(
217
+ // // kioskClient: KioskClient,
218
+ // // gasBudget: number,
219
+ // // nftPackageId: string,
220
+ // // policy: string,
221
+ // // nft_id: string,
222
+ // // singer: string
223
+ // // ) {
224
+ // // let tx = new TransactionBlock();
225
+ // // const kioskTx = new KioskTransaction({ transactionBlock: tx, kioskClient });
226
+ // // kioskTx.create();
227
+ // // // @ts-ignore
228
+ // // kioskTx.lock({ itemType: `${nftPackageId}::typus_nft::Tails`, itemId: nft_id, policy, item: nft_id });
229
+ // // const { kiosk, kioskCap } = kioskTx;
230
+ // // if (kiosk && kioskCap) {
231
+ // // tx.moveCall({
232
+ // // target: `0x2::transfer::public_share_object`,
233
+ // // typeArguments: [KIOSK_TYPE],
234
+ // // arguments: [kiosk],
235
+ // // });
236
+ // // tx.transferObjects([kioskCap], tx.pure(singer));
237
+ // // tx.setGasBudget(gasBudget);
238
+ // // } else {
239
+ // // console.error("Fail to Create Kiosk Tx!!");
240
+ // // }
241
+ // // return tx;
242
+ // // }
243
+ // /**
244
+ // public fun unstake_nft(
245
+ // registry: &mut Registry,
246
+ // kiosk: &mut Kiosk,
247
+ // kiosk_cap: &KioskOwnerCap,
248
+ // coin: Coin<SUI>,
249
+ // ctx: &mut TxContext
250
+ // )
251
+ // */
252
+ // // export async function getUnstakeNftTx(
253
+ // // gasBudget: number,
254
+ // // nftPackageId: string,
255
+ // // registry: string,
256
+ // // typeArguments: string[],
257
+ // // kioskOwnerCap: kioskOwnerCap,
258
+ // // personalKioskPackageId: string
259
+ // // ) {
260
+ // // let tx = new TransactionBlock();
261
+ // // // tx.moveCall({
262
+ // // // target: `${nftPackageId}::tails_staking::snapshot`,
263
+ // // // typeArguments: [],
264
+ // // // arguments: [tx.object(registry), tx.object(CLOCK)],
265
+ // // // });
266
+ // // tx.moveCall({
267
+ // // target: `${nftPackageId}::tails_staking::claim_profit_sharing`,
268
+ // // typeArguments,
269
+ // // arguments: [tx.object(registry), tx.pure("dice_profit")],
270
+ // // });
271
+ // // tx.moveCall({
272
+ // // target: `${nftPackageId}::tails_staking::claim_profit_sharing`,
273
+ // // typeArguments,
274
+ // // arguments: [tx.object(registry), tx.pure("exp_profit")],
275
+ // // });
276
+ // // if (kioskOwnerCap.isPersonal) {
277
+ // // const [personalKioskCap, borrow] = tx.moveCall({
278
+ // // target: `${personalKioskPackageId}::personal_kiosk::borrow_val`,
279
+ // // arguments: [tx.object(kioskOwnerCap.objectId)],
280
+ // // });
281
+ // // tx.moveCall({
282
+ // // target: `${nftPackageId}::tails_staking::unstake_nft`,
283
+ // // typeArguments: [],
284
+ // // arguments: [tx.object(registry), tx.object(kioskOwnerCap.kioskId), tx.object(personalKioskCap)],
285
+ // // });
286
+ // // tx.moveCall({
287
+ // // target: `${personalKioskPackageId}::personal_kiosk::return_val`,
288
+ // // arguments: [tx.object(kioskOwnerCap.objectId), personalKioskCap, borrow],
289
+ // // });
290
+ // // } else {
291
+ // // tx.moveCall({
292
+ // // target: `${nftPackageId}::tails_staking::unstake_nft`,
293
+ // // typeArguments: [],
294
+ // // arguments: [tx.object(registry), tx.object(kioskOwnerCap.kioskId), tx.object(kioskOwnerCap.objectId)],
295
+ // // });
296
+ // // }
297
+ // // tx.setGasBudget(gasBudget);
298
+ // // return tx;
299
+ // // }
300
+ // /**
301
+ // public fun daily_attend(
302
+ // registry: &mut Registry,
303
+ // clock: &Clock,
304
+ // ctx: &mut TxContext
305
+ // )
306
+ // */
307
+ // // export async function getDailyAttendTx(gasBudget: number, nftPackageId: string, registry: string) {
308
+ // // let tx = new TransactionBlock();
309
+ // // tx.moveCall({
310
+ // // target: `${nftPackageId}::tails_staking::daily_attend`,
311
+ // // typeArguments: [],
312
+ // // arguments: [tx.object(registry), tx.object(CLOCK)],
313
+ // // });
314
+ // // tx.setGasBudget(gasBudget);
315
+ // // return tx;
316
+ // // }
317
+ // /**
318
+ // entry fun snapshot(
319
+ // registry: &mut Registry,
320
+ // clock: &Clock,
321
+ // ctx: &mut TxContext
322
+ // )
323
+ // */
324
+ // // export async function getSnapshotTx(
325
+ // // gasBudget: number,
326
+ // // typusEcosystemVersion: string,
327
+ // // typusUserRegistry: string,
328
+ // // nftPackageId: string,
329
+ // // registry: string,
330
+ // // amount: string
331
+ // // ) {
332
+ // // let tx = new TransactionBlock();
333
+ // // tx.moveCall({
334
+ // // target: `${nftPackageId}::tails_staking::snapshot`,
335
+ // // typeArguments: [],
336
+ // // arguments: [tx.object(typusEcosystemVersion), tx.object(typusUserRegistry), tx.object(registry), tx.pure(amount)],
337
+ // // });
338
+ // // tx.setGasBudget(gasBudget);
339
+ // // return tx;
340
+ // // }
341
+ // // export async function getNewBidTx(
342
+ // // gasBudget: number,
343
+ // // packageId: string,
344
+ // // typeArguments: string[],
345
+ // // registry: string,
346
+ // // additional_config_registry: string,
347
+ // // index: string,
348
+ // // priceOracle: string,
349
+ // // coins: string[],
350
+ // // size: string,
351
+ // // premium_required: string, // fe float * b_token_decimal
352
+ // // usingSponsoredGasCoin = false
353
+ // // ) {
354
+ // // let tx = new TransactionBlock();
355
+ // // if (
356
+ // // !usingSponsoredGasCoin &&
357
+ // // (typeArguments[1] == "0x2::sui::SUI" ||
358
+ // // typeArguments[1] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI")
359
+ // // ) {
360
+ // // let [coin] = tx.splitCoins(tx.gas, [tx.pure(premium_required)]);
361
+ // // tx.moveCall({
362
+ // // target: `${packageId}::tails_staking::new_bid`,
363
+ // // typeArguments,
364
+ // // arguments: [
365
+ // // tx.pure(registry),
366
+ // // tx.pure(additional_config_registry),
367
+ // // tx.pure(index),
368
+ // // tx.pure(priceOracle),
369
+ // // tx.pure("0x6"),
370
+ // // tx.makeMoveVec({ objects: [coin] }),
371
+ // // tx.pure(size),
372
+ // // ],
373
+ // // });
374
+ // // } else {
375
+ // // tx.moveCall({
376
+ // // target: `${packageId}::tails_staking::new_bid`,
377
+ // // typeArguments,
378
+ // // arguments: [
379
+ // // tx.pure(registry),
380
+ // // tx.pure(additional_config_registry),
381
+ // // tx.pure(index),
382
+ // // tx.pure(priceOracle),
383
+ // // tx.pure("0x6"),
384
+ // // tx.makeMoveVec({ objects: coins.map((id) => tx.object(id)) }),
385
+ // // tx.pure(size),
386
+ // // ],
387
+ // // });
388
+ // // }
389
+ // // tx.setGasBudget(gasBudget);
390
+ // // return tx;
391
+ // // }
392
+ // // export async function getDepositTx(
393
+ // // gasBudget: number,
394
+ // // packageId: string,
395
+ // // typeArguments: string[],
396
+ // // registry: string,
397
+ // // additional_config_registry: string,
398
+ // // index: string,
399
+ // // coins: string[],
400
+ // // amount: string,
401
+ // // usingSponsoredGasCoin = false
402
+ // // ) {
403
+ // // let tx = new TransactionBlock();
404
+ // // if (
405
+ // // !usingSponsoredGasCoin &&
406
+ // // (typeArguments[0] == "0x2::sui::SUI" ||
407
+ // // typeArguments[0] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI")
408
+ // // ) {
409
+ // // let [coin] = tx.splitCoins(tx.gas, [tx.pure(amount)]);
410
+ // // tx.moveCall({
411
+ // // target: `${packageId}::tails_staking::deposit`,
412
+ // // typeArguments,
413
+ // // arguments: [
414
+ // // tx.pure(registry),
415
+ // // tx.pure(additional_config_registry),
416
+ // // tx.pure(index),
417
+ // // tx.makeMoveVec({ objects: [coin] }),
418
+ // // tx.pure(amount),
419
+ // // tx.object(CLOCK),
420
+ // // ],
421
+ // // });
422
+ // // } else {
423
+ // // tx.moveCall({
424
+ // // target: `${packageId}::tails_staking::deposit`,
425
+ // // typeArguments,
426
+ // // arguments: [
427
+ // // tx.pure(registry),
428
+ // // tx.pure(additional_config_registry),
429
+ // // tx.pure(index),
430
+ // // tx.makeMoveVec({ objects: coins.map((id) => tx.object(id)) }),
431
+ // // tx.pure(amount),
432
+ // // tx.object(CLOCK),
433
+ // // ],
434
+ // // });
435
+ // // }
436
+ // // tx.setGasBudget(gasBudget);
437
+ // // return tx;
438
+ // // }
439
+ // // export async function getCompoundTx(
440
+ // // gasBudget: number,
441
+ // // packageId: string,
442
+ // // typeArguments: string[],
443
+ // // registry: string,
444
+ // // additional_config_registry: string,
445
+ // // index: string
446
+ // // ) {
447
+ // // let tx = new TransactionBlock();
448
+ // // tx.moveCall({
449
+ // // target: `${packageId}::tails_staking::compound`,
450
+ // // typeArguments,
451
+ // // arguments: [tx.pure(registry), tx.pure(additional_config_registry), tx.pure(index), tx.object(CLOCK)],
452
+ // // });
453
+ // // tx.setGasBudget(gasBudget);
454
+ // // return tx;
455
+ // // }
456
+ // // export async function getWithdrawTx(
457
+ // // gasBudget: number,
458
+ // // packageId: string,
459
+ // // typeArguments: string[],
460
+ // // registry: string,
461
+ // // additional_config_registry: string,
462
+ // // index: string,
463
+ // // share?: string
464
+ // // ) {
465
+ // // let tx = new TransactionBlock();
466
+ // // tx.moveCall({
467
+ // // target: `${packageId}::tails_staking::withdraw`,
468
+ // // typeArguments,
469
+ // // arguments: [
470
+ // // tx.pure(registry),
471
+ // // tx.pure(additional_config_registry),
472
+ // // tx.pure(index),
473
+ // // tx.pure(share ? [share] : []),
474
+ // // tx.object(CLOCK),
475
+ // // ],
476
+ // // });
477
+ // // tx.setGasBudget(gasBudget);
478
+ // // return tx;
479
+ // // }
480
+ // // export async function getUnsubscribeTx(
481
+ // // gasBudget: number,
482
+ // // packageId: string,
483
+ // // typeArguments: string[],
484
+ // // registry: string,
485
+ // // additional_config_registry: string,
486
+ // // index: string,
487
+ // // share?: string
488
+ // // ) {
489
+ // // let tx = new TransactionBlock();
490
+ // // tx.moveCall({
491
+ // // target: `${packageId}::tails_staking::unsubscribe`,
492
+ // // typeArguments,
493
+ // // arguments: [
494
+ // // tx.pure(registry),
495
+ // // tx.pure(additional_config_registry),
496
+ // // tx.pure(index),
497
+ // // tx.pure(share ? [share] : []),
498
+ // // tx.object(CLOCK),
499
+ // // ],
500
+ // // });
501
+ // // tx.setGasBudget(gasBudget);
502
+ // // return tx;
503
+ // // }
504
+ // /**
505
+ // public fun level_up(
506
+ // registry: &mut Registry,
507
+ // ctx: &mut TxContext
508
+ // )
509
+ // */
510
+ // // export async function getLevelUpTx(gasBudget: number, nftPackageId: string, registry: string) {
511
+ // // let tx = new TransactionBlock();
512
+ // // tx.moveCall({
513
+ // // target: `${nftPackageId}::tails_staking::level_up`,
514
+ // // typeArguments: [],
515
+ // // arguments: [tx.object(registry)],
516
+ // // });
517
+ // // tx.setGasBudget(gasBudget);
518
+ // // return tx;
519
+ // // }
520
+ // /**
521
+ // entry fun consume_exp_coin_unstaked<EXP_COIN>(
522
+ // registry: &mut Registry,
523
+ // kiosk: &mut Kiosk,
524
+ // kiosk_cap: &KioskOwnerCap,
525
+ // id: ID,
526
+ // exp_coin: Coin<EXP_COIN>,
527
+ // ctx: &mut TxContext
528
+ // )
529
+ // */
530
+ // // export async function consumeExpCoinUnstakedTx(
531
+ // // gasBudget: number,
532
+ // // nftPackageId: string,
533
+ // // typeArguments: string[],
534
+ // // registry: string,
535
+ // // personalKioskPackageId: string,
536
+ // // tails_id: TailsId,
537
+ // // exp_coins: string[],
538
+ // // amount: string
539
+ // // ) {
540
+ // // let tx = new TransactionBlock();
541
+ // // const coin = exp_coins.pop()!;
542
+ // // if (exp_coins.length > 0) {
543
+ // // tx.mergeCoins(
544
+ // // tx.object(coin),
545
+ // // exp_coins.map((id) => tx.object(id))
546
+ // // );
547
+ // // }
548
+ // // let [input_coin] = tx.splitCoins(tx.object(coin), [tx.pure(amount)]);
549
+ // // if (tails_id.isPersonal) {
550
+ // // const [personalKioskCap, borrow] = tx.moveCall({
551
+ // // target: `${personalKioskPackageId}::personal_kiosk::borrow_val`,
552
+ // // arguments: [tx.object(tails_id.kioskCap)],
553
+ // // });
554
+ // // tx.moveCall({
555
+ // // target: `${nftPackageId}::tails_staking::consume_exp_coin_unstaked`,
556
+ // // typeArguments,
557
+ // // arguments: [tx.object(registry), tx.object(tails_id.kiosk), personalKioskCap, tx.pure(tails_id.nftId), input_coin],
558
+ // // });
559
+ // // tx.moveCall({
560
+ // // target: `${personalKioskPackageId}::personal_kiosk::return_val`,
561
+ // // arguments: [tx.object(tails_id.kioskCap), personalKioskCap, borrow],
562
+ // // });
563
+ // // } else {
564
+ // // tx.moveCall({
565
+ // // target: `${nftPackageId}::tails_staking::consume_exp_coin_unstaked`,
566
+ // // typeArguments,
567
+ // // arguments: [tx.object(registry), tx.object(tails_id.kiosk), tx.object(tails_id.kioskCap), tx.pure(tails_id.nftId), input_coin],
568
+ // // });
569
+ // // }
570
+ // // tx.setGasBudget(gasBudget);
571
+ // // return tx;
572
+ // // }
573
+ // /**
574
+ // entry fun consume_exp_coin_staked<EXP_COIN>(
575
+ // registry: &mut Registry,
576
+ // exp_coin: Coin<EXP_COIN>,
577
+ // ctx: &mut TxContext
578
+ // )
579
+ // */
580
+ // // export async function consumeExpCoinStakedTx(
581
+ // // gasBudget: number,
582
+ // // nftPackageId: string,
583
+ // // typeArguments: string[],
584
+ // // registry: string,
585
+ // // exp_coins: string[],
586
+ // // amount: string
587
+ // // ) {
588
+ // // let tx = new TransactionBlock();
589
+ // // const coin = exp_coins.pop()!;
590
+ // // if (exp_coins.length > 0) {
591
+ // // tx.mergeCoins(
592
+ // // tx.object(coin),
593
+ // // exp_coins.map((id) => tx.object(id))
594
+ // // );
595
+ // // }
596
+ // // let [input_coin] = tx.splitCoins(tx.object(coin), [tx.pure(amount)]);
597
+ // // tx.moveCall({
598
+ // // target: `${nftPackageId}::tails_staking::consume_exp_coin_staked`,
599
+ // // typeArguments,
600
+ // // arguments: [tx.object(registry), input_coin],
601
+ // // });
602
+ // // tx.setGasBudget(gasBudget);
603
+ // // return tx;
604
+ // // }
605
+ // // export async function getClaimProfitSharingTx(
606
+ // // gasBudget: number,
607
+ // // packageId: string,
608
+ // // registry: string,
609
+ // // name: "dice_profit" | "exp_profit",
610
+ // // typeArguments: string[]
611
+ // // ) {
612
+ // // let tx = new TransactionBlock();
613
+ // // tx.moveCall({
614
+ // // target: `${packageId}::tails_staking::claim_profit_sharing`,
615
+ // // typeArguments,
616
+ // // arguments: [tx.object(registry), tx.pure(name)],
617
+ // // });
618
+ // // tx.setGasBudget(gasBudget);
619
+ // // return tx;
620
+ // // }