@typus/typus-sdk 1.1.1 → 1.1.3

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.
@@ -62,3 +62,22 @@ export declare function getUnsubscribeTx(gasBudget: number, packageId: string, t
62
62
  )
63
63
  */
64
64
  export declare function getLevelUpTx(gasBudget: number, nftPackageId: string, registry: string): Promise<TransactionBlock>;
65
+ /**
66
+ entry fun consume_exp_coin_unstaked<EXP_COIN>(
67
+ registry: &mut Registry,
68
+ kiosk: &mut Kiosk,
69
+ kiosk_cap: &KioskOwnerCap,
70
+ id: ID,
71
+ exp_coin: Coin<EXP_COIN>,
72
+ ctx: &mut TxContext
73
+ )
74
+ */
75
+ export declare function consumeExpCoinUnstakedTx(gasBudget: number, nftPackageId: string, typeArguments: string[], registry: string, kiosk: string, kiosk_cap: string, nft_id: string, exp_coins: string[]): Promise<TransactionBlock>;
76
+ /**
77
+ entry fun consume_exp_coin_staked<EXP_COIN>(
78
+ registry: &mut Registry,
79
+ exp_coin: Coin<EXP_COIN>,
80
+ ctx: &mut TxContext
81
+ )
82
+ */
83
+ export declare function consumeExpCoinStakedTx(gasBudget: number, nftPackageId: string, typeArguments: string[], registry: string, exp_coins: string[]): Promise<TransactionBlock>;
@@ -52,7 +52,7 @@ var __read = (this && this.__read) || function (o, n) {
52
52
  return ar;
53
53
  };
54
54
  Object.defineProperty(exports, "__esModule", { value: true });
55
- exports.getLevelUpTx = exports.getUnsubscribeTx = exports.getWithdrawTx = exports.getCompoundTx = exports.getDepositTx = exports.getNewBidTx = exports.getSnapshotTx = exports.getDailyAttendTx = exports.getUnstakeNftTx = exports.getCreateKioskAndLockNftTx = exports.getStakeNftTx = exports.getTransferNftsTx = exports.getTransferNftTx = void 0;
55
+ 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.getStakeNftTx = exports.getTransferNftsTx = exports.getTransferNftTx = void 0;
56
56
  var sui_js_1 = require("@mysten/sui.js");
57
57
  var constants_1 = require("../../constants");
58
58
  var kiosk_1 = require("@mysten/kiosk");
@@ -403,3 +403,60 @@ function getLevelUpTx(gasBudget, nftPackageId, registry) {
403
403
  });
404
404
  }
405
405
  exports.getLevelUpTx = getLevelUpTx;
