en
Back to the list

AxLabs releases neow3j 3.25.1 with redesigned transaction API and event subscriptions

source-logo  neonewstoday.com 58 m
image

AxLabs released neow3j v3.25.1 on Nov. 23, the latest version of its Java toolkit for Neo development. The release redesigns how apps send and track transactions. It also adds 10 new features, including contract event subscriptions.

Six breaking changes come with this release, and projects on any v3.24.x version will need some migration work.

The AxLabs team released v3.25.0, the feature release, and shipped v3.25.1 on the same day. v3.25.1 only fixes build and publishing tools and the Neo Express configuration bundled with the test tools, so the runtime API is the same in both.

Know when your
coins move

Alerts, real-time prices, and market news — all in one app
qr-code Point your phone camera to install
4.8 based on 40K reviews in the App Store and Google Play

A new transaction lifecycle and event subscriptions

The largest change is the addition of a new class called TransactionSubmission, which is what an app now gets back after sending a transaction (PR #1184).

Previously, sending a transaction and following it took separate calls. Now one object covers the whole lifecycle, showing whether the node accepted or rejected the transaction.

It can wait for the transaction to be included in a block, return the execution log, and report the block height and time. Inclusion alone doesn’t confirm the invocation succeeded, so the object also reports whether the execution halted.

This makes node rejections easier to catch. Apps can check for an error and read it directly from the result.

The release also adds contract event subscriptions through subscribeToEvents() (PR #1187). A Java app can now follow the events a single contract emits as new blocks arrive.

Before, apps had to subscribe to new blocks and filter out a contract’s events themselves. The new method still polls the node for each block, so the node must support the getapplicationlog RPC method.

Breaking changes

Six changes can break code written for v3.24.x. AxLabs lists five of them in its release notes, and the sixth, a removed library, shows up in the build files. Two are the most likely to show up first.

The first is hash formatting. Account, contract, and transaction hashes now print with a 0x prefix when turned into text (PR #1192). JSON and contract manifest formats don’t change. Code that parses or compares hash text will need to handle the prefix.

The second is the send step. Sending a transaction now returns the new TransactionSubmission object instead of the raw node response. The raw response is still available inside it. The tools for tracking a transaction and reading its log moved onto the new object too.

The remaining four:

  • Context-based storage removed. The StorageContext class and the storage methods built on it have been removed from the devpack, after being deprecated in v3.24.1. Neo itself dropped the library helpers for reaching another contract’s storage this way, while keeping the underlying syscalls (PR #1180).
  • Storage maps compare differently. Two StorageMap instances created separately with the same prefix no longer count as equal, because each gets its own storage context (PR #1180).
  • Waits now throw network errors. Network failures during a wait now reach the calling code as a checked IOException, so code that calls these waits must catch or declare it before it will compile (PR #1194).
  • WebSocket library no longer bundled. Projects that relied on Java-WebSocket through neow3j need to add it directly (PR #1107).

Two signing changes can also affect existing code, though AxLabs doesn’t list them as breaking:

  • Signing checks happen earlier. Signing now fails with a clear error when a signer is missing its key or account script. Apps can check with canSign() first. Signers with only an account hash still work for building transactions and estimating fees (PR #1179).
  • Multi-signature fee estimates need more detail. For a shared account known only by its hash, developers now pass the signature threshold and participant count (PR #1181).

Other new features

A new StdLib class wraps Neo’s native StdLib contract (PR #1186). It handles serialization, encoding, and string tasks without a manual contract call.

Several smaller additions remove common conversion steps:

  • Values returned from a contract call can be read straight as a script hash or address (PR #1185).
  • A standard account’s script hash and address can be derived from a public key alone (PR #1182).
  • Token amount conversions have clearer names: toBaseUnits() and fromBaseUnits(). The old conversion methods still work but will be removed in v3.26.0 (PR #1189).

In the compiler, Java’s absolute value, min, max, and sign functions for whole numbers now compile into a single NeoVM instruction, instead of the Java method body being compiled into the contract (PR #1190).

Bug fixes

Many of the fixes address errors that used to be swallowed. Besides network failures, unexpected RPC errors now end a wait instead of being retried. Transaction lookups return nothing for transactions the node doesn’t know, and pass other errors along. Short timeouts are honored, and polling now stops when the timeout runs out (PR #1193).

The full release notes for v3.25.0 and v3.25.1 can be found at the links below:
https://github.com/neow3j/neow3j/releases/tag/3.25.0
https://github.com/neow3j/neow3j/releases/tag/3.25.1

neonewstoday.com