AxLabs releases neow3j 3.25.1 with redesigned transaction API and event subscriptions

A brand new transaction lifecycle and occasion subscriptions
The biggest change is the addition of a brand new class referred to as TransactionSubmission, which is what an app now will get again after sending a transaction (PR #1184).
Beforehand, sending a transaction and following it took separate calls. Now one object covers the entire lifecycle, displaying whether or not the node accepted or rejected the transaction.
It could await the transaction to be included in a block, return the execution log, and report the block peak and time. Inclusion alone doesn’t affirm the invocation succeeded, so the article additionally reviews whether or not the execution halted.
This makes node rejections simpler to catch. Apps can test for an error and browse it immediately from the end result.
The discharge additionally provides contract occasion subscriptions by means of subscribeToEvents() (PR #1187). A Java app can now comply with the occasions a single contract emits as new blocks arrive.
Earlier than, apps needed to subscribe to new blocks and filter out a contract’s occasions themselves. The brand new technique nonetheless polls the node for every block, so the node should help the getapplicationlog RPC technique.
Breaking modifications
Six modifications can break code written for v3.24.x. AxLabs lists 5 of them in its launch notes, and the sixth, a eliminated library, reveals up within the construct information. Two are the most certainly to indicate up first.
The primary is hash formatting. Account, contract, and transaction hashes now print with a 0x prefix when changed into textual content (PR #1192). JSON and contract manifest codecs don’t change. Code that parses or compares hash textual content might want to deal with the prefix.
The second is the ship step. Sending a transaction now returns the brand new TransactionSubmission object as an alternative of the uncooked node response. The uncooked response continues to be accessible inside it. The instruments for monitoring a transaction and studying its log moved onto the brand new object too.
The remaining 4:
-
Context-based storage eliminated. The
StorageContextclass and the storage strategies constructed on it have been faraway from the devpack, after being deprecated in v3.24.1. Neo itself dropped the library helpers for reaching one other contract’s storage this fashion, whereas protecting the underlying syscalls (PR #1180). -
Storage maps evaluate otherwise. Two
StorageMapsituations created individually with the identical prefix now not rely as equal, as a result of every will get its personal storage context (PR #1180). -
Waits now throw community errors. Community failures throughout a wait now attain the calling code as a checked
IOException, so code that calls these waits should catch or declare it earlier than it’s going to compile (PR #1194). - WebSocket library now not bundled. Tasks that relied on Java-WebSocket by means of neow3j want so as to add it immediately (PR #1107).
Two signing modifications can even have an effect on current code, although AxLabs doesn’t record them as breaking:
-
Signing checks occur earlier. Signing now fails with a transparent error when a signer is lacking its key or account script. Apps can test with
canSign()first. Signers with solely an account hash nonetheless work for constructing transactions and estimating charges (PR #1179). - Multi-signature payment estimates want extra element. For a shared account recognized solely by its hash, builders now cross the signature threshold and participant rely (PR #1181).
Different new options
A brand new StdLib class wraps Neo’s native StdLib contract (PR #1186). It handles serialization, encoding, and string duties with no handbook contract name.
A number of smaller additions take away widespread conversion steps:
- Values returned from a contract name may be learn straight as a script hash or tackle (PR #1185).
- A typical account’s script hash and tackle may be derived from a public key alone (PR #1182).
- Token quantity conversions have clearer names:
toBaseUnits()andfromBaseUnits(). The outdated conversion strategies nonetheless work however might be eliminated in v3.26.0 (PR #1189).
Within the compiler, Java’s absolute worth, min, max, and signal capabilities for complete numbers now compile right into a single NeoVM instruction, as an alternative of the Java technique physique being compiled into the contract (PR #1190).
Bug fixes
Most of the fixes tackle errors that was once swallowed. Apart from community failures, surprising RPC errors now finish a wait as an alternative of being retried. Transaction lookups return nothing for transactions the node doesn’t know, and cross different errors alongside. Quick timeouts are honored, and polling now stops when the timeout runs out (PR #1193).
The complete launch notes for v3.25.0 and v3.25.1 may be discovered on the hyperlinks under:
https://github.com/neow3j/neow3j/releases/tag/3.25.0
https://github.com/neow3j/neow3j/releases/tag/3.25.1





