mirror of
https://github.com/gosticks/iota.lib.java.git
synced 2026-09-20 23:20:27 +00:00
implemented getNewAddress command request
This commit is contained in:
@@ -87,11 +87,6 @@ public class IotaAPIProxy {
|
||||
return wrapCheckedException(res).body();
|
||||
}
|
||||
|
||||
public AnalyzeTransactionResponse analyseTransaction(String ... trytes) {
|
||||
final Call<AnalyzeTransactionResponse> res = service.analyzeTransactions(IotaAnalyzeTransactionRequest.createIotaAnalyzeTransactionRequest(trytes));
|
||||
return wrapCheckedException(res).body();
|
||||
}
|
||||
|
||||
public FindTransactionResponse findTransactions(String [] addresses, String [] digests, String [] approvees, String [] bundles ) {
|
||||
|
||||
final IotaFindTransactionsRequest findTransRequest = IotaFindTransactionsRequest
|
||||
@@ -143,6 +138,18 @@ public class IotaAPIProxy {
|
||||
return wrapCheckedException(res).body();
|
||||
}
|
||||
|
||||
public AnalyzeTransactionResponse analyseTransaction(String ... trytes) {
|
||||
final Call<AnalyzeTransactionResponse> res = service.analyzeTransactions(IotaAnalyzeTransactionRequest.createIotaAnalyzeTransactionRequest(trytes));
|
||||
return wrapCheckedException(res).body();
|
||||
}
|
||||
|
||||
public GetNewAddressResponse getNewAddress(String seed, Integer securityLevel) {
|
||||
final Call<GetNewAddressResponse> res = service.getNewAddress(IotaGetNewAddressRequest.createIotaGetNewAddressRequest(seed, securityLevel));
|
||||
return wrapCheckedException(res).body();
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected static <T> Response<T> wrapCheckedException(final Call<T> call) {
|
||||
try {
|
||||
final Response<T> res = call.execute();
|
||||
|
||||
@@ -126,11 +126,17 @@ public interface IotaAPIService {
|
||||
@POST("./")
|
||||
Call<AnalyzeTransactionResponse> analyzeTransactions(@Body IotaAnalyzeTransactionRequest request);
|
||||
|
||||
/*
|
||||
/**
|
||||
* Generates a new address for your specified account (seed + securityLevel).
|
||||
*
|
||||
* curl http://localhost:14265 -X POST -H 'Content-Type: application/json'
|
||||
* -d '{"command": "getNewAddress", "seed": "AAA999999999999999999999999999999999999999999999999999999999999999999999999999999", "securityLevel": 1}'
|
||||
*/
|
||||
@Headers({ CONTENT_TYPE_HEADER, USER_AGENT_HEADER })
|
||||
@POST("./")
|
||||
Call<GetNewAddressResponse> getNewAddress(@Body IotaGetNewAddressRequest request);
|
||||
|
||||
/*
|
||||
@Headers({ CONTENT_TYPE_HEADER, USER_AGENT_HEADER })
|
||||
@POST("./")
|
||||
Call<PrepareTransfersResponse> prepareTransfers(@Body IotaPrepareTransfersRequest request);
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package jota.dto.request;
|
||||
|
||||
import jota.IotaAPICommands;
|
||||
|
||||
public class IotaGetNewAddressRequest extends IotaCommandRequest {
|
||||
|
||||
private String seed;
|
||||
private Integer securityLevel;
|
||||
|
||||
private IotaGetNewAddressRequest(final String seed, final Integer securityLevel) {
|
||||
super(IotaAPICommands.GET_NEW_ADDRESS);
|
||||
this.seed = seed;
|
||||
this.securityLevel = securityLevel;
|
||||
}
|
||||
|
||||
public static IotaGetNewAddressRequest createIotaGetNewAddressRequest(String seed, Integer securityLevel) {
|
||||
return new IotaGetNewAddressRequest(seed, securityLevel);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package jota.dto.response;
|
||||
|
||||
public class GetNewAddressResponse extends AbstractResponse {
|
||||
|
||||
private String address;
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user