Neow3j Versions Save

Java/Kotlin/Android Development Toolkit for the Neo Blockchain

3.19.1

1 year ago

Neowww, dear cat devs, neow3j now supports Neo's new Name Service! ๐Ÿ˜ป

This release provides interfaces for the official Name Service contract (NNS) both in the devpack and the SDK. Additionally, we've added transfer methods that allow you to transfer tokens to a NNS resolvable address. That means, you can now send tokens to a NNS name and don't need to remember a script hash. How cool is that! ๐Ÿ˜ธ

Check out the list of what has changed below.

Have a look at the neow3j documentation at neow3j.io, open a Github issue, or contact us on the Neo Discord #java channel for any question you might have about neow3j. ๐Ÿ˜ธ

New Features

devpack

  • Updated NeoNameService to the official Name Service contract. (#885)

SDK

  • Updated NeoNameService to the official Name Service contract. (#885)
  • Added transfer methods for NEP-11 and NEP-17 tokens to transfer to a resolved NNS. (#885)

Fixes

SDK

  • Fixed the ContractParameter.equals(...) method for Hash160 and Hash256 contract parameters (#889)
  • Refactored and improved the JsonRpc2_0Rx class for easier maintainability and improved error reporting to the user. (#881)

3.19.0

1 year ago

Hey my feline friends, neow3j now supports Neo 3.4.0! ๐Ÿ˜ป

In this release neow3j supports the new native method ContractManagement.hasMethod() and updated changes according to Neo 3.4.0. Further, you can now retrieve values from an iterator stack item when sessions are disabled on the connected Neo node.

Check out the list of what has changed below.

Have a look at the neow3j documentation at neow3j.io, open a Github issue, or contact us on the Neo Discord #java channel for any question you might have about neow3j. ๐Ÿ˜ธ

New Features

devpack

  • Added ContractManagement.hasMethod() that has been added in Neo 3.4.0. (#858)

SDK

  • Added the method SmartContract.callFunctionAndUnwrapIterator() to retrieve iterator values through RPCs if the connecting node has sessions disabled. (#852)
  • Added ContractManagement.hasMethod() that has been added in Neo 3.4.0. (#858)

Changes

SDK

  • Updated DTO class GetNep11Balances.Nep11Balances based on changes in Neo 3.4.0. (#858)
  • Updated DTO class GetNep17Balances.Nep17Balances based on changes in Neo 3.4.0. (#858)

General

  • Migrated unit and integration tests from JUnit 4 to JUnit 5, causing some refactoring in the test code base (#822). The migration of integration tests in the gradle-plugin module is still pending.

3.18.1

1 year ago

Hey neow3j friends, time for a new release! ๐Ÿ˜ป This time, a minor one. ๐Ÿˆ

In this release we fixed a bug with different string concatenations compilations and support the new diagnostics in invocation results, which provides information about changed storage values and called contracts. Further, we simplified the creation of Hash160, Hash256, and ECPoint from constant strings, and optimised fee costs when initialising empty arrays.

Check out the complete list of what has changed below.

Have a look at the neow3j documentation at neow3j.io, open a Github issue, or contact us on the Neo Discord #java channel for any question you might have about neow3j. ๐Ÿ˜ธ

New Features

devpack

  • Hash160, Hash256, and ECPoint can now easily be created with a constant string value. (#826)

SDK

  • Invocation results can now hold diagnostics. These provide useful information about the invocation, such as what storage writes/changes/deletions have occurred, and what contracts have been called in what order. (#824)

Fixes

SDK

  • Numeric.hexStringToByteArray() now checks for hexadecimal validity. (#834)

devpack

  • Fixed a bug where neow3j could not handle different JVM compilation outcomes of string concatenations based on unspecifiable Java compiler options when compiled without gradle. (#838)

Changes

SDK

  • Allow uncompressed (hexadecimal) and prefixed public keys in ECPublicKey constructor. (#827)

devpack

  • Optimised the use of the NEWARRAY opcode. Whenever it would follow a PUSH0 opcode, it is now replaced with the cheaper NEWARRAY0 instruction. (#840)

3.18.0

1 year ago

Neowww, big news: I now support Neo v3.3.1 ๐Ÿ˜ป

Neow3j's support of Neo v3.3.1 includes new JSON-RPCs calls, native contract methods, and new opcodes. Furthermore, there's now a more convenient way to make contract calls for custom contract interfaces. Check out the complete list of what has changed below.

Have a look at the neow3j documentation at neow3j.io, open a Github issue, or contact us on the Neo Discord #java channel for any question you might have about neow3j. ๐Ÿ˜ธ

Breaking Changes

๐Ÿšจ IMPORTANT๐Ÿšจ

The following 3 updates are critical breaking changes and you must adapt your Java smart contract written using 3.17.1.

1) Contract Interfaces

#800 / #814: Contract interfaces are no longer intended to be used statically. A contract interface (or an extending type) has to be initialized with its contract hash and hold instance methods. Accordingly, the annotation @ContractHash has been removed.

Previously, in order to make a contract call with a dynamic contract hash (a variable), the method Contract.call() had to be used. With the changes in this release, you can now initialize a contract interface. For example, if you previously wrote code for a NEP-17 transfer with a dynamic contract hash:

(boolean) Contract.call(contractHash, "transfer", CallFlags.All, new Object[]{from, to, amount, data})

you can now rewrite this to the following:

new FungibleToken(contractHash).transfer(from, to, amount, data);

When a custom type extends ContractInterface, its constructor is required to either take its contract hash as a Hash160 or a String (a big-endian script hash) that is passed to super() without any further logic in the constructor. In case a ContractInterface is initialized with a dynamic contract hash, it must only use the constructor with the Hash160 type. If the contract hash is known at compile time, the constructor with the String type can be used.

If you previously created a custom class like the following:

@ContractHash("0x340720c7107ef5721e44ed2ea8e314cce5c130fa")
class MyTokenContract extends FungibleToken {
    public static native String getValue();
}

and used it statically in your contract:

MyTokenContract.getValue();

you should rewrite your custom token interface to:

class MyTokenContract extends FungibleToken {
    MyTokenContract(String contractHash) {
        super(contractHash);
    }
    public native String getValue();
}

and initialize it in your contract with its script hash:

new MyTokenContract("0x340720c7107ef5721e44ed2ea8e314cce5c130fa").getValue();

Finally, native contracts are initialized without parameters, since contract hashes are fixed:

new NeoToken()

2) Iterator

#815: The design of the InteropInterface stack item type has been updated. When an iterator is returned from an RPC invokefunction or invokescript, the iterator now no longer contains the iterator's values, but an iterator id. Together with the new session id in the invocation result, the iterator can now be traversed with the new RPC traverseiterator in order to retrieve all values of the iterator. For this, a new class Iterator is introduced in the contract module for more convenient access to an iterator's values.

3) String Concatenation

#779: Concatenations done with the + operator that results in a String are now enforced to involve only Strings as operands. The concatenation of a String with another type does not necessarily behave in an expected way on the NeoVM. For example:

If an integer should be concatenated with a String, use the method itoa (integer-to-ascii) of the native contract StdLib. For example to get token#42 from a String token# and an integer 42:

"token#" + new StdLib().itoa(42)

Changes

devpack

  • Updated the prices of the interop services CreateStandardAccount and CreateMultisigAccount. (#791)
  • Updated the price of the system call GetNotification. (#792)

New Features

devpack

  • Added a new annotation @CallFlags that can be added to methods in a contract interface. By default, i.e., if this annotation is not present, CallFlags.All is used when a method is called. (#813)
  • Added the new RPC traverseiterator. (#815)
  • Added the new RPC terminatesession. (#815)
  • Added the new method LedgerContract.getTransactionSigners(Hash256). (#786)
  • Support for the new method NeoToken.getAllCandidates(). (#786)
  • Support for the new method NeoToken.getCandidateVote(). (#786)
  • Added new opcode MODMUL. (#786)
  • Added new opcode MODPOW. (#786)

3.17.1

2 years ago

Hey, dev cats! Here comes a new neow3j release. ๐Ÿ˜ป

It's a minor one, we know, but it's made with โค๏ธ.

This new release allows configuring your neow3j instance to allow transmission of a transaction that leads to a fault NeoVM state, which can be useful when using our test framework (e.g., when verifying an event thrown in a faulty transaction).

Have a look at the neow3j documentation at neow3j.io, open a Github issue, or contact us on the Neo Discord #java channel for any question you might have about neow3j. ๐Ÿ˜ธ

New Features

SDK

  • The neow3j object can now be configured, so that you can build a Transaction from a TransactionBuilder that will end up in a FAULT NeoVM state (based on the response of the sent invokescript RPC to retrieve the transaction's system fee). (#769)

devpack

  • The classes Storage and StorageMap now feature the methods getHash160() and getHash256(). They can be used to retrieve the types Hash160 and Hash256 directly without instantiating them manually. (#776)

3.17.0

2 years ago

Hey, dev cats! Here comes a new neowwww3j release. ๐Ÿ˜ป

This release supports new features of the recent Neo release 3.2.1. For example, you can now attach signers with a witness scope WitnessRules. We've also added new native contract methods, support for a new neo-express feature to produce blocks with a defined time in the future, and refactored the use of Java's assert statement (see "Breaking Changes" below).

Last but not least, we fixed some minor bugs. Check out the complete list of what has changed below.

Have a look at the neow3j documentation at neow3j.io, open a Github issue, or contact us on the Neo Discord #java channel for any question you might have about neow3j. ๐Ÿ˜ธ

Breaking Changes

๐Ÿšจ IMPORTANT๐Ÿšจ: In this version, the behavior of Java's assert statement changed when executed in the NeoVM. This is a critical breaking change and you must adapt your Java smart contract written using 3.16.0.

Note: The assert statement now compiles to the ASSERT opcode on the Neo VM.

If your previous contract had the following construct:

assert Runtime.checkWitness(scriptHash) : "No authorization";

you should now rewrite to:

if (Runtime.checkWitness(scriptHash) { 
    throw new Exception("No authorization.");
}

or, if you don't want it to be catchable, you can still use assert, but you can no longer use it with a message:

assert Runtime.checkWitness(scriptHash);

Using assert makes sure that the NeoVM really fails. Not even a calling contract can catch the failure. Throwing an exception is different in that it can be caught by a calling contract, meaning that any actions that happened before the exceptions could be persisted.

New Features

devpack

  • Added support for the new native method CryptoLib.murmur32(). (#758)
  • Added support for the new native method LedgerContract.getTransactionVMState(). (#758)
  • Added support for the ASSERT opcode on the Neo VM. For this, the Java assert statement now compiles into the ASSERT opcode on the Neo VM instead of throwing an exception. Take a look at the explanation above (Breaking Changes) about how to manage it, since this is also a breaking change. (#752)

devpack-test

  • Added support for the new neo-express fast-forward feature. (#749)

SDK

  • Added support for the new witness scope WitnessRules. (#758)

Fixes

devpack

  • Added the missing field source to the DTO class ContractNef. (#755)

compiler

  • Fixed a bug where the compiler failed handling more than 6 branches in a switch statement. (#761)
  • Fixed a bug where an Event with no parameters could not be handled by the compiler. (#762)

3.16.0

2 years ago

Well, dev cats... it's about time for new neow3j features! โฐ ๐Ÿ˜ธ ๐Ÿˆโ€โฌ›

This release brings a lot of new features. Just to name a few: Instance classes can now be extended to inherit variable fields, or Java's instanceOf can now be used for more types, e.g., Hash160, or ECPoint. Further, utility methods have been implemented to easily create contract groups, or to retrieve a transaction as a string to sign and send it using neo-cli.

There's a lot more! Take a look at the complete list of what has changed below.

Check out the neow3j documentation at neow3j.io, open a Github issue, or contact us on the Neo Discord #java channel for any question you might have about neow3j. As usual: don't worry... we won't bite nor scratch. ๐Ÿ˜ป

New Features

devpack

  • Added an annotation @Struct to mark classes that should be used as struct instances holding values in a specific manner on the neo-vm. (#738)
  • Added inheritance support for instance classes. @Struct-annotated classes can now be extended, and hence, its existing variable fields are inherited. (#738)
  • Refactored @SupportedStandard to use nested values. (#716)
  • Added a new enum NeoStandards to set supported NEP standards in the @SupportedStandard annotation in a standard fashion. (#716)
  • Added support for instanceOf for the types Hash160, Hash256, ECPoint, Notification, and arrays, e.g., String[]. (#720)

SDK

  • Added utility methods to create and add contract groups (e.g., ContractManifest.createGroup()). (#721)
  • Added functionality to add an additional system fee to a transaction builder. (#724)
  • Added a method NonFungibleToken.customProperties() that returns a map with stack item values. The token tracker plugin only returns string values, while this new method allows retrieving other types (e.g, arrays) as well. (#729)
  • Added InvocationScript.getSignatures() to get the signatures in an invocation script. (#730)
  • Added the method Transaction.toContractParametersContext() to get a ContractParametersContext instance. This new class is used to produce a JSON object in order for a transaction created in neow3j to be signed in neo-cli. (#730)
  • A witness can now be added to a Transaction directly with an Account instance using Transaction.addWitness(). (#730)
  • A byte value can now be passed as an integer contract parameter. (#739)

Fixes

devpack

  • Fixed a bug where a method call within an event parameter could not be compiled correctly. (#735)

SDK

  • The method Transaction.addMultiSigWitness() did not produce the correct witness if signatures were not provided in the correct order. The method now takes a map of the participating public keys mapped to their signatures and orders these accordingly to create a valid multi-sig witness. (#731)

Changes

SDK

  • Changed return type of NonFungibleToken.properties() to a map of strings instead of NFTokenState. Therefore, the class NFTokenState is redundant and was removed. (#729)

3.15.0

2 years ago

New year - new Neow3j features๐Ÿ˜ป This release brings several convenience and also fee-optimizing features for Smart Contract development. Take a look what changed below!

Check out the neow3j documentation at neow3j.io, open a Github issue, or contact us on the Neo Discord #java channel for any question you might have about neow3j. Don't worry; we won't bite nor scratch. ๐Ÿ˜ธ

New Features

devpack

  • Added a method getIntOrZero to Storage and StorageMap (#702).
  • Empty arrays can now be passed in ContractParameter.array() (#708).
  • Added ByteString constructor from integer value (#709).
  • Added ECPoint.isValid() to verify the instance's correct size (#709).
  • Added the method StorageMap.find() to iterate directly on a StorageMap (#712).
  • Added support for nested Maps and Lists to be cast automatically to the correct ContractParameter in the method ContractParameter.mapToContractParameter() (#713).
  • Added support for direct conversion of ECPublicKey and Sign.SignatureData to the corresponding ContractParameter in the method ContractParameter.mapToContractParameter() (#713).
  • Added a static method ContractParameter.publicKey() that takes a ECPublicKey as a parameter (#713).

Fixes

SDK

  • Fixed a bug that did not sort the keys of a multi-sig in a strict manner before creating the script (#705).

Changes

devpack

  • Renamed getInteger to getInt in the classes Storage and StorageMap for consistency. (#702)
  • Removed size checks in the constructors of the wrapper classes Hash160, Hash256, and ECPoint (#709). You can use the corresponding method isValid() in order to verify the correct size.

3.14.1

2 years ago

The 3.14.0 release was great... but right after releasing we were attracted by some low-hanging catnip. ๐ŸŒณ ๐Ÿˆ ๐Ÿ˜ป

Thus, we used the momentum to apply some small improvements - mainly to the devpack-test - and release again. ๐Ÿš€ ๐Ÿ’ฏ

Changes

  • Added the possibility to tell the test framework with which account a specific contract should be deployed.
  • Improved JavaDocs.
  • Several code improvements.

3.14.0

2 years ago

Hey meta fur balls! Here's a new neow3j release. ๐Ÿ˜ป Check the below list for new features and changes to try out and experiment with ๐Ÿงถ

Check the neow3j documentation
Open Github issues Contact us on the Neo Discord #java channel

New Features

SDK

  • Add an extendScript method on the ScriptBuilder in case you want to pack multiple custom invocations scripts into one transaction (#663). To build such scripts you can use, e.g., the new buildInvokeFunctionScript method in SmartContract.
  • Added support for deserialising contract parameters in neow3j (#678). This was not deemed to be necessary before, but can come in handy in some use cases.
  • RPC methods for the new NEP-11 token tracker plugin (#688).
  • Added methods for EC signature verification (#692). I know, sounds like a must have, but we just never needed it before.

devpack

  • Added support for multi-dimensional arrays, e.g., int[][] (#659)
  • Added new memcpy method to the Helper class (#666). It allows copying data from one buffer or byte string to another.
  • You can now make use of the getMessage method on caught Exceptions if you want to get a hold of the exception message (#669).
  • Added support for using integers as keys in Storage-related methods, e.g., Storage.get(StorageContext ctx, int key)
  • Added two new opcodes related to Structs and Maps (#686). Map contract parameters are now constructed in a more efficient way via the neow3j SDK.

Fixes

SDK

  • Added a deserialiser to ContractParameter to allow for correct deserialisation of contract parameters from JSON (#668).
  • Allow deserialisation of Transaction without witness section (#675).
  • Add pendingsignature attribute to InvocationResult (#677).

Changes

devpack

  • Adapted the devpack-test module to support testing of multiple contracts, deploy parameters for each contract, placeholder string substitution, and fast-forwarding (#665, #671, #681)
  • Neow3j now fails compilation when you try to use methods that your smart contract classes inherit from Object but are not overridden in your classes (#661)
  • Decoupled devpack-test from a direct dependency on neo-express (#684). This will allow the use of other Neo blockchain implementation to run contract tests on.