Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

Feature: Rodeos integration #118

Open
wants to merge 46 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
accaf6a
Add models to house data
Jun 16, 2020
be7d055
Add custom ActionTraceDeserializer to handle conversion of deserializ…
Jun 23, 2020
573ad31
provider updates
Jun 25, 2020
bdccde9
Deserialization properly
Jun 29, 2020
6ae7882
Update tests
Jun 29, 2020
035e686
Move abieosserializationobject back. Remove custom deserializer
Jun 29, 2020
b5c9df1
Revert Project.xml
Jun 29, 2020
d424372
Use getGson instead of creating new gson object
Jun 29, 2020
656b393
Add error types and refactor
Jun 29, 2020
1b73c86
Add tests and refactor
Jun 29, 2020
a74f043
Error message rename
Jun 29, 2020
5b44493
Add comments and update tests
Jun 29, 2020
db02dd3
Add comments
Jun 30, 2020
5aab43f
Don't use stream
Jun 30, 2020
92b7f36
Add new error to throw instead of printing stack trace
Jun 30, 2020
9393ec1
Add/update tests and comments.
Jul 2, 2020
3bd6b12
Update README with struct serialization/deserialization and 0.1.3 fea…
Jul 7, 2020
fbaa8da
Merge branch 'develop' of https://github.com/EOSIO/eosio-java into fe…
Jul 7, 2020
15bb0b3
Overload constructor to pass null contract/action names when not needed
Jul 8, 2020
5131d2c
Add additional constructor for omit type
Jul 8, 2020
6d905d2
Begin adding deserialization of queries
Jul 13, 2020
15a7cdd
Begin adding query
Jul 14, 2020
f992b3c
Setup for sendTransaction
Jul 14, 2020
84043da
Update rpcProvider
Jul 14, 2020
4d89322
Working towards getting proper return type to deserialize.
Jul 15, 2020
cfb9015
Get return type properly
Jul 16, 2020
a973f76
Implementation for getting return type index and tests
Jul 16, 2020
f7eb344
Added tests, finished updates to processor
Jul 16, 2020
33e7adc
Add b1x-specific test
Jul 16, 2020
e336433
Add all primitive type deserialization/conversion + tests
Jul 17, 2020
c2cf602
Working with both any_array and any_object
Jul 17, 2020
1e165d6
Full tests
Jul 17, 2020
36a115b
Use Field
Jul 17, 2020
b67e9fb
Unnecessary deserializer
Jul 17, 2020
f9cf1cd
Add constants
Jul 17, 2020
834beb0
Convert QueryIt -> AnyVar
Jul 18, 2020
8b3feff
Serialize all regular types
Jul 18, 2020
3aa11df
Fix bug in deserializer. Add serializer for now
Jul 18, 2020
6527832
Serialize properly
Jul 18, 2020
95186e4
Add conversion process to transaction processor
Jul 18, 2020
2fd6740
Convert to use SendTransaction. Update tests
Jul 20, 2020
7feef17
Javadocs and tests
Jul 20, 2020
195b186
Javadocs and field tests
Jul 20, 2020
7ce56c0
Javadocs
Jul 20, 2020
4cd63b9
Fix test
Jul 20, 2020
f1b3a65
Bump libraryVersion as test
Jul 20, 2020
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
25 changes: 0 additions & 25 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ To date, EOSIO SDK for Java has only been tested on Android. The goal, however,

## Updates

7/7/20

Version 0.1.3 Allows for deserialization of action return value structs.

2/25/20

Version 0.1.2 Uses JDK11 to build and targets 1.8 for source and target compatibility.
Expand Down Expand Up @@ -148,7 +152,7 @@ EOSIO SDK for Java _does not include_ an RPC provider implementation; one must b

### Serialization Provider Protocol

