initAmplifySDK() once at application startup.
Import
Usage
Parameters
SDKInitOptions
Return Type
Examples
- Basic
- Custom RPCs
- With Options
- Custom Logger
Behavior
- Validates API key — Checks key format and minimum length
- Returns immediately — Initialization completes without blocking on network calls
- Populates cache in background — Vaults and assets are fetched asynchronously after init returns. Use
waitForCacheReady()if you need guaranteed fast operations before the first SDK call - Configures telemetry — Sets up PostHog if enabled (async, non-blocking)
- Configures logging — Sets log level and optional custom logger
- Idempotent — Multiple calls with same key are no-ops
- Re-initialization — Different key clears cache and reconfigures
Error Handling
If you call other SDK functions (e.g.,
prepareDepositTxData, fetchSupportedAssets) before calling initAmplifySDK(), they will throw an SDK_NOT_INITIALIZED error. Always initialize the SDK first.Related
- Logging Guide - Configure logging levels
- Project Setup - SDK initialization patterns