Consult with the Treasure team to gain access to a pre-release version of the Treasure Launcher.

Games that are distributed via the Treasure Launcher, do not need to authenticate users via the Treasure Connect flow.

The JS TDK Core Library will automatically detect if the user is using the Treasure Launcher and provides the developer with access to the user’s auth token.

The auth token can be used to interact with the TDK API.

Installation

Desktop Launcher Connect usage with the JS TDK Core Library is available via the @treasure-dev/launcher package.

Public members

import type { SessionOptions } from "@treasure-dev/tdk-core";

function getTreasureLauncherAuthToken(): string | undefined;
function isUsingTreasureLauncher(): boolean;
function startUserSessionViaLauncher({
  backendWallet,
  approvedTargets,
  nativeTokenLimitPerTransaction,
  sessionDurationSec,
  sessionMinDurationLeftSec,
}: SessionOptions): Promise<void>;

Usage

Get auth token

import { getTreasureLauncherAuthToken } from "@treasure-dev/launcher";

const authToken = getTreasureLauncherAuthToken();

Check if using Treasure Launcher

import { isUsingTreasureLauncher } from "@treasure-dev/launcher";

const usingLauncher = isUsingTreasureLauncher();

Start user session

import { startUserSessionViaLauncher } from "@treasure-dev/launcher";

await startUserSessionViaLauncher({
  backendWallet: "0x...",
  approvedTargets: ["0x..."],
  nativeTokenLimitPerTransaction: 100,
  sessionDurationSec: 60 * 60 * 24 * 7,
  sessionMinDurationLeftSec: 60 * 60 * 24 * 3,
});