@@ -562,6 +562,8 @@ def get_request(self, *args, **kwargs):
562
562
def arg_to_cli (arg ):
563
563
if isinstance (arg , bool ):
564
564
return str (arg ).lower ()
565
+ elif arg is None :
566
+ return 'null'
565
567
elif isinstance (arg , dict ) or isinstance (arg , list ):
566
568
return json .dumps (arg , default = EncodeDecimal )
567
569
else :
@@ -632,27 +634,13 @@ def __init__(self, rpc, cli=False, descriptors=False):
632
634
def __getattr__ (self , name ):
633
635
return getattr (self .rpc , name )
634
636
635
- def createwallet (self , wallet_name , disable_private_keys = None , blank = None , passphrase = None , avoid_reuse = None , descriptors = None ):
636
- if self .is_cli :
637
- if disable_private_keys is None :
638
- disable_private_keys = 'null'
639
- if blank is None :
640
- blank = 'null'
641
- if passphrase is None :
642
- passphrase = ''
643
- if avoid_reuse is None :
644
- avoid_reuse = 'null'
637
+ def createwallet (self , wallet_name , disable_private_keys = None , blank = None , passphrase = '' , avoid_reuse = None , descriptors = None ):
645
638
if descriptors is None :
646
639
descriptors = self .descriptors
647
640
return self .__getattr__ ('createwallet' )(wallet_name , disable_private_keys , blank , passphrase , avoid_reuse , descriptors )
648
641
649
642
def importprivkey (self , privkey , label = None , rescan = None ):
650
643
wallet_info = self .getwalletinfo ()
651
- if self .is_cli :
652
- if label is None :
653
- label = 'null'
654
- if rescan is None :
655
- rescan = 'null'
656
644
if 'descriptors' not in wallet_info or ('descriptors' in wallet_info and not wallet_info ['descriptors' ]):
657
645
return self .__getattr__ ('importprivkey' )(privkey , label , rescan )
658
646
desc = descsum_create ('combo(' + privkey + ')' )
@@ -667,11 +655,6 @@ def importprivkey(self, privkey, label=None, rescan=None):
667
655
668
656
def addmultisigaddress (self , nrequired , keys , label = None , address_type = None ):
669
657
wallet_info = self .getwalletinfo ()
670
- if self .is_cli :
671
- if label is None :
672
- label = 'null'
673
- if address_type is None :
674
- address_type = 'null'
675
658
if 'descriptors' not in wallet_info or ('descriptors' in wallet_info and not wallet_info ['descriptors' ]):
676
659
return self .__getattr__ ('addmultisigaddress' )(nrequired , keys , label , address_type )
677
660
cms = self .createmultisig (nrequired , keys , address_type )
@@ -687,11 +670,6 @@ def addmultisigaddress(self, nrequired, keys, label=None, address_type=None):
687
670
688
671
def importpubkey (self , pubkey , label = None , rescan = None ):
689
672
wallet_info = self .getwalletinfo ()
690
- if self .is_cli :
691
- if label is None :
692
- label = 'null'
693
- if rescan is None :
694
- rescan = 'null'
695
673
if 'descriptors' not in wallet_info or ('descriptors' in wallet_info and not wallet_info ['descriptors' ]):
696
674
return self .__getattr__ ('importpubkey' )(pubkey , label , rescan )
697
675
desc = descsum_create ('combo(' + pubkey + ')' )
@@ -706,13 +684,6 @@ def importpubkey(self, pubkey, label=None, rescan=None):
706
684
707
685
def importaddress (self , address , label = None , rescan = None , p2sh = None ):
708
686
wallet_info = self .getwalletinfo ()
709
- if self .is_cli :
710
- if label is None :
711
- label = 'null'
712
- if rescan is None :
713
- rescan = 'null'
714
- if p2sh is None :
715
- p2sh = 'null'
716
687
if 'descriptors' not in wallet_info or ('descriptors' in wallet_info and not wallet_info ['descriptors' ]):
717
688
return self .__getattr__ ('importaddress' )(address , label , rescan , p2sh )
718
689
is_hex = False
0 commit comments