Skip to main content
Every Passport user has an embedded wallet on Immutable Chain. This guide covers wallet operations for developers integrating Passport into games and applications.
For end users: Players can manage their wallet, view balances, and browse transaction history at Immutable Play. Direct your users there for wallet management features.

Overview

This page covers essential wallet operations including retrieving wallet addresses, checking native IMX and ERC-20 token balances, sending transactions (transfers, contract interactions, NFTs), signing messages (ERC-191 personal sign and EIP-712 typed data), and error handling patterns.

Prerequisites

User Authentication

User must be authenticated with Passport before using wallet operations
Web vs Native: Some features like pre-approved transactions require Unity/Unreal native clients and cannot be used in web browsers.

Wallet Connect

Connect the EVM provider and request account access. Required for all wallet operations including Checkout wallet funding and Orderbook trading operations.
Pass getUser from useImmutableSession to connectWallet so the wallet uses your server-managed session instead of its own OAuth flow.
When getUser is provided, the wallet skips its own OAuth flow and relies on the server-managed session. This avoids duplicate login prompts and keeps token refresh in one place. Pass undefined when the user is not authenticated to allow the wallet to use its own login flow.
Important: Before connecting the wallet, ensure you have initialized Passport and logged in the user. Then complete these steps:
  1. Connect EVM provider (connectEvm() / ConnectEvm())
  2. Request accounts (eth_requestAccounts / ZkEvmRequestAccounts())
Next.js: Once you have the provider from connectWallet({ getUser }) (shown in the Next.js tab above), all wallet operations below work the same way as the TypeScript examples — the provider is the same EIP-1193 compatible ZkEvmProvider. Use the TypeScript tab code with your Next.js provider.

Configuration

The connectWallet function accepts configuration options to customize the wallet provider.

Custom Client ID

Chain Selection

All Options

Using @imtbl/auth (Direct)

For applications that manage authentication outside of Next.js, wrap the Auth class in a getUser function:

Chain Configuration

Chain Constants

Presets

Spread-friendly presets are also available:

Custom Chain Configuration

Get Wallet Address

Linked Addresses

Users can link external wallets (like MetaMask, WalletConnect, etc.) to their Passport account, allowing them to use the same identity across multiple wallets.
Link an external wallet (such as MetaMask or a hardware wallet) to the user’s Passport account. This requires a signature from the external wallet to prove ownership.

Linking Errors

Check Balances

Native IMX and ERC-20 Token Balances

Send Transactions

Wei Conversion: 1 IMX = 10^18 wei. For TypeScript, use parseUnits('1', 18) from ethers or viem. Unity/Unreal require string values in wei.

Send Transaction with Confirmation

Recommended for critical operations - Waits for blockchain confirmation before returning.
When to use: Critical operations like transfers, mints, or state changes. Ensures transaction succeeded before updating game state.

Send Transaction without Confirmation

For fire-and-forget operations - Returns transaction hash immediately without waiting.
Fire-and-Forget: Returns immediately without waiting for blockchain confirmation. Use for non-critical operations where you want responsive UI (cosmetic purchases, achievements, analytics).
Transaction Hash ≠ Success: Obtaining the transaction hash does not guarantee a successful transaction. To determine the transaction’s status, use ZkEvmGetTransactionReceipt along with the transaction hash received. Follow best practices for client-side polling: set maximum attempts, polling intervals, and implement timeout handling.
When to use: Non-critical operations or when you need custom polling/retry logic. Most games should use “with confirmation” variant for critical operations.

NFT Transfer

Sign Messages

Personal Sign (ERC-191)

For authentication or simple message signing:

Typed Data (EIP-712)

For structured data signing (used by protocols like Seaport):

Provider Events

The provider emits standard EIP-1193 events that you can subscribe to:

EIP-6963 Provider Discovery

The wallet automatically announces itself via EIP-6963 for wallet discovery by dApps. Disable this if needed:
For manual announcement:

Error Handling

Use WalletError and WalletErrorType for typed error handling:

Error Types

JSON-RPC Error Codes

Next Steps

Gas Sponsorship

Gas sponsorship and transaction costs

Pre-Approved Transactions

Instant transactions without popups (Unity/Unreal)

Immutable Play

Where users manage their wallet

Architecture

Understand the security model

Minting NFTs

Mint NFTs to user wallets

Operator Allowlist

Contract allowlisting and verification