lnrpc: use a protobuf oneof for the different types of fee limits

This commit is contained in:
Wilmer Paulino 2018-04-18 18:13:55 -04:00
parent 6746609ec6
commit df6d75a054
No known key found for this signature in database
GPG key ID: 6DF57B9F9514972F
3 changed files with 653 additions and 485 deletions

File diff suppressed because it is too large Load diff

View file

@ -646,6 +646,16 @@ message TransactionDetails {
repeated Transaction transactions = 1 [json_name = "transactions"]; repeated Transaction transactions = 1 [json_name = "transactions"];
} }
message FeeLimit {
oneof limit {
/// The fee limit expressed as a fixed amount of satoshis.
int64 fixed = 1;
/// The fee limit expressed as a percentage of the payment amount.
int64 percent = 2;
}
}
message SendRequest { message SendRequest {
/// The identity pubkey of the payment recipient /// The identity pubkey of the payment recipient
bytes dest = 1; bytes dest = 1;
@ -669,12 +679,19 @@ message SendRequest {
*/ */
string payment_request = 6; string payment_request = 6;
/// The CLTV delta from the current height that should be used to set the timelock for the final hop. /**
The CLTV delta from the current height that should be used to set the
timelock for the final hop.
*/
int32 final_cltv_delta = 7; int32 final_cltv_delta = 7;
/// The maximum total fees for the payment in satoshis. /**
int64 fee_limit = 8 [json_name = "fee_limit"]; The maximum number of satoshis that will be paid as a fee of the payment.
This value can be represented either as a percentage of the amount being
sent, or as a fixed amount of the maximum fee the user is willing the pay to
send the payment.
*/
FeeLimit fee_limit = 8;
} }
message SendResponse { message SendResponse {
string payment_error = 1 [json_name = "payment_error"]; string payment_error = 1 [json_name = "payment_error"];
@ -1235,11 +1252,16 @@ message QueryRoutesRequest {
/// An optional CLTV delta from the current height that should be used for the timelock of the final hop /// An optional CLTV delta from the current height that should be used for the timelock of the final hop
int32 final_cltv_delta = 4; int32 final_cltv_delta = 4;
/// The maximum total fees for the route in satoshis. /**
int64 fee_limit = 5; The maximum number of satoshis that will be paid as a fee of the payment.
This value can be represented either as a percentage of the amount being
sent, or as a fixed amount of the maximum fee the user is willing the pay to
send the payment.
*/
FeeLimit fee_limit = 5;
} }
message QueryRoutesResponse { message QueryRoutesResponse {
repeated Route routes = 1 [ json_name = "routes"]; repeated Route routes = 1 [json_name = "routes"];
} }
message Hop { message Hop {

View file

@ -476,8 +476,16 @@
"format": "int32" "format": "int32"
}, },
{ {
"name": "fee_limit", "name": "fee_limit.fixed",
"description": "/ The maximum total fees for the route in satoshis.", "description": "/ The fee limit expressed as a fixed amount of satoshis.",
"in": "query",
"required": false,
"type": "string",
"format": "int64"
},
{
"name": "fee_limit.percent",
"description": "/ The fee limit expressed as a percentage of the payment amount.",
"in": "query", "in": "query",
"required": false, "required": false,
"type": "string", "type": "string",
@ -1340,6 +1348,21 @@
"lnrpcDisconnectPeerResponse": { "lnrpcDisconnectPeerResponse": {
"type": "object" "type": "object"
}, },
"lnrpcFeeLimit": {
"type": "object",
"properties": {
"fixed": {
"type": "string",
"format": "int64",
"description": "/ The fee limit expressed as a fixed amount of satoshis."
},
"percent": {
"type": "string",
"format": "int64",
"description": "/ The fee limit expressed as a percentage of the payment amount."
}
}
},
"lnrpcFeeReportResponse": { "lnrpcFeeReportResponse": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -2388,12 +2411,11 @@
"final_cltv_delta": { "final_cltv_delta": {
"type": "integer", "type": "integer",
"format": "int32", "format": "int32",
"description": "/ The CLTV delta from the current height that should be used to set the timelock for the final hop." "description": "*\nThe CLTV delta from the current height that should be used to set the\ntimelock for the final hop."
}, },
"fee_limit": { "fee_limit": {
"type": "string", "$ref": "#/definitions/lnrpcFeeLimit",
"format": "int64", "description": "*\nThe maximum number of satoshis that will be paid as a fee of the payment.\nThis value can be represented either as a percentage of the amount being\nsent, or as a fixed amount of the maximum fee the user is willing the pay to\nsend the payment."
"description": "/ The maximum total fees for the payment in satoshis."
} }
} }
}, },