Skip to content

Commit 39d45f2

Browse files
committed
java maven example for ton-sdk-toncenter
Signed-off-by: andreypfau <[email protected]>
1 parent e890db7 commit 39d45f2

File tree

3 files changed

+133
-0
lines changed

3 files changed

+133
-0
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
*.class
2+
*.log
3+
*.ctxt
4+
.mtj.tmp/
5+
*.jar
6+
*.war
7+
*.nar
8+
*.ear
9+
*.zip
10+
*.tar.gz
11+
*.rar
12+
hs_err_pid*
13+
replay_pid*
14+
target/
15+
pom.xml.tag
16+
pom.xml.releaseBackup
17+
pom.xml.versionsBackup
18+
pom.xml.next
19+
release.properties
20+
dependency-reduced-pom.xml
21+
buildNumber.properties
22+
.mvn/timing.properties
23+
.mvn/wrapper/maven-wrapper.jar
24+
.project
25+
.classpath
26+
.idea/**/workspace.xml
27+
.idea/**/tasks.xml
28+
.idea/**/usage.statistics.xml
29+
.idea/**/dictionaries
30+
.idea/**/shelf
31+
.idea/**/aws.xml
32+
.idea/**/contentModel.xml
33+
.idea/**/dataSources/
34+
.idea/**/dataSources.ids
35+
.idea/**/dataSources.local.xml
36+
.idea/**/sqlDataSources.xml
37+
.idea/**/dynamic.xml
38+
.idea/**/uiDesigner.xml
39+
.idea/**/dbnavigator.xml
40+
.idea/**/gradle.xml
41+
.idea/**/libraries
42+
cmake-build-*/
43+
.idea/**/mongoSettings.xml
44+
*.iws
45+
out/
46+
.idea_modules/
47+
atlassian-ide-plugin.xml
48+
.idea/replstate.xml
49+
.idea/sonarlint/
50+
com_crashlytics_export_strings.xml
51+
crashlytics.properties
52+
crashlytics-build.properties
53+
fabric.properties
54+
.idea/httpRequests
55+
.idea/caches/build_file_checksums.ser
56+
.DS_Store
57+
.AppleDouble
58+
.LSOverride
59+
Icon
60+
._*
61+
.DocumentRevisions-V100
62+
.fseventsd
63+
.Spotlight-V100
64+
.TemporaryItems
65+
.Trashes
66+
.VolumeIcon.icns
67+
.com.apple.timemachine.donotpresent
68+
.AppleDB
69+
.AppleDesktop
70+
Network Trash Folder
71+
Temporary Items
72+
.apdisk
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="http://maven.apache.org/POM/4.0.0"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>org.ton.sdk.example</groupId>
8+
<artifactId>java-maven-project</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
11+
<properties>
12+
<maven.compiler.source>11</maven.compiler.source>
13+
<maven.compiler.target>11</maven.compiler.target>
14+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15+
</properties>
16+
17+
<dependencies>
18+
<dependency>
19+
<groupId>org.ton.kotlin</groupId>
20+
<artifactId>ton-kotlin-toncenter-jvm</artifactId>
21+
<version>0.5.1-SNAPSHOT</version>
22+
</dependency>
23+
<dependency>
24+
<groupId>io.ktor</groupId>
25+
<artifactId>ktor-client-java-jvm</artifactId>
26+
<version>3.3.1</version>
27+
</dependency>
28+
</dependencies>
29+
30+
</project>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package org.ton.sdk.example;
2+
3+
import org.ton.sdk.blockchain.address.AddressStd;
4+
import org.ton.sdk.blockchain.currency.Coins;
5+
import org.ton.sdk.toncenter.TonCenterV3Client;
6+
import org.ton.sdk.toncenter.model.TonCenterTransaction;
7+
import org.ton.sdk.toncenter.model.TonCenterTransactionsRequestBuilder;
8+
import org.ton.sdk.toncenter.model.TonCenterTransactionsResponse;
9+
10+
import java.math.BigInteger;
11+
import java.util.concurrent.ExecutionException;
12+
13+
public class GetTransactionExample {
14+
public static void main(String[] args) throws ExecutionException, InterruptedException {
15+
TonCenterV3Client client = TonCenterV3Client.create();
16+
TonCenterTransactionsResponse response = client.transactionsAsync(
17+
new TonCenterTransactionsRequestBuilder()
18+
.address(AddressStd.parse("UQAKtVj024T9MfYaJzU1xnDAkf_GGbHNu-V2mgvyjTuP6uYH"))
19+
.limit(15)
20+
).get();
21+
for (TonCenterTransaction transaction : response.getTransactions()) {
22+
Coins balance = transaction.getAccountStateAfter().getBalance();
23+
24+
BigInteger value = BigInteger.ZERO;
25+
if (balance != null) {
26+
value = balance.getValue();
27+
}
28+
System.out.println("hash="+transaction.getHash()+" lt="+transaction.getLt()+" balance="+value);
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)