@typus/typus-sdk 1.1.42 → 1.1.44
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.
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
2
|
-
import {
|
|
3
|
-
import { SuiClient } from "@mysten/sui.js/client";
|
|
2
|
+
import { KioskClient } from "@mysten/kiosk";
|
|
4
3
|
/**
|
|
5
4
|
entry fun transfer_nft(
|
|
6
5
|
registry: &mut Registry,
|
|
@@ -24,7 +23,7 @@ export declare function getTransferNftsTx(gasBudget: number, nftPackageId: strin
|
|
|
24
23
|
)
|
|
25
24
|
*/
|
|
26
25
|
export declare function getStakeNftTx(gasBudget: number, nftPackageId: string, registry: string, kiosk: string, kiosk_cap: string, nft_id: string): Promise<TransactionBlock>;
|
|
27
|
-
export declare function getCreateKioskAndLockNftTx(
|
|
26
|
+
export declare function getCreateKioskAndLockNftTx(kioskClient: KioskClient, gasBudget: number, nftPackageId: string, policy: string, nft_id: string, singer: string): Promise<TransactionBlock>;
|
|
28
27
|
/**
|
|
29
28
|
public fun unstake_nft(
|
|
30
29
|
registry: &mut Registry,
|
|
@@ -131,16 +131,13 @@ function getStakeNftTx(gasBudget, nftPackageId, registry, kiosk, kiosk_cap, nft_
|
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
133
|
exports.getStakeNftTx = getStakeNftTx;
|
|
134
|
-
function getCreateKioskAndLockNftTx(
|
|
134
|
+
function getCreateKioskAndLockNftTx(kioskClient, gasBudget, nftPackageId, policy, nft_id, singer) {
|
|
135
135
|
return __awaiter(this, void 0, void 0, function () {
|
|
136
|
-
var tx,
|
|
136
|
+
var tx, kioskTx, kiosk, kioskCap;
|
|
137
137
|
return __generator(this, function (_a) {
|
|
138
138
|
tx = new transactions_1.TransactionBlock();
|
|
139
|
-
kioskClient = new kiosk_1.KioskClient({
|
|
140
|
-
client: provider,
|
|
141
|
-
network: network,
|
|
142
|
-
});
|
|
143
139
|
kioskTx = new kiosk_1.KioskTransaction({ transactionBlock: tx, kioskClient: kioskClient });
|
|
140
|
+
kioskTx.create();
|
|
144
141
|
kioskTx.lock({ itemType: "".concat(nftPackageId, "::typus_nft::Tails"), itemId: nft_id, policy: policy });
|
|
145
142
|
kiosk = kioskTx.kiosk, kioskCap = kioskTx.kioskCap;
|
|
146
143
|
if (kiosk && kioskCap) {
|
|
@@ -18,6 +18,7 @@ interface TailsId {
|
|
|
18
18
|
tails: Tails;
|
|
19
19
|
}
|
|
20
20
|
export declare function getTailsIds(kioskClient: KioskClient, nftConfig: any, address: string): Promise<TailsId[]>;
|
|
21
|
+
export declare function getTails(provider: SuiClient, tailsIds: string[]): Promise<Tails[]>;
|
|
21
22
|
export declare function fieldsToTails(fields: any): Tails;
|
|
22
23
|
export interface Tails {
|
|
23
24
|
id: string;
|
|
@@ -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.LevelExpVec = exports.getLevelExp = exports.fieldsToTails = exports.getTailsIds = exports.getWhitelistMap = exports.getPoolMap = exports.necklaces = exports.getPool = void 0;
|
|
50
|
+
exports.LevelExpVec = exports.getLevelExp = exports.fieldsToTails = exports.getTails = exports.getTailsIds = exports.getWhitelistMap = exports.getPoolMap = exports.necklaces = exports.getPool = void 0;
|
|
51
51
|
function getPool(provider, pool) {
|
|
52
52
|
var _a;
|
|
53
53
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -213,6 +213,44 @@ function getTailsIds(kioskClient, nftConfig, address) {
|
|
|
213
213
|
});
|
|
214
214
|
}
|
|
215
215
|
exports.getTailsIds = getTailsIds;
|
|
216
|
+
function getTails(provider, tailsIds) {
|
|
217
|
+
var _a;
|
|
218
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
219
|
+
var Tails, len, results, results_1, results_1_1, result, fields, tails;
|
|
220
|
+
var e_2, _b;
|
|
221
|
+
return __generator(this, function (_c) {
|
|
222
|
+
switch (_c.label) {
|
|
223
|
+
case 0:
|
|
224
|
+
Tails = [];
|
|
225
|
+
_c.label = 1;
|
|
226
|
+
case 1:
|
|
227
|
+
if (!(tailsIds.length > 0)) return [3 /*break*/, 3];
|
|
228
|
+
len = tailsIds.length > 50 ? 50 : tailsIds.length;
|
|
229
|
+
return [4 /*yield*/, provider.multiGetObjects({ ids: tailsIds.splice(0, len), options: { showContent: true } })];
|
|
230
|
+
case 2:
|
|
231
|
+
results = _c.sent();
|
|
232
|
+
try {
|
|
233
|
+
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()) {
|
|
234
|
+
result = results_1_1.value;
|
|
235
|
+
fields = (_a = result.data) === null || _a === void 0 ? void 0 : _a.content.fields;
|
|
236
|
+
tails = fieldsToTails(fields);
|
|
237
|
+
Tails.push(tails);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
241
|
+
finally {
|
|
242
|
+
try {
|
|
243
|
+
if (results_1_1 && !results_1_1.done && (_b = results_1.return)) _b.call(results_1);
|
|
244
|
+
}
|
|
245
|
+
finally { if (e_2) throw e_2.error; }
|
|
246
|
+
}
|
|
247
|
+
return [3 /*break*/, 1];
|
|
248
|
+
case 3: return [2 /*return*/, Tails];
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
exports.getTails = getTails;
|
|
216
254
|
function fieldsToTails(fields) {
|
|
217
255
|
// console.log(fields.attributes.fields.contents);
|
|
218
256
|
var attributes = new Map();
|