@@ -9,23 +9,23 @@ import (
99
1010 "github.com/lightninglabs/loop/instantout/reservation"
1111 "github.com/lightninglabs/loop/looprpc"
12- "github.com/urfave/cli"
12+ "github.com/urfave/cli/v3 "
1313)
1414
15- var instantOutCommand = cli.Command {
15+ var instantOutCommand = & cli.Command {
1616 Name : "instantout" ,
1717 Usage : "perform an instant off-chain to on-chain swap (looping out)" ,
1818 Description : `
1919 Attempts to instantly loop out into the backing lnd's wallet. The amount
2020 will be chosen via the cli.
2121 ` ,
2222 Flags : []cli.Flag {
23- cli.StringFlag {
23+ & cli.StringFlag {
2424 Name : "channel" ,
2525 Usage : "the comma-separated list of short " +
2626 "channel IDs of the channels to loop out" ,
2727 },
28- cli.StringFlag {
28+ & cli.StringFlag {
2929 Name : "addr" ,
3030 Usage : "the optional address that the looped out funds " +
3131 "should be sent to, if let blank the funds " +
@@ -35,13 +35,13 @@ var instantOutCommand = cli.Command{
3535 Action : instantOut ,
3636}
3737
38- func instantOut (ctx * cli.Context ) error {
38+ func instantOut (ctx context. Context , cmd * cli.Command ) error {
3939 // Parse outgoing channel set. Don't string split if the flag is empty.
4040 // Otherwise, strings.Split returns a slice of length one with an empty
4141 // element.
4242 var outgoingChanSet []uint64
43- if ctx .IsSet ("channel" ) {
44- chanStrings := strings .Split (ctx .String ("channel" ), "," )
43+ if cmd .IsSet ("channel" ) {
44+ chanStrings := strings .Split (cmd .String ("channel" ), "," )
4545 for _ , chanString := range chanStrings {
4646 chanID , err := strconv .ParseUint (chanString , 10 , 64 )
4747 if err != nil {
@@ -53,15 +53,15 @@ func instantOut(ctx *cli.Context) error {
5353 }
5454
5555 // First set up the swap client itself.
56- client , cleanup , err := getClient (ctx )
56+ client , cleanup , err := getClient (ctx , cmd )
5757 if err != nil {
5858 return err
5959 }
6060 defer cleanup ()
6161
6262 // Now we fetch all the confirmed reservations.
6363 reservations , err := client .ListReservations (
64- context . Background () , & looprpc.ListReservationsRequest {},
64+ ctx , & looprpc.ListReservationsRequest {},
6565 )
6666 if err != nil {
6767 return err
@@ -156,7 +156,7 @@ func instantOut(ctx *cli.Context) error {
156156 // Now that we have the selected reservations we can estimate the
157157 // fee-rates.
158158 quote , err := client .InstantOutQuote (
159- context . Background () , & looprpc.InstantOutQuoteRequest {
159+ ctx , & looprpc.InstantOutQuoteRequest {
160160 Amt : selectedAmt ,
161161 ReservationIds : selectedReservations ,
162162 },
@@ -180,11 +180,11 @@ func instantOut(ctx *cli.Context) error {
180180
181181 // Now we can request the instant out swap.
182182 instantOutRes , err := client .InstantOut (
183- context . Background () ,
183+ ctx ,
184184 & looprpc.InstantOutRequest {
185185 ReservationIds : selectedReservations ,
186186 OutgoingChanSet : outgoingChanSet ,
187- DestAddr : ctx .String ("addr" ),
187+ DestAddr : cmd .String ("addr" ),
188188 },
189189 )
190190 if err != nil {
@@ -202,7 +202,7 @@ func instantOut(ctx *cli.Context) error {
202202 return nil
203203}
204204
205- var listInstantOutsCommand = cli.Command {
205+ var listInstantOutsCommand = & cli.Command {
206206 Name : "listinstantouts" ,
207207 Usage : "list all instant out swaps" ,
208208 Description : `
@@ -211,16 +211,16 @@ var listInstantOutsCommand = cli.Command{
211211 Action : listInstantOuts ,
212212}
213213
214- func listInstantOuts (ctx * cli.Context ) error {
214+ func listInstantOuts (ctx context. Context , cmd * cli.Command ) error {
215215 // First set up the swap client itself.
216- client , cleanup , err := getClient (ctx )
216+ client , cleanup , err := getClient (ctx , cmd )
217217 if err != nil {
218218 return err
219219 }
220220 defer cleanup ()
221221
222222 resp , err := client .ListInstantOuts (
223- context . Background () , & looprpc.ListInstantOutsRequest {},
223+ ctx , & looprpc.ListInstantOutsRequest {},
224224 )
225225 if err != nil {
226226 return err
0 commit comments