bomb-panic-sdk 0.1.5 → 0.1.6
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/parse.js +8 -1
- package/dist/tx.js +6 -8
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
package/dist/parse.js
CHANGED
|
@@ -91,6 +91,9 @@ export function parseGameState(content) {
|
|
|
91
91
|
if (!content || content.dataType !== 'moveObject')
|
|
92
92
|
return null;
|
|
93
93
|
const fields = content.fields ?? {};
|
|
94
|
+
const configFields = typeof fields.config === 'object' && fields.config
|
|
95
|
+
? fields.config.fields ?? fields.config
|
|
96
|
+
: {};
|
|
94
97
|
const gameId = getObjectIdFromContent(content);
|
|
95
98
|
const phase = fields.phase?.variant ?? 'Unknown';
|
|
96
99
|
const roundId = toBigInt(fields.round_id ?? 0);
|
|
@@ -101,7 +104,9 @@ export function parseGameState(content) {
|
|
|
101
104
|
const poolValue = toBigInt(fields.pool_value ?? 0);
|
|
102
105
|
const entryFeePerPlayer = toBigInt(fields.entry_fee_per_player ?? 0);
|
|
103
106
|
const rewardPerSec = toBigInt(fields.reward_per_sec ?? 0);
|
|
104
|
-
const explosionRateBps = toBigInt(fields.explosion_rate_bps ?? 0);
|
|
107
|
+
const explosionRateBps = toBigInt(configFields.explosion_rate_bps ?? fields.explosion_rate_bps ?? 0);
|
|
108
|
+
const maxHoldTimeMs = toBigInt(configFields.max_hold_time_ms ?? fields.max_hold_time_ms ?? 0);
|
|
109
|
+
const rewardDivisor = toBigInt(configFields.reward_divisor ?? fields.reward_divisor ?? 0);
|
|
105
110
|
const settlementConsumed = Boolean(fields.settlement_consumed);
|
|
106
111
|
const roomId = fields.room_id ?? '';
|
|
107
112
|
const rewards = new Map();
|
|
@@ -136,6 +141,8 @@ export function parseGameState(content) {
|
|
|
136
141
|
entryFeePerPlayer,
|
|
137
142
|
rewardPerSec,
|
|
138
143
|
explosionRateBps,
|
|
144
|
+
maxHoldTimeMs,
|
|
145
|
+
rewardDivisor,
|
|
139
146
|
settlementConsumed,
|
|
140
147
|
roomId,
|
|
141
148
|
players,
|
package/dist/tx.js
CHANGED
|
@@ -30,7 +30,7 @@ export function buildCreateGameForRoomTx(config, args) {
|
|
|
30
30
|
const tx = new Transaction();
|
|
31
31
|
tx.moveCall({
|
|
32
32
|
target: `${config.packageId}::bomb_panic::create_game_for_room`,
|
|
33
|
-
arguments: [tx.object(args.lobbyId), tx.
|
|
33
|
+
arguments: [tx.object(args.lobbyId), tx.object(args.roomId)],
|
|
34
34
|
typeArguments: [config.coinType],
|
|
35
35
|
});
|
|
36
36
|
return tx;
|
|
@@ -142,13 +142,11 @@ export function buildLeaveRoomAndGameTx(config, args) {
|
|
|
142
142
|
typeArguments: [config.coinType],
|
|
143
143
|
});
|
|
144
144
|
// 2. Cancel Ready if needed
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
});
|
|
151
|
-
}
|
|
145
|
+
tx.moveCall({
|
|
146
|
+
target: `${config.packageId}::gamehub::cancel_ready`,
|
|
147
|
+
arguments: [tx.object(args.roomId)],
|
|
148
|
+
typeArguments: [config.coinType],
|
|
149
|
+
});
|
|
152
150
|
// 3. Leave Room
|
|
153
151
|
tx.moveCall({
|
|
154
152
|
target: `${config.packageId}::gamehub::leave_room`,
|
package/dist/types.d.ts
CHANGED