mirror of
https://github.com/lightninglabs/loop
synced 2024-11-09 19:10:47 +00:00
266 lines
10 KiB
JSON
266 lines
10 KiB
JSON
{
|
|
"swagger": "2.0",
|
|
"info": {
|
|
"title": "client.proto",
|
|
"version": "version not set"
|
|
},
|
|
"schemes": [
|
|
"http",
|
|
"https"
|
|
],
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"paths": {
|
|
"/v1/loop/out": {
|
|
"post": {
|
|
"summary": "* loop: `out`\nLoopOut initiates an loop out swap with the given parameters. The call\nreturns after the swap has been set up with the swap server. From that\npoint onwards, progress can be tracked via the SwapStatus stream that is\nreturned from Monitor().",
|
|
"operationId": "LoopOut",
|
|
"responses": {
|
|
"200": {
|
|
"description": "",
|
|
"schema": {
|
|
"$ref": "#/definitions/looprpcSwapResponse"
|
|
}
|
|
}
|
|
},
|
|
"parameters": [
|
|
{
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/looprpcLoopOutRequest"
|
|
}
|
|
}
|
|
],
|
|
"tags": [
|
|
"SwapClient"
|
|
]
|
|
}
|
|
},
|
|
"/v1/loop/out/quote/{amt}": {
|
|
"get": {
|
|
"summary": "* loop: `quote`\nLoopOutQuote returns a quote for a loop out swap with the provided\nparameters.",
|
|
"operationId": "LoopOutQuote",
|
|
"responses": {
|
|
"200": {
|
|
"description": "",
|
|
"schema": {
|
|
"$ref": "#/definitions/looprpcQuoteResponse"
|
|
}
|
|
}
|
|
},
|
|
"parameters": [
|
|
{
|
|
"name": "amt",
|
|
"in": "path",
|
|
"required": true,
|
|
"type": "string",
|
|
"format": "int64"
|
|
}
|
|
],
|
|
"tags": [
|
|
"SwapClient"
|
|
]
|
|
}
|
|
},
|
|
"/v1/loop/out/terms": {
|
|
"get": {
|
|
"summary": "* loop: `terms`\nLoopOutTerms returns the terms that the server enforces for a loop out swap.",
|
|
"operationId": "LoopOutTerms",
|
|
"responses": {
|
|
"200": {
|
|
"description": "",
|
|
"schema": {
|
|
"$ref": "#/definitions/looprpcTermsResponse"
|
|
}
|
|
}
|
|
},
|
|
"tags": [
|
|
"SwapClient"
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"definitions": {
|
|
"looprpcLoopOutRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"amt": {
|
|
"type": "string",
|
|
"format": "int64",
|
|
"description": "*\nRequested swap amount in sat. This does not include the swap and miner fee."
|
|
},
|
|
"dest": {
|
|
"type": "string",
|
|
"description": "*\nBase58 encoded destination address for the swap."
|
|
},
|
|
"max_swap_routing_fee": {
|
|
"type": "string",
|
|
"format": "int64",
|
|
"description": "*\nMaximum off-chain fee in msat that may be paid for payment to the server.\nThis limit is applied during path finding. Typically this value is taken\nfrom the response of the GetQuote call."
|
|
},
|
|
"max_prepay_routing_fee": {
|
|
"type": "string",
|
|
"format": "int64",
|
|
"description": "*\nMaximum off-chain fee in msat that may be paid for payment to the server.\nThis limit is applied during path finding. Typically this value is taken\nfrom the response of the GetQuote call."
|
|
},
|
|
"max_swap_fee": {
|
|
"type": "string",
|
|
"format": "int64",
|
|
"description": "*\nMaximum we are willing to pay the server for the swap. This value is not\ndisclosed in the swap initiation call, but if the server asks for a\nhigher fee, we abort the swap. Typically this value is taken from the\nresponse of the GetQuote call. It includes the prepay amount."
|
|
},
|
|
"max_prepay_amt": {
|
|
"type": "string",
|
|
"format": "int64",
|
|
"description": "*\nMaximum amount of the swap fee that may be charged as a prepayment."
|
|
},
|
|
"max_miner_fee": {
|
|
"type": "string",
|
|
"format": "int64",
|
|
"description": "*\nMaximum in on-chain fees that we are willing to spent. If we want to\nsweep the on-chain htlc and the fee estimate turns out higher than this\nvalue, we cancel the swap. If the fee estimate is lower, we publish the\nsweep tx.\n\nIf the sweep tx is not confirmed, we are forced to ratchet up fees until it\nis swept. Possibly even exceeding max_miner_fee if we get close to the htlc\ntimeout. Because the initial publication revealed the preimage, we have no\nother choice. The server may already have pulled the off-chain htlc. Only\nwhen the fee becomes higher than the swap amount, we can only wait for fees\nto come down and hope - if we are past the timeout - that the server is not\npublishing the revocation.\n\nmax_miner_fee is typically taken from the response of the GetQuote call."
|
|
},
|
|
"loop_out_channel": {
|
|
"type": "string",
|
|
"format": "uint64",
|
|
"description": "*\nThe channel to loop out, the channel to loop out is selected based on the\nlowest routing fee for the swap payment to the server."
|
|
}
|
|
}
|
|
},
|
|
"looprpcQuoteResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"swap_fee": {
|
|
"type": "string",
|
|
"format": "int64",
|
|
"description": "*\nThe fee that the swap server is charging for the swap."
|
|
},
|
|
"prepay_amt": {
|
|
"type": "string",
|
|
"format": "int64",
|
|
"description": "*\nThe part of the swap fee that is requested as a prepayment."
|
|
},
|
|
"miner_fee": {
|
|
"type": "string",
|
|
"format": "int64",
|
|
"description": "*\nAn estimate of the on-chain fee that needs to be paid to sweep the HTLC."
|
|
}
|
|
}
|
|
},
|
|
"looprpcSwapResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"description": "*\nSwap identifier to track status in the update stream that is returned from\nthe Start() call. Currently this is the hash that locks the htlcs."
|
|
},
|
|
"htlc_address": {
|
|
"type": "string",
|
|
"description": "*\nThe address of the on-chain htlc."
|
|
}
|
|
}
|
|
},
|
|
"looprpcSwapState": {
|
|
"type": "string",
|
|
"enum": [
|
|
"INITIATED",
|
|
"PREIMAGE_REVEALED",
|
|
"HTLC_PUBLISHED",
|
|
"SUCCESS",
|
|
"FAILED",
|
|
"INVOICE_SETTLED"
|
|
],
|
|
"default": "INITIATED",
|
|
"description": " - INITIATED: *\nINITIATED is the initial state of a swap. At that point, the initiation\ncall to the server has been made and the payment process has been started\nfor the swap and prepayment invoices.\n - PREIMAGE_REVEALED: *\nPREIMAGE_REVEALED is reached when the sweep tx publication is first\nattempted. From that point on, we should consider the preimage to no\nlonger be secret and we need to do all we can to get the sweep confirmed.\nThis state will mostly coalesce with StateHtlcConfirmed, except in the\ncase where we wait for fees to come down before we sweep.\n - HTLC_PUBLISHED: *\nHTLC_PUBLISHED is reached when the htlc tx has been published in a loop in\nswap.\n - SUCCESS: *\nSUCCESS is the final swap state that is reached when the sweep tx has\nthe required confirmation depth.\n - FAILED: *\nFAILED is the final swap state for a failed swap with or without loss of\nthe swap amount.\n - INVOICE_SETTLED: *\nINVOICE_SETTLED is reached when the swap invoice in a loop in swap has been\npaid, but we are still waiting for the htlc spend to confirm."
|
|
},
|
|
"looprpcSwapStatus": {
|
|
"type": "object",
|
|
"properties": {
|
|
"amt": {
|
|
"type": "string",
|
|
"format": "int64",
|
|
"description": "*\nRequested swap amount in sat. This does not include the swap and miner\nfee."
|
|
},
|
|
"id": {
|
|
"type": "string",
|
|
"description": "*\nSwap identifier to track status in the update stream that is returned from\nthe Start() call. Currently this is the hash that locks the htlcs."
|
|
},
|
|
"type": {
|
|
"$ref": "#/definitions/looprpcSwapType",
|
|
"title": "*\nSwap type"
|
|
},
|
|
"state": {
|
|
"$ref": "#/definitions/looprpcSwapState",
|
|
"description": "*\nState the swap is currently in, see State enum."
|
|
},
|
|
"initiation_time": {
|
|
"type": "string",
|
|
"format": "int64",
|
|
"description": "*\nInitiation time of the swap."
|
|
},
|
|
"last_update_time": {
|
|
"type": "string",
|
|
"format": "int64",
|
|
"description": "*\nInitiation time of the swap."
|
|
},
|
|
"htlc_address": {
|
|
"type": "string",
|
|
"description": "*\nHtlc address."
|
|
}
|
|
}
|
|
},
|
|
"looprpcSwapType": {
|
|
"type": "string",
|
|
"enum": [
|
|
"LOOP_OUT",
|
|
"LOOP_IN"
|
|
],
|
|
"default": "LOOP_OUT",
|
|
"title": "- LOOP_OUT: LOOP_OUT indicates an loop out swap (off-chain to on-chain)\n - LOOP_IN: LOOP_IN indicates a loop in swap (on-chain to off-chain)"
|
|
},
|
|
"looprpcTermsResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"swap_payment_dest": {
|
|
"type": "string",
|
|
"description": "*\nThe node pubkey where the swap payment needs to be paid\nto. This can be used to test connectivity before initiating the swap."
|
|
},
|
|
"swap_fee_base": {
|
|
"type": "string",
|
|
"format": "int64",
|
|
"title": "*\nThe base fee for a swap (sat)"
|
|
},
|
|
"swap_fee_rate": {
|
|
"type": "string",
|
|
"format": "int64",
|
|
"title": "*\nThe fee rate for a swap (parts per million)"
|
|
},
|
|
"prepay_amt": {
|
|
"type": "string",
|
|
"format": "int64",
|
|
"title": "*\nRequired prepay amount"
|
|
},
|
|
"min_swap_amount": {
|
|
"type": "string",
|
|
"format": "int64",
|
|
"title": "*\nMinimum swap amount (sat)"
|
|
},
|
|
"max_swap_amount": {
|
|
"type": "string",
|
|
"format": "int64",
|
|
"title": "*\nMaximum swap amount (sat)"
|
|
},
|
|
"cltv_delta": {
|
|
"type": "integer",
|
|
"format": "int32",
|
|
"title": "*\nOn-chain cltv expiry delta"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|