Skip to content

Commit 2d03ef9

Browse files
committed
staticaddr: loop-in manager and fsm
1 parent 80595bf commit 2d03ef9

File tree

8 files changed

+2242
-0
lines changed

8 files changed

+2242
-0
lines changed

create.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
# Define the reg_alice function
4+
reg_alice() {
5+
docker exec -ti alice lncli --network regtest "$@"
6+
}
7+
8+
# Request a new static loop-in address from the server
9+
NEW_ADDRESS=$(loop --network=regtest s n | grep "Received a new static loop-in address from the server:" | awk '{print $10}')
10+
11+
echo "New static loop-in address: $NEW_ADDRESS"
12+
13+
# Send coins to the new address
14+
AMOUNT=250000
15+
SEND_COINS=$(reg_alice sendcoins --addr "$NEW_ADDRESS" --amt "$AMOUNT" --min_confs 0 --force)
16+
17+
echo "$SEND_COINS"
18+
19+
# Extract the txid
20+
TXID=$(echo "$SEND_COINS" | grep "txid" | awk '{print $2}' | tr -d '",')
21+
22+
echo "Transaction ID: $TXID"
23+
24+
# Mine 3 blocks to confirm the transaction
25+
/usr/local/bin/regtest mine 3
26+
27+
echo "Mined 3 blocks to confirm the transaction."
28+
29+
echo "Script completed successfully."

interface.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,42 @@ type LoopInRequest struct {
234234
RouteHints [][]zpay32.HopHint
235235
}
236236

237+
// StaticAddressLoopInRequest contains the required parameters for the swap.
238+
type StaticAddressLoopInRequest struct {
239+
// DepositOutpoints contain the outpoints of the static address deposits
240+
// that are being looped in. The sum of output values constitute the
241+
// swap amount.
242+
DepositOutpoints []string
243+
244+
// MaxSwapFee is the maximum we are willing to pay the server for the
245+
// swap. This value is not disclosed in the swap initiation call, but if
246+
// the server asks for a higher fee, we abort the swap. Typically this
247+
// value is taken from the response of the LoopInQuote call. It
248+
// includes the pre-pay amount.
249+
MaxSwapFee btcutil.Amount
250+
251+
// LastHop optionally specifies the last hop to use for the loop in
252+
// payment.
253+
LastHop *route.Vertex
254+
255+
// Label contains an optional label for the swap.
256+
Label string
257+
258+
// Initiator is an optional string that identifies what software
259+
// initiated the swap (loop CLI, autolooper, LiT UI and so on) and is
260+
// appended to the user agent string.
261+
Initiator string
262+
263+
// Private indicates whether the destination node should be considered
264+
// private. In which case, loop will generate hophints to assist with
265+
// probing and payment.
266+
Private bool
267+
268+
// RouteHints are optional route hints to reach the destination through
269+
// private channels.
270+
RouteHints [][]zpay32.HopHint
271+
}
272+
237273
// LoopInTerms are the server terms on which it executes loop in swaps.
238274
type LoopInTerms struct {
239275
// MinSwapAmount is the minimum amount that the server requires for a

0 commit comments

Comments
 (0)