@@ -538,6 +538,8 @@ def get_request(self, *args, **kwargs):
538
538
def arg_to_cli (arg ):
539
539
if isinstance (arg , bool ):
540
540
return str (arg ).lower ()
541
+ elif arg is None :
542
+ return 'null'
541
543
elif isinstance (arg , dict ) or isinstance (arg , list ):
542
544
return json .dumps (arg , default = EncodeDecimal )
543
545
else :
@@ -608,27 +610,13 @@ def __init__(self, rpc, cli=False, descriptors=False):
608
610
def __getattr__ (self , name ):
609
611
return getattr (self .rpc , name )
610
612
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 ):
621
614
if descriptors is None :
622
615
descriptors = self .descriptors
623
616
return self .__getattr__ ('createwallet' )(wallet_name , disable_private_keys , blank , passphrase , avoid_reuse , descriptors )
624
617
625
618
def importprivkey (self , privkey , label = None , rescan = None ):
626
619
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'
632
620
if 'descriptors' not in wallet_info or ('descriptors' in wallet_info and not wallet_info ['descriptors' ]):
633
621
return self .__getattr__ ('importprivkey' )(privkey , label , rescan )
634
622
desc = descsum_create ('combo(' + privkey + ')' )
@@ -643,11 +631,6 @@ def importprivkey(self, privkey, label=None, rescan=None):
643
631
644
632
def addmultisigaddress (self , nrequired , keys , label = None , address_type = None ):
645
633
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'
651
634
if 'descriptors' not in wallet_info or ('descriptors' in wallet_info and not wallet_info ['descriptors' ]):
652
635
return self .__getattr__ ('addmultisigaddress' )(nrequired , keys , label , address_type )
653
636
cms = self .createmultisig (nrequired , keys , address_type )
@@ -663,11 +646,6 @@ def addmultisigaddress(self, nrequired, keys, label=None, address_type=None):
663
646
664
647
def importpubkey (self , pubkey , label = None , rescan = None ):
665
648
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'
671
649
if 'descriptors' not in wallet_info or ('descriptors' in wallet_info and not wallet_info ['descriptors' ]):
672
650
return self .__getattr__ ('importpubkey' )(pubkey , label , rescan )
673
651
desc = descsum_create ('combo(' + pubkey + ')' )
@@ -682,13 +660,6 @@ def importpubkey(self, pubkey, label=None, rescan=None):
682
660
683
661
def importaddress (self , address , label = None , rescan = None , p2sh = None ):
684
662
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'
692
663
if 'descriptors' not in wallet_info or ('descriptors' in wallet_info and not wallet_info ['descriptors' ]):
693
664
return self .__getattr__ ('importaddress' )(address , label , rescan , p2sh )
694
665
is_hex = False
0 commit comments