@typus/typus-sdk 1.1.41 → 1.1.42
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 +1 -0
- package/lib/constants.js +4 -1
- package/lib/utils/typus-nft/fetch.d.ts +3 -3
- package/lib/utils/typus-nft/fetch.js +25 -62
- package/package.json +1 -1
package/lib/constants.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export declare const TOKEN_NAME_TO_MODULE: {
|
|
|
12
12
|
SUI: string;
|
|
13
13
|
USDC: string;
|
|
14
14
|
};
|
|
15
|
+
export declare const mainnetConnection: SuiClient;
|
|
15
16
|
export declare const testnetConnection: SuiClient;
|
|
16
17
|
export declare const ACTIVE_SUB_VAULT_TAG: number;
|
|
17
18
|
export declare const DEACTIVATING_SUB_VAULT_TAG: number;
|
package/lib/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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;
|
|
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.mainnetConnection = 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
4
|
var client_1 = require("@mysten/sui.js/client");
|
|
5
5
|
exports.CLOCK = "0x6";
|
|
6
6
|
exports.SENDER = "0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
|
|
@@ -15,6 +15,9 @@ exports.TOKEN_NAME_TO_MODULE = {
|
|
|
15
15
|
SUI: "sui",
|
|
16
16
|
USDC: "usdc",
|
|
17
17
|
};
|
|
18
|
+
exports.mainnetConnection = new client_1.SuiClient({
|
|
19
|
+
url: "https://fullnode.mainnet.sui.io:443/",
|
|
20
|
+
});
|
|
18
21
|
exports.testnetConnection = new client_1.SuiClient({
|
|
19
22
|
url: "https://fullnode.testnet.sui.io:443/",
|
|
20
23
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SuiClient } from "@mysten/sui.js/client";
|
|
2
|
-
import {
|
|
2
|
+
import { KioskClient } from "@mysten/kiosk";
|
|
3
3
|
export declare function getPool(provider: SuiClient, pool: string): Promise<PoolData>;
|
|
4
4
|
export interface PoolData {
|
|
5
5
|
pool_id: string;
|
|
@@ -15,9 +15,9 @@ interface TailsId {
|
|
|
15
15
|
nftId: string;
|
|
16
16
|
kiosk: string;
|
|
17
17
|
kioskCap: string;
|
|
18
|
+
tails: Tails;
|
|
18
19
|
}
|
|
19
|
-
export declare function getTailsIds(
|
|
20
|
-
export declare function getTails(provider: SuiClient, tailsIds: string[]): Promise<Tails[]>;
|
|
20
|
+
export declare function getTailsIds(kioskClient: KioskClient, nftConfig: any, address: string): Promise<TailsId[]>;
|
|
21
21
|
export declare function fieldsToTails(fields: any): Tails;
|
|
22
22
|
export interface Tails {
|
|
23
23
|
id: string;
|
|
@@ -47,8 +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.
|
|
51
|
-
var kiosk_1 = require("@mysten/kiosk");
|
|
50
|
+
exports.LevelExpVec = exports.getLevelExp = exports.fieldsToTails = exports.getTailsIds = exports.getWhitelistMap = exports.getPoolMap = exports.necklaces = exports.getPool = void 0;
|
|
52
51
|
function getPool(provider, pool) {
|
|
53
52
|
var _a;
|
|
54
53
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -145,32 +144,34 @@ function getWhitelistMap(nftConfig, wlTokens) {
|
|
|
145
144
|
});
|
|
146
145
|
}
|
|
147
146
|
exports.getWhitelistMap = getWhitelistMap;
|
|
148
|
-
function getTailsIds(
|
|
147
|
+
function getTailsIds(kioskClient, nftConfig, address) {
|
|
149
148
|
return __awaiter(this, void 0, void 0, function () {
|
|
150
|
-
var
|
|
149
|
+
var kiosks, Tails, _loop_1, _a, _b, kioskOwnerCap, e_1_1;
|
|
151
150
|
var e_1, _c;
|
|
152
151
|
return __generator(this, function (_d) {
|
|
153
152
|
switch (_d.label) {
|
|
154
|
-
case 0:
|
|
153
|
+
case 0: return [4 /*yield*/, kioskClient.getOwnedKiosks({ address: address })];
|
|
154
|
+
case 1:
|
|
155
|
+
kiosks = _d.sent();
|
|
155
156
|
Tails = [];
|
|
156
|
-
kioskClient = new kiosk_1.KioskClient({
|
|
157
|
-
client: provider,
|
|
158
|
-
network: network,
|
|
159
|
-
});
|
|
160
157
|
_loop_1 = function (kioskOwnerCap) {
|
|
161
158
|
var res, tails;
|
|
162
159
|
return __generator(this, function (_e) {
|
|
163
160
|
switch (_e.label) {
|
|
164
|
-
case 0: return [4 /*yield*/, kioskClient.getKiosk({ id: kioskOwnerCap.
|
|
161
|
+
case 0: return [4 /*yield*/, kioskClient.getKiosk({ id: kioskOwnerCap.kioskId, options: { withKioskFields: true, withObjects: true } })];
|
|
165
162
|
case 1:
|
|
166
163
|
res = _e.sent();
|
|
167
164
|
tails = res.items
|
|
168
165
|
.filter(function (item) { return item.type == "".concat(nftConfig.NFT_PACKAGE, "::typus_nft::Tails"); })
|
|
169
166
|
.map(function (item) {
|
|
167
|
+
// console.log(item.data);
|
|
168
|
+
// @ts-ignore
|
|
169
|
+
var tails = item.data;
|
|
170
170
|
var t = {
|
|
171
171
|
nftId: item.objectId,
|
|
172
172
|
kiosk: kioskOwnerCap.kioskId,
|
|
173
173
|
kioskCap: kioskOwnerCap.objectId,
|
|
174
|
+
tails: tails,
|
|
174
175
|
};
|
|
175
176
|
return t;
|
|
176
177
|
});
|
|
@@ -180,76 +181,38 @@ function getTailsIds(provider, network, nftConfig, kiosks) {
|
|
|
180
181
|
}
|
|
181
182
|
});
|
|
182
183
|
};
|
|
183
|
-
_d.label = 1;
|
|
184
|
-
case 1:
|
|
185
|
-
_d.trys.push([1, 6, 7, 8]);
|
|
186
|
-
_a = __values(kiosks.kioskOwnerCaps), _b = _a.next();
|
|
187
184
|
_d.label = 2;
|
|
188
185
|
case 2:
|
|
189
|
-
|
|
186
|
+
_d.trys.push([2, 7, 8, 9]);
|
|
187
|
+
_a = __values(kiosks.kioskOwnerCaps), _b = _a.next();
|
|
188
|
+
_d.label = 3;
|
|
189
|
+
case 3:
|
|
190
|
+
if (!!_b.done) return [3 /*break*/, 6];
|
|
190
191
|
kioskOwnerCap = _b.value;
|
|
191
192
|
return [5 /*yield**/, _loop_1(kioskOwnerCap)];
|
|
192
|
-
case 3:
|
|
193
|
-
_d.sent();
|
|
194
|
-
_d.label = 4;
|
|
195
193
|
case 4:
|
|
194
|
+
_d.sent();
|
|
195
|
+
_d.label = 5;
|
|
196
|
+
case 5:
|
|
196
197
|
_b = _a.next();
|
|
197
|
-
return [3 /*break*/,
|
|
198
|
-
case
|
|
199
|
-
case
|
|
198
|
+
return [3 /*break*/, 3];
|
|
199
|
+
case 6: return [3 /*break*/, 9];
|
|
200
|
+
case 7:
|
|
200
201
|
e_1_1 = _d.sent();
|
|
201
202
|
e_1 = { error: e_1_1 };
|
|
202
|
-
return [3 /*break*/,
|
|
203
|
-
case
|
|
203
|
+
return [3 /*break*/, 9];
|
|
204
|
+
case 8:
|
|
204
205
|
try {
|
|
205
206
|
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
206
207
|
}
|
|
207
208
|
finally { if (e_1) throw e_1.error; }
|
|
208
209
|
return [7 /*endfinally*/];
|
|
209
|
-
case
|
|
210
|
+
case 9: return [2 /*return*/, Tails];
|
|
210
211
|
}
|
|
211
212
|
});
|
|
212
213
|
});
|
|
213
214
|
}
|
|
214
215
|
exports.getTailsIds = getTailsIds;
|
|
215
|
-
function getTails(provider, tailsIds) {
|
|
216
|
-
var _a;
|
|
217
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
218
|
-
var Tails, len, results, results_1, results_1_1, result, fields, tails;
|
|
219
|
-
var e_2, _b;
|
|
220
|
-
return __generator(this, function (_c) {
|
|
221
|
-
switch (_c.label) {
|
|
222
|
-
case 0:
|
|
223
|
-
Tails = [];
|
|
224
|
-
_c.label = 1;
|
|
225
|
-
case 1:
|
|
226
|
-
if (!(tailsIds.length > 0)) return [3 /*break*/, 3];
|
|
227
|
-
len = tailsIds.length > 50 ? 50 : tailsIds.length;
|
|
228
|
-
return [4 /*yield*/, provider.multiGetObjects({ ids: tailsIds.splice(0, len), options: { showContent: true } })];
|
|
229
|
-
case 2:
|
|
230
|
-
results = _c.sent();
|
|
231
|
-
try {
|
|
232
|
-
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()) {
|
|
233
|
-
result = results_1_1.value;
|
|
234
|
-
fields = (_a = result.data) === null || _a === void 0 ? void 0 : _a.content.fields;
|
|
235
|
-
tails = fieldsToTails(fields);
|
|
236
|
-
Tails.push(tails);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
240
|
-
finally {
|
|
241
|
-
try {
|
|
242
|
-
if (results_1_1 && !results_1_1.done && (_b = results_1.return)) _b.call(results_1);
|
|
243
|
-
}
|
|
244
|
-
finally { if (e_2) throw e_2.error; }
|
|
245
|
-
}
|
|
246
|
-
return [3 /*break*/, 1];
|
|
247
|
-
case 3: return [2 /*return*/, Tails];
|
|
248
|
-
}
|
|
249
|
-
});
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
exports.getTails = getTails;
|
|
253
216
|
function fieldsToTails(fields) {
|
|
254
217
|
// console.log(fields.attributes.fields.contents);
|
|
255
218
|
var attributes = new Map();
|