406
+ /**
407
+ entry fun consume_exp_coin_unstaked<EXP_COIN>(
408
+ registry: &mut Registry,
409
+ kiosk: &mut Kiosk,
410
+ kiosk_cap: &KioskOwnerCap,
411
+ id: ID,
412
+ exp_coin: Coin<EXP_COIN>,
413
+ ctx: &mut TxContext
414
+ )
415
+ */
416
+ function consumeExpCoinUnstakedTx(gasBudget, nftPackageId, typeArguments, registry, kiosk, kiosk_cap, nft_id, exp_coins) {
417
+ return __awaiter(this, void 0, void 0, function () {
418
+ var tx, coin;
419
+ return __generator(this, function (_a) {
420
+ tx = new sui_js_1.TransactionBlock();
421
+ coin = exp_coins.pop();
422
+ if (exp_coins.length > 0) {
423
+ tx.mergeCoins(tx.object(coin), exp_coins.map(function (id) { return tx.object(id); }));
424
+ }
425
+ tx.moveCall({
426
+ target: "".concat(nftPackageId, "::tails_staking::consume_exp_coin_unstaked"),
427
+ typeArguments: typeArguments,
428
+ arguments: [tx.object(registry), tx.object(kiosk), tx.object(kiosk_cap), tx.object(nft_id), tx.object(coin)],
429
+ });
430
+ tx.setGasBudget(gasBudget);
431
+ return [2 /*return*/, tx];
432
+ });
433
+ });
434
+ }
435
+ exports.consumeExpCoinUnstakedTx = consumeExpCoinUnstakedTx;
436
+ /**
437
+ entry fun consume_exp_coin_staked<EXP_COIN>(
438
+ registry: &mut Registry,
439
+ exp_coin: Coin<EXP_COIN>,
440
+ ctx: &mut TxContext
441
+ )
442
+ */
443
+ function consumeExpCoinStakedTx(gasBudget, nftPackageId, typeArguments, registry, exp_coins) {
444
+ return __awaiter(this, void 0, void 0, function () {
445
+ var tx, coin;
446
+ return __generator(this, function (_a) {
447
+ tx = new sui_js_1.TransactionBlock();
448
+ coin = exp_coins.pop();
449
+ if (exp_coins.length > 0) {
450
+ tx.mergeCoins(tx.object(coin), exp_coins.map(function (id) { return tx.object(id); }));
451
+ }
452
+ tx.moveCall({
453
+ target: "".concat(nftPackageId, "::tails_staking::consume_exp_coin_staked"),
454
+ typeArguments: typeArguments,
455
+ arguments: [tx.object(registry), tx.object(coin)],
456
+ });
457
+ tx.setGasBudget(gasBudget);
458
+ return [2 /*return*/, tx];
459
+ });
460
+ });
461
+ }
462
+ exports.consumeExpCoinStakedTx = consumeExpCoinStakedTx;
@@ -176,3 +176,24 @@ export interface DepositShare {
176
176
  export declare function getDepositShares(provider: JsonRpcProvider, typusFrameworkPackageId: string, packageId: string, registry: string, receipts: string[]): Promise<{
177
177
  [key: string]: DepositShare;
178
178
  }>;
179
+ export interface BidVault {
180
+ id: string;
181
+ depositToken: string;
182
+ bidToken: string;
183
+ incentiveToken: string | undefined;
184
+ index: string;
185
+ shareSupply: string;
186
+ metadata: string;
187
+ u64Padding: string[];
188
+ bcsPadding: string[];
189
+ }
190
+ export interface BidShare {
191
+ bidVault: BidVault;
192
+ share: string;
193
+ }
194
+ export declare function getMyBids(provider: JsonRpcProvider, typusFrameworkPackageId: string, packageId: string, registry: string, receipts: string[]): Promise<{
195
+ [key: string]: BidShare;
196
+ }>;
197
+ export declare function getRefundShares(provider: JsonRpcProvider, packageId: string, registry: string, user: string, typeArguments: string[]): Promise<{
198
+ [key: string]: string;
199
+ }>;
@@ -52,7 +52,7 @@ var __read = (this && this.__read) || function (o, n) {
52
52
  return ar;
53
53
  };
54
54
  Object.defineProperty(exports, "__esModule", { value: true });
55
- exports.getDepositShares = exports.getAuctionBids = exports.getAuctions = exports.getVaults = exports.SENDER = void 0;
55
+ exports.getRefundShares = exports.getMyBids = exports.getDepositShares = exports.getAuctionBids = exports.getAuctions = exports.getVaults = exports.SENDER = void 0;
56
56
  var sui_js_1 = require("@mysten/sui.js");
57
57
  var bcs_1 = require("@mysten/bcs");
58
58
  var tools_1 = require("../tools");
@@ -451,48 +451,108 @@ function getDepositShares(provider, typusFrameworkPackageId, packageId, registry
451
451
  });
452
452
  }
453
453
  exports.getDepositShares = getDepositShares;
