|
1 | 1 | syntax = "proto3"; |
2 | 2 |
|
3 | 3 | import "swapserverrpc/common.proto"; |
| 4 | +import "lnrpc/lightning.proto"; |
4 | 5 |
|
5 | 6 | package looprpc; |
6 | 7 |
|
@@ -38,6 +39,12 @@ service SwapClient { |
38 | 39 | */ |
39 | 40 | rpc ListSwaps (ListSwapsRequest) returns (ListSwapsResponse); |
40 | 41 |
|
| 42 | + /* loop: `sweephtlc` |
| 43 | + SweepHtlc spends a swap HTLC output via the preimage (success) path using |
| 44 | + the swap's known preimage or an optionally supplied one. |
| 45 | + */ |
| 46 | + rpc SweepHtlc (SweepHtlcRequest) returns (SweepHtlcResponse); |
| 47 | + |
41 | 48 | /* loop: `swapinfo` |
42 | 49 | SwapInfo returns all known details about a single swap. |
43 | 50 | */ |
@@ -200,13 +207,34 @@ service SwapClient { |
200 | 207 | rpc GetStaticAddressSummary (StaticAddressSummaryRequest) |
201 | 208 | returns (StaticAddressSummaryResponse); |
202 | 209 |
|
203 | | - /* loop:`static` |
| 210 | + /* loop:`static in` |
204 | 211 | StaticAddressLoopIn initiates a static address loop-in swap. |
205 | 212 | */ |
206 | 213 | rpc StaticAddressLoopIn (StaticAddressLoopInRequest) |
207 | 214 | returns (StaticAddressLoopInResponse); |
| 215 | + |
| 216 | + /* loop:`static openchannel` |
| 217 | + StaticOpenChannel opens a channel funded by selected static address |
| 218 | + deposits. |
| 219 | + */ |
| 220 | + rpc StaticOpenChannel (StaticOpenChannelRequest) |
| 221 | + returns (StaticOpenChannelResponse); |
| 222 | +} |
| 223 | + |
| 224 | +message StaticOpenChannelRequest { |
| 225 | + // Wrap lnd's request so Loop can extend this RPC with Loop-specific fields |
| 226 | + // without diverging from the upstream API surface. |
| 227 | + lnrpc.OpenChannelRequest open_channel_request = 1; |
208 | 228 | } |
209 | 229 |
|
| 230 | +message StaticOpenChannelResponse { |
| 231 | + /* |
| 232 | + The outpoint of the channel opening transaction in the format |
| 233 | + "txid:output_index". |
| 234 | + */ |
| 235 | + string channel_open_outpoint = 1; |
| 236 | +}; |
| 237 | + |
210 | 238 | message StopDaemonRequest { |
211 | 239 | } |
212 | 240 |
|
@@ -739,6 +767,61 @@ message ListSwapsResponse { |
739 | 767 | int64 next_start_time = 2; |
740 | 768 | } |
741 | 769 |
|
| 770 | +// SweepHtlcRequest instructs loopd to sweep a swap HTLC via its success path. |
| 771 | +message SweepHtlcRequest { |
| 772 | + // Optional override for the sweep destination; defaults to a new address |
| 773 | + // derived from the connected lnd wallet. |
| 774 | + string dest_address = 1; |
| 775 | + |
| 776 | + // Fee rate used for the sweep transaction in sat/vByte. |
| 777 | + uint32 sat_per_vbyte = 2; |
| 778 | + |
| 779 | + // HTLC outpoint to sweep, formatted as "txid:vout". |
| 780 | + string outpoint = 3; |
| 781 | + |
| 782 | + // Optional override for the stored swap preimage. |
| 783 | + bytes preimage = 4; |
| 784 | + |
| 785 | + // If true, publish the sweep transaction immediately. |
| 786 | + bool publish = 5; |
| 787 | + |
| 788 | + // The HTLC address whose output is being swept; used to derive the |
| 789 | + // expected pkScript. |
| 790 | + string htlc_address = 6; |
| 791 | +} |
| 792 | + |
| 793 | +// SweepHtlcResponse returns the broadcast sweep transaction. |
| 794 | +message SweepHtlcResponse { |
| 795 | + // Raw sweep transaction bytes. |
| 796 | + bytes sweep_tx = 1; |
| 797 | + |
| 798 | + // Miner fee paid by the sweep transaction. |
| 799 | + uint64 fee_sats = 2; |
| 800 | + |
| 801 | + // Publish outcome. |
| 802 | + oneof publish { |
| 803 | + PublishNotRequested not_requested = 3; |
| 804 | + PublishSucceeded published = 4; |
| 805 | + PublishFailed failed = 5; |
| 806 | + } |
| 807 | +} |
| 808 | + |
| 809 | +// PublishNotRequested is returned by SweepHtlc if publishing was not requested |
| 810 | +// in SweepHtlcRequest. |
| 811 | +message PublishNotRequested { |
| 812 | +} |
| 813 | + |
| 814 | +// PublishSucceeded is returned by SweepHtlc if publishing was requested in |
| 815 | +// SweepHtlcRequest and it succeeded. |
| 816 | +message PublishSucceeded { |
| 817 | +} |
| 818 | + |
| 819 | +// PublishFailed is returned by SweepHtlc if publishing was requested in |
| 820 | +// SweepHtlcRequest, but failed. It includes the error message. |
| 821 | +message PublishFailed { |
| 822 | + string error = 1; |
| 823 | +} |
| 824 | + |
742 | 825 | message SwapInfoRequest { |
743 | 826 | /* |
744 | 827 | The swap identifier which currently is the hash that locks the HTLCs. When |
@@ -1710,7 +1793,7 @@ message WithdrawDepositsRequest { |
1710 | 1793 | /* |
1711 | 1794 | The outpoints of the deposits to withdraw. |
1712 | 1795 | */ |
1713 | | - repeated OutPoint outpoints = 1; |
| 1796 | + repeated lnrpc.OutPoint outpoints = 1; |
1714 | 1797 |
|
1715 | 1798 | /* |
1716 | 1799 | If set to true, all deposits will be withdrawn. |
@@ -1749,23 +1832,6 @@ message WithdrawDepositsResponse { |
1749 | 1832 | string address = 2; |
1750 | 1833 | } |
1751 | 1834 |
|
1752 | | -message OutPoint { |
1753 | | - /* |
1754 | | - Raw bytes representing the transaction id. |
1755 | | - */ |
1756 | | - bytes txid_bytes = 1; |
1757 | | - |
1758 | | - /* |
1759 | | - Reversed, hex-encoded string representing the transaction id. |
1760 | | - */ |
1761 | | - string txid_str = 2; |
1762 | | - |
1763 | | - /* |
1764 | | - The index of the output on the transaction. |
1765 | | - */ |
1766 | | - uint32 output_index = 3; |
1767 | | -} |
1768 | | - |
1769 | 1835 | message ListStaticAddressDepositsRequest { |
1770 | 1836 | /* |
1771 | 1837 | Filters the list of all stored deposits by deposit state. |
@@ -1853,6 +1919,11 @@ message StaticAddressSummaryResponse { |
1853 | 1919 | The total value of all htlc timeout sweeps that the client swept. |
1854 | 1920 | */ |
1855 | 1921 | int64 value_htlc_timeout_sweeps_satoshis = 9; |
| 1922 | + |
| 1923 | + /* |
| 1924 | + The total value of all deposits that have been used for channel openings. |
| 1925 | + */ |
| 1926 | + int64 value_channels_opened = 10; |
1856 | 1927 | } |
1857 | 1928 |
|
1858 | 1929 | enum DepositState { |
@@ -1921,6 +1992,18 @@ enum DepositState { |
1921 | 1992 | has been sufficiently confirmed. |
1922 | 1993 | */ |
1923 | 1994 | EXPIRED = 10; |
| 1995 | + |
| 1996 | + /* |
| 1997 | + OPENING_CHANNEL indicates that the channel open in which the deposit was |
| 1998 | + used is in progress. |
| 1999 | + */ |
| 2000 | + OPENING_CHANNEL = 11; |
| 2001 | + |
| 2002 | + /* |
| 2003 | + CHANNEL_PUBLISHED indicates that the channel open was finalized and |
| 2004 | + published and that it should be managed from lnd from now on. |
| 2005 | + */ |
| 2006 | + CHANNEL_PUBLISHED = 12; |
1924 | 2007 | } |
1925 | 2008 |
|
1926 | 2009 | message Deposit { |
|
0 commit comments