Configuration
Configuration options and settings for @tetherto/wdk-wallet-tron
Wallet Configuration
import WalletManagerTron from '@tetherto/wdk-wallet-tron'
const config = {
provider: [
'https://api.trongrid.io',
'https://secondary-tron-rpc.example'
], // Tron RPC endpoints; array enables failover
retries: 3, // Additional failover attempts when provider is an array
transferMaxFee: 10000000n // Maximum transfer fee in sun (optional)
}
const wallet = new WalletManagerTron(seedPhrase, config)Account Configuration
import { WalletAccountTron } from '@tetherto/wdk-wallet-tron'
const accountConfig = {
provider: 'https://api.trongrid.io',
transferMaxFee: 10000000n // Maximum transfer fee in sun (optional)
}
const account = new WalletAccountTron(seedPhrase, "0'/0/0", accountConfig)Configuration Options
Provider
The provider option specifies how the wallet connects to Tron. It accepts a Tron RPC endpoint URL, a TronWeb instance, or an ordered list of URLs and TronWeb instances for automatic failover.
Type: string | TronWeb | Array<string | TronWeb>
Examples:
// Single RPC endpoint
const config = {
provider: 'https://api.trongrid.io'
}
// TronWeb instance
const config = {
provider: tronWeb
}
// Ordered failover list
const config = {
provider: [
'https://api.trongrid.io',
'https://secondary-tron-rpc.example'
],
retries: 3
}When provider is an array, connection errors fail over to the next provider in the list. Empty arrays throw during provider initialization. Use endpoints that serve the same Tron network.
If the array contains TronWeb instances, the first instance becomes the wallet's primary client. Additional instances contribute their fullNode, solidityNode, and eventServer connections to the failover pool.
Retries
The retries option controls how many additional failover attempts can happen after the initial provider call fails. It only applies when provider is an array.
Type: number (optional)
Default: 3
Example:
const config = {
provider: [
'https://api.trongrid.io',
'https://secondary-tron-rpc.example'
],
retries: 1
}Transfer Max Fee
The transferMaxFee option sets the maximum fee amount (in sun) for TRC20 transfer() operations. This helps prevent transfers from being sent with unexpectedly high fees.
Type: number | bigint (optional)
Unit: Sun (1 TRX = 1,000,000 Sun)
Example:
const config = {
transferMaxFee: 10000000n // 10 TRX in sun
}Node.js Quickstart
Get started with WDK in a Node.js environment
React Native Quickstart
Build mobile wallets with React Native Expo
WDK Tron Wallet Usage
Get started with WDK's Tron Wallet Usage
WDK Tron Wallet API
Get started with WDK's Tron Wallet API