Usage
Installation, quick start, and usage examples for @tetherto/wdk-wallet-tron
Installation
To install the @tetherto/wdk-wallet-tron package, follow these instructions:
npm install @tetherto/wdk-wallet-tronQuick Start
Importing from @tetherto/wdk-wallet-tron
@tetherto/wdk-wallet-tronWalletManagerTron: This is the main class for managing wallets.
WalletAccountTron: Use this for full access accounts.
WalletAccountReadOnlyTron: Use this for read-only accounts.
Creating a New Wallet
import WalletManagerTron, { WalletAccountTron, WalletAccountReadOnlyTron } from '@tetherto/wdk-wallet-tron'
// Use a BIP-39 seed phrase (replace with your own secure phrase)
const seedPhrase = 'your twelve word seed phrase here' // Replace with actual seed generation
// Create wallet manager with Tron RPC provider
const wallet = new WalletManagerTron(seedPhrase, {
provider: 'https://api.trongrid.io' // or any other Tron RPC provider
})
// Get a full access account
const account = await wallet.getAccount(0)
// Convert to a read-only account
const readOnlyAccount = await account.toReadOnlyAccount()Managing Multiple Accounts
Checking Balances
Owned Account
For accounts where you have the seed phrase and full access:
Read-Only Account
For addresses where you don't have the seed phrase:
Sending Transactions
Send TRX and estimate fees using WalletAccountTron. Ensure connection to TronWeb.
Token Transfers
Transfer TRC20 tokens and estimate fees using WalletAccountTron. Ensure connection to TronWeb.
Message Signing and Verification
Sign and verify messages using WalletAccountTron. Ensure connection to TronWeb.
Fee Management
Retrieve current fee rates using WalletManagerTron. Ensure connection to TronWeb.
Memory Management
Clear sensitive data from memory using dispose methods in WalletAccountTron and WalletManagerTron.

