@@ -338,6 +338,24 @@ public List<Transaction> findTransactionObjectsByBundle(String[] input) {
338
338
* @throws InvalidTransferException is thrown when an invalid transfer is provided.
339
339
*/
340
340
public List <String > prepareTransfers (String seed , int security , final List <Transfer > transfers , String remainder , List <Input > inputs ) throws NotEnoughBalanceException , InvalidSecurityLevelException , InvalidAddressException , InvalidTransferException {
341
+ return prepareTransfers (seed , security , transfers , remainder , inputs , true );
342
+ }
343
+ /**
344
+ * Prepares transfer by generating bundle, finding and signing inputs.
345
+ *
346
+ * @param seed 81-tryte encoded address of recipient.
347
+ * @param security The security level of private key / seed.
348
+ * @param transfers Array of transfer objects.
349
+ * @param remainder If defined, this address will be used for sending the remainder value (of the inputs) to.
350
+ * @param inputs The inputs.
351
+ * @param validateInputs whether or not to validate the balances of the provided inputs
352
+ * @return Returns bundle trytes.
353
+ * @throws InvalidAddressException is thrown when the specified address is not an valid address.
354
+ * @throws NotEnoughBalanceException is thrown when a transfer fails because their is not enough balance to perform the transfer.
355
+ * @throws InvalidSecurityLevelException is thrown when the specified security level is not valid.
356
+ * @throws InvalidTransferException is thrown when an invalid transfer is provided.
357
+ */
358
+ public List <String > prepareTransfers (String seed , int security , final List <Transfer > transfers , String remainder , List <Input > inputs , boolean validateInputs ) throws NotEnoughBalanceException , InvalidSecurityLevelException , InvalidAddressException , InvalidTransferException {
341
359
342
360
// Input validation of transfers object
343
361
if (!InputValidator .isTransfersCollectionValid (transfers )) {
@@ -419,6 +437,8 @@ public List<String> prepareTransfers(String seed, int security, final List<Trans
419
437
420
438
// Case 1: user provided inputs
421
439
// Validate the inputs by calling getBalances
440
+ if (!validateInputs )
441
+ return addRemainder (seed , security , inputs , bundle , tag , totalValue , remainder , signatureFragments );
422
442
if (inputs != null && !inputs .isEmpty ()) {
423
443
424
444
// Get list if addresses of the provided inputs
@@ -456,7 +476,7 @@ public List<String> prepareTransfers(String seed, int security, final List<Trans
456
476
throw new IllegalStateException ("Not enough balance" );
457
477
}
458
478
459
- return addRemainder (seed , security , confirmedInputs , bundle , tag , totalValue , null , signatureFragments );
479
+ return addRemainder (seed , security , confirmedInputs , bundle , tag , totalValue , remainder , signatureFragments );
460
480
}
461
481
462
482
// Case 2: Get inputs deterministically
@@ -467,7 +487,7 @@ public List<String> prepareTransfers(String seed, int security, final List<Trans
467
487
468
488
@ SuppressWarnings ("unchecked" ) GetBalancesAndFormatResponse newinputs = getInputs (seed , security , 0 , 0 , totalValue );
469
489
// If inputs with enough balance
470
- return addRemainder (seed , security , newinputs .getInput (), bundle , tag , totalValue , null , signatureFragments );
490
+ return addRemainder (seed , security , newinputs .getInput (), bundle , tag , totalValue , remainder , signatureFragments );
471
491
}
472
492
} else {
473
493
0 commit comments