@@ -1231,6 +1231,47 @@ func (s *swapClientServer) InstantOutQuote(ctx context.Context,
1231
1231
}, nil
1232
1232
}
1233
1233
1234
+ // ListInstantOuts returns a list of all currently known instant out swaps and
1235
+ // their current status.
1236
+ func (s * swapClientServer ) ListInstantOuts (ctx context.Context ,
1237
+ _ * clientrpc.ListInstantOutsRequest ) (
1238
+ * clientrpc.ListInstantOutsResponse , error ) {
1239
+
1240
+ instantOuts , err := s .instantOutManager .ListInstantOuts (ctx )
1241
+ if err != nil {
1242
+ return nil , err
1243
+ }
1244
+
1245
+ rpcSwaps := make ([]* clientrpc.InstantOut , 0 , len (instantOuts ))
1246
+ for _ , instantOut := range instantOuts {
1247
+ rpcSwaps = append (rpcSwaps , rpcInstantOut (instantOut ))
1248
+ }
1249
+
1250
+ return & clientrpc.ListInstantOutsResponse {
1251
+ Swaps : rpcSwaps ,
1252
+ }, nil
1253
+ }
1254
+
1255
+ func rpcInstantOut (instantOut * instantout.InstantOut ) * clientrpc.InstantOut {
1256
+ var sweepTxId string
1257
+ if instantOut .SweepTxHash != nil {
1258
+ sweepTxId = instantOut .SweepTxHash .String ()
1259
+ }
1260
+
1261
+ reservations := make ([][]byte , len (instantOut .Reservations ))
1262
+ for i , res := range instantOut .Reservations {
1263
+ reservations [i ] = res .ID [:]
1264
+ }
1265
+
1266
+ return & clientrpc.InstantOut {
1267
+ SwapHash : instantOut .SwapHash [:],
1268
+ State : string (instantOut .State ),
1269
+ Amount : uint64 (instantOut .Value ),
1270
+ SweepTxId : sweepTxId ,
1271
+ ReservationIds : reservations ,
1272
+ }
1273
+ }
1274
+
1234
1275
func rpcAutoloopReason (reason liquidity.Reason ) (clientrpc.AutoReason , error ) {
1235
1276
switch reason {
1236
1277
case liquidity .ReasonNone :
0 commit comments