2929
3030/**
3131 * @author Ub - H. MARTEAU
32- * @version 4.4
32+ * @version 4.6
3333 */
3434public class QueryBuilderWalletTransaction extends QueryBuilderCommon {
3535 /**
@@ -76,9 +76,7 @@ public class QueryBuilderWalletTransaction extends QueryBuilderCommon {
7676 * @return
7777 * @throws MultichainException
7878 */
79- protected Object executeGetAddressTransaction ( String address ,
80- String txid ,
81- boolean verbose ) throws MultichainException {
79+ protected Object executeGetAddressTransaction (String address , String txid , boolean verbose ) throws MultichainException {
8280 MultichainTestParameter .isNotNullOrEmpty ("address" , address );
8381 MultichainTestParameter .isNotNullOrEmpty ("txid" , txid );
8482 return execute (CommandEnum .GETADDRESSTRANSACTION , address , txid , verbose );
@@ -197,9 +195,7 @@ protected Object executeGetTxOut(String txid, int vout, boolean includemempool)
197195 * @return
198196 * @throws MultichainException
199197 */
200- protected Object executeGetWalletTransaction ( String txid ,
201- boolean includeWatchOnly ,
202- boolean verbose ) throws MultichainException {
198+ protected Object executeGetWalletTransaction (String txid , boolean includeWatchOnly , boolean verbose ) throws MultichainException {
203199 return execute (CommandEnum .GETWALLETTRANSACTION , txid , includeWatchOnly , verbose );
204200
205201 }
@@ -253,10 +249,7 @@ protected Object executeGetWalletTransaction( String txid,
253249 * @return
254250 * @throws MultichainException
255251 */
256- protected Object executeListAddressTransactions (String address ,
257- long count ,
258- long skip ,
259- boolean verbose ) throws MultichainException {
252+ protected Object executeListAddressTransactions (String address , long count , long skip , boolean verbose ) throws MultichainException {
260253 MultichainTestParameter .isNotNullOrEmpty ("address" , address );
261254 MultichainTestParameter .valueIsPositive ("count" , count );
262255 MultichainTestParameter .valueIsNotNegative ("skip" , skip );
@@ -308,10 +301,7 @@ protected Object executeListAddressTransactions(String address,
308301 * @return
309302 * @throws MultichainException
310303 */
311- protected Object executeListWalletTransaction ( long count ,
312- long skip ,
313- boolean includeWatchonly ,
314- boolean verbose ) throws MultichainException {
304+ protected Object executeListWalletTransaction (long count , long skip , boolean includeWatchonly , boolean verbose ) throws MultichainException {
315305 MultichainTestParameter .valueIsPositive ("count" , count );
316306 MultichainTestParameter .valueIsNotNegative ("skip" , skip );
317307 return execute (CommandEnum .LISTWALLETTRANSACTIONS , count , skip , includeWatchonly , verbose );
@@ -345,19 +335,20 @@ protected Object executeListWalletTransaction( long count,
345335 * @return transactionId
346336 * @throws MultichainException
347337 */
348- protected Object executeSendFromAddress (String fromAddress ,
349- String toAddress ,
350- List <BalanceAssetBase > assets ) throws MultichainException {
338+ protected Object executeSendFromAddress (String fromAddress , String toAddress , List <BalanceAssetBase > assets ) throws MultichainException {
351339 MultichainTestParameter .isNotNullOrEmpty ("fromAddress" , fromAddress );
352340 MultichainTestParameter .isNotNullOrEmpty ("toAddress" , toAddress );
353341 if (assets == null || assets .isEmpty ()) {
354342 throw new MultichainException ("assets" , "assets needed to be sent" );
355343 }
344+
345+ Map <String , Double > mapAssets = new HashMap <String , Double >();
356346 for (BalanceAssetBase asset : assets ) {
357347 asset .isFilled ();
348+ mapAssets .put (asset .getName (), new Double (asset .getQty ()));
358349 }
359350
360- return execute (CommandEnum .SENDFROMADDRESS , fromAddress , toAddress , assets );
351+ return execute (CommandEnum .SENDFROMADDRESS , fromAddress , toAddress , mapAssets );
361352 }
362353
363354 /**
@@ -388,9 +379,7 @@ protected Object executeSendFromAddress(String fromAddress,
388379 * @return transactionId
389380 * @throws MultichainException
390381 */
391- protected Object executeSendFromAddress (String fromAddress ,
392- String toAddress ,
393- double amount ) throws MultichainException {
382+ protected Object executeSendFromAddress (String fromAddress , String toAddress , double amount ) throws MultichainException {
394383 MultichainTestParameter .isNotNullOrEmpty ("fromAddress" , fromAddress );
395384 MultichainTestParameter .isNotNullOrEmpty ("toAddress" , toAddress );
396385 MultichainTestParameter .valueIsPositive ("amount" , amount );
@@ -430,11 +419,13 @@ protected Object executeSendToAddress(String address, List<BalanceAssetBase> ass
430419 if (assets == null || assets .isEmpty ()) {
431420 throw new MultichainException ("assets" , "assets needed to be sent" );
432421 }
422+ Map <String , Double > mapAssets = new HashMap <String , Double >();
433423 for (BalanceAssetBase asset : assets ) {
434424 asset .isFilled ();
425+ mapAssets .put (asset .getName (), new Double (asset .getQty ()));
435426 }
436427
437- return execute (CommandEnum .SENDTOADDRESS , address , formatJson ( assets ) );
428+ return execute (CommandEnum .SENDTOADDRESS , address , mapAssets );
438429 }
439430
440431 /**
@@ -494,19 +485,19 @@ protected Object executeSendToAddress(String address, double amount) throws Mult
494485 * @return
495486 * @throws MultichainException
496487 */
497- protected Object executeSendWithMetaData ( String address ,
498- List <BalanceAssetBase > assets ,
499- String hexMetaData ) throws MultichainException {
488+ protected Object executeSendWithMetaData (String address , List <BalanceAssetBase > assets , String hexMetaData ) throws MultichainException {
500489 MultichainTestParameter .isNotNullOrEmpty ("address" , address );
501490 MultichainTestParameter .isNotNullOrEmpty ("hexMetaData" , hexMetaData );
502491 if (assets == null || assets .isEmpty ()) {
503492 throw new MultichainException ("assets" , "assets needed to be sent" );
504493 }
494+ Map <String , Double > mapAssets = new HashMap <String , Double >();
505495 for (BalanceAssetBase asset : assets ) {
506496 asset .isFilled ();
497+ mapAssets .put (asset .getName (), new Double (asset .getQty ()));
507498 }
508499
509- return execute (CommandEnum .SENDWITHMETADATA , address , formatJson ( assets ) , hexMetaData );
500+ return execute (CommandEnum .SENDWITHMETADATA , address , mapAssets , hexMetaData );
510501 }
511502
512503 /**
@@ -532,9 +523,7 @@ protected Object executeSendWithMetaData( String address,
532523 * @return
533524 * @throws MultichainException
534525 */
535- protected Object executeSendWithMetaData ( String address ,
536- double amount ,
537- String hexMetaData ) throws MultichainException {
526+ protected Object executeSendWithMetaData (String address , double amount , String hexMetaData ) throws MultichainException {
538527 MultichainTestParameter .isNotNullOrEmpty ("address" , address );
539528 MultichainTestParameter .isNotNullOrEmpty ("hexMetaData" , hexMetaData );
540529 MultichainTestParameter .valueIsPositive ("amount" , amount );
@@ -568,10 +557,7 @@ protected Object executeSendWithMetaData( String address,
568557 * @return
569558 * @throws MultichainException
570559 */
571- protected Object executeSendWithMetaDataFrom ( String fromAddress ,
572- String toAddress ,
573- List <BalanceAssetBase > assets ,
574- String hexMetaData ) throws MultichainException {
560+ protected Object executeSendWithMetaDataFrom (String fromAddress , String toAddress , List <BalanceAssetBase > assets , String hexMetaData ) throws MultichainException {
575561 MultichainTestParameter .isNotNullOrEmpty ("fromAddress" , fromAddress );
576562 MultichainTestParameter .isNotNullOrEmpty ("toAddress" , toAddress );
577563 MultichainTestParameter .isNotNullOrEmpty ("hexMetaData" , hexMetaData );
@@ -582,9 +568,10 @@ protected Object executeSendWithMetaDataFrom( String fromAddress,
582568 for (BalanceAssetBase asset : assets ) {
583569 asset .isFilled ();
584570 }
585- Map <String , Object > mapAssets = new HashMap <String , Object >();
571+ Map <String , Double > mapAssets = new HashMap <String , Double >();
586572 for (BalanceAssetBase asset : assets ) {
587- mapAssets .put (asset .getName (), asset .getIssueqty ());
573+ asset .isFilled ();
574+ mapAssets .put (asset .getName (), new Double (asset .getQty ()));
588575 }
589576
590577 return execute (CommandEnum .SENDWITHMETADATAFROM , fromAddress , toAddress , mapAssets , hexMetaData );
@@ -616,10 +603,7 @@ protected Object executeSendWithMetaDataFrom( String fromAddress,
616603 * @return
617604 * @throws MultichainException
618605 */
619- protected Object executeSendWithMetaDataFrom ( String fromAddress ,
620- String toAddress ,
621- double amount ,
622- String hexMetaData ) throws MultichainException {
606+ protected Object executeSendWithMetaDataFrom (String fromAddress , String toAddress , double amount , String hexMetaData ) throws MultichainException {
623607 MultichainTestParameter .isNotNullOrEmpty ("fromAddress" , fromAddress );
624608 MultichainTestParameter .isNotNullOrEmpty ("toAddress" , toAddress );
625609 MultichainTestParameter .isNotNullOrEmpty ("hexMetaData" , hexMetaData );
@@ -628,11 +612,7 @@ protected Object executeSendWithMetaDataFrom( String fromAddress,
628612 return execute (CommandEnum .SENDWITHMETADATAFROM , fromAddress , toAddress , String .valueOf (amount ), hexMetaData );
629613 }
630614
631- protected Object executeSendWithDataFrom ( String fromAddress ,
632- String toAddress ,
633- String assetName ,
634- Integer assetValue ,
635- String metadata ) throws MultichainException {
615+ protected Object executeSendWithDataFrom (String fromAddress , String toAddress , String assetName , Integer assetValue , String metadata ) throws MultichainException {
636616 MultichainTestParameter .isNotNullOrEmpty ("fromAddress" , fromAddress );
637617 MultichainTestParameter .isNotNullOrEmpty ("toAddress" , toAddress );
638618 MultichainTestParameter .isNotNullOrEmpty ("metadata" , metadata );
0 commit comments