Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# EOS Blockchain Java SDK
# EOS Blockchain Java SDK - Cyberluke Edition

> eosio java sdk with eos rpc-api

Expand All @@ -16,14 +16,14 @@ Maven [http://repo1.maven.org/maven2/io/jafka/jeos](http://repo1.maven.org/maven
<dependency>
<groupId>io.jafka</groupId>
<artifactId>jeos</artifactId>
<version>0.9.14</version>
<version>0.9.15</version>
</dependency>
</dependencies>
```

Gradle

> compile group: 'io.jafka', name: 'jeos', version: '0.9.14'
> compile group: 'io.jafka', name: 'jeos', version: '0.9.15'


### latest snapshot version
Expand Down
20 changes: 10 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.jafka</groupId>
<artifactId>jeos</artifactId>
<version>0.9.14</version>
<description>EOS Blockchain Java SDK</description>
<version>0.9.17</version>
<description>EOS Blockchain Java SDK - Cyberluke</description>

<properties>
<com.squareup.retrofit2.version>2.4.0</com.squareup.retrofit2.version>
Expand All @@ -15,9 +15,9 @@
<resources.encoding>${compile.encoding}</resources.encoding>
</properties>
<scm>
<connection>scm:git:[email protected]:adyliu/jeos.git</connection>
<developerConnection>scm:git:[email protected]:adyliu/jeos.git</developerConnection>
<url>https://github.com/adyliu/jeos</url>
<connection>scm:git:[email protected]:cyberluke/jeos.git</connection>
<developerConnection>scm:git:[email protected]:cyberluke/jeos.git</developerConnection>
<url>https://github.com/cyberluke/jeos</url>
</scm>
<licenses>
<license>
Expand All @@ -28,10 +28,10 @@
</licenses>
<developers>
<developer>
<id>imxylz</id>
<name>Ady Liu</name>
<email>imxylz@gmail.com</email>
<url>https://github.com/adyliu</url>
<id>cyberluke</id>
<name>Lukas Satin</name>
<email>luke.satin@gmail.com</email>
<url>https://github.com/cyberluke</url>
<roles>
<role>developer</role>
</roles>
Expand Down Expand Up @@ -187,5 +187,5 @@
</profile>
</profiles>
<name>jeos</name>
<url>https://github.com/adyliu/jeos</url>
<url>https://github.com/cyberluke/jeos</url>
</project>
2 changes: 1 addition & 1 deletion src/main/java/io/jafka/jeos/LocalApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
public interface LocalApi {

String createPrivateKey();
String createPrivateKey(byte[] seed);

String toPublicKey(String privateKey);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@

public class Action {

private Integer accountActionSeq;
private Long accountActionSeq;

private ActionTrace actionTrace;

private Integer blockNum;
private Long blockNum;

private String blockTime;

private Integer globalActionSeq;
private Long globalActionSeq;

public Integer getAccountActionSeq() {
public Long getAccountActionSeq() {
return accountActionSeq;
}

@JsonProperty("account_action_seq")
public void setAccountActionSeq(Integer accountActionSeq) {
public void setAccountActionSeq(Long accountActionSeq) {
this.accountActionSeq = accountActionSeq;
}

Expand All @@ -35,12 +35,12 @@ public void setActionTrace(ActionTrace actionTrace) {
this.actionTrace = actionTrace;
}

public Integer getBlockNum() {
public Long getBlockNum() {
return blockNum;
}

@JsonProperty("block_num")
public void setBlockNum(Integer blockNum) {
public void setBlockNum(Long blockNum) {
this.blockNum = blockNum;
}

Expand All @@ -53,12 +53,12 @@ public void setBlockTime(String blockTime) {
this.blockTime = blockTime;
}

public Integer getGlobalActionSeq() {
public Long getGlobalActionSeq() {
return globalActionSeq;
}

@JsonProperty("global_action_seq")
public void setGlobalActionSeq(Integer globalActionSeq) {
public void setGlobalActionSeq(Long globalActionSeq) {
this.globalActionSeq = globalActionSeq;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class Actions {

private List<Action> actions;

private Integer lastIrreversibleBlock;
private Long lastIrreversibleBlock;

public List<Action> getActions() {
return actions;
Expand All @@ -18,12 +18,12 @@ public void setActions(List<Action> actions) {
this.actions = actions;
}

public Integer getLastIrreversibleBlock() {
public Long getLastIrreversibleBlock() {
return lastIrreversibleBlock;
}

@JsonProperty("last_irreversible_block")
public void setLastIrreversibleBlock(Integer lastIrreversibleBlock) {
public void setLastIrreversibleBlock(Long lastIrreversibleBlock) {
this.lastIrreversibleBlock = lastIrreversibleBlock;
}
}
15 changes: 15 additions & 0 deletions src/main/java/io/jafka/jeos/exception/EosApiException.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
public class EosApiException extends RuntimeException {

private ErrorCode eosErrorCode;
private EosErrorDetails[] details;

public EosApiException(ErrorCode eosErrorCode) {
this.eosErrorCode = eosErrorCode;
Expand All @@ -27,6 +28,20 @@ public EosApiException(String message, Throwable cause, ErrorCode eosErrorCode)
this.eosErrorCode = eosErrorCode;
}

public EosApiException(String message, EosApiErrorCode eosErrorCode, EosErrorDetails[] details) {
super(message);
this.eosErrorCode = eosErrorCode;
this.details = details;
}

public EosErrorDetails[] getDetails() {
return details;
}

public void setDetails(EosErrorDetails[] details) {
this.details = details;
}

public ErrorCode getEosErrorCode() {
return eosErrorCode;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static <T> T executeSync(Call<T> call) {
return response.body();
} else {
EosApiError apiError = getEosApiError(response);
throw new EosApiException(apiError.getDetailedMessage(), EosApiErrorCode.get(apiError.getEosErrorCode()));
throw new EosApiException(apiError.getDetailedMessage(), EosApiErrorCode.get(apiError.getEosErrorCode()), apiError.getError().getDetails());
}
} catch (IOException e) {
throw new EosApiException(e);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/jafka/jeos/impl/LocalApiImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
public class LocalApiImpl implements LocalApi {

@Override
public String createPrivateKey() {
return KeyUtil.createPrivateKey();
public String createPrivateKey(byte[] seed) {
return KeyUtil.createPrivateKey(seed);
}

@Override
Expand Down
8 changes: 3 additions & 5 deletions src/main/java/io/jafka/jeos/util/KeyUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@ public class KeyUtil {
public static final String address_prefix = "EOS";

public static final Secp256k secp = new Secp256k();
public static String createPrivateKey() {
return createPrivateKey(UUID.randomUUID().toString());
}
public static String createPrivateKey(String seed) {

public static String createPrivateKey(byte[] seed) {
Objects.requireNonNull(seed);
byte[] a = { (byte) 0x80 };
byte[] b = new BigInteger(SHA.sha256(seed)).toByteArray();
byte[] b = seed;
byte[] private_key = Raw.concat(a, b);
byte[] checksum = SHA.sha256(private_key);
checksum = SHA.sha256(checksum);
Expand Down