Skip to content

Commit

Permalink
separate fift and func runners and put to new modules
Browse files Browse the repository at this point in the history
  • Loading branch information
neodix42 committed Sep 12, 2024
1 parent 8db3636 commit 7bef8f0
Show file tree
Hide file tree
Showing 30 changed files with 434 additions and 46 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ found [here](https://github.com/ton-blockchain/ton/actions).
## Maven [![Maven Central][maven-central-svg]][maven-central]

```xml

<dependency>
<groupId>io.github.neodix42</groupId>
<artifactId>smartcontract</artifactId>
Expand All @@ -22,7 +21,6 @@ found [here](https://github.com/ton-blockchain/ton/actions).
## Jitpack [![JitPack][jitpack-svg]][jitpack]

```xml

<repositories>
<repository>
<id>jitpack.io</id>
Expand All @@ -32,7 +30,6 @@ found [here](https://github.com/ton-blockchain/ton/actions).
```

```xml

<dependency>
<groupId>io.github.neodix42</groupId>
<artifactId>ton4j</artifactId>
Expand All @@ -50,6 +47,8 @@ You can use each submodule individually. Click the module below to get more deta
* [Mnemonic](mnemonic/README.md) - helpful methods for generating deterministic keys for TON blockchain.
* [Emulator](emulator/README.md) - wrapper for using with external precompiled emulator shared library.
* [Liteclient](liteclient/README.md) - wrapper for using with external precompiled lite-client binary.
* [Fift](fift/README.md) - wrapper for using with external precompiled fift binary.
* [Func](func/README.md) - wrapper for using with external precompiled func binary.
* [TonConnect](tonconnect/README.md) - implementation of Ton Connect standard.
* [Utils](utils/README.md) - create private and public keys, convert data, etc.

Expand Down
1 change: 0 additions & 1 deletion address/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
## Maven [![Maven Central][maven-central-svg]][maven-central]

```xml

<dependency>
<groupId>io.github.neodix42</groupId>
<artifactId>address</artifactId>
Expand Down
2 changes: 0 additions & 2 deletions bitstring/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
## Maven [![Maven Central][maven-central-svg]][maven-central]

```xml

<dependency>
<groupId>io.github.neodix42</groupId>
<artifactId>bitstring</artifactId>
Expand All @@ -14,7 +13,6 @@
## Jitpack

```xml

<dependency>
<groupId>io.github.neodix42.ton4j</groupId>
<artifactId>bitstring</artifactId>
Expand Down
1 change: 0 additions & 1 deletion cell/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
## Maven [![Maven Central][maven-central-svg]][maven-central]

```xml

<dependency>
<groupId>io.github.neodix42</groupId>
<artifactId>cell</artifactId>
Expand Down
3 changes: 1 addition & 2 deletions emulator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Java Emulator wrapper uses JNA to access methods in native emulator shared libra
## Maven [![Maven Central][maven-central-svg]][maven-central]

```xml

<dependency>
<groupId>io.github.neodix42</groupId>
<artifactId>emulator</artifactId>
Expand All @@ -23,7 +22,7 @@ Java Emulator wrapper uses JNA to access methods in native emulator shared libra
</dependency>
```

## Simply usage
## Usage

```java
Tonlib tonlib=Tonlib.builder().build(); // we need tonlib to get network config
Expand Down
38 changes: 38 additions & 0 deletions fift/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr

### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/

### Mac OS ###
.DS_Store
47 changes: 47 additions & 0 deletions fift/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Liteclient module

Java Lite-client wrapper uses JNA to access methods in native lite-client binary.

## Maven [![Maven Central][maven-central-svg]][maven-central]

```xml
<dependency>
<groupId>io.github.neodix42</groupId>
<artifactId>fift</artifactId>
<version>0.5.5</version>
</dependency>
```

## Jitpack

```xml
<dependency>
<groupId>io.github.neodix42.ton4j</groupId>
<artifactId>fift</artifactId>
<version>0.5.5</version>
</dependency>
```

## Usage

```java
URL resource = TestFiftRunner.class.getResource("/test.fift");
File fiftFile = Paths.get(resource.toURI()).toFile();
String absolutePath = fiftFile.getAbsolutePath();

FiftRunner fiftRunner = FiftRunner.builder().build();

String result = fiftRunner.run(fiftFile.getParent(), "-s", absolutePath);
log.info("output: {}", result);
```

More examples in [TestFiftRunner](../fift/src/test/java/org/ton/java/fift/TestFiftRunner.java) class.


[maven-central-svg]: https://img.shields.io/maven-central/v/io.github.neodix42/tonlib

[maven-central]: https://mvnrepository.com/artifact/io.github.neodix42/tonlib

[ton-svg]: https://img.shields.io/badge/Based%20on-TON-blue

[ton]: https://ton.org
87 changes: 87 additions & 0 deletions fift/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.github.neodix42</groupId>
<artifactId>top</artifactId>
<version>0.5.5</version>
</parent>

<artifactId>fift</artifactId>
<name>TON Java Fift wrapper</name>

<description>Java wrapper for fift executable.</description>

<url>https://github.com/neodiX42/ton4j</url>

<licenses>
<license>
<name>GNU General Public License v3.0</name>
<url>https://www.gnu.org/licenses/gpl-3.0.html</url>
</license>
</licenses>

<developers>
<developer>
<name>neodiX</name>
<email>[email protected]</email>
</developer>
</developers>

<scm>
<connection>scm:git:git://github.com/neodiX42/ton4j.git</connection>
<developerConnection>scm:git:ssh://github.com/neodiX42/ton4j.git</developerConnection>
<url>https://github.com/neodiX42/ton4j/tree/main</url>
</scm>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>io.github.neodix42</groupId>
<artifactId>utils</artifactId>
<version>${project.parent.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons-io.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.ton.java.smartcontract;
package org.ton.java.fift;

import lombok.extern.java.Log;
import org.apache.commons.io.IOUtils;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.ton.java.smartcontract;
package org.ton.java.fift;

import jdk.nashorn.internal.ir.annotations.Ignore;
import lombok.Builder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package org.ton.java.smartcontract.unittests;
package org.ton.java.fift;

import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.ton.java.smartcontract.FiftRunner;

import java.io.File;
import java.net.URISyntaxException;
Expand All @@ -21,7 +20,7 @@ public class TestFiftRunner {
@Test
public void testFiftRunner() throws URISyntaxException {

URL resource = TestFiftRunner.class.getResource("/fift/test.fift");
URL resource = TestFiftRunner.class.getResource("/test.fift");
File fiftFile = Paths.get(resource.toURI()).toFile();
String absolutePath = fiftFile.getAbsolutePath();

Expand Down
File renamed without changes.
38 changes: 38 additions & 0 deletions func/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr

### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/

### Mac OS ###
.DS_Store
47 changes: 47 additions & 0 deletions func/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Liteclient module

Java Lite-client wrapper uses JNA to access methods in native lite-client binary.

## Maven [![Maven Central][maven-central-svg]][maven-central]

```xml
<dependency>
<groupId>io.github.neodix42</groupId>
<artifactId>func</artifactId>
<version>0.5.5</version>
</dependency>
```

## Jitpack

```xml
<dependency>
<groupId>io.github.neodix42.ton4j</groupId>
<artifactId>func</artifactId>
<version>0.5.5</version>
</dependency>
```

## Usage

```java
URL resource = TestFuncRunner.class.getResource("/test.fc");
File funcFile = Paths.get(resource.toURI()).toFile();
String absolutePath = funcFile.getAbsolutePath();

FuncRunner funcRunner = FuncRunner.builder().build();

String result = funcRunner.run(funcFile.getParent(), "-PA", absolutePath);
log.info("output: {}", result);
```

More examples in [TestFuncRunner](../func/src/test/java/org/ton/java/func/TestFuncRunner.java) class.


[maven-central-svg]: https://img.shields.io/maven-central/v/io.github.neodix42/tonlib

[maven-central]: https://mvnrepository.com/artifact/io.github.neodix42/tonlib

[ton-svg]: https://img.shields.io/badge/Based%20on-TON-blue

[ton]: https://ton.org
Loading

0 comments on commit 7bef8f0

Please sign in to comment.