@typus/typus-sdk 1.1.2 → 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.
- package/lib/utils/nft-staking/user-entry.d.ts +19 -0
- package/lib/utils/nft-staking/user-entry.js +58 -1
- package/lib/utils/typus-dov-single-v2/view-function.d.ts +3 -0
- package/lib/utils/typus-dov-single-v2/view-function.js +43 -1
- package/lib/utils/typus-nft/user-entry.d.ts +2 -2
- package/lib/utils/typus-nft/user-entry.js +11 -4
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -194,3 +194,6 @@ export interface BidShare {
|
|
|
194
194
|
export declare function getMyBids(provider: JsonRpcProvider, typusFrameworkPackageId: string, packageId: string, registry: string, receipts: string[]): Promise<{
|
|
195
195
|
[key: string]: BidShare;
|
|
196
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.getMyBids = 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");
|
|
@@ -514,3 +514,45 @@ function getMyBids(provider, typusFrameworkPackageId, packageId, registry, recei
|
|
|
514
514
|
});
|
|
515
515
|
}
|
|
516
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: [
|
|
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];
|