This is my code for transaction history:
@RequestMapping(value = EmpRestURIConstants.TRANS_HIS, method = RequestMethod.POST)
public @ResponseBody TransactionsRequestBuilder transactionHistory(@RequestBody stellarModel stellm) {
logger.info("Start transactionHistory.");
KeyPair source = KeyPair.fromSecretSeed(stellm.getSeed());
TransactionsRequestBuilder tr = server.transactions().forAccount(source);
return tr;
}
It gives following error:
2019-04-15 11:47:01.839 WARN 18689 --- [nio-8080-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.http.converter.HttpMessageNotWritableException: No converter found for return value of type: class org.stellar.sdk.requests.TransactionsRequestBuilder]
I am stuck with this for two days,any help would be greatly apreciated
Try this as suggested:
@RequestMapping(value = StellRestURIConstants.TRANS_HIS, method = RequestMethod.POST)
public @ResponseBody ArrayList<TransactionResponse> transactionHistory(@RequestBody stellarModel stellm) {
logger.info("Start transactionHistory.");
ArrayList<TransactionResponse> arr = new ArrayList<TransactionResponse>();
KeyPair source = KeyPair.fromSecretSeed(stellm.getSeed());
TransactionsRequestBuilder tr = server.transactions().forAccount(source);
try {
arr = tr.execute().getRecords() ;
} catch (TooManyRequestsException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("aaaaaaaa");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("bbbbbbb");
}
return arr;
}
It gives below error:
"timestamp": "2019-04-15T10:34:50.439+0000",
"status": 500,
"error": "Internal Server Error",
"message": "Could not write JSON: (was java.lang.NullPointerException); nested exception is com.fasterxml.jackson.databind.JsonMappingException: (was java.lang.NullPointerException) (through reference chain: java.util.ArrayList[0]->org.stellar.sdk.responses.TransactionResponse[\"sourceAccount\"]->org.stellar.sdk.KeyPair[\"secretSeed\"])",
"path": "/transaction_history"
Keypair
a keypair object that represents both, secret seed and public id? I'd assume you have to pass the public String "G...." only.