@typus/typus-sdk 1.4.7-c → 1.4.8

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/config.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "PACKAGE_ORIGIN": {
5
5
  "DOV_SINGLE": "0x321848bf1ae327a9e022ccb3701940191e02fa193ab160d9c0e49cd3c003de3a",
6
6
  "FRAMEWORK": "0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274",
7
- "DICE": "0x37816d28c34cc0df82655ca97b3f066112a5f3c202cbb4aaa76c8af54e779750",
7
+ "EXP_GUESS": "0x37816d28c34cc0df82655ca97b3f066112a5f3c202cbb4aaa76c8af54e779750",
8
8
  "MFUD": "0xd8f04cd2a16c19c17428c3b4c22b01dd06740423b93fb7ee88fbe2676a82849d",
9
9
  "NFT": "0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196",
10
10
  "ORACLE": "0x855eb2d260ee42b898266e6df90bfd3c4ed821ccb253a352c159c223244a4b8a",
@@ -14,8 +14,7 @@
14
14
  "PACKAGE": {
15
15
  "DOV_SINGLE": "0xf7ef57f3bd98455262417886b17eb4d5af1a18d2dec19c5b34e512bf4fc10acf",
16
16
  "FRAMEWORK": "0x5c6648fb219c046256488486d23d4af7bc562d5ab5c382e1f4b558066a327fe8",
17
- "DICE": "0xda804c7136e8fda3c9abb25e028fdc006c0adf2be1e58d8f0cce77e743373fca",
18
- "DICE_0x8": "0xb1cc7379a7375808eaf4cda927a6f3a14363b6d131c020f4828119b87731fe03",
17
+ "EXP_GUESS": "0xb1cc7379a7375808eaf4cda927a6f3a14363b6d131c020f4828119b87731fe03",
19
18
  "MFUD": "0xd8f04cd2a16c19c17428c3b4c22b01dd06740423b93fb7ee88fbe2676a82849d",
20
19
  "NFT": "0xba06aae31d9b7c9f651e783272c7e4f776fb5ae17e89d525b75a17b099f58202",
21
20
  "ORACLE": "0x978f65df8570a075298598a9965c18de9087f9e888eb3430fe20334f5c554cfd",
@@ -63,7 +62,8 @@
63
62
  "RPC_ENDPOINT": "https://sui-testnet.blastapi.io:443/7f446a12-c4ab-4e3c-b2d8-ebb0fcbe5cdd",
64
63
  "PACKAGE_ORIGIN": {
65
64
  "DOV_SINGLE": "0x6c9a394a43844fc09d9617bc8a8e775a4521f0e28e83de1da780d043a498671f",
66
- "DICE": "0x9b43ee208a3b235810c145bca1161d1a71d08bfe76b1e55bb3db319ea95d0149",
65
+ "TAILS_EXP": "0x9b43ee208a3b235810c145bca1161d1a71d08bfe76b1e55bb3db319ea95d0149",
66
+ "EXP_GUESS": "0x9b43ee208a3b235810c145bca1161d1a71d08bfe76b1e55bb3db319ea95d0149",
67
67
  "FRAMEWORK": "0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded",
68
68
  "MFUD": "0x7755ff79f0f27256c73e6c197e25b407ef6d4b9bd6e1af8cdd50fef28f84712c",
69
69
  "NFT": "0x5cfd0819411be98034cba544cbffab192c2c35674a05ff57f4f1c5042875b828",
@@ -74,7 +74,7 @@
74
74
  },
75
75
  "PACKAGE": {
76
76
  "DOV_SINGLE": "0x2e462aa0224bec76acaea81c51ca5b9ae4b27ec50281a764797c84148c8a463f",
77
- "DICE": "0x112321a74fb0903aff5c654603c19060552a704b5fb13a6cefa84e1147e66db8",
77
+ "EXP_GUESS": "0x4aab9bfc3efe279981d73eca80129356238508d3f2ffdda38a4832faf94e0b9a",
78
78
  "FRAMEWORK": "0x90ca6e2393e3adc91b4e9b70ab16c017e5f70f7094b6f09b913fef2833a656e9",
79
79
  "MFUD": "0x7755ff79f0f27256c73e6c197e25b407ef6d4b9bd6e1af8cdd50fef28f84712c",
80
80
  "NFT": "0x0f5162014f18686640b8d0adefd60c3fe5b377413ec4f1e77001c67d96f8501a",
@@ -88,7 +88,6 @@
88
88
  "LEADERBOARD": "0x4faabe5a4a509a145fc9bae95761d34c11571da4cb25d681f06ffcbadbc355e7",
89
89
  "MFUD": "0x7ad87901531693f1baa541712947860dcc543617e11b14993ad70d20daf159c6",
90
90
  "TAILS_EXP": "0x37e0c8c80a5099d5dfe1b0aeae62e3f01916be73935090efb9c95279b7bb1ce7",
91
- "TYPUS_DICE": "0x034f58472d9604eee3e1fb5896e4d6a14f426c17c504cdb9dcdc7269ca4ad3b4",
92
91
  "EXP_GUESS": "0x37e0c8c80a5099d5dfe1b0aeae62e3f01916be73935090efb9c95279b7bb1ce7",
93
92
  "TAILS_STAKING": "0x989bd585b580dfc22d9d7656a5807b2f6c8fe36260a2003ef697adc8a38d21af",
94
93
  "TGLD": "0x2118b4056c89d90a6dc40d198fbe239cb8e83f7ea20daaf4ea53341c7fdb043c",
@@ -2,7 +2,7 @@ export * from "./airdrop";
2
2
  export * from "./auto-bid";
3
3
  export * from "./constants";
4
4
  export * from "./leaderboard";
5
- export * from "./dice";
5
+ export * from "./tails-exp-dice";
6
6
  export * from "./tails-staking";
7
7
  export * from "./typus-dov-single-v2";
8
8
  export * from "./typus-nft";
package/dist/src/index.js CHANGED
@@ -18,7 +18,7 @@ __exportStar(require("./airdrop"), exports);
18
18
  __exportStar(require("./auto-bid"), exports);
19
19
  __exportStar(require("./constants"), exports);
20
20
  __exportStar(require("./leaderboard"), exports);
21
- __exportStar(require("./dice"), exports);
21
+ __exportStar(require("./tails-exp-dice"), exports);
22
22
  __exportStar(require("./tails-staking"), exports);
23
23
  __exportStar(require("./typus-dov-single-v2"), exports);
24
24
  __exportStar(require("./typus-nft"), exports);
@@ -0,0 +1 @@
1
+ export declare function getDrawResult(network: "mainnet" | "testnet", packageId: string, 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[]): Promise<any>;
@@ -37,9 +37,10 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.getDrawResult = getDrawResult;
40
- function getDrawResult(network, packageId, module, registry, index, amount, guess_1, larger_than_1, guess_2, larger_than_2, vrf_input_1, vrf_input_2) {
40
+ var apiUrl = "https://us-central1-aqueous-freedom-378103.cloudfunctions.net/draw-result-1";
41
+ function getDrawResult(network, packageId, registry, index, amount, guess_1, larger_than_1, guess_2, larger_than_2, vrf_input_1, vrf_input_2) {
41
42
  return __awaiter(this, void 0, void 0, function () {
42
- var queryParams, vrf_input_1_string, vrf_input_2_string, apiUrl, apiUrlWithParams, response, data;
43
+ var queryParams, vrf_input_1_string, vrf_input_2_string, apiUrlWithParams, response, data;
43
44
  return __generator(this, function (_a) {
44
45
  switch (_a.label) {
45
46
  case 0:
@@ -56,12 +57,6 @@ function getDrawResult(network, packageId, module, registry, index, amount, gues
56
57
  });
57
58
  vrf_input_1_string = JSON.stringify(vrf_input_1);
58
59
  vrf_input_2_string = JSON.stringify(vrf_input_2);
59
- if (module === "tails_exp") {
60
- apiUrl = "https://us-central1-aqueous-freedom-378103.cloudfunctions.net/draw-result-1";
61
- }
62
- else if (module === "combo_dice") {
63
- apiUrl = "https://us-central1-aqueous-freedom-378103.cloudfunctions.net/draw-result-2";
64
- }
65
60
  apiUrlWithParams = "".concat(apiUrl, "?").concat(queryParams.toString(), "&vrf_input_1=").concat(vrf_input_1_string, "&vrf_input_2=").concat(vrf_input_2_string);
66
61
  return [4 /*yield*/, fetch(apiUrlWithParams, {
67
62
  method: "GET",
@@ -9,22 +9,14 @@ export interface Playground {
9
9
  opened_games: Map<string, Game>;
10
10
  game_config: GameConfig;
11
11
  is_active: boolean;
12
- exp_config?: ExpConfig;
13
12
  }
14
13
  export interface GameConfig {
15
14
  max_stake: string;
16
15
  min_stake: string;
17
16
  stake_lot_size: string;
18
- critical_hits_multiplier_bp: string;
19
- base_exp_divisor?: string;
20
- losses_multiplier_bp?: string;
21
- banker_edge_bp?: string;
22
- max_single_game_loss_ratio_bp?: string;
23
- u64_padding?: string[];
24
- }
25
- export interface ExpConfig {
26
17
  base_exp_divisor: string;
27
- u64_padding: string[];
18
+ losses_multiplier_bp: string;
19
+ critical_hits_multiplier_bp: string;
28
20
  }
29
21
  export interface Game {
30
22
  game_id: string;
@@ -37,11 +29,13 @@ export interface Game {
37
29
  larger_than_2: boolean | null;
38
30
  vrf_input_2: number[] | null;
39
31
  }
40
- export declare function getHistory(provider: SuiClient, dicePackage: string, module: "tails_exp" | "combo_dice", playgrounds: Playground[]): Promise<DrawDisplay[]>;
32
+ export declare function getHistory(provider: SuiClient, dicePackage: string, playgrounds: Playground[]): Promise<DrawDisplay[]>;
33
+ export declare function waitHistory(provider: SuiClient, dicePackage: string, onMessage: any): Promise<import("@mysten/sui.js/client").Unsubscribe>;
41
34
  export declare function parseHistory(datas: any, playgrounds: Playground[]): Promise<DrawDisplay[]>;
42
35
  export interface DrawEvent {
43
36
  answer_1: string;
44
37
  answer_2: string;
38
+ exp: string;
45
39
  game_id: string;
46
40
  guess_1: string;
47
41
  guess_2: string;
@@ -57,9 +51,6 @@ export interface DrawEvent {
57
51
  signer: string;
58
52
  stake_amount: string;
59
53
  timestampMs: string;
60
- exp?: string;
61
- exp_amount?: string;
62
- reward?: string;
63
54
  }
64
55
  export interface DrawDisplay {
65
56
  game_id: string;
@@ -71,8 +62,13 @@ export interface DrawDisplay {
71
62
  bet_amount: string;
72
63
  exp: string;
73
64
  timestampMs: string;
74
- reward?: string;
75
65
  }
66
+ export interface LeaderBoard {
67
+ player: string;
68
+ total_bet_amount: number;
69
+ total_earn_exp: number;
70
+ }
71
+ export declare function getLeaderBoard(drawDisplays: DrawDisplay[]): Promise<LeaderBoard[]>;
76
72
  export interface ProfitSharing {
77
73
  level_profits: string[];
78
74
  level_users: string[];
@@ -49,7 +49,9 @@ var __values = (this && this.__values) || function(o) {
49
49
  Object.defineProperty(exports, "__esModule", { value: true });
50
50
  exports.getPlaygrounds = getPlaygrounds;
51
51
  exports.getHistory = getHistory;
52
+ exports.waitHistory = waitHistory;
52
53
  exports.parseHistory = parseHistory;
54
+ exports.getLeaderBoard = getLeaderBoard;
53
55
  exports.getProfitSharing = getProfitSharing;
54
56
  exports.calculateLevelReward = calculateLevelReward;
55
57
  var token_1 = require("../constants/token");
@@ -74,30 +76,16 @@ function getPlaygrounds(provider, diceRegistry) {
74
76
  // @ts-ignore
75
77
  .filter(function (object) { var _a, _b; return (_b = (_a = object.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.type.endsWith("Playground"); })
76
78
  .map(function (object) {
77
- var e_1, _a;
78
- var _b;
79
+ var _a;
79
80
  // @ts-ignore
80
- var fields = (_b = object.data) === null || _b === void 0 ? void 0 : _b.content.fields;
81
+ var fields = (_a = object.data) === null || _a === void 0 ? void 0 : _a.content.fields;
81
82
  // console.log(fields);
82
- var opened_games = new Map();
83
- if (fields.opened_games.fields) {
84
- try {
85
- for (var _c = __values(fields.opened_games.fields.contents), _d = _c.next(); !_d.done; _d = _c.next()) {
86
- var curr = _d.value;
87
- // console.log(curr);
88
- opened_games.set(curr.fields.key, curr.fields.value.fields);
89
- }
90
- }
91
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
92
- finally {
93
- try {
94
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
95
- }
96
- finally { if (e_1) throw e_1.error; }
97
- }
98
- }
99
- // console.log(opened_games);
83
+ var opened_games = fields.opened_games.fields.contents.reduce(function (acc, curr) {
84
+ acc.set(curr.fields.key, curr.fields.value.fields);
85
+ return acc;
86
+ }, new Map());
100
87
  var game_config = fields.game_config.fields;
88
+ // console.log(opened_games);
101
89
  // console.log(game_config);
102
90
  var playground = {
103
91
  id: fields.id.id,
@@ -109,9 +97,6 @@ function getPlaygrounds(provider, diceRegistry) {
109
97
  game_config: game_config,
110
98
  is_active: fields.is_active,
111
99
  };
112
- if (fields.exp_config) {
113
- playground.exp_config = fields.exp_config.fields;
114
- }
115
100
  // console.log(playground);
116
101
  return playground;
117
102
  });
@@ -120,14 +105,14 @@ function getPlaygrounds(provider, diceRegistry) {
120
105
  });
121
106
  });
122
107
  }
123
- function getHistory(provider, dicePackage, module, playgrounds) {
108
+ function getHistory(provider, dicePackage, playgrounds) {
124
109
  return __awaiter(this, void 0, void 0, function () {
125
110
  var eventFilter, result, history, nextPage;
126
111
  return __generator(this, function (_a) {
127
112
  switch (_a.label) {
128
113
  case 0:
129
114
  eventFilter = {
130
- MoveEventType: "".concat(dicePackage, "::").concat(module, "::Draw"),
115
+ MoveEventType: "".concat(dicePackage, "::tails_exp::Draw"),
131
116
  };
132
117
  return [4 /*yield*/, provider.queryEvents({ query: eventFilter, order: "descending" })];
133
118
  case 1:
@@ -151,6 +136,26 @@ function getHistory(provider, dicePackage, module, playgrounds) {
151
136
  });
152
137
  });
153
138
  }
139
+ function waitHistory(provider, dicePackage, onMessage) {
140
+ return __awaiter(this, void 0, void 0, function () {
141
+ var eventFilter, unsubscribe;
142
+ return __generator(this, function (_a) {
143
+ switch (_a.label) {
144
+ case 0:
145
+ eventFilter = {
146
+ MoveEventType: "".concat(dicePackage, "::tails_exp::Draw"),
147
+ };
148
+ return [4 /*yield*/, provider.subscribeEvent({
149
+ filter: eventFilter,
150
+ onMessage: onMessage,
151
+ })];
152
+ case 1:
153
+ unsubscribe = _a.sent();
154
+ return [2 /*return*/, unsubscribe];
155
+ }
156
+ });
157
+ });
158
+ }
154
159
  function parseHistory(datas, playgrounds) {
155
160
  return __awaiter(this, void 0, void 0, function () {
156
161
  var result;
@@ -189,15 +194,7 @@ function parseHistory(datas, playgrounds) {
189
194
  break;
190
195
  }
191
196
  var stake_amount = Number(drawEvent.stake_amount) / Math.pow(10, decimal);
192
- var amount;
193
- if (asset == "FUD") {
194
- amount = "".concat(stake_amount / 1000000, "m");
195
- }
196
- else {
197
- amount = stake_amount;
198
- }
199
- var exp = Number(drawEvent.exp) | Number(drawEvent.exp_amount);
200
- // console.log(drawEvent);
197
+ var amount = stake_amount > 1000000 ? "".concat(stake_amount / 1000000, "m") : stake_amount;
201
198
  var display = {
202
199
  game_id: drawEvent.game_id,
203
200
  player: drawEvent.player,
@@ -206,24 +203,52 @@ function parseHistory(datas, playgrounds) {
206
203
  result_1: result_1,
207
204
  result_2: result_2,
208
205
  bet_amount: "".concat(amount, " ").concat(asset),
209
- exp: "".concat(exp, " EXP"),
206
+ exp: "".concat(Number(drawEvent.exp), " EXP"),
210
207
  timestampMs: drawEvent.timestampMs,
211
208
  };
212
- if (drawEvent.reward) {
213
- var reward = Number(drawEvent.reward) / Math.pow(10, decimal);
214
- if (asset == "FUD") {
215
- display.reward = "".concat(reward / 1000000, "m ").concat(asset);
216
- }
217
- else {
218
- display.reward = "".concat(reward, " ").concat(asset);
219
- }
220
- }
221
209
  return display;
222
210
  });
223
211
  return [2 /*return*/, result];
224
212
  });
225
213
  });
226
214
  }
215
+ function getLeaderBoard(drawDisplays) {
216
+ return __awaiter(this, void 0, void 0, function () {
217
+ var leaderBoard, _loop_1, drawDisplays_1, drawDisplays_1_1, drawDisplay;
218
+ var e_1, _a;
219
+ return __generator(this, function (_b) {
220
+ leaderBoard = [];
221
+ _loop_1 = function (drawDisplay) {
222
+ var i = leaderBoard.findIndex(function (x) { return x.player == drawDisplay.player; });
223
+ if (i == -1) {
224
+ leaderBoard.push({
225
+ player: drawDisplay.player,
226
+ total_bet_amount: Number(drawDisplay.bet_amount.split(" ")[0]),
227
+ total_earn_exp: Number(drawDisplay.exp.split(" ")[0]),
228
+ });
229
+ }
230
+ else {
231
+ leaderBoard[i].total_bet_amount += Number(drawDisplay.bet_amount.split(" ")[0]);
232
+ leaderBoard[i].total_earn_exp += Number(drawDisplay.exp.split(" ")[0]);
233
+ }
234
+ };
235
+ try {
236
+ for (drawDisplays_1 = __values(drawDisplays), drawDisplays_1_1 = drawDisplays_1.next(); !drawDisplays_1_1.done; drawDisplays_1_1 = drawDisplays_1.next()) {
237
+ drawDisplay = drawDisplays_1_1.value;
238
+ _loop_1(drawDisplay);
239
+ }
240
+ }
241
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
242
+ finally {
243
+ try {
244
+ if (drawDisplays_1_1 && !drawDisplays_1_1.done && (_a = drawDisplays_1.return)) _a.call(drawDisplays_1);
245
+ }
246
+ finally { if (e_1) throw e_1.error; }
247
+ }
248
+ return [2 /*return*/, leaderBoard];
249
+ });
250
+ });
251
+ }
227
252
  function getProfitSharing(provider, diceProfitSharing) {
228
253
  return __awaiter(this, void 0, void 0, function () {
229
254
  var object, type, tokenType, result;
@@ -8,7 +8,7 @@ import { TransactionBlock } from "@mysten/sui.js/transactions";
8
8
  ctx: &mut TxContext
9
9
  )
10
10
  */
11
- export declare function newGameTx(gasBudget: number, packageId: string, module: "tails_exp" | "combo_dice", typeArguments: string[], // [TOKEN]
11
+ export declare function newGameTx(gasBudget: number, packageId: string, typeArguments: string[], // [TOKEN]
12
12
  registry: string, index: string, coins: string[], amount: string): Promise<TransactionBlock>;
13
13
  /**
14
14
  public(friend) entry fun play_guess(
@@ -22,9 +22,9 @@ registry: string, index: string, coins: string[], amount: string): Promise<Trans
22
22
  ctx: &mut TxContext
23
23
  )
24
24
  */
25
- export declare function playGuessTx(gasBudget: number, packageId: string, module: "tails_exp" | "combo_dice", registry: string, index: string, guess_1: string, larger_than_1: boolean, guess_2: string, larger_than_2: boolean): Promise<TransactionBlock>;
26
- export declare function newGamePlayGuessTx(gasBudget: number, packageId: string, module: "tails_exp" | "combo_dice", typeArguments: string[], // [TOKEN]
27
- registry: string, expRegistry: string, index: string, coins: string[], amount: string, guess_1: string, larger_than_1: boolean, guess_2: string, larger_than_2: boolean): Promise<TransactionBlock>;
25
+ export declare function playGuessTx(gasBudget: number, packageId: string, registry: string, index: string, guess_1: string, larger_than_1: boolean, guess_2: string, larger_than_2: boolean): Promise<TransactionBlock>;
26
+ export declare function newGamePlayGuessTx(gasBudget: number, packageId: string, typeArguments: string[], // [TOKEN]
27
+ registry: string, index: string, coins: string[], amount: string, guess_1: string, larger_than_1: boolean, guess_2: string, larger_than_2: boolean): Promise<TransactionBlock>;
28
28
  /**
29
29
  public fun consume_exp_coin_staked(
30
30
  registry: &mut Registry,
@@ -67,14 +67,14 @@ var transactions_1 = require("@mysten/sui.js/transactions");
67
67
  ctx: &mut TxContext
68
68
  )
69
69
  */
70
- function newGameTx(gasBudget, packageId, module, typeArguments, // [TOKEN]
70
+ function newGameTx(gasBudget, packageId, typeArguments, // [TOKEN]
71
71
  registry, index, coins, amount) {
72
72
  return __awaiter(this, void 0, void 0, function () {
73
73
  var tx;
74
74
  return __generator(this, function (_a) {
75
75
  tx = new transactions_1.TransactionBlock();
76
76
  tx.moveCall({
77
- target: "".concat(packageId, "::").concat(module, "::new_game"),
77
+ target: "".concat(packageId, "::tails_exp::new_game"),
78
78
  typeArguments: typeArguments,
79
79
  arguments: [tx.object(registry), tx.pure(index), tx.makeMoveVec({ objects: coins.map(function (id) { return tx.object(id); }) }), tx.pure(amount)],
80
80
  });
@@ -95,13 +95,13 @@ registry, index, coins, amount) {
95
95
  ctx: &mut TxContext
96
96
  )
97
97
  */
98
- function playGuessTx(gasBudget, packageId, module, registry, index, guess_1, larger_than_1, guess_2, larger_than_2) {
98
+ function playGuessTx(gasBudget, packageId, registry, index, guess_1, larger_than_1, guess_2, larger_than_2) {
99
99
  return __awaiter(this, void 0, void 0, function () {
100
100
  var tx;
101
101
  return __generator(this, function (_a) {
102
102
  tx = new transactions_1.TransactionBlock();
103
103
  tx.moveCall({
104
- target: "".concat(packageId, "::").concat(module, "::play_guess"),
104
+ target: "".concat(packageId, "::tails_exp::play_guess"),
105
105
  typeArguments: [],
106
106
  arguments: [
107
107
  tx.object(registry),
@@ -117,8 +117,8 @@ function playGuessTx(gasBudget, packageId, module, registry, index, guess_1, lar
117
117
  });
118
118
  });
119
119
  }
120
- function newGamePlayGuessTx(gasBudget, packageId, module, typeArguments, // [TOKEN]
121
- registry, expRegistry, index, coins, amount, guess_1, larger_than_1, guess_2, larger_than_2) {
120
+ function newGamePlayGuessTx(gasBudget, packageId, typeArguments, // [TOKEN]
121
+ registry, index, coins, amount, guess_1, larger_than_1, guess_2, larger_than_2) {
122
122
  return __awaiter(this, void 0, void 0, function () {
123
123
  var tx, _a, coin;
124
124
  return __generator(this, function (_b) {
@@ -127,16 +127,14 @@ registry, expRegistry, index, coins, amount, guess_1, larger_than_1, guess_2, la
127
127
  typeArguments[0] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI") {
128
128
  _a = __read(tx.splitCoins(tx.gas, [tx.pure(amount)]), 1), coin = _a[0];
129
129
  tx.moveCall({
130
- target: "".concat(packageId, "::").concat(module, "::new_game"),
130
+ target: "".concat(packageId, "::tails_exp::new_game"),
131
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)],
132
+ arguments: [tx.object(registry), tx.pure(index), tx.makeMoveVec({ objects: [coin] }), tx.pure(amount)],
135
133
  });
136
134
  }
137
135
  else {
138
136
  tx.moveCall({
139
- target: "".concat(packageId, "::").concat(module, "::new_game"),
137
+ target: "".concat(packageId, "::tails_exp::new_game"),
140
138
  typeArguments: typeArguments,
141
139
  arguments: [
142
140
  tx.object(registry),
@@ -147,7 +145,7 @@ registry, expRegistry, index, coins, amount, guess_1, larger_than_1, guess_2, la
147
145
  });
148
146
  }
149
147
  tx.moveCall({
150
- target: "".concat(packageId, "::").concat(module, "::play_guess"),
148
+ target: "".concat(packageId, "::tails_exp::play_guess"),
151
149
  typeArguments: [],
152
150
  arguments: [
153
151
  tx.object(registry),
@@ -156,22 +154,9 @@ registry, expRegistry, index, coins, amount, guess_1, larger_than_1, guess_2, la
156
154
  tx.pure(larger_than_1),
157
155
  tx.pure(guess_2),
158
156
  tx.pure(larger_than_2),
157
+ // tx.object("0x8"), // TODO: waiting for upgrade
159
158
  ],
160
159
  });
161
- // TODO: waiting for upgrade
162
- // tx.moveCall({
163
- // target: `${packageId}::${module}::play_guess_with_random`,
164
- // typeArguments: module == "combo_dice" ? typeArguments : [],
165
- // arguments: [
166
- // tx.object(registry),
167
- // tx.pure(index),
168
- // tx.pure(guess_1),
169
- // tx.pure(larger_than_1),
170
- // tx.pure(guess_2),
171
- // tx.pure(larger_than_2),
172
- // tx.object("0x8"),
173
- // ],
174
- // });
175
160
  tx.setGasBudget(gasBudget);
176
161
  return [2 /*return*/, tx];
177
162
  });
@@ -0,0 +1,8 @@
1
+ export interface DrawResult {
2
+ answer_1: string;
3
+ result_1: string;
4
+ answer_2: string;
5
+ result_2: string;
6
+ exp: string;
7
+ }
8
+ export declare function simulateGame(network: "mainnet" | "testnet", packageId: string, 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>;
@@ -44,8 +44,8 @@ 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) {
47
+ function simulateGame(network_1, packageId_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, registry, index, amount, guess_1, larger_than_1, guess_2, larger_than_2, vrf_input_1, vrf_input_2, drawKeys, sender) {
49
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
50
  if (sender === void 0) { sender = "0xb6c7e3b1c61ee81516a8317f221daa035f1503e0ac3ae7a50b61834bc7a3ead9"; }
51
51
  return __generator(this, function (_a) {
@@ -53,7 +53,7 @@ function simulateGame(network_1, packageId_1, module_1, registry_1, index_1, amo
53
53
  case 0:
54
54
  provider = new client_1.SuiClient({ url: (0, client_1.getFullnodeUrl)(network) });
55
55
  transactionBlock = new transactions_1.TransactionBlock();
56
- target = "".concat(packageId, "::").concat(module, "::simulate_game");
56
+ target = "".concat(packageId, "::tails_exp::simulate_game");
57
57
  return [4 /*yield*/, (0, bls_signatures_1.default)()];
58
58
  case 1:
59
59
  BLS = _a.sent();
@@ -734,7 +734,7 @@ function parseVaultInfo(vaults, Index, action, eventLog) {
734
734
  period = "Hourly";
735
735
  break;
736
736
  case "4":
737
- period = "10Min";
737
+ period = "10min";
738
738
  break;
739
739
  default:
740
740
  period = "";
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typus/typus-sdk",
3
3
  "author": "Typus",
4
4
  "description": "typus sdk",
5
- "version": "1.4.7-c",
5
+ "version": "1.4.8",
6
6
  "dependencies": {
7
7
  "@mysten/bcs": "^0.11.1",
8
8
  "@mysten/kiosk": "0.8.10",
@@ -1 +0,0 @@
1
- export declare function getDrawResult(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[]): Promise<any>;
@@ -1,8 +0,0 @@
1
- export interface DrawResult {
2
- answer_1: string;
3
- result_1: string;
4
- answer_2: string;
5
- result_2: string;
6
- exp: string;
7
- }
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>;
File without changes
File without changes