@typus/typus-sdk 1.2.36 → 1.2.37
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/mainnet.json +4 -3
- package/lib/utils/leader-board.d.ts +5 -3
- package/lib/utils/leader-board.js +29 -4
- package/lib/utils/nft-staking/authorized-entry.d.ts +3 -2
- package/lib/utils/nft-staking/authorized-entry.js +22 -6
- package/lib/utils/nft-staking/fetch.d.ts +1 -0
- package/lib/utils/nft-staking/fetch.js +31 -1
- package/lib/utils/nft-staking/user-entry.d.ts +1 -1
- package/lib/utils/nft-staking/user-entry.js +14 -4
- package/lib/utils/typus-nft/fetch.js +1 -1
- package/package.json +1 -1
package/lib/mainnet.json
CHANGED
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"SCALLOP_MARKET": "0xa757975255146dc9686aa823b7838b507f315d704f428cbadad2f4ea061939d9",
|
|
31
31
|
"SCALLOP_REWARD_POOL_FOR_SUI": "0x162250ef72393a4ad3d46294c4e1bdfcb03f04c869d390e7efbfc995353a7ee9",
|
|
32
32
|
"SCALLOP_REWARD_POOL_FOR_USDC": "0xf4268cc9b9413b9bfe09e8966b8de650494c9e5784bf0930759cfef4904daff8",
|
|
33
|
-
"VERSION": "2.12
|
|
33
|
+
"VERSION": "2.18.12",
|
|
34
34
|
"EXP_GUESS_PACKAGE": "0x32d670520a10a87b8c042d2259c2d1f7c319329bafcf6f893ad9aaf01a43db8b",
|
|
35
35
|
"EXP_GUESS_PACKAGE_ORIGIN": "0x32d670520a10a87b8c042d2259c2d1f7c319329bafcf6f893ad9aaf01a43db8b",
|
|
36
36
|
"EXP_GUESS_REGISTRY": "0x70c6cbe6764b315cee1b24f483a0fc8307f047f1fab2a0d4438624845e6ba3f2",
|
|
37
37
|
"FRAMEWORK_PACKAGE": "0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274",
|
|
38
|
-
"SINGLE_COLLATERAL_PACKAGE": "
|
|
38
|
+
"SINGLE_COLLATERAL_PACKAGE": "0x05b81d86deb99c33a46042ee92a0e6665cea64dffa3ad23a114ce08f449b8bdb",
|
|
39
39
|
"SINGLE_COLLATERAL_PACKAGE_ORIGIN": "0x321848bf1ae327a9e022ccb3701940191e02fa193ab160d9c0e49cd3c003de3a",
|
|
40
40
|
"SINGLE_COLLATERAL_REGISTRY": "0x3d70b09359e3ca8301ae0abeda4f2fdf72ce313ba58c919ce568e5f535fd2ea8",
|
|
41
41
|
"SINGLE_COLLATERAL_PORTFOLIO_VAULT_REGISTRY": "0xa1a186d050e3172ef4701c16048c99b11f785969874fa2642b9cbcf59cde7fc0",
|
|
@@ -65,5 +65,6 @@
|
|
|
65
65
|
"sui_network": "0xed5f3eebda1be7cd74ebb883852738996ea4b7d651eb1b5a77bb5d7f221b5b2a",
|
|
66
66
|
"mysten_labs": "0x985a37095c597ecfa072b0f389df689ee4d9c99bcf4b175aa53be52e2e5f25b8",
|
|
67
67
|
"none": "0x88dba869e789d0725ae55fbb446f6e38065b67e1f26b10ec57322b18f4de9892",
|
|
68
|
-
"diceProfitSharing": "0x42ba35a057e38baf19e916b0f9ad5d98bb23b7fc246b4d659fc21c608790e872"
|
|
68
|
+
"diceProfitSharing": "0x42ba35a057e38baf19e916b0f9ad5d98bb23b7fc246b4d659fc21c608790e872",
|
|
69
|
+
"STRATEGY_POOL": "0x2c60ddd50d76beb00faa025962d566359a6ea05b1f7f19ac6bd050f4db8c885c"
|
|
69
70
|
}
|
|
@@ -4,9 +4,11 @@ interface LeaderBoard {
|
|
|
4
4
|
user: string;
|
|
5
5
|
score: number;
|
|
6
6
|
}
|
|
7
|
-
interface
|
|
8
|
-
|
|
7
|
+
export interface ExpLeaderBoard {
|
|
8
|
+
nft_id: string;
|
|
9
9
|
total_exp_earn: number;
|
|
10
|
+
owner: string | undefined;
|
|
10
11
|
}
|
|
11
|
-
export declare function
|
|
12
|
+
export declare function getExpLeaderBoardWithOwner(expLeaderBoard: ExpLeaderBoard[], ownerMap: Map<string, string>): Promise<ExpLeaderBoard[]>;
|
|
13
|
+
export declare function getExpLeaderBoard(startTimestamp: string, endTimestamp?: string): Promise<ExpLeaderBoard[]>;
|
|
12
14
|
export {};
|
|
@@ -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.getExpLeaderBoard = exports.getBidderLeaderBoard = exports.getDepositorLeaderBoard = void 0;
|
|
55
|
+
exports.getExpLeaderBoard = exports.getExpLeaderBoardWithOwner = exports.getBidderLeaderBoard = exports.getDepositorLeaderBoard = void 0;
|
|
56
56
|
var apiUrl = "https://app.sentio.xyz/api/v1/insights/wayne/typus/query";
|
|
57
57
|
var headers = {
|
|
58
58
|
"api-key": "oBOW8DsO1izVrINCy6Tmxga9YcWeOL87O",
|
|
@@ -267,6 +267,17 @@ function getBidderLeaderBoard(startTimestamp, end) {
|
|
|
267
267
|
});
|
|
268
268
|
}
|
|
269
269
|
exports.getBidderLeaderBoard = getBidderLeaderBoard;
|
|
270
|
+
function getExpLeaderBoardWithOwner(expLeaderBoard, ownerMap) {
|
|
271
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
272
|
+
return __generator(this, function (_a) {
|
|
273
|
+
return [2 /*return*/, expLeaderBoard.map(function (l) {
|
|
274
|
+
l.owner = ownerMap.get(l.nft_id);
|
|
275
|
+
return l;
|
|
276
|
+
})];
|
|
277
|
+
});
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
exports.getExpLeaderBoardWithOwner = getExpLeaderBoardWithOwner;
|
|
270
281
|
function getExpLeaderBoard(startTimestamp, endTimestamp) {
|
|
271
282
|
return __awaiter(this, void 0, void 0, function () {
|
|
272
283
|
var apiUrl, headers, _endTimestamp, requestData, jsonData, response, data;
|
|
@@ -278,11 +289,25 @@ function getExpLeaderBoard(startTimestamp, endTimestamp) {
|
|
|
278
289
|
"api-key": "tz3JJ6stG7Fux6ueRSRA5mdpC9U0lozI3",
|
|
279
290
|
"Content-Type": "application/json",
|
|
280
291
|
};
|
|
281
|
-
_endTimestamp = endTimestamp ? endTimestamp : "
|
|
292
|
+
_endTimestamp = endTimestamp ? endTimestamp : "9999999999";
|
|
282
293
|
requestData = {
|
|
283
294
|
sqlQuery: {
|
|
284
|
-
sql:
|
|
285
|
-
|
|
295
|
+
// sql: `SELECT S.distinct_id AS owner, SUM(E.exp_earn) AS total_exp_earn
|
|
296
|
+
// FROM ExpUp E
|
|
297
|
+
// JOIN (
|
|
298
|
+
// SELECT number, distinct_id
|
|
299
|
+
// FROM StakeNft
|
|
300
|
+
// WHERE (number, timestamp) IN (
|
|
301
|
+
// SELECT number, MAX(timestamp) AS max_timestamp
|
|
302
|
+
// FROM StakeNft
|
|
303
|
+
// GROUP BY number
|
|
304
|
+
// )
|
|
305
|
+
// ) S ON E.number = S.number
|
|
306
|
+
// WHERE E.timestamp >= ${startTimestamp} && E.timestamp < ${_endTimestamp}
|
|
307
|
+
// GROUP BY owner
|
|
308
|
+
// ORDER BY total_exp_earn DESC;`,
|
|
309
|
+
sql: "\n SELECT E.nft_id as nft_id, SUM(E.exp_earn) as total_exp_earn\n FROM ExpUp E\n WHERE E.timestamp >= ".concat(startTimestamp, " && E.timestamp < ").concat(_endTimestamp, "\n GROUP BY nft_id\n ORDER BY total_exp_earn DESC;\n "),
|
|
310
|
+
size: 200,
|
|
286
311
|
},
|
|
287
312
|
};
|
|
288
313
|
jsonData = JSON.stringify(requestData);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
2
|
-
export declare function getSetProfitSharingTx(gasBudget: number, packageId: string, registry: string, level_profits: number[], amount: number, coins: string[], typeArguments: string[]): Promise<TransactionBlock>;
|
|
2
|
+
export declare function getSetProfitSharingTx(gasBudget: number, packageId: string, registry: string, name: "dice_profit_sharing" | "exp_profit_sharing", level_profits: number[], amount: number, coins: string[], typeArguments: string[]): Promise<TransactionBlock>;
|
|
3
3
|
export declare function getAllocateProfitSharingTx(gasBudget: number, packageId: string, registry: string, users: string[], typeArguments: string[]): Promise<TransactionBlock>;
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function getAllocateProfitSharingValueTx(gasBudget: number, packageId: string, registry: string, users: string[], values: string[], typeArguments: string[]): Promise<TransactionBlock>;
|
|
5
|
+
export declare function getRemoveProfitSharingTx(gasBudget: number, packageId: string, registry: string, name: "dice_profit_sharing" | "exp_profit_sharing", typeArgumentsRemove: string[]): Promise<TransactionBlock>;
|
|
@@ -52,9 +52,9 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
52
52
|
return ar;
|
|
53
53
|
};
|
|
54
54
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
|
-
exports.getRemoveProfitSharingTx = exports.getAllocateProfitSharingTx = exports.getSetProfitSharingTx = void 0;
|
|
55
|
+
exports.getRemoveProfitSharingTx = exports.getAllocateProfitSharingValueTx = exports.getAllocateProfitSharingTx = exports.getSetProfitSharingTx = void 0;
|
|
56
56
|
var transactions_1 = require("@mysten/sui.js/transactions");
|
|
57
|
-
function getSetProfitSharingTx(gasBudget, packageId, registry, level_profits, amount, coins, typeArguments) {
|
|
57
|
+
function getSetProfitSharingTx(gasBudget, packageId, registry, name, level_profits, amount, coins, typeArguments) {
|
|
58
58
|
return __awaiter(this, void 0, void 0, function () {
|
|
59
59
|
var tx, _a, input_coin, coin, _b, input_coin;
|
|
60
60
|
return __generator(this, function (_c) {
|
|
@@ -65,7 +65,7 @@ function getSetProfitSharingTx(gasBudget, packageId, registry, level_profits, am
|
|
|
65
65
|
tx.moveCall({
|
|
66
66
|
target: "".concat(packageId, "::tails_staking::set_profit_sharing"),
|
|
67
67
|
typeArguments: typeArguments,
|
|
68
|
-
arguments: [tx.object(registry), tx.pure(level_profits), input_coin],
|
|
68
|
+
arguments: [tx.object(registry), tx.pure(name), tx.pure(level_profits), input_coin],
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
else {
|
|
@@ -77,7 +77,7 @@ function getSetProfitSharingTx(gasBudget, packageId, registry, level_profits, am
|
|
|
77
77
|
tx.moveCall({
|
|
78
78
|
target: "".concat(packageId, "::tails_staking::set_profit_sharing"),
|
|
79
79
|
typeArguments: typeArguments,
|
|
80
|
-
arguments: [tx.object(registry), tx.pure(level_profits), input_coin],
|
|
80
|
+
arguments: [tx.object(registry), tx.pure(name), tx.pure(level_profits), input_coin],
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
83
|
tx.setGasBudget(gasBudget);
|
|
@@ -102,7 +102,23 @@ function getAllocateProfitSharingTx(gasBudget, packageId, registry, users, typeA
|
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
104
|
exports.getAllocateProfitSharingTx = getAllocateProfitSharingTx;
|
|
105
|
-
function
|
|
105
|
+
function getAllocateProfitSharingValueTx(gasBudget, packageId, registry, users, values, typeArguments) {
|
|
106
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
107
|
+
var tx;
|
|
108
|
+
return __generator(this, function (_a) {
|
|
109
|
+
tx = new transactions_1.TransactionBlock();
|
|
110
|
+
tx.moveCall({
|
|
111
|
+
target: "".concat(packageId, "::tails_staking::allocate_profit_sharing_w_value"),
|
|
112
|
+
typeArguments: typeArguments,
|
|
113
|
+
arguments: [tx.object(registry), tx.pure(users), tx.pure(values)],
|
|
114
|
+
});
|
|
115
|
+
tx.setGasBudget(gasBudget);
|
|
116
|
+
return [2 /*return*/, tx];
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
exports.getAllocateProfitSharingValueTx = getAllocateProfitSharingValueTx;
|
|
121
|
+
function getRemoveProfitSharingTx(gasBudget, packageId, registry, name, typeArgumentsRemove) {
|
|
106
122
|
return __awaiter(this, void 0, void 0, function () {
|
|
107
123
|
var tx;
|
|
108
124
|
return __generator(this, function (_a) {
|
|
@@ -110,7 +126,7 @@ function getRemoveProfitSharingTx(gasBudget, packageId, registry, typeArgumentsR
|
|
|
110
126
|
tx.moveCall({
|
|
111
127
|
target: "".concat(packageId, "::tails_staking::remove_profit_sharing"),
|
|
112
128
|
typeArguments: typeArgumentsRemove,
|
|
113
|
-
arguments: [tx.object(registry)],
|
|
129
|
+
arguments: [tx.object(registry), tx.pure(name)],
|
|
114
130
|
});
|
|
115
131
|
tx.setGasBudget(gasBudget);
|
|
116
132
|
return [2 /*return*/, tx];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SuiClient } from "@mysten/sui.js/client";
|
|
2
2
|
import { Tails } from "../typus-nft/fetch";
|
|
3
3
|
export declare function getUserStake(provider: SuiClient, nft_table: string, user: string): Promise<Tails | null>;
|
|
4
|
+
export declare function getNftTable(provider: SuiClient, nft_table: string): Promise<import("@mysten/sui.js/client").DynamicFieldInfo[]>;
|
|
4
5
|
export declare function getDailyAttendExp(provider: SuiClient, dailyAttendExp: string): Promise<any>;
|
|
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.getDailyAttendExp = exports.getUserStake = void 0;
|
|
39
|
+
exports.getDailyAttendExp = exports.getNftTable = exports.getUserStake = void 0;
|
|
40
40
|
var fetch_1 = require("../typus-nft/fetch");
|
|
41
41
|
function getUserStake(provider, nft_table, user) {
|
|
42
42
|
var _a;
|
|
@@ -64,6 +64,36 @@ function getUserStake(provider, nft_table, user) {
|
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
exports.getUserStake = getUserStake;
|
|
67
|
+
function getNftTable(provider, nft_table) {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
69
|
+
var result, datas;
|
|
70
|
+
return __generator(this, function (_a) {
|
|
71
|
+
switch (_a.label) {
|
|
72
|
+
case 0: return [4 /*yield*/, provider.getDynamicFields({
|
|
73
|
+
parentId: nft_table,
|
|
74
|
+
})];
|
|
75
|
+
case 1:
|
|
76
|
+
result = _a.sent();
|
|
77
|
+
datas = result.data;
|
|
78
|
+
_a.label = 2;
|
|
79
|
+
case 2:
|
|
80
|
+
if (!result.hasNextPage) return [3 /*break*/, 4];
|
|
81
|
+
return [4 /*yield*/, provider.getDynamicFields({
|
|
82
|
+
parentId: nft_table,
|
|
83
|
+
cursor: result.nextCursor,
|
|
84
|
+
})];
|
|
85
|
+
case 3:
|
|
86
|
+
result = _a.sent();
|
|
87
|
+
datas = datas.concat(result.data);
|
|
88
|
+
return [3 /*break*/, 2];
|
|
89
|
+
case 4:
|
|
90
|
+
// console.log(datas);
|
|
91
|
+
return [2 /*return*/, datas];
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
exports.getNftTable = getNftTable;
|
|
67
97
|
function getDailyAttendExp(provider, dailyAttendExp) {
|
|
68
98
|
var _a, _b;
|
|
69
99
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -83,4 +83,4 @@ export declare function consumeExpCoinUnstakedTx(gasBudget: number, nftPackageId
|
|
|
83
83
|
)
|
|
84
84
|
*/
|
|
85
85
|
export declare function consumeExpCoinStakedTx(gasBudget: number, nftPackageId: string, typeArguments: string[], registry: string, exp_coins: string[], amount: string): Promise<TransactionBlock>;
|
|
86
|
-
export declare function getClaimProfitSharingTx(gasBudget: number, packageId: string, registry: string, typeArguments: string[]): Promise<TransactionBlock>;
|
|
86
|
+
export declare function getClaimProfitSharingTx(gasBudget: number, packageId: string, registry: string, name: "dice_profit" | "exp_profit", typeArguments: string[]): Promise<TransactionBlock>;
|
|
@@ -145,7 +145,12 @@ function getSwitchNftTx(gasBudget, nftPackageId, registry, kiosk, kiosk_cap, nft
|
|
|
145
145
|
tx.moveCall({
|
|
146
146
|
target: "".concat(nftPackageId, "::tails_staking::claim_profit_sharing"),
|
|
147
147
|
typeArguments: typeArguments,
|
|
148
|
-
arguments: [tx.object(registry)],
|
|
148
|
+
arguments: [tx.object(registry), tx.pure("dice_profit")],
|
|
149
|
+
});
|
|
150
|
+
tx.moveCall({
|
|
151
|
+
target: "".concat(nftPackageId, "::tails_staking::claim_profit_sharing"),
|
|
152
|
+
typeArguments: typeArguments,
|
|
153
|
+
arguments: [tx.object(registry), tx.pure("exp_profit")],
|
|
149
154
|
});
|
|
150
155
|
tx.moveCall({
|
|
151
156
|
target: "".concat(nftPackageId, "::tails_staking::switch_nft"),
|
|
@@ -207,7 +212,12 @@ function getUnstakeNftTx(gasBudget, nftPackageId, registry, kiosk, kiosk_cap, ty
|
|
|
207
212
|
tx.moveCall({
|
|
208
213
|
target: "".concat(nftPackageId, "::tails_staking::claim_profit_sharing"),
|
|
209
214
|
typeArguments: typeArguments,
|
|
210
|
-
arguments: [tx.object(registry)],
|
|
215
|
+
arguments: [tx.object(registry), tx.pure("dice_profit")],
|
|
216
|
+
});
|
|
217
|
+
tx.moveCall({
|
|
218
|
+
target: "".concat(nftPackageId, "::tails_staking::claim_profit_sharing"),
|
|
219
|
+
typeArguments: typeArguments,
|
|
220
|
+
arguments: [tx.object(registry), tx.pure("exp_profit")],
|
|
211
221
|
});
|
|
212
222
|
tx.moveCall({
|
|
213
223
|
target: "".concat(nftPackageId, "::tails_staking::unstake_nft"),
|
|
@@ -496,7 +506,7 @@ function consumeExpCoinStakedTx(gasBudget, nftPackageId, typeArguments, registry
|
|
|
496
506
|
});
|
|
497
507
|
}
|
|
498
508
|
exports.consumeExpCoinStakedTx = consumeExpCoinStakedTx;
|
|
499
|
-
function getClaimProfitSharingTx(gasBudget, packageId, registry, typeArguments) {
|
|
509
|
+
function getClaimProfitSharingTx(gasBudget, packageId, registry, name, typeArguments) {
|
|
500
510
|
return __awaiter(this, void 0, void 0, function () {
|
|
501
511
|
var tx;
|
|
502
512
|
return __generator(this, function (_a) {
|
|
@@ -504,7 +514,7 @@ function getClaimProfitSharingTx(gasBudget, packageId, registry, typeArguments)
|
|
|
504
514
|
tx.moveCall({
|
|
505
515
|
target: "".concat(packageId, "::tails_staking::claim_profit_sharing"),
|
|
506
516
|
typeArguments: typeArguments,
|
|
507
|
-
arguments: [tx.object(registry)],
|
|
517
|
+
arguments: [tx.object(registry), tx.pure(name)],
|
|
508
518
|
});
|
|
509
519
|
tx.setGasBudget(gasBudget);
|
|
510
520
|
return [2 /*return*/, tx];
|
|
@@ -160,7 +160,7 @@ function getTailsIds(kioskClient, nftConfig, address) {
|
|
|
160
160
|
var res, tails;
|
|
161
161
|
return __generator(this, function (_e) {
|
|
162
162
|
switch (_e.label) {
|
|
163
|
-
case 0: return [4 /*yield*/, kioskClient.getKiosk({ id: kioskOwnerCap.kioskId
|
|
163
|
+
case 0: return [4 /*yield*/, kioskClient.getKiosk({ id: kioskOwnerCap.kioskId })];
|
|
164
164
|
case 1:
|
|
165
165
|
res = _e.sent();
|
|
166
166
|
tails = res.items
|