Configuration
This page describes all available configuration options for initializeLedgerProvider.
Configuration options
{
devConfig?: {
stub?: {
base?: boolean; // Enable base stub mode for development (default: false)
account?: boolean; // Enable account stubbing (default: false)
device?: boolean; // Enable device stubbing (default: false)
web3Provider?: boolean; // Enable Web3 provider stubbing (default: false)
dAppConfig?: boolean; // Enable dApp config stubbing (default: false)
};
};
target?: HTMLElement; // Target element to mount UI (default: document.body)
dAppIdentifier?: string; // Your dApp identifier
apiKey?: string; // Your Ledger API key
loggerLevel?: string; // Log level: 'debug', 'info', 'warn', 'error' (default: 'info')
dmkConfig?: any; // Device Management Kit configuration (optional)
walletTransactionFeatures?: Array<'send' | 'receive' | 'swap' | 'buy' | 'earn' | 'sell'>; // Wallet action CTAs to display
}Parameter details
devConfig.stub
Toggles local stub modes so you can simulate accounts, devices, and Web3 flows during development.
For development and testing, you can enable stub mode:
const cleanup = initializeLedgerProvider({
devConfig: {
stub: {
base: true, // Enable base stub mode
account: true, // Mock account operations
device: true, // Mock device interactions
web3Provider: true, // Mock Web3 provider responses
dAppConfig: true, // Mock dApp configuration
},
},
dAppIdentifier: "my-dapp",
apiKey: "your-api-key",
});target
Target element to mount UI. Default is document.body.
Determines where the Ledger Wallet Provider UI mounts in your application.
dAppIdentifier
Your dApp identifier. This lets Ledger validate the integration and enable remote services.
apiKey
Your Ledger API key. Required for production use.
loggerLevel
Log level: 'debug', 'info', 'warn', 'error'. Default is 'info'.
Adjusts log verbosity.
dmkConfig
Device Management Kit configuration (optional).
Passes Device Management Kit options when you need custom device policies.
walletTransactionFeatures
An optional array of wallet transaction features to display as action buttons in the side panel.
Available features:
'send'- Send crypto'receive'- Receive crypto'swap'- Swap tokens'buy'- Buy crypto'earn'- Earn rewards'sell'- Sell crypto
If no features are specified, the action buttons section will not be displayed.
Return value
The function returns a cleanup function to remove the provider and UI components.
const cleanup = initializeLedgerProvider({ /* options */ })
// Later, when unmounting:
cleanup()The cleanup function tears down the UI and event listeners if your app unmounts.