mirror of
https://github.com/gosticks/iota.lib.java.git
synced 2026-08-31 05:10:25 +00:00
100% command coverage for IRI 1.1.0
This commit is contained in:
@@ -2,15 +2,17 @@ package jota;
|
||||
|
||||
/**
|
||||
* IOTA's node command list
|
||||
*
|
||||
* 'params' is not currently used.
|
||||
*/
|
||||
public enum IotaAPICommands {
|
||||
|
||||
GET_NODE_INFO("getNodeInfo", 0),
|
||||
GET_NEIGHBORS("getNeighbors", 0),
|
||||
ADD_NEIGHBORS("addNeighbors", 0),
|
||||
REMOVE_NEIGHBORS("removeNeighbors",0),
|
||||
ADD_NEIGHBORS("addNeighbors", 1),
|
||||
REMOVE_NEIGHBORS("removeNeighbors",1),
|
||||
GET_TIPS("getTips",0),
|
||||
FIND_TRANSACTIONS("findTransactions", 0),
|
||||
FIND_TRANSACTIONS("findTransactions", 1),
|
||||
GET_TRYTES("getTrytes", 0),
|
||||
GET_INCLUSIONS_STATES("getInclusionStates", 0),
|
||||
GET_BALANCES("getBalances", 0),
|
||||
@@ -20,7 +22,7 @@ public enum IotaAPICommands {
|
||||
BROADCAST_TRANSACTIONS("broadcastTransactions",0),
|
||||
STORE_TRANSACTIONS("storeTransactions", 0);
|
||||
|
||||
private IotaAPICommands(String command, int params) {
|
||||
IotaAPICommands(String command, int params) {
|
||||
this.command = command;
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
@@ -78,6 +78,16 @@ public class IotaAPIProxy {
|
||||
return wrapCheckedException(res).body();
|
||||
}
|
||||
|
||||
public AddNeighborsResponse addNeighbors(String ... uris) {
|
||||
final Call<AddNeighborsResponse> res = service.addNeighbors(IotaNeighborsRequest.createAddNeighborsRequest(uris));
|
||||
return wrapCheckedException(res).body();
|
||||
}
|
||||
|
||||
public RemoveNeighborsResponse removeNeighbors(String ... uris) {
|
||||
final Call<RemoveNeighborsResponse> res = service.removeNeighbors(IotaNeighborsRequest.createRemoveNeighborsRequest(uris));
|
||||
return wrapCheckedException(res).body();
|
||||
}
|
||||
|
||||
public GetTipsResponse getTips() {
|
||||
final Call<GetTipsResponse> res = service.getTips(IotaCommandRequest.createGetTipsRequest());
|
||||
return wrapCheckedException(res).body();
|
||||
@@ -129,11 +139,35 @@ public class IotaAPIProxy {
|
||||
return wrapCheckedException(res).body();
|
||||
}
|
||||
|
||||
public GetTransactionsToApproveResponse getTransactionsToApprove(String milestone) {
|
||||
final Call<GetTransactionsToApproveResponse> res = service.getTransactionsToApprove(IotaGetTransactionsToApproveRequest.createIotaGetTransactionsToApproveRequest(milestone));
|
||||
public GetTransactionsToApproveResponse getTransactionsToApprove(Integer depth) {
|
||||
final Call<GetTransactionsToApproveResponse> res = service.getTransactionsToApprove(IotaGetTransactionsToApproveRequest.createIotaGetTransactionsToApproveRequest(depth));
|
||||
return wrapCheckedException(res).body();
|
||||
}
|
||||
|
||||
public GetBalancesResponse getBalances(Integer threshold, String [] addresses) {
|
||||
final Call<GetBalancesResponse> res = service.getBalances(IotaGetBalancesRequest.createIotaGetBalancesRequest(threshold, addresses));
|
||||
return wrapCheckedException(res).body();
|
||||
}
|
||||
|
||||
public InterruptAttachingToTangleResponse interruptAttachingToTangle() {
|
||||
final Call<InterruptAttachingToTangleResponse> res = service.interruptAttachingToTangle(IotaCommandRequest.createInterruptAttachToTangleRequest());
|
||||
return wrapCheckedException(res).body();
|
||||
}
|
||||
|
||||
public GetAttachToTangleResponse attachToTangle(String trunkTransaction, String branchTransaction, Integer minWeightMagnitude, String ... trytes) {
|
||||
final Call<GetAttachToTangleResponse> res = service.attachToTangle(IotaAttachToTangleRequest.createAttachToTangleRequest(trunkTransaction, branchTransaction, minWeightMagnitude, trytes));
|
||||
return wrapCheckedException(res).body();
|
||||
}
|
||||
|
||||
public StoreTransactionsResponse storeTransactions(String ... trytes) {
|
||||
final Call<StoreTransactionsResponse> res = service.storeTransactions(IotaStoreTransactionsRequest.createStoreTransactionsRequest(trytes));
|
||||
return wrapCheckedException(res).body();
|
||||
}
|
||||
|
||||
public BroadcastTransactionsResponse broadcastTransactions(String ... trytes) {
|
||||
final Call<BroadcastTransactionsResponse> res = service.broadcastTransactions(IotaBroadcastTransactionRequest.createBroadcastTransactionsRequest(trytes));
|
||||
return wrapCheckedException(res).body();
|
||||
}
|
||||
|
||||
protected static <T> Response<T> wrapCheckedException(final Call<T> call) {
|
||||
try {
|
||||
@@ -159,11 +193,13 @@ public class IotaAPIProxy {
|
||||
}
|
||||
|
||||
private static final String env(String env, String def) {
|
||||
return Optional.ofNullable(System.getenv(env)).orElseGet(() -> {
|
||||
log.warn("Enviroment variable '{}' is not defined, and actual value has not been specified. "
|
||||
final String value = System.getenv(env);
|
||||
if (value == null) {
|
||||
log.warn("Environment variable '{}' is not defined, and actual value has not been specified. "
|
||||
+ "Rolling back to default value: '{}'", env, def);
|
||||
return def;
|
||||
});
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
@@ -192,17 +228,17 @@ public class IotaAPIProxy {
|
||||
final Properties nodeConfig = new Properties();
|
||||
nodeConfig.load(reader);
|
||||
|
||||
Optional.ofNullable(nodeConfig.getProperty("iota.node.protocol"))
|
||||
.filter(v -> protocol == null)
|
||||
.ifPresent(v -> protocol = v);
|
||||
if (nodeConfig.getProperty("iota.node.protocol") != null) {
|
||||
protocol = nodeConfig.getProperty("iota.node.protocol");
|
||||
}
|
||||
|
||||
Optional.ofNullable(nodeConfig.getProperty("iota.node.host"))
|
||||
.filter(v -> host == null)
|
||||
.ifPresent(v -> host = v);
|
||||
if (nodeConfig.getProperty("iota.node.host") != null) {
|
||||
host = nodeConfig.getProperty("iota.node.host");
|
||||
}
|
||||
|
||||
Optional.ofNullable(nodeConfig.getProperty("iota.node.port"))
|
||||
.filter(v -> port == null)
|
||||
.ifPresent(v -> port = v);
|
||||
if (nodeConfig.getProperty("iota.node.port") != null) {
|
||||
port = nodeConfig.getProperty("iota.node.port");
|
||||
}
|
||||
|
||||
} catch (IOException e1) {
|
||||
log.debug("node_config.properties not found. Rolling back for another solution...");
|
||||
@@ -211,18 +247,9 @@ public class IotaAPIProxy {
|
||||
}
|
||||
|
||||
private void checkEnviromentVariables() {
|
||||
|
||||
Optional.of(env("IOTA_NODE_PROTOCOL", "http"))
|
||||
.filter(v -> protocol == null)
|
||||
.ifPresent(v -> protocol = v);
|
||||
|
||||
Optional.ofNullable(env("IOTA_NODE_HOST", "localhost"))
|
||||
.filter(v -> host == null)
|
||||
.ifPresent(v -> host = v);
|
||||
|
||||
Optional.ofNullable(env("IOTA_NODE_PORT", "14265"))
|
||||
.filter(v -> port == null)
|
||||
.ifPresent(v -> port = v);
|
||||
protocol = env("IOTA_NODE_PROTOCOL", "http");
|
||||
host = env("IOTA_NODE_HOST", "localhost");
|
||||
port = env("IOTA_NODE_PORT", "14265");
|
||||
}
|
||||
|
||||
public Builder host(String host) {
|
||||
@@ -241,5 +268,4 @@ public class IotaAPIProxy {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -39,6 +39,26 @@ public interface IotaAPIService {
|
||||
@POST("./")
|
||||
Call<GetNeighborsResponse> getNeighbors(@Body IotaCommandRequest request);
|
||||
|
||||
/**
|
||||
* Add a list of neighbors to your node.
|
||||
*
|
||||
* curl http://localhost:14265 -X POST -H 'Content-Type: application/json'
|
||||
* -d '{"command": "addNeighbors", "uris": ["udp://8.8.8.8:14265", "udp://8.8.8.5:14265"]}'
|
||||
*/
|
||||
@Headers({ CONTENT_TYPE_HEADER, USER_AGENT_HEADER })
|
||||
@POST("./")
|
||||
Call<AddNeighborsResponse> addNeighbors(@Body IotaNeighborsRequest request);
|
||||
|
||||
/**
|
||||
* Removes a list of neighbors to your node.
|
||||
*
|
||||
* curl http://localhost:14265 -X POST -H 'Content-Type: application/json'
|
||||
* -d '{"command": "removeNeighbors", "uris": ["udp://8.8.8.8:14265", "udp://8.8.8.5:14265"]}'
|
||||
*/
|
||||
@Headers({ CONTENT_TYPE_HEADER, USER_AGENT_HEADER })
|
||||
@POST("./")
|
||||
Call<RemoveNeighborsResponse> removeNeighbors(@Body IotaNeighborsRequest request);
|
||||
|
||||
/**
|
||||
* Get the list of latest tips (unconfirmed transactions).
|
||||
*
|
||||
@@ -85,68 +105,59 @@ public interface IotaAPIService {
|
||||
* Tip selection which returns trunkTransaction and branchTransaction. The input value is the latest coordinator milestone, as provided through the getNodeInfo API call.
|
||||
*
|
||||
* curl http://localhost:14265 -X POST -H 'Content-Type: application/json'
|
||||
* -d '{"command": "getTransactionsToApprove", "milestone": "SMYMAKKPSUKCKDRUEYCGZJTYCZ9HHDMDUWBAPXARGURPQRHTAJDASRWMIDTPTBNDKDEFBUTBGGAFX9999"}'
|
||||
* -d '{"command": "getTransactionsToApprove", "depth": 27}'
|
||||
*/
|
||||
@Headers({ CONTENT_TYPE_HEADER, USER_AGENT_HEADER })
|
||||
@POST("./")
|
||||
Call<GetTransactionsToApproveResponse> getTransactionsToApprove(@Body IotaGetTransactionsToApproveRequest request);
|
||||
|
||||
/*
|
||||
/**
|
||||
* It returns the confirmed balance which a list of addresses have at the latest confirmed milestone.
|
||||
*
|
||||
* curl http://localhost:14265 -X POST -H 'Content-Type: application/json'
|
||||
* -d '{"command": "getBalances", "addresses": ["HBBYKAKTILIPVUKFOTSLHGENPTXYBNKXZFQFR9VQFWNBMTQNRVOUKPVPRNBSZVVILMAFBKOTBLGLWLOHQ"], "threshold": 100}'
|
||||
*/
|
||||
@Headers({ CONTENT_TYPE_HEADER, USER_AGENT_HEADER })
|
||||
@POST("./")
|
||||
Call<GetBalancesResponse> getBalances(@Body IotaGetBalancesRequest request);
|
||||
|
||||
/**
|
||||
* Attaches the specified transactions (trytes) to the Tangle by doing Proof of Work.
|
||||
*
|
||||
* curl http://localhost:14265 -X POST -H 'Content-Type: application/json'
|
||||
* -d '{"command": "attachToTangle", "trunkTransaction": "JVMTDGDPDFYHMZPMWEKKANBQSLSDTIIHAYQUMZOKHXXXGJHJDQPOMDOMNRDKYCZRUFZROZDADTHZC9999", "branchTransaction": "P9KFSJVGSPLXAEBJSHWFZLGP9GGJTIO9YITDEHATDTGAFLPLBZ9FOFWWTKMAZXZHFGQHUOXLXUALY9999", "minWeightMagnitude": 18, "trytes": ["TRYTVALUEHERE"]}'
|
||||
*/
|
||||
@Headers({ CONTENT_TYPE_HEADER, USER_AGENT_HEADER })
|
||||
@POST("./")
|
||||
Call<GetAttachToTangleResponse> attachToTangle(@Body IotaAttachToTangleRequest request);
|
||||
|
||||
/**
|
||||
* Interrupts and completely aborts the attachToTangle process.
|
||||
*
|
||||
* curl http://localhost:14265 -X POST -H 'Content-Type: application/json'
|
||||
* -d '{"command": "interruptAttachingToTangle" }
|
||||
*/
|
||||
@Headers({ CONTENT_TYPE_HEADER, USER_AGENT_HEADER })
|
||||
@POST("./")
|
||||
Call<InterruptAttachingToTangleResponse> interruptAttachingToTangle(@Body IotaInterruptAttachingToTangleRequest request);
|
||||
Call<InterruptAttachingToTangleResponse> interruptAttachingToTangle(@Body IotaCommandRequest request);
|
||||
|
||||
/**
|
||||
* Broadcast a list of transactions to all neighbors. The input trytes for this call are provided by attachToTangle.
|
||||
*
|
||||
* curl http://localhost:14265 -X POST -H 'Content-Type: application/json'
|
||||
* -d '{"command": "broadcastTransactions", "trytes": ["BYSWEAUTWXHXZ9YBZISEK9LUHWGMHXCGEVNZHRLUWQFCUSDXZHOFHWHL9MQPVJXXZLIXPXPXF9KYEREFSKCPKYIIKPZVLHUTDFQKKVVBBN9ATTLPCNPJDWDEVIYYLGPZGCWXOBDXMLJC9VO9QXTTBLAXTTBFUAROYEGQIVB9MJWJKXJMCUPTWAUGFZBTZCSJVRBGMYXTVBDDS9MYUJCPZ9YDWWQNIPUAIJXXSNLKUBSCOIJPCLEFPOXFJREXQCUVUMKSDOVQGGHRNILCO9GNCLWFM9APMNMWYASHXQAYBEXF9QRIHIBHYEJOYHRQJAOKAQ9AJJFQ9WEIWIJOTZATIBOXQLBMIJU9PCGBLVDDVFP9CFFSXTDUXMEGOOFXWRTLFGV9XXMYWEMGQEEEDBTIJ9OJOXFAP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AJNUJ9BKYYXSV9JSPEXYMCFAIKTGNRSQGUNIYZCRT9FOWENSZQPD9ALUPYYAVICHVYELYFPUYDTWUSWNIYFXPX9MICCCOOZIWRNJIDALWGWRATGLJXNAYTNIZWQ9YTVDBOFZRKO9CFWRPAQQRXTPACOWCPRLYRYSJARRKSQPR9TCFXDVIXLP9XVL99ERRDSOHBFJDJQQGGGCZNDQ9NYCTQJWVZIAELCRBJJFDMCNZU9FIZRPGNURTXOCDSQGXTQHKHUECGWFUUYS9J9NYQ9U9P9UUP9YMZHWWWCIASCFLCMSKTELZWUGCDE9YOKVOVKTAYPHDF9ZCCQAYPJIJNGSHUIHHCOSSOOBUDOKE9CJZGYSSGNCQJVBEFTZFJ9SQUHOASKRRGBSHWKBCBWBTJHOGQ9WOMQFHWJVEG9NYX9KWBTCAIXNXHEBDIOFO9ALYMFGRICLCKKLG9FOBOX9PDWNQRGHBKHGKKRLWTBEQMCWQRLHAVYYZDIIPKVQTHYTWQMTOACXZOQCDTJTBAAUWXSGJF9PNQIJ9AJRUMUVCPWYVYVARKR9RKGOUHHNKNVGGPDDLGKPQNOYHNKAVVKCXWXOQPZNSLATUJT9AUWRMPPSWHSTTYDFAQDXOCYTZHOYYGAIM9CELMZ9AZPWB9MJXGHOKDNNSZVUDAGXTJJSSZCPZVPZBYNNTUQABSXQWZCHDQSLGK9UOHCFKBIBNETK999999999999999999999999999999999999999999999999999999999999999999999999999999999NOXDXXKUDWLOFJLIPQIBRBMGDYCPGDNLQOLQS99EQYKBIU9VHCJVIPFUYCQDNY9APGEVYLCENJIOBLWNB999999999XKBRHUD99C99999999NKZKEKWLDKMJCI9N9XQOLWEPAYWSH9999999999999999999999999KDDTGZLIPBNZKMLTOLOXQVNGLASESDQVPTXALEKRMIOHQLUHD9ELQDBQETS9QFGTYOYWLNTSKKMVJAUXSIROUICDOXKSYZTDPEDKOQENTJOWJONDEWROCEJIEWFWLUAACVSJFTMCHHXJBJRKAAPUDXXVXFWP9X9999IROUICDOXKSYZTDPEDKOQENTJOWJONDEWROCEJIEWFWLUAACVSJFTMCHHXJBJRKAAPUDXXVXFWP9X9999"]}
|
||||
*/
|
||||
@Headers({ CONTENT_TYPE_HEADER, USER_AGENT_HEADER })
|
||||
@POST("./")
|
||||
Call<PushTransactionsResponse> pushTransactions(@Body IotaPushTransactionsRequest request);
|
||||
Call<BroadcastTransactionsResponse> broadcastTransactions(@Body IotaBroadcastTransactionRequest request);
|
||||
|
||||
/**
|
||||
* Store transactions into the local storage. The trytes to be used for this call are returned by attachToTangle.
|
||||
*
|
||||
* curl http://localhost:14265 -X POST -H 'Content-Type: application/json'
|
||||
* -d '{"command": "storeTransactions", "trytes": ["BYSWEAUTWXHXZ9YBZISEK9LUHWGMHXCGEVNZHRLUWQFCUSDXZHOFHWHL9MQPVJXXZLIXPXPXF9KYEREFSKCPKYIIKPZVLHUTDFQKKVVBBN9ATTLPCNPJDWDEVIYYLGPZGCWXOBDXMLJC9VO9QXTTBLAXTTBFUAROYEGQIVB9MJWJKXJMCUPTWAUGFZBTZCSJVRBGMYXTVBDDS9MYUJCPZ9YDWWQNIPUAIJXXSNLKUBSCOIJPCLEFPOXFJREXQCUVUMKSDOVQGGHRNILCO9GNCLWFM9APMNMWYASHXQAYBEXF9QRIHIBHYEJOYHRQJAOKAQ9AJJFQ9WEIWIJOTZATIBOXQLBMIJU9PCGBLVDDVFP9CFFSXTDUXMEGOOFXWRTLFGV9XXMYWEMGQEEEDBTIJ9OJOXFAPFQXCDAXOUDMLVYRMRLUDBETOLRJQAEDDLNVIRQJUBZBO9CCFDHIX9MSQCWYAXJVWHCUPTRSXJDESISQPRKZAFKFRULCGVRSBLVFOPEYLEE99JD9SEBALQINPDAZHFAB9RNBH9AZWIJOTLBZVIEJIAYGMC9AZGNFWGRSWAXTYSXVROVNKCOQQIWGPNQZKHUNODGYADPYLZZZUQRTJRTODOUKAOITNOMWNGHJBBA99QUMBHRENGBHTH9KHUAOXBVIVDVYYZMSEYSJWIOGGXZVRGN999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9U9P9UUP9YMZHWWWCIASCFLCMSKTELZWUGCDE9YOKVOVKTAYPHDF9ZCCQAYPJIJNGSHUIHHCOSSOOBUDOKE9CJZGYSSGNCQJVBEFTZFJ9SQUHOASKRRGBSHWKBCBWBTJHOGQ9WOMQFHWJVEG9NYX9KWBTCAIXNXHEBDIOFO9ALYMFGRICLCKKLG9FOBOX9PDWNQRGHBKHGKKRLWTBEQMCWQRLHAVYYZDIIPKVQTHYTWQMTOACXZOQCDTJTBAAUWXSGJF9PNQIJ9AJRUMUVCPWYVYVARKR9RKGOUHHNKNVGGPDDLGKPQNOYHNKAVVKCXWXOQPZNSLATUJT9AUWRMPPSWHSTTYDFAQDXOCYTZHOYYGAIM9CELMZ9AZPWB9MJXGHOKDNNSZVUDAGXTJJSSZCPZVPZBYNNTUQABSXQWZCHDQSLGK9UOHCFKBIBNETK999999999999999999999999999999999999999999999999999999999999999999999999999999999NOXDXXKUDWLOFJLIPQIBRBMGDYCPGDNLQOLQS99EQYKBIU9VHCJVIPFUYCQDNY9APGEVYLCENJIOBLWNB999999999XKBRHUD99C99999999NKZKEKWLDKMJCI9N9XQOLWEPAYWSH9999999999999999999999999KDDTGZLIPBNZKMLTOLOXQVNGLASESDQVPTXALEKRMIOHQLUHD9ELQDBQETS9QFGTYOYWLNTSKKMVJAUXSIROUICDOXKSYZTDPEDKOQENTJOWJONDEWROCEJIEWFWLUAACVSJFTMCHHXJBJRKAAPUDXXVXFWP9X9999IROUICDOXKSYZTDPEDKOQENTJOWJONDEWROCEJIEWFWLUAACVSJFTMCHHXJBJRKAAPUDXXVXFWP9X9999"]}'
|
||||
*/
|
||||
@Headers({ CONTENT_TYPE_HEADER, USER_AGENT_HEADER })
|
||||
@POST("./")
|
||||
Call<StoreTransactionsResponse> storeTransactions(@Body IotaStoreTransactionsRequest request);
|
||||
|
||||
@Headers({ CONTENT_TYPE_HEADER, USER_AGENT_HEADER })
|
||||
@POST("./")
|
||||
Call<TransferResponse> transfer(@Body IotaTransferRequest request);
|
||||
|
||||
@Headers({ CONTENT_TYPE_HEADER, USER_AGENT_HEADER })
|
||||
@POST("./")
|
||||
Call<ReplayTransferResponse> replayTransfer(@Body IotaReplayTransferRequest request);
|
||||
|
||||
@Headers({ CONTENT_TYPE_HEADER, USER_AGENT_HEADER })
|
||||
@POST("./")
|
||||
Call<PullTransactionsResponse> pullTransactions(@Body IotaPullTransactionsRequest request);
|
||||
|
||||
* Get the list of transactions which were bundled with the specified tail transaction.
|
||||
* This call returns the full value of all individual transactions, not just the hashes.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package jota.dto.request;
|
||||
|
||||
import jota.IotaAPICommands;
|
||||
|
||||
public class IotaAttachToTangleRequest extends IotaCommandRequest {
|
||||
|
||||
private String trunkTransaction;
|
||||
private String branchTransaction;
|
||||
private Integer minWeightMagnitude;
|
||||
private String [] trytes;
|
||||
|
||||
private IotaAttachToTangleRequest(final String trunkTransaction, final String branchTransaction, final Integer minWeightMagnitude, final String ... trytes) {
|
||||
super(IotaAPICommands.ATTACH_TO_TANGLE);
|
||||
this.trunkTransaction = trunkTransaction;
|
||||
this.branchTransaction = branchTransaction;
|
||||
this.minWeightMagnitude = minWeightMagnitude;
|
||||
this.trytes = trytes;
|
||||
}
|
||||
|
||||
public static IotaAttachToTangleRequest createAttachToTangleRequest(final String trunkTransaction, final String branchTransaction, final Integer minWeightMagnitude, final String ... trytes) {
|
||||
return new IotaAttachToTangleRequest(trunkTransaction, branchTransaction, minWeightMagnitude, trytes);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package jota.dto.request;
|
||||
|
||||
import jota.IotaAPICommands;
|
||||
|
||||
public class IotaBroadcastTransactionRequest extends IotaCommandRequest {
|
||||
|
||||
private String [] trytes;
|
||||
|
||||
private IotaBroadcastTransactionRequest(final String ... trytes) {
|
||||
super(IotaAPICommands.BROADCAST_TRANSACTIONS);
|
||||
this.trytes = trytes;
|
||||
}
|
||||
|
||||
public static IotaBroadcastTransactionRequest createBroadcastTransactionsRequest(final String ... trytes) {
|
||||
return new IotaBroadcastTransactionRequest(trytes);
|
||||
}
|
||||
}
|
||||
@@ -21,4 +21,8 @@ public class IotaCommandRequest {
|
||||
public static IotaCommandRequest createGetNeighborsRequest() {
|
||||
return new IotaCommandRequest(IotaAPICommands.GET_NEIGHBORS);
|
||||
}
|
||||
|
||||
public static IotaCommandRequest createInterruptAttachToTangleRequest() {
|
||||
return new IotaCommandRequest(IotaAPICommands.INTERRUPT_ATTACHING_TO_TANGLE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,4 @@ public class IotaFindTransactionsRequest extends IotaCommandRequest {
|
||||
this.approvees = approvees;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package jota.dto.request;
|
||||
|
||||
import jota.IotaAPICommands;
|
||||
|
||||
public class IotaGetBalancesRequest extends IotaCommandRequest {
|
||||
|
||||
private String [] addresses;
|
||||
private Integer threshold;
|
||||
|
||||
private IotaGetBalancesRequest(final Integer threshold, final String ... addresses) {
|
||||
super(IotaAPICommands.GET_BALANCES);
|
||||
this.addresses = addresses;
|
||||
this.threshold = threshold;
|
||||
}
|
||||
|
||||
public static IotaGetBalancesRequest createIotaGetBalancesRequest(final Integer threshold, final String ... addresses) {
|
||||
return new IotaGetBalancesRequest(threshold, addresses);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,14 +4,14 @@ import jota.IotaAPICommands;
|
||||
|
||||
public class IotaGetTransactionsToApproveRequest extends IotaCommandRequest {
|
||||
|
||||
private String milestone;
|
||||
private Integer depth;
|
||||
|
||||
private IotaGetTransactionsToApproveRequest(final String milestone) {
|
||||
private IotaGetTransactionsToApproveRequest(final Integer depth) {
|
||||
super(IotaAPICommands.GET_TRANSACTIONS_TO_APPROVE);
|
||||
this.milestone = milestone;
|
||||
this.depth = depth;
|
||||
}
|
||||
|
||||
public static IotaGetTransactionsToApproveRequest createIotaGetTransactionsToApproveRequest(String milestone) {
|
||||
return new IotaGetTransactionsToApproveRequest(milestone);
|
||||
public static IotaGetTransactionsToApproveRequest createIotaGetTransactionsToApproveRequest(Integer depth) {
|
||||
return new IotaGetTransactionsToApproveRequest(depth);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package jota.dto.request;
|
||||
|
||||
import jota.IotaAPICommands;
|
||||
|
||||
public class IotaNeighborsRequest extends IotaCommandRequest {
|
||||
|
||||
private String [] uris;
|
||||
|
||||
private IotaNeighborsRequest(IotaAPICommands type, final String ... uris) {
|
||||
super(type);
|
||||
this.uris = uris;
|
||||
}
|
||||
|
||||
public static IotaNeighborsRequest createAddNeighborsRequest(String ... uris) {
|
||||
return new IotaNeighborsRequest(IotaAPICommands.ADD_NEIGHBORS, uris);
|
||||
}
|
||||
|
||||
public static IotaNeighborsRequest createRemoveNeighborsRequest(String ... uris) {
|
||||
return new IotaNeighborsRequest(IotaAPICommands.REMOVE_NEIGHBORS, uris);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package jota.dto.request;
|
||||
|
||||
import jota.IotaAPICommands;
|
||||
|
||||
public class IotaStoreTransactionsRequest extends IotaCommandRequest {
|
||||
|
||||
private String [] trytes;
|
||||
|
||||
private IotaStoreTransactionsRequest(final String ... trytes) {
|
||||
super(IotaAPICommands.STORE_TRANSACTIONS);
|
||||
this.trytes = trytes;
|
||||
}
|
||||
|
||||
public static IotaStoreTransactionsRequest createStoreTransactionsRequest(final String ... trytes) {
|
||||
return new IotaStoreTransactionsRequest(trytes);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package jota.dto.response;
|
||||
|
||||
public class AddNeighborsResponse extends AbstractResponse {
|
||||
|
||||
private int addedNeighbors;
|
||||
|
||||
public int getAddedNeighbors() {
|
||||
return addedNeighbors;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package jota.dto.response;
|
||||
|
||||
public class BroadcastTransactionsResponse extends AbstractResponse {
|
||||
// empty response
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package jota.dto.response;
|
||||
|
||||
public class GetAttachToTangleResponse extends AbstractResponse {
|
||||
|
||||
private String [] trytes;
|
||||
|
||||
public String[] getTrytes() {
|
||||
return trytes;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package jota.dto.response;
|
||||
|
||||
public class GetBalancesResponse extends AbstractResponse {
|
||||
|
||||
private String [] balances;
|
||||
private String milestone;
|
||||
private Integer milestoneIndex;
|
||||
|
||||
public Integer getMilestoneIndex() {
|
||||
return milestoneIndex;
|
||||
}
|
||||
|
||||
public String getMilestone() {
|
||||
return milestone;
|
||||
}
|
||||
|
||||
public String[] getBalances() {
|
||||
return balances;
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,10 @@ package jota.dto.response;
|
||||
public class GetTransactionsToApproveResponse extends AbstractResponse {
|
||||
|
||||
private String trunkTransaction;
|
||||
private String branchTransaction;
|
||||
private String branchTransactionToApprove;
|
||||
|
||||
public String getBranchTransaction() {
|
||||
return branchTransaction;
|
||||
public String getBranchTransactionToApprove() {
|
||||
return branchTransactionToApprove;
|
||||
}
|
||||
public String getTrunkTransaction() {
|
||||
return trunkTransaction;
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package jota.dto.response;
|
||||
|
||||
public class InterruptAttachingToTangleResponse extends AbstractResponse {
|
||||
// empty response
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package jota.dto.response;
|
||||
|
||||
public class RemoveNeighborsResponse extends AbstractResponse {
|
||||
|
||||
private int removedNeighbors;
|
||||
|
||||
public int getRemovedNeighbors() {
|
||||
return removedNeighbors;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package jota.dto.response;
|
||||
|
||||
public class StoreTransactionsResponse extends AbstractResponse {
|
||||
// empty response
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user