A TypeScript SDK for interacting with the Gigaverse game API.
npm install gigaverse-sdk
# or
yarn add gigaverse-sdk
# or
pnpm add gigaverse-sdkimport { GameClient } from "gigaverse-sdk";
// Initialize the client with your API base URL and auth token
const client = new GameClient("https://gigaverse.io", "your-auth-token");
// Example: Start a new run
async function startGameRun() {
try {
// Claim energy if needed
await client.claimEnergy({
romId: "1465",
claimId: "energy",
});
// Start a run
const runResponse = await client.startRun({
actionToken: "initial-token",
dungeonId: 1,
data: {
consumables: [],
itemId: 123,
index: 0,
},
});
console.log("Run started successfully:", runResponse.data.run);
// Make a move
const moveResponse = await client.playMove({
action: "rock",
actionToken: client.getActionToken(),
dungeonId: 1,
data: {},
});
console.log("Move result:", moveResponse.data);
} catch (error) {
console.error("Error:", error);
}
}
startGameRun();The main client for interacting with the Gigaverse API.
new GameClient(baseUrl: string, authToken: string)setAuthToken(newToken: string): void- Update the authentication tokengetActionToken(): string | number | null- Get the current action tokensetActionToken(token: string | number): void- Set the current action tokenclaimEnergy(payload: ClaimEnergyPayload): Promise<ClaimEnergyResponse>- Claim energystartRun(payload: StartRunPayload): Promise<StartRunResponse>- Start a new runplayMove(payload: ActionPayload): Promise<ActionResponse>- Make a move in the current run
The SDK includes TypeScript definitions for all request and response types.
# Install dependencies
pnpm install
# Build
pnpm build
# Lint
pnpm lint
# Format code
pnpm formatMIT