454
- // export interface BidShare {
455
- // index: string;
456
- // share: string;
457
- // }
458
- // export async function getBidShares(
459
- // provider: JsonRpcProvider,
460
- // typusFrameworkPackageId: string,
461
- // packageId: string,
462
- // registry: string,
463
- // receipts: string[]
464
- // ): Promise<{ [key: string]: BidShare }> {
465
- // let transactionBlock = new TransactionBlock();
466
- // let target = `${packageId}::tds_view_function::get_bid_shares_bcs` as any;
467
- // let transactionBlockArguments = [
468
- // transactionBlock.pure(registry),
469
- // transactionBlock.makeMoveVec({
470
- // type: `${typusFrameworkPackageId}::vault::TypusBidReceipt`,
471
- // objects: receipts.map((id) => transactionBlock.object(id)),
472
- // }),
473
- // ];
474
- // transactionBlock.moveCall({
475
- // target,
476
- // typeArguments: [],
477
- // arguments: transactionBlockArguments,
478
- // });
479
- // let results = (await provider.devInspectTransactionBlock({ transactionBlock, sender: SENDER })).results;
480
- // // @ts-ignore
481
- // let bytes = results[results.length - 1].returnValues[0][0];
482
- // let reader = new BcsReader(new Uint8Array(bytes));
483
- // let result = Array.from(new Map()).reduce((map, [key, value]) => {
484
- // map[key] = value;
485
- // return map;
486
- // }, {});
487
- // reader.readVec((reader, i) => {
488
- // reader.read8();
489
- // let index = reader.read64();
490
- // let share = reader.read64();
491
- // result[index] = {
492
- // index: reader.read64(),
493
- // share: reader.read64(),
494
- // } as BidShare;
495
- // });
496
- // // @ts-ignore
497
- // return result;
498
- // }
454
+ function getMyBids(provider, typusFrameworkPackageId, packageId, registry, receipts) {
455
+ return __awaiter(this, void 0, void 0, function () {
456
+ var transactionBlock, target, transactionBlockArguments, results, bytes, reader, result;
457
+ return __generator(this, function (_a) {
458
+ switch (_a.label) {
459
+ case 0:
460
+ transactionBlock = new sui_js_1.TransactionBlock();
461
+ target = "".concat(packageId, "::tds_view_function::get_my_bids_bcs");
462
+ transactionBlockArguments = [
463
+ transactionBlock.pure(registry),
464
+ transactionBlock.makeMoveVec({
465
+ type: "".concat(typusFrameworkPackageId, "::vault::TypusBidReceipt"),
466
+ objects: receipts.map(function (id) { return transactionBlock.object(id); }),
467
+ }),
468
+ ];
469
+ transactionBlock.moveCall({
470
+ target: target,
471
+ typeArguments: [],
472
+ arguments: transactionBlockArguments,
473
+ });
474
+ return [4 /*yield*/, provider.devInspectTransactionBlock({ transactionBlock: transactionBlock, sender: exports.SENDER })];
475
+ case 1:
476
+ results = (_a.sent()).results;
477
+ bytes = results[results.length - 1].returnValues[0][0];
478
+ reader = new bcs_1.BcsReader(new Uint8Array(bytes));
479
+ result = Array.from(new Map()).reduce(function (map, _a) {
480
+ var _b = __read(_a, 2), key = _b[0], value = _b[1];
481
+ map[key] = value;
482
+ return map;
483
+ }, {});
484
+ reader.readVec(function (reader, i) {
485
+ reader.read16();
486
+ var bidVault = {
487
+ id: (0, tools_1.AddressFromBytes)(reader.readBytes(32)),
488
+ depositToken: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.read8()))),
489
+ bidToken: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.read8()))),
490
+ incentiveToken: reader
491
+ .readVec(function (reader) {
492
+ return String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.read8())));
493
+ })
494
+ .at(0),
495
+ index: reader.read64(),
496
+ shareSupply: reader.read64(),
497
+ metadata: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.read8()))),
498
+ u64Padding: reader.readVec(function (reader) {
499
+ return reader.read64();
500
+ }),
501
+ bcsPadding: reader.readVec(function (reader) {
502
+ return reader.read8();
503
+ }),
504
+ };
505
+ result[bidVault.index] = {
506
+ bidVault: bidVault,
507
+ share: reader.read64(),
508
+ };
509
+ });
510
+ // @ts-ignore
511
+ return [2 /*return*/, result];
512
+ }
513
+ });
514
+ });
515
+ }
516
+ exports.getMyBids = getMyBids;
517
+ function getRefundShares(provider, packageId, registry, user, typeArguments) {
518
+ return __awaiter(this, void 0, void 0, function () {
519
+ var transactionBlock, target, transactionBlockArguments, results, refundShares;
520
+ return __generator(this, function (_a) {
521
+ switch (_a.label) {
522
+ case 0:
523
+ transactionBlock = new sui_js_1.TransactionBlock();
524
+ target = "".concat(packageId, "::tds_view_function::get_refund_shares_bcs");
525
+ transactionBlockArguments = [transactionBlock.pure(registry)];
526
+ typeArguments.forEach(function (typeArgument) {
527
+ transactionBlock.moveCall({
528
+ target: target,
529
+ typeArguments: [typeArgument],
530
+ arguments: transactionBlockArguments,
531
+ });
532
+ });
533
+ return [4 /*yield*/, provider.devInspectTransactionBlock({
534
+ transactionBlock: transactionBlock,
535
+ sender: user,
536
+ })];
537
+ case 1:
538
+ results = (_a.sent()).results;
539
+ refundShares = Array.from(new Map()).reduce(function (map, _a) {
540
+ var _b = __read(_a, 2), key = _b[0], value = _b[1];
541
+ map[key] = value;
542
+ return map;
543
+ }, {});
544
+ // @ts-ignore
545
+ results.forEach(function (result) {
546
+ // @ts-ignore
547
+ var bytes = result.returnValues[0][0];
548
+ var reader = new bcs_1.BcsReader(new Uint8Array(bytes));
549
+ reader.read8();
550
+ refundShares[String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.read8())))] = reader.read64();
551
+ });
552
+ // @ts-ignore
553
+ return [2 /*return*/, refundShares];
554
+ }
555
+ });
556
+ });
557
+ }
558
+ exports.getRefundShares = getRefundShares;
@@ -6,7 +6,7 @@ import { TransactionArgument, TransactionBlock } from "@mysten/sui.js";
6
6
  ctx: &mut TxContext,
