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.
npm install bomb-panic-sdkThin 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.
From the repo root:
``ts`
import { SuiClient } from '@onelabs/sui/client';
import {
buildJoinAndReadyTx,
buildPassBombTx,
getLobbyRoomGamePairs,
getRoomAndGameParsed,
parseRoom,
type SdkConfig,
} from './sdk/index.js';
`ts`
const sdkConfig: SdkConfig = {
packageId: '
coinType: '0x2::oct::OCT',
// optional overrides
randomId: '0x8',
clockId: '0x6',
};
These helpers need a Coin input for create_room (creation fee) and ready_to_play (entry fee).coinType
If is not your gas coin, you can either:
- pass a coin object id to split from, or
- pass client + owner so the SDK merges/splits for you.
`ts
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);
`
`ts
const tx = await 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 });
`
`ts
const HACKATHON = '0x8b76fc2a2317d45118770cefed7e57171a08c477ed16283616b15f099391f120::hackathon::HACKATHON';
const hackConfig: SdkConfig = { packageId: '
const createTx = await buildCreateRoomTx(hackConfig, {
gameRegistryId: GAME_REGISTRY_ID,
configId: CONFIG_ID,
entryFee: ENTRY_FEE,
maxPlayers: 4,
creationFee: 100,
client,
owner: WALLET_ADDRESS,
});
const readyTx = await buildReadyTx(hackConfig, {
roomId: ROOM_ID,
entryFee: ENTRY_FEE,
client,
owner: WALLET_ADDRESS,
});
`
- Fee-paying helpers return Promise (they may query/merge coins).docs/INTEGRATION_SHORT_SDK.md` for full end-to-end usage.
- Read helpers return raw objects or parsed shapes for UI/DB use.
- See