radianceteam / everscale-client-java Goto Github PK
View Code? Open in Web Editor NEWJava library for TON-SDK Client
License: Apache License 2.0
Java library for TON-SDK Client
License: Apache License 2.0
version : 1.44.2
`2024-04-24 19:15:13.124 INFO 48914 --- [ main] com.radiance.tonclient.TONContext : => 1 net.query_collection {"collection":"blocks","result":"id workchain_id shard seq_no","order":[{"path":"seq_no","direction":"DESC"}],"limit":1}
2024-04-24 19:15:14.670 INFO 48914 --- [ Thread-10] com.radiance.tonclient.TONContext : <= 1 {"result":[{"id":"8712979ca122a06d77474b1256d4b9bf104ac9590c2182cd7ca06dfdd1a53f9b","workchain_id":0,"shard":"7000000000000000","seq_no":7039626}]} type=0 finished=true
2024-04-24 19:15:14.677 INFO 48914 --- [ main] com.radiance.tonclient.TONContext : => 2 net.query_collection {"collection":"blocks","result":"id workchain_id shard seq_no","order":[{"path":"seq_no","direction":1}],"limit":1}
2024-04-24 19:15:14.678 INFO 48914 --- [ Thread-11] com.radiance.tonclient.TONContext : <= 2 {"code":23,"message":"Invalid parameters: expected value at line 1 column 102\nparams: {"collection":"blocks","result":"id workchain_id shard seq_no","order":[{"path":"seq_no","direction":1}],"limit":1}","data":{"core_version":"1.44.2"}} type=1 finished=true`
when call this code
Object[] completableFuture1 = net.queryCollection( "blocks", null, "id workchain_id shard seq_no", new Net.OrderBy[]{new Net.OrderBy("seq_no", Net.SortDirection.DESC)}, 1).get();
OrderBy class to json should be
"order":[{"path":"seq_no","direction":"DESC"}]
not
"order":[{"path":"seq_no","direction":1}],
Please fix artifactId in README.md. Now it points to ton-client-binding, which is wrong:
...
<dependency>
<groupId>com.radiance.tonclient</groupId>
<artifactId>ton-client-binding</artifactId>
<version>1.17.0</version>
</dependency>
...
on ubuntu20.04 compile command:
sudo apt-get install default-jdk
sudo apt-get install maven
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
git clone https://github.com/radianceteam/ton-client-java.git
cd ton-client-java/
apt update
apt install cmake make
apt install nodejs
apt install openssl
apt install pkg-config
apt install openssl-devel
apt install libssl-dev
./build.sh
E:\Coins\TON\ton-client-java\jni>cargo build --release
Updating crates.io index
Updating git repository https://github.com/tonlabs/bip39-rs.git
Updating git repository https://github.com/tonlabs/lockfree.git
Updating git repository https://github.com/tonlabs/sodalite.git
Updating git submodule https://github.com/jmesmon/rust-ci-helper
error: failed to select a version for the requirement hmac = "^0.4"
candidate versions found which didn't match: 0.11.0, 0.10.1, 0.10.0, ...
location searched: crates.io index
required by package hmac-drbg v0.1.0
... which is depended on by libsecp256k1 v0.2.2
... which is depended on by ton_client v1.6.2 (E:\Coins\TON\ton-client-java\target\TON-SDK\ton_client)
... which is depended on by ton-client-jni v1.23.0 (E:\Coins\TON\ton-client-java\jni)
how to solve this problem?
Hello!
Did you achieve any working examples of this lib usage?
It works in unpackaged build runs or in tests, but it can't be used in executable JAR or WAR package (made via Spring Boot, for example).
The error looks like this:
28-Jun-2021 04:51:42.170 INFO [https-jsse-nio-8443-exec-6] com.radiance.tonclient.TONContext.requestCallback => 1 net.query_collection {"collection":"accounts","filter":{"id":{"in":["0:f4611223eabcfc4dcdcfbe504da6a6c539405a509cfa552f84e783c56e4b2b9b","0:4989360a2b2a9443864f2e0f1ae49283ef67726161047942227aa6d0f1b1805c","0:035e31e05c6c1582c93d8c0e33c09ccb6b75aa160f10b641e7801b3dee8b0505","0:d80011d1ec9559392113a99319982935a37fa5b7cccae7218751232551ea6896"] },"acc_type":{"eq":1}},"result":"id boc"}
thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: JavaException', src/lib.rs:82:73
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Exception in thread "Thread-6" java.lang.NoClassDefFoundError: com/radiance/tonclient/TONContext
Caused by: java.lang.ClassNotFoundException: com.radiance.tonclient.TONContext
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:636)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:182)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519)
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: "PoisonError { inner: .. }"', src/lib.rs:36:40
fatal runtime error: failed to initiate panic, error 5
Variants I've tried:
Lib successfully creates context (because answer is synchronous) and falls when it comes to async callback handling here:
https://github.com/radianceteam/ton-client-java/blob/main/jni/src/lib.rs#L82
Reasons for this are explained here I think:
https://developer.android.com/training/articles/perf-jni.html#faq_FindClass
(You can get into trouble if you create a thread yourself (perhaps by calling pthread_create and then attaching it with AttachCurrentThread). Now there are no stack frames from your application. If you call FindClass from this thread, the JavaVM will start in the "system" class loader instead of the one associated with your application, so attempts to find app-specific classes will fail.)
Can you fix this, please? I have not enough experience with Rust to make correct changes and do a PR with fix.
In current state, lib is hardly usable to any server or mobile apps development.
v1.19.0 reports an error in the centos7 environment.
v1.14.0 is normal in centos7.
May I ask what's going on?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.