Renamed HistoricalTransfer to OperationHistory
This commit is contained in:
parent
7eef0e9c1c
commit
b9533f4ff6
7 changed files with 12 additions and 10 deletions
0
gradlew
vendored
Normal file → Executable file
0
gradlew
vendored
Normal file → Executable file
|
@ -18,7 +18,7 @@ import cy.agorise.graphenej.UserAccount;
|
||||||
import cy.agorise.graphenej.interfaces.WitnessResponseListener;
|
import cy.agorise.graphenej.interfaces.WitnessResponseListener;
|
||||||
import cy.agorise.graphenej.models.ApiCall;
|
import cy.agorise.graphenej.models.ApiCall;
|
||||||
import cy.agorise.graphenej.models.BaseResponse;
|
import cy.agorise.graphenej.models.BaseResponse;
|
||||||
import cy.agorise.graphenej.models.HistoricalTransfer;
|
import cy.agorise.graphenej.models.OperationHistory;
|
||||||
import cy.agorise.graphenej.models.WitnessResponse;
|
import cy.agorise.graphenej.models.WitnessResponse;
|
||||||
import cy.agorise.graphenej.objects.Memo;
|
import cy.agorise.graphenej.objects.Memo;
|
||||||
import cy.agorise.graphenej.operations.TransferOperation;
|
import cy.agorise.graphenej.operations.TransferOperation;
|
||||||
|
@ -158,12 +158,12 @@ public class GetRelativeAccountHistory extends BaseGrapheneHandler {
|
||||||
|
|
||||||
sendRelativeAccountHistoryRequest();
|
sendRelativeAccountHistoryRequest();
|
||||||
}else if(baseResponse.id >= GET_HISTORY_DATA){
|
}else if(baseResponse.id >= GET_HISTORY_DATA){
|
||||||
Type RelativeAccountHistoryResponse = new TypeToken<WitnessResponse<List<HistoricalTransfer>>>(){}.getType();
|
Type RelativeAccountHistoryResponse = new TypeToken<WitnessResponse<List<OperationHistory>>>(){}.getType();
|
||||||
GsonBuilder gsonBuilder = new GsonBuilder();
|
GsonBuilder gsonBuilder = new GsonBuilder();
|
||||||
gsonBuilder.registerTypeAdapter(TransferOperation.class, new TransferOperation.TransferDeserializer());
|
gsonBuilder.registerTypeAdapter(TransferOperation.class, new TransferOperation.TransferDeserializer());
|
||||||
gsonBuilder.registerTypeAdapter(AssetAmount.class, new AssetAmount.AssetAmountDeserializer());
|
gsonBuilder.registerTypeAdapter(AssetAmount.class, new AssetAmount.AssetAmountDeserializer());
|
||||||
gsonBuilder.registerTypeAdapter(Memo.class, new Memo.MemoDeserializer());
|
gsonBuilder.registerTypeAdapter(Memo.class, new Memo.MemoDeserializer());
|
||||||
WitnessResponse<List<HistoricalTransfer>> transfersResponse = gsonBuilder.create().fromJson(response, RelativeAccountHistoryResponse);
|
WitnessResponse<List<OperationHistory>> transfersResponse = gsonBuilder.create().fromJson(response, RelativeAccountHistoryResponse);
|
||||||
mListener.onSuccess(transfersResponse);
|
mListener.onSuccess(transfersResponse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class SubscriptionMessagesHub extends BaseGrapheneHandler implements Subs
|
||||||
private int subscriptionCounter = 0;
|
private int subscriptionCounter = 0;
|
||||||
private HashMap<Long, BaseGrapheneHandler> mHandlerMap = new HashMap<>();
|
private HashMap<Long, BaseGrapheneHandler> mHandlerMap = new HashMap<>();
|
||||||
private List<BaseGrapheneHandler> pendingHandlerList = new ArrayList<>();
|
private List<BaseGrapheneHandler> pendingHandlerList = new ArrayList<>();
|
||||||
private boolean printLogs;
|
private boolean printLogs = true;
|
||||||
|
|
||||||
// State variables
|
// State variables
|
||||||
private boolean isUnsubscribing;
|
private boolean isUnsubscribing;
|
||||||
|
|
|
@ -10,7 +10,7 @@ import cy.agorise.graphenej.operations.TransferOperation;
|
||||||
* More operations types might be listed in the response of that method, but by using this class
|
* More operations types might be listed in the response of that method, but by using this class
|
||||||
* those will be filtered out of the parsed result.
|
* those will be filtered out of the parsed result.
|
||||||
*/
|
*/
|
||||||
public class HistoricalTransfer {
|
public class OperationHistory {
|
||||||
private String id;
|
private String id;
|
||||||
private TransferOperation op;
|
private TransferOperation op;
|
||||||
public Object[] result;
|
public Object[] result;
|
|
@ -182,6 +182,8 @@ public class SubscriptionResponse {
|
||||||
broadcastedTransaction.setTransactionId(jsonObject.get(BroadcastedTransaction.KEY_TRX_ID).getAsString());
|
broadcastedTransaction.setTransactionId(jsonObject.get(BroadcastedTransaction.KEY_TRX_ID).getAsString());
|
||||||
objectMap.put(ObjectType.TRANSACTION_OBJECT, true);
|
objectMap.put(ObjectType.TRANSACTION_OBJECT, true);
|
||||||
secondArgument.add(broadcastedTransaction);
|
secondArgument.add(broadcastedTransaction);
|
||||||
|
}else if(grapheneObject.getObjectType() == ObjectType.OPERATION_HISTORY_OBJECT){
|
||||||
|
//TODO: Add support for other types of objects
|
||||||
}else{
|
}else{
|
||||||
//TODO: Add support for other types of objects
|
//TODO: Add support for other types of objects
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import java.util.List;
|
||||||
import cy.agorise.graphenej.UserAccount;
|
import cy.agorise.graphenej.UserAccount;
|
||||||
import cy.agorise.graphenej.interfaces.WitnessResponseListener;
|
import cy.agorise.graphenej.interfaces.WitnessResponseListener;
|
||||||
import cy.agorise.graphenej.models.BaseResponse;
|
import cy.agorise.graphenej.models.BaseResponse;
|
||||||
import cy.agorise.graphenej.models.HistoricalTransfer;
|
import cy.agorise.graphenej.models.OperationHistory;
|
||||||
import cy.agorise.graphenej.models.WitnessResponse;
|
import cy.agorise.graphenej.models.WitnessResponse;
|
||||||
import cy.agorise.graphenej.operations.TransferOperation;
|
import cy.agorise.graphenej.operations.TransferOperation;
|
||||||
|
|
||||||
|
@ -51,8 +51,8 @@ public class GetRelativeAccountHistoryTest extends BaseApiTest {
|
||||||
public void onSuccess(WitnessResponse response) {
|
public void onSuccess(WitnessResponse response) {
|
||||||
System.out.println("mTransferHistoryListener.onSuccess");
|
System.out.println("mTransferHistoryListener.onSuccess");
|
||||||
historicalTransferCount++;
|
historicalTransferCount++;
|
||||||
WitnessResponse<List<HistoricalTransfer>> resp = response;
|
WitnessResponse<List<OperationHistory>> resp = response;
|
||||||
for(HistoricalTransfer historicalTransfer : resp.result){
|
for(OperationHistory historicalTransfer : resp.result){
|
||||||
if(historicalTransfer.getOperation() != null){
|
if(historicalTransfer.getOperation() != null){
|
||||||
System.out.println("Got transfer operation!");
|
System.out.println("Got transfer operation!");
|
||||||
TransferOperation transferOperation = historicalTransfer.getOperation();
|
TransferOperation transferOperation = historicalTransfer.getOperation();
|
||||||
|
|
|
@ -10,13 +10,13 @@ import java.util.Timer;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
|
|
||||||
import cy.agorise.graphenej.ObjectType;
|
import cy.agorise.graphenej.ObjectType;
|
||||||
import cy.agorise.graphenej.Transaction;
|
|
||||||
import cy.agorise.graphenej.interfaces.NodeErrorListener;
|
import cy.agorise.graphenej.interfaces.NodeErrorListener;
|
||||||
import cy.agorise.graphenej.interfaces.SubscriptionListener;
|
import cy.agorise.graphenej.interfaces.SubscriptionListener;
|
||||||
import cy.agorise.graphenej.models.BaseResponse;
|
import cy.agorise.graphenej.models.BaseResponse;
|
||||||
import cy.agorise.graphenej.models.BroadcastedTransaction;
|
import cy.agorise.graphenej.models.BroadcastedTransaction;
|
||||||
import cy.agorise.graphenej.models.DynamicGlobalProperties;
|
import cy.agorise.graphenej.models.DynamicGlobalProperties;
|
||||||
import cy.agorise.graphenej.models.SubscriptionResponse;
|
import cy.agorise.graphenej.models.SubscriptionResponse;
|
||||||
|
import cy.agorise.graphenej.Transaction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class used to encapsulate all tests that relate to the {@see SubscriptionMessagesHub} class.
|
* Class used to encapsulate all tests that relate to the {@see SubscriptionMessagesHub} class.
|
||||||
|
@ -178,7 +178,7 @@ public class SubscriptionMessagesHubTest extends BaseApiTest {
|
||||||
@Test
|
@Test
|
||||||
public void testBroadcastedTransactionDeserializer(){
|
public void testBroadcastedTransactionDeserializer(){
|
||||||
try{
|
try{
|
||||||
mMessagesHub = new SubscriptionMessagesHub("", "", mErrorListener);
|
mMessagesHub = new SubscriptionMessagesHub("", "", true, mErrorListener);
|
||||||
mMessagesHub.addSubscriptionListener(new SubscriptionListener() {
|
mMessagesHub.addSubscriptionListener(new SubscriptionListener() {
|
||||||
private int MAX_MESSAGES = 15;
|
private int MAX_MESSAGES = 15;
|
||||||
private int messageCounter = 0;
|
private int messageCounter = 0;
|
||||||
|
|
Loading…
Reference in a new issue