@typus/typus-sdk 1.2.36 → 1.2.38-exp
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 +25 -8
- 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 +2 -2
- 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>): 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,13 @@ function getBidderLeaderBoard(startTimestamp, end) {
|
|
|
267
267
|
});
|
|
268
268
|
}
|
|
269
269
|
exports.getBidderLeaderBoard = getBidderLeaderBoard;
|
|
270
|
+
function getExpLeaderBoardWithOwner(expLeaderBoard, ownerMap) {
|
|
271
|
+
return expLeaderBoard.map(function (l) {
|
|
272
|
+
l.owner = ownerMap.get(l.nft_id);
|
|
273
|
+
return l;
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
exports.getExpLeaderBoardWithOwner = getExpLeaderBoardWithOwner;
|
|
270
277
|
function getExpLeaderBoard(startTimestamp, endTimestamp) {
|
|
271
278
|
return __awaiter(this, void 0, void 0, function () {
|
|
272
279
|
var apiUrl, headers, _endTimestamp, requestData, jsonData, response, data;
|
|
@@ -278,11 +285,25 @@ function getExpLeaderBoard(startTimestamp, endTimestamp) {
|
|
|
278
285
|
"api-key": "tz3JJ6stG7Fux6ueRSRA5mdpC9U0lozI3",
|
|
279
286
|
"Content-Type": "application/json",
|
|
280
287
|
};
|
|
281
|
-
_endTimestamp = endTimestamp ? endTimestamp : "
|
|
288
|
+
_endTimestamp = endTimestamp ? endTimestamp : "9999999999";
|
|
282
289
|
requestData = {
|
|
283
290
|
sqlQuery: {
|
|
284
|
-
sql:
|
|
285
|
-
|
|
291
|
+
// sql: `SELECT S.distinct_id AS owner, SUM(E.exp_earn) AS total_exp_earn
|
|
292
|
+
// FROM ExpUp E
|
|
293
|
+
// JOIN (
|
|
294
|
+
// SELECT number, distinct_id
|
|
295
|
+
// FROM StakeNft
|
|
296
|
+
// WHERE (number, timestamp) IN (
|
|
297
|
+
// SELECT number, MAX(timestamp) AS max_timestamp
|
|
298
|
+
// FROM StakeNft
|
|
299
|
+
// GROUP BY number
|
|
300
|
+
// )
|
|
301
|
+
// ) S ON E.number = S.number
|
|
302
|
+
// WHERE E.timestamp >= ${startTimestamp} && E.timestamp < ${_endTimestamp}
|
|
303
|
+
// GROUP BY owner
|
|
304
|
+
// ORDER BY total_exp_earn DESC;`,
|
|
305
|
+
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 "),
|
|
306
|
+
size: 200,
|
|
286
307
|
},
|
|
287
308
|
};
|
|
288
309
|
jsonData = JSON.stringify(requestData);
|
|
@@ -302,7 +323,3 @@ function getExpLeaderBoard(startTimestamp, endTimestamp) {
|
|
|
302
323
|
});
|
|
303
324
|
}
|
|
304
325
|
exports.getExpLeaderBoard = getExpLeaderBoard;
|
|
305
|
-
// (async () => {
|
|
306
|
-
// let res = await getExpLeaderBoard("1709539200", "1709625600");
|
|
307
|
-
// console.log(res);
|
|
308
|
-
// })();
|
|
@@ -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>;
|
|
@@ -496,7 +496,7 @@ function consumeExpCoinStakedTx(gasBudget, nftPackageId, typeArguments, registry
|
|
|
496
496
|
});
|
|
497
497
|
}
|
|
498
498
|
exports.consumeExpCoinStakedTx = consumeExpCoinStakedTx;
|
|
499
|
-
function getClaimProfitSharingTx(gasBudget, packageId, registry, typeArguments) {
|
|
499
|
+
function getClaimProfitSharingTx(gasBudget, packageId, registry, name, typeArguments) {
|
|
500
500
|
return __awaiter(this, void 0, void 0, function () {
|
|
501
501
|
var tx;
|
|
502
502
|
return __generator(this, function (_a) {
|
|
@@ -504,7 +504,7 @@ function getClaimProfitSharingTx(gasBudget, packageId, registry, typeArguments)
|
|
|
504
504
|
tx.moveCall({
|
|
505
505
|
target: "".concat(packageId, "::tails_staking::claim_profit_sharing"),
|
|
506
506
|
typeArguments: typeArguments,
|
|
507
|
-
arguments: [tx.object(registry)],
|
|
507
|
+
arguments: [tx.object(registry), tx.pure(name)],
|
|
508
508
|
});
|
|
509
509
|
tx.setGasBudget(gasBudget);
|
|
510
510
|
return [2 /*return*/, tx];
|