Merge pull request #4250 from guggero/rest-1-cleanup

REST saga 1/3: Cleanup proto files, generate Swagger docs
This commit is contained in:
Olaoluwa Osuntokun authored and GitHub committed 2020-05-11 17:26:52 -07:00
commit 36e8d1b468
38 files changed
+7018 -4609

No files matched your search

+5 -20
View File
@@ -452,30 +452,15 @@ _exact same_ version of `protoc`. As of the writing of this article, the `lnd`
project uses [v3.4.0](https://github.com/google/protobuf/releases/tag/v3.4.0)
of `protoc`.
The following commit hashes of related projects are also required in order to
generate identical compiled protos and related files:
* grpc-ecosystem/grpc-gateway: `f2862b476edcef83412c7af8687c9cd8e4097c0f`
* golang/protobuf: `ab9f9a6dab164b7d1246e0e688b0ab7b94d8553e`
The following two libraries must be installed with the exact commit hash as
described in [lnrpc README](https://github.com/lightningnetwork/lnd/blob/master/lnrpc/README.md)
otherwise the CI pipeline on Travis will fail:
- grpc-ecosystem/grpc-gateway
- golang/protobuf
For detailed instructions on how to compile modifications to `lnd`'s `protobuf`
definitions, check out the [lnrpc README](https://github.com/lightningnetwork/lnd/blob/master/lnrpc/README.md).
Additionally, in order to maintain a uniform display of the RPC responses
rendered by `lncli`, all added or modified `protof` definitions, _must_ attach
the proper `json_name` option for all fields. An example of such an option can
be found within the definition of the `DebugLevelResponse` struct:
```protobuf
message DebugLevelResponse {
string sub_systems = 1 [ json_name = "sub_systems" ];
}
```
Notice how the `json_name` field option corresponds with the name of the field
itself, and uses a `snake_case` style of name formatting. All added or modified
`proto` fields should adhere to the format above.
<a name="ExtraGoFmtStyle" />
#### 4.8. Additional Style Constraints On Top of `gofmt`
+13 -13
View File
@@ -54,7 +54,7 @@ func (m *StatusRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_StatusRequest proto.InternalMessageInfo
type StatusResponse struct {
/// Indicates whether the autopilot is active or not.
// Indicates whether the autopilot is active or not.
Active bool `protobuf:"varint,1,opt,name=active,proto3" json:"active,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -94,7 +94,7 @@ func (m *StatusResponse) GetActive() bool {
}
type ModifyStatusRequest struct {
/// Whether the autopilot agent should be enabled or not.
// Whether the autopilot agent should be enabled or not.
Enable bool `protobuf:"varint,1,opt,name=enable,proto3" json:"enable,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -166,7 +166,7 @@ var xxx_messageInfo_ModifyStatusResponse proto.InternalMessageInfo
type QueryScoresRequest struct {
Pubkeys []string `protobuf:"bytes,1,rep,name=pubkeys,proto3" json:"pubkeys,omitempty"`
/// If set, we will ignore the local channel state when calculating scores.
// If set, we will ignore the local channel state when calculating scores.
IgnoreLocalState bool `protobuf:"varint,2,opt,name=ignore_local_state,json=ignoreLocalState,proto3" json:"ignore_local_state,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -299,9 +299,9 @@ func (m *QueryScoresResponse_HeuristicResult) GetScores() map[string]float64 {
}
type SetScoresRequest struct {
/// The name of the heuristic to provide scores to.
// The name of the heuristic to provide scores to.
Heuristic string `protobuf:"bytes,1,opt,name=heuristic,proto3" json:"heuristic,omitempty"`
//*
//
//A map from hex-encoded public keys to scores. Scores must be in the range
//[0.0, 1.0].
Scores map[string]float64 `protobuf:"bytes,2,rep,name=scores,proto3" json:"scores,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"fixed64,2,opt,name=value,proto3"`
@@ -442,19 +442,19 @@ const _ = grpc.SupportPackageIsVersion4
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type AutopilotClient interface {
//*
//
//Status returns whether the daemon's autopilot agent is active.
Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusResponse, error)
//*
//
//ModifyStatus is used to modify the status of the autopilot agent, like
//enabling or disabling it.
ModifyStatus(ctx context.Context, in *ModifyStatusRequest, opts ...grpc.CallOption) (*ModifyStatusResponse, error)
//*
//
//QueryScores queries all available autopilot heuristics, in addition to any
//active combination of these heruristics, for the scores they would give to
//the given nodes.
QueryScores(ctx context.Context, in *QueryScoresRequest, opts ...grpc.CallOption) (*QueryScoresResponse, error)
//*
//
//SetScores attempts to set the scores used by the running autopilot agent,
//if the external scoring heuristic is enabled.
SetScores(ctx context.Context, in *SetScoresRequest, opts ...grpc.CallOption) (*SetScoresResponse, error)
@@ -506,19 +506,19 @@ func (c *autopilotClient) SetScores(ctx context.Context, in *SetScoresRequest, o
// AutopilotServer is the server API for Autopilot service.
type AutopilotServer interface {
//*
//
//Status returns whether the daemon's autopilot agent is active.
Status(context.Context, *StatusRequest) (*StatusResponse, error)
//*
//
//ModifyStatus is used to modify the status of the autopilot agent, like
//enabling or disabling it.
ModifyStatus(context.Context, *ModifyStatusRequest) (*ModifyStatusResponse, error)
//*
//
//QueryScores queries all available autopilot heuristics, in addition to any
//active combination of these heruristics, for the scores they would give to
//the given nodes.
QueryScores(context.Context, *QueryScoresRequest) (*QueryScoresResponse, error)
//*
//
//SetScores attempts to set the scores used by the running autopilot agent,
//if the external scoring heuristic is enabled.
SetScores(context.Context, *SetScoresRequest) (*SetScoresResponse, error)
+9 -9
View File
@@ -8,25 +8,25 @@ option go_package = "github.com/lightningnetwork/lnd/lnrpc/autopilotrpc";
// state of the daemon's autopilot agent, and also supply it with information
// that can be used when deciding where to open channels.
service Autopilot {
/**
/*
Status returns whether the daemon's autopilot agent is active.
*/
rpc Status (StatusRequest) returns (StatusResponse);
/**
/*
ModifyStatus is used to modify the status of the autopilot agent, like
enabling or disabling it.
*/
rpc ModifyStatus (ModifyStatusRequest) returns (ModifyStatusResponse);
/**
/*
QueryScores queries all available autopilot heuristics, in addition to any
active combination of these heruristics, for the scores they would give to
the given nodes.
*/
rpc QueryScores (QueryScoresRequest) returns (QueryScoresResponse);
/**
/*
SetScores attempts to set the scores used by the running autopilot agent,
if the external scoring heuristic is enabled.
*/
@@ -37,12 +37,12 @@ message StatusRequest {
}
message StatusResponse {
/// Indicates whether the autopilot is active or not.
// Indicates whether the autopilot is active or not.
bool active = 1;
}
message ModifyStatusRequest {
/// Whether the autopilot agent should be enabled or not.
// Whether the autopilot agent should be enabled or not.
bool enable = 1;
}
@@ -52,7 +52,7 @@ message ModifyStatusResponse {
message QueryScoresRequest {
repeated string pubkeys = 1;
/// If set, we will ignore the local channel state when calculating scores.
// If set, we will ignore the local channel state when calculating scores.
bool ignore_local_state = 2;
}
@@ -66,10 +66,10 @@ message QueryScoresResponse {
}
message SetScoresRequest {
/// The name of the heuristic to provide scores to.
// The name of the heuristic to provide scores to.
string heuristic = 1;
/**
/*
A map from hex-encoded public keys to scores. Scores must be in the range
[0.0, 1.0].
*/
+62
View File
@@ -0,0 +1,62 @@
{
"swagger": "2.0",
"info": {
"title": "autopilotrpc/autopilot.proto",
"version": "version not set"
},
"schemes": [
"http",
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {},
"definitions": {
"QueryScoresResponseHeuristicResult": {
"type": "object",
"properties": {
"heuristic": {
"type": "string"
},
"scores": {
"type": "object",
"additionalProperties": {
"type": "number",
"format": "double"
}
}
}
},
"autopilotrpcModifyStatusResponse": {
"type": "object"
},
"autopilotrpcQueryScoresResponse": {
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"$ref": "#/definitions/QueryScoresResponseHeuristicResult"
}
}
}
},
"autopilotrpcSetScoresResponse": {
"type": "object"
},
"autopilotrpcStatusResponse": {
"type": "object",
"properties": {
"active": {
"type": "boolean",
"format": "boolean",
"description": "Indicates whether the autopilot is active or not."
}
}
}
}
}
+38 -36
View File
@@ -2,6 +2,44 @@ syntax = "proto3";
package chainrpc;
// ChainNotifier is a service that can be used to get information about the
// chain backend by registering notifiers for chain events.
service ChainNotifier {
/*
RegisterConfirmationsNtfn is a synchronous response-streaming RPC that
registers an intent for a client to be notified once a confirmation request
has reached its required number of confirmations on-chain.
A client can specify whether the confirmation request should be for a
particular transaction by its hash or for an output script by specifying a
zero hash.
*/
rpc RegisterConfirmationsNtfn (ConfRequest) returns (stream ConfEvent);
/*
RegisterSpendNtfn is a synchronous response-streaming RPC that registers an
intent for a client to be notification once a spend request has been spent
by a transaction that has confirmed on-chain.
A client can specify whether the spend request should be for a particular
outpoint or for an output script by specifying a zero outpoint.
*/
rpc RegisterSpendNtfn (SpendRequest) returns (stream SpendEvent);
/*
RegisterBlockEpochNtfn is a synchronous response-streaming RPC that
registers an intent for a client to be notified of blocks in the chain. The
stream will return a hash and height tuple of a block for each new/stale
block in the chain. It is the client's responsibility to determine whether
the tuple returned is for a new or stale block in the chain.
A client can also request a historical backlog of blocks from a particular
point. This allows clients to be idempotent by ensuring that they do not
missing processing a single block within the chain.
*/
rpc RegisterBlockEpochNtfn (BlockEpoch) returns (stream BlockEpoch);
}
message ConfRequest {
/*
The transaction hash for which we should request a confirmation notification
@@ -140,39 +178,3 @@ message BlockEpoch {
// The height of the block.
uint32 height = 2;
}
service ChainNotifier {
/*
RegisterConfirmationsNtfn is a synchronous response-streaming RPC that
registers an intent for a client to be notified once a confirmation request
has reached its required number of confirmations on-chain.
A client can specify whether the confirmation request should be for a
particular transaction by its hash or for an output script by specifying a
zero hash.
*/
rpc RegisterConfirmationsNtfn (ConfRequest) returns (stream ConfEvent);
/*
RegisterSpendNtfn is a synchronous response-streaming RPC that registers an
intent for a client to be notification once a spend request has been spent
by a transaction that has confirmed on-chain.
A client can specify whether the spend request should be for a particular
outpoint or for an output script by specifying a zero outpoint.
*/
rpc RegisterSpendNtfn (SpendRequest) returns (stream SpendEvent);
/*
RegisterBlockEpochNtfn is a synchronous response-streaming RPC that
registers an intent for a client to be notified of blocks in the chain. The
stream will return a hash and height tuple of a block for each new/stale
block in the chain. It is the client's responsibility to determine whether
the tuple returned is for a new or stale block in the chain.
A client can also request a historical backlog of blocks from a particular
point. This allows clients to be idempotent by ensuring that they do not
missing processing a single block within the chain.
*/
rpc RegisterBlockEpochNtfn (BlockEpoch) returns (stream BlockEpoch);
}
+208
View File
@@ -0,0 +1,208 @@
{
"swagger": "2.0",
"info": {
"title": "chainrpc/chainnotifier.proto",
"version": "version not set"
},
"schemes": [
"http",
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {},
"definitions": {
"chainrpcBlockEpoch": {
"type": "object",
"properties": {
"hash": {
"type": "string",
"format": "byte",
"description": "The hash of the block."
},
"height": {
"type": "integer",
"format": "int64",
"description": "The height of the block."
}
}
},
"chainrpcConfDetails": {
"type": "object",
"properties": {
"raw_tx": {
"type": "string",
"format": "byte",
"description": "The raw bytes of the confirmed transaction."
},
"block_hash": {
"type": "string",
"format": "byte",
"description": "The hash of the block in which the confirmed transaction was included in."
},
"block_height": {
"type": "integer",
"format": "int64",
"description": "The height of the block in which the confirmed transaction was included\nin."
},
"tx_index": {
"type": "integer",
"format": "int64",
"description": "The index of the confirmed transaction within the transaction."
}
}
},
"chainrpcConfEvent": {
"type": "object",
"properties": {
"conf": {
"$ref": "#/definitions/chainrpcConfDetails",
"description": "An event that includes the confirmation details of the request\n(txid/ouput script)."
},
"reorg": {
"$ref": "#/definitions/chainrpcReorg",
"description": "An event send when the transaction of the request is reorged out of the\nchain."
}
}
},
"chainrpcOutpoint": {
"type": "object",
"properties": {
"hash": {
"type": "string",
"format": "byte",
"description": "The hash of the transaction."
},
"index": {
"type": "integer",
"format": "int64",
"description": "The index of the output within the transaction."
}
}
},
"chainrpcReorg": {
"type": "object"
},
"chainrpcSpendDetails": {
"type": "object",
"properties": {
"spending_outpoint": {
"$ref": "#/definitions/chainrpcOutpoint",
"description": "The outpoint was that spent."
},
"raw_spending_tx": {
"type": "string",
"format": "byte",
"description": "The raw bytes of the spending transaction."
},
"spending_tx_hash": {
"type": "string",
"format": "byte",
"description": "The hash of the spending transaction."
},
"spending_input_index": {
"type": "integer",
"format": "int64",
"description": "The input of the spending transaction that fulfilled the spend request."
},
"spending_height": {
"type": "integer",
"format": "int64",
"description": "The height at which the spending transaction was included in a block."
}
}
},
"chainrpcSpendEvent": {
"type": "object",
"properties": {
"spend": {
"$ref": "#/definitions/chainrpcSpendDetails",
"description": "An event that includes the details of the spending transaction of the\nrequest (outpoint/output script)."
},
"reorg": {
"$ref": "#/definitions/chainrpcReorg",
"description": "An event sent when the spending transaction of the request was\nreorged out of the chain."
}
}
},
"protobufAny": {
"type": "object",
"properties": {
"type_url": {
"type": "string"
},
"value": {
"type": "string",
"format": "byte"
}
}
},
"runtimeStreamError": {
"type": "object",
"properties": {
"grpc_code": {
"type": "integer",
"format": "int32"
},
"http_code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"http_status": {
"type": "string"
},
"details": {
"type": "array",
"items": {
"$ref": "#/definitions/protobufAny"
}
}
}
}
},
"x-stream-definitions": {
"chainrpcBlockEpoch": {
"type": "object",
"properties": {
"result": {
"$ref": "#/definitions/chainrpcBlockEpoch"
},
"error": {
"$ref": "#/definitions/runtimeStreamError"
}
},
"title": "Stream result of chainrpcBlockEpoch"
},
"chainrpcConfEvent": {
"type": "object",
"properties": {
"result": {
"$ref": "#/definitions/chainrpcConfEvent"
},
"error": {
"$ref": "#/definitions/runtimeStreamError"
}
},
"title": "Stream result of chainrpcConfEvent"
},
"chainrpcSpendEvent": {
"type": "object",
"properties": {
"result": {
"$ref": "#/definitions/chainrpcSpendEvent"
},
"error": {
"$ref": "#/definitions/runtimeStreamError"
}
},
"title": "Stream result of chainrpcSpendEvent"
}
}
}
+21 -25
View File
@@ -2,33 +2,29 @@
echo "Generating root gRPC server protos"
# Generate the protos.
protoc -I/usr/local/include -I. \
-I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
--go_out=plugins=grpc,paths=source_relative:. \
rpc.proto
# Generate the REST reverse proxy.
protoc -I/usr/local/include -I. \
-I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
--grpc-gateway_out=logtostderr=true,paths=source_relative:. \
rpc.proto
# Finally, generate the swagger file which describes the REST API in detail.
protoc -I/usr/local/include -I. \
-I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
--swagger_out=logtostderr=true:. \
rpc.proto
PROTOS="rpc.proto walletunlocker.proto **/*.proto"
# For each of the sub-servers, we then generate their protos, but a restricted
# set as they don't yet require REST proxies, or swagger docs.
for file in **/*.proto
do
DIRECTORY=$(dirname ${file})
echo "Generating protos from ${file}, into ${DIRECTORY}"
for file in $PROTOS; do
DIRECTORY=$(dirname "${file}")
echo "Generating protos from ${file}, into ${DIRECTORY}"
protoc -I/usr/local/include -I. \
-I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
--go_out=plugins=grpc,paths=source_relative:. \
${file}
# Generate the protos.
protoc -I/usr/local/include -I. \
-I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
--go_out=plugins=grpc,paths=source_relative:. \
"${file}"
# Generate the REST reverse proxy.
protoc -I/usr/local/include -I. \
-I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
--grpc-gateway_out=logtostderr=true,paths=source_relative:. \
"${file}"
# Finally, generate the swagger file which describes the REST API in detail.
protoc -I/usr/local/include -I. \
-I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
--swagger_out=logtostderr=true:. \
"${file}"
done
+23 -23
View File
@@ -25,7 +25,7 @@ var _ = math.Inf
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type CancelInvoiceMsg struct {
/// Hash corresponding to the (hold) invoice to cancel.
// Hash corresponding to the (hold) invoice to cancel.
PaymentHash []byte `protobuf:"bytes,1,opt,name=payment_hash,json=paymentHash,proto3" json:"payment_hash,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -96,40 +96,40 @@ func (m *CancelInvoiceResp) XXX_DiscardUnknown() {
var xxx_messageInfo_CancelInvoiceResp proto.InternalMessageInfo
type AddHoldInvoiceRequest struct {
//*
//
//An optional memo to attach along with the invoice. Used for record keeping
//purposes for the invoice's creator, and will also be set in the description
//field of the encoded payment request if the description_hash field is not
//being used.
Memo string `protobuf:"bytes,1,opt,name=memo,proto3" json:"memo,omitempty"`
/// The hash of the preimage
// The hash of the preimage
Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"`
//*
//
//The value of this invoice in satoshis
//
//The fields value and value_msat are mutually exclusive.
Value int64 `protobuf:"varint,3,opt,name=value,proto3" json:"value,omitempty"`
//*
//
//The value of this invoice in millisatoshis
//
//The fields value and value_msat are mutually exclusive.
ValueMsat int64 `protobuf:"varint,10,opt,name=value_msat,json=valueMsat,proto3" json:"value_msat,omitempty"`
//*
//
//Hash (SHA-256) of a description of the payment. Used if the description of
//payment (memo) is too long to naturally fit within the description field
//of an encoded payment request.
DescriptionHash []byte `protobuf:"bytes,4,opt,name=description_hash,json=descriptionHash,proto3" json:"description_hash,omitempty"`
/// Payment request expiry time in seconds. Default is 3600 (1 hour).
// Payment request expiry time in seconds. Default is 3600 (1 hour).
Expiry int64 `protobuf:"varint,5,opt,name=expiry,proto3" json:"expiry,omitempty"`
/// Fallback on-chain address.
// Fallback on-chain address.
FallbackAddr string `protobuf:"bytes,6,opt,name=fallback_addr,json=fallbackAddr,proto3" json:"fallback_addr,omitempty"`
/// Delta to use for the time-lock of the CLTV extended to the final hop.
// Delta to use for the time-lock of the CLTV extended to the final hop.
CltvExpiry uint64 `protobuf:"varint,7,opt,name=cltv_expiry,json=cltvExpiry,proto3" json:"cltv_expiry,omitempty"`
//*
//
//Route hints that can each be individually used to assist in reaching the
//invoice's destination.
RouteHints []*lnrpc.RouteHint `protobuf:"bytes,8,rep,name=route_hints,json=routeHints,proto3" json:"route_hints,omitempty"`
/// Whether this invoice should include routing hints for private channels.
// Whether this invoice should include routing hints for private channels.
Private bool `protobuf:"varint,9,opt,name=private,proto3" json:"private,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -232,7 +232,7 @@ func (m *AddHoldInvoiceRequest) GetPrivate() bool {
}
type AddHoldInvoiceResp struct {
//*
//
//A bare-bones invoice for a payment within the Lightning Network. With the
//details of the invoice, the sender has all the data necessary to send a
//payment to the recipient.
@@ -275,8 +275,8 @@ func (m *AddHoldInvoiceResp) GetPaymentRequest() string {
}
type SettleInvoiceMsg struct {
/// Externally discovered pre-image that should be used to settle the hold
/// invoice.
// Externally discovered pre-image that should be used to settle the hold
// invoice.
Preimage []byte `protobuf:"bytes,1,opt,name=preimage,proto3" json:"preimage,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -347,7 +347,7 @@ func (m *SettleInvoiceResp) XXX_DiscardUnknown() {
var xxx_messageInfo_SettleInvoiceResp proto.InternalMessageInfo
type SubscribeSingleInvoiceRequest struct {
/// Hash corresponding to the (hold) invoice to subscribe to.
// Hash corresponding to the (hold) invoice to subscribe to.
RHash []byte `protobuf:"bytes,2,opt,name=r_hash,json=rHash,proto3" json:"r_hash,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -448,21 +448,21 @@ const _ = grpc.SupportPackageIsVersion4
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type InvoicesClient interface {
//*
//
//SubscribeSingleInvoice returns a uni-directional stream (server -> client)
//to notify the client of state transitions of the specified invoice.
//Initially the current invoice state is always sent out.
SubscribeSingleInvoice(ctx context.Context, in *SubscribeSingleInvoiceRequest, opts ...grpc.CallOption) (Invoices_SubscribeSingleInvoiceClient, error)
//*
//
//CancelInvoice cancels a currently open invoice. If the invoice is already
//canceled, this call will succeed. If the invoice is already settled, it will
//fail.
CancelInvoice(ctx context.Context, in *CancelInvoiceMsg, opts ...grpc.CallOption) (*CancelInvoiceResp, error)
//*
//
//AddHoldInvoice creates a hold invoice. It ties the invoice to the hash
//supplied in the request.
AddHoldInvoice(ctx context.Context, in *AddHoldInvoiceRequest, opts ...grpc.CallOption) (*AddHoldInvoiceResp, error)
//*
//
//SettleInvoice settles an accepted invoice. If the invoice is already
//settled, this call will succeed.
SettleInvoice(ctx context.Context, in *SettleInvoiceMsg, opts ...grpc.CallOption) (*SettleInvoiceResp, error)
@@ -537,21 +537,21 @@ func (c *invoicesClient) SettleInvoice(ctx context.Context, in *SettleInvoiceMsg
// InvoicesServer is the server API for Invoices service.
type InvoicesServer interface {
//*
//
//SubscribeSingleInvoice returns a uni-directional stream (server -> client)
//to notify the client of state transitions of the specified invoice.
//Initially the current invoice state is always sent out.
SubscribeSingleInvoice(*SubscribeSingleInvoiceRequest, Invoices_SubscribeSingleInvoiceServer) error
//*
//
//CancelInvoice cancels a currently open invoice. If the invoice is already
//canceled, this call will succeed. If the invoice is already settled, it will
//fail.
CancelInvoice(context.Context, *CancelInvoiceMsg) (*CancelInvoiceResp, error)
//*
//
//AddHoldInvoice creates a hold invoice. It ties the invoice to the hash
//supplied in the request.
AddHoldInvoice(context.Context, *AddHoldInvoiceRequest) (*AddHoldInvoiceResp, error)
//*
//
//SettleInvoice settles an accepted invoice. If the invoice is already
//settled, this call will succeed.
SettleInvoice(context.Context, *SettleInvoiceMsg) (*SettleInvoiceResp, error)
+19 -19
View File
@@ -10,7 +10,7 @@ option go_package = "github.com/lightningnetwork/lnd/lnrpc/invoicesrpc";
// Invoices is a service that can be used to create, accept, settle and cancel
// invoices.
service Invoices {
/**
/*
SubscribeSingleInvoice returns a uni-directional stream (server -> client)
to notify the client of state transitions of the specified invoice.
Initially the current invoice state is always sent out.
@@ -18,20 +18,20 @@ service Invoices {
rpc SubscribeSingleInvoice (SubscribeSingleInvoiceRequest)
returns (stream lnrpc.Invoice);
/**
/*
CancelInvoice cancels a currently open invoice. If the invoice is already
canceled, this call will succeed. If the invoice is already settled, it will
fail.
*/
rpc CancelInvoice (CancelInvoiceMsg) returns (CancelInvoiceResp);
/**
/*
AddHoldInvoice creates a hold invoice. It ties the invoice to the hash
supplied in the request.
*/
rpc AddHoldInvoice (AddHoldInvoiceRequest) returns (AddHoldInvoiceResp);
/**
/*
SettleInvoice settles an accepted invoice. If the invoice is already
settled, this call will succeed.
*/
@@ -39,14 +39,14 @@ service Invoices {
}
message CancelInvoiceMsg {
/// Hash corresponding to the (hold) invoice to cancel.
// Hash corresponding to the (hold) invoice to cancel.
bytes payment_hash = 1;
}
message CancelInvoiceResp {
}
message AddHoldInvoiceRequest {
/**
/*
An optional memo to attach along with the invoice. Used for record keeping
purposes for the invoice's creator, and will also be set in the description
field of the encoded payment request if the description_hash field is not
@@ -54,51 +54,51 @@ message AddHoldInvoiceRequest {
*/
string memo = 1;
/// The hash of the preimage
// The hash of the preimage
bytes hash = 2;
/**
/*
The value of this invoice in satoshis
The fields value and value_msat are mutually exclusive.
*/
int64 value = 3;
/**
/*
The value of this invoice in millisatoshis
The fields value and value_msat are mutually exclusive.
*/
int64 value_msat = 10;
/**
/*
Hash (SHA-256) of a description of the payment. Used if the description of
payment (memo) is too long to naturally fit within the description field
of an encoded payment request.
*/
bytes description_hash = 4;
/// Payment request expiry time in seconds. Default is 3600 (1 hour).
// Payment request expiry time in seconds. Default is 3600 (1 hour).
int64 expiry = 5;
/// Fallback on-chain address.
// Fallback on-chain address.
string fallback_addr = 6;
/// Delta to use for the time-lock of the CLTV extended to the final hop.
// Delta to use for the time-lock of the CLTV extended to the final hop.
uint64 cltv_expiry = 7;
/**
/*
Route hints that can each be individually used to assist in reaching the
invoice's destination.
*/
repeated lnrpc.RouteHint route_hints = 8;
/// Whether this invoice should include routing hints for private channels.
// Whether this invoice should include routing hints for private channels.
bool private = 9;
}
message AddHoldInvoiceResp {
/**
/*
A bare-bones invoice for a payment within the Lightning Network. With the
details of the invoice, the sender has all the data necessary to send a
payment to the recipient.
@@ -107,8 +107,8 @@ message AddHoldInvoiceResp {
}
message SettleInvoiceMsg {
/// Externally discovered pre-image that should be used to settle the hold
/// invoice.
// Externally discovered pre-image that should be used to settle the hold
// invoice.
bytes preimage = 1;
}
@@ -118,6 +118,6 @@ message SettleInvoiceResp {
message SubscribeSingleInvoiceRequest {
reserved 1;
/// Hash corresponding to the (hold) invoice to subscribe to.
// Hash corresponding to the (hold) invoice to subscribe to.
bytes r_hash = 2;
}
+349
View File
@@ -0,0 +1,349 @@
{
"swagger": "2.0",
"info": {
"title": "invoicesrpc/invoices.proto",
"version": "version not set"
},
"schemes": [
"http",
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {},
"definitions": {
"InvoiceInvoiceState": {
"type": "string",
"enum": [
"OPEN",
"SETTLED",
"CANCELED",
"ACCEPTED"
],
"default": "OPEN"
},
"invoicesrpcAddHoldInvoiceResp": {
"type": "object",
"properties": {
"payment_request": {
"type": "string",
"description": "A bare-bones invoice for a payment within the Lightning Network. With the\ndetails of the invoice, the sender has all the data necessary to send a\npayment to the recipient."
}
}
},
"invoicesrpcCancelInvoiceResp": {
"type": "object"
},
"invoicesrpcSettleInvoiceResp": {
"type": "object"
},
"lnrpcFeature": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"is_required": {
"type": "boolean",
"format": "boolean"
},
"is_known": {
"type": "boolean",
"format": "boolean"
}
}
},
"lnrpcHopHint": {
"type": "object",
"properties": {
"node_id": {
"type": "string",
"description": "The public key of the node at the start of the channel."
},
"chan_id": {
"type": "string",
"format": "uint64",
"description": "The unique identifier of the channel."
},
"fee_base_msat": {
"type": "integer",
"format": "int64",
"description": "The base fee of the channel denominated in millisatoshis."
},
"fee_proportional_millionths": {
"type": "integer",
"format": "int64",
"description": "The fee rate of the channel for sending one satoshi across it denominated in\nmillionths of a satoshi."
},
"cltv_expiry_delta": {
"type": "integer",
"format": "int64",
"description": "The time-lock delta of the channel."
}
}
},
"lnrpcInvoice": {
"type": "object",
"properties": {
"memo": {
"type": "string",
"description": "An optional memo to attach along with the invoice. Used for record keeping\npurposes for the invoice's creator, and will also be set in the description\nfield of the encoded payment request if the description_hash field is not\nbeing used."
},
"r_preimage": {
"type": "string",
"format": "byte",
"description": "The hex-encoded preimage (32 byte) which will allow settling an incoming\nHTLC payable to this preimage. When using REST, this field must be encoded\nas base64."
},
"r_hash": {
"type": "string",
"format": "byte",
"description": "The hash of the preimage. When using REST, this field must be encoded as\nbase64."
},
"value": {
"type": "string",
"format": "int64",
"description": "The fields value and value_msat are mutually exclusive.",
"title": "The value of this invoice in satoshis"
},
"value_msat": {
"type": "string",
"format": "int64",
"description": "The fields value and value_msat are mutually exclusive.",
"title": "The value of this invoice in millisatoshis"
},
"settled": {
"type": "boolean",
"format": "boolean",
"title": "Whether this invoice has been fulfilled"
},
"creation_date": {
"type": "string",
"format": "int64",
"title": "When this invoice was created"
},
"settle_date": {
"type": "string",
"format": "int64",
"title": "When this invoice was settled"
},
"payment_request": {
"type": "string",
"description": "A bare-bones invoice for a payment within the Lightning Network. With the\ndetails of the invoice, the sender has all the data necessary to send a\npayment to the recipient."
},
"description_hash": {
"type": "string",
"format": "byte",
"description": "Hash (SHA-256) of a description of the payment. Used if the description of\npayment (memo) is too long to naturally fit within the description field\nof an encoded payment request. When using REST, this field must be encoded\nas base64."
},
"expiry": {
"type": "string",
"format": "int64",
"description": "Payment request expiry time in seconds. Default is 3600 (1 hour)."
},
"fallback_addr": {
"type": "string",
"description": "Fallback on-chain address."
},
"cltv_expiry": {
"type": "string",
"format": "uint64",
"description": "Delta to use for the time-lock of the CLTV extended to the final hop."
},
"route_hints": {
"type": "array",
"items": {
"$ref": "#/definitions/lnrpcRouteHint"
},
"description": "Route hints that can each be individually used to assist in reaching the\ninvoice's destination."
},
"private": {
"type": "boolean",
"format": "boolean",
"description": "Whether this invoice should include routing hints for private channels."
},
"add_index": {
"type": "string",
"format": "uint64",
"description": "The \"add\" index of this invoice. Each newly created invoice will increment\nthis index making it monotonically increasing. Callers to the\nSubscribeInvoices call can use this to instantly get notified of all added\ninvoices with an add_index greater than this one."
},
"settle_index": {
"type": "string",
"format": "uint64",
"description": "The \"settle\" index of this invoice. Each newly settled invoice will\nincrement this index making it monotonically increasing. Callers to the\nSubscribeInvoices call can use this to instantly get notified of all\nsettled invoices with an settle_index greater than this one."
},
"amt_paid": {
"type": "string",
"format": "int64",
"description": "Deprecated, use amt_paid_sat or amt_paid_msat."
},
"amt_paid_sat": {
"type": "string",
"format": "int64",
"description": "The amount that was accepted for this invoice, in satoshis. This will ONLY\nbe set if this invoice has been settled. We provide this field as if the\ninvoice was created with a zero value, then we need to record what amount\nwas ultimately accepted. Additionally, it's possible that the sender paid\nMORE that was specified in the original invoice. So we'll record that here\nas well."
},
"amt_paid_msat": {
"type": "string",
"format": "int64",
"description": "The amount that was accepted for this invoice, in millisatoshis. This will\nONLY be set if this invoice has been settled. We provide this field as if\nthe invoice was created with a zero value, then we need to record what\namount was ultimately accepted. Additionally, it's possible that the sender\npaid MORE that was specified in the original invoice. So we'll record that\nhere as well."
},
"state": {
"$ref": "#/definitions/InvoiceInvoiceState",
"description": "The state the invoice is in."
},
"htlcs": {
"type": "array",
"items": {
"$ref": "#/definitions/lnrpcInvoiceHTLC"
},
"description": "List of HTLCs paying to this invoice [EXPERIMENTAL]."
},
"features": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/lnrpcFeature"
},
"description": "List of features advertised on the invoice."
},
"is_keysend": {
"type": "boolean",
"format": "boolean",
"description": "Indicates if this invoice was a spontaneous payment that arrived via keysend\n[EXPERIMENTAL]."
}
}
},
"lnrpcInvoiceHTLC": {
"type": "object",
"properties": {
"chan_id": {
"type": "string",
"format": "uint64",
"description": "Short channel id over which the htlc was received."
},
"htlc_index": {
"type": "string",
"format": "uint64",
"description": "Index identifying the htlc on the channel."
},
"amt_msat": {
"type": "string",
"format": "uint64",
"description": "The amount of the htlc in msat."
},
"accept_height": {
"type": "integer",
"format": "int32",
"description": "Block height at which this htlc was accepted."
},
"accept_time": {
"type": "string",
"format": "int64",
"description": "Time at which this htlc was accepted."
},
"resolve_time": {
"type": "string",
"format": "int64",
"description": "Time at which this htlc was settled or canceled."
},
"expiry_height": {
"type": "integer",
"format": "int32",
"description": "Block height at which this htlc expires."
},
"state": {
"$ref": "#/definitions/lnrpcInvoiceHTLCState",
"description": "Current state the htlc is in."
},
"custom_records": {
"type": "object",
"additionalProperties": {
"type": "string",
"format": "byte"
},
"description": "Custom tlv records."
},
"mpp_total_amt_msat": {
"type": "string",
"format": "uint64",
"description": "The total amount of the mpp payment in msat."
}
},
"title": "Details of an HTLC that paid to an invoice"
},
"lnrpcInvoiceHTLCState": {
"type": "string",
"enum": [
"ACCEPTED",
"SETTLED",
"CANCELED"
],
"default": "ACCEPTED"
},
"lnrpcRouteHint": {
"type": "object",
"properties": {
"hop_hints": {
"type": "array",
"items": {
"$ref": "#/definitions/lnrpcHopHint"
},
"description": "A list of hop hints that when chained together can assist in reaching a\nspecific destination."
}
}
},
"protobufAny": {
"type": "object",
"properties": {
"type_url": {
"type": "string"
},
"value": {
"type": "string",
"format": "byte"
}
}
},
"runtimeStreamError": {
"type": "object",
"properties": {
"grpc_code": {
"type": "integer",
"format": "int32"
},
"http_code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"http_status": {
"type": "string"
},
"details": {
"type": "array",
"items": {
"$ref": "#/definitions/protobufAny"
}
}
}
}
},
"x-stream-definitions": {
"lnrpcInvoice": {
"type": "object",
"properties": {
"result": {
"$ref": "#/definitions/lnrpcInvoice"
},
"error": {
"$ref": "#/definitions/runtimeStreamError"
}
},
"title": "Stream result of lnrpcInvoice"
}
}
}
+2 -2
View File
@@ -22,9 +22,9 @@ var _ = math.Inf
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type VersionResponse struct {
/// The version information for lncli.
// The version information for lncli.
Lncli *verrpc.Version `protobuf:"bytes,1,opt,name=lncli,proto3" json:"lncli,omitempty"`
/// The version information for lnd.
// The version information for lnd.
Lnd *verrpc.Version `protobuf:"bytes,2,opt,name=lnd,proto3" json:"lnd,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
+2 -2
View File
@@ -7,9 +7,9 @@ package lnclipb;
option go_package = "github.com/lightningnetwork/lnd/lnrpc/lnclipb";
message VersionResponse {
/// The version information for lncli.
// The version information for lncli.
verrpc.Version lncli = 1;
/// The version information for lnd.
// The version information for lnd.
verrpc.Version lnd = 2;
};
+19
View File
@@ -0,0 +1,19 @@
{
"swagger": "2.0",
"info": {
"title": "lnclipb/lncli.proto",
"version": "version not set"
},
"schemes": [
"http",
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {},
"definitions": {}
}
+89 -89
View File
@@ -114,27 +114,27 @@ func (FailureDetail) EnumDescriptor() ([]byte, []int) {
type PaymentState int32
const (
//*
//
//Payment is still in flight.
PaymentState_IN_FLIGHT PaymentState = 0
//*
//
//Payment completed successfully.
PaymentState_SUCCEEDED PaymentState = 1
//*
//
//There are more routes to try, but the payment timeout was exceeded.
PaymentState_FAILED_TIMEOUT PaymentState = 2
//*
//
//All possible routes were tried and failed permanently. Or were no
//routes to the destination at all.
PaymentState_FAILED_NO_ROUTE PaymentState = 3
//*
//
//A non-recoverable error has occured.
PaymentState_FAILED_ERROR PaymentState = 4
//*
//
//Payment details incorrect (unknown hash, invalid amt or
//invalid final cltv delta)
PaymentState_FAILED_INCORRECT_PAYMENT_DETAILS PaymentState = 5
//*
//
//Insufficient local balance.
PaymentState_FAILED_INSUFFICIENT_BALANCE PaymentState = 6
)
@@ -199,38 +199,38 @@ func (HtlcEvent_EventType) EnumDescriptor() ([]byte, []int) {
}
type SendPaymentRequest struct {
/// The identity pubkey of the payment recipient
// The identity pubkey of the payment recipient
Dest []byte `protobuf:"bytes,1,opt,name=dest,proto3" json:"dest,omitempty"`
//*
//
//Number of satoshis to send.
//
//The fields amt and amt_msat are mutually exclusive.
Amt int64 `protobuf:"varint,2,opt,name=amt,proto3" json:"amt,omitempty"`
//*
//
//Number of millisatoshis to send.
//
//The fields amt and amt_msat are mutually exclusive.
AmtMsat int64 `protobuf:"varint,12,opt,name=amt_msat,json=amtMsat,proto3" json:"amt_msat,omitempty"`
/// The hash to use within the payment's HTLC
// The hash to use within the payment's HTLC
PaymentHash []byte `protobuf:"bytes,3,opt,name=payment_hash,json=paymentHash,proto3" json:"payment_hash,omitempty"`
//*
//
//The CLTV delta from the current height that should be used to set the
//timelock for the final hop.
FinalCltvDelta int32 `protobuf:"varint,4,opt,name=final_cltv_delta,json=finalCltvDelta,proto3" json:"final_cltv_delta,omitempty"`
//*
//
//A bare-bones invoice for a payment within the Lightning Network. With the
//details of the invoice, the sender has all the data necessary to send a
//payment to the recipient. The amount in the payment request may be zero. In
//that case it is required to set the amt field as well. If no payment request
//is specified, the following fields are required: dest, amt and payment_hash.
PaymentRequest string `protobuf:"bytes,5,opt,name=payment_request,json=paymentRequest,proto3" json:"payment_request,omitempty"`
//*
//
//An upper limit on the amount of time we should spend when attempting to
//fulfill the payment. This is expressed in seconds. If we cannot make a
//successful payment within this time frame, an error will be returned.
//This field must be non-zero.
TimeoutSeconds int32 `protobuf:"varint,6,opt,name=timeout_seconds,json=timeoutSeconds,proto3" json:"timeout_seconds,omitempty"`
//*
//
//The maximum number of satoshis that will be paid as a fee of the payment.
//If this field is left to the default value of 0, only zero-fee routes will
//be considered. This usually means single hop routes connecting directly to
@@ -238,7 +238,7 @@ type SendPaymentRequest struct {
//
//The fields fee_limit_sat and fee_limit_msat are mutually exclusive.
FeeLimitSat int64 `protobuf:"varint,7,opt,name=fee_limit_sat,json=feeLimitSat,proto3" json:"fee_limit_sat,omitempty"`
//*
//
//The maximum number of millisatoshis that will be paid as a fee of the
//payment. If this field is left to the default value of 0, only zero-fee
//routes will be considered. This usually means single hop routes connecting
@@ -247,42 +247,42 @@ type SendPaymentRequest struct {
//
//The fields fee_limit_sat and fee_limit_msat are mutually exclusive.
FeeLimitMsat int64 `protobuf:"varint,13,opt,name=fee_limit_msat,json=feeLimitMsat,proto3" json:"fee_limit_msat,omitempty"`
//*
//
//The channel id of the channel that must be taken to the first hop. If zero,
//any channel may be used.
OutgoingChanId uint64 `protobuf:"varint,8,opt,name=outgoing_chan_id,json=outgoingChanId,proto3" json:"outgoing_chan_id,omitempty"`
//*
//
//The pubkey of the last hop of the route. If empty, any hop may be used.
LastHopPubkey []byte `protobuf:"bytes,14,opt,name=last_hop_pubkey,json=lastHopPubkey,proto3" json:"last_hop_pubkey,omitempty"`
//*
//
//An optional maximum total time lock for the route. This should not exceed
//lnd's `--max-cltv-expiry` setting. If zero, then the value of
//`--max-cltv-expiry` is enforced.
CltvLimit int32 `protobuf:"varint,9,opt,name=cltv_limit,json=cltvLimit,proto3" json:"cltv_limit,omitempty"`
//*
//
//Optional route hints to reach the destination through private channels.
RouteHints []*lnrpc.RouteHint `protobuf:"bytes,10,rep,name=route_hints,json=routeHints,proto3" json:"route_hints,omitempty"`
//*
//
//An optional field that can be used to pass an arbitrary set of TLV records
//to a peer which understands the new records. This can be used to pass
//application specific data during the payment attempt. Record types are
//required to be in the custom range >= 65536. When using REST, the values
//must be encoded as base64.
DestCustomRecords map[uint64][]byte `protobuf:"bytes,11,rep,name=dest_custom_records,json=destCustomRecords,proto3" json:"dest_custom_records,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
/// If set, circular payments to self are permitted.
// If set, circular payments to self are permitted.
AllowSelfPayment bool `protobuf:"varint,15,opt,name=allow_self_payment,json=allowSelfPayment,proto3" json:"allow_self_payment,omitempty"`
//*
//
//Features assumed to be supported by the final node. All transitive feature
//dependencies must also be set properly. For a given feature bit pair, either
//optional or remote may be set, but not both. If this field is nil or empty,
//the router will try to load destination features from the graph as a
//fallback.
DestFeatures []lnrpc.FeatureBit `protobuf:"varint,16,rep,packed,name=dest_features,json=destFeatures,proto3,enum=lnrpc.FeatureBit" json:"dest_features,omitempty"`
//*
//
//The maximum number of partial payments that may be use to complete the full
//amount.
MaxParts uint32 `protobuf:"varint,17,opt,name=max_parts,json=maxParts,proto3" json:"max_parts,omitempty"`
//*
//
//If set, only the final payment update is streamed back. Intermediate updates
//that show which htlcs are still in flight are suppressed.
NoInflightUpdates bool `protobuf:"varint,18,opt,name=no_inflight_updates,json=noInflightUpdates,proto3" json:"no_inflight_updates,omitempty"`
@@ -443,9 +443,9 @@ func (m *SendPaymentRequest) GetNoInflightUpdates() bool {
}
type TrackPaymentRequest struct {
/// The hash of the payment to look up.
// The hash of the payment to look up.
PaymentHash []byte `protobuf:"bytes,1,opt,name=payment_hash,json=paymentHash,proto3" json:"payment_hash,omitempty"`
//*
//
//If set, only the final payment update is streamed back. Intermediate updates
//that show which htlcs are still in flight are suppressed.
NoInflightUpdates bool `protobuf:"varint,2,opt,name=no_inflight_updates,json=noInflightUpdates,proto3" json:"no_inflight_updates,omitempty"`
@@ -494,10 +494,10 @@ func (m *TrackPaymentRequest) GetNoInflightUpdates() bool {
}
type RouteFeeRequest struct {
//*
//
//The destination once wishes to obtain a routing fee quote to.
Dest []byte `protobuf:"bytes,1,opt,name=dest,proto3" json:"dest,omitempty"`
//*
//
//The amount one wishes to send to the target destination.
AmtSat int64 `protobuf:"varint,2,opt,name=amt_sat,json=amtSat,proto3" json:"amt_sat,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@@ -545,11 +545,11 @@ func (m *RouteFeeRequest) GetAmtSat() int64 {
}
type RouteFeeResponse struct {
//*
//
//A lower bound of the estimated fee to the target destination within the
//network, expressed in milli-satoshis.
RoutingFeeMsat int64 `protobuf:"varint,1,opt,name=routing_fee_msat,json=routingFeeMsat,proto3" json:"routing_fee_msat,omitempty"`
//*
//
//An estimate of the worst case time delay that can occur. Note that callers
//will still need to factor in the final CLTV delta of the last hop into this
//value.
@@ -599,9 +599,9 @@ func (m *RouteFeeResponse) GetTimeLockDelay() int64 {
}
type SendToRouteRequest struct {
/// The payment hash to use for the HTLC.
// The payment hash to use for the HTLC.
PaymentHash []byte `protobuf:"bytes,1,opt,name=payment_hash,json=paymentHash,proto3" json:"payment_hash,omitempty"`
/// Route that should be used to attempt to complete the payment.
// Route that should be used to attempt to complete the payment.
Route *lnrpc.Route `protobuf:"bytes,2,opt,name=route,proto3" json:"route,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -648,9 +648,9 @@ func (m *SendToRouteRequest) GetRoute() *lnrpc.Route {
}
type SendToRouteResponse struct {
/// The preimage obtained by making the payment.
// The preimage obtained by making the payment.
Preimage []byte `protobuf:"bytes,1,opt,name=preimage,proto3" json:"preimage,omitempty"`
/// The failure message in case the payment failed.
// The failure message in case the payment failed.
Failure *lnrpc.Failure `protobuf:"bytes,2,opt,name=failure,proto3" json:"failure,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -789,9 +789,9 @@ func (m *QueryMissionControlRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_QueryMissionControlRequest proto.InternalMessageInfo
/// QueryMissionControlResponse contains mission control state.
// QueryMissionControlResponse contains mission control state.
type QueryMissionControlResponse struct {
/// Node pair-level mission control state.
// Node pair-level mission control state.
Pairs []*PairHistory `protobuf:"bytes,2,rep,name=pairs,proto3" json:"pairs,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -830,11 +830,11 @@ func (m *QueryMissionControlResponse) GetPairs() []*PairHistory {
return nil
}
/// PairHistory contains the mission control state for a particular node pair.
// PairHistory contains the mission control state for a particular node pair.
type PairHistory struct {
/// The source node pubkey of the pair.
// The source node pubkey of the pair.
NodeFrom []byte `protobuf:"bytes,1,opt,name=node_from,json=nodeFrom,proto3" json:"node_from,omitempty"`
/// The destination node pubkey of the pair.
// The destination node pubkey of the pair.
NodeTo []byte `protobuf:"bytes,2,opt,name=node_to,json=nodeTo,proto3" json:"node_to,omitempty"`
History *PairData `protobuf:"bytes,7,opt,name=history,proto3" json:"history,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@@ -889,21 +889,21 @@ func (m *PairHistory) GetHistory() *PairData {
}
type PairData struct {
/// Time of last failure.
// Time of last failure.
FailTime int64 `protobuf:"varint,1,opt,name=fail_time,json=failTime,proto3" json:"fail_time,omitempty"`
//*
//
//Lowest amount that failed to forward rounded to whole sats. This may be
//set to zero if the failure is independent of amount.
FailAmtSat int64 `protobuf:"varint,2,opt,name=fail_amt_sat,json=failAmtSat,proto3" json:"fail_amt_sat,omitempty"`
//*
//
//Lowest amount that failed to forward in millisats. This may be
//set to zero if the failure is independent of amount.
FailAmtMsat int64 `protobuf:"varint,4,opt,name=fail_amt_msat,json=failAmtMsat,proto3" json:"fail_amt_msat,omitempty"`
/// Time of last success.
// Time of last success.
SuccessTime int64 `protobuf:"varint,5,opt,name=success_time,json=successTime,proto3" json:"success_time,omitempty"`
/// Highest amount that we could successfully forward rounded to whole sats.
// Highest amount that we could successfully forward rounded to whole sats.
SuccessAmtSat int64 `protobuf:"varint,6,opt,name=success_amt_sat,json=successAmtSat,proto3" json:"success_amt_sat,omitempty"`
/// Highest amount that we could successfully forward in millisats.
// Highest amount that we could successfully forward in millisats.
SuccessAmtMsat int64 `protobuf:"varint,7,opt,name=success_amt_msat,json=successAmtMsat,proto3" json:"success_amt_msat,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -978,11 +978,11 @@ func (m *PairData) GetSuccessAmtMsat() int64 {
}
type QueryProbabilityRequest struct {
/// The source node pubkey of the pair.
// The source node pubkey of the pair.
FromNode []byte `protobuf:"bytes,1,opt,name=from_node,json=fromNode,proto3" json:"from_node,omitempty"`
/// The destination node pubkey of the pair.
// The destination node pubkey of the pair.
ToNode []byte `protobuf:"bytes,2,opt,name=to_node,json=toNode,proto3" json:"to_node,omitempty"`
/// The amount for which to calculate a probability.
// The amount for which to calculate a probability.
AmtMsat int64 `protobuf:"varint,3,opt,name=amt_msat,json=amtMsat,proto3" json:"amt_msat,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -1036,9 +1036,9 @@ func (m *QueryProbabilityRequest) GetAmtMsat() int64 {
}
type QueryProbabilityResponse struct {
/// The success probability for the requested pair.
// The success probability for the requested pair.
Probability float64 `protobuf:"fixed64,1,opt,name=probability,proto3" json:"probability,omitempty"`
/// The historical data for the requested pair.
// The historical data for the requested pair.
History *PairData `protobuf:"bytes,2,opt,name=history,proto3" json:"history,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -1085,19 +1085,19 @@ func (m *QueryProbabilityResponse) GetHistory() *PairData {
}
type BuildRouteRequest struct {
//*
//
//The amount to send expressed in msat. If set to zero, the minimum routable
//amount is used.
AmtMsat int64 `protobuf:"varint,1,opt,name=amt_msat,json=amtMsat,proto3" json:"amt_msat,omitempty"`
//*
//
//CLTV delta from the current height that should be used for the timelock
//of the final hop
FinalCltvDelta int32 `protobuf:"varint,2,opt,name=final_cltv_delta,json=finalCltvDelta,proto3" json:"final_cltv_delta,omitempty"`
//*
//
//The channel id of the channel that must be taken to the first hop. If zero,
//any channel may be used.
OutgoingChanId uint64 `protobuf:"varint,3,opt,name=outgoing_chan_id,json=outgoingChanId,proto3" json:"outgoing_chan_id,omitempty"`
//*
//
//A list of hops that defines the route. This does not include the source hop
//pubkey.
HopPubkeys [][]byte `protobuf:"bytes,4,rep,name=hop_pubkeys,json=hopPubkeys,proto3" json:"hop_pubkeys,omitempty"`
@@ -1160,7 +1160,7 @@ func (m *BuildRouteRequest) GetHopPubkeys() [][]byte {
}
type BuildRouteResponse struct {
//*
//
//Fully specified route that can be used to execute the payment.
Route *lnrpc.Route `protobuf:"bytes,1,opt,name=route,proto3" json:"route,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@@ -1231,7 +1231,7 @@ func (m *SubscribeHtlcEventsRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_SubscribeHtlcEventsRequest proto.InternalMessageInfo
//*
//
//HtlcEvent contains the htlc event that was processed. These are served on a
//best-effort basis; events are not persisted, delivery is not guaranteed
//(in the event of a crash in the switch, forward events may be lost) and
@@ -1239,26 +1239,26 @@ var xxx_messageInfo_SubscribeHtlcEventsRequest proto.InternalMessageInfo
//should be de-duplicated by the htlc's unique combination of incoming and
//outgoing channel id and htlc id. [EXPERIMENTAL]
type HtlcEvent struct {
//*
//
//The short channel id that the incoming htlc arrived at our node on. This
//value is zero for sends.
IncomingChannelId uint64 `protobuf:"varint,1,opt,name=incoming_channel_id,json=incomingChannelId,proto3" json:"incoming_channel_id,omitempty"`
//*
//
//The short channel id that the outgoing htlc left our node on. This value
//is zero for receives.
OutgoingChannelId uint64 `protobuf:"varint,2,opt,name=outgoing_channel_id,json=outgoingChannelId,proto3" json:"outgoing_channel_id,omitempty"`
//*
//
//Incoming id is the index of the incoming htlc in the incoming channel.
//This value is zero for sends.
IncomingHtlcId uint64 `protobuf:"varint,3,opt,name=incoming_htlc_id,json=incomingHtlcId,proto3" json:"incoming_htlc_id,omitempty"`
//*
//
//Outgoing id is the index of the outgoing htlc in the outgoing channel.
//This value is zero for receives.
OutgoingHtlcId uint64 `protobuf:"varint,4,opt,name=outgoing_htlc_id,json=outgoingHtlcId,proto3" json:"outgoing_htlc_id,omitempty"`
//*
//
//The time in unix nanoseconds that the event occurred.
TimestampNs uint64 `protobuf:"varint,5,opt,name=timestamp_ns,json=timestampNs,proto3" json:"timestamp_ns,omitempty"`
//*
//
//The event type indicates whether the htlc was part of a send, receive or
//forward.
EventType HtlcEvent_EventType `protobuf:"varint,6,opt,name=event_type,json=eventType,proto3,enum=routerrpc.HtlcEvent_EventType" json:"event_type,omitempty"`
@@ -1587,7 +1587,7 @@ type LinkFailEvent struct {
Info *HtlcInfo `protobuf:"bytes,1,opt,name=info,proto3" json:"info,omitempty"`
// FailureCode is the BOLT error code for the failure.
WireFailure lnrpc.Failure_FailureCode `protobuf:"varint,2,opt,name=wire_failure,json=wireFailure,proto3,enum=lnrpc.Failure_FailureCode" json:"wire_failure,omitempty"`
//*
//
//FailureDetail provides additional information about the reason for the
//failure. This detail enriches the information provided by the wire message
//and may be 'no detail' if the wire message requires no additional metadata.
@@ -1653,12 +1653,12 @@ func (m *LinkFailEvent) GetFailureString() string {
}
type PaymentStatus struct {
/// Current state the payment is in.
// Current state the payment is in.
State PaymentState `protobuf:"varint,1,opt,name=state,proto3,enum=routerrpc.PaymentState" json:"state,omitempty"`
//*
//
//The pre-image of the payment when state is SUCCEEDED.
Preimage []byte `protobuf:"bytes,2,opt,name=preimage,proto3" json:"preimage,omitempty"`
//*
//
//The HTLCs made in attempt to settle the payment [EXPERIMENTAL].
Htlcs []*lnrpc.HTLCAttempt `protobuf:"bytes,4,rep,name=htlcs,proto3" json:"htlcs,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@@ -1902,51 +1902,51 @@ const _ = grpc.SupportPackageIsVersion4
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type RouterClient interface {
//*
//
//SendPaymentV2 attempts to route a payment described by the passed
//PaymentRequest to the final destination. The call returns a stream of
//payment updates.
SendPaymentV2(ctx context.Context, in *SendPaymentRequest, opts ...grpc.CallOption) (Router_SendPaymentV2Client, error)
//*
//
//TrackPaymentV2 returns an update stream for the payment identified by the
//payment hash.
TrackPaymentV2(ctx context.Context, in *TrackPaymentRequest, opts ...grpc.CallOption) (Router_TrackPaymentV2Client, error)
//*
//
//EstimateRouteFee allows callers to obtain a lower bound w.r.t how much it
//may cost to send an HTLC to the target end destination.
EstimateRouteFee(ctx context.Context, in *RouteFeeRequest, opts ...grpc.CallOption) (*RouteFeeResponse, error)
//*
//
//SendToRoute attempts to make a payment via the specified route. This method
//differs from SendPayment in that it allows users to specify a full route
//manually. This can be used for things like rebalancing, and atomic swaps.
SendToRoute(ctx context.Context, in *SendToRouteRequest, opts ...grpc.CallOption) (*SendToRouteResponse, error)
//*
//
//ResetMissionControl clears all mission control state and starts with a clean
//slate.
ResetMissionControl(ctx context.Context, in *ResetMissionControlRequest, opts ...grpc.CallOption) (*ResetMissionControlResponse, error)
//*
//
//QueryMissionControl exposes the internal mission control state to callers.
//It is a development feature.
QueryMissionControl(ctx context.Context, in *QueryMissionControlRequest, opts ...grpc.CallOption) (*QueryMissionControlResponse, error)
//*
//
//QueryProbability returns the current success probability estimate for a
//given node pair and amount.
QueryProbability(ctx context.Context, in *QueryProbabilityRequest, opts ...grpc.CallOption) (*QueryProbabilityResponse, error)
//*
//
//BuildRoute builds a fully specified route based on a list of hop public
//keys. It retrieves the relevant channel policies from the graph in order to
//calculate the correct fees and time locks.
BuildRoute(ctx context.Context, in *BuildRouteRequest, opts ...grpc.CallOption) (*BuildRouteResponse, error)
//*
//
//SubscribeHtlcEvents creates a uni-directional stream from the server to
//the client which delivers a stream of htlc events.
SubscribeHtlcEvents(ctx context.Context, in *SubscribeHtlcEventsRequest, opts ...grpc.CallOption) (Router_SubscribeHtlcEventsClient, error)
//*
//
//Deprecated, use SendPaymentV2. SendPayment attempts to route a payment
//described by the passed PaymentRequest to the final destination. The call
//returns a stream of payment status updates.
SendPayment(ctx context.Context, in *SendPaymentRequest, opts ...grpc.CallOption) (Router_SendPaymentClient, error)
//*
//
//Deprecated, use TrackPaymentV2. TrackPayment returns an update stream for
//the payment identified by the payment hash.
TrackPayment(ctx context.Context, in *TrackPaymentRequest, opts ...grpc.CallOption) (Router_TrackPaymentClient, error)
@@ -2178,51 +2178,51 @@ func (x *routerTrackPaymentClient) Recv() (*PaymentStatus, error) {
// RouterServer is the server API for Router service.
type RouterServer interface {
//*
//
//SendPaymentV2 attempts to route a payment described by the passed
//PaymentRequest to the final destination. The call returns a stream of
//payment updates.
SendPaymentV2(*SendPaymentRequest, Router_SendPaymentV2Server) error
//*
//
//TrackPaymentV2 returns an update stream for the payment identified by the
//payment hash.
TrackPaymentV2(*TrackPaymentRequest, Router_TrackPaymentV2Server) error
//*
//
//EstimateRouteFee allows callers to obtain a lower bound w.r.t how much it
//may cost to send an HTLC to the target end destination.
EstimateRouteFee(context.Context, *RouteFeeRequest) (*RouteFeeResponse, error)
//*
//
//SendToRoute attempts to make a payment via the specified route. This method
//differs from SendPayment in that it allows users to specify a full route
//manually. This can be used for things like rebalancing, and atomic swaps.
SendToRoute(context.Context, *SendToRouteRequest) (*SendToRouteResponse, error)
//*
//
//ResetMissionControl clears all mission control state and starts with a clean
//slate.
ResetMissionControl(context.Context, *ResetMissionControlRequest) (*ResetMissionControlResponse, error)
//*
//
//QueryMissionControl exposes the internal mission control state to callers.
//It is a development feature.
QueryMissionControl(context.Context, *QueryMissionControlRequest) (*QueryMissionControlResponse, error)
//*
//
//QueryProbability returns the current success probability estimate for a
//given node pair and amount.
QueryProbability(context.Context, *QueryProbabilityRequest) (*QueryProbabilityResponse, error)
//*
//
//BuildRoute builds a fully specified route based on a list of hop public
//keys. It retrieves the relevant channel policies from the graph in order to
//calculate the correct fees and time locks.
BuildRoute(context.Context, *BuildRouteRequest) (*BuildRouteResponse, error)
//*
//
//SubscribeHtlcEvents creates a uni-directional stream from the server to
//the client which delivers a stream of htlc events.
SubscribeHtlcEvents(*SubscribeHtlcEventsRequest, Router_SubscribeHtlcEventsServer) error
//*
//
//Deprecated, use SendPaymentV2. SendPayment attempts to route a payment
//described by the passed PaymentRequest to the final destination. The call
//returns a stream of payment status updates.
SendPayment(*SendPaymentRequest, Router_SendPaymentServer) error
//*
//
//Deprecated, use TrackPaymentV2. TrackPayment returns an update stream for
//the payment identified by the payment hash.
TrackPayment(*TrackPaymentRequest, Router_TrackPaymentServer) error
+150 -148
View File
@@ -6,34 +6,116 @@ package routerrpc;
option go_package = "github.com/lightningnetwork/lnd/lnrpc/routerrpc";
// Router is a service that offers advanced interaction with the router
// subsystem of the daemon.
service Router {
/*
SendPaymentV2 attempts to route a payment described by the passed
PaymentRequest to the final destination. The call returns a stream of
payment updates.
*/
rpc SendPaymentV2 (SendPaymentRequest) returns (stream lnrpc.Payment);
/*
TrackPaymentV2 returns an update stream for the payment identified by the
payment hash.
*/
rpc TrackPaymentV2 (TrackPaymentRequest) returns (stream lnrpc.Payment);
/*
EstimateRouteFee allows callers to obtain a lower bound w.r.t how much it
may cost to send an HTLC to the target end destination.
*/
rpc EstimateRouteFee (RouteFeeRequest) returns (RouteFeeResponse);
/*
SendToRoute attempts to make a payment via the specified route. This method
differs from SendPayment in that it allows users to specify a full route
manually. This can be used for things like rebalancing, and atomic swaps.
*/
rpc SendToRoute (SendToRouteRequest) returns (SendToRouteResponse);
/*
ResetMissionControl clears all mission control state and starts with a clean
slate.
*/
rpc ResetMissionControl (ResetMissionControlRequest)
returns (ResetMissionControlResponse);
/*
QueryMissionControl exposes the internal mission control state to callers.
It is a development feature.
*/
rpc QueryMissionControl (QueryMissionControlRequest)
returns (QueryMissionControlResponse);
/*
QueryProbability returns the current success probability estimate for a
given node pair and amount.
*/
rpc QueryProbability (QueryProbabilityRequest)
returns (QueryProbabilityResponse);
/*
BuildRoute builds a fully specified route based on a list of hop public
keys. It retrieves the relevant channel policies from the graph in order to
calculate the correct fees and time locks.
*/
rpc BuildRoute (BuildRouteRequest) returns (BuildRouteResponse);
/*
SubscribeHtlcEvents creates a uni-directional stream from the server to
the client which delivers a stream of htlc events.
*/
rpc SubscribeHtlcEvents (SubscribeHtlcEventsRequest)
returns (stream HtlcEvent);
/*
Deprecated, use SendPaymentV2. SendPayment attempts to route a payment
described by the passed PaymentRequest to the final destination. The call
returns a stream of payment status updates.
*/
rpc SendPayment (SendPaymentRequest) returns (stream PaymentStatus) {
option deprecated = true;
}
/*
Deprecated, use TrackPaymentV2. TrackPayment returns an update stream for
the payment identified by the payment hash.
*/
rpc TrackPayment (TrackPaymentRequest) returns (stream PaymentStatus) {
option deprecated = true;
}
}
message SendPaymentRequest {
/// The identity pubkey of the payment recipient
// The identity pubkey of the payment recipient
bytes dest = 1;
/**
/*
Number of satoshis to send.
The fields amt and amt_msat are mutually exclusive.
*/
int64 amt = 2;
/**
/*
Number of millisatoshis to send.
The fields amt and amt_msat are mutually exclusive.
*/
int64 amt_msat = 12;
/// The hash to use within the payment's HTLC
// The hash to use within the payment's HTLC
bytes payment_hash = 3;
/**
/*
The CLTV delta from the current height that should be used to set the
timelock for the final hop.
*/
int32 final_cltv_delta = 4;
/**
/*
A bare-bones invoice for a payment within the Lightning Network. With the
details of the invoice, the sender has all the data necessary to send a
payment to the recipient. The amount in the payment request may be zero. In
@@ -42,7 +124,7 @@ message SendPaymentRequest {
*/
string payment_request = 5;
/**
/*
An upper limit on the amount of time we should spend when attempting to
fulfill the payment. This is expressed in seconds. If we cannot make a
successful payment within this time frame, an error will be returned.
@@ -50,7 +132,7 @@ message SendPaymentRequest {
*/
int32 timeout_seconds = 6;
/**
/*
The maximum number of satoshis that will be paid as a fee of the payment.
If this field is left to the default value of 0, only zero-fee routes will
be considered. This usually means single hop routes connecting directly to
@@ -60,7 +142,7 @@ message SendPaymentRequest {
*/
int64 fee_limit_sat = 7;
/**
/*
The maximum number of millisatoshis that will be paid as a fee of the
payment. If this field is left to the default value of 0, only zero-fee
routes will be considered. This usually means single hop routes connecting
@@ -71,30 +153,30 @@ message SendPaymentRequest {
*/
int64 fee_limit_msat = 13;
/**
/*
The channel id of the channel that must be taken to the first hop. If zero,
any channel may be used.
*/
uint64 outgoing_chan_id = 8 [jstype = JS_STRING];
/**
/*
The pubkey of the last hop of the route. If empty, any hop may be used.
*/
bytes last_hop_pubkey = 14;
/**
/*
An optional maximum total time lock for the route. This should not exceed
lnd's `--max-cltv-expiry` setting. If zero, then the value of
`--max-cltv-expiry` is enforced.
*/
int32 cltv_limit = 9;
/**
/*
Optional route hints to reach the destination through private channels.
*/
repeated lnrpc.RouteHint route_hints = 10;
/**
/*
An optional field that can be used to pass an arbitrary set of TLV records
to a peer which understands the new records. This can be used to pass
application specific data during the payment attempt. Record types are
@@ -103,10 +185,10 @@ message SendPaymentRequest {
*/
map<uint64, bytes> dest_custom_records = 11;
/// If set, circular payments to self are permitted.
// If set, circular payments to self are permitted.
bool allow_self_payment = 15;
/**
/*
Features assumed to be supported by the final node. All transitive feature
dependencies must also be set properly. For a given feature bit pair, either
optional or remote may be set, but not both. If this field is nil or empty,
@@ -115,13 +197,13 @@ message SendPaymentRequest {
*/
repeated lnrpc.FeatureBit dest_features = 16;
/**
/*
The maximum number of partial payments that may be use to complete the full
amount.
*/
uint32 max_parts = 17;
/**
/*
If set, only the final payment update is streamed back. Intermediate updates
that show which htlcs are still in flight are suppressed.
*/
@@ -129,10 +211,10 @@ message SendPaymentRequest {
}
message TrackPaymentRequest {
/// The hash of the payment to look up.
// The hash of the payment to look up.
bytes payment_hash = 1;
/**
/*
If set, only the final payment update is streamed back. Intermediate updates
that show which htlcs are still in flight are suppressed.
*/
@@ -140,25 +222,25 @@ message TrackPaymentRequest {
}
message RouteFeeRequest {
/**
/*
The destination once wishes to obtain a routing fee quote to.
*/
bytes dest = 1;
/**
/*
The amount one wishes to send to the target destination.
*/
int64 amt_sat = 2;
}
message RouteFeeResponse {
/**
/*
A lower bound of the estimated fee to the target destination within the
network, expressed in milli-satoshis.
*/
int64 routing_fee_msat = 1;
/**
/*
An estimate of the worst case time delay that can occur. Note that callers
will still need to factor in the final CLTV delta of the last hop into this
value.
@@ -167,18 +249,18 @@ message RouteFeeResponse {
}
message SendToRouteRequest {
/// The payment hash to use for the HTLC.
// The payment hash to use for the HTLC.
bytes payment_hash = 1;
/// Route that should be used to attempt to complete the payment.
// Route that should be used to attempt to complete the payment.
lnrpc.Route route = 2;
}
message SendToRouteResponse {
/// The preimage obtained by making the payment.
// The preimage obtained by making the payment.
bytes preimage = 1;
/// The failure message in case the payment failed.
// The failure message in case the payment failed.
lnrpc.Failure failure = 2;
}
@@ -191,20 +273,20 @@ message ResetMissionControlResponse {
message QueryMissionControlRequest {
}
/// QueryMissionControlResponse contains mission control state.
// QueryMissionControlResponse contains mission control state.
message QueryMissionControlResponse {
reserved 1;
/// Node pair-level mission control state.
// Node pair-level mission control state.
repeated PairHistory pairs = 2;
}
/// PairHistory contains the mission control state for a particular node pair.
// PairHistory contains the mission control state for a particular node pair.
message PairHistory {
/// The source node pubkey of the pair.
// The source node pubkey of the pair.
bytes node_from = 1;
/// The destination node pubkey of the pair.
// The destination node pubkey of the pair.
bytes node_to = 2;
reserved 3, 4, 5, 6;
@@ -213,16 +295,16 @@ message PairHistory {
}
message PairData {
/// Time of last failure.
// Time of last failure.
int64 fail_time = 1;
/**
/*
Lowest amount that failed to forward rounded to whole sats. This may be
set to zero if the failure is independent of amount.
*/
int64 fail_amt_sat = 2;
/**
/*
Lowest amount that failed to forward in millisats. This may be
set to zero if the failure is independent of amount.
*/
@@ -230,55 +312,55 @@ message PairData {
reserved 3;
/// Time of last success.
// Time of last success.
int64 success_time = 5;
/// Highest amount that we could successfully forward rounded to whole sats.
// Highest amount that we could successfully forward rounded to whole sats.
int64 success_amt_sat = 6;
/// Highest amount that we could successfully forward in millisats.
// Highest amount that we could successfully forward in millisats.
int64 success_amt_msat = 7;
}
message QueryProbabilityRequest {
/// The source node pubkey of the pair.
// The source node pubkey of the pair.
bytes from_node = 1;
/// The destination node pubkey of the pair.
// The destination node pubkey of the pair.
bytes to_node = 2;
/// The amount for which to calculate a probability.
// The amount for which to calculate a probability.
int64 amt_msat = 3;
}
message QueryProbabilityResponse {
/// The success probability for the requested pair.
// The success probability for the requested pair.
double probability = 1;
/// The historical data for the requested pair.
// The historical data for the requested pair.
PairData history = 2;
}
message BuildRouteRequest {
/**
/*
The amount to send expressed in msat. If set to zero, the minimum routable
amount is used.
*/
int64 amt_msat = 1;
/**
/*
CLTV delta from the current height that should be used for the timelock
of the final hop
*/
int32 final_cltv_delta = 2;
/**
/*
The channel id of the channel that must be taken to the first hop. If zero,
any channel may be used.
*/
uint64 outgoing_chan_id = 3 [jstype = JS_STRING];
/**
/*
A list of hops that defines the route. This does not include the source hop
pubkey.
*/
@@ -286,7 +368,7 @@ message BuildRouteRequest {
}
message BuildRouteResponse {
/**
/*
Fully specified route that can be used to execute the payment.
*/
lnrpc.Route route = 1;
@@ -295,7 +377,7 @@ message BuildRouteResponse {
message SubscribeHtlcEventsRequest {
}
/**
/*
HtlcEvent contains the htlc event that was processed. These are served on a
best-effort basis; events are not persisted, delivery is not guaranteed
(in the event of a crash in the switch, forward events may be lost) and
@@ -304,31 +386,31 @@ should be de-duplicated by the htlc's unique combination of incoming and
outgoing channel id and htlc id. [EXPERIMENTAL]
*/
message HtlcEvent {
/**
/*
The short channel id that the incoming htlc arrived at our node on. This
value is zero for sends.
*/
uint64 incoming_channel_id = 1;
/**
/*
The short channel id that the outgoing htlc left our node on. This value
is zero for receives.
*/
uint64 outgoing_channel_id = 2;
/**
/*
Incoming id is the index of the incoming htlc in the incoming channel.
This value is zero for sends.
*/
uint64 incoming_htlc_id = 3;
/**
/*
Outgoing id is the index of the outgoing htlc in the outgoing channel.
This value is zero for receives.
*/
uint64 outgoing_htlc_id = 4;
/**
/*
The time in unix nanoseconds that the event occurred.
*/
uint64 timestamp_ns = 5;
@@ -340,7 +422,7 @@ message HtlcEvent {
FORWARD = 3;
}
/**
/*
The event type indicates whether the htlc was part of a send, receive or
forward.
*/
@@ -386,7 +468,7 @@ message LinkFailEvent {
// FailureCode is the BOLT error code for the failure.
lnrpc.Failure.FailureCode wire_failure = 2;
/**
/*
FailureDetail provides additional information about the reason for the
failure. This detail enriches the information provided by the wire message
and may be 'no detail' if the wire message requires no additional metadata.
@@ -424,137 +506,57 @@ enum FailureDetail {
}
enum PaymentState {
/**
/*
Payment is still in flight.
*/
IN_FLIGHT = 0;
/**
/*
Payment completed successfully.
*/
SUCCEEDED = 1;
/**
/*
There are more routes to try, but the payment timeout was exceeded.
*/
FAILED_TIMEOUT = 2;
/**
/*
All possible routes were tried and failed permanently. Or were no
routes to the destination at all.
*/
FAILED_NO_ROUTE = 3;
/**
/*
A non-recoverable error has occured.
*/
FAILED_ERROR = 4;
/**
/*
Payment details incorrect (unknown hash, invalid amt or
invalid final cltv delta)
*/
FAILED_INCORRECT_PAYMENT_DETAILS = 5;
/**
/*
Insufficient local balance.
*/
FAILED_INSUFFICIENT_BALANCE = 6;
}
message PaymentStatus {
/// Current state the payment is in.
// Current state the payment is in.
PaymentState state = 1;
/**
/*
The pre-image of the payment when state is SUCCEEDED.
*/
bytes preimage = 2;
reserved 3;
/**
/*
The HTLCs made in attempt to settle the payment [EXPERIMENTAL].
*/
repeated lnrpc.HTLCAttempt htlcs = 4;
}
service Router {
/**
SendPaymentV2 attempts to route a payment described by the passed
PaymentRequest to the final destination. The call returns a stream of
payment updates.
*/
rpc SendPaymentV2 (SendPaymentRequest) returns (stream lnrpc.Payment);
/**
TrackPaymentV2 returns an update stream for the payment identified by the
payment hash.
*/
rpc TrackPaymentV2 (TrackPaymentRequest) returns (stream lnrpc.Payment);
/**
EstimateRouteFee allows callers to obtain a lower bound w.r.t how much it
may cost to send an HTLC to the target end destination.
*/
rpc EstimateRouteFee (RouteFeeRequest) returns (RouteFeeResponse);
/**
SendToRoute attempts to make a payment via the specified route. This method
differs from SendPayment in that it allows users to specify a full route
manually. This can be used for things like rebalancing, and atomic swaps.
*/
rpc SendToRoute (SendToRouteRequest) returns (SendToRouteResponse);
/**
ResetMissionControl clears all mission control state and starts with a clean
slate.
*/
rpc ResetMissionControl (ResetMissionControlRequest)
returns (ResetMissionControlResponse);
/**
QueryMissionControl exposes the internal mission control state to callers.
It is a development feature.
*/
rpc QueryMissionControl (QueryMissionControlRequest)
returns (QueryMissionControlResponse);
/**
QueryProbability returns the current success probability estimate for a
given node pair and amount.
*/
rpc QueryProbability (QueryProbabilityRequest)
returns (QueryProbabilityResponse);
/**
BuildRoute builds a fully specified route based on a list of hop public
keys. It retrieves the relevant channel policies from the graph in order to
calculate the correct fees and time locks.
*/
rpc BuildRoute (BuildRouteRequest) returns (BuildRouteResponse);
/**
SubscribeHtlcEvents creates a uni-directional stream from the server to
the client which delivers a stream of htlc events.
*/
rpc SubscribeHtlcEvents (SubscribeHtlcEventsRequest)
returns (stream HtlcEvent);
/**
Deprecated, use SendPaymentV2. SendPayment attempts to route a payment
described by the passed PaymentRequest to the final destination. The call
returns a stream of payment status updates.
*/
rpc SendPayment(SendPaymentRequest) returns (stream PaymentStatus) {
option deprecated = true;
}
/**
Deprecated, use TrackPaymentV2. TrackPayment returns an update stream for
the payment identified by the payment hash.
*/
rpc TrackPayment(TrackPaymentRequest) returns (stream PaymentStatus) {
option deprecated = true;
}
}
+848
View File
@@ -0,0 +1,848 @@
{
"swagger": "2.0",
"info": {
"title": "routerrpc/router.proto",
"version": "version not set"
},
"schemes": [
"http",
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {},
"definitions": {
"FailureFailureCode": {
"type": "string",
"enum": [
"RESERVED",
"INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS",
"INCORRECT_PAYMENT_AMOUNT",
"FINAL_INCORRECT_CLTV_EXPIRY",
"FINAL_INCORRECT_HTLC_AMOUNT",
"FINAL_EXPIRY_TOO_SOON",
"INVALID_REALM",
"EXPIRY_TOO_SOON",
"INVALID_ONION_VERSION",
"INVALID_ONION_HMAC",
"INVALID_ONION_KEY",
"AMOUNT_BELOW_MINIMUM",
"FEE_INSUFFICIENT",
"INCORRECT_CLTV_EXPIRY",
"CHANNEL_DISABLED",
"TEMPORARY_CHANNEL_FAILURE",
"REQUIRED_NODE_FEATURE_MISSING",
"REQUIRED_CHANNEL_FEATURE_MISSING",
"UNKNOWN_NEXT_PEER",
"TEMPORARY_NODE_FAILURE",
"PERMANENT_NODE_FAILURE",
"PERMANENT_CHANNEL_FAILURE",
"EXPIRY_TOO_FAR",
"MPP_TIMEOUT",
"INTERNAL_FAILURE",
"UNKNOWN_FAILURE",
"UNREADABLE_FAILURE"
],
"default": "RESERVED",
"description": " - RESERVED: The numbers assigned in this enumeration match the failure codes as\ndefined in BOLT #4. Because protobuf 3 requires enums to start with 0,\na RESERVED value is added.\n - INTERNAL_FAILURE: An internal error occurred.\n - UNKNOWN_FAILURE: The error source is known, but the failure itself couldn't be decoded.\n - UNREADABLE_FAILURE: An unreadable failure result is returned if the received failure message\ncannot be decrypted. In that case the error source is unknown."
},
"HTLCAttemptHTLCStatus": {
"type": "string",
"enum": [
"IN_FLIGHT",
"SUCCEEDED",
"FAILED"
],
"default": "IN_FLIGHT"
},
"lnrpcChannelUpdate": {
"type": "object",
"properties": {
"signature": {
"type": "string",
"format": "byte",
"description": "The signature that validates the announced data and proves the ownership\nof node id."
},
"chain_hash": {
"type": "string",
"format": "byte",
"description": "The target chain that this channel was opened within. This value\nshould be the genesis hash of the target chain. Along with the short\nchannel ID, this uniquely identifies the channel globally in a\nblockchain."
},
"chan_id": {
"type": "string",
"format": "uint64",
"description": "The unique description of the funding transaction."
},
"timestamp": {
"type": "integer",
"format": "int64",
"description": "A timestamp that allows ordering in the case of multiple announcements.\nWe should ignore the message if timestamp is not greater than the\nlast-received."
},
"message_flags": {
"type": "integer",
"format": "int64",
"description": "The bitfield that describes whether optional fields are present in this\nupdate. Currently, the least-significant bit must be set to 1 if the\noptional field MaxHtlc is present."
},
"channel_flags": {
"type": "integer",
"format": "int64",
"description": "The bitfield that describes additional meta-data concerning how the\nupdate is to be interpreted. Currently, the least-significant bit must be\nset to 0 if the creating node corresponds to the first node in the\npreviously sent channel announcement and 1 otherwise. If the second bit\nis set, then the channel is set to be disabled."
},
"time_lock_delta": {
"type": "integer",
"format": "int64",
"description": "The minimum number of blocks this node requires to be added to the expiry\nof HTLCs. This is a security parameter determined by the node operator.\nThis value represents the required gap between the time locks of the\nincoming and outgoing HTLC's set to this node."
},
"htlc_minimum_msat": {
"type": "string",
"format": "uint64",
"description": "The minimum HTLC value which will be accepted."
},
"base_fee": {
"type": "integer",
"format": "int64",
"description": "The base fee that must be used for incoming HTLC's to this particular\nchannel. This value will be tacked onto the required for a payment\nindependent of the size of the payment."
},
"fee_rate": {
"type": "integer",
"format": "int64",
"description": "The fee rate that will be charged per millionth of a satoshi."
},
"htlc_maximum_msat": {
"type": "string",
"format": "uint64",
"description": "The maximum HTLC value which will be accepted."
},
"extra_opaque_data": {
"type": "string",
"format": "byte",
"description": "The set of data that was appended to this message, some of which we may\nnot actually know how to iterate or parse. By holding onto this data, we\nensure that we're able to properly validate the set of signatures that\ncover these new fields, and ensure we're able to make upgrades to the\nnetwork in a forwards compatible manner."
}
}
},
"lnrpcFailure": {
"type": "object",
"properties": {
"code": {
"$ref": "#/definitions/FailureFailureCode",
"title": "Failure code as defined in the Lightning spec"
},
"channel_update": {
"$ref": "#/definitions/lnrpcChannelUpdate",
"description": "An optional channel update message."
},
"htlc_msat": {
"type": "string",
"format": "uint64",
"description": "A failure type-dependent htlc value."
},
"onion_sha_256": {
"type": "string",
"format": "byte",
"description": "The sha256 sum of the onion payload."
},
"cltv_expiry": {
"type": "integer",
"format": "int64",
"description": "A failure type-dependent cltv expiry value."
},
"flags": {
"type": "integer",
"format": "int64",
"description": "A failure type-dependent flags value."
},
"failure_source_index": {
"type": "integer",
"format": "int64",
"description": "The position in the path of the intermediate or final node that generated\nthe failure message. Position zero is the sender node."
},
"height": {
"type": "integer",
"format": "int64",
"description": "A failure type-dependent block height."
}
}
},
"lnrpcFeatureBit": {
"type": "string",
"enum": [
"DATALOSS_PROTECT_REQ",
"DATALOSS_PROTECT_OPT",
"INITIAL_ROUING_SYNC",
"UPFRONT_SHUTDOWN_SCRIPT_REQ",
"UPFRONT_SHUTDOWN_SCRIPT_OPT",
"GOSSIP_QUERIES_REQ",
"GOSSIP_QUERIES_OPT",
"TLV_ONION_REQ",
"TLV_ONION_OPT",
"EXT_GOSSIP_QUERIES_REQ",
"EXT_GOSSIP_QUERIES_OPT",
"STATIC_REMOTE_KEY_REQ",
"STATIC_REMOTE_KEY_OPT",
"PAYMENT_ADDR_REQ",
"PAYMENT_ADDR_OPT",
"MPP_REQ",
"MPP_OPT"
],
"default": "DATALOSS_PROTECT_REQ"
},
"lnrpcHTLCAttempt": {
"type": "object",
"properties": {
"status": {
"$ref": "#/definitions/HTLCAttemptHTLCStatus",
"description": "The status of the HTLC."
},
"route": {
"$ref": "#/definitions/lnrpcRoute",
"description": "The route taken by this HTLC."
},
"attempt_time_ns": {
"type": "string",
"format": "int64",
"description": "The time in UNIX nanoseconds at which this HTLC was sent."
},
"resolve_time_ns": {
"type": "string",
"format": "int64",
"description": "The time in UNIX nanoseconds at which this HTLC was settled or failed.\nThis value will not be set if the HTLC is still IN_FLIGHT."
},
"failure": {
"$ref": "#/definitions/lnrpcFailure",
"description": "Detailed htlc failure info."
}
}
},
"lnrpcHop": {
"type": "object",
"properties": {
"chan_id": {
"type": "string",
"format": "uint64",
"description": "The unique channel ID for the channel. The first 3 bytes are the block\nheight, the next 3 the index within the block, and the last 2 bytes are the\noutput index for the channel."
},
"chan_capacity": {
"type": "string",
"format": "int64"
},
"amt_to_forward": {
"type": "string",
"format": "int64"
},
"fee": {
"type": "string",
"format": "int64"
},
"expiry": {
"type": "integer",
"format": "int64"
},
"amt_to_forward_msat": {
"type": "string",
"format": "int64"
},
"fee_msat": {
"type": "string",
"format": "int64"
},
"pub_key": {
"type": "string",
"description": "An optional public key of the hop. If the public key is given, the payment\ncan be executed without relying on a copy of the channel graph."
},
"tlv_payload": {
"type": "boolean",
"format": "boolean",
"description": "If set to true, then this hop will be encoded using the new variable length\nTLV format. Note that if any custom tlv_records below are specified, then\nthis field MUST be set to true for them to be encoded properly."
},
"mpp_record": {
"$ref": "#/definitions/lnrpcMPPRecord",
"description": "An optional TLV record that signals the use of an MPP payment. If present,\nthe receiver will enforce that that the same mpp_record is included in the\nfinal hop payload of all non-zero payments in the HTLC set. If empty, a\nregular single-shot payment is or was attempted."
},
"custom_records": {
"type": "object",
"additionalProperties": {
"type": "string",
"format": "byte"
},
"description": "An optional set of key-value TLV records. This is useful within the context\nof the SendToRoute call as it allows callers to specify arbitrary K-V pairs\nto drop off at each hop within the onion."
}
}
},
"lnrpcHopHint": {
"type": "object",
"properties": {
"node_id": {
"type": "string",
"description": "The public key of the node at the start of the channel."
},
"chan_id": {
"type": "string",
"format": "uint64",
"description": "The unique identifier of the channel."
},
"fee_base_msat": {
"type": "integer",
"format": "int64",
"description": "The base fee of the channel denominated in millisatoshis."
},
"fee_proportional_millionths": {
"type": "integer",
"format": "int64",
"description": "The fee rate of the channel for sending one satoshi across it denominated in\nmillionths of a satoshi."
},
"cltv_expiry_delta": {
"type": "integer",
"format": "int64",
"description": "The time-lock delta of the channel."
}
}
},
"lnrpcMPPRecord": {
"type": "object",
"properties": {
"payment_addr": {
"type": "string",
"format": "byte",
"description": "A unique, random identifier used to authenticate the sender as the intended\npayer of a multi-path payment. The payment_addr must be the same for all\nsubpayments, and match the payment_addr provided in the receiver's invoice.\nThe same payment_addr must be used on all subpayments."
},
"total_amt_msat": {
"type": "string",
"format": "int64",
"description": "The total amount in milli-satoshis being sent as part of a larger multi-path\npayment. The caller is responsible for ensuring subpayments to the same node\nand payment_hash sum exactly to total_amt_msat. The same\ntotal_amt_msat must be used on all subpayments."
}
}
},
"lnrpcPayment": {
"type": "object",
"properties": {
"payment_hash": {
"type": "string",
"title": "The payment hash"
},
"value": {
"type": "string",
"format": "int64",
"description": "Deprecated, use value_sat or value_msat."
},
"creation_date": {
"type": "string",
"format": "int64",
"title": "Deprecated, use creation_time_ns"
},
"fee": {
"type": "string",
"format": "int64",
"description": "Deprecated, use fee_sat or fee_msat."
},
"payment_preimage": {
"type": "string",
"title": "The payment preimage"
},
"value_sat": {
"type": "string",
"format": "int64",
"title": "The value of the payment in satoshis"
},
"value_msat": {
"type": "string",
"format": "int64",
"title": "The value of the payment in milli-satoshis"
},
"payment_request": {
"type": "string",
"description": "The optional payment request being fulfilled."
},
"status": {
"$ref": "#/definitions/lnrpcPaymentPaymentStatus",
"description": "The status of the payment."
},
"fee_sat": {
"type": "string",
"format": "int64",
"title": "The fee paid for this payment in satoshis"
},
"fee_msat": {
"type": "string",
"format": "int64",
"title": "The fee paid for this payment in milli-satoshis"
},
"creation_time_ns": {
"type": "string",
"format": "int64",
"description": "The time in UNIX nanoseconds at which the payment was created."
},
"htlcs": {
"type": "array",
"items": {
"$ref": "#/definitions/lnrpcHTLCAttempt"
},
"description": "The HTLCs made in attempt to settle the payment."
},
"payment_index": {
"type": "string",
"format": "uint64",
"description": "The creation index of this payment. Each payment can be uniquely identified\nby this index, which may not strictly increment by 1 for payments made in\nolder versions of lnd."
},
"failure_reason": {
"$ref": "#/definitions/lnrpcPaymentFailureReason"
}
}
},
"lnrpcPaymentFailureReason": {
"type": "string",
"enum": [
"FAILURE_REASON_NONE",
"FAILURE_REASON_TIMEOUT",
"FAILURE_REASON_NO_ROUTE",
"FAILURE_REASON_ERROR",
"FAILURE_REASON_INCORRECT_PAYMENT_DETAILS",
"FAILURE_REASON_INSUFFICIENT_BALANCE"
],
"default": "FAILURE_REASON_NONE",
"description": " - FAILURE_REASON_NONE: Payment isn't failed (yet).\n - FAILURE_REASON_TIMEOUT: There are more routes to try, but the payment timeout was exceeded.\n - FAILURE_REASON_NO_ROUTE: All possible routes were tried and failed permanently. Or were no\nroutes to the destination at all.\n - FAILURE_REASON_ERROR: A non-recoverable error has occured.\n - FAILURE_REASON_INCORRECT_PAYMENT_DETAILS: Payment details incorrect (unknown hash, invalid amt or\ninvalid final cltv delta)\n - FAILURE_REASON_INSUFFICIENT_BALANCE: Insufficient local balance."
},
"lnrpcPaymentPaymentStatus": {
"type": "string",
"enum": [
"UNKNOWN",
"IN_FLIGHT",
"SUCCEEDED",
"FAILED"
],
"default": "UNKNOWN"
},
"lnrpcRoute": {
"type": "object",
"properties": {
"total_time_lock": {
"type": "integer",
"format": "int64",
"description": "The cumulative (final) time lock across the entire route. This is the CLTV\nvalue that should be extended to the first hop in the route. All other hops\nwill decrement the time-lock as advertised, leaving enough time for all\nhops to wait for or present the payment preimage to complete the payment."
},
"total_fees": {
"type": "string",
"format": "int64",
"description": "The sum of the fees paid at each hop within the final route. In the case\nof a one-hop payment, this value will be zero as we don't need to pay a fee\nto ourselves."
},
"total_amt": {
"type": "string",
"format": "int64",
"description": "The total amount of funds required to complete a payment over this route.\nThis value includes the cumulative fees at each hop. As a result, the HTLC\nextended to the first-hop in the route will need to have at least this many\nsatoshis, otherwise the route will fail at an intermediate node due to an\ninsufficient amount of fees."
},
"hops": {
"type": "array",
"items": {
"$ref": "#/definitions/lnrpcHop"
},
"description": "Contains details concerning the specific forwarding details at each hop."
},
"total_fees_msat": {
"type": "string",
"format": "int64",
"description": "The total fees in millisatoshis."
},
"total_amt_msat": {
"type": "string",
"format": "int64",
"description": "The total amount in millisatoshis."
}
},
"description": "A path through the channel graph which runs over one or more channels in\nsuccession. This struct carries all the information required to craft the\nSphinx onion packet, and send the payment along the first hop in the path. A\nroute is only selected as valid if all the channels have sufficient capacity to\ncarry the initial payment amount after fees are accounted for."
},
"lnrpcRouteHint": {
"type": "object",
"properties": {
"hop_hints": {
"type": "array",
"items": {
"$ref": "#/definitions/lnrpcHopHint"
},
"description": "A list of hop hints that when chained together can assist in reaching a\nspecific destination."
}
}
},
"protobufAny": {
"type": "object",
"properties": {
"type_url": {
"type": "string"
},
"value": {
"type": "string",
"format": "byte"
}
}
},
"routerrpcBuildRouteResponse": {
"type": "object",
"properties": {
"route": {
"$ref": "#/definitions/lnrpcRoute",
"description": "Fully specified route that can be used to execute the payment."
}
}
},
"routerrpcFailureDetail": {
"type": "string",
"enum": [
"UNKNOWN",
"NO_DETAIL",
"ONION_DECODE",
"LINK_NOT_ELIGIBLE",
"ON_CHAIN_TIMEOUT",
"HTLC_EXCEEDS_MAX",
"INSUFFICIENT_BALANCE",
"INCOMPLETE_FORWARD",
"HTLC_ADD_FAILED",
"FORWARDS_DISABLED",
"INVOICE_CANCELED",
"INVOICE_UNDERPAID",
"INVOICE_EXPIRY_TOO_SOON",
"INVOICE_NOT_OPEN",
"MPP_INVOICE_TIMEOUT",
"ADDRESS_MISMATCH",
"SET_TOTAL_MISMATCH",
"SET_TOTAL_TOO_LOW",
"SET_OVERPAID",
"UNKNOWN_INVOICE",
"INVALID_KEYSEND",
"MPP_IN_PROGRESS",
"CIRCULAR_ROUTE"
],
"default": "UNKNOWN"
},
"routerrpcForwardEvent": {
"type": "object",
"properties": {
"info": {
"$ref": "#/definitions/routerrpcHtlcInfo",
"description": "Info contains details about the htlc that was forwarded."
}
}
},
"routerrpcForwardFailEvent": {
"type": "object"
},
"routerrpcHtlcEvent": {
"type": "object",
"properties": {
"incoming_channel_id": {
"type": "string",
"format": "uint64",
"description": "The short channel id that the incoming htlc arrived at our node on. This\nvalue is zero for sends."
},
"outgoing_channel_id": {
"type": "string",
"format": "uint64",
"description": "The short channel id that the outgoing htlc left our node on. This value\nis zero for receives."
},
"incoming_htlc_id": {
"type": "string",
"format": "uint64",
"description": "Incoming id is the index of the incoming htlc in the incoming channel.\nThis value is zero for sends."
},
"outgoing_htlc_id": {
"type": "string",
"format": "uint64",
"description": "Outgoing id is the index of the outgoing htlc in the outgoing channel.\nThis value is zero for receives."
},
"timestamp_ns": {
"type": "string",
"format": "uint64",
"description": "The time in unix nanoseconds that the event occurred."
},
"event_type": {
"$ref": "#/definitions/routerrpcHtlcEventEventType",
"description": "The event type indicates whether the htlc was part of a send, receive or\nforward."
},
"forward_event": {
"$ref": "#/definitions/routerrpcForwardEvent"
},
"forward_fail_event": {
"$ref": "#/definitions/routerrpcForwardFailEvent"
},
"settle_event": {
"$ref": "#/definitions/routerrpcSettleEvent"
},
"link_fail_event": {
"$ref": "#/definitions/routerrpcLinkFailEvent"
}
},
"title": "HtlcEvent contains the htlc event that was processed. These are served on a\nbest-effort basis; events are not persisted, delivery is not guaranteed\n(in the event of a crash in the switch, forward events may be lost) and\nsome events may be replayed upon restart. Events consumed from this package\nshould be de-duplicated by the htlc's unique combination of incoming and\noutgoing channel id and htlc id. [EXPERIMENTAL]"
},
"routerrpcHtlcEventEventType": {
"type": "string",
"enum": [
"UNKNOWN",
"SEND",
"RECEIVE",
"FORWARD"
],
"default": "UNKNOWN"
},
"routerrpcHtlcInfo": {
"type": "object",
"properties": {
"incoming_timelock": {
"type": "integer",
"format": "int64",
"description": "The timelock on the incoming htlc."
},
"outgoing_timelock": {
"type": "integer",
"format": "int64",
"description": "The timelock on the outgoing htlc."
},
"incoming_amt_msat": {
"type": "string",
"format": "uint64",
"description": "The amount of the incoming htlc."
},
"outgoing_amt_msat": {
"type": "string",
"format": "uint64",
"description": "The amount of the outgoing htlc."
}
}
},
"routerrpcLinkFailEvent": {
"type": "object",
"properties": {
"info": {
"$ref": "#/definitions/routerrpcHtlcInfo",
"description": "Info contains details about the htlc that we failed."
},
"wire_failure": {
"$ref": "#/definitions/FailureFailureCode",
"description": "FailureCode is the BOLT error code for the failure."
},
"failure_detail": {
"$ref": "#/definitions/routerrpcFailureDetail",
"description": "FailureDetail provides additional information about the reason for the\nfailure. This detail enriches the information provided by the wire message\nand may be 'no detail' if the wire message requires no additional metadata."
},
"failure_string": {
"type": "string",
"description": "A string representation of the link failure."
}
}
},
"routerrpcPairData": {
"type": "object",
"properties": {
"fail_time": {
"type": "string",
"format": "int64",
"description": "Time of last failure."
},
"fail_amt_sat": {
"type": "string",
"format": "int64",
"description": "Lowest amount that failed to forward rounded to whole sats. This may be\nset to zero if the failure is independent of amount."
},
"fail_amt_msat": {
"type": "string",
"format": "int64",
"description": "Lowest amount that failed to forward in millisats. This may be\nset to zero if the failure is independent of amount."
},
"success_time": {
"type": "string",
"format": "int64",
"description": "Time of last success."
},
"success_amt_sat": {
"type": "string",
"format": "int64",
"description": "Highest amount that we could successfully forward rounded to whole sats."
},
"success_amt_msat": {
"type": "string",
"format": "int64",
"description": "Highest amount that we could successfully forward in millisats."
}
}
},
"routerrpcPairHistory": {
"type": "object",
"properties": {
"node_from": {
"type": "string",
"format": "byte",
"description": "The source node pubkey of the pair."
},
"node_to": {
"type": "string",
"format": "byte",
"description": "The destination node pubkey of the pair."
},
"history": {
"$ref": "#/definitions/routerrpcPairData"
}
},
"description": "PairHistory contains the mission control state for a particular node pair."
},
"routerrpcPaymentState": {
"type": "string",
"enum": [
"IN_FLIGHT",
"SUCCEEDED",
"FAILED_TIMEOUT",
"FAILED_NO_ROUTE",
"FAILED_ERROR",
"FAILED_INCORRECT_PAYMENT_DETAILS",
"FAILED_INSUFFICIENT_BALANCE"
],
"default": "IN_FLIGHT",
"description": " - IN_FLIGHT: Payment is still in flight.\n - SUCCEEDED: Payment completed successfully.\n - FAILED_TIMEOUT: There are more routes to try, but the payment timeout was exceeded.\n - FAILED_NO_ROUTE: All possible routes were tried and failed permanently. Or were no\nroutes to the destination at all.\n - FAILED_ERROR: A non-recoverable error has occured.\n - FAILED_INCORRECT_PAYMENT_DETAILS: Payment details incorrect (unknown hash, invalid amt or\ninvalid final cltv delta)\n - FAILED_INSUFFICIENT_BALANCE: Insufficient local balance."
},
"routerrpcPaymentStatus": {
"type": "object",
"properties": {
"state": {
"$ref": "#/definitions/routerrpcPaymentState",
"description": "Current state the payment is in."
},
"preimage": {
"type": "string",
"format": "byte",
"description": "The pre-image of the payment when state is SUCCEEDED."
},
"htlcs": {
"type": "array",
"items": {
"$ref": "#/definitions/lnrpcHTLCAttempt"
},
"description": "The HTLCs made in attempt to settle the payment [EXPERIMENTAL]."
}
}
},
"routerrpcQueryMissionControlResponse": {
"type": "object",
"properties": {
"pairs": {
"type": "array",
"items": {
"$ref": "#/definitions/routerrpcPairHistory"
},
"description": "Node pair-level mission control state."
}
},
"description": "QueryMissionControlResponse contains mission control state."
},
"routerrpcQueryProbabilityResponse": {
"type": "object",
"properties": {
"probability": {
"type": "number",
"format": "double",
"description": "The success probability for the requested pair."
},
"history": {
"$ref": "#/definitions/routerrpcPairData",
"description": "The historical data for the requested pair."
}
}
},
"routerrpcResetMissionControlResponse": {
"type": "object"
},
"routerrpcRouteFeeResponse": {
"type": "object",
"properties": {
"routing_fee_msat": {
"type": "string",
"format": "int64",
"description": "A lower bound of the estimated fee to the target destination within the\nnetwork, expressed in milli-satoshis."
},
"time_lock_delay": {
"type": "string",
"format": "int64",
"description": "An estimate of the worst case time delay that can occur. Note that callers\nwill still need to factor in the final CLTV delta of the last hop into this\nvalue."
}
}
},
"routerrpcSendToRouteResponse": {
"type": "object",
"properties": {
"preimage": {
"type": "string",
"format": "byte",
"description": "The preimage obtained by making the payment."
},
"failure": {
"$ref": "#/definitions/lnrpcFailure",
"description": "The failure message in case the payment failed."
}
}
},
"routerrpcSettleEvent": {
"type": "object"
},
"runtimeStreamError": {
"type": "object",
"properties": {
"grpc_code": {
"type": "integer",
"format": "int32"
},
"http_code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"http_status": {
"type": "string"
},
"details": {
"type": "array",
"items": {
"$ref": "#/definitions/protobufAny"
}
}
}
}
},
"x-stream-definitions": {
"lnrpcPayment": {
"type": "object",
"properties": {
"result": {
"$ref": "#/definitions/lnrpcPayment"
},
"error": {
"$ref": "#/definitions/runtimeStreamError"
}
},
"title": "Stream result of lnrpcPayment"
},
"routerrpcHtlcEvent": {
"type": "object",
"properties": {
"result": {
"$ref": "#/definitions/routerrpcHtlcEvent"
},
"error": {
"$ref": "#/definitions/runtimeStreamError"
}
},
"title": "Stream result of routerrpcHtlcEvent"
},
"routerrpcPaymentStatus": {
"type": "object",
"properties": {
"result": {
"$ref": "#/definitions/routerrpcPaymentStatus"
},
"error": {
"$ref": "#/definitions/runtimeStreamError"
}
},
"title": "Stream result of routerrpcPaymentStatus"
}
}
}
+1492 -2169
View File
File diff suppressed because it is too large. Load diff
-209
View File
@@ -28,74 +28,6 @@ var _ status.Status
var _ = runtime.String
var _ = utilities.NewDoubleArray
var (
filter_WalletUnlocker_GenSeed_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_WalletUnlocker_GenSeed_0(ctx context.Context, marshaler runtime.Marshaler, client WalletUnlockerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq GenSeedRequest
var metadata runtime.ServerMetadata
if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_WalletUnlocker_GenSeed_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.GenSeed(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func request_WalletUnlocker_InitWallet_0(ctx context.Context, marshaler runtime.Marshaler, client WalletUnlockerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq InitWalletRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.InitWallet(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func request_WalletUnlocker_UnlockWallet_0(ctx context.Context, marshaler runtime.Marshaler, client WalletUnlockerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq UnlockWalletRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.UnlockWallet(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func request_WalletUnlocker_ChangePassword_0(ctx context.Context, marshaler runtime.Marshaler, client WalletUnlockerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ChangePasswordRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.ChangePassword(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func request_Lightning_WalletBalance_0(ctx context.Context, marshaler runtime.Marshaler, client LightningClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq WalletBalanceRequest
var metadata runtime.ServerMetadata
@@ -944,147 +876,6 @@ func request_Lightning_BakeMacaroon_0(ctx context.Context, marshaler runtime.Mar
}
// RegisterWalletUnlockerHandlerFromEndpoint is same as RegisterWalletUnlockerHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterWalletUnlockerHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.Dial(endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterWalletUnlockerHandler(ctx, mux, conn)
}
// RegisterWalletUnlockerHandler registers the http handlers for service WalletUnlocker to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterWalletUnlockerHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterWalletUnlockerHandlerClient(ctx, mux, NewWalletUnlockerClient(conn))
}
// RegisterWalletUnlockerHandlerClient registers the http handlers for service WalletUnlocker
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "WalletUnlockerClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "WalletUnlockerClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "WalletUnlockerClient" to call the correct interceptors.
func RegisterWalletUnlockerHandlerClient(ctx context.Context, mux *runtime.ServeMux, client WalletUnlockerClient) error {
mux.Handle("GET", pattern_WalletUnlocker_GenSeed_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_WalletUnlocker_GenSeed_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_WalletUnlocker_GenSeed_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_WalletUnlocker_InitWallet_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_WalletUnlocker_InitWallet_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_WalletUnlocker_InitWallet_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_WalletUnlocker_UnlockWallet_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_WalletUnlocker_UnlockWallet_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_WalletUnlocker_UnlockWallet_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_WalletUnlocker_ChangePassword_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_WalletUnlocker_ChangePassword_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_WalletUnlocker_ChangePassword_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_WalletUnlocker_GenSeed_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "genseed"}, ""))
pattern_WalletUnlocker_InitWallet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "initwallet"}, ""))
pattern_WalletUnlocker_UnlockWallet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "unlockwallet"}, ""))
pattern_WalletUnlocker_ChangePassword_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "changepassword"}, ""))
)
var (
forward_WalletUnlocker_GenSeed_0 = runtime.ForwardResponseMessage
forward_WalletUnlocker_InitWallet_0 = runtime.ForwardResponseMessage
forward_WalletUnlocker_UnlockWallet_0 = runtime.ForwardResponseMessage
forward_WalletUnlocker_ChangePassword_0 = runtime.ForwardResponseMessage
)
// RegisterLightningHandlerFromEndpoint is same as RegisterLightningHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterLightningHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
+563 -753
View File
File diff suppressed because it is too large. Load diff
+483 -692
View File
File diff suppressed because it is too large. Load diff
+35 -35
View File
@@ -23,9 +23,9 @@ var _ = math.Inf
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type KeyLocator struct {
/// The family of key being identified.
// The family of key being identified.
KeyFamily int32 `protobuf:"varint,1,opt,name=key_family,json=keyFamily,proto3" json:"key_family,omitempty"`
/// The precise index of the key being identified.
// The precise index of the key being identified.
KeyIndex int32 `protobuf:"varint,2,opt,name=key_index,json=keyIndex,proto3" json:"key_index,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -72,11 +72,11 @@ func (m *KeyLocator) GetKeyIndex() int32 {
}
type KeyDescriptor struct {
//*
//
//The raw bytes of the key being identified. Either this or the KeyLocator
//must be specified.
RawKeyBytes []byte `protobuf:"bytes,1,opt,name=raw_key_bytes,json=rawKeyBytes,proto3" json:"raw_key_bytes,omitempty"`
//*
//
//The key locator that identifies which key to use for signing. Either this
//or the raw bytes of the target key must be specified.
KeyLoc *KeyLocator `protobuf:"bytes,2,opt,name=key_loc,json=keyLoc,proto3" json:"key_loc,omitempty"`
@@ -125,9 +125,9 @@ func (m *KeyDescriptor) GetKeyLoc() *KeyLocator {
}
type TxOut struct {
/// The value of the output being spent.
// The value of the output being spent.
Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"`
/// The script of the output being spent.
// The script of the output being spent.
PkScript []byte `protobuf:"bytes,2,opt,name=pk_script,json=pkScript,proto3" json:"pk_script,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -174,19 +174,19 @@ func (m *TxOut) GetPkScript() []byte {
}
type SignDescriptor struct {
//*
//
//A descriptor that precisely describes *which* key to use for signing. This
//may provide the raw public key directly, or require the Signer to re-derive
//the key according to the populated derivation path.
KeyDesc *KeyDescriptor `protobuf:"bytes,1,opt,name=key_desc,json=keyDesc,proto3" json:"key_desc,omitempty"`
//*
//
//A scalar value that will be added to the private key corresponding to the
//above public key to obtain the private key to be used to sign this input.
//This value is typically derived via the following computation:
//
// derivedKey = privkey + sha256(perCommitmentPoint || pubKey) mod N
SingleTweak []byte `protobuf:"bytes,2,opt,name=single_tweak,json=singleTweak,proto3" json:"single_tweak,omitempty"`
//*
//
//A private key that will be used in combination with its corresponding
//private key to derive the private key that is to be used to sign the target
//input. Within the Lightning protocol, this value is typically the
@@ -197,19 +197,19 @@ type SignDescriptor struct {
// k = (privKey*sha256(pubKey || tweakPub) +
//tweakPriv*sha256(tweakPub || pubKey)) mod N
DoubleTweak []byte `protobuf:"bytes,3,opt,name=double_tweak,json=doubleTweak,proto3" json:"double_tweak,omitempty"`
//*
//
//The full script required to properly redeem the output. This field will
//only be populated if a p2wsh or a p2sh output is being signed.
WitnessScript []byte `protobuf:"bytes,4,opt,name=witness_script,json=witnessScript,proto3" json:"witness_script,omitempty"`
//*
//
//A description of the output being spent. The value and script MUST be
//provided.
Output *TxOut `protobuf:"bytes,5,opt,name=output,proto3" json:"output,omitempty"`
//*
//
//The target sighash type that should be used when generating the final
//sighash, and signature.
Sighash uint32 `protobuf:"varint,7,opt,name=sighash,proto3" json:"sighash,omitempty"`
//*
//
//The target input within the transaction that should be signed.
InputIndex int32 `protobuf:"varint,8,opt,name=input_index,json=inputIndex,proto3" json:"input_index,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@@ -292,9 +292,9 @@ func (m *SignDescriptor) GetInputIndex() int32 {
}
type SignReq struct {
/// The raw bytes of the transaction to be signed.
// The raw bytes of the transaction to be signed.
RawTxBytes []byte `protobuf:"bytes,1,opt,name=raw_tx_bytes,json=rawTxBytes,proto3" json:"raw_tx_bytes,omitempty"`
/// A set of sign descriptors, for each input to be signed.
// A set of sign descriptors, for each input to be signed.
SignDescs []*SignDescriptor `protobuf:"bytes,2,rep,name=sign_descs,json=signDescs,proto3" json:"sign_descs,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -341,7 +341,7 @@ func (m *SignReq) GetSignDescs() []*SignDescriptor {
}
type SignResp struct {
//*
//
//A set of signatures realized in a fixed 64-byte format ordered in ascending
//input order.
RawSigs [][]byte `protobuf:"bytes,1,rep,name=raw_sigs,json=rawSigs,proto3" json:"raw_sigs,omitempty"`
@@ -383,9 +383,9 @@ func (m *SignResp) GetRawSigs() [][]byte {
}
type InputScript struct {
/// The serializes witness stack for the specified input.
// The serializes witness stack for the specified input.
Witness [][]byte `protobuf:"bytes,1,rep,name=witness,proto3" json:"witness,omitempty"`
//**
//*
//The optional sig script for the specified witness that will only be set if
//the input specified is a nested p2sh witness program.
SigScript []byte `protobuf:"bytes,2,opt,name=sig_script,json=sigScript,proto3" json:"sig_script,omitempty"`
@@ -434,7 +434,7 @@ func (m *InputScript) GetSigScript() []byte {
}
type InputScriptResp struct {
/// The set of fully valid input scripts requested.
// The set of fully valid input scripts requested.
InputScripts []*InputScript `protobuf:"bytes,1,rep,name=input_scripts,json=inputScripts,proto3" json:"input_scripts,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -474,9 +474,9 @@ func (m *InputScriptResp) GetInputScripts() []*InputScript {
}
type SignMessageReq struct {
/// The message to be signed.
// The message to be signed.
Msg []byte `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"`
/// The key locator that identifies which key to use for signing.
// The key locator that identifies which key to use for signing.
KeyLoc *KeyLocator `protobuf:"bytes,2,opt,name=key_loc,json=keyLoc,proto3" json:"key_loc,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -523,7 +523,7 @@ func (m *SignMessageReq) GetKeyLoc() *KeyLocator {
}
type SignMessageResp struct {
//*
//
//The signature for the given message in the fixed-size LN wire format.
Signature []byte `protobuf:"bytes,1,opt,name=signature,proto3" json:"signature,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@@ -564,13 +564,13 @@ func (m *SignMessageResp) GetSignature() []byte {
}
type VerifyMessageReq struct {
/// The message over which the signature is to be verified.
// The message over which the signature is to be verified.
Msg []byte `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"`
//*
//
//The fixed-size LN wire encoded signature to be verified over the given
//message.
Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`
/// The public key the signature has to be valid for.
// The public key the signature has to be valid for.
Pubkey []byte `protobuf:"bytes,3,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -624,7 +624,7 @@ func (m *VerifyMessageReq) GetPubkey() []byte {
}
type VerifyMessageResp struct {
/// Whether the signature was valid over the given message.
// Whether the signature was valid over the given message.
Valid bool `protobuf:"varint,1,opt,name=valid,proto3" json:"valid,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -666,7 +666,7 @@ func (m *VerifyMessageResp) GetValid() bool {
type SharedKeyRequest struct {
// The ephemeral public key to use for the DH key derivation.
EphemeralPubkey []byte `protobuf:"bytes,1,opt,name=ephemeral_pubkey,json=ephemeralPubkey,proto3" json:"ephemeral_pubkey,omitempty"`
//*
//
//The optional key locator of the local key that should be used. If this
//parameter is not set then the node's identity private key will be used.
KeyLoc *KeyLocator `protobuf:"bytes,2,opt,name=key_loc,json=keyLoc,proto3" json:"key_loc,omitempty"`
@@ -837,7 +837,7 @@ const _ = grpc.SupportPackageIsVersion4
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type SignerClient interface {
//*
//
//SignOutputRaw is a method that can be used to generated a signature for a
//set of inputs/outputs to a transaction. Each request specifies details
//concerning how the outputs should be signed, which keys they should be
@@ -847,7 +847,7 @@ type SignerClient interface {
//If we are unable to sign using the specified keys, then an error will be
//returned.
SignOutputRaw(ctx context.Context, in *SignReq, opts ...grpc.CallOption) (*SignResp, error)
//*
//
//ComputeInputScript generates a complete InputIndex for the passed
//transaction with the signature as defined within the passed SignDescriptor.
//This method should be capable of generating the proper input script for
@@ -859,14 +859,14 @@ type SignerClient interface {
//in the TxOut field, the value in that same field, and finally the input
//index.
ComputeInputScript(ctx context.Context, in *SignReq, opts ...grpc.CallOption) (*InputScriptResp, error)
//*
//
//SignMessage signs a message with the key specified in the key locator. The
//returned signature is fixed-size LN wire format encoded.
//
//The main difference to SignMessage in the main RPC is that a specific key is
//used to sign the message instead of the node identity private key.
SignMessage(ctx context.Context, in *SignMessageReq, opts ...grpc.CallOption) (*SignMessageResp, error)
//*
//
//VerifyMessage verifies a signature over a message using the public key
//provided. The signature must be fixed-size LN wire format encoded.
//
@@ -939,7 +939,7 @@ func (c *signerClient) DeriveSharedKey(ctx context.Context, in *SharedKeyRequest
// SignerServer is the server API for Signer service.
type SignerServer interface {
//*
//
//SignOutputRaw is a method that can be used to generated a signature for a
//set of inputs/outputs to a transaction. Each request specifies details
//concerning how the outputs should be signed, which keys they should be
@@ -949,7 +949,7 @@ type SignerServer interface {
//If we are unable to sign using the specified keys, then an error will be
//returned.
SignOutputRaw(context.Context, *SignReq) (*SignResp, error)
//*
//
//ComputeInputScript generates a complete InputIndex for the passed
//transaction with the signature as defined within the passed SignDescriptor.
//This method should be capable of generating the proper input script for
@@ -961,14 +961,14 @@ type SignerServer interface {
//in the TxOut field, the value in that same field, and finally the input
//index.
ComputeInputScript(context.Context, *SignReq) (*InputScriptResp, error)
//*
//
//SignMessage signs a message with the key specified in the key locator. The
//returned signature is fixed-size LN wire format encoded.
//
//The main difference to SignMessage in the main RPC is that a specific key is
//used to sign the message instead of the node identity private key.
SignMessage(context.Context, *SignMessageReq) (*SignMessageResp, error)
//*
//
//VerifyMessage verifies a signature over a message using the public key
//provided. The signature must be fixed-size LN wire format encoded.
//
+170 -168
View File
@@ -4,172 +4,10 @@ package signrpc;
option go_package = "github.com/lightningnetwork/lnd/lnrpc/signrpc";
message KeyLocator {
/// The family of key being identified.
int32 key_family = 1;
/// The precise index of the key being identified.
int32 key_index = 2;
}
message KeyDescriptor {
/**
The raw bytes of the key being identified. Either this or the KeyLocator
must be specified.
*/
bytes raw_key_bytes = 1;
/**
The key locator that identifies which key to use for signing. Either this
or the raw bytes of the target key must be specified.
*/
KeyLocator key_loc = 2;
}
message TxOut {
/// The value of the output being spent.
int64 value = 1;
/// The script of the output being spent.
bytes pk_script = 2;
}
message SignDescriptor {
/**
A descriptor that precisely describes *which* key to use for signing. This
may provide the raw public key directly, or require the Signer to re-derive
the key according to the populated derivation path.
*/
KeyDescriptor key_desc = 1;
/**
A scalar value that will be added to the private key corresponding to the
above public key to obtain the private key to be used to sign this input.
This value is typically derived via the following computation:
* derivedKey = privkey + sha256(perCommitmentPoint || pubKey) mod N
*/
bytes single_tweak = 2;
/**
A private key that will be used in combination with its corresponding
private key to derive the private key that is to be used to sign the target
input. Within the Lightning protocol, this value is typically the
commitment secret from a previously revoked commitment transaction. This
value is in combination with two hash values, and the original private key
to derive the private key to be used when signing.
* k = (privKey*sha256(pubKey || tweakPub) +
tweakPriv*sha256(tweakPub || pubKey)) mod N
*/
bytes double_tweak = 3;
/**
The full script required to properly redeem the output. This field will
only be populated if a p2wsh or a p2sh output is being signed.
*/
bytes witness_script = 4;
/**
A description of the output being spent. The value and script MUST be
provided.
*/
TxOut output = 5;
/**
The target sighash type that should be used when generating the final
sighash, and signature.
*/
uint32 sighash = 7;
/**
The target input within the transaction that should be signed.
*/
int32 input_index = 8;
}
message SignReq {
/// The raw bytes of the transaction to be signed.
bytes raw_tx_bytes = 1;
/// A set of sign descriptors, for each input to be signed.
repeated SignDescriptor sign_descs = 2;
}
message SignResp {
/**
A set of signatures realized in a fixed 64-byte format ordered in ascending
input order.
*/
repeated bytes raw_sigs = 1;
}
message InputScript {
/// The serializes witness stack for the specified input.
repeated bytes witness = 1;
/***
The optional sig script for the specified witness that will only be set if
the input specified is a nested p2sh witness program.
*/
bytes sig_script = 2;
}
message InputScriptResp {
/// The set of fully valid input scripts requested.
repeated InputScript input_scripts = 1;
}
message SignMessageReq {
/// The message to be signed.
bytes msg = 1;
/// The key locator that identifies which key to use for signing.
KeyLocator key_loc = 2;
}
message SignMessageResp {
/**
The signature for the given message in the fixed-size LN wire format.
*/
bytes signature = 1;
}
message VerifyMessageReq {
/// The message over which the signature is to be verified.
bytes msg = 1;
/**
The fixed-size LN wire encoded signature to be verified over the given
message.
*/
bytes signature = 2;
/// The public key the signature has to be valid for.
bytes pubkey = 3;
}
message VerifyMessageResp {
/// Whether the signature was valid over the given message.
bool valid = 1;
}
message SharedKeyRequest {
// The ephemeral public key to use for the DH key derivation.
bytes ephemeral_pubkey = 1;
/**
The optional key locator of the local key that should be used. If this
parameter is not set then the node's identity private key will be used.
*/
KeyLocator key_loc = 2;
}
message SharedKeyResponse {
// The shared public key, hashed with sha256.
bytes shared_key = 1;
}
// Signer is a service that gives access to the signing functionality of the
// daemon's wallet.
service Signer {
/**
/*
SignOutputRaw is a method that can be used to generated a signature for a
set of inputs/outputs to a transaction. Each request specifies details
concerning how the outputs should be signed, which keys they should be
@@ -181,7 +19,7 @@ service Signer {
*/
rpc SignOutputRaw (SignReq) returns (SignResp);
/**
/*
ComputeInputScript generates a complete InputIndex for the passed
transaction with the signature as defined within the passed SignDescriptor.
This method should be capable of generating the proper input script for
@@ -195,7 +33,7 @@ service Signer {
*/
rpc ComputeInputScript (SignReq) returns (InputScriptResp);
/**
/*
SignMessage signs a message with the key specified in the key locator. The
returned signature is fixed-size LN wire format encoded.
@@ -204,7 +42,7 @@ service Signer {
*/
rpc SignMessage (SignMessageReq) returns (SignMessageResp);
/**
/*
VerifyMessage verifies a signature over a message using the public key
provided. The signature must be fixed-size LN wire format encoded.
@@ -224,3 +62,167 @@ service Signer {
*/
rpc DeriveSharedKey (SharedKeyRequest) returns (SharedKeyResponse);
}
message KeyLocator {
// The family of key being identified.
int32 key_family = 1;
// The precise index of the key being identified.
int32 key_index = 2;
}
message KeyDescriptor {
/*
The raw bytes of the key being identified. Either this or the KeyLocator
must be specified.
*/
bytes raw_key_bytes = 1;
/*
The key locator that identifies which key to use for signing. Either this
or the raw bytes of the target key must be specified.
*/
KeyLocator key_loc = 2;
}
message TxOut {
// The value of the output being spent.
int64 value = 1;
// The script of the output being spent.
bytes pk_script = 2;
}
message SignDescriptor {
/*
A descriptor that precisely describes *which* key to use for signing. This
may provide the raw public key directly, or require the Signer to re-derive
the key according to the populated derivation path.
*/
KeyDescriptor key_desc = 1;
/*
A scalar value that will be added to the private key corresponding to the
above public key to obtain the private key to be used to sign this input.
This value is typically derived via the following computation:
* derivedKey = privkey + sha256(perCommitmentPoint || pubKey) mod N
*/
bytes single_tweak = 2;
/*
A private key that will be used in combination with its corresponding
private key to derive the private key that is to be used to sign the target
input. Within the Lightning protocol, this value is typically the
commitment secret from a previously revoked commitment transaction. This
value is in combination with two hash values, and the original private key
to derive the private key to be used when signing.
* k = (privKey*sha256(pubKey || tweakPub) +
tweakPriv*sha256(tweakPub || pubKey)) mod N
*/
bytes double_tweak = 3;
/*
The full script required to properly redeem the output. This field will
only be populated if a p2wsh or a p2sh output is being signed.
*/
bytes witness_script = 4;
/*
A description of the output being spent. The value and script MUST be
provided.
*/
TxOut output = 5;
/*
The target sighash type that should be used when generating the final
sighash, and signature.
*/
uint32 sighash = 7;
/*
The target input within the transaction that should be signed.
*/
int32 input_index = 8;
}
message SignReq {
// The raw bytes of the transaction to be signed.
bytes raw_tx_bytes = 1;
// A set of sign descriptors, for each input to be signed.
repeated SignDescriptor sign_descs = 2;
}
message SignResp {
/*
A set of signatures realized in a fixed 64-byte format ordered in ascending
input order.
*/
repeated bytes raw_sigs = 1;
}
message InputScript {
// The serializes witness stack for the specified input.
repeated bytes witness = 1;
/**
The optional sig script for the specified witness that will only be set if
the input specified is a nested p2sh witness program.
*/
bytes sig_script = 2;
}
message InputScriptResp {
// The set of fully valid input scripts requested.
repeated InputScript input_scripts = 1;
}
message SignMessageReq {
// The message to be signed.
bytes msg = 1;
// The key locator that identifies which key to use for signing.
KeyLocator key_loc = 2;
}
message SignMessageResp {
/*
The signature for the given message in the fixed-size LN wire format.
*/
bytes signature = 1;
}
message VerifyMessageReq {
// The message over which the signature is to be verified.
bytes msg = 1;
/*
The fixed-size LN wire encoded signature to be verified over the given
message.
*/
bytes signature = 2;
// The public key the signature has to be valid for.
bytes pubkey = 3;
}
message VerifyMessageResp {
// Whether the signature was valid over the given message.
bool valid = 1;
}
message SharedKeyRequest {
// The ephemeral public key to use for the DH key derivation.
bytes ephemeral_pubkey = 1;
/*
The optional key locator of the local key that should be used. If this
parameter is not set then the node's identity private key will be used.
*/
KeyLocator key_loc = 2;
}
message SharedKeyResponse {
// The shared public key, hashed with sha256.
bytes shared_key = 1;
}
+176
View File
@@ -0,0 +1,176 @@
{
"swagger": "2.0",
"info": {
"title": "signrpc/signer.proto",
"version": "version not set"
},
"schemes": [
"http",
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {},
"definitions": {
"signrpcInputScript": {
"type": "object",
"properties": {
"witness": {
"type": "array",
"items": {
"type": "string",
"format": "byte"
},
"description": "The serializes witness stack for the specified input."
},
"sig_script": {
"type": "string",
"format": "byte",
"description": "*\nThe optional sig script for the specified witness that will only be set if\nthe input specified is a nested p2sh witness program."
}
}
},
"signrpcInputScriptResp": {
"type": "object",
"properties": {
"input_scripts": {
"type": "array",
"items": {
"$ref": "#/definitions/signrpcInputScript"
},
"description": "The set of fully valid input scripts requested."
}
}
},
"signrpcKeyDescriptor": {
"type": "object",
"properties": {
"raw_key_bytes": {
"type": "string",
"format": "byte",
"description": "The raw bytes of the key being identified. Either this or the KeyLocator\nmust be specified."
},
"key_loc": {
"$ref": "#/definitions/signrpcKeyLocator",
"description": "The key locator that identifies which key to use for signing. Either this\nor the raw bytes of the target key must be specified."
}
}
},
"signrpcKeyLocator": {
"type": "object",
"properties": {
"key_family": {
"type": "integer",
"format": "int32",
"description": "The family of key being identified."
},
"key_index": {
"type": "integer",
"format": "int32",
"description": "The precise index of the key being identified."
}
}
},
"signrpcSharedKeyResponse": {
"type": "object",
"properties": {
"shared_key": {
"type": "string",
"format": "byte",
"description": "The shared public key, hashed with sha256."
}
}
},
"signrpcSignDescriptor": {
"type": "object",
"properties": {
"key_desc": {
"$ref": "#/definitions/signrpcKeyDescriptor",
"description": "A descriptor that precisely describes *which* key to use for signing. This\nmay provide the raw public key directly, or require the Signer to re-derive\nthe key according to the populated derivation path."
},
"single_tweak": {
"type": "string",
"format": "byte",
"description": "derivedKey = privkey + sha256(perCommitmentPoint || pubKey) mod N",
"title": "A scalar value that will be added to the private key corresponding to the\nabove public key to obtain the private key to be used to sign this input.\nThis value is typically derived via the following computation:"
},
"double_tweak": {
"type": "string",
"format": "byte",
"description": "A private key that will be used in combination with its corresponding\nprivate key to derive the private key that is to be used to sign the target\ninput. Within the Lightning protocol, this value is typically the\ncommitment secret from a previously revoked commitment transaction. This\nvalue is in combination with two hash values, and the original private key\nto derive the private key to be used when signing.\n\nk = (privKey*sha256(pubKey || tweakPub) +\ntweakPriv*sha256(tweakPub || pubKey)) mod N"
},
"witness_script": {
"type": "string",
"format": "byte",
"description": "The full script required to properly redeem the output. This field will\nonly be populated if a p2wsh or a p2sh output is being signed."
},
"output": {
"$ref": "#/definitions/signrpcTxOut",
"description": "A description of the output being spent. The value and script MUST be\nprovided."
},
"sighash": {
"type": "integer",
"format": "int64",
"description": "The target sighash type that should be used when generating the final\nsighash, and signature."
},
"input_index": {
"type": "integer",
"format": "int32",
"description": "The target input within the transaction that should be signed."
}
}
},
"signrpcSignMessageResp": {
"type": "object",
"properties": {
"signature": {
"type": "string",
"format": "byte",
"description": "The signature for the given message in the fixed-size LN wire format."
}
}
},
"signrpcSignResp": {
"type": "object",
"properties": {
"raw_sigs": {
"type": "array",
"items": {
"type": "string",
"format": "byte"
},
"description": "A set of signatures realized in a fixed 64-byte format ordered in ascending\ninput order."
}
}
},
"signrpcTxOut": {
"type": "object",
"properties": {
"value": {
"type": "string",
"format": "int64",
"description": "The value of the output being spent."
},
"pk_script": {
"type": "string",
"format": "byte",
"description": "The script of the output being spent."
}
}
},
"signrpcVerifyMessageResp": {
"type": "object",
"properties": {
"valid": {
"type": "boolean",
"format": "boolean",
"description": "Whether the signature was valid over the given message."
}
}
}
}
}
+15 -9
View File
@@ -54,23 +54,23 @@ func (m *VersionRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_VersionRequest proto.InternalMessageInfo
type Version struct {
/// A verbose description of the daemon's commit.
// A verbose description of the daemon's commit.
Commit string `protobuf:"bytes,1,opt,name=commit,proto3" json:"commit,omitempty"`
/// The SHA1 commit hash that the daemon is compiled with.
// The SHA1 commit hash that the daemon is compiled with.
CommitHash string `protobuf:"bytes,2,opt,name=commit_hash,json=commitHash,proto3" json:"commit_hash,omitempty"`
/// The semantic version.
// The semantic version.
Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"`
/// The major application version.
// The major application version.
AppMajor uint32 `protobuf:"varint,4,opt,name=app_major,json=appMajor,proto3" json:"app_major,omitempty"`
/// The minor application version.
// The minor application version.
AppMinor uint32 `protobuf:"varint,5,opt,name=app_minor,json=appMinor,proto3" json:"app_minor,omitempty"`
/// The application patch number.
// The application patch number.
AppPatch uint32 `protobuf:"varint,6,opt,name=app_patch,json=appPatch,proto3" json:"app_patch,omitempty"`
/// The application pre-release modifier, possibly empty.
// The application pre-release modifier, possibly empty.
AppPreRelease string `protobuf:"bytes,7,opt,name=app_pre_release,json=appPreRelease,proto3" json:"app_pre_release,omitempty"`
/// The list of build tags that were supplied during compilation.
// The list of build tags that were supplied during compilation.
BuildTags []string `protobuf:"bytes,8,rep,name=build_tags,json=buildTags,proto3" json:"build_tags,omitempty"`
/// The version of go that compiled the executable.
// The version of go that compiled the executable.
GoVersion string `protobuf:"bytes,9,opt,name=go_version,json=goVersion,proto3" json:"go_version,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -207,6 +207,9 @@ const _ = grpc.SupportPackageIsVersion4
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type VersionerClient interface {
// lncli: `version`
//GetVersion returns the current version and build information of the running
//daemon.
GetVersion(ctx context.Context, in *VersionRequest, opts ...grpc.CallOption) (*Version, error)
}
@@ -229,6 +232,9 @@ func (c *versionerClient) GetVersion(ctx context.Context, in *VersionRequest, op
// VersionerServer is the server API for Versioner service.
type VersionerServer interface {
// lncli: `version`
//GetVersion returns the current version and build information of the running
//daemon.
GetVersion(context.Context, *VersionRequest) (*Version, error)
}
+18 -12
View File
@@ -4,38 +4,44 @@ package verrpc;
option go_package = "github.com/lightningnetwork/lnd/lnrpc/verrpc";
// Versioner is a service that can be used to get information about the version
// and build information of the running daemon.
service Versioner {
/* lncli: `version`
GetVersion returns the current version and build information of the running
daemon.
*/
rpc GetVersion (VersionRequest) returns (Version);
};
}
message VersionRequest {
};
}
message Version {
/// A verbose description of the daemon's commit.
// A verbose description of the daemon's commit.
string commit = 1;
/// The SHA1 commit hash that the daemon is compiled with.
// The SHA1 commit hash that the daemon is compiled with.
string commit_hash = 2;
/// The semantic version.
// The semantic version.
string version = 3;
/// The major application version.
// The major application version.
uint32 app_major = 4;
/// The minor application version.
// The minor application version.
uint32 app_minor = 5;
/// The application patch number.
// The application patch number.
uint32 app_patch = 6;
/// The application pre-release modifier, possibly empty.
// The application pre-release modifier, possibly empty.
string app_pre_release = 7;
/// The list of build tags that were supplied during compilation.
// The list of build tags that were supplied during compilation.
repeated string build_tags = 8;
/// The version of go that compiled the executable.
// The version of go that compiled the executable.
string go_version = 9;
};
}
+67
View File
@@ -0,0 +1,67 @@
{
"swagger": "2.0",
"info": {
"title": "verrpc/verrpc.proto",
"version": "version not set"
},
"schemes": [
"http",
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {},
"definitions": {
"verrpcVersion": {
"type": "object",
"properties": {
"commit": {
"type": "string",
"description": "A verbose description of the daemon's commit."
},
"commit_hash": {
"type": "string",
"description": "The SHA1 commit hash that the daemon is compiled with."
},
"version": {
"type": "string",
"description": "The semantic version."
},
"app_major": {
"type": "integer",
"format": "int64",
"description": "The major application version."
},
"app_minor": {
"type": "integer",
"format": "int64",
"description": "The minor application version."
},
"app_patch": {
"type": "integer",
"format": "int64",
"description": "The application patch number."
},
"app_pre_release": {
"type": "string",
"description": "The application pre-release modifier, possibly empty."
},
"build_tags": {
"type": "array",
"items": {
"type": "string"
},
"description": "The list of build tags that were supplied during compilation."
},
"go_version": {
"type": "string",
"description": "The version of go that compiled the executable."
}
}
}
}
}
+32 -32
View File
@@ -133,12 +133,12 @@ func (WitnessType) EnumDescriptor() ([]byte, []int) {
}
type KeyReq struct {
//*
//
//Is the key finger print of the root pubkey that this request is targeting.
//This allows the WalletKit to possibly serve out keys for multiple HD chains
//via public derivation.
KeyFingerPrint int32 `protobuf:"varint,1,opt,name=key_finger_print,json=keyFingerPrint,proto3" json:"key_finger_print,omitempty"`
//*
//
//The target key family to derive a key from. In other contexts, this is
//known as the "account".
KeyFamily int32 `protobuf:"varint,2,opt,name=key_family,json=keyFamily,proto3" json:"key_family,omitempty"`
@@ -218,7 +218,7 @@ func (m *AddrRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_AddrRequest proto.InternalMessageInfo
type AddrResponse struct {
//*
//
//The address encoded using a bech32 format.
Addr string `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@@ -259,7 +259,7 @@ func (m *AddrResponse) GetAddr() string {
}
type Transaction struct {
//*
//
//The raw serialized transaction.
TxHex []byte `protobuf:"bytes,1,opt,name=tx_hex,json=txHex,proto3" json:"tx_hex,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@@ -300,7 +300,7 @@ func (m *Transaction) GetTxHex() []byte {
}
type PublishResponse struct {
//*
//
//If blank, then no error occurred and the transaction was successfully
//published. If not the empty string, then a string representation of the
//broadcast error.
@@ -345,11 +345,11 @@ func (m *PublishResponse) GetPublishError() string {
}
type SendOutputsRequest struct {
//*
//
//The number of satoshis per kilo weight that should be used when crafting
//this transaction.
SatPerKw int64 `protobuf:"varint,1,opt,name=sat_per_kw,json=satPerKw,proto3" json:"sat_per_kw,omitempty"`
//*
//
//A slice of the outputs that should be created in the transaction produced.
Outputs []*signrpc.TxOut `protobuf:"bytes,2,rep,name=outputs,proto3" json:"outputs,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@@ -397,7 +397,7 @@ func (m *SendOutputsRequest) GetOutputs() []*signrpc.TxOut {
}
type SendOutputsResponse struct {
//*
//
//The serialized transaction sent out on the network.
RawTx []byte `protobuf:"bytes,1,opt,name=raw_tx,json=rawTx,proto3" json:"raw_tx,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@@ -438,7 +438,7 @@ func (m *SendOutputsResponse) GetRawTx() []byte {
}
type EstimateFeeRequest struct {
//*
//
//The number of confirmations to shoot for when estimating the fee.
ConfTarget int32 `protobuf:"varint,1,opt,name=conf_target,json=confTarget,proto3" json:"conf_target,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@@ -479,7 +479,7 @@ func (m *EstimateFeeRequest) GetConfTarget() int32 {
}
type EstimateFeeResponse struct {
//*
//
//The amount of satoshis per kw that should be used in order to reach the
//confirmation target in the request.
SatPerKw int64 `protobuf:"varint,1,opt,name=sat_per_kw,json=satPerKw,proto3" json:"sat_per_kw,omitempty"`
@@ -542,7 +542,7 @@ type PendingSweep struct {
RequestedConfTarget uint32 `protobuf:"varint,8,opt,name=requested_conf_target,json=requestedConfTarget,proto3" json:"requested_conf_target,omitempty"`
// The requested fee rate, expressed in sat/byte, for this output.
RequestedSatPerByte uint32 `protobuf:"varint,9,opt,name=requested_sat_per_byte,json=requestedSatPerByte,proto3" json:"requested_sat_per_byte,omitempty"`
//*
//
//Whether this input must be force-swept. This means that it is swept even
//if it has a negative yield.
Force bool `protobuf:"varint,7,opt,name=force,proto3" json:"force,omitempty"`
@@ -720,7 +720,7 @@ type BumpFeeRequest struct {
//The fee rate, expressed in sat/byte, that should be used to spend the input
//with.
SatPerByte uint32 `protobuf:"varint,3,opt,name=sat_per_byte,json=satPerByte,proto3" json:"sat_per_byte,omitempty"`
//*
//
//Whether this input must be force-swept. This means that it is swept even
//if it has a negative yield.
Force bool `protobuf:"varint,4,opt,name=force,proto3" json:"force,omitempty"`
@@ -1002,12 +1002,12 @@ func init() {
func init() { proto.RegisterFile("walletrpc/walletkit.proto", fileDescriptor_6cc6942ac78249e5) }
var fileDescriptor_6cc6942ac78249e5 = []byte{
// 1180 bytes of a gzipped FileDescriptorProto
// 1178 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0x6d, 0x6f, 0xe2, 0x46,
0x10, 0x3e, 0x42, 0x42, 0x60, 0x78, 0x09, 0x59, 0xf2, 0xe2, 0xe3, 0x72, 0x0d, 0x75, 0xdf, 0xa2,
0xf6, 0x8e, 0xa8, 0x39, 0xb5, 0xea, 0xb5, 0x52, 0xd5, 0x04, 0x1c, 0x11, 0x41, 0x70, 0x6a, 0xfb,
0x2e, 0xba, 0xaa, 0xd2, 0xca, 0xe0, 0x0d, 0xb1, 0x02, 0xb6, 0x6f, 0xbd, 0x1c, 0xf0, 0xad, 0xdf,
0xfa, 0x0f, 0x2a, 0xdd, 0xbf, 0xad, 0xbc, 0x7e, 0x61, 0x0d, 0xcd, 0x49, 0xfd, 0x14, 0x76, 0x9e,
0x2e, 0xba, 0xaa, 0xd2, 0xca, 0xe0, 0x0d, 0xb1, 0x02, 0xb6, 0x6f, 0xbd, 0x1c, 0xf0, 0xad, 0x5f,
0xfa, 0x17, 0x2a, 0xdd, 0xbf, 0xad, 0xbc, 0x7e, 0x61, 0x0d, 0xcd, 0x49, 0xfd, 0x14, 0x76, 0x9e,
0x67, 0x9e, 0x9d, 0x9d, 0x19, 0xcf, 0x04, 0x9e, 0xce, 0xcc, 0xf1, 0x98, 0x30, 0xea, 0x0d, 0x4f,
0xc3, 0x5f, 0x0f, 0x36, 0x6b, 0x7a, 0xd4, 0x65, 0x2e, 0x2a, 0x24, 0x50, 0xbd, 0x40, 0xbd, 0x61,
0x68, 0xad, 0xef, 0xf9, 0xf6, 0xc8, 0x09, 0xe8, 0xc1, 0x5f, 0x42, 0x43, 0xab, 0xfc, 0x3b, 0xe4,
@@ -1072,11 +1072,11 @@ var fileDescriptor_6cc6942ac78249e5 = []byte{
0xf5, 0x0d, 0x5d, 0xff, 0xec, 0x31, 0x78, 0xa9, 0x26, 0x2c, 0xc5, 0x94, 0xda, 0xfa, 0x8e, 0x4d,
0xa9, 0xfd, 0xd7, 0x2e, 0xd5, 0xa0, 0x9c, 0x9a, 0xbc, 0xe8, 0xf8, 0x91, 0xc9, 0x9a, 0xc4, 0xd7,
0x78, 0x9c, 0x10, 0x69, 0xfe, 0x06, 0xdb, 0xd1, 0x6c, 0x43, 0x4f, 0x05, 0x72, 0x7a, 0x0e, 0xa7,
0x32, 0xb6, 0x32, 0x0a, 0x51, 0x17, 0x60, 0x39, 0x54, 0xd0, 0xd1, 0x23, 0xb3, 0x26, 0xd4, 0x79,
0xfe, 0xc9, 0x49, 0x24, 0x3f, 0xb9, 0xf8, 0xfe, 0x8f, 0xd3, 0x91, 0xcd, 0xee, 0xa7, 0x83, 0xe6,
0xd0, 0x9d, 0x9c, 0x8e, 0x83, 0x3d, 0xe8, 0xd8, 0xce, 0xc8, 0x21, 0x6c, 0xe6, 0xd2, 0x87, 0xd3,
0xb1, 0x63, 0x9d, 0xf2, 0xa9, 0x78, 0x9a, 0xe8, 0x0c, 0x72, 0xfc, 0xdf, 0xc4, 0x57, 0xff, 0x06,
0x00, 0x00, 0xff, 0xff, 0xe6, 0xc9, 0x1c, 0x56, 0x6f, 0x0a, 0x00, 0x00,
0x32, 0xb6, 0x32, 0x0a, 0xd1, 0x15, 0xc0, 0x72, 0xa8, 0xa0, 0xa3, 0x47, 0x66, 0x4d, 0xa8, 0xf3,
0xfc, 0x93, 0x93, 0xe8, 0xe2, 0xfb, 0x3f, 0x4e, 0x47, 0x36, 0xbb, 0x9f, 0x0e, 0x9a, 0x43, 0x77,
0x72, 0x3a, 0x0e, 0xb6, 0xa0, 0x63, 0x3b, 0x23, 0x87, 0xb0, 0x99, 0x4b, 0x1f, 0x4e, 0xc7, 0x8e,
0x75, 0xca, 0x67, 0xe2, 0x69, 0xa2, 0x32, 0xc8, 0xf1, 0x7f, 0x12, 0x5f, 0xfd, 0x1b, 0x00, 0x00,
0xff, 0xff, 0x88, 0x6c, 0x32, 0x8c, 0x6d, 0x0a, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -1091,30 +1091,30 @@ const _ = grpc.SupportPackageIsVersion4
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type WalletKitClient interface {
//*
//
//DeriveNextKey attempts to derive the *next* key within the key family
//(account in BIP43) specified. This method should return the next external
//child within this branch.
DeriveNextKey(ctx context.Context, in *KeyReq, opts ...grpc.CallOption) (*signrpc.KeyDescriptor, error)
//*
//
//DeriveKey attempts to derive an arbitrary key specified by the passed
//KeyLocator.
DeriveKey(ctx context.Context, in *signrpc.KeyLocator, opts ...grpc.CallOption) (*signrpc.KeyDescriptor, error)
//*
//
//NextAddr returns the next unused address within the wallet.
NextAddr(ctx context.Context, in *AddrRequest, opts ...grpc.CallOption) (*AddrResponse, error)
//*
//
//PublishTransaction attempts to publish the passed transaction to the
//network. Once this returns without an error, the wallet will continually
//attempt to re-broadcast the transaction on start up, until it enters the
//chain.
PublishTransaction(ctx context.Context, in *Transaction, opts ...grpc.CallOption) (*PublishResponse, error)
//*
//
//SendOutputs is similar to the existing sendmany call in Bitcoind, and
//allows the caller to create a transaction that sends to several outputs at
//once. This is ideal when wanting to batch create a set of transactions.
SendOutputs(ctx context.Context, in *SendOutputsRequest, opts ...grpc.CallOption) (*SendOutputsResponse, error)
//*
//
//EstimateFee attempts to query the internal fee estimator of the wallet to
//determine the fee (in sat/kw) to attach to a transaction in order to
//achieve the confirmation target.
@@ -1254,30 +1254,30 @@ func (c *walletKitClient) ListSweeps(ctx context.Context, in *ListSweepsRequest,
// WalletKitServer is the server API for WalletKit service.
type WalletKitServer interface {
//*
//
//DeriveNextKey attempts to derive the *next* key within the key family
//(account in BIP43) specified. This method should return the next external
//child within this branch.
DeriveNextKey(context.Context, *KeyReq) (*signrpc.KeyDescriptor, error)
//*
//
//DeriveKey attempts to derive an arbitrary key specified by the passed
//KeyLocator.
DeriveKey(context.Context, *signrpc.KeyLocator) (*signrpc.KeyDescriptor, error)
//*
//
//NextAddr returns the next unused address within the wallet.
NextAddr(context.Context, *AddrRequest) (*AddrResponse, error)
//*
//
//PublishTransaction attempts to publish the passed transaction to the
//network. Once this returns without an error, the wallet will continually
//attempt to re-broadcast the transaction on start up, until it enters the
//chain.
PublishTransaction(context.Context, *Transaction) (*PublishResponse, error)
//*
//
//SendOutputs is similar to the existing sendmany call in Bitcoind, and
//allows the caller to create a transaction that sends to several outputs at
//once. This is ideal when wanting to batch create a set of transactions.
SendOutputs(context.Context, *SendOutputsRequest) (*SendOutputsResponse, error)
//*
//
//EstimateFee attempts to query the internal fee estimator of the wallet to
//determine the fee (in sat/kw) to attach to a transaction in order to
//achieve the confirmation target.
+104 -105
View File
@@ -7,15 +7,107 @@ package walletrpc;
option go_package = "github.com/lightningnetwork/lnd/lnrpc/walletrpc";
message KeyReq {
// WalletKit is a service that gives access to the core functionalities of the
// daemon's wallet.
service WalletKit {
/*
DeriveNextKey attempts to derive the *next* key within the key family
(account in BIP43) specified. This method should return the next external
child within this branch.
*/
rpc DeriveNextKey (KeyReq) returns (signrpc.KeyDescriptor);
/*
DeriveKey attempts to derive an arbitrary key specified by the passed
KeyLocator.
*/
rpc DeriveKey (signrpc.KeyLocator) returns (signrpc.KeyDescriptor);
/*
NextAddr returns the next unused address within the wallet.
*/
rpc NextAddr (AddrRequest) returns (AddrResponse);
/*
PublishTransaction attempts to publish the passed transaction to the
network. Once this returns without an error, the wallet will continually
attempt to re-broadcast the transaction on start up, until it enters the
chain.
*/
rpc PublishTransaction (Transaction) returns (PublishResponse);
/*
SendOutputs is similar to the existing sendmany call in Bitcoind, and
allows the caller to create a transaction that sends to several outputs at
once. This is ideal when wanting to batch create a set of transactions.
*/
rpc SendOutputs (SendOutputsRequest) returns (SendOutputsResponse);
/*
EstimateFee attempts to query the internal fee estimator of the wallet to
determine the fee (in sat/kw) to attach to a transaction in order to
achieve the confirmation target.
*/
rpc EstimateFee (EstimateFeeRequest) returns (EstimateFeeResponse);
/*
PendingSweeps returns lists of on-chain outputs that lnd is currently
attempting to sweep within its central batching engine. Outputs with similar
fee rates are batched together in order to sweep them within a single
transaction.
NOTE: Some of the fields within PendingSweepsRequest are not guaranteed to
remain supported. This is an advanced API that depends on the internals of
the UtxoSweeper, so things may change.
*/
rpc PendingSweeps (PendingSweepsRequest) returns (PendingSweepsResponse);
/*
BumpFee bumps the fee of an arbitrary input within a transaction. This RPC
takes a different approach than bitcoind's bumpfee command. lnd has a
central batching engine in which inputs with similar fee rates are batched
together to save on transaction fees. Due to this, we cannot rely on
bumping the fee on a specific transaction, since transactions can change at
any point with the addition of new inputs. The list of inputs that
currently exist within lnd's central batching engine can be retrieved
through the PendingSweeps RPC.
When bumping the fee of an input that currently exists within lnd's central
batching engine, a higher fee transaction will be created that replaces the
lower fee transaction through the Replace-By-Fee (RBF) policy. If it
This RPC also serves useful when wanting to perform a Child-Pays-For-Parent
(CPFP), where the child transaction pays for its parent's fee. This can be
done by specifying an outpoint within the low fee transaction that is under
the control of the wallet.
The fee preference can be expressed either as a specific fee rate or a delta
of blocks in which the output should be swept on-chain within. If a fee
preference is not explicitly specified, then an error is returned.
Note that this RPC currently doesn't perform any validation checks on the
fee preference being provided. For now, the responsibility of ensuring that
the new fee preference is sufficient is delegated to the user.
*/
rpc BumpFee (BumpFeeRequest) returns (BumpFeeResponse);
/**
ListSweeps returns a list of the sweep transactions our node has produced.
Note that these sweeps may not be confirmed yet, as we record sweeps on
broadcast, not confirmation.
*/
rpc ListSweeps (ListSweepsRequest) returns (ListSweepsResponse);
}
message KeyReq {
/*
Is the key finger print of the root pubkey that this request is targeting.
This allows the WalletKit to possibly serve out keys for multiple HD chains
via public derivation.
*/
int32 key_finger_print = 1;
/**
/*
The target key family to derive a key from. In other contexts, this is
known as the "account".
*/
@@ -26,20 +118,20 @@ message AddrRequest {
// No fields, as we always give out a p2wkh address.
}
message AddrResponse {
/**
/*
The address encoded using a bech32 format.
*/
string addr = 1;
}
message Transaction {
/**
/*
The raw serialized transaction.
*/
bytes tx_hex = 1;
}
message PublishResponse {
/**
/*
If blank, then no error occurred and the transaction was successfully
published. If not the empty string, then a string representation of the
broadcast error.
@@ -50,32 +142,32 @@ message PublishResponse {
}
message SendOutputsRequest {
/**
/*
The number of satoshis per kilo weight that should be used when crafting
this transaction.
*/
int64 sat_per_kw = 1;
/**
/*
A slice of the outputs that should be created in the transaction produced.
*/
repeated signrpc.TxOut outputs = 2;
}
message SendOutputsResponse {
/**
/*
The serialized transaction sent out on the network.
*/
bytes raw_tx = 1;
}
message EstimateFeeRequest {
/**
/*
The number of confirmations to shoot for when estimating the fee.
*/
int32 conf_target = 1;
}
message EstimateFeeResponse {
/**
/*
The amount of satoshis per kw that should be used in order to reach the
confirmation target in the request.
*/
@@ -204,7 +296,7 @@ message PendingSweep {
// The requested fee rate, expressed in sat/byte, for this output.
uint32 requested_sat_per_byte = 9;
/**
/*
Whether this input must be force-swept. This means that it is swept even
if it has a negative yield.
*/
@@ -234,7 +326,7 @@ message BumpFeeRequest {
*/
uint32 sat_per_byte = 3;
/**
/*
Whether this input must be force-swept. This means that it is swept even
if it has a negative yield.
*/
@@ -244,7 +336,6 @@ message BumpFeeRequest {
message BumpFeeResponse {
}
message ListSweepsRequest {
/*
Retrieve the full sweep transaction details. If false, only the sweep txids
@@ -268,95 +359,3 @@ message ListSweepsResponse {
TransactionIDs transaction_ids = 2;
}
}
service WalletKit {
/**
DeriveNextKey attempts to derive the *next* key within the key family
(account in BIP43) specified. This method should return the next external
child within this branch.
*/
rpc DeriveNextKey (KeyReq) returns (signrpc.KeyDescriptor);
/**
DeriveKey attempts to derive an arbitrary key specified by the passed
KeyLocator.
*/
rpc DeriveKey (signrpc.KeyLocator) returns (signrpc.KeyDescriptor);
/**
NextAddr returns the next unused address within the wallet.
*/
rpc NextAddr (AddrRequest) returns (AddrResponse);
/**
PublishTransaction attempts to publish the passed transaction to the
network. Once this returns without an error, the wallet will continually
attempt to re-broadcast the transaction on start up, until it enters the
chain.
*/
rpc PublishTransaction (Transaction) returns (PublishResponse);
/**
SendOutputs is similar to the existing sendmany call in Bitcoind, and
allows the caller to create a transaction that sends to several outputs at
once. This is ideal when wanting to batch create a set of transactions.
*/
rpc SendOutputs (SendOutputsRequest) returns (SendOutputsResponse);
/**
EstimateFee attempts to query the internal fee estimator of the wallet to
determine the fee (in sat/kw) to attach to a transaction in order to
achieve the confirmation target.
*/
rpc EstimateFee (EstimateFeeRequest) returns (EstimateFeeResponse);
/*
PendingSweeps returns lists of on-chain outputs that lnd is currently
attempting to sweep within its central batching engine. Outputs with similar
fee rates are batched together in order to sweep them within a single
transaction.
NOTE: Some of the fields within PendingSweepsRequest are not guaranteed to
remain supported. This is an advanced API that depends on the internals of
the UtxoSweeper, so things may change.
*/
rpc PendingSweeps (PendingSweepsRequest) returns (PendingSweepsResponse);
/*
BumpFee bumps the fee of an arbitrary input within a transaction. This RPC
takes a different approach than bitcoind's bumpfee command. lnd has a
central batching engine in which inputs with similar fee rates are batched
together to save on transaction fees. Due to this, we cannot rely on
bumping the fee on a specific transaction, since transactions can change at
any point with the addition of new inputs. The list of inputs that
currently exist within lnd's central batching engine can be retrieved
through the PendingSweeps RPC.
When bumping the fee of an input that currently exists within lnd's central
batching engine, a higher fee transaction will be created that replaces the
lower fee transaction through the Replace-By-Fee (RBF) policy. If it
This RPC also serves useful when wanting to perform a Child-Pays-For-Parent
(CPFP), where the child transaction pays for its parent's fee. This can be
done by specifying an outpoint within the low fee transaction that is under
the control of the wallet.
The fee preference can be expressed either as a specific fee rate or a delta
of blocks in which the output should be swept on-chain within. If a fee
preference is not explicitly specified, then an error is returned.
Note that this RPC currently doesn't perform any validation checks on the
fee preference being provided. For now, the responsibility of ensuring that
the new fee preference is sufficient is delegated to the user.
*/
rpc BumpFee (BumpFeeRequest) returns (BumpFeeResponse);
/**
ListSweeps returns a list of the sweep transactions our node has produced.
Note that these sweeps may not be confirmed yet, as we record sweeps on
broadcast, not confirmation.
*/
rpc ListSweeps (ListSweepsRequest) returns (ListSweepsResponse) {}
}
+289
View File
@@ -0,0 +1,289 @@
{
"swagger": "2.0",
"info": {
"title": "walletrpc/walletkit.proto",
"version": "version not set"
},
"schemes": [
"http",
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {},
"definitions": {
"ListSweepsResponseTransactionIDs": {
"type": "object",
"properties": {
"transaction_ids": {
"type": "array",
"items": {
"type": "string"
},
"description": "Reversed, hex-encoded string representing the transaction ids of the\nsweeps that our node has broadcast. Note that these transactions may\nnot have confirmed yet, we record sweeps on broadcast, not confirmation."
}
}
},
"lnrpcOutPoint": {
"type": "object",
"properties": {
"txid_bytes": {
"type": "string",
"format": "byte",
"description": "Raw bytes representing the transaction id."
},
"txid_str": {
"type": "string",
"description": "Reversed, hex-encoded string representing the transaction id."
},
"output_index": {
"type": "integer",
"format": "int64",
"description": "The index of the output on the transaction."
}
}
},
"lnrpcTransaction": {
"type": "object",
"properties": {
"tx_hash": {
"type": "string",
"title": "The transaction hash"
},
"amount": {
"type": "string",
"format": "int64",
"title": "The transaction amount, denominated in satoshis"
},
"num_confirmations": {
"type": "integer",
"format": "int32",
"title": "The number of confirmations"
},
"block_hash": {
"type": "string",
"title": "The hash of the block this transaction was included in"
},
"block_height": {
"type": "integer",
"format": "int32",
"title": "The height of the block this transaction was included in"
},
"time_stamp": {
"type": "string",
"format": "int64",
"title": "Timestamp of this transaction"
},
"total_fees": {
"type": "string",
"format": "int64",
"title": "Fees paid for this transaction"
},
"dest_addresses": {
"type": "array",
"items": {
"type": "string"
},
"title": "Addresses that received funds for this transaction"
},
"raw_tx_hex": {
"type": "string",
"description": "The raw transaction hex."
}
}
},
"lnrpcTransactionDetails": {
"type": "object",
"properties": {
"transactions": {
"type": "array",
"items": {
"$ref": "#/definitions/lnrpcTransaction"
},
"description": "The list of transactions relevant to the wallet."
}
}
},
"signrpcKeyDescriptor": {
"type": "object",
"properties": {
"raw_key_bytes": {
"type": "string",
"format": "byte",
"description": "The raw bytes of the key being identified. Either this or the KeyLocator\nmust be specified."
},
"key_loc": {
"$ref": "#/definitions/signrpcKeyLocator",
"description": "The key locator that identifies which key to use for signing. Either this\nor the raw bytes of the target key must be specified."
}
}
},
"signrpcKeyLocator": {
"type": "object",
"properties": {
"key_family": {
"type": "integer",
"format": "int32",
"description": "The family of key being identified."
},
"key_index": {
"type": "integer",
"format": "int32",
"description": "The precise index of the key being identified."
}
}
},
"signrpcTxOut": {
"type": "object",
"properties": {
"value": {
"type": "string",
"format": "int64",
"description": "The value of the output being spent."
},
"pk_script": {
"type": "string",
"format": "byte",
"description": "The script of the output being spent."
}
}
},
"walletrpcAddrResponse": {
"type": "object",
"properties": {
"addr": {
"type": "string",
"description": "The address encoded using a bech32 format."
}
}
},
"walletrpcBumpFeeResponse": {
"type": "object"
},
"walletrpcEstimateFeeResponse": {
"type": "object",
"properties": {
"sat_per_kw": {
"type": "string",
"format": "int64",
"description": "The amount of satoshis per kw that should be used in order to reach the\nconfirmation target in the request."
}
}
},
"walletrpcListSweepsResponse": {
"type": "object",
"properties": {
"transaction_details": {
"$ref": "#/definitions/lnrpcTransactionDetails"
},
"transaction_ids": {
"$ref": "#/definitions/ListSweepsResponseTransactionIDs"
}
}
},
"walletrpcPendingSweep": {
"type": "object",
"properties": {
"outpoint": {
"$ref": "#/definitions/lnrpcOutPoint",
"description": "The outpoint of the output we're attempting to sweep."
},
"witness_type": {
"$ref": "#/definitions/walletrpcWitnessType",
"description": "The witness type of the output we're attempting to sweep."
},
"amount_sat": {
"type": "integer",
"format": "int64",
"description": "The value of the output we're attempting to sweep."
},
"sat_per_byte": {
"type": "integer",
"format": "int64",
"description": "The fee rate we'll use to sweep the output. The fee rate is only determined\nonce a sweeping transaction for the output is created, so it's possible for\nthis to be 0 before this."
},
"broadcast_attempts": {
"type": "integer",
"format": "int64",
"description": "The number of broadcast attempts we've made to sweep the output."
},
"next_broadcast_height": {
"type": "integer",
"format": "int64",
"description": "The next height of the chain at which we'll attempt to broadcast the\nsweep transaction of the output."
},
"requested_conf_target": {
"type": "integer",
"format": "int64",
"description": "The requested confirmation target for this output."
},
"requested_sat_per_byte": {
"type": "integer",
"format": "int64",
"description": "The requested fee rate, expressed in sat/byte, for this output."
},
"force": {
"type": "boolean",
"format": "boolean",
"description": "Whether this input must be force-swept. This means that it is swept even\nif it has a negative yield."
}
}
},
"walletrpcPendingSweepsResponse": {
"type": "object",
"properties": {
"pending_sweeps": {
"type": "array",
"items": {
"$ref": "#/definitions/walletrpcPendingSweep"
},
"description": "The set of outputs currently being swept by lnd's central batching engine."
}
}
},
"walletrpcPublishResponse": {
"type": "object",
"properties": {
"publish_error": {
"type": "string",
"description": "If blank, then no error occurred and the transaction was successfully\npublished. If not the empty string, then a string representation of the\nbroadcast error.\n\nTODO(roasbeef): map to a proper enum type"
}
}
},
"walletrpcSendOutputsResponse": {
"type": "object",
"properties": {
"raw_tx": {
"type": "string",
"format": "byte",
"description": "The serialized transaction sent out on the network."
}
}
},
"walletrpcWitnessType": {
"type": "string",
"enum": [
"UNKNOWN_WITNESS",
"COMMITMENT_TIME_LOCK",
"COMMITMENT_NO_DELAY",
"COMMITMENT_REVOKE",
"HTLC_OFFERED_REVOKE",
"HTLC_ACCEPTED_REVOKE",
"HTLC_OFFERED_TIMEOUT_SECOND_LEVEL",
"HTLC_ACCEPTED_SUCCESS_SECOND_LEVEL",
"HTLC_OFFERED_REMOTE_TIMEOUT",
"HTLC_ACCEPTED_REMOTE_SUCCESS",
"HTLC_SECOND_LEVEL_REVOKE",
"WITNESS_KEY_HASH",
"NESTED_WITNESS_KEY_HASH",
"COMMITMENT_ANCHOR"
],
"default": "UNKNOWN_WITNESS",
"description": " - COMMITMENT_TIME_LOCK: A witness that allows us to spend the output of a commitment transaction\nafter a relative lock-time lockout.\n - COMMITMENT_NO_DELAY: A witness that allows us to spend a settled no-delay output immediately on a\ncounterparty's commitment transaction.\n - COMMITMENT_REVOKE: A witness that allows us to sweep the settled output of a malicious\ncounterparty's who broadcasts a revoked commitment transaction.\n - HTLC_OFFERED_REVOKE: A witness that allows us to sweep an HTLC which we offered to the remote\nparty in the case that they broadcast a revoked commitment state.\n - HTLC_ACCEPTED_REVOKE: A witness that allows us to sweep an HTLC output sent to us in the case that\nthe remote party broadcasts a revoked commitment state.\n - HTLC_OFFERED_TIMEOUT_SECOND_LEVEL: A witness that allows us to sweep an HTLC output that we extended to a\nparty, but was never fulfilled. This HTLC output isn't directly on the\ncommitment transaction, but is the result of a confirmed second-level HTLC\ntransaction. As a result, we can only spend this after a CSV delay.\n - HTLC_ACCEPTED_SUCCESS_SECOND_LEVEL: A witness that allows us to sweep an HTLC output that was offered to us, and\nfor which we have a payment preimage. This HTLC output isn't directly on our\ncommitment transaction, but is the result of confirmed second-level HTLC\ntransaction. As a result, we can only spend this after a CSV delay.\n - HTLC_OFFERED_REMOTE_TIMEOUT: A witness that allows us to sweep an HTLC that we offered to the remote\nparty which lies in the commitment transaction of the remote party. We can\nspend this output after the absolute CLTV timeout of the HTLC as passed.\n - HTLC_ACCEPTED_REMOTE_SUCCESS: A witness that allows us to sweep an HTLC that was offered to us by the\nremote party. We use this witness in the case that the remote party goes to\nchain, and we know the pre-image to the HTLC. We can sweep this without any\nadditional timeout.\n - HTLC_SECOND_LEVEL_REVOKE: A witness that allows us to sweep an HTLC from the remote party's commitment\ntransaction in the case that the broadcast a revoked commitment, but then\nalso immediately attempt to go to the second level to claim the HTLC.\n - WITNESS_KEY_HASH: A witness type that allows us to spend a regular p2wkh output that's sent to\nan output which is under complete control of the backing wallet.\n - NESTED_WITNESS_KEY_HASH: A witness type that allows us to sweep an output that sends to a nested P2SH\nscript that pays to a key solely under our control.\n - COMMITMENT_ANCHOR: A witness type that allows us to spend our anchor on the commitment\ntransaction."
}
}
}
+732
View File
@@ -0,0 +1,732 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: walletunlocker.proto
package lnrpc
import (
context "context"
fmt "fmt"
proto "github.com/golang/protobuf/proto"
_ "google.golang.org/genproto/googleapis/api/annotations"
grpc "google.golang.org/grpc"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type GenSeedRequest struct {
//
//aezeed_passphrase is an optional user provided passphrase that will be used
//to encrypt the generated aezeed cipher seed. When using REST, this field
//must be encoded as base64.
AezeedPassphrase []byte `protobuf:"bytes,1,opt,name=aezeed_passphrase,json=aezeedPassphrase,proto3" json:"aezeed_passphrase,omitempty"`
//
//seed_entropy is an optional 16-bytes generated via CSPRNG. If not
//specified, then a fresh set of randomness will be used to create the seed.
//When using REST, this field must be encoded as base64.
SeedEntropy []byte `protobuf:"bytes,2,opt,name=seed_entropy,json=seedEntropy,proto3" json:"seed_entropy,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *GenSeedRequest) Reset() { *m = GenSeedRequest{} }
func (m *GenSeedRequest) String() string { return proto.CompactTextString(m) }
func (*GenSeedRequest) ProtoMessage() {}
func (*GenSeedRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_76e3ed10ed53e4fd, []int{0}
}
func (m *GenSeedRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GenSeedRequest.Unmarshal(m, b)
}
func (m *GenSeedRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_GenSeedRequest.Marshal(b, m, deterministic)
}
func (m *GenSeedRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_GenSeedRequest.Merge(m, src)
}
func (m *GenSeedRequest) XXX_Size() int {
return xxx_messageInfo_GenSeedRequest.Size(m)
}
func (m *GenSeedRequest) XXX_DiscardUnknown() {
xxx_messageInfo_GenSeedRequest.DiscardUnknown(m)
}
var xxx_messageInfo_GenSeedRequest proto.InternalMessageInfo
func (m *GenSeedRequest) GetAezeedPassphrase() []byte {
if m != nil {
return m.AezeedPassphrase
}
return nil
}
func (m *GenSeedRequest) GetSeedEntropy() []byte {
if m != nil {
return m.SeedEntropy
}
return nil
}
type GenSeedResponse struct {
//
//cipher_seed_mnemonic is a 24-word mnemonic that encodes a prior aezeed
//cipher seed obtained by the user. This field is optional, as if not
//provided, then the daemon will generate a new cipher seed for the user.
//Otherwise, then the daemon will attempt to recover the wallet state linked
//to this cipher seed.
CipherSeedMnemonic []string `protobuf:"bytes,1,rep,name=cipher_seed_mnemonic,json=cipherSeedMnemonic,proto3" json:"cipher_seed_mnemonic,omitempty"`
//
//enciphered_seed are the raw aezeed cipher seed bytes. This is the raw
//cipher text before run through our mnemonic encoding scheme.
EncipheredSeed []byte `protobuf:"bytes,2,opt,name=enciphered_seed,json=encipheredSeed,proto3" json:"enciphered_seed,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *GenSeedResponse) Reset() { *m = GenSeedResponse{} }
func (m *GenSeedResponse) String() string { return proto.CompactTextString(m) }
func (*GenSeedResponse) ProtoMessage() {}
func (*GenSeedResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_76e3ed10ed53e4fd, []int{1}
}
func (m *GenSeedResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GenSeedResponse.Unmarshal(m, b)
}
func (m *GenSeedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_GenSeedResponse.Marshal(b, m, deterministic)
}
func (m *GenSeedResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_GenSeedResponse.Merge(m, src)
}
func (m *GenSeedResponse) XXX_Size() int {
return xxx_messageInfo_GenSeedResponse.Size(m)
}
func (m *GenSeedResponse) XXX_DiscardUnknown() {
xxx_messageInfo_GenSeedResponse.DiscardUnknown(m)
}
var xxx_messageInfo_GenSeedResponse proto.InternalMessageInfo
func (m *GenSeedResponse) GetCipherSeedMnemonic() []string {
if m != nil {
return m.CipherSeedMnemonic
}
return nil
}
func (m *GenSeedResponse) GetEncipheredSeed() []byte {
if m != nil {
return m.EncipheredSeed
}
return nil
}
type InitWalletRequest struct {
//
//wallet_password is the passphrase that should be used to encrypt the
//wallet. This MUST be at least 8 chars in length. After creation, this
//password is required to unlock the daemon. When using REST, this field
//must be encoded as base64.
WalletPassword []byte `protobuf:"bytes,1,opt,name=wallet_password,json=walletPassword,proto3" json:"wallet_password,omitempty"`
//
//cipher_seed_mnemonic is a 24-word mnemonic that encodes a prior aezeed
//cipher seed obtained by the user. This may have been generated by the
//GenSeed method, or be an existing seed.
CipherSeedMnemonic []string `protobuf:"bytes,2,rep,name=cipher_seed_mnemonic,json=cipherSeedMnemonic,proto3" json:"cipher_seed_mnemonic,omitempty"`
//
//aezeed_passphrase is an optional user provided passphrase that will be used
//to encrypt the generated aezeed cipher seed. When using REST, this field
//must be encoded as base64.
AezeedPassphrase []byte `protobuf:"bytes,3,opt,name=aezeed_passphrase,json=aezeedPassphrase,proto3" json:"aezeed_passphrase,omitempty"`
//
//recovery_window is an optional argument specifying the address lookahead
//when restoring a wallet seed. The recovery window applies to each
//individual branch of the BIP44 derivation paths. Supplying a recovery
//window of zero indicates that no addresses should be recovered, such after
//the first initialization of the wallet.
RecoveryWindow int32 `protobuf:"varint,4,opt,name=recovery_window,json=recoveryWindow,proto3" json:"recovery_window,omitempty"`
//
//channel_backups is an optional argument that allows clients to recover the
//settled funds within a set of channels. This should be populated if the
//user was unable to close out all channels and sweep funds before partial or
//total data loss occurred. If specified, then after on-chain recovery of
//funds, lnd begin to carry out the data loss recovery protocol in order to
//recover the funds in each channel from a remote force closed transaction.
ChannelBackups *ChanBackupSnapshot `protobuf:"bytes,5,opt,name=channel_backups,json=channelBackups,proto3" json:"channel_backups,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *InitWalletRequest) Reset() { *m = InitWalletRequest{} }
func (m *InitWalletRequest) String() string { return proto.CompactTextString(m) }
func (*InitWalletRequest) ProtoMessage() {}
func (*InitWalletRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_76e3ed10ed53e4fd, []int{2}
}
func (m *InitWalletRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_InitWalletRequest.Unmarshal(m, b)
}
func (m *InitWalletRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_InitWalletRequest.Marshal(b, m, deterministic)
}
func (m *InitWalletRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_InitWalletRequest.Merge(m, src)
}
func (m *InitWalletRequest) XXX_Size() int {
return xxx_messageInfo_InitWalletRequest.Size(m)
}
func (m *InitWalletRequest) XXX_DiscardUnknown() {
xxx_messageInfo_InitWalletRequest.DiscardUnknown(m)
}
var xxx_messageInfo_InitWalletRequest proto.InternalMessageInfo
func (m *InitWalletRequest) GetWalletPassword() []byte {
if m != nil {
return m.WalletPassword
}
return nil
}
func (m *InitWalletRequest) GetCipherSeedMnemonic() []string {
if m != nil {
return m.CipherSeedMnemonic
}
return nil
}
func (m *InitWalletRequest) GetAezeedPassphrase() []byte {
if m != nil {
return m.AezeedPassphrase
}
return nil
}
func (m *InitWalletRequest) GetRecoveryWindow() int32 {
if m != nil {
return m.RecoveryWindow
}
return 0
}
func (m *InitWalletRequest) GetChannelBackups() *ChanBackupSnapshot {
if m != nil {
return m.ChannelBackups
}
return nil
}
type InitWalletResponse struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *InitWalletResponse) Reset() { *m = InitWalletResponse{} }
func (m *InitWalletResponse) String() string { return proto.CompactTextString(m) }
func (*InitWalletResponse) ProtoMessage() {}
func (*InitWalletResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_76e3ed10ed53e4fd, []int{3}
}
func (m *InitWalletResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_InitWalletResponse.Unmarshal(m, b)
}
func (m *InitWalletResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_InitWalletResponse.Marshal(b, m, deterministic)
}
func (m *InitWalletResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_InitWalletResponse.Merge(m, src)
}
func (m *InitWalletResponse) XXX_Size() int {
return xxx_messageInfo_InitWalletResponse.Size(m)
}
func (m *InitWalletResponse) XXX_DiscardUnknown() {
xxx_messageInfo_InitWalletResponse.DiscardUnknown(m)
}
var xxx_messageInfo_InitWalletResponse proto.InternalMessageInfo
type UnlockWalletRequest struct {
//
//wallet_password should be the current valid passphrase for the daemon. This
//will be required to decrypt on-disk material that the daemon requires to
//function properly. When using REST, this field must be encoded as base64.
WalletPassword []byte `protobuf:"bytes,1,opt,name=wallet_password,json=walletPassword,proto3" json:"wallet_password,omitempty"`
//
//recovery_window is an optional argument specifying the address lookahead
//when restoring a wallet seed. The recovery window applies to each
//individual branch of the BIP44 derivation paths. Supplying a recovery
//window of zero indicates that no addresses should be recovered, such after
//the first initialization of the wallet.
RecoveryWindow int32 `protobuf:"varint,2,opt,name=recovery_window,json=recoveryWindow,proto3" json:"recovery_window,omitempty"`
//
//channel_backups is an optional argument that allows clients to recover the
//settled funds within a set of channels. This should be populated if the
//user was unable to close out all channels and sweep funds before partial or
//total data loss occurred. If specified, then after on-chain recovery of
//funds, lnd begin to carry out the data loss recovery protocol in order to
//recover the funds in each channel from a remote force closed transaction.
ChannelBackups *ChanBackupSnapshot `protobuf:"bytes,3,opt,name=channel_backups,json=channelBackups,proto3" json:"channel_backups,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *UnlockWalletRequest) Reset() { *m = UnlockWalletRequest{} }
func (m *UnlockWalletRequest) String() string { return proto.CompactTextString(m) }
func (*UnlockWalletRequest) ProtoMessage() {}
func (*UnlockWalletRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_76e3ed10ed53e4fd, []int{4}
}
func (m *UnlockWalletRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UnlockWalletRequest.Unmarshal(m, b)
}
func (m *UnlockWalletRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_UnlockWalletRequest.Marshal(b, m, deterministic)
}
func (m *UnlockWalletRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_UnlockWalletRequest.Merge(m, src)
}
func (m *UnlockWalletRequest) XXX_Size() int {
return xxx_messageInfo_UnlockWalletRequest.Size(m)
}
func (m *UnlockWalletRequest) XXX_DiscardUnknown() {
xxx_messageInfo_UnlockWalletRequest.DiscardUnknown(m)
}
var xxx_messageInfo_UnlockWalletRequest proto.InternalMessageInfo
func (m *UnlockWalletRequest) GetWalletPassword() []byte {
if m != nil {
return m.WalletPassword
}
return nil
}
func (m *UnlockWalletRequest) GetRecoveryWindow() int32 {
if m != nil {
return m.RecoveryWindow
}
return 0
}
func (m *UnlockWalletRequest) GetChannelBackups() *ChanBackupSnapshot {
if m != nil {
return m.ChannelBackups
}
return nil
}
type UnlockWalletResponse struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *UnlockWalletResponse) Reset() { *m = UnlockWalletResponse{} }
func (m *UnlockWalletResponse) String() string { return proto.CompactTextString(m) }
func (*UnlockWalletResponse) ProtoMessage() {}
func (*UnlockWalletResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_76e3ed10ed53e4fd, []int{5}
}
func (m *UnlockWalletResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UnlockWalletResponse.Unmarshal(m, b)
}
func (m *UnlockWalletResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_UnlockWalletResponse.Marshal(b, m, deterministic)
}
func (m *UnlockWalletResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_UnlockWalletResponse.Merge(m, src)
}
func (m *UnlockWalletResponse) XXX_Size() int {
return xxx_messageInfo_UnlockWalletResponse.Size(m)
}
func (m *UnlockWalletResponse) XXX_DiscardUnknown() {
xxx_messageInfo_UnlockWalletResponse.DiscardUnknown(m)
}
var xxx_messageInfo_UnlockWalletResponse proto.InternalMessageInfo
type ChangePasswordRequest struct {
//
//current_password should be the current valid passphrase used to unlock the
//daemon. When using REST, this field must be encoded as base64.
CurrentPassword []byte `protobuf:"bytes,1,opt,name=current_password,json=currentPassword,proto3" json:"current_password,omitempty"`
//
//new_password should be the new passphrase that will be needed to unlock the
//daemon. When using REST, this field must be encoded as base64.
NewPassword []byte `protobuf:"bytes,2,opt,name=new_password,json=newPassword,proto3" json:"new_password,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ChangePasswordRequest) Reset() { *m = ChangePasswordRequest{} }
func (m *ChangePasswordRequest) String() string { return proto.CompactTextString(m) }
func (*ChangePasswordRequest) ProtoMessage() {}
func (*ChangePasswordRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_76e3ed10ed53e4fd, []int{6}
}
func (m *ChangePasswordRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ChangePasswordRequest.Unmarshal(m, b)
}
func (m *ChangePasswordRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ChangePasswordRequest.Marshal(b, m, deterministic)
}
func (m *ChangePasswordRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_ChangePasswordRequest.Merge(m, src)
}
func (m *ChangePasswordRequest) XXX_Size() int {
return xxx_messageInfo_ChangePasswordRequest.Size(m)
}
func (m *ChangePasswordRequest) XXX_DiscardUnknown() {
xxx_messageInfo_ChangePasswordRequest.DiscardUnknown(m)
}
var xxx_messageInfo_ChangePasswordRequest proto.InternalMessageInfo
func (m *ChangePasswordRequest) GetCurrentPassword() []byte {
if m != nil {
return m.CurrentPassword
}
return nil
}
func (m *ChangePasswordRequest) GetNewPassword() []byte {
if m != nil {
return m.NewPassword
}
return nil
}
type ChangePasswordResponse struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ChangePasswordResponse) Reset() { *m = ChangePasswordResponse{} }
func (m *ChangePasswordResponse) String() string { return proto.CompactTextString(m) }
func (*ChangePasswordResponse) ProtoMessage() {}
func (*ChangePasswordResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_76e3ed10ed53e4fd, []int{7}
}
func (m *ChangePasswordResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ChangePasswordResponse.Unmarshal(m, b)
}
func (m *ChangePasswordResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ChangePasswordResponse.Marshal(b, m, deterministic)
}
func (m *ChangePasswordResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_ChangePasswordResponse.Merge(m, src)
}
func (m *ChangePasswordResponse) XXX_Size() int {
return xxx_messageInfo_ChangePasswordResponse.Size(m)
}
func (m *ChangePasswordResponse) XXX_DiscardUnknown() {
xxx_messageInfo_ChangePasswordResponse.DiscardUnknown(m)
}
var xxx_messageInfo_ChangePasswordResponse proto.InternalMessageInfo
func init() {
proto.RegisterType((*GenSeedRequest)(nil), "lnrpc.GenSeedRequest")
proto.RegisterType((*GenSeedResponse)(nil), "lnrpc.GenSeedResponse")
proto.RegisterType((*InitWalletRequest)(nil), "lnrpc.InitWalletRequest")
proto.RegisterType((*InitWalletResponse)(nil), "lnrpc.InitWalletResponse")
proto.RegisterType((*UnlockWalletRequest)(nil), "lnrpc.UnlockWalletRequest")
proto.RegisterType((*UnlockWalletResponse)(nil), "lnrpc.UnlockWalletResponse")
proto.RegisterType((*ChangePasswordRequest)(nil), "lnrpc.ChangePasswordRequest")
proto.RegisterType((*ChangePasswordResponse)(nil), "lnrpc.ChangePasswordResponse")
}
func init() { proto.RegisterFile("walletunlocker.proto", fileDescriptor_76e3ed10ed53e4fd) }
var fileDescriptor_76e3ed10ed53e4fd = []byte{
// 595 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xdf, 0x4a, 0xdc, 0x4e,
0x14, 0x26, 0xbb, 0x3f, 0x7f, 0xc5, 0xe3, 0x36, 0xd1, 0x71, 0xb5, 0x31, 0x2a, 0xac, 0x81, 0xb2,
0x5b, 0x0b, 0x9b, 0xd6, 0xde, 0x79, 0x69, 0x29, 0xa5, 0x17, 0x82, 0xac, 0x88, 0x50, 0x0a, 0xdb,
0x98, 0x1c, 0x92, 0x60, 0x3c, 0x93, 0x4e, 0x66, 0x0d, 0xf6, 0xb2, 0x57, 0xbd, 0x2d, 0x7d, 0x8c,
0x3e, 0x4e, 0x5f, 0xa1, 0x0f, 0x52, 0x32, 0x33, 0x71, 0xd5, 0xdd, 0x85, 0xb6, 0x77, 0xe1, 0x3b,
0x7f, 0xbe, 0xf3, 0x7d, 0xe7, 0x64, 0xa0, 0x5b, 0x85, 0x79, 0x8e, 0x72, 0x42, 0x39, 0x8f, 0x2e,
0x51, 0x0c, 0x0b, 0xc1, 0x25, 0x67, 0x4b, 0x39, 0x89, 0x22, 0xf2, 0x76, 0x12, 0xce, 0x93, 0x1c,
0x83, 0xb0, 0xc8, 0x82, 0x90, 0x88, 0xcb, 0x50, 0x66, 0x9c, 0x4a, 0x9d, 0xe4, 0x2d, 0x8b, 0x22,
0xd2, 0x9f, 0xfe, 0x47, 0xb0, 0xdf, 0x22, 0x9d, 0x22, 0xc6, 0x23, 0xfc, 0x34, 0xc1, 0x52, 0xb2,
0xe7, 0xb0, 0x16, 0xe2, 0x67, 0xc4, 0x78, 0x5c, 0x84, 0x65, 0x59, 0xa4, 0x22, 0x2c, 0xd1, 0xb5,
0x7a, 0xd6, 0xa0, 0x33, 0x5a, 0xd5, 0x81, 0x93, 0x5b, 0x9c, 0xed, 0x41, 0xa7, 0xac, 0x53, 0x91,
0xa4, 0xe0, 0xc5, 0x8d, 0xdb, 0x52, 0x79, 0x2b, 0x35, 0xf6, 0x46, 0x43, 0x7e, 0x0e, 0xce, 0x2d,
0x43, 0x59, 0x70, 0x2a, 0x91, 0xbd, 0x80, 0x6e, 0x94, 0x15, 0x29, 0x8a, 0xb1, 0x2a, 0xbe, 0x22,
0xbc, 0xe2, 0x94, 0x45, 0xae, 0xd5, 0x6b, 0x0f, 0x96, 0x47, 0x4c, 0xc7, 0xea, 0x8a, 0x63, 0x13,
0x61, 0x7d, 0x70, 0x90, 0x34, 0x8e, 0xb1, 0xaa, 0x32, 0x54, 0xf6, 0x14, 0xae, 0x0b, 0xfc, 0xaf,
0x2d, 0x58, 0x7b, 0x47, 0x99, 0x3c, 0x57, 0xe6, 0x34, 0x9a, 0xfa, 0xe0, 0x68, 0xb7, 0x94, 0xa6,
0x8a, 0x8b, 0xd8, 0x28, 0xb2, 0x35, 0x7c, 0x62, 0xd0, 0x85, 0x93, 0xb5, 0x16, 0x4e, 0x36, 0xd7,
0xae, 0xf6, 0x02, 0xbb, 0xfa, 0xe0, 0x08, 0x8c, 0xf8, 0x35, 0x8a, 0x9b, 0x71, 0x95, 0x51, 0xcc,
0x2b, 0xf7, 0xbf, 0x9e, 0x35, 0x58, 0x1a, 0xd9, 0x0d, 0x7c, 0xae, 0x50, 0x76, 0x04, 0x4e, 0x94,
0x86, 0x44, 0x98, 0x8f, 0x2f, 0xc2, 0xe8, 0x72, 0x52, 0x94, 0xee, 0x52, 0xcf, 0x1a, 0xac, 0x1c,
0x6c, 0x0d, 0xd5, 0x82, 0x87, 0xaf, 0xd3, 0x90, 0x8e, 0x54, 0xe4, 0x94, 0xc2, 0xa2, 0x4c, 0xb9,
0x1c, 0xd9, 0xa6, 0x42, 0xc3, 0xa5, 0xdf, 0x05, 0x76, 0xd7, 0x09, 0xed, 0xbd, 0xff, 0xc3, 0x82,
0xf5, 0x33, 0x75, 0x33, 0xff, 0x68, 0xd1, 0x1c, 0x0d, 0xad, 0x3f, 0xd5, 0xd0, 0xfe, 0x5b, 0x0d,
0x9b, 0xd0, 0xbd, 0x3f, 0xac, 0x51, 0x81, 0xb0, 0x51, 0x57, 0x27, 0xd8, 0x8c, 0xd5, 0xc8, 0x78,
0x06, 0xab, 0xd1, 0x44, 0x08, 0xa4, 0x19, 0x1d, 0x8e, 0xc1, 0x6f, 0x85, 0xec, 0x41, 0x87, 0xb0,
0x9a, 0xa6, 0x99, 0xdb, 0x25, 0xac, 0x9a, 0x14, 0xdf, 0x85, 0xcd, 0x87, 0x34, 0x7a, 0x80, 0x83,
0x6f, 0x6d, 0xb0, 0xf5, 0x4c, 0x67, 0xe6, 0x07, 0x64, 0xc7, 0xf0, 0xc8, 0x1c, 0x3a, 0xdb, 0x30,
0x0a, 0xef, 0xff, 0x5a, 0xde, 0xe6, 0x43, 0xd8, 0xa8, 0x59, 0xff, 0xf2, 0xf3, 0xd7, 0xf7, 0xd6,
0x63, 0xb6, 0x12, 0x5c, 0xbf, 0x0c, 0x12, 0xa4, 0xfa, 0xf6, 0xd8, 0x07, 0x80, 0xe9, 0xfa, 0x98,
0x6b, 0x4a, 0x67, 0x6e, 0xdb, 0xdb, 0x9a, 0x13, 0x31, 0x7d, 0xb7, 0x54, 0xdf, 0x75, 0xdf, 0xae,
0xfb, 0x66, 0x94, 0x49, 0xbd, 0xca, 0x43, 0x6b, 0x9f, 0xc5, 0xd0, 0xb9, 0x6b, 0x2c, 0xf3, 0x4c,
0x97, 0x39, 0xa7, 0xe1, 0x6d, 0xcf, 0x8d, 0x19, 0x8e, 0x6d, 0xc5, 0xb1, 0xe1, 0xaf, 0xd6, 0x1c,
0xfa, 0x31, 0x9a, 0xb2, 0xe4, 0x60, 0xdf, 0xf7, 0x8f, 0xed, 0xdc, 0xd9, 0xfd, 0xcc, 0xf6, 0xbc,
0xdd, 0x05, 0x51, 0xc3, 0xb5, 0xab, 0xb8, 0x9e, 0xf8, 0xac, 0xe6, 0x8a, 0x54, 0x4e, 0xb3, 0xbd,
0x43, 0x6b, 0xff, 0xa8, 0xff, 0xfe, 0x69, 0x92, 0xc9, 0x74, 0x72, 0x31, 0x8c, 0xf8, 0x55, 0x90,
0x67, 0x49, 0x2a, 0x29, 0xa3, 0x84, 0x50, 0x56, 0x5c, 0x5c, 0x06, 0x39, 0xc5, 0x81, 0x6a, 0x7f,
0xf1, 0xbf, 0x7a, 0xfb, 0x5e, 0xfd, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x9c, 0xfa, 0x8d, 0x9e, 0x43,
0x05, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
// WalletUnlockerClient is the client API for WalletUnlocker service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type WalletUnlockerClient interface {
//
//GenSeed is the first method that should be used to instantiate a new lnd
//instance. This method allows a caller to generate a new aezeed cipher seed
//given an optional passphrase. If provided, the passphrase will be necessary
//to decrypt the cipherseed to expose the internal wallet seed.
//
//Once the cipherseed is obtained and verified by the user, the InitWallet
//method should be used to commit the newly generated seed, and create the
//wallet.
GenSeed(ctx context.Context, in *GenSeedRequest, opts ...grpc.CallOption) (*GenSeedResponse, error)
//
//InitWallet is used when lnd is starting up for the first time to fully
//initialize the daemon and its internal wallet. At the very least a wallet
//password must be provided. This will be used to encrypt sensitive material
//on disk.
//
//In the case of a recovery scenario, the user can also specify their aezeed
//mnemonic and passphrase. If set, then the daemon will use this prior state
//to initialize its internal wallet.
//
//Alternatively, this can be used along with the GenSeed RPC to obtain a
//seed, then present it to the user. Once it has been verified by the user,
//the seed can be fed into this RPC in order to commit the new wallet.
InitWallet(ctx context.Context, in *InitWalletRequest, opts ...grpc.CallOption) (*InitWalletResponse, error)
// lncli: `unlock`
//UnlockWallet is used at startup of lnd to provide a password to unlock
//the wallet database.
UnlockWallet(ctx context.Context, in *UnlockWalletRequest, opts ...grpc.CallOption) (*UnlockWalletResponse, error)
// lncli: `changepassword`
//ChangePassword changes the password of the encrypted wallet. This will
//automatically unlock the wallet database if successful.
ChangePassword(ctx context.Context, in *ChangePasswordRequest, opts ...grpc.CallOption) (*ChangePasswordResponse, error)
}
type walletUnlockerClient struct {
cc *grpc.ClientConn
}
func NewWalletUnlockerClient(cc *grpc.ClientConn) WalletUnlockerClient {
return &walletUnlockerClient{cc}
}
func (c *walletUnlockerClient) GenSeed(ctx context.Context, in *GenSeedRequest, opts ...grpc.CallOption) (*GenSeedResponse, error) {
out := new(GenSeedResponse)
err := c.cc.Invoke(ctx, "/lnrpc.WalletUnlocker/GenSeed", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *walletUnlockerClient) InitWallet(ctx context.Context, in *InitWalletRequest, opts ...grpc.CallOption) (*InitWalletResponse, error) {
out := new(InitWalletResponse)
err := c.cc.Invoke(ctx, "/lnrpc.WalletUnlocker/InitWallet", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *walletUnlockerClient) UnlockWallet(ctx context.Context, in *UnlockWalletRequest, opts ...grpc.CallOption) (*UnlockWalletResponse, error) {
out := new(UnlockWalletResponse)
err := c.cc.Invoke(ctx, "/lnrpc.WalletUnlocker/UnlockWallet", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *walletUnlockerClient) ChangePassword(ctx context.Context, in *ChangePasswordRequest, opts ...grpc.CallOption) (*ChangePasswordResponse, error) {
out := new(ChangePasswordResponse)
err := c.cc.Invoke(ctx, "/lnrpc.WalletUnlocker/ChangePassword", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// WalletUnlockerServer is the server API for WalletUnlocker service.
type WalletUnlockerServer interface {
//
//GenSeed is the first method that should be used to instantiate a new lnd
//instance. This method allows a caller to generate a new aezeed cipher seed
//given an optional passphrase. If provided, the passphrase will be necessary
//to decrypt the cipherseed to expose the internal wallet seed.
//
//Once the cipherseed is obtained and verified by the user, the InitWallet
//method should be used to commit the newly generated seed, and create the
//wallet.
GenSeed(context.Context, *GenSeedRequest) (*GenSeedResponse, error)
//
//InitWallet is used when lnd is starting up for the first time to fully
//initialize the daemon and its internal wallet. At the very least a wallet
//password must be provided. This will be used to encrypt sensitive material
//on disk.
//
//In the case of a recovery scenario, the user can also specify their aezeed
//mnemonic and passphrase. If set, then the daemon will use this prior state
//to initialize its internal wallet.
//
//Alternatively, this can be used along with the GenSeed RPC to obtain a
//seed, then present it to the user. Once it has been verified by the user,
//the seed can be fed into this RPC in order to commit the new wallet.
InitWallet(context.Context, *InitWalletRequest) (*InitWalletResponse, error)
// lncli: `unlock`
//UnlockWallet is used at startup of lnd to provide a password to unlock
//the wallet database.
UnlockWallet(context.Context, *UnlockWalletRequest) (*UnlockWalletResponse, error)
// lncli: `changepassword`
//ChangePassword changes the password of the encrypted wallet. This will
//automatically unlock the wallet database if successful.
ChangePassword(context.Context, *ChangePasswordRequest) (*ChangePasswordResponse, error)
}
func RegisterWalletUnlockerServer(s *grpc.Server, srv WalletUnlockerServer) {
s.RegisterService(&_WalletUnlocker_serviceDesc, srv)
}
func _WalletUnlocker_GenSeed_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GenSeedRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WalletUnlockerServer).GenSeed(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/lnrpc.WalletUnlocker/GenSeed",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WalletUnlockerServer).GenSeed(ctx, req.(*GenSeedRequest))
}
return interceptor(ctx, in, info, handler)
}
func _WalletUnlocker_InitWallet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(InitWalletRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WalletUnlockerServer).InitWallet(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/lnrpc.WalletUnlocker/InitWallet",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WalletUnlockerServer).InitWallet(ctx, req.(*InitWalletRequest))
}
return interceptor(ctx, in, info, handler)
}
func _WalletUnlocker_UnlockWallet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UnlockWalletRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WalletUnlockerServer).UnlockWallet(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/lnrpc.WalletUnlocker/UnlockWallet",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WalletUnlockerServer).UnlockWallet(ctx, req.(*UnlockWalletRequest))
}
return interceptor(ctx, in, info, handler)
}
func _WalletUnlocker_ChangePassword_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ChangePasswordRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WalletUnlockerServer).ChangePassword(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/lnrpc.WalletUnlocker/ChangePassword",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WalletUnlockerServer).ChangePassword(ctx, req.(*ChangePasswordRequest))
}
return interceptor(ctx, in, info, handler)
}
var _WalletUnlocker_serviceDesc = grpc.ServiceDesc{
ServiceName: "lnrpc.WalletUnlocker",
HandlerType: (*WalletUnlockerServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GenSeed",
Handler: _WalletUnlocker_GenSeed_Handler,
},
{
MethodName: "InitWallet",
Handler: _WalletUnlocker_InitWallet_Handler,
},
{
MethodName: "UnlockWallet",
Handler: _WalletUnlocker_UnlockWallet_Handler,
},
{
MethodName: "ChangePassword",
Handler: _WalletUnlocker_ChangePassword_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "walletunlocker.proto",
}
+238
View File
@@ -0,0 +1,238 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: walletunlocker.proto
/*
Package lnrpc is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package lnrpc
import (
"context"
"io"
"net/http"
"github.com/golang/protobuf/proto"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/grpc-ecosystem/grpc-gateway/utilities"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/status"
)
var _ codes.Code
var _ io.Reader
var _ status.Status
var _ = runtime.String
var _ = utilities.NewDoubleArray
var (
filter_WalletUnlocker_GenSeed_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_WalletUnlocker_GenSeed_0(ctx context.Context, marshaler runtime.Marshaler, client WalletUnlockerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq GenSeedRequest
var metadata runtime.ServerMetadata
if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_WalletUnlocker_GenSeed_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.GenSeed(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func request_WalletUnlocker_InitWallet_0(ctx context.Context, marshaler runtime.Marshaler, client WalletUnlockerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq InitWalletRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.InitWallet(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func request_WalletUnlocker_UnlockWallet_0(ctx context.Context, marshaler runtime.Marshaler, client WalletUnlockerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq UnlockWalletRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.UnlockWallet(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func request_WalletUnlocker_ChangePassword_0(ctx context.Context, marshaler runtime.Marshaler, client WalletUnlockerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ChangePasswordRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.ChangePassword(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
// RegisterWalletUnlockerHandlerFromEndpoint is same as RegisterWalletUnlockerHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterWalletUnlockerHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.Dial(endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterWalletUnlockerHandler(ctx, mux, conn)
}
// RegisterWalletUnlockerHandler registers the http handlers for service WalletUnlocker to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterWalletUnlockerHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterWalletUnlockerHandlerClient(ctx, mux, NewWalletUnlockerClient(conn))
}
// RegisterWalletUnlockerHandlerClient registers the http handlers for service WalletUnlocker
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "WalletUnlockerClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "WalletUnlockerClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "WalletUnlockerClient" to call the correct interceptors.
func RegisterWalletUnlockerHandlerClient(ctx context.Context, mux *runtime.ServeMux, client WalletUnlockerClient) error {
mux.Handle("GET", pattern_WalletUnlocker_GenSeed_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_WalletUnlocker_GenSeed_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_WalletUnlocker_GenSeed_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_WalletUnlocker_InitWallet_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_WalletUnlocker_InitWallet_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_WalletUnlocker_InitWallet_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_WalletUnlocker_UnlockWallet_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_WalletUnlocker_UnlockWallet_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_WalletUnlocker_UnlockWallet_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_WalletUnlocker_ChangePassword_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_WalletUnlocker_ChangePassword_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_WalletUnlocker_ChangePassword_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_WalletUnlocker_GenSeed_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "genseed"}, ""))
pattern_WalletUnlocker_InitWallet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "initwallet"}, ""))
pattern_WalletUnlocker_UnlockWallet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "unlockwallet"}, ""))
pattern_WalletUnlocker_ChangePassword_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "changepassword"}, ""))
)
var (
forward_WalletUnlocker_GenSeed_0 = runtime.ForwardResponseMessage
forward_WalletUnlocker_InitWallet_0 = runtime.ForwardResponseMessage
forward_WalletUnlocker_UnlockWallet_0 = runtime.ForwardResponseMessage
forward_WalletUnlocker_ChangePassword_0 = runtime.ForwardResponseMessage
)
+213
View File
@@ -0,0 +1,213 @@
syntax = "proto3";
import "google/api/annotations.proto";
import "rpc.proto";
package lnrpc;
option go_package = "github.com/lightningnetwork/lnd/lnrpc";
/*
* Comments in this file will be directly parsed into the API
* Documentation as descriptions of the associated method, message, or field.
* These descriptions should go right above the definition of the object, and
* can be in either block or // comment format.
*
* An RPC method can be matched to an lncli command by placing a line in the
* beginning of the description in exactly the following format:
* lncli: `methodname`
*
* Failure to specify the exact name of the command will cause documentation
* generation to fail.
*
* More information on how exactly the gRPC documentation is generated from
* this proto file can be found here:
* https://github.com/lightninglabs/lightning-api
*/
// WalletUnlocker is a service that is used to set up a wallet password for
// lnd at first startup, and unlock a previously set up wallet.
service WalletUnlocker {
/*
GenSeed is the first method that should be used to instantiate a new lnd
instance. This method allows a caller to generate a new aezeed cipher seed
given an optional passphrase. If provided, the passphrase will be necessary
to decrypt the cipherseed to expose the internal wallet seed.
Once the cipherseed is obtained and verified by the user, the InitWallet
method should be used to commit the newly generated seed, and create the
wallet.
*/
rpc GenSeed (GenSeedRequest) returns (GenSeedResponse) {
option (google.api.http) = {
get: "/v1/genseed"
};
}
/*
InitWallet is used when lnd is starting up for the first time to fully
initialize the daemon and its internal wallet. At the very least a wallet
password must be provided. This will be used to encrypt sensitive material
on disk.
In the case of a recovery scenario, the user can also specify their aezeed
mnemonic and passphrase. If set, then the daemon will use this prior state
to initialize its internal wallet.
Alternatively, this can be used along with the GenSeed RPC to obtain a
seed, then present it to the user. Once it has been verified by the user,
the seed can be fed into this RPC in order to commit the new wallet.
*/
rpc InitWallet (InitWalletRequest) returns (InitWalletResponse) {
option (google.api.http) = {
post: "/v1/initwallet"
body: "*"
};
}
/* lncli: `unlock`
UnlockWallet is used at startup of lnd to provide a password to unlock
the wallet database.
*/
rpc UnlockWallet (UnlockWalletRequest) returns (UnlockWalletResponse) {
option (google.api.http) = {
post: "/v1/unlockwallet"
body: "*"
};
}
/* lncli: `changepassword`
ChangePassword changes the password of the encrypted wallet. This will
automatically unlock the wallet database if successful.
*/
rpc ChangePassword (ChangePasswordRequest)
returns (ChangePasswordResponse) {
option (google.api.http) = {
post: "/v1/changepassword"
body: "*"
};
}
}
message GenSeedRequest {
/*
aezeed_passphrase is an optional user provided passphrase that will be used
to encrypt the generated aezeed cipher seed. When using REST, this field
must be encoded as base64.
*/
bytes aezeed_passphrase = 1;
/*
seed_entropy is an optional 16-bytes generated via CSPRNG. If not
specified, then a fresh set of randomness will be used to create the seed.
When using REST, this field must be encoded as base64.
*/
bytes seed_entropy = 2;
}
message GenSeedResponse {
/*
cipher_seed_mnemonic is a 24-word mnemonic that encodes a prior aezeed
cipher seed obtained by the user. This field is optional, as if not
provided, then the daemon will generate a new cipher seed for the user.
Otherwise, then the daemon will attempt to recover the wallet state linked
to this cipher seed.
*/
repeated string cipher_seed_mnemonic = 1;
/*
enciphered_seed are the raw aezeed cipher seed bytes. This is the raw
cipher text before run through our mnemonic encoding scheme.
*/
bytes enciphered_seed = 2;
}
message InitWalletRequest {
/*
wallet_password is the passphrase that should be used to encrypt the
wallet. This MUST be at least 8 chars in length. After creation, this
password is required to unlock the daemon. When using REST, this field
must be encoded as base64.
*/
bytes wallet_password = 1;
/*
cipher_seed_mnemonic is a 24-word mnemonic that encodes a prior aezeed
cipher seed obtained by the user. This may have been generated by the
GenSeed method, or be an existing seed.
*/
repeated string cipher_seed_mnemonic = 2;
/*
aezeed_passphrase is an optional user provided passphrase that will be used
to encrypt the generated aezeed cipher seed. When using REST, this field
must be encoded as base64.
*/
bytes aezeed_passphrase = 3;
/*
recovery_window is an optional argument specifying the address lookahead
when restoring a wallet seed. The recovery window applies to each
individual branch of the BIP44 derivation paths. Supplying a recovery
window of zero indicates that no addresses should be recovered, such after
the first initialization of the wallet.
*/
int32 recovery_window = 4;
/*
channel_backups is an optional argument that allows clients to recover the
settled funds within a set of channels. This should be populated if the
user was unable to close out all channels and sweep funds before partial or
total data loss occurred. If specified, then after on-chain recovery of
funds, lnd begin to carry out the data loss recovery protocol in order to
recover the funds in each channel from a remote force closed transaction.
*/
ChanBackupSnapshot channel_backups = 5;
}
message InitWalletResponse {
}
message UnlockWalletRequest {
/*
wallet_password should be the current valid passphrase for the daemon. This
will be required to decrypt on-disk material that the daemon requires to
function properly. When using REST, this field must be encoded as base64.
*/
bytes wallet_password = 1;
/*
recovery_window is an optional argument specifying the address lookahead
when restoring a wallet seed. The recovery window applies to each
individual branch of the BIP44 derivation paths. Supplying a recovery
window of zero indicates that no addresses should be recovered, such after
the first initialization of the wallet.
*/
int32 recovery_window = 2;
/*
channel_backups is an optional argument that allows clients to recover the
settled funds within a set of channels. This should be populated if the
user was unable to close out all channels and sweep funds before partial or
total data loss occurred. If specified, then after on-chain recovery of
funds, lnd begin to carry out the data loss recovery protocol in order to
recover the funds in each channel from a remote force closed transaction.
*/
ChanBackupSnapshot channel_backups = 3;
}
message UnlockWalletResponse {
}
message ChangePasswordRequest {
/*
current_password should be the current valid passphrase used to unlock the
daemon. When using REST, this field must be encoded as base64.
*/
bytes current_password = 1;
/*
new_password should be the new passphrase that will be needed to unlock the
daemon. When using REST, this field must be encoded as base64.
*/
bytes new_password = 2;
}
message ChangePasswordResponse {
}
+305
View File
@@ -0,0 +1,305 @@
{
"swagger": "2.0",
"info": {
"title": "walletunlocker.proto",
"version": "version not set"
},
"schemes": [
"http",
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/v1/changepassword": {
"post": {
"summary": "lncli: `changepassword`\nChangePassword changes the password of the encrypted wallet. This will\nautomatically unlock the wallet database if successful.",
"operationId": "ChangePassword",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/lnrpcChangePasswordResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/lnrpcChangePasswordRequest"
}
}
],
"tags": [
"WalletUnlocker"
]
}
},
"/v1/genseed": {
"get": {
"summary": "GenSeed is the first method that should be used to instantiate a new lnd\ninstance. This method allows a caller to generate a new aezeed cipher seed\ngiven an optional passphrase. If provided, the passphrase will be necessary\nto decrypt the cipherseed to expose the internal wallet seed.",
"description": "Once the cipherseed is obtained and verified by the user, the InitWallet\nmethod should be used to commit the newly generated seed, and create the\nwallet.",
"operationId": "GenSeed",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/lnrpcGenSeedResponse"
}
}
},
"parameters": [
{
"name": "aezeed_passphrase",
"description": "aezeed_passphrase is an optional user provided passphrase that will be used\nto encrypt the generated aezeed cipher seed. When using REST, this field\nmust be encoded as base64.",
"in": "query",
"required": false,
"type": "string",
"format": "byte"
},
{
"name": "seed_entropy",
"description": "seed_entropy is an optional 16-bytes generated via CSPRNG. If not\nspecified, then a fresh set of randomness will be used to create the seed.\nWhen using REST, this field must be encoded as base64.",
"in": "query",
"required": false,
"type": "string",
"format": "byte"
}
],
"tags": [
"WalletUnlocker"
]
}
},
"/v1/initwallet": {
"post": {
"summary": "InitWallet is used when lnd is starting up for the first time to fully\ninitialize the daemon and its internal wallet. At the very least a wallet\npassword must be provided. This will be used to encrypt sensitive material\non disk.",
"description": "In the case of a recovery scenario, the user can also specify their aezeed\nmnemonic and passphrase. If set, then the daemon will use this prior state\nto initialize its internal wallet.\n\nAlternatively, this can be used along with the GenSeed RPC to obtain a\nseed, then present it to the user. Once it has been verified by the user,\nthe seed can be fed into this RPC in order to commit the new wallet.",
"operationId": "InitWallet",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/lnrpcInitWalletResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/lnrpcInitWalletRequest"
}
}
],
"tags": [
"WalletUnlocker"
]
}
},
"/v1/unlockwallet": {
"post": {
"summary": "lncli: `unlock`\nUnlockWallet is used at startup of lnd to provide a password to unlock\nthe wallet database.",
"operationId": "UnlockWallet",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/lnrpcUnlockWalletResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/lnrpcUnlockWalletRequest"
}
}
],
"tags": [
"WalletUnlocker"
]
}
}
},
"definitions": {
"lnrpcChanBackupSnapshot": {
"type": "object",
"properties": {
"single_chan_backups": {
"$ref": "#/definitions/lnrpcChannelBackups",
"description": "The set of new channels that have been added since the last channel backup\nsnapshot was requested."
},
"multi_chan_backup": {
"$ref": "#/definitions/lnrpcMultiChanBackup",
"description": "A multi-channel backup that covers all open channels currently known to\nlnd."
}
}
},
"lnrpcChangePasswordRequest": {
"type": "object",
"properties": {
"current_password": {
"type": "string",
"format": "byte",
"description": "current_password should be the current valid passphrase used to unlock the\ndaemon. When using REST, this field must be encoded as base64."
},
"new_password": {
"type": "string",
"format": "byte",
"description": "new_password should be the new passphrase that will be needed to unlock the\ndaemon. When using REST, this field must be encoded as base64."
}
}
},
"lnrpcChangePasswordResponse": {
"type": "object"
},
"lnrpcChannelBackup": {
"type": "object",
"properties": {
"chan_point": {
"$ref": "#/definitions/lnrpcChannelPoint",
"description": "Identifies the channel that this backup belongs to."
},
"chan_backup": {
"type": "string",
"format": "byte",
"description": "Is an encrypted single-chan backup. this can be passed to\nRestoreChannelBackups, or the WalletUnlocker Init and Unlock methods in\norder to trigger the recovery protocol. When using REST, this field must be\nencoded as base64."
}
}
},
"lnrpcChannelBackups": {
"type": "object",
"properties": {
"chan_backups": {
"type": "array",
"items": {
"$ref": "#/definitions/lnrpcChannelBackup"
},
"description": "A set of single-chan static channel backups."
}
}
},
"lnrpcChannelPoint": {
"type": "object",
"properties": {
"funding_txid_bytes": {
"type": "string",
"format": "byte",
"description": "Txid of the funding transaction. When using REST, this field must be\nencoded as base64."
},
"funding_txid_str": {
"type": "string",
"description": "Hex-encoded string representing the byte-reversed hash of the funding\ntransaction."
},
"output_index": {
"type": "integer",
"format": "int64",
"title": "The index of the output of the funding transaction"
}
}
},
"lnrpcGenSeedResponse": {
"type": "object",
"properties": {
"cipher_seed_mnemonic": {
"type": "array",
"items": {
"type": "string"
},
"description": "cipher_seed_mnemonic is a 24-word mnemonic that encodes a prior aezeed\ncipher seed obtained by the user. This field is optional, as if not\nprovided, then the daemon will generate a new cipher seed for the user.\nOtherwise, then the daemon will attempt to recover the wallet state linked\nto this cipher seed."
},
"enciphered_seed": {
"type": "string",
"format": "byte",
"description": "enciphered_seed are the raw aezeed cipher seed bytes. This is the raw\ncipher text before run through our mnemonic encoding scheme."
}
}
},
"lnrpcInitWalletRequest": {
"type": "object",
"properties": {
"wallet_password": {
"type": "string",
"format": "byte",
"description": "wallet_password is the passphrase that should be used to encrypt the\nwallet. This MUST be at least 8 chars in length. After creation, this\npassword is required to unlock the daemon. When using REST, this field\nmust be encoded as base64."
},
"cipher_seed_mnemonic": {
"type": "array",
"items": {
"type": "string"
},
"description": "cipher_seed_mnemonic is a 24-word mnemonic that encodes a prior aezeed\ncipher seed obtained by the user. This may have been generated by the\nGenSeed method, or be an existing seed."
},
"aezeed_passphrase": {
"type": "string",
"format": "byte",
"description": "aezeed_passphrase is an optional user provided passphrase that will be used\nto encrypt the generated aezeed cipher seed. When using REST, this field\nmust be encoded as base64."
},
"recovery_window": {
"type": "integer",
"format": "int32",
"description": "recovery_window is an optional argument specifying the address lookahead\nwhen restoring a wallet seed. The recovery window applies to each\nindividual branch of the BIP44 derivation paths. Supplying a recovery\nwindow of zero indicates that no addresses should be recovered, such after\nthe first initialization of the wallet."
},
"channel_backups": {
"$ref": "#/definitions/lnrpcChanBackupSnapshot",
"description": "channel_backups is an optional argument that allows clients to recover the\nsettled funds within a set of channels. This should be populated if the\nuser was unable to close out all channels and sweep funds before partial or\ntotal data loss occurred. If specified, then after on-chain recovery of\nfunds, lnd begin to carry out the data loss recovery protocol in order to\nrecover the funds in each channel from a remote force closed transaction."
}
}
},
"lnrpcInitWalletResponse": {
"type": "object"
},
"lnrpcMultiChanBackup": {
"type": "object",
"properties": {
"chan_points": {
"type": "array",
"items": {
"$ref": "#/definitions/lnrpcChannelPoint"
},
"description": "Is the set of all channels that are included in this multi-channel backup."
},
"multi_chan_backup": {
"type": "string",
"format": "byte",
"description": "A single encrypted blob containing all the static channel backups of the\nchannel listed above. This can be stored as a single file or blob, and\nsafely be replaced with any prior/future versions. When using REST, this\nfield must be encoded as base64."
}
}
},
"lnrpcUnlockWalletRequest": {
"type": "object",
"properties": {
"wallet_password": {
"type": "string",
"format": "byte",
"description": "wallet_password should be the current valid passphrase for the daemon. This\nwill be required to decrypt on-disk material that the daemon requires to\nfunction properly. When using REST, this field must be encoded as base64."
},
"recovery_window": {
"type": "integer",
"format": "int32",
"description": "recovery_window is an optional argument specifying the address lookahead\nwhen restoring a wallet seed. The recovery window applies to each\nindividual branch of the BIP44 derivation paths. Supplying a recovery\nwindow of zero indicates that no addresses should be recovered, such after\nthe first initialization of the wallet."
},
"channel_backups": {
"$ref": "#/definitions/lnrpcChanBackupSnapshot",
"description": "channel_backups is an optional argument that allows clients to recover the\nsettled funds within a set of channels. This should be populated if the\nuser was unable to close out all channels and sweep funds before partial or\ntotal data loss occurred. If specified, then after on-chain recovery of\nfunds, lnd begin to carry out the data loss recovery protocol in order to\nrecover the funds in each channel from a remote force closed transaction."
}
}
},
"lnrpcUnlockWalletResponse": {
"type": "object"
}
}
}
+5 -5
View File
@@ -54,11 +54,11 @@ func (m *GetInfoRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_GetInfoRequest proto.InternalMessageInfo
type GetInfoResponse struct {
/// The public key of the watchtower.
// The public key of the watchtower.
Pubkey []byte `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
/// The listening addresses of the watchtower.
// The listening addresses of the watchtower.
Listeners []string `protobuf:"bytes,2,rep,name=listeners,proto3" json:"listeners,omitempty"`
/// The URIs of the watchtower.
// The URIs of the watchtower.
Uris []string `protobuf:"bytes,3,rep,name=uris,proto3" json:"uris,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -148,7 +148,7 @@ const _ = grpc.SupportPackageIsVersion4
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type WatchtowerClient interface {
//* lncli: tower info
// lncli: tower info
//GetInfo returns general information concerning the companion watchtower
//including its public key and URIs where the server is currently
//listening for clients.
@@ -174,7 +174,7 @@ func (c *watchtowerClient) GetInfo(ctx context.Context, in *GetInfoRequest, opts
// WatchtowerServer is the server API for Watchtower service.
type WatchtowerServer interface {
//* lncli: tower info
// lncli: tower info
//GetInfo returns general information concerning the companion watchtower
//including its public key and URIs where the server is currently
//listening for clients.
+6 -4
View File
@@ -4,8 +4,10 @@ package watchtowerrpc;
option go_package = "github.com/lightningnetwork/lnd/lnrpc/watchtowerrpc";
// Watchtower is a service that grants access to the watchtower server
// functionality of the daemon.
service Watchtower {
/** lncli: tower info
/* lncli: tower info
GetInfo returns general information concerning the companion watchtower
including its public key and URIs where the server is currently
listening for clients.
@@ -17,12 +19,12 @@ message GetInfoRequest {
}
message GetInfoResponse {
/// The public key of the watchtower.
// The public key of the watchtower.
bytes pubkey = 1;
/// The listening addresses of the watchtower.
// The listening addresses of the watchtower.
repeated string listeners = 2;
/// The URIs of the watchtower.
// The URIs of the watchtower.
repeated string uris = 3;
}
@@ -0,0 +1,44 @@
{
"swagger": "2.0",
"info": {
"title": "watchtowerrpc/watchtower.proto",
"version": "version not set"
},
"schemes": [
"http",
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {},
"definitions": {
"watchtowerrpcGetInfoResponse": {
"type": "object",
"properties": {
"pubkey": {
"type": "string",
"format": "byte",
"description": "The public key of the watchtower."
},
"listeners": {
"type": "array",
"items": {
"type": "string"
},
"description": "The listening addresses of the watchtower."
},
"uris": {
"type": "array",
"items": {
"type": "string"
},
"description": "The URIs of the watchtower."
}
}
}
}
}
+32 -30
View File
@@ -4,6 +4,38 @@ package wtclientrpc;
option go_package = "github.com/lightningnetwork/lnd/lnrpc/wtclientrpc";
// WatchtowerClient is a service that grants access to the watchtower client
// functionality of the daemon.
service WatchtowerClient {
/*
AddTower adds a new watchtower reachable at the given address and
considers it for new sessions. If the watchtower already exists, then
any new addresses included will be considered when dialing it for
session negotiations and backups.
*/
rpc AddTower (AddTowerRequest) returns (AddTowerResponse);
/*
RemoveTower removes a watchtower from being considered for future session
negotiations and from being used for any subsequent backups until it's added
again. If an address is provided, then this RPC only serves as a way of
removing the address from the watchtower instead.
*/
rpc RemoveTower (RemoveTowerRequest) returns (RemoveTowerResponse);
// ListTowers returns the list of watchtowers registered with the client.
rpc ListTowers (ListTowersRequest) returns (ListTowersResponse);
// GetTowerInfo retrieves information for a registered watchtower.
rpc GetTowerInfo (GetTowerInfoRequest) returns (Tower);
// Stats returns the in-memory statistics of the client since startup.
rpc Stats (StatsRequest) returns (StatsResponse);
// Policy returns the active watchtower client policy configuration.
rpc Policy (PolicyRequest) returns (PolicyResponse);
}
message AddTowerRequest {
// The identifying public key of the watchtower to add.
bytes pubkey = 1;
@@ -133,33 +165,3 @@ message PolicyResponse {
*/
uint32 sweep_sat_per_byte = 2;
}
service WatchtowerClient {
/*
AddTower adds a new watchtower reachable at the given address and
considers it for new sessions. If the watchtower already exists, then
any new addresses included will be considered when dialing it for
session negotiations and backups.
*/
rpc AddTower (AddTowerRequest) returns (AddTowerResponse);
/*
RemoveTower removes a watchtower from being considered for future session
negotiations and from being used for any subsequent backups until it's added
again. If an address is provided, then this RPC only serves as a way of
removing the address from the watchtower instead.
*/
rpc RemoveTower (RemoveTowerRequest) returns (RemoveTowerResponse);
// ListTowers returns the list of watchtowers registered with the client.
rpc ListTowers (ListTowersRequest) returns (ListTowersResponse);
// GetTowerInfo retrieves information for a registered watchtower.
rpc GetTowerInfo (GetTowerInfoRequest) returns (Tower);
// Stats returns the in-memory statistics of the client since startup.
rpc Stats (StatsRequest) returns (StatsResponse);
// Policy returns the active watchtower client policy configuration.
rpc Policy (PolicyRequest) returns (PolicyResponse);
}
+142
View File
@@ -0,0 +1,142 @@
{
"swagger": "2.0",
"info": {
"title": "wtclientrpc/wtclient.proto",
"version": "version not set"
},
"schemes": [
"http",
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {},
"definitions": {
"wtclientrpcAddTowerResponse": {
"type": "object"
},
"wtclientrpcListTowersResponse": {
"type": "object",
"properties": {
"towers": {
"type": "array",
"items": {
"$ref": "#/definitions/wtclientrpcTower"
},
"description": "The list of watchtowers available for new backups."
}
}
},
"wtclientrpcPolicyResponse": {
"type": "object",
"properties": {
"max_updates": {
"type": "integer",
"format": "int64",
"description": "The maximum number of updates each session we negotiate with watchtowers\nshould allow."
},
"sweep_sat_per_byte": {
"type": "integer",
"format": "int64",
"description": "The fee rate, in satoshis per vbyte, that will be used by watchtowers for\njustice transactions in response to channel breaches."
}
}
},
"wtclientrpcRemoveTowerResponse": {
"type": "object"
},
"wtclientrpcStatsResponse": {
"type": "object",
"properties": {
"num_backups": {
"type": "integer",
"format": "int64",
"description": "The total number of backups made to all active and exhausted watchtower\nsessions."
},
"num_pending_backups": {
"type": "integer",
"format": "int64",
"description": "The total number of backups that are pending to be acknowledged by all\nactive and exhausted watchtower sessions."
},
"num_failed_backups": {
"type": "integer",
"format": "int64",
"description": "The total number of backups that all active and exhausted watchtower\nsessions have failed to acknowledge."
},
"num_sessions_acquired": {
"type": "integer",
"format": "int64",
"description": "The total number of new sessions made to watchtowers."
},
"num_sessions_exhausted": {
"type": "integer",
"format": "int64",
"description": "The total number of watchtower sessions that have been exhausted."
}
}
},
"wtclientrpcTower": {
"type": "object",
"properties": {
"pubkey": {
"type": "string",
"format": "byte",
"description": "The identifying public key of the watchtower."
},
"addresses": {
"type": "array",
"items": {
"type": "string"
},
"description": "The list of addresses the watchtower is reachable over."
},
"active_session_candidate": {
"type": "boolean",
"format": "boolean",
"description": "Whether the watchtower is currently a candidate for new sessions."
},
"num_sessions": {
"type": "integer",
"format": "int64",
"description": "The number of sessions that have been negotiated with the watchtower."
},
"sessions": {
"type": "array",
"items": {
"$ref": "#/definitions/wtclientrpcTowerSession"
},
"description": "The list of sessions that have been negotiated with the watchtower."
}
}
},
"wtclientrpcTowerSession": {
"type": "object",
"properties": {
"num_backups": {
"type": "integer",
"format": "int64",
"description": "The total number of successful backups that have been made to the\nwatchtower session."
},
"num_pending_backups": {
"type": "integer",
"format": "int64",
"description": "The total number of backups in the session that are currently pending to be\nacknowledged by the watchtower."
},
"max_backups": {
"type": "integer",
"format": "int64",
"description": "The maximum number of backups allowed by the watchtower session."
},
"sweep_sat_per_byte": {
"type": "integer",
"format": "int64",
"description": "The fee rate, in satoshis per vbyte, that will be used by the watchtower for\nthe justice transaction in the event of a channel breach."
}
}
}
}
}