bomb-panic-sdk
v0.1.5
Published
Thin TypeScript helpers for Bomb Panic + GameHub flows. This SDK only builds transactions and parses on-chain data. You still sign/execute transactions with your wallet or server signer.
Readme
Bomb Panic SDK (Local)
Thin TypeScript helpers for Bomb Panic + GameHub flows. This SDK only builds transactions and parses on-chain data. You still sign/execute transactions with your wallet or server signer.
Install / Import (local)
From the repo root:
import { SuiClient } from '@onelabs/sui/client';
import {
buildJoinAndReadyTx,
buildPassBombTx,
getLobbyRoomGamePairs,
getRoomAndGameParsed,
parseRoom,
type SdkConfig,
} from './sdk/index.js';Config
const sdkConfig: SdkConfig = {
packageId: '<PACKAGE_ID>',
coinType: '0x2::oct::OCT',
// optional overrides
randomId: '0x8',
clockId: '0x6',
};Read Examples
const client = new SuiClient({ url: RPC_URL });
const pairs = await getLobbyRoomGamePairs(client, LOBBY_ID);
const roomIds = pairs.map(p => p.roomId);
const rooms = await client.multiGetObjects({
ids: roomIds,
options: { showContent: true, showType: true },
});
const parsedRooms = rooms
.map(r => parseRoom(r.data?.content))
.filter(Boolean);
const { room, game } = await getRoomAndGameParsed(client, ROOM_ID, GAME_STATE_ID);Tx Examples
const tx = buildJoinAndReadyTx(sdkConfig, {
roomId: ROOM_ID,
gameStateId: GAME_STATE_ID,
entryFee: ENTRY_FEE,
});
await wallet.signAndExecuteTransaction({ transaction: tx });
const passTx = buildPassBombTx(sdkConfig, { gameStateId: GAME_STATE_ID });
await wallet.signAndExecuteTransaction({ transaction: passTx });Notes
- All helpers return a
Transactionfrom@onelabs/sui/transactions. - Read helpers return raw objects or parsed shapes for UI/DB use.
- See
docs/INTEGRATION_SHORT_SDK.mdfor full end-to-end usage.
