Skip to content

cartridge-gg/controller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2,225 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Controller Cover Image

Controller

Controller is a gaming specific smart contract wallet that enables seamless player onboarding and game interactions.

It supports transaction signing using Passkeys and Session Tokens.

Project structure

The project consists of several packages in the packages directory:

  • keychain - Sandboxed iframe hosted at https://x.cartridge.gg/ that fills the same role as an injected wallet like MetaMask or Rabby: holds keys, signs transactions, and prompts user for approval. Also displays account state (balances, activities, achievements).
  • controller - Main SDK implementing the account interfaces required by starknet.js. Ships two provider modes:
    • ControllerProvider (web apps) - Full-featured web wallet communicating with an embedded keychain iframe. Supports sessions as well as per-transaction approval.
    • SessionProvider (native apps) - Creates ephemeral session keys with pre-configured policies so transactions can execute without per-call approval.
  • connector - Thin adapter that wraps providers as starknet-react connectors, making them drop-in compatible with <StarknetConfig>.

Integration examples live in examples/ (Next.js, Svelte, Node.js).

Development

Frontend

Install pnpm via corepack:

corepack enable pnpm

Install dependencies:

pnpm i

Run Controller with examples:

pnpm dev

This command builds all workspace dependencies first and start these servers:

The simplest way to then develop with your cartridge account is to port it over from the production keychain:

window.cartridge.importAccount("EXPORTED ACCOUNT");