@@ -116,7 +116,7 @@ pub enum WalletCommand {
116116 space : String ,
117117 msg : protocol:: Bytes ,
118118 resp : crate :: rpc:: Responder < anyhow:: Result < SignedMessage > > ,
119- }
119+ } ,
120120}
121121
122122#[ derive( Debug , Clone , Copy , Serialize , Deserialize , ValueEnum ) ]
@@ -184,7 +184,7 @@ impl RpcWallet {
184184 let space = fullspaceout. spaceout . space . as_ref ( ) . expect ( "space" ) . name . to_string ( ) ;
185185 let foreign_input = fullspaceout. outpoint ( ) ;
186186 let tx = wallet. buy :: < Sha256 > ( state, & listing, fee_rate) ?;
187-
187+
188188 if !skip_tx_check {
189189 let tip = wallet. local_chain ( ) . tip ( ) . height ( ) ;
190190 let mut checker = TxChecker :: new ( state) ;
@@ -205,7 +205,7 @@ impl RpcWallet {
205205
206206 // Incrementing last_seen by 1 ensures eviction of older tx
207207 // in cases with same-second/last seen replacement.
208- wallet. apply_unconfirmed_tx_record ( tx_record, last_seen+ 1 ) ?;
208+ wallet. apply_unconfirmed_tx_record ( tx_record, last_seen + 1 ) ?;
209209 wallet. commit ( ) ?;
210210
211211 Ok ( TxResponse {
@@ -248,7 +248,7 @@ impl RpcWallet {
248248
249249 // Incrementing last_seen by 1 ensures eviction of older tx
250250 // in cases with same-second/last seen replacement.
251- wallet. apply_unconfirmed_tx_record ( tx_record, last_seen+ 1 ) ?;
251+ wallet. apply_unconfirmed_tx_record ( tx_record, last_seen + 1 ) ?;
252252 wallet. commit ( ) ?;
253253
254254 Ok ( vec ! [ TxResponse {
@@ -573,7 +573,7 @@ impl RpcWallet {
573573
574574 fn list_spaces (
575575 wallet : & mut SpacesWallet ,
576- state : & mut LiveSnapshot
576+ state : & mut LiveSnapshot ,
577577 ) -> anyhow:: Result < ListSpacesResponse > {
578578 let unspent = wallet. list_unspent_with_details ( state) ?;
579579 let recent_events = wallet. list_recent_events ( ) ?;
@@ -788,14 +788,20 @@ impl RpcWallet {
788788 . filter_map ( |space| SLabel :: from_str ( space) . ok ( ) )
789789 . collect ( ) ;
790790 if spaces. len ( ) != params. spaces . len ( ) {
791- return Err ( anyhow ! ( "sendspaces : some names were malformed" ) ) ;
791+ return Err ( anyhow ! ( "transfer : some names were malformed" ) ) ;
792792 }
793- let recipient = match Self :: resolve ( network, store, & params. to , true ) ? {
794- None => {
795- return Err ( anyhow ! ( "sendspaces: could not resolve '{}'" , params. to) )
793+
794+ let recipient = if let Some ( to) = params. to {
795+ match Self :: resolve ( network, store, & to, true ) ? {
796+ None => {
797+ return Err ( anyhow ! ( "transfer: could not resolve '{}'" , to) )
798+ }
799+ Some ( r) => Some ( r) ,
796800 }
797- Some ( r) => r,
801+ } else {
802+ None
798803 } ;
804+
799805 for space in spaces {
800806 let spacehash = SpaceKey :: from ( Sha256 :: hash ( space. as_ref ( ) ) ) ;
801807 match store. get_space_info ( & spacehash) ? {
@@ -817,6 +823,18 @@ impl RpcWallet {
817823 }
818824
819825 Some ( full) => {
826+ let recipient = match recipient. clone ( ) {
827+ None => {
828+ SpaceAddress (
829+ Address :: from_script (
830+ full. spaceout . script_pubkey . as_script ( ) ,
831+ wallet. config . network ,
832+ ) . expect ( "valid script" )
833+ )
834+ }
835+ Some ( addr) => SpaceAddress ( addr)
836+ } ;
837+
820838 builder = builder. add_transfer ( SpaceTransfer {
821839 space : full,
822840 recipient : recipient. clone ( ) ,
@@ -938,7 +956,7 @@ impl RpcWallet {
938956 let address = wallet. next_unused_space_address ( ) ;
939957 spaces. push ( SpaceTransfer {
940958 space : spaceout,
941- recipient : address. 0 ,
959+ recipient : address,
942960 } ) ;
943961 }
944962
@@ -1195,7 +1213,7 @@ impl RpcWallet {
11951213 pub async fn send_sign_message (
11961214 & self ,
11971215 space : & str ,
1198- msg : protocol:: Bytes
1216+ msg : protocol:: Bytes ,
11991217 ) -> anyhow:: Result < SignedMessage > {
12001218 let ( resp, resp_rx) = oneshot:: channel ( ) ;
12011219 self . sender
@@ -1221,7 +1239,6 @@ impl RpcWallet {
12211239 }
12221240
12231241
1224-
12251242 pub async fn send_force_spend (
12261243 & self ,
12271244 outpoint : OutPoint ,
0 commit comments