tviem
A lightweight, modular TypeScript SDK for TRON with ABI-driven type inference.
Prerequisites
tviem is a TypeScript SDK for building applications that interact with the TRON network. It supports querying on-chain data, calling smart contracts, and building, signing, and broadcasting transactions.
Key features include:
- Lightweight, modular design: Supports selective imports and tree shaking, allowing compatible bundlers to remove unused code and reduce unnecessary bundle size.
- Type inference: Infers function names, argument types, and return types from statically declared contract ABIs, checking calls for type errors at compile time.
- Composable clients: Uses a Client, Transport, and Action structure similar to viem, with a Public Client for read-only queries and a Wallet Client for transaction operations.
- Flexible transaction workflows: Supports building, signing, and broadcasting a transaction, or building an unsigned transaction for an external signing workflow.
TronWeb primarily uses a single instance to configure the node connection and exposes queries, transaction building, signing, and broadcasting through that instance. tviem separates network configuration, request transport, and the signing account into Chain, Transport, and Account, with a Public Client for read-only queries and a Wallet Client for transaction operations.
tviem cannot replace TronWeb without changes to the calling code. Migration requires adjustments to client configuration, API calls, and data types, such as passing named parameters in an object and using bigint for balances and SUN-denominated amounts. For API mappings and migration considerations, see Migrating from TronWeb.
For installation, environment requirements, API references, and usage examples, refer to the official tviem resources:
- Documentation: https://walletadapter.org/tviem/
- Quick Start: https://walletadapter.org/tviem/docs/getting-started
- GitHub Repository: https://github.com/tronweb3/tviem
- npm Package: https://www.npmjs.com/package/@tronweb3/tviem
- Get Support: https://github.com/tronweb3/tviem/issues
Updated about 2 hours ago