@typus/typus-sdk 1.4.20 → 1.4.21

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.
Files changed (49) hide show
  1. package/dist/src/auto-bid/token-user-entry.d.ts +46 -8
  2. package/dist/src/auto-bid/token-user-entry.js +117 -74
  3. package/dist/src/auto-bid/user-entry.d.ts +42 -8
  4. package/dist/src/auto-bid/user-entry.js +92 -93
  5. package/dist/src/auto-bid/view-function.d.ts +8 -5
  6. package/dist/src/auto-bid/view-function.js +26 -15
  7. package/dist/src/constants/constant.d.ts +1 -0
  8. package/dist/src/constants/constant.js +2 -1
  9. package/dist/src/dice/api.d.ts +13 -1
  10. package/dist/src/dice/api.js +25 -14
  11. package/dist/src/dice/fetch.d.ts +8 -12
  12. package/dist/src/dice/fetch.js +77 -30
  13. package/dist/src/dice/user-entry.d.ts +29 -17
  14. package/dist/src/dice/user-entry.js +114 -79
  15. package/dist/src/dice/view-function.d.ts +14 -1
  16. package/dist/src/dice/view-function.js +34 -25
  17. package/dist/src/typus/airdrop/view-function.d.ts +1 -2
  18. package/dist/src/typus/airdrop/view-function.js +6 -3
  19. package/dist/src/typus/leaderboard/view-function.d.ts +1 -2
  20. package/dist/src/typus/leaderboard/view-function.js +6 -3
  21. package/dist/src/typus/tails-staking/authority-entry.js +2 -2
  22. package/dist/src/typus/tails-staking/view-function.d.ts +2 -3
  23. package/dist/src/typus/tails-staking/view-function.js +10 -6
  24. package/dist/src/typus/user/view-function.d.ts +1 -2
  25. package/dist/src/typus/user/view-function.js +6 -4
  26. package/dist/src/typus-dov-single-v2/authority-entry.d.ts +0 -25
  27. package/dist/src/typus-dov-single-v2/authority-entry.js +26 -0
  28. package/dist/src/typus-dov-single-v2/function/bidding.d.ts +5 -3
  29. package/dist/src/typus-dov-single-v2/function/bidding.js +17 -14
  30. package/dist/src/typus-dov-single-v2/history/vault-history.d.ts +3 -2
  31. package/dist/src/typus-dov-single-v2/history/vault-history.js +6 -4
  32. package/dist/src/typus-dov-single-v2/token-user-entry.js +10 -10
  33. package/dist/src/typus-dov-single-v2/view-function.d.ts +6 -7
  34. package/dist/src/typus-dov-single-v2/view-function.js +26 -19
  35. package/dist/src/typus-nft/user-entry.d.ts +25 -6
  36. package/dist/src/typus-nft/user-entry.js +24 -36
  37. package/dist/src/typus-perp/fetch.d.ts +7 -8
  38. package/dist/src/typus-perp/fetch.js +35 -24
  39. package/dist/src/typus-perp/user/order.d.ts +4 -11
  40. package/dist/src/typus-perp/user/order.js +23 -23
  41. package/dist/src/typus-perp/user/orderWithBidReceipt.d.ts +9 -9
  42. package/dist/src/typus-perp/user/orderWithBidReceipt.js +50 -49
  43. package/dist/src/typus-perp/user/tlp.d.ts +5 -13
  44. package/dist/src/typus-perp/user/tlp.js +30 -30
  45. package/dist/src/typus-safu/user-entry.d.ts +4 -8
  46. package/dist/src/typus-safu/user-entry.js +56 -56
  47. package/dist/src/typus-safu/view-function.d.ts +0 -3
  48. package/dist/src/typus-safu/view-function.js +10 -7
  49. 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(gasBudget, packageId, module, typeArguments, // [TOKEN]
71
- registry, index, coins, amount) {
69
+ function newGameTx(config, tx, input) {
72
70
  return __awaiter(this, void 0, void 0, function () {
73
- var tx;
71
+ var registry;
74
72
  return __generator(this, function (_a) {
75
- tx = new transactions_1.TransactionBlock();
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(packageId, "::").concat(module, "::new_game"),
78
- typeArguments: typeArguments,
79
- arguments: [tx.object(registry), tx.pure(index), tx.makeMoveVec({ objects: coins.map(function (id) { return tx.object(id); }) }), tx.pure(amount)],
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(gasBudget, packageId, module, registry, index, guess_1, larger_than_1, guess_2, larger_than_2) {
110
+ function playGuessTx(config, tx, input) {
99
111
  return __awaiter(this, void 0, void 0, function () {
100
- var tx;
112
+ var registry;
101
113
  return __generator(this, function (_a) {
102
- tx = new transactions_1.TransactionBlock();
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(packageId, "::").concat(module, "::play_guess"),
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(gasBudget, packageId, module, typeArguments, // [TOKEN]
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 tx, _a, coin;
143
+ var registry, _a, coin;
124
144
  return __generator(this, function (_b) {
125
- tx = new transactions_1.TransactionBlock();
126
- if (typeArguments[0] == "0x2::sui::SUI" ||
127
- typeArguments[0] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI") {
128
- _a = __read(tx.splitCoins(tx.gas, [tx.pure(amount)]), 1), coin = _a[0];
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(packageId, "::").concat(module, "::new_game"),
131
- typeArguments: typeArguments,
132
- arguments: module == "combo_dice"
133
- ? [tx.object(registry), tx.object(expRegistry), tx.pure(index), tx.makeMoveVec({ objects: [coin] }), tx.pure(amount)]
134
- : [tx.object(registry), tx.pure(index), tx.makeMoveVec({ objects: [coin] }), tx.pure(amount)],
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(packageId, "::").concat(module, "::new_game"),
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(packageId, "::").concat(module, "::play_guess"),
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
- input.tx.mergeCoins(input.tx.object(coin), input.coins.map(function (id) { return input.tx.object(id); }));
227
+ tx.mergeCoins(tx.object(coin), input.coins.map(function (id) { return tx.object(id); }));
193
228
  }
194
- var _a = __read(input.tx.splitCoins(input.tx.object(coin), [input.tx.pure(input.amount)]), 1), input_coin = _a[0];
195
- input.tx.moveCall({
196
- target: "".concat(input.packageId, "::tails_exp::consume_exp_coin_staked"),
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
- input.tx.object(input.tailsExpRegistry),
200
- input.tx.object(input.typusEcosystemVersion),
201
- input.tx.object(input.tailsStakingRegistry),
202
- input.tx.pure(input.tails),
203
- input.tx.object(input_coin),
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 input.tx;
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
- input.tx.mergeCoins(input.tx.object(coin), input.coins.map(function (id) { return input.tx.object(id); }));
257
+ tx.mergeCoins(tx.object(coin), input.coins.map(function (id) { return tx.object(id); }));
223
258
  }
224
- var _a = __read(input.tx.splitCoins(input.tx.object(coin), [input.tx.pure(input.amount)]), 1), input_coin = _a[0];
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(input.tx.moveCall({
261
+ var _b = __read(tx.moveCall({
227
262
  target: "".concat(input.personalKioskPackageId, "::personal_kiosk::borrow_val"),
228
- arguments: [input.tx.object(input.kioskCap)],
263
+ arguments: [tx.object(input.kioskCap)],
229
264
  }), 2), personalKioskCap = _b[0], borrow = _b[1];
230
- input.tx.moveCall({
231
- target: "".concat(input.packageId, "::tails_exp::consume_exp_coin_unstaked"),
265
+ tx.moveCall({
266
+ target: "".concat(config.package.dice, "::tails_exp::consume_exp_coin_unstaked"),
232
267
  typeArguments: [],
233
268
  arguments: [
234
- input.tx.object(input.tailsExpRegistry),
235
- input.tx.object(input.typusEcosystemVersion),
236
- input.tx.object(input.tailsStakingRegistry),
237
- input.tx.object(input.kiosk),
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
- input.tx.pure(input.tails),
240
- input.tx.object(input_coin),
274
+ tx.pure(input.tails),
275
+ tx.object(input_coin),
241
276
  ],
242
277
  });
243
- input.tx.moveCall({
278
+ tx.moveCall({
244
279
  target: "".concat(input.personalKioskPackageId, "::personal_kiosk::return_val"),
245
- arguments: [input.tx.object(input.kioskCap), personalKioskCap, borrow],
280
+ arguments: [tx.object(input.kioskCap), personalKioskCap, borrow],
246
281
  });
247
282
  }
248
283
  else {
249
- input.tx.moveCall({
250
- target: "".concat(input.packageId, "::tails_exp::consume_exp_coin_unstaked"),
284
+ tx.moveCall({
285
+ target: "".concat(config.package.dice, "::tails_exp::consume_exp_coin_unstaked"),
251
286
  typeArguments: [],
252
287
  arguments: [
253
- input.tx.object(input.tailsExpRegistry),
254
- input.tx.object(input.typusEcosystemVersion),
255
- input.tx.object(input.tailsStakingRegistry),
256
- input.tx.object(input.kiosk),
257
- input.tx.object(input.kioskCap),
258
- input.tx.pure(input.tails),
259
- input.tx.object(input_coin),
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 input.tx;
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(network: "mainnet" | "testnet", packageId: string, module: "tails_exp" | "combo_dice", registry: string, index: string, amount: string, guess_1: string, larger_than_1: boolean, guess_2: string, larger_than_2: boolean, vrf_input_1: number[], vrf_input_2: number[], drawKeys: any, sender?: string): Promise<DrawResult>;
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
- function simulateGame(network_1, packageId_1, module_1, registry_1, index_1, amount_1, guess_1_1, larger_than_1_1, guess_2_1, larger_than_2_1, vrf_input_1_1, vrf_input_2_1, drawKeys_1) {
48
- return __awaiter(this, arguments, void 0, function (network, packageId, module, registry, index, amount, guess_1, larger_than_1, guess_2, larger_than_2, vrf_input_1, vrf_input_2, drawKeys, sender) {
49
- var provider, transactionBlock, target, BLS, PRIVATE_KEY, draw_private_key, bls_signature_1, bls_signature_2, transactionBlockArguments, results, bytes, reader, answer_1, result_1, answer_2, result_2, exp, result;
50
- if (sender === void 0) { sender = "0xb6c7e3b1c61ee81516a8317f221daa035f1503e0ac3ae7a50b61834bc7a3ead9"; }
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: (0, client_1.getFullnodeUrl)(network) });
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
- transactionBlockArguments = [
65
- transactionBlock.object(registry),
66
- transactionBlock.pure(index),
67
- transactionBlock.pure(amount),
68
- transactionBlock.pure(guess_1),
69
- transactionBlock.pure(larger_than_1),
70
- transactionBlock.pure(guess_2),
71
- transactionBlock.pure(larger_than_2),
72
- transactionBlock.pure(uint8ArrayToBCSStringArray(Uint8Array.from(vrf_input_1))),
73
- transactionBlock.pure(uint8ArrayToBCSStringArray(Uint8Array.from(vrf_input_2))),
74
- transactionBlock.pure(uint8ArrayToBCSStringArray(bls_signature_1)),
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: target,
75
+ target: "".concat(config.package.dice, "::").concat(module, "::simulate_game"),
79
76
  typeArguments: [],
80
- arguments: transactionBlockArguments,
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: 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, provider: SuiClient, input: {
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
- function getAirdrop(config, provider, input) {
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: "0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
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, provider: SuiClient, input: {
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
- function getRankings(config, provider, input) {
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: "0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
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
- var result = tx.moveCall({
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
- var result = tx.moveCall({
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, provider: SuiClient, input: {
8
+ export declare function getStakingInfo(config: TypusConfig, input: {
10
9
  user: string;
11
10
  }): Promise<StakingInfo>;
12
- export declare function getLevelCounts(config: TypusConfig, provider: SuiClient): Promise<number[]>;
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
- function getStakingInfo(config, provider, input) {
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: "0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
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, provider) {
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: "0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
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, provider: SuiClient, input: {
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 SENDER = "0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
43
- function getUserMetadata(config, provider, input) {
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: {