This is a Java binding project for EVER-SDK library that is compatible with Everscale, Venom, GOSH & TON blockchain networks. Binding calls JSON-RPC interface of EVER-SDK. Native calls are based on modern Foreign Function & Memory API.
This artifact provides full binding functionality, but doesn't include higher level helpers for development, tests or fast prototyping. Try our larger Java4Ever framework that is based on this binding for easier work with TVM blockchains.
- Provide Java binding for EVER-SDK based on modern Java native memory access
- Support any modern versions of EVER-SDK without rebuild of binding itself
- Support custom EVER-SDK binaries
- Install JDK 20 (link)
- Gradle
dependencies {
implementation 'tech.deplant.java4ever:java4ever-binding:2.2.0'
}
- Maven
<dependency>
<groupId>tech.deplant.java4ever</groupId>
<artifactId>java4ever-binding</artifactId>
<version>2.2.0</version>
</dependency>
If you use default EVER-SDK lib (latest EVER-SDK that is included in the distribution), you can create EverSdkContext object as following:
EverSdkContext ctx = EverSdkContext.builder()
.setConfigJson(configJson)
.buildNew();
To use custom one, specify it in buildNew() method:
EverSdkContext ctx = EverSdkContext.builder()
.setConfigJson(configJson)
.buildNew(new AbsolutePathLoader(Path.of("\home\ton\lib\libton_client.so")));
Variants of loading ton_client lib:
AbsolutePathLoader.ofSystemEnv("TON_CLIENT_LIB")
- path from Environment variableAbsolutePathLoader.ofUserDir("libton_client.so")
- file from ~ (user home)new AbsolutePathLoader(Path.of("\home\ton\lib\libton_client.so"))
- any absolute pathnew JavaLibraryPathLoader("ton_client");
- gets library from java.library.path JVM argument
It's very simple, just type ModuleName.methodName (list of modules and methods is here: EVER-SDK API Summary ). Note that method names are converted from snake_case to camelCase. Then pass EverSdkContext object as 1st parameter. That's all.
Client.version(ctx);
EVER-SDK libs are included in the distribution, but if you want to use custom one - build EVER-SDK binary lib "ton_client"(.so/.dll) yourself (or get precompiled one)
java4ever-binding uses the JDK Platform Loggging (JEP 264: Platform Logging API and Service), so can be easily bridged to any logging framework.