@typus/typus-sdk 1.2.17 → 1.2.19
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/auto-bid/user-entry.d.ts +3 -3
- package/lib/utils/auto-bid/user-entry.js +8 -4
- package/lib/utils/auto-bid/view-function.d.ts +1 -1
- package/lib/utils/auto-bid/view-function.js +21 -16
- package/lib/utils/typus-nft/fetch.d.ts +15 -0
- package/lib/utils/typus-nft/fetch.js +47 -1
- package/lib/utils/typus-nft/user-entry.d.ts +10 -0
- package/lib/utils/typus-nft/user-entry.js +43 -1
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@ import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
|
13
13
|
)
|
|
14
14
|
*/
|
|
15
15
|
export declare function getNewStrategyTx(gasBudget: number, packageId: string, typeArguments: string[], // D_TOKEN, B_TOKEN
|
|
16
|
-
strategy_pool: string, vault_index: string, signal_index: string, coins: string[], amount: string, size: string, price_percentage: string, max_times: string, target_rounds: string[]): TransactionBlock;
|
|
16
|
+
registry: string, strategy_pool: string, vault_index: string, signal_index: string, coins: string[], amount: string, size: string, price_percentage: string, max_times: string, target_rounds: string[]): TransactionBlock;
|
|
17
17
|
/**
|
|
18
18
|
entry fun close_strategy<D_TOKEN, B_TOKEN>(
|
|
19
19
|
strategy_pool: &mut StrategyPoolV2,
|
|
@@ -24,7 +24,7 @@ strategy_pool: string, vault_index: string, signal_index: string, coins: string[
|
|
|
24
24
|
)
|
|
25
25
|
*/
|
|
26
26
|
export declare function getCloseStrategyTx(gasBudget: number, packageId: string, typeArguments: string[], // D_TOKEN, B_TOKEN
|
|
27
|
-
strategy_pool: string, vault_index: string, signal_index: string, strategy_index: string): TransactionBlock;
|
|
27
|
+
registry: string, strategy_pool: string, vault_index: string, signal_index: string, strategy_index: string): TransactionBlock;
|
|
28
28
|
/**
|
|
29
29
|
entry fun update_strategy<D_TOKEN, B_TOKEN>(
|
|
30
30
|
strategy_pool: &mut StrategyPoolV2,
|
|
@@ -40,4 +40,4 @@ strategy_pool: string, vault_index: string, signal_index: string, strategy_index
|
|
|
40
40
|
)
|
|
41
41
|
*/
|
|
42
42
|
export declare function getUpdateStrategyTx(gasBudget: number, packageId: string, typeArguments: string[], // D_TOKEN, B_TOKEN
|
|
43
|
-
strategy_pool: string, vault_index: string, signal_index: string, strategy_index: string, coins: string[], amount: string, size: string | null, price_percentage: string | null, max_times: string | null, target_rounds: string[]): TransactionBlock;
|
|
43
|
+
registry: string, strategy_pool: string, vault_index: string, signal_index: string, strategy_index: string, coins: string[], amount: string, size: string | null, price_percentage: string | null, max_times: string | null, target_rounds: string[]): TransactionBlock;
|
|
@@ -32,7 +32,7 @@ var transactions_1 = require("@mysten/sui.js/transactions");
|
|
|
32
32
|
)
|
|
33
33
|
*/
|
|
34
34
|
function getNewStrategyTx(gasBudget, packageId, typeArguments, // D_TOKEN, B_TOKEN
|
|
35
|
-
strategy_pool, vault_index, signal_index, coins, amount, size, price_percentage, max_times, target_rounds) {
|
|
35
|
+
registry, strategy_pool, vault_index, signal_index, coins, amount, size, price_percentage, max_times, target_rounds) {
|
|
36
36
|
var tx = new transactions_1.TransactionBlock();
|
|
37
37
|
if (
|
|
38
38
|
// B_TOKEN
|
|
@@ -43,6 +43,7 @@ strategy_pool, vault_index, signal_index, coins, amount, size, price_percentage,
|
|
|
43
43
|
target: "".concat(packageId, "::auto_bid::new_strategy"),
|
|
44
44
|
typeArguments: typeArguments,
|
|
45
45
|
arguments: [
|
|
46
|
+
tx.object(registry),
|
|
46
47
|
tx.object(strategy_pool),
|
|
47
48
|
tx.pure(vault_index),
|
|
48
49
|
tx.pure(signal_index),
|
|
@@ -64,6 +65,7 @@ strategy_pool, vault_index, signal_index, coins, amount, size, price_percentage,
|
|
|
64
65
|
target: "".concat(packageId, "::auto_bid::new_strategy"),
|
|
65
66
|
typeArguments: typeArguments,
|
|
66
67
|
arguments: [
|
|
68
|
+
tx.object(registry),
|
|
67
69
|
tx.object(strategy_pool),
|
|
68
70
|
tx.pure(vault_index),
|
|
69
71
|
tx.pure(signal_index),
|
|
@@ -89,12 +91,12 @@ exports.getNewStrategyTx = getNewStrategyTx;
|
|
|
89
91
|
)
|
|
90
92
|
*/
|
|
91
93
|
function getCloseStrategyTx(gasBudget, packageId, typeArguments, // D_TOKEN, B_TOKEN
|
|
92
|
-
strategy_pool, vault_index, signal_index, strategy_index) {
|
|
94
|
+
registry, strategy_pool, vault_index, signal_index, strategy_index) {
|
|
93
95
|
var tx = new transactions_1.TransactionBlock();
|
|
94
96
|
tx.moveCall({
|
|
95
97
|
target: "".concat(packageId, "::auto_bid::close_strategy"),
|
|
96
98
|
typeArguments: typeArguments,
|
|
97
|
-
arguments: [tx.object(strategy_pool), tx.pure(vault_index), tx.pure(signal_index), tx.pure(strategy_index)],
|
|
99
|
+
arguments: [tx.object(registry), tx.object(strategy_pool), tx.pure(vault_index), tx.pure(signal_index), tx.pure(strategy_index)],
|
|
98
100
|
});
|
|
99
101
|
tx.setGasBudget(gasBudget);
|
|
100
102
|
return tx;
|
|
@@ -115,7 +117,7 @@ exports.getCloseStrategyTx = getCloseStrategyTx;
|
|
|
115
117
|
)
|
|
116
118
|
*/
|
|
117
119
|
function getUpdateStrategyTx(gasBudget, packageId, typeArguments, // D_TOKEN, B_TOKEN
|
|
118
|
-
strategy_pool, vault_index, signal_index, strategy_index, coins, amount, size, price_percentage, max_times, target_rounds) {
|
|
120
|
+
registry, strategy_pool, vault_index, signal_index, strategy_index, coins, amount, size, price_percentage, max_times, target_rounds) {
|
|
119
121
|
var tx = new transactions_1.TransactionBlock();
|
|
120
122
|
if (
|
|
121
123
|
// B_TOKEN
|
|
@@ -126,6 +128,7 @@ strategy_pool, vault_index, signal_index, strategy_index, coins, amount, size, p
|
|
|
126
128
|
target: "".concat(packageId, "::auto_bid::update_strategy"),
|
|
127
129
|
typeArguments: typeArguments,
|
|
128
130
|
arguments: [
|
|
131
|
+
tx.object(registry),
|
|
129
132
|
tx.object(strategy_pool),
|
|
130
133
|
tx.pure(vault_index),
|
|
131
134
|
tx.pure(signal_index),
|
|
@@ -148,6 +151,7 @@ strategy_pool, vault_index, signal_index, strategy_index, coins, amount, size, p
|
|
|
148
151
|
target: "".concat(packageId, "::auto_bid::update_strategy"),
|
|
149
152
|
typeArguments: typeArguments,
|
|
150
153
|
arguments: [
|
|
154
|
+
tx.object(registry),
|
|
151
155
|
tx.object(strategy_pool),
|
|
152
156
|
tx.pure(vault_index),
|
|
153
157
|
tx.pure(signal_index),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SuiClient } from "@mysten/sui.js/client";
|
|
2
2
|
export declare function getUserStrategies(provider: SuiClient, packageId: string, strategyPool: string, user: string): Promise<StrategyV2[]>;
|
|
3
|
-
export declare function getVaults(provider: SuiClient, strategyPool: string): Promise<
|
|
3
|
+
export declare function getVaults(provider: SuiClient, strategyPool: string): Promise<StrategyPoolV2>;
|
|
4
4
|
export interface StrategyPoolV2 {
|
|
5
5
|
id: string;
|
|
6
6
|
strategies: Map<string, Map<string, StrategyV2[]>>;
|
|
@@ -168,46 +168,51 @@ exports.getUserStrategies = getUserStrategies;
|
|
|
168
168
|
function getVaults(provider, strategyPool) {
|
|
169
169
|
var _a;
|
|
170
170
|
return __awaiter(this, void 0, void 0, function () {
|
|
171
|
-
var pool, vaults, vaults_1, vaults_1_1, vault, signals,
|
|
172
|
-
var e_1,
|
|
173
|
-
return __generator(this, function (
|
|
174
|
-
switch (
|
|
171
|
+
var pool, vaults, strategies, vaults_1, vaults_1_1, vault, signals, _b, _c, signal, strategy_pool;
|
|
172
|
+
var e_1, _d, e_2, _e;
|
|
173
|
+
return __generator(this, function (_f) {
|
|
174
|
+
switch (_f.label) {
|
|
175
175
|
case 0: return [4 /*yield*/, provider.getObject({ id: strategyPool, options: { showContent: true } })];
|
|
176
176
|
case 1:
|
|
177
|
-
pool = (_a = (
|
|
178
|
-
console.log(pool);
|
|
177
|
+
pool = (_a = (_f.sent()).data) === null || _a === void 0 ? void 0 : _a.content.fields;
|
|
179
178
|
vaults = pool.strategies.fields.contents;
|
|
179
|
+
strategies = new Map();
|
|
180
180
|
try {
|
|
181
181
|
for (vaults_1 = __values(vaults), vaults_1_1 = vaults_1.next(); !vaults_1_1.done; vaults_1_1 = vaults_1.next()) {
|
|
182
182
|
vault = vaults_1_1.value;
|
|
183
|
-
signals =
|
|
184
|
-
console.log("vault: ", vault);
|
|
185
|
-
console.log("signals: ", signals);
|
|
183
|
+
signals = new Map();
|
|
186
184
|
try {
|
|
187
|
-
for (
|
|
188
|
-
signal =
|
|
189
|
-
strategyTable = signal.fields.value.fields.contents;
|
|
190
|
-
console.log(strategyTable);
|
|
185
|
+
for (_b = (e_2 = void 0, __values(vault.fields.value.fields.contents)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
186
|
+
signal = _c.value;
|
|
187
|
+
// let strategyTable = signal.fields.value.fields.contents;
|
|
188
|
+
// console.log(strategyTable);
|
|
191
189
|
// dynamic fields
|
|
190
|
+
signals.set(signal.fields.key, []);
|
|
192
191
|
}
|
|
193
192
|
}
|
|
194
193
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
195
194
|
finally {
|
|
196
195
|
try {
|
|
197
|
-
if (
|
|
196
|
+
if (_c && !_c.done && (_e = _b.return)) _e.call(_b);
|
|
198
197
|
}
|
|
199
198
|
finally { if (e_2) throw e_2.error; }
|
|
200
199
|
}
|
|
200
|
+
strategies.set(vault.fields.key, signals);
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
204
204
|
finally {
|
|
205
205
|
try {
|
|
206
|
-
if (vaults_1_1 && !vaults_1_1.done && (
|
|
206
|
+
if (vaults_1_1 && !vaults_1_1.done && (_d = vaults_1.return)) _d.call(vaults_1);
|
|
207
207
|
}
|
|
208
208
|
finally { if (e_1) throw e_1.error; }
|
|
209
209
|
}
|
|
210
|
-
|
|
210
|
+
strategy_pool = {
|
|
211
|
+
id: pool.id.id,
|
|
212
|
+
strategies: strategies,
|
|
213
|
+
authority: pool.authority,
|
|
214
|
+
};
|
|
215
|
+
return [2 /*return*/, strategy_pool];
|
|
211
216
|
}
|
|
212
217
|
});
|
|
213
218
|
});
|
|
@@ -37,4 +37,19 @@ export interface Tails {
|
|
|
37
37
|
export declare function getLevelExp(level: number): number | undefined;
|
|
38
38
|
export declare const LevelExpVec: number[];
|
|
39
39
|
export declare function getTableTails(provider: SuiClient, parentId: string): Promise<Tails[]>;
|
|
40
|
+
export declare function getDiscountPool(provider: SuiClient, pool: string): Promise<DiscountPoolData>;
|
|
41
|
+
export interface DiscountPoolData {
|
|
42
|
+
id: string;
|
|
43
|
+
num: string;
|
|
44
|
+
price: string;
|
|
45
|
+
start_ms: string;
|
|
46
|
+
end_ms: string;
|
|
47
|
+
authority: string;
|
|
48
|
+
public_key: number[];
|
|
49
|
+
discount_pcts: string[];
|
|
50
|
+
is_live: boolean;
|
|
51
|
+
balance: string;
|
|
52
|
+
remaining: number;
|
|
53
|
+
}
|
|
54
|
+
export declare function getMintHistory(provider: SuiClient, NFT_PACKAGE_UPGRADE: string, vrf_input: any): Promise<import("@mysten/sui.js/client").PaginatedEvents | undefined>;
|
|
40
55
|
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.getTableTails = exports.LevelExpVec = exports.getLevelExp = exports.fieldsToTails = exports.getTails = exports.getTailsIds = exports.getWhitelistMap = exports.getPoolMap = exports.necklaces = exports.getPool = void 0;
|
|
50
|
+
exports.getMintHistory = exports.getDiscountPool = exports.getTableTails = 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 () {
|
|
@@ -333,3 +333,49 @@ function getTableTails(provider, parentId) {
|
|
|
333
333
|
});
|
|
334
334
|
}
|
|
335
335
|
exports.getTableTails = getTableTails;
|
|
336
|
+
function getDiscountPool(provider, pool) {
|
|
337
|
+
var _a;
|
|
338
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
339
|
+
var res, poolData, remaining;
|
|
340
|
+
return __generator(this, function (_b) {
|
|
341
|
+
switch (_b.label) {
|
|
342
|
+
case 0: return [4 /*yield*/, provider.getObject({ id: pool, options: { showContent: true } })];
|
|
343
|
+
case 1:
|
|
344
|
+
res = _b.sent();
|
|
345
|
+
poolData = (_a = res.data) === null || _a === void 0 ? void 0 : _a.content.fields;
|
|
346
|
+
remaining = poolData.tails.fields.contents.fields.size - poolData.requests.length;
|
|
347
|
+
poolData.remaining = remaining;
|
|
348
|
+
return [2 /*return*/, poolData];
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
exports.getDiscountPool = getDiscountPool;
|
|
354
|
+
function getMintHistory(provider, NFT_PACKAGE_UPGRADE, vrf_input) {
|
|
355
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
356
|
+
var eventFilter, result, res, eventFilter_1, result;
|
|
357
|
+
return __generator(this, function (_a) {
|
|
358
|
+
switch (_a.label) {
|
|
359
|
+
case 0:
|
|
360
|
+
eventFilter = {
|
|
361
|
+
MoveEventType: "".concat(NFT_PACKAGE_UPGRADE, "::discount_mint::DiscountEventV2"),
|
|
362
|
+
};
|
|
363
|
+
return [4 /*yield*/, provider.queryEvents({ query: eventFilter, order: "descending" })];
|
|
364
|
+
case 1:
|
|
365
|
+
result = _a.sent();
|
|
366
|
+
res = result.data.filter(function (d) { return d.parsedJson.vrf_input.toString() == vrf_input.toString(); });
|
|
367
|
+
if (!(res.length > 0)) return [3 /*break*/, 3];
|
|
368
|
+
eventFilter_1 = {
|
|
369
|
+
Transaction: res[0].id.txDigest,
|
|
370
|
+
};
|
|
371
|
+
return [4 /*yield*/, provider.queryEvents({ query: eventFilter_1, order: "descending" })];
|
|
372
|
+
case 2:
|
|
373
|
+
result = _a.sent();
|
|
374
|
+
// console.log(result);
|
|
375
|
+
return [2 /*return*/, result];
|
|
376
|
+
case 3: return [2 /*return*/];
|
|
377
|
+
}
|
|
378
|
+
});
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
exports.getMintHistory = getMintHistory;
|
|
@@ -25,3 +25,13 @@ export declare function getMintToKioskTx(gasBudget: number, nftPackageId: string
|
|
|
25
25
|
)
|
|
26
26
|
*/
|
|
27
27
|
export declare function getPayRoyaltyTx(tx: TransactionBlock, nftPackageId: string, policy: string, request: TransactionArgument, coin: any): Promise<TransactionBlock>;
|
|
28
|
+
/**
|
|
29
|
+
entry fun request_mint(
|
|
30
|
+
pool: &mut Pool,
|
|
31
|
+
seed: u64, // 0, 1, 2
|
|
32
|
+
coin: Coin<SUI>,
|
|
33
|
+
clock: &Clock,
|
|
34
|
+
ctx: & TxContext
|
|
35
|
+
)
|
|
36
|
+
*/
|
|
37
|
+
export declare function getRequestMintTx(gasBudget: number, nftPackageId: string, pool: string, seed: string, price: string): Promise<TransactionBlock>;
|
|
@@ -35,8 +35,24 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
36
|
}
|
|
37
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
|
+
};
|
|
38
54
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.getPayRoyaltyTx = exports.getMintToKioskTx = exports.getMintTx = void 0;
|
|
55
|
+
exports.getRequestMintTx = exports.getPayRoyaltyTx = exports.getMintToKioskTx = exports.getMintTx = void 0;
|
|
40
56
|
var transactions_1 = require("@mysten/sui.js/transactions");
|
|
41
57
|
var constants_1 = require("../../constants");
|
|
42
58
|
/**
|
|
@@ -114,3 +130,29 @@ function getPayRoyaltyTx(tx, nftPackageId, policy, request, coin) {
|
|
|
114
130
|
});
|
|
115
131
|
}
|
|
116
132
|
exports.getPayRoyaltyTx = getPayRoyaltyTx;
|
|
133
|
+
/**
|
|
134
|
+
entry fun request_mint(
|
|
135
|
+
pool: &mut Pool,
|
|
136
|
+
seed: u64, // 0, 1, 2
|
|
137
|
+
coin: Coin<SUI>,
|
|
138
|
+
clock: &Clock,
|
|
139
|
+
ctx: & TxContext
|
|
140
|
+
)
|
|
141
|
+
*/
|
|
142
|
+
function getRequestMintTx(gasBudget, nftPackageId, pool, seed, price) {
|
|
143
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
144
|
+
var tx, _a, coin;
|
|
145
|
+
return __generator(this, function (_b) {
|
|
146
|
+
tx = new transactions_1.TransactionBlock();
|
|
147
|
+
_a = __read(tx.splitCoins(tx.gas, [tx.pure(price)]), 1), coin = _a[0];
|
|
148
|
+
tx.moveCall({
|
|
149
|
+
target: "".concat(nftPackageId, "::discount_mint::request_mint"),
|
|
150
|
+
typeArguments: [],
|
|
151
|
+
arguments: [tx.object(pool), tx.pure(seed), coin, tx.object(constants_1.CLOCK)],
|
|
152
|
+
});
|
|
153
|
+
tx.setGasBudget(gasBudget);
|
|
154
|
+
return [2 /*return*/, tx];
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
exports.getRequestMintTx = getRequestMintTx;
|