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
  wsUrl: 'wss://api.mainnet-beta.solana.com/', // Optional: WebSocket endpoint
  transferMaxFee: 10000000 // Optional: Maximum fee in lamports
}

const wallet = new WalletManagerSolana(seedPhrase, config)

Account Configuration

import { WalletAccountSolana } from '@tetherto/wdk-wallet-solana'

const accountConfig = {
  rpcUrl: 'https://api.mainnet-beta.solana.com',
  wsUrl: 'wss://api.mainnet-beta.solana.com/', // Optional
  transferMaxFee: 10000000 // Optional: Maximum fee in lamports
}

const account = new WalletAccountSolana(seedPhrase, "0'/0/0", accountConfig)

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:

wsUrl

The wsUrl option specifies a custom WebSocket endpoint for real-time subscriptions and confirmations.

Type: string (optional)

Default: If not provided, the WebSocket URL will be automatically derived from the rpcUrl

Example:

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:

Complete Configuration Example

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)

Security Considerations

  • Always use HTTPS URLs for RPC endpoints

  • Set appropriate transferMaxFee limits 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


Need Help?