Skip to content

Java binding for native EVER-SDK library of Everscale blockchain network. Built around Foreign Memory Access (Project Panama). Also suitable for any Everscale forks like GOSH or Venom.

License

Notifications You must be signed in to change notification settings

deplant/java4ever-binding

Repository files navigation

EVER-SDK for Java

JDK version SDK version License

  • Discuss in Telegram: Channel on Telegram
  • Read full docs: javadoc

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.

Goals

  • 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

Quick start

Prerequisites

  • Install JDK 21 (link)

Add java4ever to your Maven of Gradle setup:

  • Gradle
dependencies {
    implementation 'tech.deplant.java4ever:java4ever-binding:3.0.0'
}
  • Maven
<dependency>
    <groupId>tech.deplant.java4ever</groupId>
    <artifactId>java4ever-binding</artifactId>
    <version>3.0.0</version>
</dependency>

Creating EVER-SDK Context

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 variable
  • AbsolutePathLoader.ofUserDir("libton_client.so") - file from ~ (user home)
  • new AbsolutePathLoader(Path.of("\home\ton\lib\libton_client.so")) - any absolute path
  • new JavaLibraryPathLoader("ton_client"); - gets library from java.library.path JVM argument

Calling EVER-SDK methods

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);

Notes

Custom EVER-SDK libs

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)

Logging

java4ever-binding uses the JDK Platform Loggging (JEP 264: Platform Logging API and Service), so can be easily bridged to any logging framework.

About

Java binding for native EVER-SDK library of Everscale blockchain network. Built around Foreign Memory Access (Project Panama). Also suitable for any Everscale forks like GOSH or Venom.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published