@@ -538,6 +538,8 @@ def get_request(self, *args, **kwargs):
538538def arg_to_cli (arg ):
539539 if isinstance (arg , bool ):
540540 return str (arg ).lower ()
541+ elif arg is None :
542+ return 'null'
541543 elif isinstance (arg , dict ) or isinstance (arg , list ):
542544 return json .dumps (arg , default = EncodeDecimal )
543545 else :
@@ -608,27 +610,13 @@ def __init__(self, rpc, cli=False, descriptors=False):
608610 def __getattr__ (self , name ):
609611 return getattr (self .rpc , name )
610612
611- def createwallet (self , wallet_name , disable_private_keys = None , blank = None , passphrase = None , avoid_reuse = None , descriptors = None ):
612- if self .is_cli :
613- if disable_private_keys is None :
614- disable_private_keys = 'null'
615- if blank is None :
616- blank = 'null'
617- if passphrase is None :
618- passphrase = ''
619- if avoid_reuse is None :
620- avoid_reuse = 'null'
613+ def createwallet (self , wallet_name , disable_private_keys = None , blank = None , passphrase = '' , avoid_reuse = None , descriptors = None ):
621614 if descriptors is None :
622615 descriptors = self .descriptors
623616 return self .__getattr__ ('createwallet' )(wallet_name , disable_private_keys , blank , passphrase , avoid_reuse , descriptors )
624617
625618 def importprivkey (self , privkey , label = None , rescan = None ):
626619 wallet_info = self .getwalletinfo ()
627- if self .is_cli :
628- if label is None :
629- label = 'null'
630- if rescan is None :
631- rescan = 'null'
632620 if 'descriptors' not in wallet_info or ('descriptors' in wallet_info and not wallet_info ['descriptors' ]):
633621 return self .__getattr__ ('importprivkey' )(privkey , label , rescan )
634622 desc = descsum_create ('combo(' + privkey + ')' )
@@ -643,11 +631,6 @@ def importprivkey(self, privkey, label=None, rescan=None):
643631
644632 def addmultisigaddress (self , nrequired , keys , label = None , address_type = None ):
645633 wallet_info = self .getwalletinfo ()
646- if self .is_cli :
647- if label is None :
648- label = 'null'
649- if address_type is None :
650- address_type = 'null'
651634 if 'descriptors' not in wallet_info or ('descriptors' in wallet_info and not wallet_info ['descriptors' ]):
652635 return self .__getattr__ ('addmultisigaddress' )(nrequired , keys , label , address_type )
653636 cms = self .createmultisig (nrequired , keys , address_type )
@@ -663,11 +646,6 @@ def addmultisigaddress(self, nrequired, keys, label=None, address_type=None):
663646
664647 def importpubkey (self , pubkey , label = None , rescan = None ):
665648 wallet_info = self .getwalletinfo ()
666- if self .is_cli :
667- if label is None :
668- label = 'null'
669- if rescan is None :
670- rescan = 'null'
671649 if 'descriptors' not in wallet_info or ('descriptors' in wallet_info and not wallet_info ['descriptors' ]):
672650 return self .__getattr__ ('importpubkey' )(pubkey , label , rescan )
673651 desc = descsum_create ('combo(' + pubkey + ')' )
@@ -682,13 +660,6 @@ def importpubkey(self, pubkey, label=None, rescan=None):
682660
683661 def importaddress (self , address , label = None , rescan = None , p2sh = None ):
684662 wallet_info = self .getwalletinfo ()
685- if self .is_cli :
686- if label is None :
687- label = 'null'
688- if rescan is None :
689- rescan = 'null'
690- if p2sh is None :
691- p2sh = 'null'
692663 if 'descriptors' not in wallet_info or ('descriptors' in wallet_info and not wallet_info ['descriptors' ]):
693664 return self .__getattr__ ('importaddress' )(address , label , rescan , p2sh )
694665 is_hex = False
0 commit comments