@@ -671,3 +671,162 @@ macro_rules! impl_client_v17__keypoolrefill {
671671 }
672672 } ;
673673}
674+
675+ /// Implements Bitcoin Core JSON-RPC API method `lockunspent`
676+ #[ macro_export]
677+ macro_rules! impl_client_v17__lockunspent {
678+ ( ) => {
679+ use crate :: client_sync:: LockUnspentOutput ;
680+ impl Client {
681+ pub fn lock_unspent(
682+ & self ,
683+ unlock: bool ,
684+ outputs: Option <& [ LockUnspentOutput ] >,
685+ persistent: Option <bool >,
686+ ) -> Result <bool > {
687+ let mut params = vec![ unlock. into( ) ] ;
688+
689+ match outputs {
690+ Some ( outs) => params. push( serde_json:: to_value( outs) ?) ,
691+ None => {
692+ if unlock {
693+ params. push( serde_json:: Value :: Array ( vec![ ] ) ) ;
694+ } else {
695+ return Err ( crate :: client_sync:: Error :: Returned ( "lockunspent requires specific outputs when locking (unlock=false)" . to_string( ) ) ) ;
696+ }
697+ }
698+ }
699+
700+ if !unlock {
701+ if let Some ( p) = persistent {
702+ if params. len( ) == 1 {
703+ params. push( serde_json:: Value :: Array ( vec![ ] ) ) ;
704+ }
705+ params. push( p. into( ) ) ;
706+ }
707+ }
708+ self . call( "lockunspent" , & params)
709+ }
710+ }
711+ } ;
712+ }
713+
714+ /// Implements Bitcoin Core JSON-RPC API method `removeprunedfunds`
715+ #[ macro_export]
716+ macro_rules! impl_client_v17__removeprunedfunds {
717+ ( ) => {
718+ impl Client {
719+ pub fn remove_pruned_funds( & self , txid: Txid ) -> Result <( ) > {
720+ match self . call( "removeprunedfunds" , & [ into_json( txid) ?] ) {
721+ Ok ( serde_json:: Value :: Null ) => Ok ( ( ) ) ,
722+ Ok ( ref val) if val. is_null( ) => Ok ( ( ) ) ,
723+ Ok ( other) => Err ( crate :: client_sync:: Error :: Returned ( format!( "removeprunedfunds expected null, got: {}" , other) ) ) ,
724+ Err ( e) => Err ( e. into( ) ) ,
725+ }
726+ }
727+ }
728+ } ;
729+ }
730+
731+ /// Implements Bitcoin Core JSON-RPC API method `sethdseed`
732+ #[ macro_export]
733+ macro_rules! impl_client_v17__sethdseed {
734+ ( ) => {
735+ impl Client {
736+ pub fn set_hd_seed(
737+ & self ,
738+ new_keypool: Option <bool >,
739+ seed: Option <& PrivateKey >,
740+ ) -> Result <( ) > {
741+ let mut params = vec![ ] ;
742+
743+ if new_keypool. is_some( ) || seed. is_some( ) {
744+ params. push( new_keypool. map_or( true . into( ) , |k| k. into( ) ) ) ;
745+ }
746+
747+ if let Some ( s) = seed {
748+ params. push( s. to_wif( ) . into( ) ) ;
749+ }
750+
751+ match self . call( "sethdseed" , & params) {
752+ Ok ( serde_json:: Value :: Null ) => Ok ( ( ) ) ,
753+ Ok ( ref val) if val. is_null( ) => Ok ( ( ) ) ,
754+ Ok ( other) => Err ( crate :: client_sync:: Error :: Returned ( format!( "sethdseed expected null, got: {}" , other) ) ) ,
755+ Err ( e) => Err ( e. into( ) ) ,
756+ }
757+ }
758+ }
759+ } ;
760+ }
761+
762+ /// Implements Bitcoin Core JSON-RPC API method `settxfee`
763+ #[ macro_export]
764+ macro_rules! impl_client_v17__settxfee {
765+ ( ) => {
766+ const SATS_PER_BTC_F64_SETTXFEE : f64 = 100_000_000.0 ;
767+ fn fee_rate_to_rpc_arg_settxfee( fee_rate: bitcoin:: FeeRate ) -> f64 {
768+ let sat_per_kwu = fee_rate. to_sat_per_kwu( ) ;
769+ let sat_per_kvb = ( sat_per_kwu as f64 ) * 4.0 ;
770+ sat_per_kvb / SATS_PER_BTC_F64_SETTXFEE
771+ }
772+
773+ impl Client {
774+ pub fn set_tx_fee( & self , fee_rate: bitcoin:: FeeRate ) -> Result <bool > {
775+ let amount_rpc_arg = fee_rate_to_rpc_arg_settxfee( fee_rate) ;
776+
777+ self . call( "settxfee" , & [ amount_rpc_arg. into( ) ] )
778+ }
779+ }
780+ } ;
781+ }
782+
783+ /// Implements Bitcoin Core JSON-RPC API method `walletlock`
784+ #[ macro_export]
785+ macro_rules! impl_client_v17__walletlock {
786+ ( ) => {
787+ impl Client {
788+ pub fn wallet_lock( & self ) -> Result <( ) > {
789+ match self . call( "walletlock" , & [ ] ) {
790+ Ok ( serde_json:: Value :: Null ) => Ok ( ( ) ) ,
791+ Ok ( ref val) if val. is_null( ) => Ok ( ( ) ) ,
792+ Ok ( other) => Err ( crate :: client_sync:: Error :: Returned ( format!( "walletlock expected null, got: {}" , other) ) ) ,
793+ Err ( e) => Err ( e. into( ) ) ,
794+ }
795+ }
796+ }
797+ } ;
798+ }
799+
800+ /// Implements Bitcoin Core JSON-RPC API method `walletpassphrase`
801+ #[ macro_export]
802+ macro_rules! impl_client_v17__walletpassphrase {
803+ ( ) => {
804+ impl Client {
805+ pub fn wallet_passphrase( & self , passphrase: & str , timeout: u64 ) -> Result <( ) > {
806+ match self . call( "walletpassphrase" , & [ passphrase. into( ) , timeout. into( ) ] ) {
807+ Ok ( serde_json:: Value :: Null ) => Ok ( ( ) ) ,
808+ Ok ( ref val) if val. is_null( ) => Ok ( ( ) ) ,
809+ Ok ( other) => Err ( crate :: client_sync:: Error :: Returned ( format!( "walletpassphrase expected null, got: {}" , other) ) ) ,
810+ Err ( e) => Err ( e. into( ) ) ,
811+ }
812+ }
813+ }
814+ } ;
815+ }
816+
817+ /// Implements Bitcoin Core JSON-RPC API method `walletpassphrasechange`
818+ #[ macro_export]
819+ macro_rules! impl_client_v17__walletpassphrasechange {
820+ ( ) => {
821+ impl Client {
822+ pub fn wallet_passphrase_change( & self , old_passphrase: & str , new_passphrase: & str ) -> Result <( ) > {
823+ match self . call( "walletpassphrasechange" , & [ old_passphrase. into( ) , new_passphrase. into( ) ] ) {
824+ Ok ( serde_json:: Value :: Null ) => Ok ( ( ) ) ,
825+ Ok ( ref val) if val. is_null( ) => Ok ( ( ) ) ,
826+ Ok ( other) => Err ( crate :: client_sync:: Error :: Returned ( format!( "walletpassphrasechange expected null, got: {}" , other) ) ) ,
827+ Err ( e) => Err ( e. into( ) ) ,
828+ }
829+ }
830+ }
831+ } ;
832+ }
0 commit comments