--- sidebar_position: 2 description: "Summarizes TronWeb 6.4.0 changes: typed contract.read/write namespaces, encodeFunctionData, updateWitness, Buffer-to-TextEncoder switch, and dependency bumps." keywords: ["release note", "6.4.0", "changelog", "contract.read", "encodefunctiondata", "tronweb"] --- # Release Note ## New Features - **Typed `read` / `write` contract namespaces** Added [`contract.read`](<./API List/contract/read.md>) and [`contract.write`](<./API List/contract/write.md>) namespaces for type-safe, ergonomic access to contract methods. Functions are split by state mutability: `view` / `pure` (constant call) functions are exposed under `contract.read`, while state-changing functions are exposed under `contract.write`. When an ABI is declared `as const`, function names and argument types are checked at compile time. - Call as `contract.read.methodName([arg0, arg1, ...], options)` / `contract.write.methodName([arg0, arg1, ...], options)`. - The **write** `account` option is a **private key**: its derived address owns and signs the transaction, so a write can be issued from a non-default signer — including on an instance with no default key. A value that is not a private key is rejected; treat it as secret. For **reads**, a `from` option sets the caller address (validated); a caller is required — pass `from` or set a default address on the instance. - Validation errors (argument count, signer, call value, account) surface as promise rejections. - ABI functions literally named `read` or `write` remain callable via the legacy flat surface. - Each function is additionally exposed under its full selector, e.g. `contract.read['balanceOf(address)']` / `contract.write['transfer(address,uint256)']`, pinning that exact overload. Namespaces enumerate each method under both its bare name and its selector. - **Added `utils.abi.encodeFunctionData`** Added [`utils.abi.encodeFunctionData(funcABI, args)`](<./API List/utils/encodeFunctionData.md>) to build smart contract calldata (function selector + encoded parameters). Validates argument count and supports TRON-specific handling of `trcToken` (kept in the selector, encoded as `uint256`). - **Added `transactionBuilder.updateWitness`** Added [`transactionBuilder.updateWitness(address, url, options)`](<./API List/transactionBuilder/updateWitness.md>) to create a `WitnessUpdateContract` transaction that updates a witness node URL. Validates the address and the URL format / length (≤ 256). ## Improvements - **Dropped `Buffer` in favor of `TextEncoder` / `TextDecoder`** - Replaced `Buffer`-based encoding in `tronweb`, `utils/crypto`, `utils/abi` and `utils/ethersUtils` with `TextEncoder` / `TextDecoder` for better cross-environment (browser) compatibility. The conversion is byte-for-byte equivalent to the previous behavior. - **`address.fromPrivateKey` accepts `0x`-prefixed private keys** - [`TronWeb.address.fromPrivateKey`](<./API List/utils/address.md>) (and the underlying `utils.crypto.pkToAddress`) now strips a leading `0x` from the private key before deriving the address, so a private key works whether or not it carries the `0x` prefix. ## Changes - Bump `axios` from 1.15.0 to 1.18.0. - Bump dev dependency `nyc` to 18. - Add overrides for `ws` (8.21.0) and `serialize-javascript` (7.0.5) to pin security-patched versions. - `build` now runs the full `build:all` (esm, cjs, dist).