diff --git a/core/pom.xml b/core/pom.xml
index 949f2589..e8dfcffe 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -177,7 +177,7 @@
2.2
1.15
2.10.0
- 3.9
+ 3.8
2.6
1.7.26
2.12.1
diff --git a/core/src/main/java/eu/bittrade/libs/steemj/enums/RequestMethod.java b/core/src/main/java/eu/bittrade/libs/steemj/enums/RequestMethod.java
index b85330ac..41bc9152 100644
--- a/core/src/main/java/eu/bittrade/libs/steemj/enums/RequestMethod.java
+++ b/core/src/main/java/eu/bittrade/libs/steemj/enums/RequestMethod.java
@@ -32,6 +32,8 @@ public enum RequestMethod {
GET_TRANSACTION,
/** Get the full history of an account. */
GET_ACCOUNT_HISTORY,
+ /** Receive virtual operations for blocks. */
+ ENUM_VIRTUAL_OPS,
// block_api
/** */
GET_BLOCK,
@@ -273,6 +275,6 @@ public enum RequestMethod {
GET_ACCOUNT_BANDWIDTH,
/** */
GET_REVERSE_RATIO,
-
+
GET_LIQUIDITY_QUEUE
}
diff --git a/core/src/main/java/eu/bittrade/libs/steemj/plugins/apis/account/history/AccountHistoryApi.java b/core/src/main/java/eu/bittrade/libs/steemj/plugins/apis/account/history/AccountHistoryApi.java
index 21a7d1a2..8adac800 100644
--- a/core/src/main/java/eu/bittrade/libs/steemj/plugins/apis/account/history/AccountHistoryApi.java
+++ b/core/src/main/java/eu/bittrade/libs/steemj/plugins/apis/account/history/AccountHistoryApi.java
@@ -22,11 +22,14 @@
import eu.bittrade.libs.steemj.enums.SteemApiType;
import eu.bittrade.libs.steemj.exceptions.SteemCommunicationException;
import eu.bittrade.libs.steemj.exceptions.SteemResponseException;
+import eu.bittrade.libs.steemj.plugins.apis.account.history.models.EnumVirtualOps;
+import eu.bittrade.libs.steemj.plugins.apis.account.history.models.EnumVirtualOpsArgs;
import eu.bittrade.libs.steemj.plugins.apis.account.history.models.GetAccountHistoryArgs;
import eu.bittrade.libs.steemj.plugins.apis.account.history.models.GetAccountHistoryReturn;
import eu.bittrade.libs.steemj.plugins.apis.account.history.models.GetOpsInBlockArgs;
import eu.bittrade.libs.steemj.plugins.apis.account.history.models.GetOpsInBlockReturn;
import eu.bittrade.libs.steemj.protocol.AnnotatedSignedTransaction;
+import eu.bittrade.libs.steemj.protocol.TransactionId;
/**
* This class implements the "account_history_api".
@@ -71,22 +74,26 @@ private AccountHistoryApi() {
*
*/
public static GetOpsInBlockReturn getOpsInBlock(CommunicationHandler communicationHandler,
- GetOpsInBlockArgs getOpsInBlockArgs) throws SteemCommunicationException, SteemResponseException {
- JsonRPCRequest requestObject = new JsonRPCRequest(SteemApiType.ACCOUNT_HISTORY_API,
+ GetOpsInBlockArgs getOpsInBlockArgs) throws SteemCommunicationException, SteemResponseException {
+ JsonRPCRequest requestObject = new JsonRPCRequest(SteemApiType.ACCOUNT_HISTORY_API,
RequestMethod.GET_OPS_IN_BLOCK, getOpsInBlockArgs);
return communicationHandler.performRequest(requestObject, GetOpsInBlockReturn.class).get(0);
}
/**
- * Find a transaction by its transactionId
.
+ * Returns the details of a transaction based on a
+ * transactionId
.
*
+ * @deprecated According to
+ * https://developers.steem.io/apidefinitions/#apidefinitions-account-history-api
+ * this method is deprecated.
* @param communicationHandler
* A
* {@link eu.bittrade.libs.steemj.communication.CommunicationHandler
* CommunicationHandler} instance that should be used to send the
* request.
- * @param transactionId
+ * @param getTransactionArgs
* The transactionId
to search for.
* @return A sequence of operations included/generated within a particular
* block.
@@ -105,8 +112,9 @@ public static GetOpsInBlockReturn getOpsInBlock(CommunicationHandler communicati
*
If the Server returned an error object.
*
*/
+ @Deprecated
public static AnnotatedSignedTransaction getTransaction(CommunicationHandler communicationHandler,
- GetAccountHistoryArgs getTransactionArgs) throws SteemCommunicationException, SteemResponseException {
+ TransactionId getTransactionArgs) throws SteemCommunicationException, SteemResponseException {
JsonRPCRequest requestObject = new JsonRPCRequest(SteemApiType.ACCOUNT_HISTORY_API,
RequestMethod.GET_TRANSACTION, getTransactionArgs);
@@ -151,4 +159,40 @@ public static GetAccountHistoryReturn getAccountHistory(CommunicationHandler com
return communicationHandler.performRequest(requestObject, GetAccountHistoryReturn.class).get(0);
}
+
+ /**
+ * Get all virtual operations in a specified range of blocks..
+ *
+ * @param communicationHandler
+ * A
+ * {@link eu.bittrade.libs.steemj.communication.CommunicationHandler
+ * CommunicationHandler} instance that should be used to send the
+ * request.
+ * @param enumVirtualOpsArgs
+ * The user name of the account.
+ * @return A list of
+ * {@link eu.bittrade.libs.steemj.plugins.apis.account.history.models.AppliedOperation
+ * AppliedOperations}.
+ * @throws SteemCommunicationException
+ *
+ * - If the server was not able to answer the request in the
+ * given time (see
+ * {@link eu.bittrade.libs.steemj.configuration.SteemJConfig#setResponseTimeout(int)
+ * setResponseTimeout}).
+ * - If there is a connection problem.
+ *
+ * @throws SteemResponseException
+ *
+ * - If the SteemJ is unable to transform the JSON response
+ * into a Java object.
+ * - If the Server returned an error object.
+ *
+ */
+ public static EnumVirtualOps enumVirtualOps(CommunicationHandler communicationHandler,
+ EnumVirtualOpsArgs enumVirtualOpsArgs) throws SteemCommunicationException, SteemResponseException {
+ JsonRPCRequest requestObject = new JsonRPCRequest(SteemApiType.ACCOUNT_HISTORY_API,
+ RequestMethod.ENUM_VIRTUAL_OPS, enumVirtualOpsArgs);
+
+ return communicationHandler.performRequest(requestObject, EnumVirtualOps.class).get(0);
+ }
}
diff --git a/core/src/main/java/eu/bittrade/libs/steemj/plugins/apis/account/history/models/AppliedOperation.java b/core/src/main/java/eu/bittrade/libs/steemj/plugins/apis/account/history/models/AppliedOperation.java
index 7b414a3f..217e2d97 100644
--- a/core/src/main/java/eu/bittrade/libs/steemj/plugins/apis/account/history/models/AppliedOperation.java
+++ b/core/src/main/java/eu/bittrade/libs/steemj/plugins/apis/account/history/models/AppliedOperation.java
@@ -24,8 +24,8 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import eu.bittrade.libs.steemj.fc.TimePointSec;
+import eu.bittrade.libs.steemj.plugins.apis.account.history.models.deserializer.OperationWrapper;
import eu.bittrade.libs.steemj.protocol.TransactionId;
-import eu.bittrade.libs.steemj.protocol.operations.Operation;
/**
* This class is the java implementation of the Steem "api_operation_object"
@@ -51,7 +51,7 @@ public class AppliedOperation {
@JsonProperty("timestamp")
private TimePointSec timestamp;
@JsonProperty("op")
- private Operation op;
+ private OperationWrapper operationWrapper;
/**
* This object is only used to wrap the JSON response in a POJO, so
@@ -79,27 +79,27 @@ public UInteger getBlock() {
}
/**
- * Get the index of the transaction inside the block.
+ * Get the number of transactions inside the block.
*
- * @return The transaction index in the block.
+ * @return The number of transactions inside the block.
*/
public UInteger getTrxInBlock() {
return trxInBlock;
}
/**
- * Get the index of the operation inside the transaction.
+ * Get the number of operations inside the transaction.
*
- * @return The operation index in the transaction.
+ * @return The number of operations inside the transaction.
*/
public UShort getOpInTrx() {
return opInTrx;
}
/**
- * Get the index of the virtual operation inside the transaction.
+ * Get the number of virtual operations inside the transaction.
*
- * @return The virtual operation index in the transaction.
+ * @return The number of virtual operations inside the transaction.
*/
public ULong getVirtualOp() {
return virtualOp;
@@ -115,12 +115,12 @@ public TimePointSec getTimestamp() {
}
/**
- * Get the whole operation object.
+ * Get a wrapper object which stores the whole operation object.
*
* @return The operation object.
*/
- public Operation getOp() {
- return op;
+ public OperationWrapper getOperationWrapper() {
+ return operationWrapper;
}
@Override
diff --git a/core/src/main/java/eu/bittrade/libs/steemj/plugins/apis/account/history/models/EnumVirtualOps.java b/core/src/main/java/eu/bittrade/libs/steemj/plugins/apis/account/history/models/EnumVirtualOps.java
new file mode 100644
index 00000000..15ab0c08
--- /dev/null
+++ b/core/src/main/java/eu/bittrade/libs/steemj/plugins/apis/account/history/models/EnumVirtualOps.java
@@ -0,0 +1,56 @@
+/*
+ * This file is part of SteemJ (formerly known as 'Steem-Java-Api-Wrapper')
+ *
+ * SteemJ is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SteemJ is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SteemJ. If not, see .
+ */
+package eu.bittrade.libs.steemj.plugins.apis.account.history.models;
+
+import java.util.List;
+
+import org.joou.UInteger;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * This class implements the Steem "enum_virtual_ops_return" object.
+ *
+ * @author dez1337
+ */
+public class EnumVirtualOps {
+ @JsonProperty("ops")
+ private List operations;
+ @JsonProperty("next_block_range_begin")
+ private UInteger nextBlockRangeBegin;
+
+ /**
+ * This object is only used to wrap the JSON response in a POJO, so
+ * therefore this class should not be instantiated.
+ */
+ private EnumVirtualOps() {
+ }
+
+ /**TODO
+ * @return the operations
+ */
+ public List getOperations() {
+ return operations;
+ }
+
+ /**TODO
+ * @return the nextBlockRangeBegin
+ */
+ public UInteger getNextBlockRangeBegin() {
+ return nextBlockRangeBegin;
+ }
+}
diff --git a/core/src/main/java/eu/bittrade/libs/steemj/plugins/apis/account/history/models/EnumVirtualOpsArgs.java b/core/src/main/java/eu/bittrade/libs/steemj/plugins/apis/account/history/models/EnumVirtualOpsArgs.java
new file mode 100644
index 00000000..efc42856
--- /dev/null
+++ b/core/src/main/java/eu/bittrade/libs/steemj/plugins/apis/account/history/models/EnumVirtualOpsArgs.java
@@ -0,0 +1,68 @@
+/*
+ * This file is part of SteemJ (formerly known as 'Steem-Java-Api-Wrapper')
+ *
+ * SteemJ is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SteemJ is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SteemJ. If not, see .
+ */
+package eu.bittrade.libs.steemj.plugins.apis.account.history.models;
+
+import org.apache.commons.lang3.Validate;
+import org.joou.UInteger;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * This class implements the Steem "enum_virtual_ops_args" object.
+ *
+ * @author dez1337
+ */
+public class EnumVirtualOpsArgs {
+ @JsonProperty("block_range_begin")
+ private UInteger blockRangeBegin;
+ @JsonProperty("block_range_end")
+ private UInteger blockRangeEnd;
+
+ public static class Builder {
+ private UInteger blockRangeBegin;
+ private UInteger blockRangeEnd;
+
+ public Builder() {
+ this.blockRangeBegin = UInteger.valueOf(1);
+ this.blockRangeEnd = UInteger.valueOf(2);
+ }
+
+ public Builder startAt(UInteger startBlock) {
+ this.blockRangeBegin = Validate.notNull(startBlock);
+ return this;
+ }
+
+ public Builder endAt(UInteger endBlock) {
+ this.blockRangeEnd = Validate.notNull(endBlock);
+ return this;
+ }
+
+ public EnumVirtualOpsArgs build() {
+ EnumVirtualOpsArgs enumVirtualOpsArgs = new EnumVirtualOpsArgs();
+ enumVirtualOpsArgs.blockRangeBegin = this.blockRangeBegin;
+ enumVirtualOpsArgs.blockRangeEnd = this.blockRangeEnd;
+ return enumVirtualOpsArgs;
+ }
+ }
+
+ @JsonCreator()
+ private EnumVirtualOpsArgs() {
+
+ }
+
+}
diff --git a/core/src/main/java/eu/bittrade/libs/steemj/plugins/apis/account/history/models/GetAccountHistoryReturn.java b/core/src/main/java/eu/bittrade/libs/steemj/plugins/apis/account/history/models/GetAccountHistoryReturn.java
index d520973f..52223b43 100644
--- a/core/src/main/java/eu/bittrade/libs/steemj/plugins/apis/account/history/models/GetAccountHistoryReturn.java
+++ b/core/src/main/java/eu/bittrade/libs/steemj/plugins/apis/account/history/models/GetAccountHistoryReturn.java
@@ -19,7 +19,6 @@
import java.util.Map;
import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.joou.UInteger;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
@@ -34,7 +33,7 @@
public class GetAccountHistoryReturn {
@JsonProperty("history")
@JsonDeserialize(using = AppliedOperationHashMapDeserializer.class)
- private Map history;
+ private Map history;
/**
* This object is only used to wrap the JSON response in a POJO, so
@@ -51,7 +50,7 @@ private GetAccountHistoryReturn() {
*
* @return A map of operations and their id.
*/
- public Map getHistory() {
+ public Map getHistory() {
return history;
}
diff --git a/core/src/main/java/eu/bittrade/libs/steemj/plugins/apis/account/history/models/GetTransactionArgs.java b/core/src/main/java/eu/bittrade/libs/steemj/plugins/apis/account/history/models/GetTransactionArgs.java
deleted file mode 100644
index 7d971db8..00000000
--- a/core/src/main/java/eu/bittrade/libs/steemj/plugins/apis/account/history/models/GetTransactionArgs.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * This file is part of SteemJ (formerly known as 'Steem-Java-Api-Wrapper')
- *
- * SteemJ is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * SteemJ is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with SteemJ. If not, see .
- */
-package eu.bittrade.libs.steemj.plugins.apis.account.history.models;
-
-import java.security.InvalidParameterException;
-
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import eu.bittrade.libs.steemj.communication.CommunicationHandler;
-import eu.bittrade.libs.steemj.plugins.apis.account.history.AccountHistoryApi;
-import eu.bittrade.libs.steemj.protocol.TransactionId;
-import eu.bittrade.libs.steemj.util.SteemJUtils;
-
-/**
- * This class implements the Steem "get_transaction_args" object.
- *
- * @author dez1337
- */
-public class GetTransactionArgs {
- @JsonProperty("id")
- private TransactionId id;
-
- /**
- * Create a new {@link GetAccountHistoryArgs} instance to be passed to the
- * {@link AccountHistoryApi#getAccountHistory(CommunicationHandler, GetAccountHistoryArgs)}
- * method.
- *
- * @param id
- * The {@link TransactionId} to set.
- */
- @JsonCreator()
- public GetTransactionArgs(@JsonProperty("id") TransactionId id) {
- this.setId(id);
- }
-
- /**
- * @return The {@link TransactionId} wrapped by this instance.
- */
- public TransactionId getId() {
- return id;
- }
-
- /**
- * Override the current {@link TransactionId} wrapped by this instance.
- * Please notice that the id
is required. If not provided, the
- * method will throw an {@link InvalidParameterException}.
- *
- * @param id
- * The {@link TransactionId} to set.
- * @throws InvalidParameterException
- * If the id
is null.
- */
- public void setId(TransactionId id) {
- this.id = SteemJUtils.setIfNotNull(id, "The id cannot be null.");
- }
-
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this);
- }
-}
diff --git a/core/src/main/java/eu/bittrade/libs/steemj/plugins/apis/account/history/models/deserializer/AppliedOperationHashMapDeserializer.java b/core/src/main/java/eu/bittrade/libs/steemj/plugins/apis/account/history/models/deserializer/AppliedOperationHashMapDeserializer.java
index bf98868c..200f30f8 100644
--- a/core/src/main/java/eu/bittrade/libs/steemj/plugins/apis/account/history/models/deserializer/AppliedOperationHashMapDeserializer.java
+++ b/core/src/main/java/eu/bittrade/libs/steemj/plugins/apis/account/history/models/deserializer/AppliedOperationHashMapDeserializer.java
@@ -20,8 +20,6 @@
import java.util.HashMap;
import java.util.Map;
-import org.joou.UInteger;
-
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.ObjectCodec;
import com.fasterxml.jackson.core.TreeNode;
@@ -40,19 +38,19 @@
*
* @author dez1337
*/
-public class AppliedOperationHashMapDeserializer extends JsonDeserializer