@typus/typus-sdk 1.4.20 → 1.4.22
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/dist/src/auto-bid/token-user-entry.d.ts +46 -8
- package/dist/src/auto-bid/token-user-entry.js +117 -74
- package/dist/src/auto-bid/user-entry.d.ts +42 -8
- package/dist/src/auto-bid/user-entry.js +92 -93
- package/dist/src/auto-bid/view-function.d.ts +8 -5
- package/dist/src/auto-bid/view-function.js +26 -15
- package/dist/src/constants/constant.d.ts +1 -0
- package/dist/src/constants/constant.js +2 -1
- package/dist/src/dice/api.d.ts +13 -1
- package/dist/src/dice/api.js +25 -14
- package/dist/src/dice/fetch.d.ts +8 -12
- package/dist/src/dice/fetch.js +77 -30
- package/dist/src/dice/user-entry.d.ts +29 -17
- package/dist/src/dice/user-entry.js +114 -79
- package/dist/src/dice/view-function.d.ts +14 -1
- package/dist/src/dice/view-function.js +34 -25
- package/dist/src/typus/airdrop/view-function.d.ts +1 -2
- package/dist/src/typus/airdrop/view-function.js +6 -3
- package/dist/src/typus/leaderboard/view-function.d.ts +1 -2
- package/dist/src/typus/leaderboard/view-function.js +6 -3
- package/dist/src/typus/tails-staking/authority-entry.js +2 -2
- package/dist/src/typus/tails-staking/view-function.d.ts +2 -3
- package/dist/src/typus/tails-staking/view-function.js +10 -6
- package/dist/src/typus/user/view-function.d.ts +1 -2
- package/dist/src/typus/user/view-function.js +6 -4
- package/dist/src/typus-dov-single-v2/authority-entry.d.ts +0 -25
- package/dist/src/typus-dov-single-v2/authority-entry.js +26 -0
- package/dist/src/typus-dov-single-v2/function/bidding.d.ts +5 -3
- package/dist/src/typus-dov-single-v2/function/bidding.js +17 -14
- package/dist/src/typus-dov-single-v2/history/vault-history.d.ts +3 -2
- package/dist/src/typus-dov-single-v2/history/vault-history.js +6 -4
- package/dist/src/typus-dov-single-v2/token-user-entry.js +10 -10
- package/dist/src/typus-dov-single-v2/view-function.d.ts +7 -7
- package/dist/src/typus-dov-single-v2/view-function.js +26 -19
- package/dist/src/typus-nft/user-entry.d.ts +25 -6
- package/dist/src/typus-nft/user-entry.js +24 -36
- package/dist/src/typus-perp/fetch.d.ts +7 -8
- package/dist/src/typus-perp/fetch.js +35 -24
- package/dist/src/typus-perp/user/order.d.ts +4 -11
- package/dist/src/typus-perp/user/order.js +23 -23
- package/dist/src/typus-perp/user/orderWithBidReceipt.d.ts +9 -9
- package/dist/src/typus-perp/user/orderWithBidReceipt.js +50 -49
- package/dist/src/typus-perp/user/tlp.d.ts +5 -13
- package/dist/src/typus-perp/user/tlp.js +30 -30
- package/dist/src/typus-safu/user-entry.d.ts +4 -8
- package/dist/src/typus-safu/user-entry.js +56 -56
- package/dist/src/typus-safu/view-function.d.ts +0 -3
- package/dist/src/typus-safu/view-function.js +10 -7
- package/package.json +1 -1
|
@@ -57,7 +57,6 @@ exports.playGuessTx = playGuessTx;
|
|
|
57
57
|
exports.newGamePlayGuessTx = newGamePlayGuessTx;
|
|
58
58
|
exports.getConsumeExpCoinStakedTx = getConsumeExpCoinStakedTx;
|
|
59
59
|
exports.getConsumeExpCoinUnstakedTx = getConsumeExpCoinUnstakedTx;
|
|
60
|
-
var transactions_1 = require("@mysten/sui.js/transactions");
|
|
61
60
|
/**
|
|
62
61
|
public(friend) entry fun new_game<TOKEN>(
|
|
63
62
|
registry: &mut Registry,
|
|
@@ -67,18 +66,31 @@ var transactions_1 = require("@mysten/sui.js/transactions");
|
|
|
67
66
|
ctx: &mut TxContext
|
|
68
67
|
)
|
|
69
68
|
*/
|
|
70
|
-
function newGameTx(
|
|
71
|
-
registry, index, coins, amount) {
|
|
69
|
+
function newGameTx(config, tx, input) {
|
|
72
70
|
return __awaiter(this, void 0, void 0, function () {
|
|
73
|
-
var
|
|
71
|
+
var registry;
|
|
74
72
|
return __generator(this, function (_a) {
|
|
75
|
-
|
|
73
|
+
registry = "";
|
|
74
|
+
switch (input.module) {
|
|
75
|
+
case "tails_exp":
|
|
76
|
+
registry = config.registry.dice.tailsExp;
|
|
77
|
+
break;
|
|
78
|
+
case "combo_dice":
|
|
79
|
+
registry = config.registry.dice.comboDice;
|
|
80
|
+
break;
|
|
81
|
+
default:
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
76
84
|
tx.moveCall({
|
|
77
|
-
target: "".concat(
|
|
78
|
-
typeArguments: typeArguments,
|
|
79
|
-
arguments: [
|
|
85
|
+
target: "".concat(config.package.dice, "::").concat(module, "::new_game"),
|
|
86
|
+
typeArguments: input.typeArguments,
|
|
87
|
+
arguments: [
|
|
88
|
+
tx.object(registry),
|
|
89
|
+
tx.pure(input.index),
|
|
90
|
+
tx.makeMoveVec({ objects: input.coins.map(function (id) { return tx.object(id); }) }),
|
|
91
|
+
tx.pure(input.amount),
|
|
92
|
+
],
|
|
80
93
|
});
|
|
81
|
-
tx.setGasBudget(gasBudget);
|
|
82
94
|
return [2 /*return*/, tx];
|
|
83
95
|
});
|
|
84
96
|
});
|
|
@@ -95,67 +107,91 @@ registry, index, coins, amount) {
|
|
|
95
107
|
ctx: &mut TxContext
|
|
96
108
|
)
|
|
97
109
|
*/
|
|
98
|
-
function playGuessTx(
|
|
110
|
+
function playGuessTx(config, tx, input) {
|
|
99
111
|
return __awaiter(this, void 0, void 0, function () {
|
|
100
|
-
var
|
|
112
|
+
var registry;
|
|
101
113
|
return __generator(this, function (_a) {
|
|
102
|
-
|
|
114
|
+
registry = "";
|
|
115
|
+
switch (input.module) {
|
|
116
|
+
case "tails_exp":
|
|
117
|
+
registry = config.registry.dice.tailsExp;
|
|
118
|
+
break;
|
|
119
|
+
case "combo_dice":
|
|
120
|
+
registry = config.registry.dice.comboDice;
|
|
121
|
+
break;
|
|
122
|
+
default:
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
103
125
|
tx.moveCall({
|
|
104
|
-
target: "".concat(
|
|
126
|
+
target: "".concat(config.package.dice, "::").concat(module, "::play_guess"),
|
|
105
127
|
typeArguments: [],
|
|
106
128
|
arguments: [
|
|
107
129
|
tx.object(registry),
|
|
108
|
-
tx.pure(index),
|
|
109
|
-
tx.pure(guess_1),
|
|
110
|
-
tx.pure(larger_than_1),
|
|
111
|
-
tx.pure(guess_2),
|
|
112
|
-
tx.pure(larger_than_2),
|
|
130
|
+
tx.pure(input.index),
|
|
131
|
+
tx.pure(input.guess_1),
|
|
132
|
+
tx.pure(input.larger_than_1),
|
|
133
|
+
tx.pure(input.guess_2),
|
|
134
|
+
tx.pure(input.larger_than_2),
|
|
113
135
|
],
|
|
114
136
|
});
|
|
115
|
-
tx.setGasBudget(gasBudget);
|
|
116
137
|
return [2 /*return*/, tx];
|
|
117
138
|
});
|
|
118
139
|
});
|
|
119
140
|
}
|
|
120
|
-
function newGamePlayGuessTx(
|
|
121
|
-
registry, expRegistry, index, coins, amount, guess_1, larger_than_1, guess_2, larger_than_2) {
|
|
141
|
+
function newGamePlayGuessTx(config, tx, input) {
|
|
122
142
|
return __awaiter(this, void 0, void 0, function () {
|
|
123
|
-
var
|
|
143
|
+
var registry, _a, coin;
|
|
124
144
|
return __generator(this, function (_b) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
145
|
+
registry = "";
|
|
146
|
+
switch (input.module) {
|
|
147
|
+
case "tails_exp":
|
|
148
|
+
registry = config.registry.dice.tailsExp;
|
|
149
|
+
break;
|
|
150
|
+
case "combo_dice":
|
|
151
|
+
registry = config.registry.dice.comboDice;
|
|
152
|
+
break;
|
|
153
|
+
default:
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
if (input.typeArguments[0] == "0x2::sui::SUI" ||
|
|
157
|
+
input.typeArguments[0] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI") {
|
|
158
|
+
_a = __read(tx.splitCoins(tx.gas, [tx.pure(input.amount)]), 1), coin = _a[0];
|
|
129
159
|
tx.moveCall({
|
|
130
|
-
target: "".concat(
|
|
131
|
-
typeArguments: typeArguments,
|
|
132
|
-
arguments: module == "combo_dice"
|
|
133
|
-
? [
|
|
134
|
-
|
|
160
|
+
target: "".concat(config.package.dice, "::").concat(module, "::new_game"),
|
|
161
|
+
typeArguments: input.typeArguments,
|
|
162
|
+
arguments: input.module == "combo_dice"
|
|
163
|
+
? [
|
|
164
|
+
tx.object(config.registry.dice.comboDice),
|
|
165
|
+
tx.object(config.registry.dice.tailsExp),
|
|
166
|
+
tx.pure(input.index),
|
|
167
|
+
tx.makeMoveVec({ objects: [coin] }),
|
|
168
|
+
tx.pure(input.amount),
|
|
169
|
+
]
|
|
170
|
+
: [tx.object(registry), tx.pure(input.index), tx.makeMoveVec({ objects: [coin] }), tx.pure(input.amount)],
|
|
135
171
|
});
|
|
136
172
|
}
|
|
137
173
|
else {
|
|
138
174
|
tx.moveCall({
|
|
139
|
-
target: "".concat(
|
|
140
|
-
typeArguments: typeArguments,
|
|
175
|
+
target: "".concat(config.package.dice, "::").concat(module, "::new_game"),
|
|
176
|
+
typeArguments: input.typeArguments,
|
|
141
177
|
arguments: [
|
|
142
178
|
tx.object(registry),
|
|
143
|
-
tx.pure(index),
|
|
144
|
-
tx.makeMoveVec({ objects: coins.map(function (id) { return tx.object(id); }) }),
|
|
145
|
-
tx.pure(amount),
|
|
179
|
+
tx.pure(input.index),
|
|
180
|
+
tx.makeMoveVec({ objects: input.coins.map(function (id) { return tx.object(id); }) }),
|
|
181
|
+
tx.pure(input.amount),
|
|
146
182
|
],
|
|
147
183
|
});
|
|
148
184
|
}
|
|
149
185
|
tx.moveCall({
|
|
150
|
-
target: "".concat(
|
|
186
|
+
target: "".concat(config.package.dice, "::").concat(module, "::play_guess"),
|
|
151
187
|
typeArguments: [],
|
|
152
188
|
arguments: [
|
|
153
189
|
tx.object(registry),
|
|
154
|
-
tx.pure(index),
|
|
155
|
-
tx.pure(guess_1),
|
|
156
|
-
tx.pure(larger_than_1),
|
|
157
|
-
tx.pure(guess_2),
|
|
158
|
-
tx.pure(larger_than_2),
|
|
190
|
+
tx.pure(input.index),
|
|
191
|
+
tx.pure(input.guess_1),
|
|
192
|
+
tx.pure(input.larger_than_1),
|
|
193
|
+
tx.pure(input.guess_2),
|
|
194
|
+
tx.pure(input.larger_than_2),
|
|
159
195
|
],
|
|
160
196
|
});
|
|
161
197
|
// TODO: waiting for upgrade
|
|
@@ -172,7 +208,6 @@ registry, expRegistry, index, coins, amount, guess_1, larger_than_1, guess_2, la
|
|
|
172
208
|
// tx.object("0x8"),
|
|
173
209
|
// ],
|
|
174
210
|
// });
|
|
175
|
-
tx.setGasBudget(gasBudget);
|
|
176
211
|
return [2 /*return*/, tx];
|
|
177
212
|
});
|
|
178
213
|
});
|
|
@@ -186,24 +221,24 @@ registry, expRegistry, index, coins, amount, guess_1, larger_than_1, guess_2, la
|
|
|
186
221
|
coin: Coin<TAILS_EXP>,
|
|
187
222
|
) {
|
|
188
223
|
*/
|
|
189
|
-
function getConsumeExpCoinStakedTx(input) {
|
|
224
|
+
function getConsumeExpCoinStakedTx(config, tx, input) {
|
|
190
225
|
var coin = input.coins.pop();
|
|
191
226
|
if (input.coins.length > 0) {
|
|
192
|
-
|
|
227
|
+
tx.mergeCoins(tx.object(coin), input.coins.map(function (id) { return tx.object(id); }));
|
|
193
228
|
}
|
|
194
|
-
var _a = __read(
|
|
195
|
-
|
|
196
|
-
target: "".concat(
|
|
229
|
+
var _a = __read(tx.splitCoins(tx.object(coin), [tx.pure(input.amount)]), 1), input_coin = _a[0];
|
|
230
|
+
tx.moveCall({
|
|
231
|
+
target: "".concat(config.package.dice, "::tails_exp::consume_exp_coin_staked"),
|
|
197
232
|
typeArguments: [],
|
|
198
233
|
arguments: [
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
234
|
+
tx.object(config.registry.dice.tailsExp),
|
|
235
|
+
tx.object(config.version.typus),
|
|
236
|
+
tx.object(config.registry.typus.tailsStaking),
|
|
237
|
+
tx.pure(input.tails),
|
|
238
|
+
tx.object(input_coin),
|
|
204
239
|
],
|
|
205
240
|
});
|
|
206
|
-
return
|
|
241
|
+
return tx;
|
|
207
242
|
}
|
|
208
243
|
/**
|
|
209
244
|
public fun consume_exp_coin_unstaked(
|
|
@@ -216,49 +251,49 @@ function getConsumeExpCoinStakedTx(input) {
|
|
|
216
251
|
coin: Coin<TAILS_EXP>,
|
|
217
252
|
) {
|
|
218
253
|
*/
|
|
219
|
-
function getConsumeExpCoinUnstakedTx(input) {
|
|
254
|
+
function getConsumeExpCoinUnstakedTx(config, tx, input) {
|
|
220
255
|
var coin = input.coins.pop();
|
|
221
256
|
if (input.coins.length > 0) {
|
|
222
|
-
|
|
257
|
+
tx.mergeCoins(tx.object(coin), input.coins.map(function (id) { return tx.object(id); }));
|
|
223
258
|
}
|
|
224
|
-
var _a = __read(
|
|
259
|
+
var _a = __read(tx.splitCoins(tx.object(coin), [tx.pure(input.amount)]), 1), input_coin = _a[0];
|
|
225
260
|
if (input.personalKioskPackageId) {
|
|
226
|
-
var _b = __read(
|
|
261
|
+
var _b = __read(tx.moveCall({
|
|
227
262
|
target: "".concat(input.personalKioskPackageId, "::personal_kiosk::borrow_val"),
|
|
228
|
-
arguments: [
|
|
263
|
+
arguments: [tx.object(input.kioskCap)],
|
|
229
264
|
}), 2), personalKioskCap = _b[0], borrow = _b[1];
|
|
230
|
-
|
|
231
|
-
target: "".concat(
|
|
265
|
+
tx.moveCall({
|
|
266
|
+
target: "".concat(config.package.dice, "::tails_exp::consume_exp_coin_unstaked"),
|
|
232
267
|
typeArguments: [],
|
|
233
268
|
arguments: [
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
269
|
+
tx.object(config.registry.dice.tailsExp),
|
|
270
|
+
tx.object(config.version.typus),
|
|
271
|
+
tx.object(config.registry.typus.tailsStaking),
|
|
272
|
+
tx.object(input.kiosk),
|
|
238
273
|
personalKioskCap,
|
|
239
|
-
|
|
240
|
-
|
|
274
|
+
tx.pure(input.tails),
|
|
275
|
+
tx.object(input_coin),
|
|
241
276
|
],
|
|
242
277
|
});
|
|
243
|
-
|
|
278
|
+
tx.moveCall({
|
|
244
279
|
target: "".concat(input.personalKioskPackageId, "::personal_kiosk::return_val"),
|
|
245
|
-
arguments: [
|
|
280
|
+
arguments: [tx.object(input.kioskCap), personalKioskCap, borrow],
|
|
246
281
|
});
|
|
247
282
|
}
|
|
248
283
|
else {
|
|
249
|
-
|
|
250
|
-
target: "".concat(
|
|
284
|
+
tx.moveCall({
|
|
285
|
+
target: "".concat(config.package.dice, "::tails_exp::consume_exp_coin_unstaked"),
|
|
251
286
|
typeArguments: [],
|
|
252
287
|
arguments: [
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
288
|
+
tx.object(config.registry.dice.tailsExp),
|
|
289
|
+
tx.object(config.version.typus),
|
|
290
|
+
tx.object(config.registry.typus.tailsStaking),
|
|
291
|
+
tx.object(input.kiosk),
|
|
292
|
+
tx.object(input.kioskCap),
|
|
293
|
+
tx.pure(input.tails),
|
|
294
|
+
tx.object(input_coin),
|
|
260
295
|
],
|
|
261
296
|
});
|
|
262
297
|
}
|
|
263
|
-
return
|
|
298
|
+
return tx;
|
|
264
299
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TypusConfig } from "src/utils";
|
|
1
2
|
export interface DrawResult {
|
|
2
3
|
answer_1: string;
|
|
3
4
|
result_1: string;
|
|
@@ -5,4 +6,16 @@ export interface DrawResult {
|
|
|
5
6
|
result_2: string;
|
|
6
7
|
exp: string;
|
|
7
8
|
}
|
|
8
|
-
export declare function simulateGame(
|
|
9
|
+
export declare function simulateGame(config: TypusConfig, input: {
|
|
10
|
+
network: "mainnet" | "testnet";
|
|
11
|
+
module: "tails_exp" | "combo_dice";
|
|
12
|
+
index: string;
|
|
13
|
+
amount: string;
|
|
14
|
+
guess_1: string;
|
|
15
|
+
larger_than_1: boolean;
|
|
16
|
+
guess_2: string;
|
|
17
|
+
larger_than_2: boolean;
|
|
18
|
+
vrf_input_1: number[];
|
|
19
|
+
vrf_input_2: number[];
|
|
20
|
+
drawKeys: any;
|
|
21
|
+
}): Promise<DrawResult>;
|
|
@@ -44,42 +44,51 @@ var transactions_1 = require("@mysten/sui.js/transactions");
|
|
|
44
44
|
var client_1 = require("@mysten/sui.js/client");
|
|
45
45
|
var bcs_1 = require("@mysten/bcs");
|
|
46
46
|
var bls_signatures_1 = __importDefault(require("bls-signatures"));
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
var constants_1 = require("src/constants");
|
|
48
|
+
function simulateGame(config, input) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
50
|
+
var provider, transactionBlock, BLS, PRIVATE_KEY, draw_private_key, bls_signature_1, bls_signature_2, registry, results, bytes, reader, answer_1, result_1, answer_2, result_2, exp, result;
|
|
51
51
|
return __generator(this, function (_a) {
|
|
52
52
|
switch (_a.label) {
|
|
53
53
|
case 0:
|
|
54
|
-
provider = new client_1.SuiClient({ url:
|
|
54
|
+
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
55
55
|
transactionBlock = new transactions_1.TransactionBlock();
|
|
56
|
-
target = "".concat(packageId, "::").concat(module, "::simulate_game");
|
|
57
56
|
return [4 /*yield*/, (0, bls_signatures_1.default)()];
|
|
58
57
|
case 1:
|
|
59
58
|
BLS = _a.sent();
|
|
60
|
-
PRIVATE_KEY = Uint8Array.from(drawKeys[network][index]);
|
|
59
|
+
PRIVATE_KEY = Uint8Array.from(input.drawKeys[input.network][input.index]);
|
|
61
60
|
draw_private_key = BLS.PrivateKey.from_bytes(PRIVATE_KEY, true);
|
|
62
|
-
bls_signature_1 = BLS.BasicSchemeMPL.sign(draw_private_key, Uint8Array.from(vrf_input_1)).serialize();
|
|
63
|
-
bls_signature_2 = BLS.BasicSchemeMPL.sign(draw_private_key, Uint8Array.from(vrf_input_2)).serialize();
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
transactionBlock.pure(uint8ArrayToBCSStringArray(bls_signature_2)),
|
|
76
|
-
];
|
|
61
|
+
bls_signature_1 = BLS.BasicSchemeMPL.sign(draw_private_key, Uint8Array.from(input.vrf_input_1)).serialize();
|
|
62
|
+
bls_signature_2 = BLS.BasicSchemeMPL.sign(draw_private_key, Uint8Array.from(input.vrf_input_2)).serialize();
|
|
63
|
+
registry = "";
|
|
64
|
+
switch (input.module) {
|
|
65
|
+
case "tails_exp":
|
|
66
|
+
registry = config.registry.dice.tailsExp;
|
|
67
|
+
break;
|
|
68
|
+
case "combo_dice":
|
|
69
|
+
registry = config.registry.dice.comboDice;
|
|
70
|
+
break;
|
|
71
|
+
default:
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
77
74
|
transactionBlock.moveCall({
|
|
78
|
-
target:
|
|
75
|
+
target: "".concat(config.package.dice, "::").concat(module, "::simulate_game"),
|
|
79
76
|
typeArguments: [],
|
|
80
|
-
arguments:
|
|
77
|
+
arguments: [
|
|
78
|
+
transactionBlock.object(registry),
|
|
79
|
+
transactionBlock.pure(input.index),
|
|
80
|
+
transactionBlock.pure(input.amount),
|
|
81
|
+
transactionBlock.pure(input.guess_1),
|
|
82
|
+
transactionBlock.pure(input.larger_than_1),
|
|
83
|
+
transactionBlock.pure(input.guess_2),
|
|
84
|
+
transactionBlock.pure(input.larger_than_2),
|
|
85
|
+
transactionBlock.pure(uint8ArrayToBCSStringArray(Uint8Array.from(input.vrf_input_1))),
|
|
86
|
+
transactionBlock.pure(uint8ArrayToBCSStringArray(Uint8Array.from(input.vrf_input_2))),
|
|
87
|
+
transactionBlock.pure(uint8ArrayToBCSStringArray(bls_signature_1)),
|
|
88
|
+
transactionBlock.pure(uint8ArrayToBCSStringArray(bls_signature_2)),
|
|
89
|
+
],
|
|
81
90
|
});
|
|
82
|
-
return [4 /*yield*/, provider.devInspectTransactionBlock({ transactionBlock: transactionBlock, sender:
|
|
91
|
+
return [4 /*yield*/, provider.devInspectTransactionBlock({ transactionBlock: transactionBlock, sender: constants_1.SENDER })];
|
|
83
92
|
case 2:
|
|
84
93
|
results = (_a.sent()).results;
|
|
85
94
|
bytes = results[results.length - 1].returnValues[0][0];
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { SuiClient } from "@mysten/sui.js/client";
|
|
2
1
|
import { TypusConfig } from "src/utils";
|
|
3
|
-
export declare function getAirdrop(config: TypusConfig,
|
|
2
|
+
export declare function getAirdrop(config: TypusConfig, input: {
|
|
4
3
|
key: string;
|
|
5
4
|
user: string;
|
|
6
5
|
}): Promise<string[]>;
|
|
@@ -38,13 +38,16 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.getAirdrop = getAirdrop;
|
|
40
40
|
var transactions_1 = require("@mysten/sui.js/transactions");
|
|
41
|
+
var client_1 = require("@mysten/sui.js/client");
|
|
41
42
|
var bcs_1 = require("@mysten/bcs");
|
|
42
|
-
|
|
43
|
+
var constants_1 = require("src/constants");
|
|
44
|
+
function getAirdrop(config, input) {
|
|
43
45
|
return __awaiter(this, void 0, void 0, function () {
|
|
44
|
-
var transactionBlock, results, bytes, reader;
|
|
46
|
+
var provider, transactionBlock, results, bytes, reader;
|
|
45
47
|
return __generator(this, function (_a) {
|
|
46
48
|
switch (_a.label) {
|
|
47
49
|
case 0:
|
|
50
|
+
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
48
51
|
transactionBlock = new transactions_1.TransactionBlock();
|
|
49
52
|
transactionBlock.moveCall({
|
|
50
53
|
target: "".concat(config.package.typus, "::airdrop::get_airdrop"),
|
|
@@ -57,7 +60,7 @@ function getAirdrop(config, provider, input) {
|
|
|
57
60
|
],
|
|
58
61
|
});
|
|
59
62
|
return [4 /*yield*/, provider.devInspectTransactionBlock({
|
|
60
|
-
sender:
|
|
63
|
+
sender: constants_1.SENDER,
|
|
61
64
|
transactionBlock: transactionBlock,
|
|
62
65
|
})];
|
|
63
66
|
case 1:
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { SuiClient } from "@mysten/sui.js/client";
|
|
2
1
|
import { TypusConfig } from "src/utils";
|
|
3
2
|
export interface Rankings {
|
|
4
3
|
user_score: string;
|
|
@@ -8,7 +7,7 @@ export interface Ranks {
|
|
|
8
7
|
score: string;
|
|
9
8
|
users: string[];
|
|
10
9
|
}
|
|
11
|
-
export declare function getRankings(config: TypusConfig,
|
|
10
|
+
export declare function getRankings(config: TypusConfig, input: {
|
|
12
11
|
key: string;
|
|
13
12
|
id: string;
|
|
14
13
|
ranks: number;
|
|
@@ -38,14 +38,17 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.getRankings = getRankings;
|
|
40
40
|
var transactions_1 = require("@mysten/sui.js/transactions");
|
|
41
|
+
var client_1 = require("@mysten/sui.js/client");
|
|
41
42
|
var bcs_1 = require("@mysten/bcs");
|
|
42
43
|
var utils_1 = require("src/utils");
|
|
43
|
-
|
|
44
|
+
var constants_1 = require("src/constants");
|
|
45
|
+
function getRankings(config, input) {
|
|
44
46
|
return __awaiter(this, void 0, void 0, function () {
|
|
45
|
-
var transactionBlock, results, bytes, reader, result;
|
|
47
|
+
var provider, transactionBlock, results, bytes, reader, result;
|
|
46
48
|
return __generator(this, function (_a) {
|
|
47
49
|
switch (_a.label) {
|
|
48
50
|
case 0:
|
|
51
|
+
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
49
52
|
transactionBlock = new transactions_1.TransactionBlock();
|
|
50
53
|
transactionBlock.moveCall({
|
|
51
54
|
target: "".concat(config.package.typus, "::leaderboard::get_rankings"),
|
|
@@ -61,7 +64,7 @@ function getRankings(config, provider, input) {
|
|
|
61
64
|
],
|
|
62
65
|
});
|
|
63
66
|
return [4 /*yield*/, provider.devInspectTransactionBlock({
|
|
64
|
-
sender:
|
|
67
|
+
sender: constants_1.SENDER,
|
|
65
68
|
transactionBlock: transactionBlock,
|
|
66
69
|
})];
|
|
67
70
|
case 1:
|
|
@@ -20,7 +20,7 @@ exports.getRemoveProfitSharingTx = getRemoveProfitSharingTx;
|
|
|
20
20
|
) {
|
|
21
21
|
*/
|
|
22
22
|
function getUploadIdsTx(config, tx, input) {
|
|
23
|
-
|
|
23
|
+
tx.moveCall({
|
|
24
24
|
target: "".concat(config.package.typus, "::tails_staking::upload_ids"),
|
|
25
25
|
typeArguments: [],
|
|
26
26
|
arguments: [tx.object(config.version.typus), tx.object(config.registry.typus.tailsStaking), tx.pure(input.ids)],
|
|
@@ -36,7 +36,7 @@ function getUploadIdsTx(config, tx, input) {
|
|
|
36
36
|
) {
|
|
37
37
|
*/
|
|
38
38
|
function getRemoveIdsTx(config, tx, input) {
|
|
39
|
-
|
|
39
|
+
tx.moveCall({
|
|
40
40
|
target: "".concat(config.package.typus, "::tails_staking::remove_ids"),
|
|
41
41
|
typeArguments: [],
|
|
42
42
|
arguments: [tx.object(config.version.typus), tx.object(config.registry.typus.tailsStaking), tx.pure(input.count)],
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { SuiClient } from "@mysten/sui.js/client";
|
|
2
1
|
import { TypusConfig } from "src/utils";
|
|
3
2
|
export interface StakingInfo {
|
|
4
3
|
user: string;
|
|
@@ -6,7 +5,7 @@ export interface StakingInfo {
|
|
|
6
5
|
profits: string[];
|
|
7
6
|
u64Padding: string[];
|
|
8
7
|
}
|
|
9
|
-
export declare function getStakingInfo(config: TypusConfig,
|
|
8
|
+
export declare function getStakingInfo(config: TypusConfig, input: {
|
|
10
9
|
user: string;
|
|
11
10
|
}): Promise<StakingInfo>;
|
|
12
|
-
export declare function getLevelCounts(config: TypusConfig
|
|
11
|
+
export declare function getLevelCounts(config: TypusConfig): Promise<number[]>;
|
|
@@ -39,14 +39,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.getStakingInfo = getStakingInfo;
|
|
40
40
|
exports.getLevelCounts = getLevelCounts;
|
|
41
41
|
var transactions_1 = require("@mysten/sui.js/transactions");
|
|
42
|
+
var client_1 = require("@mysten/sui.js/client");
|
|
42
43
|
var bcs_1 = require("@mysten/bcs");
|
|
43
44
|
var utils_1 = require("src/utils");
|
|
44
|
-
|
|
45
|
+
var constants_1 = require("src/constants");
|
|
46
|
+
function getStakingInfo(config, input) {
|
|
45
47
|
return __awaiter(this, void 0, void 0, function () {
|
|
46
|
-
var transactionBlock, results, bytes, reader, length;
|
|
48
|
+
var provider, transactionBlock, results, bytes, reader, length;
|
|
47
49
|
return __generator(this, function (_a) {
|
|
48
50
|
switch (_a.label) {
|
|
49
51
|
case 0:
|
|
52
|
+
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
50
53
|
transactionBlock = new transactions_1.TransactionBlock();
|
|
51
54
|
transactionBlock.moveCall({
|
|
52
55
|
target: "".concat(config.package.typus, "::tails_staking::get_staking_info"),
|
|
@@ -58,7 +61,7 @@ function getStakingInfo(config, provider, input) {
|
|
|
58
61
|
],
|
|
59
62
|
});
|
|
60
63
|
return [4 /*yield*/, provider.devInspectTransactionBlock({
|
|
61
|
-
sender:
|
|
64
|
+
sender: constants_1.SENDER,
|
|
62
65
|
transactionBlock: transactionBlock,
|
|
63
66
|
})];
|
|
64
67
|
case 1:
|
|
@@ -93,12 +96,13 @@ function getStakingInfo(config, provider, input) {
|
|
|
93
96
|
});
|
|
94
97
|
});
|
|
95
98
|
}
|
|
96
|
-
function getLevelCounts(config
|
|
99
|
+
function getLevelCounts(config) {
|
|
97
100
|
return __awaiter(this, void 0, void 0, function () {
|
|
98
|
-
var transactionBlock, results, bytes, reader;
|
|
101
|
+
var provider, transactionBlock, results, bytes, reader;
|
|
99
102
|
return __generator(this, function (_a) {
|
|
100
103
|
switch (_a.label) {
|
|
101
104
|
case 0:
|
|
105
|
+
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
102
106
|
transactionBlock = new transactions_1.TransactionBlock();
|
|
103
107
|
transactionBlock.moveCall({
|
|
104
108
|
target: "".concat(config.package.typus, "::tails_staking::get_level_counts"),
|
|
@@ -106,7 +110,7 @@ function getLevelCounts(config, provider) {
|
|
|
106
110
|
arguments: [transactionBlock.pure(config.version.typus), transactionBlock.pure(config.registry.typus.tailsStaking)],
|
|
107
111
|
});
|
|
108
112
|
return [4 /*yield*/, provider.devInspectTransactionBlock({
|
|
109
|
-
sender:
|
|
113
|
+
sender: constants_1.SENDER,
|
|
110
114
|
transactionBlock: transactionBlock,
|
|
111
115
|
})];
|
|
112
116
|
case 1:
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { SuiClient } from "@mysten/sui.js/client";
|
|
2
1
|
import { TypusConfig } from "src/utils";
|
|
3
|
-
export declare function getUserMetadata(config: TypusConfig,
|
|
2
|
+
export declare function getUserMetadata(config: TypusConfig, input: {
|
|
4
3
|
user: string;
|
|
5
4
|
}): Promise<string[]>;
|
|
@@ -38,14 +38,16 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.getUserMetadata = getUserMetadata;
|
|
40
40
|
var transactions_1 = require("@mysten/sui.js/transactions");
|
|
41
|
+
var client_1 = require("@mysten/sui.js/client");
|
|
41
42
|
var bcs_1 = require("@mysten/bcs");
|
|
42
|
-
var
|
|
43
|
-
function getUserMetadata(config,
|
|
43
|
+
var constants_1 = require("src/constants");
|
|
44
|
+
function getUserMetadata(config, input) {
|
|
44
45
|
return __awaiter(this, void 0, void 0, function () {
|
|
45
|
-
var transactionBlock, results, bytes, reader;
|
|
46
|
+
var provider, transactionBlock, results, bytes, reader;
|
|
46
47
|
return __generator(this, function (_a) {
|
|
47
48
|
switch (_a.label) {
|
|
48
49
|
case 0:
|
|
50
|
+
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
49
51
|
transactionBlock = new transactions_1.TransactionBlock();
|
|
50
52
|
transactionBlock.moveCall({
|
|
51
53
|
target: "".concat(config.package.typus, "::user::get_user_metadata"),
|
|
@@ -56,7 +58,7 @@ function getUserMetadata(config, provider, input) {
|
|
|
56
58
|
transactionBlock.pure(input.user),
|
|
57
59
|
],
|
|
58
60
|
});
|
|
59
|
-
return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: SENDER, transactionBlock: transactionBlock })];
|
|
61
|
+
return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transactionBlock })];
|
|
60
62
|
case 1:
|
|
61
63
|
results = (_a.sent()).results;
|
|
62
64
|
bytes = results[results.length - 1].returnValues[0][0];
|
|
@@ -26,31 +26,6 @@ import { TypusConfig } from "src/utils";
|
|
|
26
26
|
ctx: &TxContext,
|
|
27
27
|
) {
|
|
28
28
|
*/
|
|
29
|
-
export interface UpdateConfigRequests {
|
|
30
|
-
index: string;
|
|
31
|
-
config: {
|
|
32
|
-
oracleId?: string;
|
|
33
|
-
depositLotSize?: string;
|
|
34
|
-
bidLotSize?: string;
|
|
35
|
-
minDepositSize?: string;
|
|
36
|
-
minBidSize?: string;
|
|
37
|
-
maxDepositEntry?: string;
|
|
38
|
-
maxBidEntry?: string;
|
|
39
|
-
depositFeeBp?: string;
|
|
40
|
-
depositFeeShareBp?: string;
|
|
41
|
-
depositSharedFeePool?: string;
|
|
42
|
-
bidFeeBp?: string;
|
|
43
|
-
depositIncentiveBp?: string;
|
|
44
|
-
bidIncentiveBp?: string;
|
|
45
|
-
auctionDelayTsMs?: string;
|
|
46
|
-
auctionDurationTsMs?: string;
|
|
47
|
-
recoupDelayTsMs?: string;
|
|
48
|
-
capacity?: string;
|
|
49
|
-
leverage?: string;
|
|
50
|
-
riskLevel?: string;
|
|
51
|
-
depositIncentiveBpDivisorDecimal?: string;
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
29
|
export declare function getUpdateConfigTx(config: TypusConfig, tx: TransactionBlock, requests: {
|
|
55
30
|
index: string;
|
|
56
31
|
input: {
|