tronweb
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSkill is based on TronWeb v6.2.0, generated at 2026-02-25.
TronWeb is the official JavaScript/TypeScript SDK for the TRON network. It wraps the TRON HTTP API and provides a consistent API for accounts, blocks, transactions, smart contracts, and events. Use it in Node.js or the browser to build DApps, sign and broadcast transactions, and call contracts.
本Skill基于TronWeb v6.2.0版本生成,生成时间为2026-02-25。
TronWeb是TRON网络官方的JavaScript/TypeScript SDK。它封装了TRON的HTTP API,为账户、区块、交易、智能合约及事件提供统一的调用接口。你可以在Node.js环境或浏览器中使用它来构建DApp,签名并广播交易,以及调用合约。
Core References
核心参考
| Topic | Description | Reference |
|---|---|---|
| Instance setup | fullHost, nodes, headers, privateKey, setPrivateKey/setAddress | core-instance-setup |
| Address, units, encoding | hex/base58/checksum, toSun/fromSun, fromUtf8/toUtf8, sha3 | core-address-units |
| Trx | Blocks, transactions, accounts, bandwidth, sign, broadcast, getCurrentRefBlockParams, signTypedData, ecRecover | core-trx |
| Utils | ABI, transaction, deserializeTx, accounts, address, validations | core-utils |
| Providers | HttpProvider, request, isConnected, timeout, headers, setStatusPage | core-providers |
| Constants | ADDRESS_PREFIX, SUN/TRX, default feeLimit, BIP44 path | core-constants |
| 主题 | 描述 | 参考文档 |
|---|---|---|
| 实例配置 | fullHost、节点、请求头、私钥、setPrivateKey/setAddress | core-instance-setup |
| 地址、单位与编码 | hex/base58/校验和格式、toSun/fromSun、fromUtf8/toUtf8、sha3 | core-address-units |
| TRX相关操作 | 区块、交易、账户、带宽、签名、广播、getCurrentRefBlockParams、signTypedData、ecRecover | core-trx |
| 工具函数 | ABI、交易、deserializeTx、账户、地址、验证 | core-utils |
| 提供者 | HttpProvider、请求、isConnected、超时设置、请求头、setStatusPage | core-providers |
| 常量定义 | ADDRESS_PREFIX、SUN/TRX、默认feeLimit、BIP44路径 | core-constants |
Features
功能特性
Transactions and contracts
交易与合约
| Topic | Description | Reference |
|---|---|---|
| TransactionBuilder | sendTrx, sendToken, freeze/unfreeze, triggerSmartContract, createSmartContract, deployConstantContract | features-transaction-builder |
| Contract | contract(abi, address), methods.call/send, decodeInput, new(), at() | features-contract |
| Events | getEventsByContractAddress, getEventsByTransactionID, getEventsByBlockNumber, setServer | features-events |
| Plugin | register(PluginClass), pluginInterface (requires, components, fullClass) | features-plugin |
| Message and typed data | signMessage/verifyMessage, signTypedData/verifyTypedData, EIP-712 TypedDataEncoder | features-message-typed-data |
| Connection and version | isConnected(), fullnodeSatisfies(version), getFullnodeVersion() | features-connection-version |
| Trx tokens and chain | getTokenFromID, getTokensIssuedByAddress, getAccountResources, getChainParameters | features-trx-tokens-resources |
| 主题 | 描述 | 参考文档 |
|---|---|---|
| 交易构建器 | sendTrx、sendToken、冻结/解冻、triggerSmartContract、创建智能合约、部署常量合约 | features-transaction-builder |
| 合约操作 | contract(abi, address)、methods.call/send、decodeInput、new()、at() | features-contract |
| 事件查询 | getEventsByContractAddress、getEventsByTransactionID、getEventsByBlockNumber、setServer | features-events |
| 插件系统 | register(PluginClass)、pluginInterface(requires、components、fullClass) | features-plugin |
| 消息与结构化数据 | signMessage/verifyMessage、signTypedData/verifyTypedData、EIP-712 TypedDataEncoder | features-message-typed-data |
| 连接与版本 | isConnected()、fullnodeSatisfies(version)、getFullnodeVersion() | features-connection-version |
| TRX代币与链资源 | getTokenFromID、getTokensIssuedByAddress、getAccountResources、getChainParameters | features-trx-tokens-resources |
Best practices
最佳实践
| Topic | Description | Reference |
|---|---|---|
| Errors and typing | Error instances (e.message), ABI as const for contract inference | best-practices-errors-typing |
| Param validation | Validator, notValid(params), param types (address, integer, resource, url, hex, etc.) | best-practices-param-validation |
| Multi-signature | getSignWeight, getApprovedList, multiSign, permissionId | best-practices-multisig |
| Transaction lifecycle | Sign → broadcast → getTransactionInfo, handling receipt and FAILED | best-practices-transaction-lifecycle |
| 主题 | 描述 | 参考文档 |
|---|---|---|
| 错误处理与类型 | 错误实例(e.message)、使用const定义ABI以实现合约类型推断 | best-practices-errors-typing |
| 参数验证 | 验证器、notValid(params)、参数类型(地址、整数、资源、URL、十六进制等) | best-practices-param-validation |
| 多签操作 | getSignWeight、getApprovedList、multiSign、permissionId | best-practices-multisig |
| 交易生命周期 | 签名 → 广播 → 获取交易信息、处理回执与失败情况 | best-practices-transaction-lifecycle |