Overview
Complete reference for Crossmint’s Wallet SDK, Smart Wallet functionality, UI Components, and NFT integration tools
The Crossmint SDK provides a comprehensive set of tools for building NFT experiences. This reference covers both the UI components and core wallet functionality.
Installation
Smart Wallet SDK
React UI Components
Packages Overview
Smart Wallet SDK
For direct wallet operations:
React UI Components
For UI components and hooks:
Only wallet-related functionality requires Crossmint Authentication. The NFT display components
(CrossmintNFTCollectionView
and CrossmintNFTDetail
) can be used independently. If you need wallet functionality,
wrap your application with both providers:
Authentication
The Smart Wallet SDK requires JWT Authentication to be enabled. This ensures that wallet operations are securely tied to authenticated users. For detailed information about setting up authentication, see our JWT Authentication Guide.
Smart Wallet SDK
Initialization
Retrieves or creates a wallet for an authenticated user. Returns a Promise that resolves to an EVMSmartWallet instance.
Example usage:
Providers and Hooks
The React UI components require Crossmint Authentication to work. This section covers the setup needed for the UI components package.
Provider Setup
Wallet Creation Approaches
You have two options for wallet creation:
-
Automatic Creation (Recommended)
The wallet is automatically created after user authentication. Use
useWallet
to access the wallet instance. -
Manual Creation
You’ll need to call
getOrCreateWallet
explicitly:
When using automatic creation (createOnLogin: "all-users"
), you don’t need to call getOrCreateWallet
manually.
The wallet will be available through useWallet
after authentication. Note that getOrCreateWallet
will either
create a new wallet or retrieve an existing one if it was previously created for the same user credentials and
project. This means it’s safe to call multiple times - it won’t create duplicate wallets.
Using Hooks
All wallet-related hooks must be used within the providers above. The main hook you’ll use is useWallet
:
The useWallet
hook must be used within both CrossmintProvider
and CrossmintAuthProvider
. Components using this
hook will only have access to wallets after successful authentication.
UI Components
NFT Collection View
The CrossmintNFTCollectionView
component displays NFTs from any wallet or collection in a responsive grid layout.
List of wallets to display NFTs from:
Customize the component’s appearance:
"production"
(default) or "staging"
NFT Detail View
The CrossmintNFTDetail
component shows detailed information about a specific NFT.
NFT identifier as a locator string (recommended) or object:
Example usage with locator:
Same configuration options as CrossmintNFTCollectionView
"production"
(default) or "staging"
Smart Wallet
The EVMSmartWallet
class provides core blockchain functionality:
The wallet’s blockchain address
The blockchain network:
Executes a smart contract function call. Returns a Promise that resolves to the transaction hash.
Example usage:
Resets the wallet state and cleans up any associated resources. typescript function clearWallet(): void;
Retrieves all NFTs owned by the wallet on the current chain.
Example usage:
Common Patterns
Custom Grid Layout
Connecting a Wallet
Transferring NFTs
Next Steps
Was this page helpful?