Skip to content

b3-fun/launcher-sdk

Repository files navigation

B3 Launcher SDK

A TypeScript SDK for easy integration with websites and web games.

Installation

npm install @b3dotfun/bsmnt-launcher-sdk

Usage

Initialize the SDK

import B3LauncherSDK from '@b3dotfun/bsmnt-launcher-sdk';

const sdk = new B3WebSDK({
  releaseType: "embedded",
  debug: true, // Enable debug logging,
});

Calling APIs

Access all available APIs through methods on sdk.

// e.g. get channel status
const channelStatus = await sdk.getChannelStatus();

API

SDK Configuration

interface SDKConfig {
  releaseType: "embedded" | "external";
  debug?: boolean;
  overwriteJwt?: string;
}

Response Format

All API methods return a Promise with an ApiResponse object:

interface ApiResponse<T> {
  success: boolean;
  data?: T;
  error?: {
    code: string;
    message: string;
  };
}

Error Handling

const response = await sdk.setUserScore(100, "highscore");
if (!response.success) {
  console.error(`Error: ${response.error?.code} - ${response.error?.message}`);
}

Development

Building the SDK

npm run build

Running tests

npm test

License

MIT

About

The NPM SDK package for the basement launcher APIs

Topics

Resources

Stars

Watchers

Forks