@typus/typus-sdk 1.0.94 → 1.0.95
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/fetch.d.ts +7 -0
- package/lib/utils/nft-staking/fetch.js +65 -0
- package/lib/utils/nft-staking/user-entry.d.ts +38 -0
- package/lib/utils/nft-staking/user-entry.js +168 -0
- package/lib/utils/typus-dov-single-v2/user-entry.d.ts +87 -0
- package/lib/utils/typus-dov-single-v2/user-entry.js +333 -0
- package/lib/utils/typus-nft/fetch.d.ts +9 -2
- package/lib/utils/typus-nft/fetch.js +58 -13
- package/package.json +1 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { JsonRpcProvider } from "@mysten/sui.js";
|
|
2
|
+
import { Tails } from "../typus-nft/fetch";
|
|
3
|
+
export declare function getUserStake(provider: JsonRpcProvider, nft_table: string, user: string): Promise<StakedTails | null>;
|
|
4
|
+
export interface StakedTails {
|
|
5
|
+
nft: Tails;
|
|
6
|
+
snapshot_ms: string;
|
|
7
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.getUserStake = void 0;
|
|
40
|
+
function getUserStake(provider, nft_table, user) {
|
|
41
|
+
var _a;
|
|
42
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
43
|
+
var res, fields, staked_tails;
|
|
44
|
+
return __generator(this, function (_b) {
|
|
45
|
+
switch (_b.label) {
|
|
46
|
+
case 0: return [4 /*yield*/, provider.getDynamicFieldObject({
|
|
47
|
+
parentId: nft_table,
|
|
48
|
+
name: {
|
|
49
|
+
type: "address",
|
|
50
|
+
value: user,
|
|
51
|
+
},
|
|
52
|
+
})];
|
|
53
|
+
case 1:
|
|
54
|
+
res = _b.sent();
|
|
55
|
+
if (res.error) {
|
|
56
|
+
return [2 /*return*/, null];
|
|
57
|
+
}
|
|
58
|
+
fields = (_a = res.data) === null || _a === void 0 ? void 0 : _a.content.fields;
|
|
59
|
+
staked_tails = { nft: fields.value.fields.nft.fields, snapshot_ms: fields.value.fields.snapshot_ms };
|
|
60
|
+
return [2 /*return*/, staked_tails];
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
exports.getUserStake = getUserStake;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { TransactionBlock } from "@mysten/sui.js";
|
|
2
|
+
/**
|
|
3
|
+
public fun stake_nft(
|
|
4
|
+
registry: &mut Registry,
|
|
5
|
+
kiosk: &mut Kiosk,
|
|
6
|
+
kiosk_cap: &KioskOwnerCap,
|
|
7
|
+
id: ID,
|
|
8
|
+
clock: &Clock,
|
|
9
|
+
ctx: &mut TxContext
|
|
10
|
+
)
|
|
11
|
+
*/
|
|
12
|
+
export declare function getStakeNftTx(gasBudget: number, nftPackageId: string, registry: string, kiosk: string, kiosk_cap: string, nft_id: string): Promise<TransactionBlock>;
|
|
13
|
+
/**
|
|
14
|
+
public fun unstake_nft(
|
|
15
|
+
registry: &mut Registry,
|
|
16
|
+
kiosk: &mut Kiosk,
|
|
17
|
+
kiosk_cap: &KioskOwnerCap,
|
|
18
|
+
ctx: &mut TxContext
|
|
19
|
+
)
|
|
20
|
+
*/
|
|
21
|
+
export declare function getUnstakeNftTx(gasBudget: number, nftPackageId: string, registry: string, kiosk: string, kiosk_cap: string): Promise<TransactionBlock>;
|
|
22
|
+
/**
|
|
23
|
+
public fun snapshot(
|
|
24
|
+
registry: &mut Registry,
|
|
25
|
+
clock: &Clock,
|
|
26
|
+
ctx: &mut TxContext
|
|
27
|
+
)
|
|
28
|
+
*/
|
|
29
|
+
export declare function getSnapshotTx(gasBudget: number, nftPackageId: string, registry: string): Promise<TransactionBlock>;
|
|
30
|
+
export declare function getFirstBidTx(gasBudget: number, nftPackageId: string, registry: string): Promise<TransactionBlock>;
|
|
31
|
+
export declare function getFirstDepositTx(gasBudget: number, nftPackageId: string, registry: string): Promise<TransactionBlock>;
|
|
32
|
+
/**
|
|
33
|
+
public fun level_up(
|
|
34
|
+
registry: &mut Registry,
|
|
35
|
+
ctx: &mut TxContext
|
|
36
|
+
)
|
|
37
|
+
*/
|
|
38
|
+
export declare function getLevelUpTx(gasBudget: number, nftPackageId: string, registry: string): Promise<TransactionBlock>;
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.getLevelUpTx = exports.getFirstDepositTx = exports.getFirstBidTx = exports.getSnapshotTx = exports.getUnstakeNftTx = exports.getStakeNftTx = void 0;
|
|
40
|
+
var sui_js_1 = require("@mysten/sui.js");
|
|
41
|
+
var constants_1 = require("../../constants");
|
|
42
|
+
/**
|
|
43
|
+
public fun stake_nft(
|
|
44
|
+
registry: &mut Registry,
|
|
45
|
+
kiosk: &mut Kiosk,
|
|
46
|
+
kiosk_cap: &KioskOwnerCap,
|
|
47
|
+
id: ID,
|
|
48
|
+
clock: &Clock,
|
|
49
|
+
ctx: &mut TxContext
|
|
50
|
+
)
|
|
51
|
+
*/
|
|
52
|
+
function getStakeNftTx(gasBudget, nftPackageId, registry, kiosk, kiosk_cap, nft_id) {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
54
|
+
var tx;
|
|
55
|
+
return __generator(this, function (_a) {
|
|
56
|
+
tx = new sui_js_1.TransactionBlock();
|
|
57
|
+
tx.moveCall({
|
|
58
|
+
target: "".concat(nftPackageId, "::staking::stake_nft"),
|
|
59
|
+
typeArguments: [],
|
|
60
|
+
arguments: [tx.object(registry), tx.object(kiosk), tx.object(kiosk_cap), tx.object(nft_id), tx.object(constants_1.CLOCK)],
|
|
61
|
+
});
|
|
62
|
+
tx.setGasBudget(gasBudget);
|
|
63
|
+
return [2 /*return*/, tx];
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
exports.getStakeNftTx = getStakeNftTx;
|
|
68
|
+
/**
|
|
69
|
+
public fun unstake_nft(
|
|
70
|
+
registry: &mut Registry,
|
|
71
|
+
kiosk: &mut Kiosk,
|
|
72
|
+
kiosk_cap: &KioskOwnerCap,
|
|
73
|
+
ctx: &mut TxContext
|
|
74
|
+
)
|
|
75
|
+
*/
|
|
76
|
+
function getUnstakeNftTx(gasBudget, nftPackageId, registry, kiosk, kiosk_cap) {
|
|
77
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
78
|
+
var tx;
|
|
79
|
+
return __generator(this, function (_a) {
|
|
80
|
+
tx = new sui_js_1.TransactionBlock();
|
|
81
|
+
tx.moveCall({
|
|
82
|
+
target: "".concat(nftPackageId, "::staking::unstake_nft"),
|
|
83
|
+
typeArguments: [],
|
|
84
|
+
arguments: [tx.object(registry), tx.object(kiosk), tx.object(kiosk_cap)],
|
|
85
|
+
});
|
|
86
|
+
tx.setGasBudget(gasBudget);
|
|
87
|
+
return [2 /*return*/, tx];
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
exports.getUnstakeNftTx = getUnstakeNftTx;
|
|
92
|
+
/**
|
|
93
|
+
public fun snapshot(
|
|
94
|
+
registry: &mut Registry,
|
|
95
|
+
clock: &Clock,
|
|
96
|
+
ctx: &mut TxContext
|
|
97
|
+
)
|
|
98
|
+
*/
|
|
99
|
+
function getSnapshotTx(gasBudget, nftPackageId, registry) {
|
|
100
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
101
|
+
var tx;
|
|
102
|
+
return __generator(this, function (_a) {
|
|
103
|
+
tx = new sui_js_1.TransactionBlock();
|
|
104
|
+
tx.moveCall({
|
|
105
|
+
target: "".concat(nftPackageId, "::staking::snapshot"),
|
|
106
|
+
typeArguments: [],
|
|
107
|
+
arguments: [tx.object(registry), tx.object(constants_1.CLOCK)],
|
|
108
|
+
});
|
|
109
|
+
tx.setGasBudget(gasBudget);
|
|
110
|
+
return [2 /*return*/, tx];
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
exports.getSnapshotTx = getSnapshotTx;
|
|
115
|
+
function getFirstBidTx(gasBudget, nftPackageId, registry) {
|
|
116
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
117
|
+
var tx;
|
|
118
|
+
return __generator(this, function (_a) {
|
|
119
|
+
tx = new sui_js_1.TransactionBlock();
|
|
120
|
+
tx.moveCall({
|
|
121
|
+
target: "".concat(nftPackageId, "::staking::first_bid"),
|
|
122
|
+
typeArguments: [],
|
|
123
|
+
arguments: [tx.object(registry)],
|
|
124
|
+
});
|
|
125
|
+
tx.setGasBudget(gasBudget);
|
|
126
|
+
return [2 /*return*/, tx];
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
exports.getFirstBidTx = getFirstBidTx;
|
|
131
|
+
function getFirstDepositTx(gasBudget, nftPackageId, registry) {
|
|
132
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
133
|
+
var tx;
|
|
134
|
+
return __generator(this, function (_a) {
|
|
135
|
+
tx = new sui_js_1.TransactionBlock();
|
|
136
|
+
tx.moveCall({
|
|
137
|
+
target: "".concat(nftPackageId, "::staking::first_deposit"),
|
|
138
|
+
typeArguments: [],
|
|
139
|
+
arguments: [tx.object(registry)],
|
|
140
|
+
});
|
|
141
|
+
tx.setGasBudget(gasBudget);
|
|
142
|
+
return [2 /*return*/, tx];
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
exports.getFirstDepositTx = getFirstDepositTx;
|
|
147
|
+
/**
|
|
148
|
+
public fun level_up(
|
|
149
|
+
registry: &mut Registry,
|
|
150
|
+
ctx: &mut TxContext
|
|
151
|
+
)
|
|
152
|
+
*/
|
|
153
|
+
function getLevelUpTx(gasBudget, nftPackageId, registry) {
|
|
154
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
155
|
+
var tx;
|
|
156
|
+
return __generator(this, function (_a) {
|
|
157
|
+
tx = new sui_js_1.TransactionBlock();
|
|
158
|
+
tx.moveCall({
|
|
159
|
+
target: "".concat(nftPackageId, "::staking::level_up"),
|
|
160
|
+
typeArguments: [],
|
|
161
|
+
arguments: [tx.object(registry)],
|
|
162
|
+
});
|
|
163
|
+
tx.setGasBudget(gasBudget);
|
|
164
|
+
return [2 /*return*/, tx];
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
exports.getLevelUpTx = getLevelUpTx;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { TransactionBlock } from "@mysten/sui.js";
|
|
2
|
+
/**
|
|
3
|
+
public(friend) entry fun deposit<D_TOKEN, B_TOKEN, O_TOKEN>(
|
|
4
|
+
registry: &mut Registry,
|
|
5
|
+
index: u64,
|
|
6
|
+
coins: vector<Coin<D_TOKEN>>,
|
|
7
|
+
amount: u64,
|
|
8
|
+
receipts: vector<TypusDepositReceipt>,
|
|
9
|
+
ctx: &mut TxContext,
|
|
10
|
+
)
|
|
11
|
+
*/
|
|
12
|
+
export declare function getDepositTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, additional_config_registry: string, index: string, coins: string[], amount: string, receipts: string[], usingSponsoredGasCoin?: boolean): Promise<TransactionBlock>;
|
|
13
|
+
/**
|
|
14
|
+
public(friend) entry fun withdraw<D_TOKEN, B_TOKEN, O_TOKEN>(
|
|
15
|
+
registry: &mut Registry,
|
|
16
|
+
index: u64,
|
|
17
|
+
receipts: vector<TypusDepositReceipt>,
|
|
18
|
+
share: Option<u64>,
|
|
19
|
+
ctx: &mut TxContext,
|
|
20
|
+
)
|
|
21
|
+
*/
|
|
22
|
+
export declare function getWithdrawTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string, receipts: string[], share?: string): Promise<TransactionBlock>;
|
|
23
|
+
/**
|
|
24
|
+
public(friend) entry fun unsubscribe<D_TOKEN, B_TOKEN, O_TOKEN>(
|
|
25
|
+
registry: &mut Registry,
|
|
26
|
+
index: u64,
|
|
27
|
+
receipts: vector<TypusDepositReceipt>,
|
|
28
|
+
share: Option<u64>,
|
|
29
|
+
ctx: &mut TxContext,
|
|
30
|
+
)
|
|
31
|
+
*/
|
|
32
|
+
export declare function getUnsubscribeTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string, receipts: string[], share?: string): Promise<TransactionBlock>;
|
|
33
|
+
/**
|
|
34
|
+
public(friend) entry fun claim<D_TOKEN, B_TOKEN, O_TOKEN>(
|
|
35
|
+
registry: &mut Registry,
|
|
36
|
+
index: u64,
|
|
37
|
+
receipts: vector<TypusDepositReceipt>,
|
|
38
|
+
ctx: &mut TxContext,
|
|
39
|
+
)
|
|
40
|
+
*/
|
|
41
|
+
export declare function getClaimTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string, receipts: string[]): Promise<TransactionBlock>;
|
|
42
|
+
/**
|
|
43
|
+
public(friend) entry fun harvest<D_TOKEN, B_TOKEN, O_TOKEN>(
|
|
44
|
+
registry: &mut Registry,
|
|
45
|
+
index: u64,
|
|
46
|
+
receipts: vector<TypusDepositReceipt>,
|
|
47
|
+
ctx: &mut TxContext,
|
|
48
|
+
)
|
|
49
|
+
*/
|
|
50
|
+
export declare function getHarvestTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string, receipts: string[]): Promise<TransactionBlock>;
|
|
51
|
+
/**
|
|
52
|
+
public(friend) entry fun compound<D_TOKEN, B_TOKEN, O_TOKEN>(
|
|
53
|
+
registry: &mut Registry,
|
|
54
|
+
index: u64,
|
|
55
|
+
receipts: vector<TypusDepositReceipt>,
|
|
56
|
+
ctx: &mut TxContext,
|
|
57
|
+
)
|
|
58
|
+
*/
|
|
59
|
+
export declare function getCompoundTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string, receipts: string[]): Promise<TransactionBlock>;
|
|
60
|
+
/**
|
|
61
|
+
public(friend) entry fun new_bid<D_TOKEN, B_TOKEN, O_TOKEN>(
|
|
62
|
+
registry: &mut Registry,
|
|
63
|
+
index: u64,
|
|
64
|
+
coins: vector<Coin<B_TOKEN>>,
|
|
65
|
+
size: u64,
|
|
66
|
+
clock: &Clock,
|
|
67
|
+
ctx: &mut TxContext,
|
|
68
|
+
)
|
|
69
|
+
*/
|
|
70
|
+
export declare function getNewBidTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string, coins: string[], size: string, premium_required: string, // fe float * b_token_decimal
|
|
71
|
+
usingSponsoredGasCoin?: boolean): Promise<TransactionBlock>;
|
|
72
|
+
/**
|
|
73
|
+
public(friend) entry fun exercise<D_TOKEN, B_TOKEN, O_TOKEN>(
|
|
74
|
+
registry: &mut Registry,
|
|
75
|
+
index: u64,
|
|
76
|
+
receipts: vector<TypusBidReceipt>,
|
|
77
|
+
ctx: &mut TxContext,
|
|
78
|
+
)
|
|
79
|
+
*/
|
|
80
|
+
export declare function getExerciseTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string, receipts: string[]): Promise<TransactionBlock>;
|
|
81
|
+
/**
|
|
82
|
+
public(friend) entry fun refund<TOKEN>(
|
|
83
|
+
registry: &mut Registry,
|
|
84
|
+
ctx: &mut TxContext,
|
|
85
|
+
)
|
|
86
|
+
*/
|
|
87
|
+
export declare function getRefundTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string): Promise<TransactionBlock>;
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
39
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
40
|
+
if (!m) return o;
|
|
41
|
+
var i = m.call(o), r, ar = [], e;
|
|
42
|
+
try {
|
|
43
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
44
|
+
}
|
|
45
|
+
catch (error) { e = { error: error }; }
|
|
46
|
+
finally {
|
|
47
|
+
try {
|
|
48
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
49
|
+
}
|
|
50
|
+
finally { if (e) throw e.error; }
|
|
51
|
+
}
|
|
52
|
+
return ar;
|
|
53
|
+
};
|
|
54
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
|
+
exports.getRefundTx = exports.getExerciseTx = exports.getNewBidTx = exports.getCompoundTx = exports.getHarvestTx = exports.getClaimTx = exports.getUnsubscribeTx = exports.getWithdrawTx = exports.getDepositTx = void 0;
|
|
56
|
+
var sui_js_1 = require("@mysten/sui.js");
|
|
57
|
+
/**
|
|
58
|
+
public(friend) entry fun deposit<D_TOKEN, B_TOKEN, O_TOKEN>(
|
|
59
|
+
registry: &mut Registry,
|
|
60
|
+
index: u64,
|
|
61
|
+
coins: vector<Coin<D_TOKEN>>,
|
|
62
|
+
amount: u64,
|
|
63
|
+
receipts: vector<TypusDepositReceipt>,
|
|
64
|
+
ctx: &mut TxContext,
|
|
65
|
+
)
|
|
66
|
+
*/
|
|
67
|
+
function getDepositTx(gasBudget, packageId, typeArguments, registry, additional_config_registry, index, coins, amount, receipts, usingSponsoredGasCoin) {
|
|
68
|
+
if (usingSponsoredGasCoin === void 0) { usingSponsoredGasCoin = false; }
|
|
69
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
70
|
+
var tx, _a, coin;
|
|
71
|
+
return __generator(this, function (_b) {
|
|
72
|
+
tx = new sui_js_1.TransactionBlock();
|
|
73
|
+
if (!usingSponsoredGasCoin &&
|
|
74
|
+
(typeArguments[0] == "0x2::sui::SUI" ||
|
|
75
|
+
typeArguments[0] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI")) {
|
|
76
|
+
_a = __read(tx.splitCoins(tx.gas, [tx.pure(amount)]), 1), coin = _a[0];
|
|
77
|
+
tx.moveCall({
|
|
78
|
+
target: "".concat(packageId, "::typus_dov_single::deposit"),
|
|
79
|
+
typeArguments: typeArguments,
|
|
80
|
+
arguments: [
|
|
81
|
+
tx.pure(registry),
|
|
82
|
+
tx.pure(additional_config_registry),
|
|
83
|
+
tx.pure(index),
|
|
84
|
+
tx.makeMoveVec({ objects: [coin] }),
|
|
85
|
+
tx.pure(amount),
|
|
86
|
+
tx.makeMoveVec({ objects: receipts.map(function (id) { return tx.object(id); }) }),
|
|
87
|
+
],
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
tx.moveCall({
|
|
92
|
+
target: "".concat(packageId, "::typus_dov_single::deposit"),
|
|
93
|
+
typeArguments: typeArguments,
|
|
94
|
+
arguments: [
|
|
95
|
+
tx.pure(registry),
|
|
96
|
+
tx.pure(additional_config_registry),
|
|
97
|
+
tx.pure(index),
|
|
98
|
+
tx.makeMoveVec({ objects: coins.map(function (id) { return tx.object(id); }) }),
|
|
99
|
+
tx.pure(amount),
|
|
100
|
+
tx.makeMoveVec({ objects: receipts.map(function (id) { return tx.object(id); }) }),
|
|
101
|
+
],
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
tx.setGasBudget(gasBudget);
|
|
105
|
+
return [2 /*return*/, tx];
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
exports.getDepositTx = getDepositTx;
|
|
110
|
+
/**
|
|
111
|
+
public(friend) entry fun withdraw<D_TOKEN, B_TOKEN, O_TOKEN>(
|
|
112
|
+
registry: &mut Registry,
|
|
113
|
+
index: u64,
|
|
114
|
+
receipts: vector<TypusDepositReceipt>,
|
|
115
|
+
share: Option<u64>,
|
|
116
|
+
ctx: &mut TxContext,
|
|
117
|
+
)
|
|
118
|
+
*/
|
|
119
|
+
function getWithdrawTx(gasBudget, packageId, typeArguments, registry, index, receipts, share) {
|
|
120
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
121
|
+
var tx;
|
|
122
|
+
return __generator(this, function (_a) {
|
|
123
|
+
tx = new sui_js_1.TransactionBlock();
|
|
124
|
+
tx.moveCall({
|
|
125
|
+
target: "".concat(packageId, "::typus_dov_single::withdraw"),
|
|
126
|
+
typeArguments: typeArguments,
|
|
127
|
+
arguments: [
|
|
128
|
+
tx.pure(registry),
|
|
129
|
+
tx.pure(index),
|
|
130
|
+
tx.makeMoveVec({ objects: receipts.map(function (id) { return tx.object(id); }) }),
|
|
131
|
+
tx.pure(share ? [share] : []),
|
|
132
|
+
],
|
|
133
|
+
});
|
|
134
|
+
tx.setGasBudget(gasBudget);
|
|
135
|
+
return [2 /*return*/, tx];
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
exports.getWithdrawTx = getWithdrawTx;
|
|
140
|
+
/**
|
|
141
|
+
public(friend) entry fun unsubscribe<D_TOKEN, B_TOKEN, O_TOKEN>(
|
|
142
|
+
registry: &mut Registry,
|
|
143
|
+
index: u64,
|
|
144
|
+
receipts: vector<TypusDepositReceipt>,
|
|
145
|
+
share: Option<u64>,
|
|
146
|
+
ctx: &mut TxContext,
|
|
147
|
+
)
|
|
148
|
+
*/
|
|
149
|
+
function getUnsubscribeTx(gasBudget, packageId, typeArguments, registry, index, receipts, share) {
|
|
150
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
151
|
+
var tx;
|
|
152
|
+
return __generator(this, function (_a) {
|
|
153
|
+
tx = new sui_js_1.TransactionBlock();
|
|
154
|
+
tx.moveCall({
|
|
155
|
+
target: "".concat(packageId, "::typus_dov_single::unsubscribe"),
|
|
156
|
+
typeArguments: typeArguments,
|
|
157
|
+
arguments: [
|
|
158
|
+
tx.pure(registry),
|
|
159
|
+
tx.pure(index),
|
|
160
|
+
tx.makeMoveVec({ objects: receipts.map(function (id) { return tx.object(id); }) }),
|
|
161
|
+
tx.pure(share ? [share] : []),
|
|
162
|
+
],
|
|
163
|
+
});
|
|
164
|
+
tx.setGasBudget(gasBudget);
|
|
165
|
+
return [2 /*return*/, tx];
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
exports.getUnsubscribeTx = getUnsubscribeTx;
|
|
170
|
+
/**
|
|
171
|
+
public(friend) entry fun claim<D_TOKEN, B_TOKEN, O_TOKEN>(
|
|
172
|
+
registry: &mut Registry,
|
|
173
|
+
index: u64,
|
|
174
|
+
receipts: vector<TypusDepositReceipt>,
|
|
175
|
+
ctx: &mut TxContext,
|
|
176
|
+
)
|
|
177
|
+
*/
|
|
178
|
+
function getClaimTx(gasBudget, packageId, typeArguments, registry, index, receipts) {
|
|
179
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
180
|
+
var tx;
|
|
181
|
+
return __generator(this, function (_a) {
|
|
182
|
+
tx = new sui_js_1.TransactionBlock();
|
|
183
|
+
tx.moveCall({
|
|
184
|
+
target: "".concat(packageId, "::typus_dov_single::claim"),
|
|
185
|
+
typeArguments: typeArguments,
|
|
186
|
+
arguments: [tx.pure(registry), tx.pure(index), tx.makeMoveVec({ objects: receipts.map(function (id) { return tx.object(id); }) })],
|
|
187
|
+
});
|
|
188
|
+
tx.setGasBudget(gasBudget);
|
|
189
|
+
return [2 /*return*/, tx];
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
exports.getClaimTx = getClaimTx;
|
|
194
|
+
/**
|
|
195
|
+
public(friend) entry fun harvest<D_TOKEN, B_TOKEN, O_TOKEN>(
|
|
196
|
+
registry: &mut Registry,
|
|
197
|
+
index: u64,
|
|
198
|
+
receipts: vector<TypusDepositReceipt>,
|
|
199
|
+
ctx: &mut TxContext,
|
|
200
|
+
)
|
|
201
|
+
*/
|
|
202
|
+
function getHarvestTx(gasBudget, packageId, typeArguments, registry, index, receipts) {
|
|
203
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
204
|
+
var tx;
|
|
205
|
+
return __generator(this, function (_a) {
|
|
206
|
+
tx = new sui_js_1.TransactionBlock();
|
|
207
|
+
tx.moveCall({
|
|
208
|
+
target: "".concat(packageId, "::typus_dov_single::harvest"),
|
|
209
|
+
typeArguments: typeArguments,
|
|
210
|
+
arguments: [tx.pure(registry), tx.pure(index), tx.makeMoveVec({ objects: receipts.map(function (id) { return tx.object(id); }) })],
|
|
211
|
+
});
|
|
212
|
+
tx.setGasBudget(gasBudget);
|
|
213
|
+
return [2 /*return*/, tx];
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
exports.getHarvestTx = getHarvestTx;
|
|
218
|
+
/**
|
|
219
|
+
public(friend) entry fun compound<D_TOKEN, B_TOKEN, O_TOKEN>(
|
|
220
|
+
registry: &mut Registry,
|
|
221
|
+
index: u64,
|
|
222
|
+
receipts: vector<TypusDepositReceipt>,
|
|
223
|
+
ctx: &mut TxContext,
|
|
224
|
+
)
|
|
225
|
+
*/
|
|
226
|
+
function getCompoundTx(gasBudget, packageId, typeArguments, registry, index, receipts) {
|
|
227
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
228
|
+
var tx;
|
|
229
|
+
return __generator(this, function (_a) {
|
|
230
|
+
tx = new sui_js_1.TransactionBlock();
|
|
231
|
+
tx.moveCall({
|
|
232
|
+
target: "".concat(packageId, "::typus_dov_single::compound"),
|
|
233
|
+
typeArguments: typeArguments,
|
|
234
|
+
arguments: [tx.pure(registry), tx.pure(index), tx.makeMoveVec({ objects: receipts.map(function (id) { return tx.object(id); }) })],
|
|
235
|
+
});
|
|
236
|
+
tx.setGasBudget(gasBudget);
|
|
237
|
+
return [2 /*return*/, tx];
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
exports.getCompoundTx = getCompoundTx;
|
|
242
|
+
/**
|
|
243
|
+
public(friend) entry fun new_bid<D_TOKEN, B_TOKEN, O_TOKEN>(
|
|
244
|
+
registry: &mut Registry,
|
|
245
|
+
index: u64,
|
|
246
|
+
coins: vector<Coin<B_TOKEN>>,
|
|
247
|
+
size: u64,
|
|
248
|
+
clock: &Clock,
|
|
249
|
+
ctx: &mut TxContext,
|
|
250
|
+
)
|
|
251
|
+
*/
|
|
252
|
+
function getNewBidTx(gasBudget, packageId, typeArguments, registry, index, coins, size, premium_required, // fe float * b_token_decimal
|
|
253
|
+
usingSponsoredGasCoin) {
|
|
254
|
+
if (usingSponsoredGasCoin === void 0) { usingSponsoredGasCoin = false; }
|
|
255
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
256
|
+
var tx, _a, coin;
|
|
257
|
+
return __generator(this, function (_b) {
|
|
258
|
+
tx = new sui_js_1.TransactionBlock();
|
|
259
|
+
if (!usingSponsoredGasCoin &&
|
|
260
|
+
(typeArguments[1] == "0x2::sui::SUI" ||
|
|
261
|
+
typeArguments[1] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI")) {
|
|
262
|
+
_a = __read(tx.splitCoins(tx.gas, [tx.pure(premium_required)]), 1), coin = _a[0];
|
|
263
|
+
tx.moveCall({
|
|
264
|
+
target: "".concat(packageId, "::typus_dov_single::new_bid"),
|
|
265
|
+
typeArguments: typeArguments,
|
|
266
|
+
arguments: [tx.pure(registry), tx.pure(index), tx.makeMoveVec({ objects: [coin] }), tx.pure(size), tx.pure("0x6")],
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
else {
|
|
270
|
+
tx.moveCall({
|
|
271
|
+
target: "".concat(packageId, "::typus_dov_single::new_bid"),
|
|
272
|
+
typeArguments: typeArguments,
|
|
273
|
+
arguments: [
|
|
274
|
+
tx.pure(registry),
|
|
275
|
+
tx.pure(index),
|
|
276
|
+
tx.makeMoveVec({ objects: coins.map(function (id) { return tx.object(id); }) }),
|
|
277
|
+
tx.pure(size),
|
|
278
|
+
tx.pure("0x6"),
|
|
279
|
+
],
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
tx.setGasBudget(gasBudget);
|
|
283
|
+
return [2 /*return*/, tx];
|
|
284
|
+
});
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
exports.getNewBidTx = getNewBidTx;
|
|
288
|
+
/**
|
|
289
|
+
public(friend) entry fun exercise<D_TOKEN, B_TOKEN, O_TOKEN>(
|
|
290
|
+
registry: &mut Registry,
|
|
291
|
+
index: u64,
|
|
292
|
+
receipts: vector<TypusBidReceipt>,
|
|
293
|
+
ctx: &mut TxContext,
|
|
294
|
+
)
|
|
295
|
+
*/
|
|
296
|
+
function getExerciseTx(gasBudget, packageId, typeArguments, registry, index, receipts) {
|
|
297
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
298
|
+
var tx;
|
|
299
|
+
return __generator(this, function (_a) {
|
|
300
|
+
tx = new sui_js_1.TransactionBlock();
|
|
301
|
+
tx.moveCall({
|
|
302
|
+
target: "".concat(packageId, "::typus_dov_single::exercise"),
|
|
303
|
+
typeArguments: typeArguments,
|
|
304
|
+
arguments: [tx.pure(registry), tx.pure(index), tx.makeMoveVec({ objects: receipts.map(function (id) { return tx.object(id); }) })],
|
|
305
|
+
});
|
|
306
|
+
tx.setGasBudget(gasBudget);
|
|
307
|
+
return [2 /*return*/, tx];
|
|
308
|
+
});
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
exports.getExerciseTx = getExerciseTx;
|
|
312
|
+
/**
|
|
313
|
+
public(friend) entry fun refund<TOKEN>(
|
|
314
|
+
registry: &mut Registry,
|
|
315
|
+
ctx: &mut TxContext,
|
|
316
|
+
)
|
|
317
|
+
*/
|
|
318
|
+
function getRefundTx(gasBudget, packageId, typeArguments, registry) {
|
|
319
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
320
|
+
var tx;
|
|
321
|
+
return __generator(this, function (_a) {
|
|
322
|
+
tx = new sui_js_1.TransactionBlock();
|
|
323
|
+
tx.moveCall({
|
|
324
|
+
target: "".concat(packageId, "::typus_dov_single::refund"),
|
|
325
|
+
typeArguments: typeArguments,
|
|
326
|
+
arguments: [tx.pure(registry)],
|
|
327
|
+
});
|
|
328
|
+
tx.setGasBudget(gasBudget);
|
|
329
|
+
return [2 /*return*/, tx];
|
|
330
|
+
});
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
exports.getRefundTx = getRefundTx;
|
|
@@ -10,9 +10,14 @@ export interface PoolData {
|
|
|
10
10
|
export declare const necklaces: string[];
|
|
11
11
|
export declare function getPoolMap(provider: JsonRpcProvider, nftConfig: any): Promise<Map<string, PoolData>>;
|
|
12
12
|
export declare function getWhitelistMap(nftConfig: any, wlTokens: any): Promise<Map<string, string[]>>;
|
|
13
|
-
|
|
13
|
+
interface TailsId {
|
|
14
|
+
nftId: string;
|
|
15
|
+
kiosk: string;
|
|
16
|
+
kioskCap: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function getTailsIds(provider: JsonRpcProvider, nftConfig: any, kiosks: OwnedKiosks): Promise<TailsId[]>;
|
|
14
19
|
export declare function getTails(provider: JsonRpcProvider, tailsIds: string[]): Promise<Tails[]>;
|
|
15
|
-
interface Tails {
|
|
20
|
+
export interface Tails {
|
|
16
21
|
id: string;
|
|
17
22
|
name: string;
|
|
18
23
|
number: string;
|
|
@@ -23,4 +28,6 @@ interface Tails {
|
|
|
23
28
|
first_deposit: string;
|
|
24
29
|
first_deposit_nft: string;
|
|
25
30
|
}
|
|
31
|
+
export declare function getLevelExp(level: number): number | undefined;
|
|
32
|
+
export declare const LevelExpVec: number[];
|
|
26
33
|
export {};
|
|
@@ -47,7 +47,7 @@ var __values = (this && this.__values) || function(o) {
|
|
|
47
47
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
48
48
|
};
|
|
49
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
exports.getTails = exports.getTailsIds = exports.getWhitelistMap = exports.getPoolMap = exports.necklaces = exports.getPool = void 0;
|
|
50
|
+
exports.LevelExpVec = exports.getLevelExp = exports.getTails = exports.getTailsIds = exports.getWhitelistMap = exports.getPoolMap = exports.necklaces = exports.getPool = void 0;
|
|
51
51
|
var kiosk_1 = require("@mysten/kiosk");
|
|
52
52
|
function getPool(provider, pool) {
|
|
53
53
|
var _a;
|
|
@@ -147,26 +147,46 @@ function getWhitelistMap(nftConfig, wlTokens) {
|
|
|
147
147
|
exports.getWhitelistMap = getWhitelistMap;
|
|
148
148
|
function getTailsIds(provider, nftConfig, kiosks) {
|
|
149
149
|
return __awaiter(this, void 0, void 0, function () {
|
|
150
|
-
var Tails, _a, _b,
|
|
150
|
+
var Tails, _loop_1, _a, _b, kioskOwnerCap, e_1_1;
|
|
151
151
|
var e_1, _c;
|
|
152
152
|
return __generator(this, function (_d) {
|
|
153
153
|
switch (_d.label) {
|
|
154
154
|
case 0:
|
|
155
155
|
Tails = [];
|
|
156
|
+
_loop_1 = function (kioskOwnerCap) {
|
|
157
|
+
var res, tails;
|
|
158
|
+
return __generator(this, function (_e) {
|
|
159
|
+
switch (_e.label) {
|
|
160
|
+
case 0: return [4 /*yield*/, (0, kiosk_1.fetchKiosk)(provider, kioskOwnerCap.kioskId, {}, {})];
|
|
161
|
+
case 1:
|
|
162
|
+
res = _e.sent();
|
|
163
|
+
tails = res.data.items
|
|
164
|
+
.filter(function (item) { return item.type == "".concat(nftConfig.PACKAGE, "::typus_nft::Tails"); })
|
|
165
|
+
.map(function (item) {
|
|
166
|
+
var t = {
|
|
167
|
+
nftId: item.objectId,
|
|
168
|
+
kiosk: kioskOwnerCap.kioskId,
|
|
169
|
+
kioskCap: kioskOwnerCap.objectId,
|
|
170
|
+
};
|
|
171
|
+
return t;
|
|
172
|
+
});
|
|
173
|
+
// console.log(tails);
|
|
174
|
+
Tails = Tails.concat(tails);
|
|
175
|
+
return [2 /*return*/];
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
};
|
|
156
179
|
_d.label = 1;
|
|
157
180
|
case 1:
|
|
158
181
|
_d.trys.push([1, 6, 7, 8]);
|
|
159
|
-
_a = __values(kiosks.
|
|
182
|
+
_a = __values(kiosks.kioskOwnerCaps), _b = _a.next();
|
|
160
183
|
_d.label = 2;
|
|
161
184
|
case 2:
|
|
162
185
|
if (!!_b.done) return [3 /*break*/, 5];
|
|
163
|
-
|
|
164
|
-
return [
|
|
186
|
+
kioskOwnerCap = _b.value;
|
|
187
|
+
return [5 /*yield**/, _loop_1(kioskOwnerCap)];
|
|
165
188
|
case 3:
|
|
166
|
-
|
|
167
|
-
tails = res.data.items.filter(function (item) { return item.type == "".concat(nftConfig.PACKAGE, "::typus_nft::Tails"); }).map(function (item) { return item.objectId; });
|
|
168
|
-
// console.log(tails);
|
|
169
|
-
Tails = Tails.concat(tails);
|
|
189
|
+
_d.sent();
|
|
170
190
|
_d.label = 4;
|
|
171
191
|
case 4:
|
|
172
192
|
_b = _a.next();
|
|
@@ -191,17 +211,21 @@ exports.getTailsIds = getTailsIds;
|
|
|
191
211
|
function getTails(provider, tailsIds) {
|
|
192
212
|
var _a;
|
|
193
213
|
return __awaiter(this, void 0, void 0, function () {
|
|
194
|
-
var Tails, results, results_1, results_1_1, result, fields, tails;
|
|
214
|
+
var Tails, len, results, results_1, results_1_1, result, fields, tails;
|
|
195
215
|
var e_2, _b;
|
|
196
216
|
return __generator(this, function (_c) {
|
|
197
217
|
switch (_c.label) {
|
|
198
218
|
case 0:
|
|
199
219
|
Tails = [];
|
|
200
|
-
|
|
220
|
+
_c.label = 1;
|
|
201
221
|
case 1:
|
|
222
|
+
if (!(tailsIds.length > 0)) return [3 /*break*/, 3];
|
|
223
|
+
len = tailsIds.length > 50 ? 50 : tailsIds.length;
|
|
224
|
+
return [4 /*yield*/, provider.multiGetObjects({ ids: tailsIds.splice(0, len), options: { showContent: true } })];
|
|
225
|
+
case 2:
|
|
202
226
|
results = _c.sent();
|
|
203
227
|
try {
|
|
204
|
-
for (results_1 = __values(results), results_1_1 = results_1.next(); !results_1_1.done; results_1_1 = results_1.next()) {
|
|
228
|
+
for (results_1 = (e_2 = void 0, __values(results)), results_1_1 = results_1.next(); !results_1_1.done; results_1_1 = results_1.next()) {
|
|
205
229
|
result = results_1_1.value;
|
|
206
230
|
fields = (_a = result.data) === null || _a === void 0 ? void 0 : _a.content.fields;
|
|
207
231
|
tails = {
|
|
@@ -225,9 +249,30 @@ function getTails(provider, tailsIds) {
|
|
|
225
249
|
}
|
|
226
250
|
finally { if (e_2) throw e_2.error; }
|
|
227
251
|
}
|
|
228
|
-
return [
|
|
252
|
+
return [3 /*break*/, 1];
|
|
253
|
+
case 3: return [2 /*return*/, Tails];
|
|
229
254
|
}
|
|
230
255
|
});
|
|
231
256
|
});
|
|
232
257
|
}
|
|
233
258
|
exports.getTails = getTails;
|
|
259
|
+
function getLevelExp(level) {
|
|
260
|
+
switch (level) {
|
|
261
|
+
case 1:
|
|
262
|
+
return exports.LevelExpVec[1];
|
|
263
|
+
case 2:
|
|
264
|
+
return exports.LevelExpVec[2];
|
|
265
|
+
case 3:
|
|
266
|
+
return exports.LevelExpVec[3];
|
|
267
|
+
case 4:
|
|
268
|
+
return exports.LevelExpVec[4];
|
|
269
|
+
case 5:
|
|
270
|
+
return exports.LevelExpVec[5];
|
|
271
|
+
case 6:
|
|
272
|
+
return exports.LevelExpVec[6];
|
|
273
|
+
case 7:
|
|
274
|
+
return exports.LevelExpVec[7];
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
exports.getLevelExp = getLevelExp;
|
|
278
|
+
exports.LevelExpVec = [0, 0, 1000, 50000, 250000, 1000000, 5000000, 20000000];
|