@typus/typus-sdk 1.2.16 → 1.2.18
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-dov-single-v2/mfud-user-entry.d.ts +5 -0
- package/lib/utils/typus-dov-single-v2/mfud-user-entry.js +92 -5
- package/lib/utils/typus-nft/fetch.d.ts +13 -0
- package/lib/utils/typus-nft/fetch.js +17 -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
|
});
|
|
@@ -41,12 +41,16 @@ export declare function getUnsubscribeTx(input: {
|
|
|
41
41
|
export declare function getCompoundTx(input: {
|
|
42
42
|
tx: TransactionBlock;
|
|
43
43
|
typusFrameworkOriginPackageId: string;
|
|
44
|
+
typusFrameworkPackageId: string;
|
|
44
45
|
typusDovSinglePackageId: string;
|
|
45
46
|
typusDovSingleRegistry: string;
|
|
47
|
+
mfudPackageId: string;
|
|
48
|
+
mfudRegistry: string;
|
|
46
49
|
typeArguments: string[];
|
|
47
50
|
index: string;
|
|
48
51
|
receipts: string[] | TransactionObjectArgument[];
|
|
49
52
|
user: string;
|
|
53
|
+
incentiveToken?: string;
|
|
50
54
|
}): TransactionBlock;
|
|
51
55
|
export declare function getClaimTx(input: {
|
|
52
56
|
tx: TransactionBlock;
|
|
@@ -73,6 +77,7 @@ export declare function getHarvestTx(input: {
|
|
|
73
77
|
index: string;
|
|
74
78
|
receipts: string[] | TransactionObjectArgument[];
|
|
75
79
|
user: string;
|
|
80
|
+
incentiveToken?: string;
|
|
76
81
|
}): TransactionBlock;
|
|
77
82
|
export declare function getRedeemTx(input: {
|
|
78
83
|
tx: TransactionBlock;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getRebateTx = exports.getExerciseTx = exports.getNewBidTx = exports.getRedeemTx = exports.getHarvestTx = exports.getClaimTx = exports.getCompoundTx = exports.getUnsubscribeTx = exports.getWithdrawTx = exports.getDepositTx = void 0;
|
|
4
4
|
var constants_1 = require("../../constants");
|
|
5
|
+
var user_entry_1 = require("./user-entry");
|
|
5
6
|
function getDepositTx(input) {
|
|
6
7
|
var mfud = input.tx.moveCall({
|
|
7
8
|
target: "".concat(input.mfudPackageId, "::mfud::mint"),
|
|
@@ -100,7 +101,50 @@ function getCompoundTx(input) {
|
|
|
100
101
|
input.tx.object(constants_1.CLOCK),
|
|
101
102
|
],
|
|
102
103
|
});
|
|
103
|
-
|
|
104
|
+
if (input.incentiveToken) {
|
|
105
|
+
input.typeArguments.push(input.incentiveToken);
|
|
106
|
+
if (input.incentiveToken == "".concat(input.mfudPackageId, "::mfud::MFUD")) {
|
|
107
|
+
var receipt = input.tx.moveCall({
|
|
108
|
+
target: "0x1::option::destroy_some",
|
|
109
|
+
typeArguments: ["".concat(input.typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt")],
|
|
110
|
+
arguments: [input.tx.object(result[1])],
|
|
111
|
+
});
|
|
112
|
+
input.tx = getRedeemTx({
|
|
113
|
+
tx: input.tx,
|
|
114
|
+
typusFrameworkOriginPackageId: input.typusFrameworkOriginPackageId,
|
|
115
|
+
typusFrameworkPackageId: input.typusFrameworkPackageId,
|
|
116
|
+
typusDovSinglePackageId: input.typusDovSinglePackageId,
|
|
117
|
+
typusDovSingleRegistry: input.typusDovSingleRegistry,
|
|
118
|
+
mfudPackageId: input.mfudPackageId,
|
|
119
|
+
mfudRegistry: input.mfudRegistry,
|
|
120
|
+
typeArguments: input.typeArguments,
|
|
121
|
+
index: input.index,
|
|
122
|
+
receipts: [input.tx.object(receipt)],
|
|
123
|
+
user: input.user,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
var receipt = input.tx.moveCall({
|
|
128
|
+
target: "0x1::option::destroy_some",
|
|
129
|
+
typeArguments: ["".concat(input.typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt")],
|
|
130
|
+
arguments: [input.tx.object(result[1])],
|
|
131
|
+
});
|
|
132
|
+
input.tx = (0, user_entry_1.getRedeemTx)({
|
|
133
|
+
tx: input.tx,
|
|
134
|
+
typusFrameworkOriginPackageId: input.typusFrameworkOriginPackageId,
|
|
135
|
+
typusFrameworkPackageId: input.typusFrameworkPackageId,
|
|
136
|
+
typusDovSinglePackageId: input.typusDovSinglePackageId,
|
|
137
|
+
typusDovSingleRegistry: input.typusDovSingleRegistry,
|
|
138
|
+
typeArguments: input.typeArguments,
|
|
139
|
+
index: input.index,
|
|
140
|
+
receipts: [input.tx.object(receipt)],
|
|
141
|
+
user: input.user,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
input.tx.transferObjects([input.tx.object(result[0])], input.user);
|
|
147
|
+
}
|
|
104
148
|
return input.tx;
|
|
105
149
|
}
|
|
106
150
|
exports.getCompoundTx = getCompoundTx;
|
|
@@ -157,10 +201,53 @@ function getHarvestTx(input) {
|
|
|
157
201
|
arguments: [input.tx.object(input.mfudRegistry), input.tx.object(mfud_coin)],
|
|
158
202
|
});
|
|
159
203
|
input.tx.transferObjects([input.tx.object(fud_coin)], input.user);
|
|
160
|
-
input.
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
204
|
+
if (input.incentiveToken) {
|
|
205
|
+
input.typeArguments.push(input.incentiveToken);
|
|
206
|
+
if (input.incentiveToken == "".concat(input.mfudPackageId, "::mfud::MFUD")) {
|
|
207
|
+
var receipt = input.tx.moveCall({
|
|
208
|
+
target: "0x1::option::destroy_some",
|
|
209
|
+
typeArguments: ["".concat(input.typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt")],
|
|
210
|
+
arguments: [input.tx.object(result[1])],
|
|
211
|
+
});
|
|
212
|
+
input.tx = getRedeemTx({
|
|
213
|
+
tx: input.tx,
|
|
214
|
+
typusFrameworkOriginPackageId: input.typusFrameworkOriginPackageId,
|
|
215
|
+
typusFrameworkPackageId: input.typusFrameworkPackageId,
|
|
216
|
+
typusDovSinglePackageId: input.typusDovSinglePackageId,
|
|
217
|
+
typusDovSingleRegistry: input.typusDovSingleRegistry,
|
|
218
|
+
mfudPackageId: input.mfudPackageId,
|
|
219
|
+
mfudRegistry: input.mfudRegistry,
|
|
220
|
+
typeArguments: input.typeArguments,
|
|
221
|
+
index: input.index,
|
|
222
|
+
receipts: [input.tx.object(receipt)],
|
|
223
|
+
user: input.user,
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
var receipt = input.tx.moveCall({
|
|
228
|
+
target: "0x1::option::destroy_some",
|
|
229
|
+
typeArguments: ["".concat(input.typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt")],
|
|
230
|
+
arguments: [input.tx.object(result[1])],
|
|
231
|
+
});
|
|
232
|
+
input.tx = (0, user_entry_1.getRedeemTx)({
|
|
233
|
+
tx: input.tx,
|
|
234
|
+
typusFrameworkOriginPackageId: input.typusFrameworkOriginPackageId,
|
|
235
|
+
typusFrameworkPackageId: input.typusFrameworkPackageId,
|
|
236
|
+
typusDovSinglePackageId: input.typusDovSinglePackageId,
|
|
237
|
+
typusDovSingleRegistry: input.typusDovSingleRegistry,
|
|
238
|
+
typeArguments: input.typeArguments,
|
|
239
|
+
index: input.index,
|
|
240
|
+
receipts: [input.tx.object(receipt)],
|
|
241
|
+
user: input.user,
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
input.tx.moveCall({
|
|
247
|
+
target: "".concat(input.typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
|
|
248
|
+
arguments: [input.tx.object(result[1]), input.tx.pure(input.user)],
|
|
249
|
+
});
|
|
250
|
+
}
|
|
164
251
|
return input.tx;
|
|
165
252
|
}
|
|
166
253
|
exports.getHarvestTx = getHarvestTx;
|
|
@@ -37,4 +37,17 @@ 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
|
+
}
|
|
40
53
|
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.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,19 @@ 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;
|
|
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
|
+
return [2 /*return*/, poolData];
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
exports.getDiscountPool = getDiscountPool;
|
|
@@ -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;
|