Skip to content

Commit

Permalink
Work on #177
Browse files Browse the repository at this point in the history
  • Loading branch information
neutralleiter committed Jan 1, 2018
1 parent 46a4780 commit d6698bd
Show file tree
Hide file tree
Showing 6 changed files with 257 additions and 38 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package eu.bittrade.libs.steemj.plugins.apis.account.history.models;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.joou.UInteger;
import org.joou.ULong;
import org.joou.UShort;

import com.fasterxml.jackson.annotation.JsonProperty;

Expand All @@ -15,39 +18,23 @@
* @author <a href="http://steemit.com/@dez1337">dez1337</a>
*/
public class AppliedOperation {
api_operation_object() {}
api_operation_object( const steem::chain::operation_object& op_obj ) :
trx_id( op_obj.trx_id ),
block( op_obj.block ),
trx_in_block( op_obj.trx_in_block ),
virtual_op( op_obj.virtual_op ),
timestamp( op_obj.timestamp )
{
op = fc::raw::unpack_from_buffer< steem::protocol::operation >( op_obj.serialized_op );
}

steem::protocol::transaction_id_type trx_id;
uint32_t block = 0;
uint32_t trx_in_block = 0;
uint16_t op_in_trx = 0;
uint64_t virtual_op = 0;
fc::time_point_sec timestamp;
steem::protocol::operation op;

@JsonProperty("trx_id")
private TransactionId trxId;
// Original type is uint32_t.
private int block;
@JsonProperty("block")
private UInteger block;
// Original type is uint32_t.
@JsonProperty("trx_in_block")
private int trxInBlock;
private UInteger trxInBlock;
// Original type is uint16_t.
@JsonProperty("op_in_trx")
private int opInTrx;
private UShort opInTrx;
// Original type is uint64_t.
@JsonProperty("virtual_op")
private long virtualOp;
private ULong virtualOp;
@JsonProperty("timestamp")
private TimePointSec timestamp;
@JsonProperty("op")
private Operation op;

/**
Expand All @@ -71,7 +58,7 @@ public TransactionId getTrxId() {
*
* @return The block number.
*/
public int getBlock() {
public UInteger getBlock() {
return block;
}

Expand All @@ -80,7 +67,7 @@ public int getBlock() {
*
* @return The transaction index in the block.
*/
public int getTrxInBlock() {
public UInteger getTrxInBlock() {
return trxInBlock;
}

Expand All @@ -89,7 +76,7 @@ public int getTrxInBlock() {
*
* @return The operation index in the transaction.
*/
public int getOpInTrx() {
public UShort getOpInTrx() {
return opInTrx;
}

Expand All @@ -98,14 +85,14 @@ public int getOpInTrx() {
*
* @return The virtual operation index in the transaction.
*/
public long getVirtualOp() {
public ULong getVirtualOp() {
return virtualOp;
}

/**
* Get the time point at which this transaction has been submitted.
*
* @return The submition date and time.
* @return The submission date and time.
*/
public TimePointSec getTimestamp() {
return timestamp;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,95 @@
package eu.bittrade.libs.steemj.plugins.apis.account.history.models;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.joou.UInteger;
import org.joou.ULong;

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.witness.WitnessApi;
import eu.bittrade.libs.steemj.plugins.apis.witness.enums.BandwidthType;
import eu.bittrade.libs.steemj.plugins.apis.witness.models.GetAccountBandwidthArgs;
import eu.bittrade.libs.steemj.protocol.AccountName;

/**
* This class implements the Steem "get_account_history_args" object.
*
* @author <a href="http://steemit.com/@dez1337">dez1337</a>
*/
public class GetAccountHistoryArgs {
struct get_account_history_args
{
steem::protocol::account_name_type account;
uint64_t start = -1;
uint32_t limit = 1000;
};
@JsonProperty("account")
private AccountName account;
@JsonProperty("start")
private ULong start;
@JsonProperty("limit")
private UInteger limit;

/**
* Create a new {@link GetAccountBandwidthArgs} instance to be passed to the
* {@link WitnessApi#getAccountBandwidth(CommunicationHandler, GetAccountBandwidthArgs)}
* method.
*
* @param account
* The account name request the bandwidth for.
* @param type
* The {@link BandwidthType} to request.
*/
@JsonCreator()
public GetAccountHistoryArgs() {
steem::protocol::account_name_type account;
uint64_t start = -1;
uint32_t limit = 1000;
}

/**
* @return the account
*/
public AccountName getAccount() {
return account;
}

/**
* @param account
* the account to set
*/
public void setAccount(AccountName account) {
this.account = account;
}

/**
* @return the start
*/
public ULong getStart() {
return start;
}

/**
* @param start
* the start to set
*/
public void setStart(ULong start) {
this.start = start;
}

/**
* @return the limit
*/
public UInteger getLimit() {
return limit;
}

/**
* @param limit
* the limit to set
*/
public void setLimit(UInteger limit) {
this.limit = limit;
}

@Override
public String toString() {
return ToStringBuilder.reflectionToString(this);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,40 @@
package eu.bittrade.libs.steemj.plugins.apis.account.history.models;

import java.util.Map;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.joou.UInteger;

import com.fasterxml.jackson.annotation.JsonProperty;

import eu.bittrade.libs.steemj.base.models.operations.Operation;

/**
* This class implements the Steem "get_account_history_return" object.
*
* @author <a href="http://steemit.com/@dez1337">dez1337</a>
*/
public class GetAccountHistoryReturn {
std::map< uint32_t, api_operation_object > history;
@JsonProperty("history")
private Map<UInteger, Operation> history;

/**
* This object is only used to wrap the JSON response in a POJO, so
* therefore this class should not be instantiated.
*/
private GetAccountHistoryReturn() {
}

/**
* @return the history
*/
public Map<UInteger, Operation> getHistory() {
return history;
}

@Override
public String toString() {
return ToStringBuilder.reflectionToString(this);
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,74 @@
package eu.bittrade.libs.steemj.plugins.apis.account.history.models;

import org.apache.commons.lang3.builder.ToStringBuilder;

import com.fasterxml.jackson.annotation.JsonCreator;

import eu.bittrade.libs.steemj.communication.CommunicationHandler;
import eu.bittrade.libs.steemj.plugins.apis.witness.WitnessApi;
import eu.bittrade.libs.steemj.plugins.apis.witness.enums.BandwidthType;
import eu.bittrade.libs.steemj.plugins.apis.witness.models.GetAccountBandwidthArgs;

/**
* This class implements the Steem "get_ops_in_block_args" object.
*
* @author <a href="http://steemit.com/@dez1337">dez1337</a>
*/
public class GetOpsInBlockArgs {
uint32_t block_num;
bool only_virtual;
@JsonProperty("block_num")
private UInteger blockNum;
@JsonProperty("onlyVirtual")
private Boolean onlyVirtual;

/**
* Create a new {@link GetAccountBandwidthArgs} instance to be passed to the
* {@link WitnessApi#getAccountBandwidth(CommunicationHandler, GetAccountBandwidthArgs)}
* method.
*
* @param account
* The account name request the bandwidth for.
* @param type
* The {@link BandwidthType} to request.
*/
@JsonCreator()
public GetOpsInBlockArgs() {
steem::protocol::account_name_type account;
uint64_t start = -1;
uint32_t limit = 1000;
}

/**
* @return the blockNum
*/
public UInteger getBlockNum() {
return blockNum;
}

/**
* @param blockNum
* the blockNum to set
*/
public void setBlockNum(UInteger blockNum) {
this.blockNum = blockNum;
}

/**
* @return the onlyVirtual
*/
public Boolean getOnlyVirtual() {
return onlyVirtual;
}

/**
* @param onlyVirtual
* the onlyVirtual to set
*/
public void setOnlyVirtual(Boolean onlyVirtual) {
this.onlyVirtual = onlyVirtual;
}

@Override
public String toString() {
return ToStringBuilder.reflectionToString(this);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
package eu.bittrade.libs.steemj.plugins.apis.account.history.models;

import java.util.ArrayList;

import org.apache.commons.lang3.builder.ToStringBuilder;

import com.fasterxml.jackson.annotation.JsonProperty;

import eu.bittrade.libs.steemj.base.models.operations.Operation;

/**
* This class implements the Steem "get_ops_in_block_return" object.
*
* @author <a href="http://steemit.com/@dez1337">dez1337</a>
*/
public class GetOpsInBlockReturn {
vector< api_operation_object > ops;
@JsonProperty("ops")
private ArrayList<Operation> operations;

/**
* This object is only used to wrap the JSON response in a POJO, so
* therefore this class should not be instantiated.
*/
private GetOpsInBlockReturn() {
}

/**
* @return the operations
*/
public ArrayList<Operation> getOperations() {
return operations;
}

@Override
public String toString() {
return ToStringBuilder.reflectionToString(this);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
package eu.bittrade.libs.steemj.plugins.apis.account.history.models;

import org.apache.commons.lang3.builder.ToStringBuilder;

/**
* This class implements the Steem "get_transaction_args" object.
*
* @author <a href="http://steemit.com/@dez1337">dez1337</a>
*/
public class GetTransactionArgs {
steem::protocol::transaction_id_type id;

@Override
public String toString() {
return ToStringBuilder.reflectionToString(this);
}
}

0 comments on commit d6698bd

Please sign in to comment.