diff --git a/jota/src/main/java/jota/IotaAPI.java b/jota/src/main/java/jota/IotaAPI.java index effa48a..20d3b76 100644 --- a/jota/src/main/java/jota/IotaAPI.java +++ b/jota/src/main/java/jota/IotaAPI.java @@ -14,13 +14,13 @@ import java.util.*; /** * IotaAPI Builder. Usage: - *

+ * * IotaApiProxy api = IotaApiProxy.Builder * .protocol("http") * .nodeAddress("localhost") * .port(12345) * .build(); - *

+ * * GetNodeInfoResponse response = api.getNodeInfo(); * * @author davassi @@ -730,7 +730,6 @@ public class IotaAPI extends IotaAPICore { * @throws InvalidBundleException is thrown if an invalid bundle was found or provided. * @throws ArgumentException is thrown when an invalid argument is provided. * @throws InvalidSignatureException is thrown when an invalid signature is encountered. - * @throws InvalidTransferException is thrown when an invalid transfer is provided. */ public ReplayBundleResponse replayBundle(String transaction, int depth, int minWeightMagnitude) throws InvalidBundleException, ArgumentException, InvalidSignatureException, InvalidTrytesException { StopWatch stopWatch = new StopWatch(); diff --git a/jota/src/main/java/jota/IotaAPICommands.java b/jota/src/main/java/jota/IotaAPICommands.java index fe66f1b..55de26e 100644 --- a/jota/src/main/java/jota/IotaAPICommands.java +++ b/jota/src/main/java/jota/IotaAPICommands.java @@ -2,50 +2,42 @@ 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", 1), - REMOVE_NEIGHBORS("removeNeighbors", 1), - GET_TIPS("getTips", 0), - FIND_TRANSACTIONS("findTransactions", 1), - GET_TRYTES("getTrytes", 0), - GET_INCLUSIONS_STATES("getInclusionStates", 0), - GET_BALANCES("getBalances", 0), - GET_TRANSACTIONS_TO_APPROVE("getTransactionsToApprove", 0), - ATTACH_TO_TANGLE("attachToTangle", 0), - INTERRUPT_ATTACHING_TO_TANGLE("interruptAttachingToTangle", 0), - BROADCAST_TRANSACTIONS("broadcastTransactions", 0), - STORE_TRANSACTIONS("storeTransactions", 0); + GET_NODE_INFO("getNodeInfo"), + GET_NEIGHBORS("getNeighbors"), + ADD_NEIGHBORS("addNeighbors"), + REMOVE_NEIGHBORS("removeNeighbors"), + GET_TIPS("getTips"), + FIND_TRANSACTIONS("findTransactions"), + GET_TRYTES("getTrytes"), + GET_INCLUSIONS_STATES("getInclusionStates"), + GET_BALANCES("getBalances"), + GET_TRANSACTIONS_TO_APPROVE("getTransactionsToApprove"), + ATTACH_TO_TANGLE("attachToTangle"), + INTERRUPT_ATTACHING_TO_TANGLE("interruptAttachingToTangle"), + BROADCAST_TRANSACTIONS("broadcastTransactions"), + STORE_TRANSACTIONS("storeTransactions"); private String command; - private int params; /** - * @param command - * @param params + * Initializes a new instance of the IotaAPICommands class. */ - IotaAPICommands(String command, int params) { + IotaAPICommands(String command) { this.command = command; - this.params = params; } /** - * @return + * Gets the command. + * + * @return The command. */ public String command() { return command; } - /** - * @return - */ - public int params() { - return params; - } } diff --git a/jota/src/main/java/jota/IotaAPICore.java b/jota/src/main/java/jota/IotaAPICore.java index 3aa82a9..528cd84 100644 --- a/jota/src/main/java/jota/IotaAPICore.java +++ b/jota/src/main/java/jota/IotaAPICore.java @@ -53,11 +53,6 @@ public class IotaAPICore { postConstruct(); } - /** - * @param call - * @param - * @return - */ protected static Response wrapCheckedException(final Call call) { try { final Response res = call.execute(); @@ -85,11 +80,6 @@ public class IotaAPICore { } - /** - * @param env - * @param def - * @return - */ private static String env(String env, String def) { final String value = System.getenv(env); if (value == null) { @@ -101,7 +91,7 @@ public class IotaAPICore { } /** - * added header for IRI 1.4.1 + * added header for IRI */ private void postConstruct() { @@ -138,31 +128,62 @@ public class IotaAPICore { log.debug("Jota-API Java proxy pointing to node url: '{}'", nodeUrl); } + /** + * Get the node information. + * + * @return The information about your node. + */ public GetNodeInfoResponse getNodeInfo() { final Call res = service.getNodeInfo(IotaCommandRequest.createNodeInfoRequest()); return wrapCheckedException(res).body(); } + /** + * Get the list of neighbors from your node. + * + * @return The set of neighbors you are connected with. + */ public GetNeighborsResponse getNeighbors() { final Call res = service.getNeighbors(IotaCommandRequest.createGetNeighborsRequest()); return wrapCheckedException(res).body(); } + /** + * Add a list of neighbors to your node. + * + * @param uris The list of URI elements. + */ public AddNeighborsResponse addNeighbors(String... uris) { final Call res = service.addNeighbors(IotaNeighborsRequest.createAddNeighborsRequest(uris)); return wrapCheckedException(res).body(); } + /** + * Removes a list of neighbors from your node. + * + * @param uris The list of URI elements. + */ public RemoveNeighborsResponse removeNeighbors(String... uris) { final Call res = service.removeNeighbors(IotaNeighborsRequest.createRemoveNeighborsRequest(uris)); return wrapCheckedException(res).body(); } + /** + * Get the list of latest tips (unconfirmed transactions). + * + * @return The the list of tips. + */ public GetTipsResponse getTips() { final Call res = service.getTips(IotaCommandRequest.createGetTipsRequest()); return wrapCheckedException(res).body(); } + + /** + * Find the transactions which match the specified input + * + * @return The transaction hashes which are returned depend on your input. + */ public FindTransactionResponse findTransactions(String[] addresses, String[] tags, String[] approvees, String[] bundles) { final IotaFindTransactionsRequest findTransRequest = IotaFindTransactionsRequest @@ -176,52 +197,115 @@ public class IotaAPICore { return wrapCheckedException(res).body(); } + /** + * Find the transactions by addresses + * + * @param addresses A List of addresses. + * @return The transaction hashes which are returned depend on your input. + */ public FindTransactionResponse findTransactionsByAddresses(final String... addresses) { return findTransactions(addresses, null, null, null); } + /** + * Find the transactions by bundles + * + * @param bundles A List of bundles. + * @return The transaction hashes which are returned depend on your input. + */ public FindTransactionResponse findTransactionsByBundles(final String... bundles) { return findTransactions(null, null, null, bundles); } + /** + * Find the transactions by approvees + * + * @param approvees A List of approvess. + * @return The transaction hashes which are returned depend on your input. + */ public FindTransactionResponse findTransactionsByApprovees(final String... approvees) { return findTransactions(null, null, approvees, null); } + + /** + * Find the transactions by digests + * + * @param digests A List of digests. + * @return The transaction hashes which are returned depend on your input. + */ public FindTransactionResponse findTransactionsByDigests(final String... digests) { return findTransactions(null, digests, null, null); } + + /** + * Get the inclusion states of a set of transactions. This is for determining if a transaction was accepted and confirmed by the network or not. You can search for multiple tips (and thus, milestones) to get past inclusion states of transactions. + * + * @param transactions The ist of transactions you want to get the inclusion state for. + * @param tips ThelList of tips (including milestones) you want to search for the inclusion state. + * @return The inclusion states of a set of transactions. + */ public GetInclusionStateResponse getInclusionStates(String[] transactions, String[] tips) { final Call res = service.getInclusionStates(IotaGetInclusionStateRequest .createGetInclusionStateRequest(transactions, tips)); return wrapCheckedException(res).body(); } + /** + * Returns the raw trytes data of a transaction. + * + * @param hashes The of transaction hashes of which you want to get trytes from. + * @return The the raw transaction data (trytes) of a specific transaction. + */ public GetTrytesResponse getTrytes(String... hashes) { final Call res = service.getTrytes(IotaGetTrytesRequest.createGetTrytesRequest(hashes)); return wrapCheckedException(res).body(); } + + /** + * Tip selection which returns trunkTransaction and branchTransaction. The input value is the latest coordinator milestone, as provided through the getNodeInfo API call. + * + * @param depth The number of bundles to go back to determine the transactions for approval. + * @return The Tip selection which returns trunkTransaction and branchTransaction + */ public GetTransactionsToApproveResponse getTransactionsToApprove(Integer depth) { final Call res = service.getTransactionsToApprove(IotaGetTransactionsToApproveRequest.createIotaGetTransactionsToApproveRequest(depth)); return wrapCheckedException(res).body(); } + /** + * It returns the confirmed balance which a list of addresses have at the latest confirmed milestone. + * + * @param threshold The confirmation threshold, should be set to 100. + * @param addresses The array list of addresses you want to get the confirmed balance from. + * @return The confirmed balance which a list of addresses have at the latest confirmed milestone. + */ public GetBalancesResponse getBalances(Integer threshold, String[] addresses) { final Call res = service.getBalances(IotaGetBalancesRequest.createIotaGetBalancesRequest(threshold, addresses)); return wrapCheckedException(res).body(); } + /** + * It returns the confirmed balance which a list of addresses have at the latest confirmed milestone. + * + * @param threshold The confirmation threshold, should be set to 100. + * @param addresses The list of addresses you want to get the confirmed balance from. + * @return The confirmed balance which a list of addresses have at the latest confirmed milestone. + */ public GetBalancesResponse getBalances(Integer threshold, List addresses) { return getBalances(threshold, addresses.toArray(new String[]{})); } - public InterruptAttachingToTangleResponse interruptAttachingToTangle() { - final Call res = service.interruptAttachingToTangle(IotaCommandRequest.createInterruptAttachToTangleRequest()); - return wrapCheckedException(res).body(); - } - + /** + * Attaches the specified transactions (trytes) to the Tangle by doing Proof of Work. + * + * @param trunkTransaction The trunk transaction to approve. + * @param branchTransaction The branch transaction to approve. + * @param minWeightMagnitude The Proof of Work intensity. + * @param trytes A List of trytes (raw transaction data) to attach to the tangle. + */ public GetAttachToTangleResponse attachToTangle(String trunkTransaction, String branchTransaction, Integer minWeightMagnitude, String... trytes) throws InvalidTrytesException { if (!InputValidator.isArrayOfTrytes(trytes)) { throw new InvalidTrytesException(); @@ -249,29 +333,61 @@ public class IotaAPICore { return wrapCheckedException(res).body(); } - public StoreTransactionsResponse storeTransactions(String... trytes) { - final Call res = service.storeTransactions(IotaStoreTransactionsRequest.createStoreTransactionsRequest(trytes)); + /** + * Interrupts and completely aborts the attachToTangle process. + */ + public InterruptAttachingToTangleResponse interruptAttachingToTangle() { + final Call res = service.interruptAttachingToTangle(IotaCommandRequest.createInterruptAttachToTangleRequest()); return wrapCheckedException(res).body(); } + /** + * Broadcast a list of transactions to all neighbors. The input trytes for this call are provided by attachToTangle. + * + * @param trytes The list of raw data of transactions to be rebroadcast. + */ public BroadcastTransactionsResponse broadcastTransactions(String... trytes) { final Call res = service.broadcastTransactions(IotaBroadcastTransactionRequest.createBroadcastTransactionsRequest(trytes)); return wrapCheckedException(res).body(); } + /** + * Store transactions into the local storage. The trytes to be used for this call are returned by attachToTangle. + * + * @param trytes The list of raw data of transactions to be rebroadcast. + */ + public StoreTransactionsResponse storeTransactions(String... trytes) { + final Call res = service.storeTransactions(IotaStoreTransactionsRequest.createStoreTransactionsRequest(trytes)); + return wrapCheckedException(res).body(); + } + + /** + * Gets the protocol. + * + * @return The protocol to use when connecting to the remote node. + */ public String getProtocol() { return protocol; } + /** + * Gets the host. + * + * @return The host you want to connect to. + */ public String getHost() { return host; } + /** + * Gets the port. + * + * @return The port of the host you want to connect to. + */ public String getPort() { return port; } - @SuppressWarnings("unchecked") public static class Builder> { String protocol, host, port; IotaLocalPoW localPoW; @@ -332,37 +448,21 @@ public class IotaAPICore { return (T) this; } - /** - * @param host - * @return - */ public T host(String host) { this.host = host; return (T) this; } - /** - * @param port - * @return - */ public T port(String port) { this.port = port; return (T) this; } - /** - * @param protocol - * @return - */ public T protocol(String protocol) { this.protocol = protocol; return (T) this; } - /** - * @param localPoW - * @return - */ public T localPoW(IotaLocalPoW localPoW) { this.localPoW = localPoW; return (T) this; diff --git a/jota/src/main/java/jota/IotaAPIService.java b/jota/src/main/java/jota/IotaAPIService.java index 2946307..f31a546 100644 --- a/jota/src/main/java/jota/IotaAPIService.java +++ b/jota/src/main/java/jota/IotaAPIService.java @@ -19,20 +19,18 @@ public interface IotaAPIService { /** * Returns information about your node. - *

- * curl http://localhost:14265 -X POST -H 'Content-Type: application/json' - * -d '{"command": "getNodeInfo"}' * - * @return a {@code NodeInfoResponse} object, if succesfull. + * curl http://localhost:14265 -X POST -H 'X-IOTA-API-Version: 1.4.1' -H 'Content-Type: application/json' + * -d '{"command": "getNodeInfo"}' */ @Headers({CONTENT_TYPE_HEADER, USER_AGENT_HEADER}) @POST("./") Call getNodeInfo(@Body IotaCommandRequest request); /** - * Get the list of latest tips (unconfirmed transactions). - *

- * curl http://localhost:14265 -X POST -H 'Content-Type: application/json' + * Get the list of neighbors from your node. + * + * curl http://localhost:14265 -X POST -H 'X-IOTA-API-Version: 1.4.1' -H 'Content-Type: application/json' * -d '{"command": "getNeighbors"}' */ @Headers({CONTENT_TYPE_HEADER, USER_AGENT_HEADER}) @@ -41,8 +39,8 @@ public interface IotaAPIService { /** * Add a list of neighbors to your node. - *

- * curl http://localhost:14265 -X POST -H 'Content-Type: application/json' + * + * curl http://localhost:14265 -X POST -H 'X-IOTA-API-Version: 1.4.1' -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}) @@ -51,8 +49,8 @@ public interface IotaAPIService { /** * Removes a list of neighbors to your node. - *

- * curl http://localhost:14265 -X POST -H 'Content-Type: application/json' + * + * curl http://localhost:14265 -X POST -H 'X-IOTA-API-Version: 1.4.1' -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}) @@ -61,8 +59,8 @@ public interface IotaAPIService { /** * Get the list of latest tips (unconfirmed transactions). - *

- * curl http://localhost:14265 -X POST -H 'Content-Type: application/json' + * + * curl http://localhost:14265 -X POST -H 'X-IOTA-API-Version: 1.4.1' -H 'Content-Type: application/json' * -d '{"command": "getTips"}' */ @Headers({CONTENT_TYPE_HEADER, USER_AGENT_HEADER}) @@ -71,7 +69,7 @@ public interface IotaAPIService { /** * Find the transactions which match the specified input and return - *

+ * * curl http://localhost:14265 \ -X POST \ -H 'Content-Type: application/json' \ * -d '{"command": "findTransactions", "addresses": ["RVORZ9SIIP9RCYMREUIXXVPQIPHVCNPQ9HZWYKFWYWZRE9JQKG9REPKIASHUUECPSQO9JT9XNMVKWYGVAZETAIRPTM"]}' */ @@ -82,8 +80,8 @@ public interface IotaAPIService { /** * Get the inclusion states of a set of transactions. This is for determining if a transaction was accepted and confirmed by the network or not. You can search for multiple tips (and thus, milestones) to get past inclusion states of transactions. - *

- * curl http://localhost:14265 -X POST -H 'Content-Type: application/json' + * + * curl http://localhost:14265 -X POST -H 'Content-Type: application/json' * -d '{"command": "getInclusionStates", "transactions"Q9HZWYKFWYWZRE9JQKG9REPKIASHUUECPSQO9JT9XNMVKWYGVAZETAIRPTM"], "tips" : []}' */ @Headers({CONTENT_TYPE_HEADER, USER_AGENT_HEADER}) @@ -92,8 +90,8 @@ public interface IotaAPIService { /** * Returns the raw trytes data of a transaction. - *

- * curl http://localhost:14265 -X POST -H 'Content-Type: application/json' + * + * curl http://localhost:14265 -X POST -H 'X-IOTA-API-Version: 1.4.1' -H 'Content-Type: application/json' * -d '{"command": "getTrytes", "hashes": ["OAATQS9VQLSXCLDJVJJVYUGONXAXOFMJOZNSYWRZSWECMXAQQURHQBJNLD9IOFEPGZEPEMPXCIVRX9999"]}' */ @Headers({CONTENT_TYPE_HEADER, USER_AGENT_HEADER}) @@ -102,8 +100,8 @@ 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' + * + * curl http://localhost:14265 -X POST -H 'X-IOTA-API-Version: 1.4.1' -H 'Content-Type: application/json' * -d '{"command": "getTransactionsToApprove", "depth": 27}' */ @Headers({CONTENT_TYPE_HEADER, USER_AGENT_HEADER}) @@ -112,8 +110,8 @@ public interface IotaAPIService { /** * 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' + * + * curl http://localhost:14265 -X POST -H 'X-IOTA-API-Version: 1.4.1' -H 'Content-Type: application/json' * -d '{"command": "getBalances", "addresses": ["HBBYKAKTILIPVUKFOTSLHGENPTXYBNKXZFQFR9VQFWNBMTQNRVOUKPVPRNBSZVVILMAFBKOTBLGLWLOHQ"], "threshold": 100}' */ @Headers({CONTENT_TYPE_HEADER, USER_AGENT_HEADER}) @@ -122,8 +120,8 @@ public interface IotaAPIService { /** * Attaches the specified transactions (trytes) to the Tangle by doing Proof of Work. - *

- * curl http://localhost:14265 -X POST -H 'Content-Type: application/json' + * + * curl http://localhost:14265 -X POST -H 'X-IOTA-API-Version: 1.4.1' -H 'Content-Type: application/json' * -d '{"command": "attachToTangle", "trunkTransaction": "JVMTDGDPDFYHMZPMWEKKANBQSLSDTIIHAYQUMZOKHXXXGJHJDQPOMDOMNRDKYCZRUFZROZDADTHZC9999", "branchTransaction": "P9KFSJVGSPLXAEBJSHWFZLGP9GGJTIO9YITDEHATDTGAFLPLBZ9FOFWWTKMAZXZHFGQHUOXLXUALY9999", "minWeightMagnitude": 18, "trytes": ["TRYTVALUEHERE"]}' */ @Headers({CONTENT_TYPE_HEADER, USER_AGENT_HEADER}) @@ -132,8 +130,8 @@ public interface IotaAPIService { /** * Interrupts and completely aborts the attachToTangle process. - *

- * curl http://localhost:14265 -X POST -H 'Content-Type: application/json' + * + * curl http://localhost:14265 -X POST -H 'X-IOTA-API-Version: 1.4.1' -H 'Content-Type: application/json' * -d '{"command": "interruptAttachingToTangle" } */ @Headers({CONTENT_TYPE_HEADER, USER_AGENT_HEADER}) @@ -142,8 +140,8 @@ public interface IotaAPIService { /** * 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' + * + * curl http://localhost:14265 -X POST -H 'X-IOTA-API-Version: 1.4.1' -H 'Content-Type: application/json' * -d '{"command": "broadcastTransactions", "trytes": ["BYSWEAUTWXHXZ9YBZISEK9LUHWGMHXCGEVNZHRLUWQFCUSDXZHOFHWHL9MQPVJXXZLIXPXPXF9KYEREFSKCPKYIIKPZVLHUTDFQKKVVBBN9ATTLPCNPJDWDEVIYYLGPZGCWXOBDXMLJC9VO9QXTTBLAXTTBFUAROYEGQIVB9MJWJKXJMCUPTWAUGFZBTZCSJVRBGMYXTVBDDS9MYUJCPZ9YDWWQNIPUAIJXXSNLKUBSCOIJPCLEFPOXFJREXQCUVUMKSDOVQGGHRNILCO9GNCLWFM9APMNMWYASHXQAYBEXF9QRIHIBHYEJOYHRQJAOKAQ9AJJFQ9WEIWIJOTZATIBOXQLBMIJU9PCGBLVDDVFP9CFFSXTDUXMEGOOFXWRTLFGV9XXMYWEMGQEEEDBTIJ9OJOXFAPFQXCDAXOUDMLVYRMRLUDBETOLRJQAEDDLNVIRQJUBZBO9CCFDHIX9MSQCWYAXJVWHCUPTRSXJDESISQPRKZAFKFRULCGVRSBLVFOPEYLEE99JD9SEBALQINPDAZHF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9YTVDBOFZRKO9CFWRPAQQRXTPACOWCPRLYRYSJARRKSQPR9TCFXDVIXLP9XVL99ERRDSOHBFJDJQQGGGCZNDQ9NYCTQJWVZIAELCRBJJFDMCNZU9FIZRPGNURTXOCDSQGXTQHKHUECGWFUUYS9J9NYQ9U9P9UUP9YMZHWWWCIASCFLCMSKTELZWUGCDE9YOKVOVKTAYPHDF9ZCCQAYPJIJNGSHUIHHCOSSOOBUDOKE9CJZGYSSGNCQJVBEFTZFJ9SQUHOASKRRGBSHWKBCBWBTJHOGQ9WOMQFHWJVEG9NYX9KWBTCAIXNXHEBDIOFO9ALYMFGRICLCKKLG9FOBOX9PDWNQRGHBKHGKKRLWTBEQMCWQRLHAVYYZDIIPKVQTHYTWQMTOACXZOQCDTJTBAAUWXSGJF9PNQIJ9AJRUMUVCPWYVYVARKR9RKGOUHHNKNVGGPDDLGKPQNOYHNKAVVKCXWXOQPZNSLATUJT9AUWRMPPSWHSTTYDFAQDXOCYTZHOYYGAIM9CELMZ9AZPWB9MJXGHOKDNNSZVUDAGXTJJSSZCPZVPZBYNNTUQABSXQWZCHDQSLGK9UOHCFKBIBNETK999999999999999999999999999999999999999999999999999999999999999999999999999999999NOXDXXKUDWLOFJLIPQIBRBMGDYCPGDNLQOLQS99EQYKBIU9VHCJVIPFUYCQDNY9APGEVYLCENJIOBLWNB999999999XKBRHUD99C99999999NKZKEKWLDKMJCI9N9XQOLWEPAYWSH9999999999999999999999999KDDTGZLIPBNZKMLTOLOXQVNGLASESDQVPTXALEKRMIOHQLUHD9ELQDBQETS9QFGTYOYWLNTSKKMVJAUXSIROUICDOXKSYZTDPEDKOQENTJOWJONDEWROCEJIEWFWLUAACVSJFTMCHHXJBJRKAAPUDXXVXFWP9X9999IROUICDOXKSYZTDPEDKOQENTJOWJONDEWROCEJIEWFWLUAACVSJFTMCHHXJBJRKAAPUDXXVXFWP9X9999"]} */ @Headers({CONTENT_TYPE_HEADER, USER_AGENT_HEADER}) @@ -152,8 +150,8 @@ public interface IotaAPIService { /** * 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' + * + * curl http://localhost:14265 -X POST -H 'X-IOTA-API-Version: 1.4.1' -H 'Content-Type: application/json' * -d '{"command": "storeTransactions", "trytes": ["BYSWEAUTWXHXZ9YBZISEK9LUHWGMHXCGEVNZHRLUWQFCUSDXZHOFHWHL9MQPVJXXZLIXPXPXF9KYEREFSKCPKYIIKPZVLHUTDFQKKVVBBN9ATTLPCNPJDWDEVIYYLGPZGCWXOBDXMLJC9VO9QXTTBLAXTTBFUAROYEGQIVB9MJWJKXJMCUPTWAUGFZBTZCSJVRBGMYXTVBDDS9MYUJCPZ9YDWWQNIPUAIJXXSNLKUBSCOIJPCLEFPOXFJREXQCUVUMKSDOVQGGHRNILCO9GNCLWFM9APMNMWYASHXQAYBEXF9QRIHIBHYEJOYHRQJAOKAQ9AJJFQ9WEIWIJOTZATIBOXQLBMIJU9PCGBLVDDVFP9CFFSXTDUXMEGOOFXWRTLFGV9XXMYWEMGQEEEDBTIJ9OJOXFAPFQXCDAXOUDMLVYRMRLUDBETOLRJQAEDDLNVIRQJUBZBO9CCFDHIX9MSQCWYAXJVWHCUPTRSXJDESISQPRKZAFKFRULCGVRSBLVFOPEYLEE99JD9SEBALQINPDAZHFAB9RNBH9AZWIJOTLBZVIEJIAYGMC9AZGNFWGRSWAXTYSXVROVNKCOQQIWGPNQZKHUNODGYADPYLZZZUQRTJRTODOUKAOITNOMWNGHJBBA99QUMBHRENGBHTH9KHUAOXBVIVDVYYZMSEYSJWIOGGXZVRGN999EEGQMCOYVJQRIRROMPCQBLDYIGQO9AMORPYFSSUGACOJXGAQSPDY9YWRRPESNXXBDQ9OZOXVIOMLGTSWAMKMTDRSPGJKGBXQIVNRJRFRYEZ9VJDLHIKPSKMYC9YEGHFDS9SGVDHRIXBEMLFIINOHVPXIFAZCJKBHVMQZEVWCOSNWQRDYWVAIBLSCBGESJUIB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X9PDWNQRGHBKHGKKRLWTBEQMCWQRLHAVYYZDIIPKVQTHYTWQMTOACXZOQCDTJTBAAUWXSGJF9PNQIJ9AJRUMUVCPWYVYVARKR9RKGOUHHNKNVGGPDDLGKPQNOYHNKAVVKCXWXOQPZNSLATUJT9AUWRMPPSWHSTTYDFAQDXOCYTZHOYYGAIM9CELMZ9AZPWB9MJXGHOKDNNSZVUDAGXTJJSSZCPZVPZBYNNTUQABSXQWZCHDQSLGK9UOHCFKBIBNETK999999999999999999999999999999999999999999999999999999999999999999999999999999999NOXDXXKUDWLOFJLIPQIBRBMGDYCPGDNLQOLQS99EQYKBIU9VHCJVIPFUYCQDNY9APGEVYLCENJIOBLWNB999999999XKBRHUD99C99999999NKZKEKWLDKMJCI9N9XQOLWEPAYWSH9999999999999999999999999KDDTGZLIPBNZKMLTOLOXQVNGLASESDQVPTXALEKRMIOHQLUHD9ELQDBQETS9QFGTYOYWLNTSKKMVJAUXSIROUICDOXKSYZTDPEDKOQENTJOWJONDEWROCEJIEWFWLUAACVSJFTMCHHXJBJRKAAPUDXXVXFWP9X9999IROUICDOXKSYZTDPEDKOQENTJOWJONDEWROCEJIEWFWLUAACVSJFTMCHHXJBJRKAAPUDXXVXFWP9X9999"]}' */ @Headers({CONTENT_TYPE_HEADER, USER_AGENT_HEADER}) diff --git a/jota/src/main/java/jota/dto/request/IotaAttachToTangleRequest.java b/jota/src/main/java/jota/dto/request/IotaAttachToTangleRequest.java index 5dba481..6e7fe01 100644 --- a/jota/src/main/java/jota/dto/request/IotaAttachToTangleRequest.java +++ b/jota/src/main/java/jota/dto/request/IotaAttachToTangleRequest.java @@ -4,7 +4,7 @@ import jota.IotaAPICommands; /** * This class represents the core API request 'attachToTangle'. - *

+ * * It is used to attach trytes to the tangle. **/ public class IotaAttachToTangleRequest extends IotaCommandRequest { diff --git a/jota/src/main/java/jota/dto/request/IotaBroadcastTransactionRequest.java b/jota/src/main/java/jota/dto/request/IotaBroadcastTransactionRequest.java index e09afc0..61d27cd 100644 --- a/jota/src/main/java/jota/dto/request/IotaBroadcastTransactionRequest.java +++ b/jota/src/main/java/jota/dto/request/IotaBroadcastTransactionRequest.java @@ -4,7 +4,7 @@ import jota.IotaAPICommands; /** * This class represents the core API request 'broadcastTransaction'. - *

+ * * Broadcast a list of transactions to all neighbors. The input trytes for this call are provided by attachToTangle **/ public class IotaBroadcastTransactionRequest extends IotaCommandRequest { diff --git a/jota/src/main/java/jota/dto/request/IotaCommandRequest.java b/jota/src/main/java/jota/dto/request/IotaCommandRequest.java index f99628d..26c5432 100644 --- a/jota/src/main/java/jota/dto/request/IotaCommandRequest.java +++ b/jota/src/main/java/jota/dto/request/IotaCommandRequest.java @@ -10,7 +10,7 @@ public class IotaCommandRequest { final String command; /** - * @param command + * Initializes a new instance of the IotaCommandRequest class. */ protected IotaCommandRequest(IotaAPICommands command) { this.command = command.command(); diff --git a/jota/src/main/java/jota/dto/request/IotaStoreTransactionsRequest.java b/jota/src/main/java/jota/dto/request/IotaStoreTransactionsRequest.java index 7e774b7..1662d9a 100644 --- a/jota/src/main/java/jota/dto/request/IotaStoreTransactionsRequest.java +++ b/jota/src/main/java/jota/dto/request/IotaStoreTransactionsRequest.java @@ -4,7 +4,7 @@ import jota.IotaAPICommands; /** * This class represents the core API request 'getTransactionsToApprove'. - *

+ * * It stores transactions into the local storage. The trytes to be used for this call are returned by attachToTangle. **/ public class IotaStoreTransactionsRequest extends IotaCommandRequest { diff --git a/jota/src/main/java/jota/pow/JCurl.java b/jota/src/main/java/jota/pow/JCurl.java index 4096ec8..88c1a69 100644 --- a/jota/src/main/java/jota/pow/JCurl.java +++ b/jota/src/main/java/jota/pow/JCurl.java @@ -8,7 +8,7 @@ import java.util.NoSuchElementException; /** * (c) 2016 Come-from-Beyond - *

+ * * JCurl belongs to the sponge function family. */ public class JCurl implements ICurl { diff --git a/jota/src/main/java/jota/utils/Signing.java b/jota/src/main/java/jota/utils/Signing.java index fc260eb..37bd519 100644 --- a/jota/src/main/java/jota/utils/Signing.java +++ b/jota/src/main/java/jota/utils/Signing.java @@ -22,7 +22,7 @@ public class Signing { * public Signing() { * this(null); * } - *

+ * * /** * * @param curl diff --git a/jota/src/main/java/jota/utils/StopWatch.java b/jota/src/main/java/jota/utils/StopWatch.java index c68b383..3ad93a8 100644 --- a/jota/src/main/java/jota/utils/StopWatch.java +++ b/jota/src/main/java/jota/utils/StopWatch.java @@ -10,7 +10,7 @@ public class StopWatch { private long currentTime = 0; /** - * + * Initializes a new instance of the StopWatch class. */ public StopWatch() { this.startTime = System.currentTimeMillis(); @@ -26,7 +26,7 @@ public class StopWatch { } /** - * @return + * */ public StopWatch stop() { this.running = false; @@ -52,7 +52,7 @@ public class StopWatch { /** * Elapsed time in milliseconds. * - * @return + * @return The elapsed time in milliseconds. */ public long getElapsedTimeMili() { long elapsed = 0; @@ -65,7 +65,7 @@ public class StopWatch { /** * Elapsed time in seconds. * - * @return + * @return The elapsed time in seconds. */ public long getElapsedTimeSecs() { long elapsed = 0; @@ -78,7 +78,7 @@ public class StopWatch { /** * Elapsed time in minutes. * - * @return + * @return The elapsed time in minutes. */ public long getElapsedTimeMin() { long elapsed = 0; @@ -91,7 +91,7 @@ public class StopWatch { /** * Elapsed time in hours. * - * @return + * @return The elapsed time in hours. */ public long getElapsedTimeHour() { long elapsed = 0; diff --git a/jota/src/main/java/jota/utils/TrytesConverter.java b/jota/src/main/java/jota/utils/TrytesConverter.java index e144545..8b90b75 100644 --- a/jota/src/main/java/jota/utils/TrytesConverter.java +++ b/jota/src/main/java/jota/utils/TrytesConverter.java @@ -10,20 +10,20 @@ public class TrytesConverter { /** * Conversion of ascii encoded bytes to trytes. * Input is a string (can be stringified JSON object), return value is Trytes - *

+ * * How the conversion works: * 2 Trytes === 1 Byte * There are a total of 27 different tryte values: 9ABCDEFGHIJKLMNOPQRSTUVWXYZ - *

+ * * 1. We get the decimal value of an individual ASCII character * 2. From the decimal value, we then derive the two tryte values by basically calculating the tryte equivalent (e.g. 100 === 19 + 3 * 27) * a. The first tryte value is the decimal value modulo 27 (27 trytes) * b. The second value is the remainder (decimal value - first value), divided by 27 * 3. The two values returned from Step 2. are then input as indices into the available values list ('9ABCDEFGHIJKLMNOPQRSTUVWXYZ') to get the correct tryte value - *

- *

+ * + * * EXAMPLE - *

+ * * Lets say we want to convert the ASCII character "Z". * 1. 'Z' has a decimal value of 90. * 2. 90 can be represented as 9 + 3 * 27. To make it simpler: