@@ -101,6 +101,7 @@ pub struct WalletInfoWithProgress {
101101
102102#[ derive( Debug , Clone , Serialize , Deserialize ) ]
103103pub struct ListSpacesResponse {
104+ pub pending : Vec < SLabel > ,
104105 pub winning : Vec < FullSpaceOut > ,
105106 pub outbid : Vec < FullSpaceOut > ,
106107 pub owned : Vec < FullSpaceOut > ,
@@ -816,12 +817,15 @@ impl RpcWallet {
816817 let unspent = wallet. list_unspent_with_details ( state) ?;
817818 let recent_events = wallet. list_recent_events ( ) ?;
818819
819- let mut res = ListSpacesResponse {
820- winning : vec ! [ ] ,
821- outbid : vec ! [ ] ,
822- owned : vec ! [ ] ,
823- } ;
820+ let mut pending = vec ! [ ] ;
821+ let mut outbid = vec ! [ ] ;
824822 for ( txid, event) in recent_events {
823+ let tx = wallet. get_tx ( txid) ;
824+ if tx. as_ref ( ) . is_some_and ( |tx| !tx. chain_position . is_confirmed ( ) ) {
825+ pending. push ( SLabel :: from_str ( event. space . as_ref ( ) . unwrap ( ) ) . expect ( "valid space name" ) ) ;
826+ continue ;
827+ }
828+
825829 if unspent. iter ( ) . any ( |out| {
826830 out. space
827831 . as_ref ( )
@@ -833,9 +837,12 @@ impl RpcWallet {
833837 let spacehash = SpaceKey :: from ( Sha256 :: hash ( name. as_ref ( ) ) ) ;
834838 let space = state. get_space_info ( & spacehash) ?;
835839 if let Some ( space) = space {
836- let tx = wallet. get_tx ( txid) ;
840+ if space. spaceout . space . as_ref ( ) . unwrap ( ) . is_owned ( ) {
841+ continue ;
842+ }
843+
837844 if tx. is_none ( ) {
838- res . outbid . push ( space) ;
845+ outbid. push ( space) ;
839846 continue ;
840847 }
841848
@@ -845,10 +852,13 @@ impl RpcWallet {
845852 {
846853 continue ;
847854 }
848- res. outbid . push ( space) ;
855+
856+ outbid. push ( space) ;
849857 }
850858 }
851859
860+ let mut owned = vec ! [ ] ;
861+ let mut winning = vec ! [ ] ;
852862 for wallet_output in unspent. into_iter ( ) . filter ( |output| output. space . is_some ( ) ) {
853863 let entry = FullSpaceOut {
854864 txid : wallet_output. output . outpoint . txid ,
@@ -860,15 +870,19 @@ impl RpcWallet {
860870 } ,
861871 } ;
862872
863- let space = entry. spaceout . space . as_ref ( ) . expect ( "space" ) ;
864- if matches ! ( space. covenant, spaces_protocol:: Covenant :: Bid { .. } ) {
865- res. winning . push ( entry) ;
866- } else if matches ! ( space. covenant, spaces_protocol:: Covenant :: Transfer { .. } ) {
867- res. owned . push ( entry) ;
873+ if entry. spaceout . space . as_ref ( ) . expect ( "space" ) . is_owned ( ) {
874+ owned. push ( entry) ;
875+ } else {
876+ winning. push ( entry) ;
868877 }
869878 }
870879
871- Ok ( res)
880+ Ok ( ListSpacesResponse {
881+ pending,
882+ winning,
883+ outbid,
884+ owned,
885+ } )
872886 }
873887
874888 fn list_transactions (
0 commit comments