2020
2121/**
2222 * @author Ub - H. MARTEAU
23- * @version 4.13
23+ * @version 4.15
2424 */
2525public class AddressCommand extends QueryBuilderAddress {
2626
27- public AddressCommand (String ip , String port , String login , String password ) {
28- initialize (ip , port , login , password );
27+ public AddressCommand (String ip , String port , String login , String password , RuntimeParameters runtimeparameters ) {
28+ initialize (ip , port , login , password , runtimeparameters );
2929 }
3030
3131 /**
@@ -204,6 +204,16 @@ public final List<Address> getAddressesList() throws MultichainException {
204204
205205 return addresses ;
206206 }
207+ public final List <Address > getAddressesList (boolean verbose ) throws MultichainException {
208+ List <Address > addresses = new ArrayList <Address >();
209+
210+ Object objectAddresses = executeGetAddresses (verbose );
211+ if (verifyInstance (objectAddresses , ArrayList .class ) && verifyInstanceofList ((ArrayList <Object >) objectAddresses , Address .class )) {
212+ addresses = AddressFormatter .formatAddressesList ((ArrayList <Object >) objectAddresses );
213+ }
214+
215+ return addresses ;
216+ }
207217
208218 /**
209219 * Returns a list of balances of all addresses in this node’s wallet
@@ -360,15 +370,23 @@ public List<BalanceAssetGeneral> getAddressBalances(String address) throws Multi
360370 * @throws MultichainException
361371 */
362372 public final String getNewAddress () throws MultichainException {
373+ return getNewAddress (null );
374+ }
375+ public final String getNewAddress (String label ) throws MultichainException {
363376 String stringAddress = "" ;
364-
365- Object objectAddress = executeGetNewAddress ();
377+
378+ Object objectAddress = null ;
379+ if (label == null || label .isEmpty ()) {
380+ objectAddress = executeGetNewAddress ();
381+ } else {
382+ objectAddress = executeGetNewAddress (label );
383+ }
366384 if (verifyInstance (objectAddress , String .class )) {
367385 stringAddress = (String ) objectAddress ;
368386 }
369387
370388 return stringAddress ;
371- }
389+ }
372390
373391 /**
374392 *
@@ -390,17 +408,25 @@ public final String getNewAddress() throws MultichainException {
390408 * @throws MultichainException
391409 */
392410 public final Address getNewAddressFilled () throws MultichainException {
411+ return getNewAddressFilled (null );
412+ }
413+ public final Address getNewAddressFilled (String label ) throws MultichainException {
393414 Address address = new Address ();
394415
395- Object objectAddress = executeGetNewAddress ();
416+ Object objectAddress = null ;
417+ if (label == null || label .isEmpty ()) {
418+ objectAddress = executeGetNewAddress ();
419+ } else {
420+ objectAddress = executeGetNewAddress (label );
421+ }
396422 if (verifyInstance (objectAddress , String .class )) {
397423 String stringAddress = (String ) objectAddress ;
398424
399425 address = validateAddress (stringAddress );
400426 }
401427
402428 return address ;
403- }
429+ }
404430
405431 /**
406432 * Adds address to the wallet, without an associated private key, to create
@@ -429,6 +455,26 @@ public final Address getNewAddressFilled() throws MultichainException {
429455 public void importAddress (String address , String label , boolean rescan ) throws MultichainException {
430456 /* String systemMessage = */ executeImportAddress (address , label , rescan );
431457 }
458+
459+ /**
460+ * setaccount "address" "account"
461+ *
462+ * Sets the account associated with the given address.
463+ *
464+ * Arguments:
465+ * 1. "address" (string, required) The address to be associated with an account.
466+ * 2. "account" (string, required) The account to assign the address to.
467+ *
468+ * @param address
469+ * @param label
470+ * @return
471+ * @throws MultichainException
472+ *
473+ * !!!!! Accounts are not supported with scalable wallet - if you need accounts, run multichaind -walletdbversion=1 -rescan, but the wallet will perform worse
474+ */
475+ public void setAccount (String address , String label ) throws MultichainException {
476+ executeSetAccount (address , label );
477+ }
432478
433479 /**
434480 * Get information about an address
0 commit comments