mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
looprpc: fractional amount for static address loop-ins
The QuoteRequest adds a field auto_select_deposits to signal that the specified quote amount should be coin-selected from the client's deposits to determine the number of deposits to quote for. The StaticAddressLoopInRequest gets a new amount field that either indicates that the swap amount should be allocated from the passed deposits or coin-selected from all available deposits.
This commit is contained in:
parent
22ac716726
commit
4931fb9ccd
3 changed files with 923 additions and 843 deletions
1711
looprpc/client.pb.go
1711
looprpc/client.pb.go
File diff suppressed because it is too large
Load diff
|
|
@ -775,7 +775,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 +826,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 +837,14 @@ 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;
|
||||
}
|
||||
|
||||
message InQuoteResponse {
|
||||
|
|
@ -2089,6 +2101,21 @@ 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;
|
||||
}
|
||||
|
||||
message StaticAddressLoopInResponse {
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@
|
|||
"parameters": [
|
||||
{
|
||||
"name": "amt",
|
||||
"description": "The amount to swap in satoshis.",
|
||||
"description": "The amount to swap in satoshis. In the loop-in case this can either be taken\nfrom the connected lnd wallet or coin-selected from static address deposits.\nThis is controlled by the select_deposits flag. If deposit_outpoints are\nspecified, the coins are taken out of that.",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
|
|
@ -257,7 +257,7 @@
|
|||
},
|
||||
{
|
||||
"name": "deposit_outpoints",
|
||||
"description": "Static address deposit outpoints that will be quoted for. This option only\npertains to loop in swaps. Either this or the amt parameter can be set at\nthe same time.",
|
||||
"description": "Static address deposit outpoints that will be quoted for. This option only\npertains to loop in swaps. If the amt field is set as well the respective\npartial amount will be swapped. Cannot be used in conjunction with\nauto_select_deposits.",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "array",
|
||||
|
|
@ -297,6 +297,13 @@
|
|||
"required": false,
|
||||
"type": "string",
|
||||
"format": "int64"
|
||||
},
|
||||
{
|
||||
"name": "auto_select_deposits",
|
||||
"description": "In the legacy loop-in case this field must be set to false.\nIf set to true, the swap amount will be automatically selected from the\nstatic address deposits. If set to true, deposit_outpoints must be empty.\nThis option only pertains to loop in swaps.",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "boolean"
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
|
|
@ -404,7 +411,7 @@
|
|||
"parameters": [
|
||||
{
|
||||
"name": "amt",
|
||||
"description": "The amount to swap in satoshis.",
|
||||
"description": "The amount to swap in satoshis. In the loop-in case this can either be taken\nfrom the connected lnd wallet or coin-selected from static address deposits.\nThis is controlled by the select_deposits flag. If deposit_outpoints are\nspecified, the coins are taken out of that.",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
|
|
@ -450,7 +457,7 @@
|
|||
},
|
||||
{
|
||||
"name": "deposit_outpoints",
|
||||
"description": "Static address deposit outpoints that will be quoted for. This option only\npertains to loop in swaps. Either this or the amt parameter can be set at\nthe same time.",
|
||||
"description": "Static address deposit outpoints that will be quoted for. This option only\npertains to loop in swaps. If the amt field is set as well the respective\npartial amount will be swapped. Cannot be used in conjunction with\nauto_select_deposits.",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "array",
|
||||
|
|
@ -490,6 +497,13 @@
|
|||
"required": false,
|
||||
"type": "string",
|
||||
"format": "int64"
|
||||
},
|
||||
{
|
||||
"name": "auto_select_deposits",
|
||||
"description": "In the legacy loop-in case this field must be set to false.\nIf set to true, the swap amount will be automatically selected from the\nstatic address deposits. If set to true, deposit_outpoints must be empty.\nThis option only pertains to loop in swaps.",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "boolean"
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue