Configuration
Configuration options and settings for @tetherto/wdk-wallet-ton
Wallet Configuration
The WalletManagerTon accepts a configuration object that defines how the wallet interacts with the TON blockchain:
import WalletManagerTon from '@tetherto/wdk-wallet-ton'
const config = {
tonClient: {
url: 'https://toncenter.com/api/v3',
secretKey: 'your-api-key' // Optional
},
transferMaxFee: 1000000000 // Optional: Maximum fee in nanotons (1 TON)
}
const wallet = new WalletManagerTon(seedPhrase, config)Account Configuration
import { WalletAccountTon } from '@tetherto/wdk-wallet-ton'
const accountConfig = {
tonClient: {
url: 'https://toncenter.com/api/v3',
secretKey: 'your-api-key' // Optional
},
transferMaxFee: 1000000000 // Optional: Maximum fee in nanotons
}
const account = new WalletAccountTon(seedPhrase, "0'/0/0", accountConfig)Configuration Options
tonClient
The tonClient option configures the TON Center API client for blockchain interactions.
Type:
interface TonClientConfig {
/**
* TON Center API endpoint URL
*/
url: string;
/**
* Optional API key for TON Center
* Required for higher rate limits
*/
secretKey?: string;
}Examples:
// Basic configuration
const config = {
tonClient: {
url: 'https://toncenter.com/api/v3'
}
}
// With API key for higher rate limits
const config = {
tonClient: {
url: 'https://toncenter.com/api/v3',
secretKey: 'your-api-key'
}
}transferMaxFee
The transferMaxFee option sets the maximum allowed fee (in nanotons) for transfer operations. This helps prevent unexpectedly high transaction fees.
Type: number (nanotons)
Default: No maximum (undefined)
Examples:
const config = {
transferMaxFee: 1000000000 // 1 TON in nanotons
}
// Example with both options
const config = {
tonClient: {
url: 'https://toncenter.com/api/v3',
secretKey: 'your-api-key'
},
transferMaxFee: 1000000000
}Read-Only Account Configuration
For read-only accounts, you only need the TON client configuration:
import { WalletAccountReadOnlyTon } from '@tetherto/wdk-wallet-ton'
const readOnlyConfig = {
tonClient: {
url: 'https://toncenter.com/api/v3',
secretKey: 'your-api-key' // Optional
}
}
const readOnlyAccount = new WalletAccountReadOnlyTon(publicKey, readOnlyConfig)Network Selection
The TON network (mainnet or testnet) is determined by the TON Center API endpoint URL:
- Mainnet:
https://toncenter.com/api/v3 - Testnet:
https://testnet.toncenter.com/api/v3
Derivation Paths
TON wallets use BIP-44 standard derivation paths. The default derivation path follows ecosystem conventions:
- Default path:
m/44'/607'/{index}'(where{index}is the account index)
Default Derivation Path Change in v1.0.0-beta.6+
The default derivation path was updated in v1.0.0-beta.6 to match ecosystem conventions:
- Previous path (<= v1.0.0-beta.5):
m/44'/607'/0'/0/{index} - Current path (v1.0.0-beta.6+):
m/44'/607'/{index}'
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 TON Center API endpoints
- Keep API keys secure and never expose them in client-side code
- Consider using environment variables for API keys
- Set appropriate
transferMaxFeelimits for your use case
Node.js Quickstart
Get started with WDK in a Node.js environment
React Native Quickstart
Build mobile wallets with React Native Expo
WDK TON Wallet Usage
Get started with WDK's TON Wallet Usage
WDK TON Wallet API
Get started with WDK's TON Wallet API