bomb-panic-sdk 0.1.0

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 (2) hide show
  1. package/README.md +71 -0
  2. package/package.json +11 -0
package/README.md ADDED
@@ -0,0 +1,71 @@
1
+ # Bomb Panic SDK (Local)
2
+
3
+ Thin TypeScript helpers for Bomb Panic + GameHub flows. This SDK only builds
4
+ transactions and parses on-chain data. You still sign/execute transactions with
5
+ your wallet or server signer.
6
+
7
+ ## Install / Import (local)
8
+
9
+ From the repo root:
10
+
11
+ ```ts
12
+ import { SuiClient } from '@onelabs/sui/client';
13
+ import {
14
+ buildJoinAndReadyTx,
15
+ buildPassBombTx,
16
+ getLobbyRoomGamePairs,
17
+ getRoomAndGameParsed,
18
+ parseRoom,
19
+ type SdkConfig,
20
+ } from './sdk/index.js';
21
+ ```
22
+
23
+ ## Config
24
+
25
+ ```ts
26
+ const sdkConfig: SdkConfig = {
27
+ packageId: '<PACKAGE_ID>',
28
+ coinType: '0x2::oct::OCT',
29
+ // optional overrides
30
+ randomId: '0x8',
31
+ clockId: '0x6',
32
+ };
33
+ ```
34
+
35
+ ## Read Examples
36
+
37
+ ```ts
38
+ const client = new SuiClient({ url: RPC_URL });
39
+
40
+ const pairs = await getLobbyRoomGamePairs(client, LOBBY_ID);
41
+ const roomIds = pairs.map(p => p.roomId);
42
+ const rooms = await client.multiGetObjects({
43
+ ids: roomIds,
44
+ options: { showContent: true, showType: true },
45
+ });
46
+ const parsedRooms = rooms
47
+ .map(r => parseRoom(r.data?.content))
48
+ .filter(Boolean);
49
+
50
+ const { room, game } = await getRoomAndGameParsed(client, ROOM_ID, GAME_STATE_ID);
51
+ ```
52
+
53
+ ## Tx Examples
54
+
55
+ ```ts
56
+ const tx = buildJoinAndReadyTx(sdkConfig, {
57
+ roomId: ROOM_ID,
58
+ gameStateId: GAME_STATE_ID,
59
+ entryFee: ENTRY_FEE,
60
+ });
61
+ await wallet.signAndExecuteTransaction({ transaction: tx });
62
+
63
+ const passTx = buildPassBombTx(sdkConfig, { gameStateId: GAME_STATE_ID });
64
+ await wallet.signAndExecuteTransaction({ transaction: passTx });
65
+ ```
66
+
67
+ ## Notes
68
+
69
+ - All helpers return a `Transaction` from `@onelabs/sui/transactions`.
70
+ - Read helpers return raw objects or parsed shapes for UI/DB use.
71
+ - See `docs/INTEGRATION_SHORT_SDK.md` for full end-to-end usage.
package/package.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "bomb-panic-sdk",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": ["dist", "README.md", "LICENSE"],
8
+ "scripts": {
9
+ "build": "tsc -p tsconfig.json"
10
+ }
11
+ }