The Serialization Provider is responsible for ABI-driven transaction and action serialization and deserialization between JSON and binary data representations. These implementations often contain platform-sensitive C++ code and larger dependencies. For those reasons, EOSIO SDK for Java _does not include_ a serialization provider implementation; one must be installed separately.
The Serialization Provider is responsible for ABI-driven transaction, action, and struct serialization and deserialization between JSON and binary data representations. These implementations often contain platform-sensitive C++ code and larger dependencies. For those reasons, EOSIO SDK for Java _does not include_ a serialization provider implementation; one must be installed separately.

* [ISerializationProvider](eosiojava/src/main/java/one/block/eosiojava/interfaces/ISerializationProvider.java)
* [ABIEOS Serialization Provider Implementation](https://github.com/EOSIO/eosio-java-android-abieos-serialization-provider) - Currently supports Android 6 (Marshmallow)+
Expand Down
2 changes: 1 addition & 1 deletion eosiojava/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ dependencies {

def libraryGroupId = 'one.block'
def libraryArtifactId = 'eosiojava'
def libraryVersion = '0.1.2'
def libraryVersion = '0.1.2-queryit'

task sourcesJar(type: Jar, dependsOn: classes){
classifier = 'sources'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import one.block.eosiojava.models.rpcProvider.request.GetBlockRequest;
import one.block.eosiojava.models.rpcProvider.request.GetRequiredKeysRequest;
import one.block.eosiojava.models.rpcProvider.request.PushTransactionRequest;
import one.block.eosiojava.models.rpcProvider.response.ActionTrace;
import one.block.eosiojava.models.rpcProvider.response.GetInfoResponse;
import one.block.eosiojava.models.signatureProvider.EosioTransactionSignatureRequest;
import one.block.eosiojava.session.TransactionProcessor;
Expand Down Expand Up @@ -316,8 +317,17 @@ private ErrorConstants(){
public static final String TRANSACTION_PROCESSOR_BROADCAST_SIGN_EMPTY = "Can't call broadcast because Signature is empty. Make sure of calling sign before calling broadcast.";

/**
* Error message get thrown if {@link TransactionProcessor#getSignatures()} is empty during process of {@link TransactionProcessor#signAndBroadcast()} ()}
* Error message get thrown if {@link TransactionProcessor#getSignatures()} is empty during process of {@link TransactionProcessor#signAndBroadcast()}
*/
public static final String TRANSACTION_PROCESSOR_SIGN_BROADCAST_SIGN_EMPTY = "Can't call sign and broadcast because Signature is empty. Make sure of calling sign before calling sign and broadcast.";

/**
* Error message get thrown if return value's deserialization process gets an error after calling {@link ISerializationProvider#deserialize(AbiEosSerializationObject)}
*/
public static final String TRANSACTION_PROCESSOR_DESERIALIZE_RETURN_VALUE_ERROR = "Error happened on deserializing return value [%s]";

/**
* Error message thrown if return value's deserialization process is empty after calling {@link ISerializationProvider#deserialize(AbiEosSerializationObject)}
*/
public static final String TRANSACTION_PROCESSOR_DESERIALIZE_RETURN_VALUE_EMPTY = "Deserialization of return value expected result, but was empty.";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package one.block.eosiojava.error.rpcProvider;

import org.jetbrains.annotations.NotNull;

/**
* Error class is used when there is an exception while attempting to use the RPC call,
* sendTransaction().
*/
public class SendTransactionRpcError extends RpcProviderError {

public SendTransactionRpcError() {
}

public SendTransactionRpcError(@NotNull String message) {
super(message);
}

public SendTransactionRpcError(@NotNull String message,
@NotNull Exception exception) {
super(message, exception);
}

public SendTransactionRpcError(@NotNull Exception exception) {
super(exception);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package one.block.eosiojava.error.serializationProvider;

import org.jetbrains.annotations.NotNull;

/**
* Error class is used when there is an exception while attempting to call deserialize() of
* Serialization Provider
*/
public class DeserializeReturnValueError extends SerializationProviderError {

public DeserializeReturnValueError() {
}

public DeserializeReturnValueError(@NotNull String message) {
super(message);
}

public DeserializeReturnValueError(@NotNull String message,
@NotNull Exception exception) {
super(message, exception);
}

public DeserializeReturnValueError(@NotNull Exception exception) {
super(exception);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package one.block.eosiojava.error.session;

import org.jetbrains.annotations.NotNull;

/**
* Error class is used when there is an exception while attempting to call
* formatPushTransactionResponse() of TransactionProcessor
*/
public class TransactionFormatPushTransactionResponseError extends TransactionProcessorError {

public TransactionFormatPushTransactionResponseError() {
}

public TransactionFormatPushTransactionResponseError(@NotNull String message) {
super(message);
}

public TransactionFormatPushTransactionResponseError(@NotNull String message,
@NotNull Exception exception) {
super(message, exception);
}

public TransactionFormatPushTransactionResponseError(@NotNull Exception exception) {
super(exception);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@
import one.block.eosiojava.error.rpcProvider.GetRawAbiRpcError;
import one.block.eosiojava.error.rpcProvider.GetRequiredKeysRpcError;
import one.block.eosiojava.error.rpcProvider.PushTransactionRpcError;
import one.block.eosiojava.error.rpcProvider.SendTransactionRpcError;
import one.block.eosiojava.models.rpcProvider.request.GetBlockRequest;
import one.block.eosiojava.models.rpcProvider.request.GetRawAbiRequest;
import one.block.eosiojava.models.rpcProvider.request.GetRequiredKeysRequest;
import one.block.eosiojava.models.rpcProvider.request.PushTransactionRequest;
import one.block.eosiojava.models.rpcProvider.request.SendTransactionRequest;
import one.block.eosiojava.models.rpcProvider.response.GetBlockResponse;
import one.block.eosiojava.models.rpcProvider.response.GetInfoResponse;
import one.block.eosiojava.models.rpcProvider.response.GetRawAbiResponse;
import one.block.eosiojava.models.rpcProvider.response.GetRequiredKeysResponse;
import one.block.eosiojava.models.rpcProvider.response.PushTransactionResponse;
import one.block.eosiojava.models.rpcProvider.response.SendTransactionResponse;
import org.jetbrains.annotations.NotNull;

/**
Expand Down Expand Up @@ -74,4 +77,15 @@ public interface IRPCProvider {
*/
@NotNull
PushTransactionResponse pushTransaction(PushTransactionRequest pushTransactionRequest) throws PushTransactionRpcError;

/**
* This method expects a transaction in JSON format and will attempt to apply it to the blockchain.
*
* @param sendTransactionRequest the transaction to push with signatures.
* @return the send transaction response
* @throws SendTransactionRpcError thrown if there are any exceptions/backend error during the
* sendTransaction() process.
*/
@NotNull
SendTransactionResponse sendTransaction(SendTransactionRequest sendTransactionRequest) throws SendTransactionRpcError;
}
Original file line number Diff line number Diff line change
Expand Up @@ -141,20 +141,39 @@ public void setJson(@NotNull String json) {
}

/**
* Initialize AbiEosSerializationObject
* Initialize AbiEosSerializationObject.
*
* @param contract - the contract name.
* @param name - the action name.
* @param type - the type name.
* @param abi - the abi to use for conversion.
*/
public AbiEosSerializationObject(@Nullable String contract,
@NotNull String name, @Nullable String type,
@Nullable String name, @Nullable String type,
@NotNull String abi) {
this.contract = contract;
this.name = name;
this.type = type;
this.abi = abi;
}

/**
* Initialize AbiEosSerializationObject for use with action/transaction data only.
*
* @param contract - the contract name.
* @param name - the action name.
* @param abi - the abi to use for conversion.
*/
public AbiEosSerializationObject(@NotNull String contract, @NotNull String name, @NotNull String abi) {
this(contract, name, null, abi);
}

/**
* Initialize AbiEosSerializationObject for use with type data only.
* @param type - the type name.
* @param abi - the abi to use for conversion.
*/
public AbiEosSerializationObject(@NotNull String type, @NotNull String abi) {
this(null, null, type, abi);
}
}
Loading