Configuration
Configuration options and settings for @tetherto/wdk-wallet-solana
Wallet Configuration
The WalletManagerSolana accepts an optional configuration object that defines how the wallet interacts with the Solana blockchain:
import WalletManagerSolana from '@tetherto/wdk-wallet-solana'
const config = {
rpcUrl: 'https://api.mainnet-beta.solana.com', // Solana RPC endpoint
transferMaxFee: 10000000 // Optional: Maximum fee in lamports
}
const wallet = new WalletManagerSolana(seedPhrase, config)Account Configuration
Accounts are obtained through the WalletManagerSolana instance using getAccount() or getAccountByPath():
import WalletManagerSolana from '@tetherto/wdk-wallet-solana'
const accountConfig = {
rpcUrl: 'https://api.mainnet-beta.solana.com',
transferMaxFee: 10000000 // Optional: Maximum fee in lamports
}
const wallet = new WalletManagerSolana(seedPhrase, accountConfig)
// Get account by index
const account = await wallet.getAccount(0)
// Or get account by custom derivation path
const customAccount = await wallet.getAccountByPath("0'/0/5")Configuration Options
rpcUrl
The rpcUrl option specifies the Solana RPC endpoint for blockchain interactions.
Type: string (optional)
Default: If not provided, wallet functionality that requires RPC will throw an error
Examples:
// Mainnet
const config = {
rpcUrl: 'https://api.mainnet-beta.solana.com'
}
// Devnet
const config = {
rpcUrl: 'https://api.devnet.solana.com'
}
// Custom RPC
const config = {
rpcUrl: 'https://your-custom-rpc-endpoint.com'
}transferMaxFee
The transferMaxFee option sets the maximum allowed fee (in lamports) for transfer operations. This helps prevent unexpectedly high transaction fees.
Type: number (optional)
Unit: Lamports (1 SOL = 1,000,000,000 lamports)
Example:
const config = {
transferMaxFee: 10000000 // 0.01 SOL in lamports
}Complete Configuration Example
import WalletManagerSolana from '@tetherto/wdk-wallet-solana'
const config = {
// Required for most operations
rpcUrl: 'https://api.mainnet-beta.solana.com',
// Optional: Fee protection
transferMaxFee: 10000000 // 0.01 SOL maximum fee
}
const wallet = new WalletManagerSolana(seedPhrase, config)Network Endpoints
Mainnet
- RPC:
https://api.mainnet-beta.solana.com - WebSocket:
wss://api.mainnet-beta.solana.com/
Devnet
- RPC:
https://api.devnet.solana.com - WebSocket:
wss://api.devnet.solana.com/
Testnet
- RPC:
https://api.testnet.solana.com - WebSocket:
wss://api.testnet.solana.com/
Derivation Paths
Solana wallets use BIP-44 standard derivation paths. The default derivation path follows ecosystem conventions:
- Default path:
m/44'/501'/{index}'/0'(where{index}is the account index)
Default Derivation Path Change in v1.0.0-beta.4+
The default derivation path was updated in v1.0.0-beta.4 to match ecosystem conventions:
- Before (<= v1.0.0-beta.3):
m/44'/501'/0'/0/{index} - After (v1.0.0-beta.4+):
m/44'/501'/{index}'/0'
If you're upgrading from an earlier version, existing wallets created with the old path will generate different addresses. Make sure to migrate any existing wallets or use the old path explicitly if needed for compatibility.
Use getAccountByPath to supply an explicit derivation path when importing or recreating legacy wallets.
Security Considerations
- Always use HTTPS URLs for RPC endpoints
- Set appropriate
transferMaxFeelimits for your use case - Consider using environment variables for configuration in production
- Use trusted RPC providers or run your own Solana validator for production applications
Node.js Quickstart
Get started with WDK in a Node.js environment
React Native Quickstart
Build mobile wallets with React Native Expo
WDK Solana Wallet Usage
Get started with WDK's Solana Wallet Usage
WDK Solana Wallet API
Get started with WDK's Solana Wallet API