@typus/typus-sdk 1.2.69 → 1.2.70

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,6 +1,6 @@
1
1
  import { TransactionBlock } from "@mysten/sui.js/transactions";
2
2
  import { KioskClient } from "@mysten/kiosk";
3
- import { TailsId } from "../typus-nft/fetch";
3
+ import { TailsId, kioskOwnerCap } from "../typus-nft/fetch";
4
4
  /**
5
5
  entry fun transfer_nft(
6
6
  registry: &mut Registry,
@@ -35,7 +35,7 @@ export declare function getCreateKioskAndLockNftTx(kioskClient: KioskClient, gas
35
35
  ctx: &mut TxContext
36
36
  )
37
37
  */
38
- export declare function getUnstakeNftTx(gasBudget: number, nftPackageId: string, registry: string, kiosk: string, kiosk_cap: string, typeArguments: string[]): Promise<TransactionBlock>;
38
+ export declare function getUnstakeNftTx(gasBudget: number, nftPackageId: string, registry: string, typeArguments: string[], kioskOwnerCap: kioskOwnerCap, personalKioskPackageId: string): Promise<TransactionBlock>;
39
39
  /**
40
40
  public fun daily_attend(
41
41
  registry: &mut Registry,
@@ -302,10 +302,10 @@ exports.getCreateKioskAndLockNftTx = getCreateKioskAndLockNftTx;
302
302
  ctx: &mut TxContext
303
303
  )
304
304
  */
305
- function getUnstakeNftTx(gasBudget, nftPackageId, registry, kiosk, kiosk_cap, typeArguments) {
305
+ function getUnstakeNftTx(gasBudget, nftPackageId, registry, typeArguments, kioskOwnerCap, personalKioskPackageId) {
306
306
  return __awaiter(this, void 0, void 0, function () {
307
- var tx;
308
- return __generator(this, function (_a) {
307
+ var tx, _a, personalKioskCap, borrow;
308
+ return __generator(this, function (_b) {
309
309
  tx = new transactions_1.TransactionBlock();
310
310
  tx.moveCall({
311
311
  target: "".concat(nftPackageId, "::tails_staking::snapshot"),
@@ -322,11 +322,28 @@ function getUnstakeNftTx(gasBudget, nftPackageId, registry, kiosk, kiosk_cap, ty
322
322
  typeArguments: typeArguments,
323
323
  arguments: [tx.object(registry), tx.pure("exp_profit")],
324
324
  });
325
- tx.moveCall({
326
- target: "".concat(nftPackageId, "::tails_staking::unstake_nft"),
327
- typeArguments: [],
328
- arguments: [tx.object(registry), tx.object(kiosk), tx.object(kiosk_cap)],
329
- });
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
+ }
330
347
  tx.setGasBudget(gasBudget);
331
348
  return [2 /*return*/, tx];
332
349
  });
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typus/typus-sdk",
3
3
  "author": "Typus",
4
4
  "description": "typus sdk",
5
- "version": "1.2.69",
5
+ "version": "1.2.70",
6
6
  "dependencies": {
7
7
  "@mysten/bcs": "^0.7.3",
8
8
  "@mysten/kiosk": "0.7.12",