7
7
  )
8
8
  */
9
- export declare function getMintTx(gasBudget: number, nftPackageId: string, pool: string, whitelist_token: string): Promise<TransactionBlock>;
9
+ export declare function getMintTx(gasBudget: number, nftPackageId: string, policy: string, pool: string, whitelist_token: string): Promise<TransactionBlock>;
10
10
  /**
11
11
  entry fun free_mint_into_kiosk(
12
12
  pool: &mut Pool,
@@ -16,7 +16,7 @@ export declare function getMintTx(gasBudget: number, nftPackageId: string, pool:
16
16
  ctx: &mut TxContext,
17
17
  )
18
18
  */
19
- export declare function getMintToKioskTx(gasBudget: number, nftPackageId: string, pool: string, whitelist_token: string, kiosk: string, kiosk_cap: string): Promise<TransactionBlock>;
19
+ export declare function getMintToKioskTx(gasBudget: number, nftPackageId: string, pool: string, policy: string, whitelist_token: string, kiosk: string, kiosk_cap: string): Promise<TransactionBlock>;
20
20
  /**
21
21
  public fun pay<T>(
22
22
  policy: &mut TransferPolicy<T>,
@@ -46,7 +46,7 @@ var constants_1 = require("../../constants");
46
46
  ctx: &mut TxContext,
47
47
  )
48
48
  */
49
- function getMintTx(gasBudget, nftPackageId, pool, whitelist_token) {
49
+ function getMintTx(gasBudget, nftPackageId, policy, pool, whitelist_token) {
50
50
  return __awaiter(this, void 0, void 0, function () {
51
51
  var tx;
52
52
  return __generator(this, function (_a) {
@@ -54,7 +54,7 @@ function getMintTx(gasBudget, nftPackageId, pool, whitelist_token) {
54
54
  tx.moveCall({
55
55
  target: "".concat(nftPackageId, "::typus_nft::free_mint"),
56
56
  typeArguments: [],
57
- arguments: [tx.object(pool), tx.object(whitelist_token), tx.object(constants_1.CLOCK)],
57
+ arguments: [tx.object(pool), tx.object(policy), tx.object(whitelist_token), tx.object(constants_1.CLOCK)],
58
58
  });
59
59
  tx.setGasBudget(gasBudget);
60
60
  return [2 /*return*/, tx];
@@ -71,7 +71,7 @@ exports.getMintTx = getMintTx;
71
71
  ctx: &mut TxContext,
72
72
  )
73
73
  */
74
- function getMintToKioskTx(gasBudget, nftPackageId, pool, whitelist_token, kiosk, kiosk_cap) {
74
+ function getMintToKioskTx(gasBudget, nftPackageId, pool, policy, whitelist_token, kiosk, kiosk_cap) {
75
75
  return __awaiter(this, void 0, void 0, function () {
76
76
  var tx;
77
77
  return __generator(this, function (_a) {
@@ -79,7 +79,14 @@ function getMintToKioskTx(gasBudget, nftPackageId, pool, whitelist_token, kiosk,
79
79
  tx.moveCall({
80
80
  target: "".concat(nftPackageId, "::typus_nft::free_mint_into_kiosk"),
81
81
  typeArguments: [],
82
- arguments: [tx.object(pool), tx.object(whitelist_token), tx.object(kiosk), tx.object(kiosk_cap), tx.object(constants_1.CLOCK)],
82
+ arguments: [
83
+ tx.object(pool),
84
+ tx.object(policy),
85
+ tx.object(whitelist_token),
86
+ tx.object(kiosk),
87
+ tx.object(kiosk_cap),
88
+ tx.object(constants_1.CLOCK),
89
+ ],
83
90
  });
84
91
  tx.setGasBudget(gasBudget);
85
92
  return [2 /*return*/, tx];
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.1.1",
5
+ "version": "1.1.3",
6
6
  "dependencies": {
7
7
  "@mysten/bcs": "^0.7.3",
8
8
  "@mysten/kiosk": "^0.3.3",