diff --git a/pom.xml b/pom.xml
index c870b7b..40eeac8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
com.blockcypher
java-client
- 0.1.2-SNAPSHOT
+ 0.1.3-SNAPSHOT
junit
@@ -63,6 +63,11 @@
jersey-client
${jersey.version}
+
+ org.glassfish.jersey.inject
+ jersey-hk2
+ ${jersey.version}
+
org.glassfish.jersey.containers
jersey-container-jdk-http
@@ -105,7 +110,7 @@
1.47.0.3
- 2.9
+ 2.29.1
github
@@ -117,7 +122,7 @@
central
Maven Repository Switchboard
- http://repo1.maven.org/maven2
+ https://repo1.maven.org/maven2
maven-restlet
@@ -155,7 +160,7 @@
central
Maven Plugin Repository
- http://repo1.maven.org/maven2
+ https://repo1.maven.org/maven2
@@ -188,7 +193,7 @@
com.github.github
site-maven-plugin
-
0.10-SNAPSHOT
diff --git a/src/main/java/com/blockcypher/service/TransactionService.java b/src/main/java/com/blockcypher/service/TransactionService.java
index 1d496c6..47e1059 100644
--- a/src/main/java/com/blockcypher/service/TransactionService.java
+++ b/src/main/java/com/blockcypher/service/TransactionService.java
@@ -12,6 +12,7 @@
import com.blockcypher.utils.rest.RestUtils;
import java.math.BigDecimal;
+import java.util.Iterator;
import java.util.List;
/**
@@ -63,6 +64,38 @@ private NullData postNullData(String nullData, String id) throws BlockCypherExce
return RestUtils.post(RestUtils.formatUrl(resourceUrl, endpointConfig, id), nullData, id, NullData.class);
}
+ /**
+ * Create an Intermediary Transaction from skeleton. You will then need to sign this transaction with your private key
+ *
+ * @param inputAddresses input addresses
+ * @param outputAddresses output addresses
+ * @param satoshis values
+ * @return Partially built transaction with the data to sign
+ * @throws BlockCypherException In case there is some error, ie: Address xxx with balance 0 does not have enough funds to transfer 510000.
+ */
+ public IntermediaryTransaction newTransaction(List inputAddresses, List outputAddresses,
+ List satoshis) throws BlockCypherException {
+ Transaction transaction = new Transaction();
+
+ for (String address : inputAddresses) {
+ Input input = new Input();
+ input.addAddress(address);
+ transaction.addInput(input);
+ }
+
+ Iterator satoshiIterator = satoshis.iterator();
+
+ for (String address : outputAddresses) {
+ Output output = new Output();
+ output.addAddress(address);
+ output.setValue(new BigDecimal(satoshiIterator.next()));
+ transaction.addOutput(output);
+ }
+ String transactionJson = GsonFactory.getGson().toJson(transaction);
+ return postSkeletonTransaction(transactionJson, "new");
+ }
+
+
/**
* Create an Intermediary Transaction from skeleton. You will then need to sign this transaction with your private key
*
@@ -72,6 +105,7 @@ private NullData postNullData(String nullData, String id) throws BlockCypherExce
* @return Partially built transaction with the data to sign
* @throws BlockCypherException In case there is some error, ie: Address xxx with balance 0 does not have enough funds to transfer 510000.
*/
+ @Deprecated
public IntermediaryTransaction newTransaction(List inputAddresses, List outputAddresses,
long satoshis) throws BlockCypherException {
Transaction transaction = new Transaction();