Quickstart

IAMGame Wallet gives your players an embedded, self-custodial Solana wallet they sign in to with their existing wallet or Telegram — no seed phrases, no extensions. This guide takes you from zero to a working login in about ten minutes.

1. Get your keys

Sign in to the developer portal and create an app. You get two keys:

Publishable key (pk_test_… / pk_live_…) — safe to ship in your frontend. Secret key (sk_…) — backend only, never in the browser. New apps start in test mode (Solana devnet); request live access in the portal to go to mainnet.

2. Install the SDK

bash
npm install @iamgame/wallet-sdk

3. Wrap your app in the provider

Point the SDK at the API and pass your publishable key.

TS
import { IAMGameWalletProvider } from "@iamgame/wallet-sdk";

export default function App({ children }) {
  return (
    <IAMGameWalletProvider
      publishableKey={process.env.NEXT_PUBLIC_IAMGAME_WALLET_PK!}
      baseUrl="https://api-wallet.iamgame.com/v1"
    >
      {children}
    </IAMGameWalletProvider>
  );
}

4. Add a login + wallet UI

Drop in the prebuilt components, or use the hooks to build your own.

TS
import { WalletLogin, WalletAddress, WalletBalance } from "@iamgame/wallet-sdk";

function Account() {
  return (
    <div>
      <WalletLogin />
      <WalletAddress />
      <WalletBalance />
    </div>
  );
}

On a successful login the SDK holds a short-lived session token. The next step is to prove that session to your own backend — see Authentication.

5. Trust the user on your backend

Never trust a wallet address the browser claims. Forward the session token to your backend and verify it server-to-server with your secret key, then issue your own app session.

TS
import { IAMGameWalletServer } from "@iamgame/wallet-sdk-server";

const wallet = new IAMGameWalletServer({
  secretKey: process.env.IAMGAME_WALLET_SECRET_KEY!,
  baseUrl: "https://api-wallet.iamgame.com/v1",
});

// POST /login  { sessionToken }
const verified = await wallet.verifySession(sessionToken);
// → { userId, walletAddress, wallets, identities, environment }
const myJwt = signMyAppJwt({ userId: verified.userId, wallet: verified.walletAddress });

That’s the whole loop: wallet login → session token → your backend verifies → your JWT. From here, add signing, deposits, withdrawals, and (for high-frequency games) the ledger.