@@ -101,6 +101,7 @@ pub struct WalletInfoWithProgress {
101
101
102
102
#[ derive( Debug , Clone , Serialize , Deserialize ) ]
103
103
pub struct ListSpacesResponse {
104
+ pub pending : Vec < SLabel > ,
104
105
pub winning : Vec < FullSpaceOut > ,
105
106
pub outbid : Vec < FullSpaceOut > ,
106
107
pub owned : Vec < FullSpaceOut > ,
@@ -816,12 +817,15 @@ impl RpcWallet {
816
817
let unspent = wallet. list_unspent_with_details ( state) ?;
817
818
let recent_events = wallet. list_recent_events ( ) ?;
818
819
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 ! [ ] ;
824
822
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
+
825
829
if unspent. iter ( ) . any ( |out| {
826
830
out. space
827
831
. as_ref ( )
@@ -833,9 +837,12 @@ impl RpcWallet {
833
837
let spacehash = SpaceKey :: from ( Sha256 :: hash ( name. as_ref ( ) ) ) ;
834
838
let space = state. get_space_info ( & spacehash) ?;
835
839
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
+
837
844
if tx. is_none ( ) {
838
- res . outbid . push ( space) ;
845
+ outbid. push ( space) ;
839
846
continue ;
840
847
}
841
848
@@ -845,10 +852,13 @@ impl RpcWallet {
845
852
{
846
853
continue ;
847
854
}
848
- res. outbid . push ( space) ;
855
+
856
+ outbid. push ( space) ;
849
857
}
850
858
}
851
859
860
+ let mut owned = vec ! [ ] ;
861
+ let mut winning = vec ! [ ] ;
852
862
for wallet_output in unspent. into_iter ( ) . filter ( |output| output. space . is_some ( ) ) {
853
863
let entry = FullSpaceOut {
854
864
txid : wallet_output. output . outpoint . txid ,
@@ -860,15 +870,19 @@ impl RpcWallet {
860
870
} ,
861
871
} ;
862
872
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) ;
868
877
}
869
878
}
870
879
871
- Ok ( res)
880
+ Ok ( ListSpacesResponse {
881
+ pending,
882
+ winning,
883
+ outbid,
884
+ owned,
885
+ } )
872
886
}
873
887
874
888
fn list_transactions (
0 commit comments