CrossmintSDK provides access to Crossmint’s wallet services, authentication, and blockchain functionality. Use the shared instance to integrate Crossmint features into your SwiftUI application.
Initialize the SDK with your API key before accessing any functionality:
Initialization
shared
Returns the shared SDK instance.CROSSMINT_API_KEY environment variable. In release builds or if the environment variable is not set, accessing this property without first calling shared(apiKey:authManager:logLevel:) will cause a fatal error.
Info: Call shared(apiKey:authManager:logLevel:) to initialize the SDK before accessing this property in production.
shared(apiKey:authManager:logLevel:)
Initializes and returns the shared SDK instance with the specified configuration.CrossmintSDK instance.
Call this method once during app startup to configure the SDK. Subsequent calls return the existing instance without reinitializing.
Parameters
- apiKey: Your Crossmint client API key.
-
authManager: An optional custom authentication manager. Pass
nilto use the default. -
logLevel: The logging verbosity level. Defaults to
.error.
Services
crossmintWallets
Provides access to Crossmint wallet operations.authManager
Manages user authentication and session state.crossmintService
Provides low-level access to Crossmint API services.crossmintWallets and authManager instead. This property is available for advanced use cases requiring direct API access.
OTP Verification
isOTPRequred
A publisher that emitstrue when OTP verification is required.
submit(otp:)
Submits an OTP code for verification.isOTPRequred emitting true.
Parameters
- otp: The one-time password entered by the user.
cancelTransaction()
Cancels the current transaction requiring OTP verification.Session Management
logout()
Logs out the current user and resets the SDK state.Instance Properties
isProductionEnvironment
Indicates whether the SDK is configured for the production environment.true if using a production API key, false for staging/development keys.
