Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions cmd/loop/loopin.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ var (
"with our reserved prefix: %v.",
labels.MaxLength, labels.Reserved),
}
routeHintsFlag = &cli.StringSliceFlag{
routeHintsFlag = &cli.StringFlag{
Name: "route_hints",
Usage: "route hints that can each be individually used " +
"to assist in reaching the invoice's destination",
Usage: "a JSON array of route hints that can each be " +
"individually used to assist in reaching the invoice's " +
"destination",
}
privateFlag = &cli.BoolFlag{
Name: "private",
Expand Down
1 change: 1 addition & 0 deletions cmd/loop/testdata/sessions/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Base URL: `http://127.0.0.1:12345`
| `loopout/` | `loop out` (forced success), `loop out` (invalid amount), `loop out` (addr + account error), `loop out` (invalid account address type), `loop out` (amt flag + channel + max routing fee + payment timeout), `loop out` (addr flag), `loop out` (positional addr), `loop out` (account + account_addr_type) |
| `misc/` | `loop terms` |
| `quote/` | `loop quote out` (success + verbose), `loop quote in` (help + verbose), `loop quote out` (help), `loop quote in` (deposit_outpoint success), `loop quote in` (positional + last_hop) |
| `route-hints/` | `loop quote in`, `loop in`, and `loop static in` with empty, single, multiple, and multi-hop route-hint arrays; malformed and invalid hints; comma-separated deposit and UTXO selections |
| `static/` | `loop static withdraw` (no selection error), `loop static withdraw` (invalid utxo), `loop static withdraw` (all success), `loop static withdraw` (utxo + dest_addr success), `loop static listwithdrawals`, `loop static listswaps` |
| `static-autoloop/` | `loop setparams --loopinsource static-address` (success + no-experimental error), `loop getparams` (static-address loop-in source), `loop suggestswaps` (static loop-in suggestion) |
| `static-loop-in/` | `loop static new`, `loop static` (help), `loop static listunspent` (incl alias), `loop static listdeposits`, `loop static summary`, `loop static in` (multiple args/flags cases), `loop static in` (duplicate outpoints), `loop static in` (positional low amount error), `loop static in` (positional + last_hop + payment_timeout), `loop static in` (all cancel), `loop static in` (explicit and automatically selected low-confirmation warnings) |
Expand Down
38 changes: 18 additions & 20 deletions cmd/loop/testdata/sessions/quote/02_loop-quote-in-help.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,7 @@
"kind": "stdout",
"data": {
"lines": [
"NAME:\n",
" loop quote in - get a quote for the cost of a loop in swap\n",
"\n",
"USAGE:\n",
" loop quote in amt\n",
"\n",
"DESCRIPTION:\n",
" Allows to determine the cost of a swap up front.Either specify an amount or deposit outpoints.\n",
"\n",
"OPTIONS:\n"
"NAME:\n"
]
}
},
Expand All @@ -38,11 +29,9 @@
"kind": "stdout",
"data": {
"lines": [
" --last_hop string the pubkey of the last hop to use for the quote\n",
" --conf_target uint the target number of blocks the on-chain htlc broadcast by the swap client should confirm within (default: 0)\n",
" --verbose, -v show expanded details (default: false)\n",
" --private generates and passes routehints. Should be used if the connected node is only reachable via private channels (default: false)\n",
" --route_hints string [ --route_hints string ] "
" loop quote in - get a quote for the cost of a loop in swap\n",
"\n",
"USAGE:\n"
]
}
},
Expand All @@ -51,8 +40,9 @@
"kind": "stdout",
"data": {
"lines": [
" route hints that can each be individually used to assist in reaching the invoice's destination\n",
" --deposit_outpoint string [ --deposit_outpoint string ] one or more static address deposit outpoints to quote for. Deposit outpoints are not to be used in combination with an amount. Eachadditional outpoint can be added by specifying --deposit_outpoint tx_id:idx\n"
" loop quote in amt\n",
"\n",
"DESCRIPTION:\n"
]
}
},
Expand All @@ -61,7 +51,9 @@
"kind": "stdout",
"data": {
"lines": [
" --help, -h "
" Allows to determine the cost of a swap up front.Either specify an amount or deposit outpoints.\n",
"\n",
"OPTIONS:\n"
]
}
},
Expand All @@ -70,7 +62,12 @@
"kind": "stdout",
"data": {
"lines": [
" "
" --last_hop string the pubkey of the last hop to use for the quote\n",
" --conf_target uint the target number of blocks the on-chain htlc broadcast by the swap client should confirm within (default: 0)\n",
" --verbose, -v show expanded details (default: false)\n",
" --private generates and passes routehints. Should be used if the connected node is only reachable via private channels (default: false)\n",
" --route_hints string a JSON array of route hints that can each be individually used to assist in reaching the invoice's destination\n",
" --deposit_outpoint string [ --deposit_outpoint string ] one or more static address deposit outpoints to quote for. Deposit outpoints are not to be used in combination with an amount. Eachadditional outpoint can be added by specifying --deposit_outpoint tx_id:idx"
]
}
},
Expand All @@ -79,7 +76,8 @@
"kind": "stdout",
"data": {
"lines": [
"show help\n"
"\n",
" --help, -h show help\n"
]
}
},
Expand Down
85 changes: 85 additions & 0 deletions cmd/loop/testdata/sessions/route-hints/01_quote-one-route.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"metadata": {
"args": [
"loop",
"quote",
"in",
"--network",
"regtest",
"--route_hints",
"[{\"hop_hints\":[{\"node_id\":\"022222222222222222222222222222222222222222222222222222222222222222\",\"chan_id\":\"111111111111111\",\"fee_base_msat\":1000,\"fee_proportional_millionths\":1,\"cltv_expiry_delta\":80}]}]",
"250000"
],
"version": "0.35.0-beta commit= commit_hash=",
"duration": 15981312,
"clock_start_unix": 1787783813
},
"events": [
{
"time_ms": 1,
"kind": "grpc",
"data": {
"method": "/looprpc.SwapClient/GetLoopInQuote",
"event": "request",
"message_type": "looprpc.QuoteRequest",
"payload": {
"amt": "250000",
"conf_target": 0,
"external_htlc": false,
"swap_publication_deadline": "0",
"loop_in_last_hop": "",
"loop_in_route_hints": [
{
"hop_hints": [
{
"node_id": "022222222222222222222222222222222222222222222222222222222222222222",
"chan_id": "111111111111111",
"fee_base_msat": 1000,
"fee_proportional_millionths": 1,
"cltv_expiry_delta": 80
}
]
}
],
"private": false,
"deposit_outpoints": [],
"asset_info": null,
"auto_select_deposits": false,
"fast": false
}
}
},
{
"time_ms": 15,
"kind": "grpc",
"data": {
"method": "/looprpc.SwapClient/GetLoopInQuote",
"event": "response",
"message_type": "looprpc.InQuoteResponse",
"payload": {
"swap_fee_sat": "1825",
"htlc_publish_fee_sat": "4125",
"cltv_delta": 0,
"conf_target": 6,
"quoted_amt": "250000"
}
}
},
{
"time_ms": 15,
"kind": "stdout",
"data": {
"lines": [
"Send on-chain: 250000 sat\n",
"Receive off-chain: 244050 sat\n",
"Estimated total fee: 5950 sat\n"
]
}
},
{
"time_ms": 15,
"kind": "exit",
"data": {}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
{
"metadata": {
"args": [
"loop",
"quote",
"in",
"--network",
"regtest",
"--route_hints",
"[{\"hop_hints\":[{\"node_id\":\"022222222222222222222222222222222222222222222222222222222222222222\",\"chan_id\":\"111111111111111\",\"fee_base_msat\":1000,\"fee_proportional_millionths\":1,\"cltv_expiry_delta\":80}]},{\"hopHints\":[{\"nodeId\":\"023333333333333333333333333333333333333333333333333333333333333333\",\"chanId\":\"222222222222222\",\"feeBaseMsat\":1000,\"feeProportionalMillionths\":1,\"cltvExpiryDelta\":80},{\"nodeId\":\"022222222222222222222222222222222222222222222222222222222222222222\",\"chanId\":\"111111111111111\",\"feeBaseMsat\":1000,\"feeProportionalMillionths\":1,\"cltvExpiryDelta\":80}]}]",
"250000"
],
"version": "0.35.0-beta commit= commit_hash=",
"duration": 14344073,
"clock_start_unix": 1787783836
},
"events": [
{
"time_ms": 0,
"kind": "grpc",
"data": {
"method": "/looprpc.SwapClient/GetLoopInQuote",
"event": "request",
"message_type": "looprpc.QuoteRequest",
"payload": {
"amt": "250000",
"conf_target": 0,
"external_htlc": false,
"swap_publication_deadline": "0",
"loop_in_last_hop": "",
"loop_in_route_hints": [
{
"hop_hints": [
{
"node_id": "022222222222222222222222222222222222222222222222222222222222222222",
"chan_id": "111111111111111",
"fee_base_msat": 1000,
"fee_proportional_millionths": 1,
"cltv_expiry_delta": 80
}
]
},
{
"hop_hints": [
{
"node_id": "023333333333333333333333333333333333333333333333333333333333333333",
"chan_id": "222222222222222",
"fee_base_msat": 1000,
"fee_proportional_millionths": 1,
"cltv_expiry_delta": 80
},
{
"node_id": "022222222222222222222222222222222222222222222222222222222222222222",
"chan_id": "111111111111111",
"fee_base_msat": 1000,
"fee_proportional_millionths": 1,
"cltv_expiry_delta": 80
}
]
}
],
"private": false,
"deposit_outpoints": [],
"asset_info": null,
"auto_select_deposits": false,
"fast": false
}
}
},
{
"time_ms": 14,
"kind": "grpc",
"data": {
"method": "/looprpc.SwapClient/GetLoopInQuote",
"event": "response",
"message_type": "looprpc.InQuoteResponse",
"payload": {
"swap_fee_sat": "1825",
"htlc_publish_fee_sat": "4125",
"cltv_delta": 0,
"conf_target": 6,
"quoted_amt": "250000"
}
}
},
{
"time_ms": 14,
"kind": "stdout",
"data": {
"lines": [
"Send on-chain: 250000 sat\n",
"Receive off-chain: 244050 sat\n",
"Estimated total fee: 5950 sat\n"
]
}
},
{
"time_ms": 14,
"kind": "exit",
"data": {}
}
]
}
Loading
Loading