From d477754dfddea7d137f4ac85a66c6160390d09f6 Mon Sep 17 00:00:00 2001 From: adrianziser Date: Sat, 18 Feb 2017 22:26:03 +0100 Subject: [PATCH 1/3] readme updated --- README.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f198ec6..493e27b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.org/iotaledger/iota.lib.java.svg?branch=dev)](https://travis-ci.org/iotaledger/iota.lib.java) +[![Build Status](https://travis-ci.org/iotaledger/iota.lib.java.svg?branch=master)](https://travis-ci.org/iotaledger/iota.lib.java) ##Introduction @@ -54,7 +54,8 @@ In order to communicate with *IOTA node*, JOTA needs to be aware of your node's iota.node.host=127.0.0.1 iota.node.port=14265 -Jota is still *not* in the central maven repository. +Jota is still *not* in the central maven repository. + ##Warning - This is pre-release software! @@ -62,12 +63,17 @@ Jota is still *not* in the central maven repository. - You may loose all your money :) - Please report any issues using the Issue Tracker -That's it! - ##Examples There's an extensive list of test coverages on the src/test/java package of the project that can be used as reference. +##Documentation + +A hosted version of the javadoc for the latest release can be found [here](https://iotaledger.github.io/iota.lib.java/javadoc/) + + ##Supporting the project If JOTA has been useful to you and you feel like contributing, consider posting a bug report or a pull request. + +That's it! \ No newline at end of file From 328745299c78693a3e916692ce812eb2c1668a91 Mon Sep 17 00:00:00 2001 From: Heinrich Reimer Date: Sun, 30 Apr 2017 16:35:45 +0200 Subject: [PATCH 2/3] Fix headline formatting --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 493e27b..3c64144 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ [![Build Status](https://travis-ci.org/iotaledger/iota.lib.java.svg?branch=master)](https://travis-ci.org/iotaledger/iota.lib.java) -##Introduction +## Introduction The JOTA library is a simple Java wrapper around [[IOTA]](http://www.iotatoken.com/) Node's JSON-REST HTTP interface. @@ -18,7 +18,7 @@ A list of all *IOTA* JSON-REST API commands currently supported by jota wrapper JOTA java wrapper is being designed to be thread-safe and simplest as possible in order to be easily mantainable, accordingly with the ongoing natural evolution of IOTA'api. All the boilerplate code for connecting to the node rest interface has been eliminated using Retrofit. -##Technologies & dependencies +## Technologies & dependencies The JOTA library has been designed to be used with Java6+, in order to promote compatibility with Android. @@ -31,7 +31,7 @@ Other dependencies: * Simple Logging Facade for Java 1.7.21 [[link]](http://www.slf4j.org/) * Apache Commons Lang 3.3.2 [[link]](http://commons.apache.org/proper/commons-lang/) -##Getting started +## Getting started Connect to your local node with the default settings is quite straightforward: it requires only 2 lines of code. For example, in order to fetch the Node Info: @@ -57,23 +57,23 @@ In order to communicate with *IOTA node*, JOTA needs to be aware of your node's Jota is still *not* in the central maven repository. -##Warning +## Warning - This is pre-release software! - There may be performance and stability issues. - You may loose all your money :) - Please report any issues using the Issue Tracker -##Examples +## Examples There's an extensive list of test coverages on the src/test/java package of the project that can be used as reference. -##Documentation +## Documentation A hosted version of the javadoc for the latest release can be found [here](https://iotaledger.github.io/iota.lib.java/javadoc/) -##Supporting the project +## Supporting the project If JOTA has been useful to you and you feel like contributing, consider posting a bug report or a pull request. -That's it! \ No newline at end of file +That's it! From 7f5910bdd74f9e49b3cabef7c998366360a430b1 Mon Sep 17 00:00:00 2001 From: Toon Sevrin Date: Sun, 2 Jul 2017 13:13:09 +0200 Subject: [PATCH 3/3] Added optional inputValidation and remainder --- src/main/java/jota/IotaAPI.java | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/main/java/jota/IotaAPI.java b/src/main/java/jota/IotaAPI.java index c6504bc..f83e07a 100644 --- a/src/main/java/jota/IotaAPI.java +++ b/src/main/java/jota/IotaAPI.java @@ -338,6 +338,24 @@ public class IotaAPI extends IotaAPICore { * @throws InvalidTransferException is thrown when an invalid transfer is provided. */ public List prepareTransfers(String seed, int security, final List transfers, String remainder, List inputs) throws NotEnoughBalanceException, InvalidSecurityLevelException, InvalidAddressException, InvalidTransferException { + return prepareTransfers(seed, security, transfers, remainder, inputs, true); + } + /** + * Prepares transfer by generating bundle, finding and signing inputs. + * + * @param seed 81-tryte encoded address of recipient. + * @param security The security level of private key / seed. + * @param transfers Array of transfer objects. + * @param remainder If defined, this address will be used for sending the remainder value (of the inputs) to. + * @param inputs The inputs. + * @param validateInputs whether or not to validate the balances of the provided inputs + * @return Returns bundle trytes. + * @throws InvalidAddressException is thrown when the specified address is not an valid address. + * @throws NotEnoughBalanceException is thrown when a transfer fails because their is not enough balance to perform the transfer. + * @throws InvalidSecurityLevelException is thrown when the specified security level is not valid. + * @throws InvalidTransferException is thrown when an invalid transfer is provided. + */ + public List prepareTransfers(String seed, int security, final List transfers, String remainder, List inputs, boolean validateInputs) throws NotEnoughBalanceException, InvalidSecurityLevelException, InvalidAddressException, InvalidTransferException { // Input validation of transfers object if (!InputValidator.isTransfersCollectionValid(transfers)) { @@ -419,6 +437,8 @@ public class IotaAPI extends IotaAPICore { // Case 1: user provided inputs // Validate the inputs by calling getBalances + if(!validateInputs) + return addRemainder(seed, security, inputs, bundle, tag, totalValue, remainder, signatureFragments); if (inputs != null && !inputs.isEmpty()) { // Get list if addresses of the provided inputs @@ -456,7 +476,7 @@ public class IotaAPI extends IotaAPICore { throw new IllegalStateException("Not enough balance"); } - return addRemainder(seed, security, confirmedInputs, bundle, tag, totalValue, null, signatureFragments); + return addRemainder(seed, security, confirmedInputs, bundle, tag, totalValue, remainder, signatureFragments); } // Case 2: Get inputs deterministically @@ -467,7 +487,7 @@ public class IotaAPI extends IotaAPICore { @SuppressWarnings("unchecked") GetBalancesAndFormatResponse newinputs = getInputs(seed, security, 0, 0, totalValue); // If inputs with enough balance - return addRemainder(seed, security, newinputs.getInput(), bundle, tag, totalValue, null, signatureFragments); + return addRemainder(seed, security, newinputs.getInput(), bundle, tag, totalValue, remainder, signatureFragments); } } else {