RadixMnemonicWallet
TheRadixMnemonicWallet class provides a secure, 24-word BIP-39 mnemonic-based wallet implementation with Ed25519 cryptography, designed for AI agent use cases.
Constructor
WalletConfig
Static Factory Methods
generateRandom(config: WalletConfig): RadixMnemonicWallet
Generate a new wallet with a random 24-word mnemonic.- Generates 256-bit (24-word) mnemonic
- Auto-funds on Stokenet (async, non-blocking)
- Immediate availability with sync address derivation
generateRandomAsync(config: WalletConfig): Promise<RadixMnemonicWallet>
Generate a new wallet with proper async address derivation.fromMnemonic(mnemonic: string, config: WalletConfig, passphrase?: string): RadixMnemonicWallet
Create wallet from existing mnemonic.fromMnemonicAsync(mnemonic: string, config: WalletConfig, passphrase?: string): Promise<RadixMnemonicWallet>
Create wallet from existing mnemonic with proper async initialization.Core Wallet Methods
getAddress(): string
Get the current account’s Radix address.getPublicKey(): string
Get the current account’s public key as hex string.getPrivateKeyHex(): string
Get the current account’s private key as hex string.getMnemonic(): string
Get the wallet’s mnemonic phrase.Signing Methods
sign(data: Uint8Array): Promise<string>
Sign arbitrary data with the current account.signTransaction(transactionIntent: any): Promise<any>
Sign a transaction intent (used by RadixTransactionBuilder).signWithAccount(accountIndex: number, data: Uint8Array): Promise<string>
Sign data with a specific account index.Account Management
getCurrentAccount(): DerivedAccount
Get current account details.switchToAccount(accountIndex: number): Promise<DerivedAccount>
Switch to a different account index.deriveAccount(accountIndex: number): Promise<DerivedAccount>
Derive a specific account without switching to it.deriveMultipleAccounts(startIndex?: number, count?: number): Promise<DerivedAccount[]>
Derive multiple accounts at once.getAllAccounts(): DerivedAccount[]
Get all previously derived accounts.Utility Methods
canSignFor(address: string): boolean
Check if wallet can sign for a specific address.getNetworkInfo(): NetworkInfo
Get wallet network configuration.exportPublicInfo(): PublicWalletInfo
Export wallet information for debugging (excludes private keys).waitForProperAddress(): Promise<void>
Wait for proper address derivation to complete.Static Utility Methods
validateMnemonic(mnemonic: string): boolean
Validate a mnemonic phrase.- BIP-39 checksum
- 24-word requirement for Radix compatibility
generateMnemonic(): string
Generate a random 24-word mnemonic.getMnemonicStrength(mnemonic: string): number
Get mnemonic strength in bits.Factory Class: RadixWalletFactory
Convenience factory for common wallet creation patterns.createNew(config: WalletConfig): RadixMnemonicWallet
Create a new random wallet.importFromMnemonic(mnemonic: string, config: WalletConfig, passphrase?: string): RadixMnemonicWallet
Import wallet from mnemonic.fromEnvironment(envVar?: string, config: WalletConfig): RadixMnemonicWallet
Create wallet from environment variable.Usage Examples
Basic Wallet Creation
Import Existing Wallet
Multi-Account Usage
With RadixAgent
Security Best Practices
- Secure Mnemonic Storage: Never log or expose mnemonic phrases
- Environment Variables: Use environment variables for production
- 24-Word Requirement: Always use 24-word mnemonics for Radix compatibility
- Network Separation: Use different wallets for mainnet and testnet
- Account Isolation: Use different account indices for different purposes