All Amplify SDK functions require initialization before use. CallDocumentation Index
Fetch the complete documentation index at: https://developers.paxoslabs.com/llms.txt
Use this file to discover all available pages before exploring further.
initAmplifySDK() once at application startup.
Import
Usage
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
apiKey | string | Yes | Your Paxos Labs API key (format: pxl_...) |
options | SDKInitOptions | No | Configuration options for telemetry and logging |
SDKInitOptions
| Option | Type | Default | Description |
|---|---|---|---|
rpcUrls | Record<number, string> | Public RPCs | Allow custom RPCs to provide better UX and reliability. Chains without a custom RPC URL fall back to public RPCs. |
telemetry | boolean | true | Enable PostHog error tracking |
logLevel | LogLevel | LogLevel.ERROR | Minimum log level to output |
logger | Logger | Built-in console logger | Custom logger implementation |
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 — Accounts 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
| Error Message Pattern | Description | Resolution |
|---|---|---|
"API key cannot be empty" | Empty or missing API key | Provide a valid pxl_... key |
"Invalid API key format" | Key too short or malformed | Check key format |
If you call other SDK functions (e.g.,
prepareDepositTxData,
getSupportedAssets) 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