New Features
-
Added
trx.raw— chain reads without int64 precision lossAdded a
tronWeb.trx.rawnamespace that mirrors the chain-reading methods oftrx(getBalance,getAccount,getBlock,getTransaction,getTransactionInfo,getAccountResources, token / proposal / exchange queries, ...) but issues them as GET requests withint64_as_string=true(java-tron#6699). The node then serializes int64 / uint64 fields as JSON strings, so values above 2^53 - 1 (Number.MAX_SAFE_INTEGER) reach JavaScript without precision loss. Return types reflect this at compile time: int64 fields are typed (and arrive) as strings, via the newTypes.Int64AsString/Types.Precise64mapped types.getCurrentBlock/getConfirmedCurrentBlockare rerouted in raw mode to the flag-honoringwallet/getblock?detail=true/walletsolidity/getblock?detail=true(getnowblockignores the flag).- Reads that cannot take the flag keep returning numbers in both modes:
getNodeInfo,listNodes,getBandwidthPrices,getEnergyPrices,getDelegatedResourceAccountIndexV2,getBrokerage/getUnconfirmedBrokerage, the deprecatedgetTransactionsToAddress/getTransactionsFromAddress/getTransactionsRelated,getSignWeight/getApprovedList, andgetCurrentRefBlockParams(feeds local transaction building and must stay on the number path). - Requirements and caveats: the connected node must run a java-tron build that includes #6699 — older nodes ignore the flag and keep returning (possibly precision-lossy) numbers. Responses read via
trx.rawmust not be fed back into transaction-consuming endpoints (sendRawTransaction,getSignWeight, ...): the node rejects string-encoded int64 fields in request bodies. - The plugin system cannot override the
rawsub-module.
Improvements
-
multiSignverifies the transaction returned bygetSignWeightWhen
multiSignis called with apermissionIdon a transaction that does not carry one yet, it refreshes the transaction throughgetSignWeightand previously adopted the fullNode's response unchecked. It now verifies that the returned transaction matches the one submitted (including the injectedPermission_id) before signing, and throwsInvalid transaction providedotherwise — a compromised or malicious fullNode can no longer substitute a different transaction for signing. -
Corrected
Types.Proposalto match the node's JSON wire formatProposal.stateis now typed as the enum-name string the node actually returns ('PENDING' | 'DISAPPROVED' | 'APPROVED' | 'CANCELED') instead of a numeric enum, andProposal.parametersas the{ key, value }[]array the node serializes instead of a key/value map. Runtime values are unchanged — the previous declarations did not match whatgetProposal/listProposalsreturn; code type-checked against the old numericstate(e.g.state === 2) now fails to compile and should compare against the string form.
Changes
- Migrated the test stack from mocha / karma / chai / nyc to Vitest 4 (node suite plus a headless-Playwright browser suite). Vitest runs the TypeScript test sources directly and provisions test accounts in its
globalSetup, so thebuild:test/newaccountnpm scripts are gone;test,test:watch,coverageandtest:browserare the remaining test scripts.