Improvements
-
Stricter validation of transactions returned by the node
triggerSmartContract(and everycontract.method().send()/contract.writecall) andnewTxID(extendExpiration,alterTransaction,addUpdateDatawithouttxLocal) now also check that the transaction returned by the fullNode has the requested contract type and holds exactly one contract. On thenewTxIDpath the block header (ref_block_bytes,ref_block_hash,expiration,timestamp) must also match the submitted values, asmultiSignalready required. Rejections keep the existing errors (Invalid transaction,Error generating a new transaction id.).utils.transaction.txCheckWithArgsgains an optional fourthexpectedTypeargument. Its three-argument form behaves as before, except that a transaction whoseraw_data.contractdoes not hold exactly one entry now returnsfalse: previously a missing or empty contract list threw aTypeError, and contracts beyond the first were ignored. -
contract().at()keeps the requested addressContract.at(address)now keeps the requested address on the instance (normalized to hex as before) and throwsInvalid contract address providedwhen the node's answer describes a different address.trx.getContractnow keys its cache by the hex form for both reads and writes (as does the eviction inclearABI), so a base58 address hits the cache on repeated calls instead of re-fetching. An answer that describes no contract (not deployed yet) is no longer cached, so polling for a freshly deployed contract on the same instance sees it once it lands. -
TriggerSmartContracttransactions cannot carry bothdataandfunction_selector/parameterRebuilding a
TriggerSmartContractwhose value setsdatatogether with a non-emptyfunction_selectororparameternow throwsInvalid TriggerSmartContract: data cannot be combined with function_selector or parameter, which surfaces fromtrx.sign,multiSign,ecRecover,utils.transaction.txCheckandtxCheckWithArgs. Transactions with onlydata, or onlyfunction_selector/parameter, are unaffected, as are empty-string values; transactions built by TronWeb or by the node carrydataalone. -
CreateSmartContractouter fields are taken from the top level onlyWhen rebuilding a
CreateSmartContracttransaction,owner_address,call_token_valueandtoken_idare now always read from the top level of the contract value, and same-named keys insidenew_contractare ignored. Transactions built by TronWeb or by the node are unaffected. -
Typed data rejects struct names that collide with base types
A struct named like an EIP-712 base type (e.g.
bool,uint256) is ambiguous: it was encoded as the base type rather than as the struct.signTypedData,verifyTypedDataandhashTypedDatanow reject such names, including malformed base-type look-alikes such asuint7.
Bug Fixes
-
Contract sends require an explicit broadcast acknowledgement
contract.write,contract.method().send()andcontract().new()now treat a broadcast as successful only when the node answersresult: true. Previously anything without acode(or, on thewritepath, withoutresult: false) counted as sent, so an empty or non-JSON body from a proxy, a{ "Error": ... }exception body from the node, or{ "result": 0 }returned a txID for a transaction that never reached the network. Such answers now throw with the node'smessage,codeorErrortext, orFailed to broadcast transaction. The error shapes are unchanged (Errorwith.erroronsend(), a plain{ error, message }object onnew()), andtrx.sendRawTransactionstill returns the node's answer as is. -
Contract method arguments must match the ABI inputs in number
utils.abi.encodeParamsV2ByABI, and with itcontract.method(...args)and thefuncABIV2/parametersV2options ofcreateSmartContract,triggerSmartContract,triggerConstantContract,triggerConfirmedConstantContractandestimateEnergy, now throwsInvalid arguments provided: expected N arguments, got Mwhen the argument count differs from the function inputs, asencodeFunctionDataalready did. Previously missing trailing arguments were padded with'', so an omittedstringwas silently encoded as""and an omittedboolasfalse, and the call went through; other omitted types already failed with an encoder error. Code that relied on leaving trailingstring/boolarguments out must now pass them explicitly. -
createProposallists parameters in serialization orderjspb serializes the
parametersmap sorted by key as a string (e.g.1000,20,9), while the node hashes the entries in the order the broadcast JSON lists them, so any other input order made the two txIDs differ and the node rejected the signature (SIGERROR).createProposalnow sorts the parameters into the jspb order, and throwsDuplicate proposal parameter key <key>on a repeated key instead of letting jspb collapse the entries into one. -
TypedDataEncoder.getPayloadnow exports message addresses as lowercase41-prefixed hex, likedomain.verifyingContract, instead of lowercasing base58 addresses into invalid strings. -
contract_addressmoved fromTypes.SignedTransactiontoTypes.CreateSmartContractTransaction, the only transaction that carries it. TypeScript code reading it from a generic signed transaction may need a narrower type.
Performance
-
dist/TronWeb.jsgoes from 941,066 bytes in 6.5.1 to 791,622 bytes (232,073 to 185,405 bytes gzipped), from the changes below. -
The browser bundle ships a single copy of
@noble/curvesand@noble/hashesethers pins older versions of both, so
dist/TronWeb.jsused to include two copies. They are now deduplicated, with a major-version check that fails the build if the two ever diverge. This alone saves about 30 KB (about 10.6 KB gzipped); the Node build is unchanged. Signing, recovery, message and typed-data signatures and BIP39 / BIP32 derivation produce byte-identical results. -
Only
isURLis imported fromvalidator, and onlysatisfiesfromsemver(intronweb.tsandplugin.ts), instead of the whole packages. -
concat,id,getBytes,toUtf8BytesandtoUtf8Stringare now local ports of the ethers v6 helpers, used by typed data,Interfaceand fragments.utils.ethersUtilsstill exports them with the same signatures, results and errors.
Dependencies and Environment
- Node.js
^22.23.4 || ^24.22.1 || >=26.12.1is now declared inengines. Node.js 20 is end-of-life and receives no fix for the October 2026 security releases, which include a Brotli decoder out-of-bounds write reachable through axios response decompression. axiosbumped to 1.20.0; its dependencyfollow-redirectsresolves to 1.16.2.- Dev dependencies:
ts-loader9.6.2 (its dependency chain moves topicomatch4, droppingmicromatchand related packages),vitest/@vitest/*4.1.12,vite8.3.5,fast-uri3.1.9, and refreshed transitive packages (brace-expansion,source-map-js, ...) to clearnpm auditfindings. TronWeb.versionreports6.5.2.