BAEL-1461 refactored
This commit is contained in:
parent
21bd180c1c
commit
594b6dda12
|
@ -1,4 +1,6 @@
|
|||
## EthereumJ
|
||||
## Ethereum
|
||||
|
||||
### Relevant Articles:
|
||||
- [Introduction to EthereumJ](http://www.baeldung.com/ethereumj)
|
||||
- [Lightweight Web3](http://www.baeldung.com/lightweight-web3/)
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
## Web3j
|
||||
## Ethereum
|
||||
|
||||
### Relevant Articles:
|
||||
- [Introduction to EthereumJ](http://www.baeldung.com/ethereumj)
|
||||
- [Lightweight Web3](http://www.baeldung.com/lightweight-web3/)
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
<?xml version="1.0"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<project
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.baeldung.ethereumj</groupId>
|
||||
<artifactId>ethereumj</artifactId>
|
||||
|
@ -11,9 +13,18 @@
|
|||
<artifactId>parent-boot-5</artifactId>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../parent-boot-5</relativePath>
|
||||
<relativePath>../../parent-boot-5</relativePath>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<tomcat.version>8.5.4</tomcat.version>
|
||||
<ethereumj-core.version>1.5.0-RELEASE</ethereumj-core.version>
|
||||
<web3j.core.version>3.3.1</web3j.core.version>
|
||||
<jackson-databind.version>2.5.0</jackson-databind.version>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>Ethereum</id>
|
||||
|
@ -23,7 +34,6 @@
|
|||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- Spring Boot Dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
@ -33,28 +43,24 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Unit Testing -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Ethereum -->
|
||||
<dependency>
|
||||
<groupId>org.ethereum</groupId>
|
||||
<artifactId>ethereumj-core</artifactId>
|
||||
<version>1.5.0-RELEASE</version>
|
||||
<version>${ethereumj-core.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Web3j -->
|
||||
<dependency>
|
||||
<groupId>org.web3j</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>3.3.1</version>
|
||||
<version>${web3j.core.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- JSTL/JSP -->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
|
@ -63,12 +69,20 @@
|
|||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.5.0</version>
|
||||
<version>${jackson-databind.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
|
@ -77,40 +91,4 @@
|
|||
<finalName>ethereumj</finalName>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>integration</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>test</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>none</exclude>
|
||||
</excludes>
|
||||
<includes>
|
||||
<include>*/EthControllerTestOne.java</include>
|
||||
</includes>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<tomcat.version>8.5.4</tomcat.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,9 @@
|
|||
<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>
|
||||
<groupId>com.baeldung.ethereum</groupId>
|
||||
<artifactId>ethereum</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>ethereum</name>
|
||||
|
||||
</project>
|
|
@ -8,7 +8,7 @@
|
|||
<version>1.0.0</version>
|
||||
<name>web3j</name>
|
||||
|
||||
<properties>
|
||||
<properties>
|
||||
<hamcrest.version>1.3</hamcrest.version>
|
||||
<jackson.version>2.9.3</jackson.version>
|
||||
<javax-jsp.version>2.3.1</javax-jsp.version>
|
|
@ -47,51 +47,46 @@ public class Web3Service {
|
|||
return "0x" + binary;
|
||||
}
|
||||
|
||||
@Async
|
||||
public CompletableFuture<EthBlockNumber> getBlockNumber() {
|
||||
EthBlockNumber result = new EthBlockNumber();
|
||||
try {
|
||||
this.web3j.ethBlockNumber().sendAsync().thenApply(r -> r.getBlockNumber());
|
||||
result = this.web3j.ethBlockNumber().sendAsync().get();
|
||||
} catch (Exception ex) {
|
||||
System.out.println(GENERIC_EXCEPTION);
|
||||
}
|
||||
return CompletableFuture.completedFuture(result);
|
||||
}
|
||||
|
||||
@Async
|
||||
public CompletableFuture<EthAccounts> getEthAccounts() {
|
||||
EthAccounts result = new EthAccounts();
|
||||
try {
|
||||
this.web3j.ethAccounts().sendAsync().thenApply(r -> r.getAccounts());
|
||||
result = this.web3j.ethAccounts().sendAsync().get();
|
||||
} catch (Exception ex) {
|
||||
System.out.println(GENERIC_EXCEPTION);
|
||||
}
|
||||
return CompletableFuture.completedFuture(result);
|
||||
}
|
||||
|
||||
@Async
|
||||
public CompletableFuture<EthGetTransactionCount> getTransactionCount() {
|
||||
EthGetTransactionCount result = new EthGetTransactionCount();
|
||||
try {
|
||||
this.web3j.ethGetTransactionCount(DEFAULT_ADDRESS, DefaultBlockParameter.valueOf("latest")).sendAsync().thenApply(r -> r.getTransactionCount());
|
||||
result = this.web3j.ethGetTransactionCount(DEFAULT_ADDRESS, DefaultBlockParameter.valueOf("latest")).sendAsync().get();
|
||||
} catch (Exception ex) {
|
||||
System.out.println(GENERIC_EXCEPTION);
|
||||
}
|
||||
return CompletableFuture.completedFuture(result);
|
||||
}
|
||||
|
||||
@Async
|
||||
public CompletableFuture<EthGetBalance> getEthBalance() {
|
||||
EthGetBalance result = new EthGetBalance();
|
||||
try {
|
||||
this.web3j.ethGetBalance(DEFAULT_ADDRESS, DefaultBlockParameter.valueOf("latest")).sendAsync().thenApply(r -> r.getBalance());
|
||||
result = this.web3j.ethGetBalance(DEFAULT_ADDRESS, DefaultBlockParameter.valueOf("latest")).sendAsync().get();
|
||||
} catch (Exception ex) {
|
||||
System.out.println(GENERIC_EXCEPTION);
|
||||
}
|
||||
return CompletableFuture.completedFuture(result);
|
||||
}
|
||||
|
||||
@Async
|
||||
public CompletableFuture<String> fromScratchContractExample() {
|
||||
|
||||
String contractAddress = "";
|
3
pom.xml
3
pom.xml
|
@ -73,8 +73,7 @@
|
|||
<module>deltaspike</module>
|
||||
<module>dozer</module>
|
||||
|
||||
<module>ethereumj</module>
|
||||
<module>web3j</module>
|
||||
<module>ethereum</module>
|
||||
|
||||
<!--<module>ejb</module>-->
|
||||
|
||||
|
|
|
@ -285,8 +285,6 @@
|
|||
<commons-lang.version>2.4</commons-lang.version>
|
||||
<java-version>1.8</java-version>
|
||||
|
||||
|
||||
|
||||
<!-- maven plugins -->
|
||||
<maven-jibx-plugin.version>1.3.1</maven-jibx-plugin.version>
|
||||
|
||||
|
|
Loading…
Reference in New Issue