File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -106,9 +106,15 @@ pub enum AddressKind {
106
106
107
107
#[ derive( Debug , Clone , Serialize , Deserialize ) ]
108
108
pub struct Balance {
109
+ pub balance : Amount ,
110
+ pub details : BalanceDetails ,
111
+ }
112
+
113
+ #[ derive( Debug , Clone , Serialize , Deserialize ) ]
114
+ pub struct BalanceDetails {
109
115
#[ serde( flatten) ]
110
116
pub balance : bdk_wallet:: wallet:: Balance ,
111
- pub locked : Amount ,
117
+ pub dust : Amount ,
112
118
}
113
119
114
120
#[ derive( Clone ) ]
@@ -144,13 +150,18 @@ impl RpcWallet {
144
150
let unspent = Self :: list_unspent ( wallet, state) ?;
145
151
let balance = wallet. spaces . balance ( ) ;
146
152
147
- Ok ( Balance {
153
+ let details = BalanceDetails {
148
154
balance,
149
- locked : unspent
155
+ dust : unspent
150
156
. into_iter ( )
151
157
. filter ( |output| output. is_spaceout )
152
158
. map ( |output| output. output . txout . value )
153
159
. sum ( ) ,
160
+ } ;
161
+
162
+ Ok ( Balance {
163
+ balance : ( details. balance . confirmed + details. balance . trusted_pending ) - details. dust ,
164
+ details,
154
165
} )
155
166
}
156
167
You can’t perform that action at this time.
0 commit comments