@typus/typus-sdk 1.1.37 → 1.1.38-alpha
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/constants.d.ts +2 -2
- package/lib/constants.js +3 -4
- package/lib/utils/mint.d.ts +1 -1
- package/lib/utils/mint.js +2 -2
- package/lib/utils/nft-staking/authorized-entry.d.ts +1 -1
- package/lib/utils/nft-staking/authorized-entry.js +4 -4
- package/lib/utils/nft-staking/fetch.d.ts +2 -2
- package/lib/utils/nft-staking/user-entry.d.ts +4 -2
- package/lib/utils/nft-staking/user-entry.js +37 -27
- package/lib/utils/tails-exp-dice/fetch.d.ts +11 -3
- package/lib/utils/tails-exp-dice/fetch.js +20 -1
- package/lib/utils/tails-exp-dice/user-entry.d.ts +1 -1
- package/lib/utils/tails-exp-dice/user-entry.js +4 -4
- package/lib/utils/token.js +2 -2
- package/lib/utils/typus-dov-double/authorized-entry.d.ts +1 -1
- package/lib/utils/typus-dov-double/authorized-entry.js +8 -8
- package/lib/utils/typus-dov-double/manager-entry.d.ts +1 -1
- package/lib/utils/typus-dov-double/manager-entry.js +19 -19
- package/lib/utils/typus-dov-double/portfolio-vault.d.ts +2 -2
- package/lib/utils/typus-dov-double/portfolio-vault.js +6 -2
- package/lib/utils/typus-dov-double/user-entry.d.ts +1 -1
- package/lib/utils/typus-dov-double/user-entry.js +10 -10
- package/lib/utils/typus-dov-double/view-function.d.ts +4 -4
- package/lib/utils/typus-dov-double/view-function.js +4 -4
- package/lib/utils/typus-dov-single/portfolio-vault.d.ts +3 -3
- package/lib/utils/typus-dov-single/registry.d.ts +3 -3
- package/lib/utils/typus-dov-single/user-entry.d.ts +1 -1
- package/lib/utils/typus-dov-single/user-entry.js +12 -12
- package/lib/utils/typus-dov-single/user-history.d.ts +2 -2
- package/lib/utils/typus-dov-single/view-function.d.ts +8 -8
- package/lib/utils/typus-dov-single/view-function.js +8 -8
- package/lib/utils/typus-dov-single-v2/authorized-entry.d.ts +1 -1
- package/lib/utils/typus-dov-single-v2/authorized-entry.js +3 -3
- package/lib/utils/typus-dov-single-v2/leaderboard.d.ts +4 -16
- package/lib/utils/typus-dov-single-v2/leaderboard.js +12 -0
- package/lib/utils/typus-dov-single-v2/user-entry.d.ts +1 -1
- package/lib/utils/typus-dov-single-v2/user-entry.js +11 -11
- package/lib/utils/typus-dov-single-v2/user-history.d.ts +2 -2
- package/lib/utils/typus-dov-single-v2/view-function.d.ts +7 -7
- package/lib/utils/typus-dov-single-v2/view-function.js +7 -7
- package/lib/utils/typus-framework/dutch.d.ts +2 -2
- package/lib/utils/typus-nft/fetch.d.ts +6 -6
- package/lib/utils/typus-nft/fetch.js +8 -4
- package/lib/utils/typus-nft/user-entry.d.ts +1 -1
- package/lib/utils/typus-nft/user-entry.js +3 -3
- package/package.json +3 -3
package/lib/constants.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SuiClient } from "@mysten/sui.js/client";
|
|
2
2
|
export declare const CLOCK = "0x6";
|
|
3
3
|
export declare const SENDER = "0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
|
|
4
4
|
export declare const PRICE_DECIMAL = 8;
|
|
@@ -12,7 +12,7 @@ export declare const TOKEN_NAME_TO_MODULE: {
|
|
|
12
12
|
SUI: string;
|
|
13
13
|
USDC: string;
|
|
14
14
|
};
|
|
15
|
-
export declare const testnetConnection:
|
|
15
|
+
export declare const testnetConnection: SuiClient;
|
|
16
16
|
export declare const ACTIVE_SUB_VAULT_TAG: number;
|
|
17
17
|
export declare const DEACTIVATING_SUB_VAULT_TAG: number;
|
|
18
18
|
export declare const INACTIVE_SUB_VAULT_TAG: number;
|
package/lib/constants.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PERFORMANCE_FEE_SUB_VAULT_TAG = exports.PREMIUM_SUB_VAULT_TAG = exports.BIDDER_SUB_VAULT_TAG = exports.WARMUP_SUB_VAULT_TAG = exports.INACTIVE_SUB_VAULT_TAG = exports.DEACTIVATING_SUB_VAULT_TAG = exports.ACTIVE_SUB_VAULT_TAG = exports.testnetConnection = exports.TOKEN_NAME_TO_MODULE = exports.TOKEN_NAME = exports.FAKE_TOKEN_TYPE_ARGUMENT = exports.DEFAULT_TYPE_ARGUMENT = exports.TOKEN_DECIMAL = exports.PRICE_DECIMAL = exports.SENDER = exports.CLOCK = void 0;
|
|
4
|
-
var
|
|
4
|
+
var client_1 = require("@mysten/sui.js/client");
|
|
5
5
|
exports.CLOCK = "0x6";
|
|
6
6
|
exports.SENDER = "0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
|
|
7
7
|
exports.PRICE_DECIMAL = 8;
|
|
@@ -15,9 +15,8 @@ exports.TOKEN_NAME_TO_MODULE = {
|
|
|
15
15
|
SUI: "sui",
|
|
16
16
|
USDC: "usdc",
|
|
17
17
|
};
|
|
18
|
-
exports.testnetConnection = new
|
|
19
|
-
|
|
20
|
-
faucet: "https://faucet.testnet.sui.io/gas",
|
|
18
|
+
exports.testnetConnection = new client_1.SuiClient({
|
|
19
|
+
url: "https://fullnode.testnet.sui.io:443/",
|
|
21
20
|
});
|
|
22
21
|
exports.ACTIVE_SUB_VAULT_TAG = 0;
|
|
23
22
|
exports.DEACTIVATING_SUB_VAULT_TAG = 1;
|
package/lib/utils/mint.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TransactionBlock } from "@mysten/sui.js";
|
|
1
|
+
import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
2
2
|
export declare function getMintTx(gasBudget: number, packageId: string, registry: string, moduleName: string, amount: number): Promise<TransactionBlock>;
|
package/lib/utils/mint.js
CHANGED
|
@@ -37,12 +37,12 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.getMintTx = void 0;
|
|
40
|
-
var
|
|
40
|
+
var transactions_1 = require("@mysten/sui.js/transactions");
|
|
41
41
|
function getMintTx(gasBudget, packageId, registry, moduleName, amount) {
|
|
42
42
|
return __awaiter(this, void 0, void 0, function () {
|
|
43
43
|
var tx;
|
|
44
44
|
return __generator(this, function (_a) {
|
|
45
|
-
tx = new
|
|
45
|
+
tx = new transactions_1.TransactionBlock();
|
|
46
46
|
tx.moveCall({
|
|
47
47
|
target: "".concat(packageId, "::").concat(moduleName, "::mint"),
|
|
48
48
|
arguments: [tx.pure(registry), tx.pure(amount)],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TransactionBlock } from "@mysten/sui.js";
|
|
1
|
+
import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
2
2
|
export declare function getSetProfitSharingTx(gasBudget: number, packageId: string, registry: string, level_profits: number[], amount: number): Promise<TransactionBlock>;
|
|
3
3
|
export declare function getAllocateProfitSharingTx(gasBudget: number, packageId: string, registry: string, users: string[]): Promise<TransactionBlock>;
|
|
4
4
|
export declare function getClaimProfitSharingTx(gasBudget: number, packageId: string, registry: string): Promise<TransactionBlock>;
|
|
@@ -53,12 +53,12 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
53
53
|
};
|
|
54
54
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
55
|
exports.getClaimProfitSharingTx = exports.getAllocateProfitSharingTx = exports.getSetProfitSharingTx = void 0;
|
|
56
|
-
var
|
|
56
|
+
var transactions_1 = require("@mysten/sui.js/transactions");
|
|
57
57
|
function getSetProfitSharingTx(gasBudget, packageId, registry, level_profits, amount) {
|
|
58
58
|
return __awaiter(this, void 0, void 0, function () {
|
|
59
59
|
var tx, _a, coin;
|
|
60
60
|
return __generator(this, function (_b) {
|
|
61
|
-
tx = new
|
|
61
|
+
tx = new transactions_1.TransactionBlock();
|
|
62
62
|
_a = __read(tx.splitCoins(tx.gas, [tx.pure(amount)]), 1), coin = _a[0];
|
|
63
63
|
tx.moveCall({
|
|
64
64
|
target: "".concat(packageId, "::tails_staking::set_profit_sharing"),
|
|
@@ -75,7 +75,7 @@ function getAllocateProfitSharingTx(gasBudget, packageId, registry, users) {
|
|
|
75
75
|
return __awaiter(this, void 0, void 0, function () {
|
|
76
76
|
var tx;
|
|
77
77
|
return __generator(this, function (_a) {
|
|
78
|
-
tx = new
|
|
78
|
+
tx = new transactions_1.TransactionBlock();
|
|
79
79
|
tx.moveCall({
|
|
80
80
|
target: "".concat(packageId, "::tails_staking::allocate_profit_sharing"),
|
|
81
81
|
typeArguments: ["0x2::sui::SUI"],
|
|
@@ -91,7 +91,7 @@ function getClaimProfitSharingTx(gasBudget, packageId, registry) {
|
|
|
91
91
|
return __awaiter(this, void 0, void 0, function () {
|
|
92
92
|
var tx;
|
|
93
93
|
return __generator(this, function (_a) {
|
|
94
|
-
tx = new
|
|
94
|
+
tx = new transactions_1.TransactionBlock();
|
|
95
95
|
tx.moveCall({
|
|
96
96
|
target: "".concat(packageId, "::tails_staking::claim_profit_sharing"),
|
|
97
97
|
typeArguments: ["0x2::sui::SUI"],
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SuiClient } from "@mysten/sui.js/client";
|
|
2
2
|
import { Tails } from "../typus-nft/fetch";
|
|
3
|
-
export declare function getUserStake(provider:
|
|
3
|
+
export declare function getUserStake(provider: SuiClient, nft_table: string, user: string): Promise<Tails | null>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { TransactionBlock } from "@mysten/sui.js";
|
|
1
|
+
import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
2
|
+
import { Network } from "@mysten/kiosk";
|
|
3
|
+
import { SuiClient } from "@mysten/sui.js/client";
|
|
2
4
|
/**
|
|
3
5
|
entry fun transfer_nft(
|
|
4
6
|
registry: &mut Registry,
|
|
@@ -22,7 +24,7 @@ export declare function getTransferNftsTx(gasBudget: number, nftPackageId: strin
|
|
|
22
24
|
)
|
|
23
25
|
*/
|
|
24
26
|
export declare function getStakeNftTx(gasBudget: number, nftPackageId: string, registry: string, kiosk: string, kiosk_cap: string, nft_id: string): Promise<TransactionBlock>;
|
|
25
|
-
export declare function getCreateKioskAndLockNftTx(gasBudget: number, nftPackageId: string, policy: string, nft_id: string, singer: string): Promise<TransactionBlock>;
|
|
27
|
+
export declare function getCreateKioskAndLockNftTx(provider: SuiClient, network: Network, gasBudget: number, nftPackageId: string, policy: string, nft_id: string, singer: string): Promise<TransactionBlock>;
|
|
26
28
|
/**
|
|
27
29
|
public fun unstake_nft(
|
|
28
30
|
registry: &mut Registry,
|
|
@@ -53,7 +53,7 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
53
53
|
};
|
|
54
54
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
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
|
-
var
|
|
56
|
+
var transactions_1 = require("@mysten/sui.js/transactions");
|
|
57
57
|
var constants_1 = require("../../constants");
|
|
58
58
|
var kiosk_1 = require("@mysten/kiosk");
|
|
59
59
|
/**
|
|
@@ -70,7 +70,7 @@ function getTransferNftTx(gasBudget, nftPackageId, registry, kiosk, kiosk_cap, n
|
|
|
70
70
|
return __awaiter(this, void 0, void 0, function () {
|
|
71
71
|
var tx, _a, coin;
|
|
72
72
|
return __generator(this, function (_b) {
|
|
73
|
-
tx = new
|
|
73
|
+
tx = new transactions_1.TransactionBlock();
|
|
74
74
|
_a = __read(tx.splitCoins(tx.gas, [tx.pure(10000000)]), 1), coin = _a[0];
|
|
75
75
|
tx.moveCall({
|
|
76
76
|
target: "".concat(nftPackageId, "::tails_staking::transfer_nft"),
|
|
@@ -87,7 +87,7 @@ function getTransferNftsTx(gasBudget, nftPackageId, registry, kiosks, kiosk_caps
|
|
|
87
87
|
return __awaiter(this, void 0, void 0, function () {
|
|
88
88
|
var tx, i, _a, coin;
|
|
89
89
|
return __generator(this, function (_b) {
|
|
90
|
-
tx = new
|
|
90
|
+
tx = new transactions_1.TransactionBlock();
|
|
91
91
|
i = 0;
|
|
92
92
|
while (i < kiosks.length) {
|
|
93
93
|
_a = __read(tx.splitCoins(tx.gas, [tx.pure(10000000)]), 1), coin = _a[0];
|
|
@@ -118,7 +118,7 @@ function getStakeNftTx(gasBudget, nftPackageId, registry, kiosk, kiosk_cap, nft_
|
|
|
118
118
|
return __awaiter(this, void 0, void 0, function () {
|
|
119
119
|
var tx, _a, coin;
|
|
120
120
|
return __generator(this, function (_b) {
|
|
121
|
-
tx = new
|
|
121
|
+
tx = new transactions_1.TransactionBlock();
|
|
122
122
|
_a = __read(tx.splitCoins(tx.gas, [tx.pure(50000000)]), 1), coin = _a[0];
|
|
123
123
|
tx.moveCall({
|
|
124
124
|
target: "".concat(nftPackageId, "::tails_staking::stake_nft"),
|
|
@@ -131,20 +131,30 @@ function getStakeNftTx(gasBudget, nftPackageId, registry, kiosk, kiosk_cap, nft_
|
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
133
|
exports.getStakeNftTx = getStakeNftTx;
|
|
134
|
-
function getCreateKioskAndLockNftTx(gasBudget, nftPackageId, policy, nft_id, singer) {
|
|
134
|
+
function getCreateKioskAndLockNftTx(provider, network, gasBudget, nftPackageId, policy, nft_id, singer) {
|
|
135
135
|
return __awaiter(this, void 0, void 0, function () {
|
|
136
|
-
var tx,
|
|
137
|
-
return __generator(this, function (
|
|
138
|
-
tx = new
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
target: "0x2::transfer::public_share_object",
|
|
143
|
-
typeArguments: [kiosk_1.KIOSK_TYPE],
|
|
144
|
-
arguments: [kiosk],
|
|
136
|
+
var tx, kioskClient, kioskTx, kiosk, kioskCap;
|
|
137
|
+
return __generator(this, function (_a) {
|
|
138
|
+
tx = new transactions_1.TransactionBlock();
|
|
139
|
+
kioskClient = new kiosk_1.KioskClient({
|
|
140
|
+
client: provider,
|
|
141
|
+
network: network,
|
|
145
142
|
});
|
|
146
|
-
|
|
147
|
-
|
|
143
|
+
kioskTx = new kiosk_1.KioskTransaction({ transactionBlock: tx, kioskClient: kioskClient });
|
|
144
|
+
kioskTx.lock({ itemType: "".concat(nftPackageId, "::typus_nft::Tails"), itemId: nft_id, policy: policy });
|
|
145
|
+
kiosk = kioskTx.kiosk, kioskCap = kioskTx.kioskCap;
|
|
146
|
+
if (kiosk && kioskCap) {
|
|
147
|
+
tx.moveCall({
|
|
148
|
+
target: "0x2::transfer::public_share_object",
|
|
149
|
+
typeArguments: [kiosk_1.KIOSK_TYPE],
|
|
150
|
+
arguments: [kiosk],
|
|
151
|
+
});
|
|
152
|
+
tx.transferObjects([kioskCap], tx.pure(singer));
|
|
153
|
+
tx.setGasBudget(gasBudget);
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
console.error("Fail to Create Kiosk Tx!!");
|
|
157
|
+
}
|
|
148
158
|
return [2 /*return*/, tx];
|
|
149
159
|
});
|
|
150
160
|
});
|
|
@@ -163,7 +173,7 @@ function getUnstakeNftTx(gasBudget, nftPackageId, registry, kiosk, kiosk_cap) {
|
|
|
163
173
|
return __awaiter(this, void 0, void 0, function () {
|
|
164
174
|
var tx;
|
|
165
175
|
return __generator(this, function (_a) {
|
|
166
|
-
tx = new
|
|
176
|
+
tx = new transactions_1.TransactionBlock();
|
|
167
177
|
tx.moveCall({
|
|
168
178
|
target: "".concat(nftPackageId, "::tails_staking::snapshot"),
|
|
169
179
|
typeArguments: [],
|
|
@@ -191,7 +201,7 @@ function getDailyAttendTx(gasBudget, nftPackageId, registry) {
|
|
|
191
201
|
return __awaiter(this, void 0, void 0, function () {
|
|
192
202
|
var tx;
|
|
193
203
|
return __generator(this, function (_a) {
|
|
194
|
-
tx = new
|
|
204
|
+
tx = new transactions_1.TransactionBlock();
|
|
195
205
|
tx.moveCall({
|
|
196
206
|
target: "".concat(nftPackageId, "::tails_staking::daily_attend"),
|
|
197
207
|
typeArguments: [],
|
|
@@ -214,7 +224,7 @@ function getSnapshotTx(gasBudget, nftPackageId, registry) {
|
|
|
214
224
|
return __awaiter(this, void 0, void 0, function () {
|
|
215
225
|
var tx;
|
|
216
226
|
return __generator(this, function (_a) {
|
|
217
|
-
tx = new
|
|
227
|
+
tx = new transactions_1.TransactionBlock();
|
|
218
228
|
tx.moveCall({
|
|
219
229
|
target: "".concat(nftPackageId, "::tails_staking::snapshot"),
|
|
220
230
|
typeArguments: [],
|
|
@@ -232,7 +242,7 @@ usingSponsoredGasCoin) {
|
|
|
232
242
|
return __awaiter(this, void 0, void 0, function () {
|
|
233
243
|
var tx, _a, coin;
|
|
234
244
|
return __generator(this, function (_b) {
|
|
235
|
-
tx = new
|
|
245
|
+
tx = new transactions_1.TransactionBlock();
|
|
236
246
|
if (!usingSponsoredGasCoin &&
|
|
237
247
|
(typeArguments[1] == "0x2::sui::SUI" ||
|
|
238
248
|
typeArguments[1] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI")) {
|
|
@@ -277,7 +287,7 @@ function getDepositTx(gasBudget, packageId, typeArguments, registry, additional_
|
|
|
277
287
|
return __awaiter(this, void 0, void 0, function () {
|
|
278
288
|
var tx, _a, coin;
|
|
279
289
|
return __generator(this, function (_b) {
|
|
280
|
-
tx = new
|
|
290
|
+
tx = new transactions_1.TransactionBlock();
|
|
281
291
|
if (!usingSponsoredGasCoin &&
|
|
282
292
|
(typeArguments[0] == "0x2::sui::SUI" ||
|
|
283
293
|
typeArguments[0] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI")) {
|
|
@@ -319,7 +329,7 @@ function getCompoundTx(gasBudget, packageId, typeArguments, registry, additional
|
|
|
319
329
|
return __awaiter(this, void 0, void 0, function () {
|
|
320
330
|
var tx;
|
|
321
331
|
return __generator(this, function (_a) {
|
|
322
|
-
tx = new
|
|
332
|
+
tx = new transactions_1.TransactionBlock();
|
|
323
333
|
tx.moveCall({
|
|
324
334
|
target: "".concat(packageId, "::tails_staking::compound"),
|
|
325
335
|
typeArguments: typeArguments,
|
|
@@ -335,7 +345,7 @@ function getWithdrawTx(gasBudget, packageId, typeArguments, registry, additional
|
|
|
335
345
|
return __awaiter(this, void 0, void 0, function () {
|
|
336
346
|
var tx;
|
|
337
347
|
return __generator(this, function (_a) {
|
|
338
|
-
tx = new
|
|
348
|
+
tx = new transactions_1.TransactionBlock();
|
|
339
349
|
tx.moveCall({
|
|
340
350
|
target: "".concat(packageId, "::tails_staking::withdraw"),
|
|
341
351
|
typeArguments: typeArguments,
|
|
@@ -357,7 +367,7 @@ function getUnsubscribeTx(gasBudget, packageId, typeArguments, registry, additio
|
|
|
357
367
|
return __awaiter(this, void 0, void 0, function () {
|
|
358
368
|
var tx;
|
|
359
369
|
return __generator(this, function (_a) {
|
|
360
|
-
tx = new
|
|
370
|
+
tx = new transactions_1.TransactionBlock();
|
|
361
371
|
tx.moveCall({
|
|
362
372
|
target: "".concat(packageId, "::tails_staking::unsubscribe"),
|
|
363
373
|
typeArguments: typeArguments,
|
|
@@ -385,7 +395,7 @@ function getLevelUpTx(gasBudget, nftPackageId, registry) {
|
|
|
385
395
|
return __awaiter(this, void 0, void 0, function () {
|
|
386
396
|
var tx;
|
|
387
397
|
return __generator(this, function (_a) {
|
|
388
|
-
tx = new
|
|
398
|
+
tx = new transactions_1.TransactionBlock();
|
|
389
399
|
tx.moveCall({
|
|
390
400
|
target: "".concat(nftPackageId, "::tails_staking::level_up"),
|
|
391
401
|
typeArguments: [],
|
|
@@ -411,7 +421,7 @@ function consumeExpCoinUnstakedTx(gasBudget, nftPackageId, typeArguments, regist
|
|
|
411
421
|
return __awaiter(this, void 0, void 0, function () {
|
|
412
422
|
var tx, coin;
|
|
413
423
|
return __generator(this, function (_a) {
|
|
414
|
-
tx = new
|
|
424
|
+
tx = new transactions_1.TransactionBlock();
|
|
415
425
|
coin = exp_coins.pop();
|
|
416
426
|
if (exp_coins.length > 0) {
|
|
417
427
|
tx.mergeCoins(tx.object(coin), exp_coins.map(function (id) { return tx.object(id); }));
|
|
@@ -438,7 +448,7 @@ function consumeExpCoinStakedTx(gasBudget, nftPackageId, typeArguments, registry
|
|
|
438
448
|
return __awaiter(this, void 0, void 0, function () {
|
|
439
449
|
var tx, coin;
|
|
440
450
|
return __generator(this, function (_a) {
|
|
441
|
-
tx = new
|
|
451
|
+
tx = new transactions_1.TransactionBlock();
|
|
442
452
|
coin = exp_coins.pop();
|
|
443
453
|
if (exp_coins.length > 0) {
|
|
444
454
|
tx.mergeCoins(tx.object(coin), exp_coins.map(function (id) { return tx.object(id); }));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function getPlaygrounds(provider:
|
|
1
|
+
import { SuiClient } from "@mysten/sui.js/client";
|
|
2
|
+
export declare function getPlaygrounds(provider: SuiClient, diceRegistry: string): Promise<Playground[]>;
|
|
3
3
|
export interface Playground {
|
|
4
4
|
id: string;
|
|
5
5
|
house_whitelist: string[];
|
|
@@ -29,7 +29,7 @@ export interface Game {
|
|
|
29
29
|
larger_than_2: boolean | null;
|
|
30
30
|
vrf_input_2: number[] | null;
|
|
31
31
|
}
|
|
32
|
-
export declare function getHistory(provider:
|
|
32
|
+
export declare function getHistory(provider: SuiClient, dicePackage: string, playgrounds: Playground[]): Promise<DrawDisplay[]>;
|
|
33
33
|
interface DrawDisplay {
|
|
34
34
|
game_id: string;
|
|
35
35
|
player: string;
|
|
@@ -40,4 +40,12 @@ interface DrawDisplay {
|
|
|
40
40
|
bet_amount: string;
|
|
41
41
|
exp: string;
|
|
42
42
|
}
|
|
43
|
+
export interface ProfitSharing {
|
|
44
|
+
level_profits: string[];
|
|
45
|
+
level_users: string[];
|
|
46
|
+
pool: string;
|
|
47
|
+
remaining: string;
|
|
48
|
+
total: string;
|
|
49
|
+
}
|
|
50
|
+
export declare function getProfitSharing(provider: SuiClient, diceProfitSharing: string): Promise<ProfitSharing>;
|
|
43
51
|
export {};
|
|
@@ -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.getHistory = exports.getPlaygrounds = void 0;
|
|
39
|
+
exports.getProfitSharing = exports.getHistory = exports.getPlaygrounds = void 0;
|
|
40
40
|
var token_1 = require("../token");
|
|
41
41
|
function getPlaygrounds(provider, diceRegistry) {
|
|
42
42
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -149,3 +149,22 @@ function getHistory(provider, dicePackage, playgrounds) {
|
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
151
|
exports.getHistory = getHistory;
|
|
152
|
+
function getProfitSharing(provider, diceProfitSharing) {
|
|
153
|
+
var _a, _b;
|
|
154
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
155
|
+
var object, result;
|
|
156
|
+
return __generator(this, function (_c) {
|
|
157
|
+
switch (_c.label) {
|
|
158
|
+
case 0: return [4 /*yield*/, provider.getObject({
|
|
159
|
+
id: diceProfitSharing,
|
|
160
|
+
options: { showContent: true },
|
|
161
|
+
})];
|
|
162
|
+
case 1:
|
|
163
|
+
object = _c.sent();
|
|
164
|
+
result = (_b = (_a = object.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields.value.fields;
|
|
165
|
+
return [2 /*return*/, result];
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
exports.getProfitSharing = getProfitSharing;
|
|
@@ -53,7 +53,7 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
53
53
|
};
|
|
54
54
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
55
|
exports.newGamePlayGuessTx = exports.playGuessTx = exports.newGameTx = void 0;
|
|
56
|
-
var
|
|
56
|
+
var transactions_1 = require("@mysten/sui.js/transactions");
|
|
57
57
|
/**
|
|
58
58
|
public(friend) entry fun new_game<TOKEN>(
|
|
59
59
|
registry: &mut Registry,
|
|
@@ -68,7 +68,7 @@ registry, index, coins, amount) {
|
|
|
68
68
|
return __awaiter(this, void 0, void 0, function () {
|
|
69
69
|
var tx;
|
|
70
70
|
return __generator(this, function (_a) {
|
|
71
|
-
tx = new
|
|
71
|
+
tx = new transactions_1.TransactionBlock();
|
|
72
72
|
tx.moveCall({
|
|
73
73
|
target: "".concat(packageId, "::tails_exp::new_game"),
|
|
74
74
|
typeArguments: typeArguments,
|
|
@@ -96,7 +96,7 @@ function playGuessTx(gasBudget, packageId, registry, index, guess_1, larger_than
|
|
|
96
96
|
return __awaiter(this, void 0, void 0, function () {
|
|
97
97
|
var tx;
|
|
98
98
|
return __generator(this, function (_a) {
|
|
99
|
-
tx = new
|
|
99
|
+
tx = new transactions_1.TransactionBlock();
|
|
100
100
|
tx.moveCall({
|
|
101
101
|
target: "".concat(packageId, "::tails_exp::play_guess"),
|
|
102
102
|
typeArguments: [],
|
|
@@ -120,7 +120,7 @@ registry, index, coins, amount, guess_1, larger_than_1, guess_2, larger_than_2)
|
|
|
120
120
|
return __awaiter(this, void 0, void 0, function () {
|
|
121
121
|
var tx, _a, coin;
|
|
122
122
|
return __generator(this, function (_b) {
|
|
123
|
-
tx = new
|
|
123
|
+
tx = new transactions_1.TransactionBlock();
|
|
124
124
|
if (typeArguments[0] == "0x2::sui::SUI" ||
|
|
125
125
|
typeArguments[0] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI") {
|
|
126
126
|
_a = __read(tx.splitCoins(tx.gas, [tx.pure(amount)]), 1), coin = _a[0];
|
package/lib/utils/token.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.assetToDecimal = exports.typeArgToAsset = exports.typeArgsToAssets = void 0;
|
|
4
|
-
var
|
|
4
|
+
var utils_1 = require("@mysten/sui.js/utils");
|
|
5
5
|
function typeArgsToAssets(typeArgs) {
|
|
6
6
|
var assets = typeArgs.map(function (x) { return typeArgToAsset(x); });
|
|
7
7
|
return assets;
|
|
@@ -9,7 +9,7 @@ function typeArgsToAssets(typeArgs) {
|
|
|
9
9
|
exports.typeArgsToAssets = typeArgsToAssets;
|
|
10
10
|
function typeArgToAsset(typeArg) {
|
|
11
11
|
var typeArgs = typeArg.split("::");
|
|
12
|
-
switch ((0,
|
|
12
|
+
switch ((0, utils_1.normalizeSuiAddress)(typeArgs[0])) {
|
|
13
13
|
case "0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881":
|
|
14
14
|
return "WBTC";
|
|
15
15
|
case "0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5":
|
|
@@ -37,7 +37,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.getAuthorizedDeliveryTx = exports.getAuthorizedUpdateUpcomingVaultConfigTx = exports.getAuthorizedUpdateWarmupVaultConfigTx = exports.getAuthorizedUpdateCapacityTx = exports.getAuthorizedNewPortfolioVaultTx = exports.getAuthorizedRemovePortfolioVaultAuthorizedUserTx = exports.getAuthorizedAddPortfolioVaultAuthorizedUserTx = void 0;
|
|
40
|
-
var
|
|
40
|
+
var transactions_1 = require("@mysten/sui.js/transactions");
|
|
41
41
|
/**
|
|
42
42
|
public(friend) entry fun authorized_add_portfolio_vault_authorized_user<O_TOKEN, U_TOKEN, B_TOKEN>(
|
|
43
43
|
registry: &mut Registry,
|
|
@@ -50,7 +50,7 @@ function getAuthorizedAddPortfolioVaultAuthorizedUserTx(gasBudget, packageId, ty
|
|
|
50
50
|
return __awaiter(this, void 0, void 0, function () {
|
|
51
51
|
var tx;
|
|
52
52
|
return __generator(this, function (_a) {
|
|
53
|
-
tx = new
|
|
53
|
+
tx = new transactions_1.TransactionBlock();
|
|
54
54
|
tx.moveCall({
|
|
55
55
|
target: "".concat(packageId, "::typus_dov_double::authorized_add_portfolio_vault_authorized_user"),
|
|
56
56
|
typeArguments: typeArguments,
|
|
@@ -74,7 +74,7 @@ function getAuthorizedRemovePortfolioVaultAuthorizedUserTx(gasBudget, packageId,
|
|
|
74
74
|
return __awaiter(this, void 0, void 0, function () {
|
|
75
75
|
var tx;
|
|
76
76
|
return __generator(this, function (_a) {
|
|
77
|
-
tx = new
|
|
77
|
+
tx = new transactions_1.TransactionBlock();
|
|
78
78
|
tx.moveCall({
|
|
79
79
|
target: "".concat(packageId, "::typus_dov_double::authorized_remove_portfolio_vault_authorized_user"),
|
|
80
80
|
typeArguments: typeArguments,
|
|
@@ -121,7 +121,7 @@ function getAuthorizedNewPortfolioVaultTx(gasBudget, packageId, typeArguments, r
|
|
|
121
121
|
return __awaiter(this, void 0, void 0, function () {
|
|
122
122
|
var tx;
|
|
123
123
|
return __generator(this, function (_a) {
|
|
124
|
-
tx = new
|
|
124
|
+
tx = new transactions_1.TransactionBlock();
|
|
125
125
|
tx.moveCall({
|
|
126
126
|
target: "".concat(packageId, "::typus_dov_double::authorized_new_portfolio_vault"),
|
|
127
127
|
typeArguments: typeArguments,
|
|
@@ -172,7 +172,7 @@ function getAuthorizedUpdateCapacityTx(gasBudget, packageId, typeArguments, regi
|
|
|
172
172
|
return __awaiter(this, void 0, void 0, function () {
|
|
173
173
|
var tx;
|
|
174
174
|
return __generator(this, function (_a) {
|
|
175
|
-
tx = new
|
|
175
|
+
tx = new transactions_1.TransactionBlock();
|
|
176
176
|
tx.moveCall({
|
|
177
177
|
target: "".concat(packageId, "::typus_dov_double::authorized_update_capacity"),
|
|
178
178
|
typeArguments: typeArguments,
|
|
@@ -200,7 +200,7 @@ function getAuthorizedUpdateWarmupVaultConfigTx(gasBudget, packageId, typeArgume
|
|
|
200
200
|
return __awaiter(this, void 0, void 0, function () {
|
|
201
201
|
var tx;
|
|
202
202
|
return __generator(this, function (_a) {
|
|
203
|
-
tx = new
|
|
203
|
+
tx = new transactions_1.TransactionBlock();
|
|
204
204
|
tx.moveCall({
|
|
205
205
|
target: "".concat(packageId, "::typus_dov_double::authorized_update_warmup_vault_config"),
|
|
206
206
|
typeArguments: typeArguments,
|
|
@@ -242,7 +242,7 @@ function getAuthorizedUpdateUpcomingVaultConfigTx(gasBudget, packageId, typeArgu
|
|
|
242
242
|
return __awaiter(this, void 0, void 0, function () {
|
|
243
243
|
var tx;
|
|
244
244
|
return __generator(this, function (_a) {
|
|
245
|
-
tx = new
|
|
245
|
+
tx = new transactions_1.TransactionBlock();
|
|
246
246
|
tx.moveCall({
|
|
247
247
|
target: "".concat(packageId, "::typus_dov_double::authorized_update_upcoming_vault_config"),
|
|
248
248
|
typeArguments: typeArguments,
|
|
@@ -281,7 +281,7 @@ function getAuthorizedDeliveryTx(gasBudget, packageId, typeArguments, registry,
|
|
|
281
281
|
return __awaiter(this, void 0, void 0, function () {
|
|
282
282
|
var tx;
|
|
283
283
|
return __generator(this, function (_a) {
|
|
284
|
-
tx = new
|
|
284
|
+
tx = new transactions_1.TransactionBlock();
|
|
285
285
|
tx.moveCall({
|
|
286
286
|
target: "".concat(packageId, "::typus_dov_double::authorized_delivery"),
|
|
287
287
|
typeArguments: typeArguments,
|