From 79f23c6e22407978ebac45253080c74ba8a7e33e Mon Sep 17 00:00:00 2001 From: Jason Brill Date: Thu, 4 Dec 2025 08:24:31 -0700 Subject: [PATCH] deps: upgrade loop to v0.31.7-beta --- lib/types/proto/loop/client.ts | 85 ++++++++++++++- package.json | 2 +- .../client.proto | 101 +++++++++++++++++- .../debug.proto | 0 .../swapserverrpc/common.proto | 0 .../swapserverrpc/server.proto | 22 ++++ 6 files changed, 203 insertions(+), 7 deletions(-) rename protos/loop/{v0.31.2-beta => v0.31.7-beta}/client.proto (94%) rename protos/loop/{v0.31.2-beta => v0.31.7-beta}/debug.proto (100%) rename protos/loop/{v0.31.2-beta => v0.31.7-beta}/swapserverrpc/common.proto (100%) rename protos/loop/{v0.31.2-beta => v0.31.7-beta}/swapserverrpc/server.proto (96%) diff --git a/lib/types/proto/loop/client.ts b/lib/types/proto/loop/client.ts index 87104d2..97628cf 100644 --- a/lib/types/proto/loop/client.ts +++ b/lib/types/proto/loop/client.ts @@ -268,6 +268,10 @@ export enum StaticAddressLoopInSwapState { UNRECOGNIZED = 'UNRECOGNIZED' } +export interface StopDaemonRequest {} + +export interface StopDaemonResponse {} + export interface LoopOutRequest { /** Requested swap amount in sat. This does not include the swap and miner fee. */ amt: string; @@ -622,7 +626,12 @@ export interface OutTermsResponse { } export interface QuoteRequest { - /** The amount to swap in satoshis. */ + /** + * The amount to swap in satoshis. In the loop-in case this can either be taken + * from the connected lnd wallet or coin-selected from static address deposits. + * This is controlled by the select_deposits flag. If deposit_outpoints are + * specified, the coins are taken out of that. + */ amt: string; /** * The confirmation target that should be used either for the sweep of the @@ -660,8 +669,9 @@ export interface QuoteRequest { private: boolean; /** * Static address deposit outpoints that will be quoted for. This option only - * pertains to loop in swaps. Either this or the amt parameter can be set at - * the same time. + * pertains to loop in swaps. If the amt field is set as well the respective + * partial amount will be swapped. Cannot be used in conjunction with + * auto_select_deposits. */ depositOutpoints: string[]; /** @@ -669,6 +679,19 @@ export interface QuoteRequest { * be returned in the specified asset. */ assetInfo: AssetLoopOutRequest | undefined; + /** + * In the legacy loop-in case this field must be set to false. + * If set to true, the swap amount will be automatically selected from the + * static address deposits. If set to true, deposit_outpoints must be empty. + * This option only pertains to loop in swaps. + */ + autoSelectDeposits: boolean; + /** + * If set to true the server will immediately publish the swap in exchange for + * a higher fee. This can be useful if the client expects change from a swap. + * Note that this feature is only available for static address loop in swaps. + */ + fast: boolean; } export interface InQuoteResponse { @@ -687,6 +710,12 @@ export interface InQuoteResponse { cltvDelta: number; /** The confirmation target to be used to publish the on-chain HTLC. */ confTarget: number; + /** + * If the quote request was for a static address loop in and only contained + * deposit outpoints the quote response will return the total amount of the + * selected deposits. + */ + quotedAmt: string; } export interface OutQuoteResponse { @@ -947,6 +976,12 @@ export interface LiquidityParameters { * not be able to be batched with other swaps. */ fastSwapPublication: boolean; + /** + * A list of peers (their public keys) that should be excluded from the easy + * autoloop run. If set, channels connected to these peers won't be + * considered for easy autoloop swaps. + */ + easyAutoloopExcludedPeers: Uint8Array | string[]; } export interface LiquidityParameters_EasyAssetParamsEntry { @@ -1282,6 +1317,11 @@ export interface Deposit { * loop-in swap anymore. */ blocksUntilExpiry: string; + /** + * The swap hash of the swap that this deposit is part of. This field is only + * set if the deposit is part of a loop-in swap. + */ + swapHash: Uint8Array | string; } export interface StaticAddressWithdrawal { @@ -1320,6 +1360,8 @@ export interface StaticAddressLoopInSwap { * fees. */ paymentRequestAmountSatoshis: string; + /** The deposits that were used for this swap. */ + deposits: Deposit[]; } export interface StaticAddressLoopInRequest { @@ -1366,6 +1408,22 @@ export interface StaticAddressLoopInRequest { * side and the client can retry the swap with different parameters. */ paymentTimeoutSeconds: number; + /** + * The optional swap amount the client is attempting to swap. It can be + * provided in combination with the outpoints or separately. If provided with + * outpoints the client takes out this amount from the sum of provided + * outpoints and sends the change back to the static address. If the amount is + * provided without outpoints, the client will select deposits automatically. + * The coin selection strategy is simplified by sorting all available deposits + * in descending order by amount, and equal amounts in ascending order of + * blocks until expiry, and then selecting the largest deposits first until the + * amount is reached. The change will be sent back to the static address. If a + * subset of outpoints suffice to cover the specified amount the swap will be + * canceled to allow the user to safe on transaction fees. + */ + amount: string; + /** If set, request the server to use fast publication behavior. */ + fast: boolean; } export interface StaticAddressLoopInResponse { @@ -1402,6 +1460,20 @@ export interface StaticAddressLoopInResponse { * side and the client can retry the swap with different parameters. */ paymentTimeoutSeconds: number; + /** The deposits that are used for this swap. */ + usedDeposits: Deposit[]; + /** + * The amount that is being swapped (may be less than total deposit value if + * change is returned). + */ + swapAmount: string; + /** The change amount that will be returned to the static address. */ + change: string; + /** + * If set, indicates that the server was requested to use fast publication + * behavior. + */ + fast: boolean; } export interface AssetLoopOutRequest { @@ -1610,6 +1682,13 @@ export interface SwapClient { * GetInfo gets basic information about the loop daemon. */ getInfo(request?: DeepPartial): Promise; + /** + * loop: `stop` + * StopDaemon instructs the daemon to shut down gracefully. + */ + stopDaemon( + request?: DeepPartial + ): Promise; /** * loop: `getparams` * GetLiquidityParams gets the parameters that the daemon's liquidity manager diff --git a/package.json b/package.json index 9f0693d..f0940e4 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "types": "./dist/index.d.ts", "config": { "lnd_release_tag": "v0.19.1-beta", - "loop_release_tag": "v0.31.2-beta", + "loop_release_tag": "v0.31.7-beta", "pool_release_tag": "v0.6.6-beta", "faraday_release_tag": "v0.2.16-alpha", "tapd_release_tag": "v0.6.0", diff --git a/protos/loop/v0.31.2-beta/client.proto b/protos/loop/v0.31.7-beta/client.proto similarity index 94% rename from protos/loop/v0.31.2-beta/client.proto rename to protos/loop/v0.31.7-beta/client.proto index b1247e9..eba7aca 100644 --- a/protos/loop/v0.31.2-beta/client.proto +++ b/protos/loop/v0.31.7-beta/client.proto @@ -100,6 +100,11 @@ service SwapClient { */ rpc GetInfo (GetInfoRequest) returns (GetInfoResponse); + /* loop: `stop` + StopDaemon instructs the daemon to shut down gracefully. + */ + rpc StopDaemon (StopDaemonRequest) returns (StopDaemonResponse); + /* loop: `getparams` GetLiquidityParams gets the parameters that the daemon's liquidity manager is currently configured with. This may be nil if nothing is configured. @@ -202,6 +207,12 @@ service SwapClient { returns (StaticAddressLoopInResponse); } +message StopDaemonRequest { +} + +message StopDaemonResponse { +} + message LoopOutRequest { /* Requested swap amount in sat. This does not include the swap and miner fee. @@ -775,7 +786,10 @@ message OutTermsResponse { message QuoteRequest { /* - The amount to swap in satoshis. + The amount to swap in satoshis. In the loop-in case this can either be taken + from the connected lnd wallet or coin-selected from static address deposits. + This is controlled by the select_deposits flag. If deposit_outpoints are + specified, the coins are taken out of that. */ int64 amt = 1; @@ -823,8 +837,9 @@ message QuoteRequest { /* Static address deposit outpoints that will be quoted for. This option only - pertains to loop in swaps. Either this or the amt parameter can be set at - the same time. + pertains to loop in swaps. If the amt field is set as well the respective + partial amount will be swapped. Cannot be used in conjunction with + auto_select_deposits. */ repeated string deposit_outpoints = 8; @@ -833,6 +848,21 @@ message QuoteRequest { be returned in the specified asset. */ AssetLoopOutRequest asset_info = 9; + + /* + In the legacy loop-in case this field must be set to false. + If set to true, the swap amount will be automatically selected from the + static address deposits. If set to true, deposit_outpoints must be empty. + This option only pertains to loop in swaps. + */ + bool auto_select_deposits = 10; + + /* + If set to true the server will immediately publish the swap in exchange for + a higher fee. This can be useful if the client expects change from a swap. + Note that this feature is only available for static address loop in swaps. + */ + bool fast = 11; } message InQuoteResponse { @@ -862,6 +892,13 @@ message InQuoteResponse { The confirmation target to be used to publish the on-chain HTLC. */ int32 conf_target = 6; + + /* + If the quote request was for a static address loop in and only contained + deposit outpoints the quote response will return the total amount of the + selected deposits. + */ + int64 quoted_amt = 7; } message OutQuoteResponse { @@ -1243,6 +1280,13 @@ message LiquidityParameters { * not be able to be batched with other swaps. */ bool fast_swap_publication = 26; + + /* + A list of peers (their public keys) that should be excluded from the easy + autoloop run. If set, channels connected to these peers won't be + considered for easy autoloop swaps. + */ + repeated bytes easy_autoloop_excluded_peers = 27; } message EasyAssetAutoloopParams { @@ -1910,6 +1954,12 @@ message Deposit { loop-in swap anymore. */ int64 blocks_until_expiry = 6; + + /* + The swap hash of the swap that this deposit is part of. This field is only + set if the deposit is part of a loop-in swap. + */ + bytes swap_hash = 7; } message StaticAddressWithdrawal { @@ -1971,6 +2021,11 @@ message StaticAddressLoopInSwap { fees. */ int64 payment_request_amount_satoshis = 5; + + /* + The deposits that were used for this swap. + */ + repeated Deposit deposits = 6; } enum StaticAddressLoopInSwapState { @@ -2078,6 +2133,24 @@ message StaticAddressLoopInRequest { side and the client can retry the swap with different parameters. */ uint32 payment_timeout_seconds = 8; + + /* + The optional swap amount the client is attempting to swap. It can be + provided in combination with the outpoints or separately. If provided with + outpoints the client takes out this amount from the sum of provided + outpoints and sends the change back to the static address. If the amount is + provided without outpoints, the client will select deposits automatically. + The coin selection strategy is simplified by sorting all available deposits + in descending order by amount, and equal amounts in ascending order of + blocks until expiry, and then selecting the largest deposits first until the + amount is reached. The change will be sent back to the static address. If a + subset of outpoints suffice to cover the specified amount the swap will be + canceled to allow the user to safe on transaction fees. + */ + int64 amount = 9; + + // If set, request the server to use fast publication behavior. + bool fast = 10; } message StaticAddressLoopInResponse { @@ -2142,6 +2215,28 @@ message StaticAddressLoopInResponse { side and the client can retry the swap with different parameters. */ uint32 payment_timeout_seconds = 11; + + /* + The deposits that are used for this swap. + */ + repeated Deposit used_deposits = 12; + + /* + The amount that is being swapped (may be less than total deposit value if + change is returned). + */ + uint64 swap_amount = 13; + + /* + The change amount that will be returned to the static address. + */ + int64 change = 14; + + /* + If set, indicates that the server was requested to use fast publication + behavior. + */ + bool fast = 15; } message AssetLoopOutRequest { diff --git a/protos/loop/v0.31.2-beta/debug.proto b/protos/loop/v0.31.7-beta/debug.proto similarity index 100% rename from protos/loop/v0.31.2-beta/debug.proto rename to protos/loop/v0.31.7-beta/debug.proto diff --git a/protos/loop/v0.31.2-beta/swapserverrpc/common.proto b/protos/loop/v0.31.7-beta/swapserverrpc/common.proto similarity index 100% rename from protos/loop/v0.31.2-beta/swapserverrpc/common.proto rename to protos/loop/v0.31.7-beta/swapserverrpc/common.proto diff --git a/protos/loop/v0.31.2-beta/swapserverrpc/server.proto b/protos/loop/v0.31.7-beta/swapserverrpc/server.proto similarity index 96% rename from protos/loop/v0.31.2-beta/swapserverrpc/server.proto rename to protos/loop/v0.31.7-beta/swapserverrpc/server.proto index 23195a8..26d69a0 100644 --- a/protos/loop/v0.31.2-beta/swapserverrpc/server.proto +++ b/protos/loop/v0.31.7-beta/swapserverrpc/server.proto @@ -294,6 +294,10 @@ message ServerLoopInQuoteRequest { // service fee. This is to cover for the increased on-chain fee the server // has to pay when the sweeping transaction is broadcast. uint32 num_static_address_deposits = 7; + + // If set, request the server to use fast publication behavior. Note that + // this falg is only available for static address loop ins. + bool fast = 8; } message ServerLoopInQuoteResponse { @@ -660,6 +664,12 @@ message FetchL402Response { // SubscribeNotificationsRequest is a request to subscribe to notifications. message SubscribeNotificationsRequest { + enum ListenerVersion { + LEGACY = 0; + V1 = 1; + } + + ListenerVersion version = 1; } // SubscribeNotificationsResponse is a response to a @@ -668,6 +678,7 @@ message SubscribeNotificationsResponse { oneof notification { ServerReservationNotification reservation_notification = 1; ServerStaticLoopInSweepNotification static_loop_in_sweep = 2; + ServerUnfinishedSwapNotification unfinished_swap = 3; } } @@ -687,3 +698,14 @@ message ServerStaticLoopInSweepNotification { // The prevout information of the sweep txn. repeated PrevoutInfo prevout_info = 4; } + +// ServerUnfinishedSwapNotification notifies the client about an unfinished +// swap that needs attention. This is useful in client data loss scenarios to +// help the client recover the swap. +message ServerUnfinishedSwapNotification { + // The swap hash of the unfinished swap. + bytes swap_hash = 1; + + // Whether the swap is a loop in or loop out. + bool is_loop_in = 2; +}