Documentation ¶
Overview ¶
Package invoicesrpc is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func AddInvoice(ctx context.Context, cfg *AddInvoiceConfig, invoice *AddInvoiceData) (*lntypes.Hash, *channeldb.Invoice, error)
- func CreateRPCFeatures(fv *lnwire.FeatureVector) map[uint32]*lnrpc.Feature
- func CreateRPCInvoice(invoice *channeldb.Invoice, activeNetParams *chaincfg.Params) (*lnrpc.Invoice, error)
- func CreateRPCRouteHints(routeHints [][]zpay32.HopHint) []*lnrpc.RouteHint
- func CreateZpay32HopHints(routeHints []*lnrpc.RouteHint) ([][]zpay32.HopHint, error)
- func DisableLog()
- func RegisterInvoicesHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterInvoicesHandlerClient(ctx context.Context, mux *runtime.ServeMux, client InvoicesClient) error
- func RegisterInvoicesHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterInvoicesHandlerServer(ctx context.Context, mux *runtime.ServeMux, server InvoicesServer) error
- func RegisterInvoicesServer(s *grpc.Server, srv InvoicesServer)
- func SelectHopHints(amtMAtoms lnwire.MilliAtom, cfg *SelectHopHintsCfg, ...) [][]zpay32.HopHint
- func UseLogger(logger slog.Logger)
- type AddHoldInvoiceRequest
- func (*AddHoldInvoiceRequest) Descriptor() ([]byte, []int)deprecated
- func (x *AddHoldInvoiceRequest) GetCltvExpiry() uint64
- func (x *AddHoldInvoiceRequest) GetDescriptionHash() []byte
- func (x *AddHoldInvoiceRequest) GetExpiry() int64
- func (x *AddHoldInvoiceRequest) GetFallbackAddr() string
- func (x *AddHoldInvoiceRequest) GetHash() []byte
- func (x *AddHoldInvoiceRequest) GetMemo() string
- func (x *AddHoldInvoiceRequest) GetPrivate() bool
- func (x *AddHoldInvoiceRequest) GetRouteHints() []*lnrpc.RouteHint
- func (x *AddHoldInvoiceRequest) GetValue() int64
- func (x *AddHoldInvoiceRequest) GetValueMAtoms() int64
- func (*AddHoldInvoiceRequest) ProtoMessage()
- func (x *AddHoldInvoiceRequest) ProtoReflect() protoreflect.Message
- func (x *AddHoldInvoiceRequest) Reset()
- func (x *AddHoldInvoiceRequest) String() string
- type AddHoldInvoiceResp
- func (*AddHoldInvoiceResp) Descriptor() ([]byte, []int)deprecated
- func (x *AddHoldInvoiceResp) GetAddIndex() uint64
- func (x *AddHoldInvoiceResp) GetPaymentAddr() []byte
- func (x *AddHoldInvoiceResp) GetPaymentRequest() string
- func (*AddHoldInvoiceResp) ProtoMessage()
- func (x *AddHoldInvoiceResp) ProtoReflect() protoreflect.Message
- func (x *AddHoldInvoiceResp) Reset()
- func (x *AddHoldInvoiceResp) String() string
- type AddInvoiceConfig
- type AddInvoiceData
- type CancelInvoiceMsg
- type CancelInvoiceResp
- type Config
- type HopHintInfo
- type InvoicesClient
- type InvoicesServer
- type Invoices_SubscribeSingleInvoiceClient
- type Invoices_SubscribeSingleInvoiceServer
- type LookupInvoiceMsg
- func (*LookupInvoiceMsg) Descriptor() ([]byte, []int)deprecated
- func (m *LookupInvoiceMsg) GetInvoiceRef() isLookupInvoiceMsg_InvoiceRef
- func (x *LookupInvoiceMsg) GetLookupModifier() LookupModifier
- func (x *LookupInvoiceMsg) GetPaymentAddr() []byte
- func (x *LookupInvoiceMsg) GetPaymentHash() []byte
- func (x *LookupInvoiceMsg) GetSetId() []byte
- func (*LookupInvoiceMsg) ProtoMessage()
- func (x *LookupInvoiceMsg) ProtoReflect() protoreflect.Message
- func (x *LookupInvoiceMsg) Reset()
- func (x *LookupInvoiceMsg) String() string
- type LookupInvoiceMsg_PaymentAddr
- type LookupInvoiceMsg_PaymentHash
- type LookupInvoiceMsg_SetId
- type LookupModifier
- func (LookupModifier) Descriptor() protoreflect.EnumDescriptor
- func (x LookupModifier) Enum() *LookupModifier
- func (LookupModifier) EnumDescriptor() ([]byte, []int)deprecated
- func (x LookupModifier) Number() protoreflect.EnumNumber
- func (x LookupModifier) String() string
- func (LookupModifier) Type() protoreflect.EnumType
- type SelectHopHintsCfg
- type Server
- func (s *Server) AddHoldInvoice(ctx context.Context, invoice *AddHoldInvoiceRequest) (*AddHoldInvoiceResp, error)
- func (s *Server) CancelInvoice(ctx context.Context, in *CancelInvoiceMsg) (*CancelInvoiceResp, error)
- func (s *Server) LookupInvoiceV2(ctx context.Context, req *LookupInvoiceMsg) (*lnrpc.Invoice, error)
- func (s *Server) Name() string
- func (s *Server) SettleInvoice(ctx context.Context, in *SettleInvoiceMsg) (*SettleInvoiceResp, error)
- func (s *Server) Start() error
- func (s *Server) Stop() error
- func (s *Server) SubscribeSingleInvoice(req *SubscribeSingleInvoiceRequest, ...) error
- type ServerShell
- func (r *ServerShell) CreateSubServer(configRegistry lnrpc.SubServerConfigDispatcher) (lnrpc.SubServer, lnrpc.MacaroonPerms, error)
- func (r *ServerShell) RegisterWithRestServer(ctx context.Context, mux *runtime.ServeMux, dest string, ...) error
- func (r *ServerShell) RegisterWithRootServer(grpcServer *grpc.Server) error
- type SettleInvoiceMsg
- type SettleInvoiceResp
- type SubscribeSingleInvoiceRequest
- func (*SubscribeSingleInvoiceRequest) Descriptor() ([]byte, []int)deprecated
- func (x *SubscribeSingleInvoiceRequest) GetRHash() []byte
- func (*SubscribeSingleInvoiceRequest) ProtoMessage()
- func (x *SubscribeSingleInvoiceRequest) ProtoReflect() protoreflect.Message
- func (x *SubscribeSingleInvoiceRequest) Reset()
- func (x *SubscribeSingleInvoiceRequest) String() string
- type UnimplementedInvoicesServer
- func (*UnimplementedInvoicesServer) AddHoldInvoice(context.Context, *AddHoldInvoiceRequest) (*AddHoldInvoiceResp, error)
- func (*UnimplementedInvoicesServer) CancelInvoice(context.Context, *CancelInvoiceMsg) (*CancelInvoiceResp, error)
- func (*UnimplementedInvoicesServer) LookupInvoiceV2(context.Context, *LookupInvoiceMsg) (*lnrpc.Invoice, error)
- func (*UnimplementedInvoicesServer) SettleInvoice(context.Context, *SettleInvoiceMsg) (*SettleInvoiceResp, error)
- func (*UnimplementedInvoicesServer) SubscribeSingleInvoice(*SubscribeSingleInvoiceRequest, Invoices_SubscribeSingleInvoiceServer) error
Constants ¶
const ( // DefaultInvoiceExpiry is the default invoice expiry for new MPP // invoices. DefaultInvoiceExpiry = 24 * time.Hour // DefaultAMPInvoiceExpiry is the default invoice expiry for new AMP // invoices. DefaultAMPInvoiceExpiry = 30 * 24 * time.Hour )
Variables ¶
var ( LookupModifier_name = map[int32]string{ 0: "DEFAULT", 1: "HTLC_SET_ONLY", 2: "HTLC_SET_BLANK", } LookupModifier_value = map[string]int32{ "DEFAULT": 0, "HTLC_SET_ONLY": 1, "HTLC_SET_BLANK": 2, } )
Enum value maps for LookupModifier.
var ( // DefaultInvoicesMacFilename is the default name of the invoices // macaroon that we expect to find via a file handle within the main // configuration file in this package. DefaultInvoicesMacFilename = "invoices.macaroon" )
var File_invoicesrpc_invoices_proto protoreflect.FileDescriptor
Functions ¶
func AddInvoice ¶
func AddInvoice(ctx context.Context, cfg *AddInvoiceConfig, invoice *AddInvoiceData) (*lntypes.Hash, *channeldb.Invoice, error)
AddInvoice attempts to add a new invoice to the invoice database. Any duplicated invoices are rejected, therefore all invoices *must* have a unique payment preimage.
func CreateRPCFeatures ¶ added in v0.3.0
func CreateRPCFeatures(fv *lnwire.FeatureVector) map[uint32]*lnrpc.Feature
CreateRPCFeatures maps a feature vector into a list of lnrpc.Features.
func CreateRPCInvoice ¶
func CreateRPCInvoice(invoice *channeldb.Invoice, activeNetParams *chaincfg.Params) (*lnrpc.Invoice, error)
CreateRPCInvoice creates an *lnrpc.Invoice from the *channeldb.Invoice.
func CreateRPCRouteHints ¶
CreateRPCRouteHints takes in the decoded form of an invoice's route hints and converts them into the lnrpc type.
func CreateZpay32HopHints ¶ added in v0.5.0
CreateZpay32HopHints takes in the lnrpc form of route hints and converts them into an invoice decoded form.
func DisableLog ¶
func DisableLog()
DisableLog disables all library log output. Logging output is disabled by by default until UseLogger is called.
func RegisterInvoicesHandler ¶ added in v0.3.0
func RegisterInvoicesHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterInvoicesHandler registers the http handlers for service Invoices to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterInvoicesHandlerClient ¶ added in v0.3.0
func RegisterInvoicesHandlerClient(ctx context.Context, mux *runtime.ServeMux, client InvoicesClient) error
RegisterInvoicesHandlerClient registers the http handlers for service Invoices to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "InvoicesClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "InvoicesClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "InvoicesClient" to call the correct interceptors.
func RegisterInvoicesHandlerFromEndpoint ¶ added in v0.3.0
func RegisterInvoicesHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterInvoicesHandlerFromEndpoint is same as RegisterInvoicesHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterInvoicesHandlerServer ¶ added in v0.3.0
func RegisterInvoicesHandlerServer(ctx context.Context, mux *runtime.ServeMux, server InvoicesServer) error
RegisterInvoicesHandlerServer registers the http handlers for service Invoices to "mux". UnaryRPC :call InvoicesServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterInvoicesHandlerFromEndpoint instead.
func RegisterInvoicesServer ¶
func RegisterInvoicesServer(s *grpc.Server, srv InvoicesServer)
func SelectHopHints ¶ added in v0.6.0
func SelectHopHints(amtMAtoms lnwire.MilliAtom, cfg *SelectHopHintsCfg, openChannels []*HopHintInfo, numMaxHophints int) [][]zpay32.HopHint
SelectHopHints will select up to numMaxHophints from the set of passed open channels. The set of hop hints will be returned as a slice of functional options that'll append the route hint to the set of all route hints.
TODO(roasbeef): do proper sub-set sum max hints usually << numChans
Types ¶
type AddHoldInvoiceRequest ¶
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 Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` // The value of this invoice in atoms. // // The fields value and value_m_atoms are mutually exclusive. Value int64 `protobuf:"varint,3,opt,name=value,proto3" json:"value,omitempty"` // The value of this invoice in milliatoms. // // The fields value and value_m_atoms are mutually exclusive. ValueMAtoms int64 `protobuf:"varint,10,opt,name=value_m_atoms,json=valueMAtoms,proto3" json:"value_m_atoms,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). Expiry int64 `protobuf:"varint,5,opt,name=expiry,proto3" json:"expiry,omitempty"` // 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. 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. Private bool `protobuf:"varint,9,opt,name=private,proto3" json:"private,omitempty"` // contains filtered or unexported fields }
func (*AddHoldInvoiceRequest) Descriptor
deprecated
func (*AddHoldInvoiceRequest) Descriptor() ([]byte, []int)
Deprecated: Use AddHoldInvoiceRequest.ProtoReflect.Descriptor instead.
func (*AddHoldInvoiceRequest) GetCltvExpiry ¶
func (x *AddHoldInvoiceRequest) GetCltvExpiry() uint64
func (*AddHoldInvoiceRequest) GetDescriptionHash ¶
func (x *AddHoldInvoiceRequest) GetDescriptionHash() []byte
func (*AddHoldInvoiceRequest) GetExpiry ¶
func (x *AddHoldInvoiceRequest) GetExpiry() int64
func (*AddHoldInvoiceRequest) GetFallbackAddr ¶
func (x *AddHoldInvoiceRequest) GetFallbackAddr() string
func (*AddHoldInvoiceRequest) GetHash ¶
func (x *AddHoldInvoiceRequest) GetHash() []byte
func (*AddHoldInvoiceRequest) GetMemo ¶
func (x *AddHoldInvoiceRequest) GetMemo() string
func (*AddHoldInvoiceRequest) GetPrivate ¶
func (x *AddHoldInvoiceRequest) GetPrivate() bool
func (*AddHoldInvoiceRequest) GetRouteHints ¶
func (x *AddHoldInvoiceRequest) GetRouteHints() []*lnrpc.RouteHint
func (*AddHoldInvoiceRequest) GetValue ¶
func (x *AddHoldInvoiceRequest) GetValue() int64
func (*AddHoldInvoiceRequest) GetValueMAtoms ¶ added in v0.3.0
func (x *AddHoldInvoiceRequest) GetValueMAtoms() int64
func (*AddHoldInvoiceRequest) ProtoMessage ¶
func (*AddHoldInvoiceRequest) ProtoMessage()
func (*AddHoldInvoiceRequest) ProtoReflect ¶ added in v0.3.0
func (x *AddHoldInvoiceRequest) ProtoReflect() protoreflect.Message
func (*AddHoldInvoiceRequest) Reset ¶
func (x *AddHoldInvoiceRequest) Reset()
func (*AddHoldInvoiceRequest) String ¶
func (x *AddHoldInvoiceRequest) String() string
type AddHoldInvoiceResp ¶
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. PaymentRequest string `protobuf:"bytes,1,opt,name=payment_request,json=paymentRequest,proto3" json:"payment_request,omitempty"` // The "add" index of this invoice. Each newly created invoice will increment // this index making it monotonically increasing. Callers to the // SubscribeInvoices call can use this to instantly get notified of all added // invoices with an add_index greater than this one. AddIndex uint64 `protobuf:"varint,2,opt,name=add_index,json=addIndex,proto3" json:"add_index,omitempty"` // The payment address of the generated invoice. This value should be used // in all payments for this invoice as we require it for end to end // security. PaymentAddr []byte `protobuf:"bytes,3,opt,name=payment_addr,json=paymentAddr,proto3" json:"payment_addr,omitempty"` // contains filtered or unexported fields }
func (*AddHoldInvoiceResp) Descriptor
deprecated
func (*AddHoldInvoiceResp) Descriptor() ([]byte, []int)
Deprecated: Use AddHoldInvoiceResp.ProtoReflect.Descriptor instead.
func (*AddHoldInvoiceResp) GetAddIndex ¶ added in v0.6.0
func (x *AddHoldInvoiceResp) GetAddIndex() uint64
func (*AddHoldInvoiceResp) GetPaymentAddr ¶ added in v0.6.0
func (x *AddHoldInvoiceResp) GetPaymentAddr() []byte
func (*AddHoldInvoiceResp) GetPaymentRequest ¶
func (x *AddHoldInvoiceResp) GetPaymentRequest() string
func (*AddHoldInvoiceResp) ProtoMessage ¶
func (*AddHoldInvoiceResp) ProtoMessage()
func (*AddHoldInvoiceResp) ProtoReflect ¶ added in v0.3.0
func (x *AddHoldInvoiceResp) ProtoReflect() protoreflect.Message
func (*AddHoldInvoiceResp) Reset ¶
func (x *AddHoldInvoiceResp) Reset()
func (*AddHoldInvoiceResp) String ¶
func (x *AddHoldInvoiceResp) String() string
type AddInvoiceConfig ¶
type AddInvoiceConfig struct { // AddInvoice is called to add the invoice to the registry. AddInvoice func(invoice *channeldb.Invoice, paymentHash lntypes.Hash) ( uint64, error) // IsChannelActive is used to generate valid hop hints. IsChannelActive func(chanID lnwire.ChannelID) bool // ChainParams are required to properly decode invoice payment requests // that are marshalled over rpc. ChainParams *chaincfg.Params // NodeSigner is an implementation of the MessageSigner implementation // that's backed by the identity private key of the running lnd node. NodeSigner *netann.NodeSigner // DefaultCLTVExpiry is the default invoice expiry if no values is // specified. DefaultCLTVExpiry uint32 // ChanDB is a global bboltdb instance which is needed to access the // channel graph. ChanDB *channeldb.ChannelStateDB // Graph holds a reference to the ChannelGraph database. Graph *channeldb.ChannelGraph // GenInvoiceFeatures returns a feature containing feature bits that // should be advertised on freshly generated invoices. GenInvoiceFeatures func() *lnwire.FeatureVector // GenAmpInvoiceFeatures returns a feature containing feature bits that // should be advertised on freshly generated AMP invoices. GenAmpInvoiceFeatures func() *lnwire.FeatureVector }
AddInvoiceConfig contains dependencies for invoice creation.
type AddInvoiceData ¶
type AddInvoiceData 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 // The preimage which will allow settling an incoming HTLC payable to // this preimage. If Preimage is set, Hash should be nil. If both // Preimage and Hash are nil, a random preimage is generated. Preimage *lntypes.Preimage // The hash of the preimage. If Hash is set, Preimage should be nil. // This condition indicates that we have a 'hold invoice' for which the // htlc will be accepted and held until the preimage becomes known. Hash *lntypes.Hash // The value of this invoice in milliatoms. Value lnwire.MilliAtom // 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 // Payment request expiry time in seconds. Default is 3600 (1 hour). Expiry int64 // Fallback on-chain address. FallbackAddr string // Delta to use for the time-lock of the CLTV extended to the final hop. CltvExpiry uint64 // Whether this invoice should include routing hints for private // channels. Private bool // HodlInvoice signals that this invoice shouldn't be settled // immediately upon receiving the payment. HodlInvoice bool // Amp signals whether or not to create an AMP invoice. // // NOTE: Preimage should always be set to nil when this value is true. Amp bool // RouteHints are optional route hints that can each be individually used // to assist in reaching the invoice's destination. RouteHints [][]zpay32.HopHint }
AddInvoiceData contains the required data to create a new invoice.
type CancelInvoiceMsg ¶
type CancelInvoiceMsg struct { // Hash corresponding to the (hold) invoice to cancel. PaymentHash []byte `protobuf:"bytes,1,opt,name=payment_hash,json=paymentHash,proto3" json:"payment_hash,omitempty"` // contains filtered or unexported fields }
func (*CancelInvoiceMsg) Descriptor
deprecated
func (*CancelInvoiceMsg) Descriptor() ([]byte, []int)
Deprecated: Use CancelInvoiceMsg.ProtoReflect.Descriptor instead.
func (*CancelInvoiceMsg) GetPaymentHash ¶
func (x *CancelInvoiceMsg) GetPaymentHash() []byte
func (*CancelInvoiceMsg) ProtoMessage ¶
func (*CancelInvoiceMsg) ProtoMessage()
func (*CancelInvoiceMsg) ProtoReflect ¶ added in v0.3.0
func (x *CancelInvoiceMsg) ProtoReflect() protoreflect.Message
func (*CancelInvoiceMsg) Reset ¶
func (x *CancelInvoiceMsg) Reset()
func (*CancelInvoiceMsg) String ¶
func (x *CancelInvoiceMsg) String() string
type CancelInvoiceResp ¶
type CancelInvoiceResp struct {
// contains filtered or unexported fields
}
func (*CancelInvoiceResp) Descriptor
deprecated
func (*CancelInvoiceResp) Descriptor() ([]byte, []int)
Deprecated: Use CancelInvoiceResp.ProtoReflect.Descriptor instead.
func (*CancelInvoiceResp) ProtoMessage ¶
func (*CancelInvoiceResp) ProtoMessage()
func (*CancelInvoiceResp) ProtoReflect ¶ added in v0.3.0
func (x *CancelInvoiceResp) ProtoReflect() protoreflect.Message
func (*CancelInvoiceResp) Reset ¶
func (x *CancelInvoiceResp) Reset()
func (*CancelInvoiceResp) String ¶
func (x *CancelInvoiceResp) String() string
type Config ¶
type Config struct { // NetworkDir is the main network directory wherein the invoices rpc // server will find the macaroon named DefaultInvoicesMacFilename. NetworkDir string // MacService is the main macaroon service that we'll use to handle // authentication for the invoices rpc server. MacService *macaroons.Service // InvoiceRegistry is a central registry of all the outstanding invoices // created by the daemon. InvoiceRegistry *invoices.InvoiceRegistry // IsChannelActive is used to generate valid hop hints. IsChannelActive func(chanID lnwire.ChannelID) bool // ChainParams are required to properly decode invoice payment requests // that are marshalled over rpc. ChainParams *chaincfg.Params // NodeSigner is an implementation of the MessageSigner implementation // that's backed by the identity private key of the running lnd node. NodeSigner *netann.NodeSigner // DefaultCLTVExpiry is the default invoice expiry if no values is // specified. DefaultCLTVExpiry uint32 // GraphDB is a global database instance which is needed to access the // channel graph. GraphDB *channeldb.ChannelGraph // ChanStateDB is a possibly replicated db instance which contains the // channel state ChanStateDB *channeldb.ChannelStateDB // GenInvoiceFeatures returns a feature containing feature bits that // should be advertised on freshly generated invoices. GenInvoiceFeatures func() *lnwire.FeatureVector // GenAmpInvoiceFeatures returns a feature containing feature bits that // should be advertised on freshly generated AMP invoices. GenAmpInvoiceFeatures func() *lnwire.FeatureVector }
Config is the primary configuration struct for the invoices RPC server. It contains all the items required for the rpc server to carry out its duties. The fields with struct tags are meant to be parsed as normal configuration options, while if able to be populated, the latter fields MUST also be specified.
type HopHintInfo ¶ added in v0.6.0
type HopHintInfo struct { // IsPublic indicates whether a channel is advertised to the network. IsPublic bool // IsActive indicates whether the channel is online and available for // use. IsActive bool // FundingOutpoint is the funding txid:index for the channel. FundingOutpoint wire.OutPoint // RemotePubkey is the public key of the remote party that this channel // is in. RemotePubkey *secp256k1.PublicKey // RemoteBalance is the remote party's balance (our current incoming // capacity). RemoteBalance lnwire.MilliAtom // ShortChannelID is the short channel ID of the channel. ShortChannelID uint64 }
HopHintInfo contains the channel information required to create a hop hint.
type InvoicesClient ¶
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) // LookupInvoiceV2 attempts to look up at invoice. An invoice can be refrenced // using either its payment hash, payment address, or set ID. LookupInvoiceV2(ctx context.Context, in *LookupInvoiceMsg, opts ...grpc.CallOption) (*lnrpc.Invoice, error) }
InvoicesClient is the client API for Invoices service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewInvoicesClient ¶
func NewInvoicesClient(cc grpc.ClientConnInterface) InvoicesClient
type InvoicesServer ¶
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) // LookupInvoiceV2 attempts to look up at invoice. An invoice can be refrenced // using either its payment hash, payment address, or set ID. LookupInvoiceV2(context.Context, *LookupInvoiceMsg) (*lnrpc.Invoice, error) }
InvoicesServer is the server API for Invoices service.
type Invoices_SubscribeSingleInvoiceClient ¶
type Invoices_SubscribeSingleInvoiceClient interface { Recv() (*lnrpc.Invoice, error) grpc.ClientStream }
type Invoices_SubscribeSingleInvoiceServer ¶
type Invoices_SubscribeSingleInvoiceServer interface { Send(*lnrpc.Invoice) error grpc.ServerStream }
type LookupInvoiceMsg ¶ added in v0.6.0
type LookupInvoiceMsg struct { // Types that are assignable to InvoiceRef: // // *LookupInvoiceMsg_PaymentHash // *LookupInvoiceMsg_PaymentAddr // *LookupInvoiceMsg_SetId InvoiceRef isLookupInvoiceMsg_InvoiceRef `protobuf_oneof:"invoice_ref"` LookupModifier LookupModifier `` /* 136-byte string literal not displayed */ // contains filtered or unexported fields }
func (*LookupInvoiceMsg) Descriptor
deprecated
added in
v0.6.0
func (*LookupInvoiceMsg) Descriptor() ([]byte, []int)
Deprecated: Use LookupInvoiceMsg.ProtoReflect.Descriptor instead.
func (*LookupInvoiceMsg) GetInvoiceRef ¶ added in v0.6.0
func (m *LookupInvoiceMsg) GetInvoiceRef() isLookupInvoiceMsg_InvoiceRef
func (*LookupInvoiceMsg) GetLookupModifier ¶ added in v0.6.0
func (x *LookupInvoiceMsg) GetLookupModifier() LookupModifier
func (*LookupInvoiceMsg) GetPaymentAddr ¶ added in v0.6.0
func (x *LookupInvoiceMsg) GetPaymentAddr() []byte
func (*LookupInvoiceMsg) GetPaymentHash ¶ added in v0.6.0
func (x *LookupInvoiceMsg) GetPaymentHash() []byte
func (*LookupInvoiceMsg) GetSetId ¶ added in v0.6.0
func (x *LookupInvoiceMsg) GetSetId() []byte
func (*LookupInvoiceMsg) ProtoMessage ¶ added in v0.6.0
func (*LookupInvoiceMsg) ProtoMessage()
func (*LookupInvoiceMsg) ProtoReflect ¶ added in v0.6.0
func (x *LookupInvoiceMsg) ProtoReflect() protoreflect.Message
func (*LookupInvoiceMsg) Reset ¶ added in v0.6.0
func (x *LookupInvoiceMsg) Reset()
func (*LookupInvoiceMsg) String ¶ added in v0.6.0
func (x *LookupInvoiceMsg) String() string
type LookupInvoiceMsg_PaymentAddr ¶ added in v0.6.0
type LookupInvoiceMsg_PaymentAddr struct {
PaymentAddr []byte `protobuf:"bytes,2,opt,name=payment_addr,json=paymentAddr,proto3,oneof"`
}
type LookupInvoiceMsg_PaymentHash ¶ added in v0.6.0
type LookupInvoiceMsg_PaymentHash struct {
PaymentHash []byte `protobuf:"bytes,1,opt,name=payment_hash,json=paymentHash,proto3,oneof"`
}
type LookupInvoiceMsg_SetId ¶ added in v0.6.0
type LookupInvoiceMsg_SetId struct {
SetId []byte `protobuf:"bytes,3,opt,name=set_id,json=setId,proto3,oneof"`
}
type LookupModifier ¶ added in v0.6.0
type LookupModifier int32
const ( // The default look up modifier, no look up behavior is changed. LookupModifier_DEFAULT LookupModifier = 0 // Indicates that when a look up is done based on a set_id, then only that set // of HTLCs related to that set ID should be returned. LookupModifier_HTLC_SET_ONLY LookupModifier = 1 // Indicates that when a look up is done using a payment_addr, then no HTLCs // related to the payment_addr should be returned. This is useful when one // wants to be able to obtain the set of associated setIDs with a given // invoice, then look up the sub-invoices "projected" by that set ID. LookupModifier_HTLC_SET_BLANK LookupModifier = 2 )
func (LookupModifier) Descriptor ¶ added in v0.6.0
func (LookupModifier) Descriptor() protoreflect.EnumDescriptor
func (LookupModifier) Enum ¶ added in v0.6.0
func (x LookupModifier) Enum() *LookupModifier
func (LookupModifier) EnumDescriptor
deprecated
added in
v0.6.0
func (LookupModifier) EnumDescriptor() ([]byte, []int)
Deprecated: Use LookupModifier.Descriptor instead.
func (LookupModifier) Number ¶ added in v0.6.0
func (x LookupModifier) Number() protoreflect.EnumNumber
func (LookupModifier) String ¶ added in v0.6.0
func (x LookupModifier) String() string
func (LookupModifier) Type ¶ added in v0.6.0
func (LookupModifier) Type() protoreflect.EnumType
type SelectHopHintsCfg ¶ added in v0.6.0
type SelectHopHintsCfg struct { // IsPublicNode is returns a bool indicating whether the node with the // given public key is seen as a public node in the graph from the // graph's source node's point of view. IsPublicNode func(pubKey [33]byte) (bool, error) // FetchChannelEdgesByID attempts to lookup the two directed edges for // the channel identified by the channel ID. FetchChannelEdgesByID func(chanID uint64) (*channeldb.ChannelEdgeInfo, *channeldb.ChannelEdgePolicy, *channeldb.ChannelEdgePolicy, error) }
SelectHopHintsCfg contains the dependencies required to obtain hop hints for an invoice.
type Server ¶ added in v0.3.0
type Server struct {
// contains filtered or unexported fields
}
Server is a sub-server of the main RPC server: the invoices RPC. This sub RPC server allows external callers to access the status of the invoices currently active within lnd, as well as configuring it at runtime.
func New ¶ added in v0.3.0
func New(cfg *Config) (*Server, lnrpc.MacaroonPerms, error)
New returns a new instance of the invoicesrpc Invoices sub-server. We also return the set of permissions for the macaroons that we may create within this method. If the macaroons we need aren't found in the filepath, then we'll create them on start up. If we're unable to locate, or create the macaroons we need, then we'll return with an error.
func (*Server) AddHoldInvoice ¶ added in v0.3.0
func (s *Server) AddHoldInvoice(ctx context.Context, invoice *AddHoldInvoiceRequest) (*AddHoldInvoiceResp, error)
AddHoldInvoice attempts to add a new hold invoice to the invoice database. Any duplicated invoices are rejected, therefore all invoices *must* have a unique payment hash.
func (*Server) CancelInvoice ¶ added in v0.3.0
func (s *Server) CancelInvoice(ctx context.Context, in *CancelInvoiceMsg) (*CancelInvoiceResp, 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.
func (*Server) LookupInvoiceV2 ¶ added in v0.6.0
func (s *Server) LookupInvoiceV2(ctx context.Context, req *LookupInvoiceMsg) (*lnrpc.Invoice, error)
LookupInvoiceV2 attempts to look up at invoice. An invoice can be referenced using either its payment hash, payment address, or set ID.
func (*Server) Name ¶ added in v0.3.0
Name returns a unique string representation of the sub-server. This can be used to identify the sub-server and also de-duplicate them.
NOTE: This is part of the lnrpc.SubServer interface.
func (*Server) SettleInvoice ¶ added in v0.3.0
func (s *Server) SettleInvoice(ctx context.Context, in *SettleInvoiceMsg) (*SettleInvoiceResp, error)
SettleInvoice settles an accepted invoice. If the invoice is already settled, this call will succeed.
func (*Server) Start ¶ added in v0.3.0
Start launches any helper goroutines required for the Server to function.
NOTE: This is part of the lnrpc.SubServer interface.
func (*Server) Stop ¶ added in v0.3.0
Stop signals any active goroutines for a graceful closure.
NOTE: This is part of the lnrpc.SubServer interface.
func (*Server) SubscribeSingleInvoice ¶ added in v0.3.0
func (s *Server) SubscribeSingleInvoice(req *SubscribeSingleInvoiceRequest, updateStream Invoices_SubscribeSingleInvoiceServer) error
SubscribeSingleInvoice returns a uni-directional stream (server -> client) for notifying the client of state changes for a specified invoice.
type ServerShell ¶ added in v0.5.0
type ServerShell struct {
InvoicesServer
}
ServerShell is a shell struct holding a reference to the actual sub-server. It is used to register the gRPC sub-server with the root server before we have the necessary dependencies to populate the actual sub-server.
func (*ServerShell) CreateSubServer ¶ added in v0.5.0
func (r *ServerShell) CreateSubServer(configRegistry lnrpc.SubServerConfigDispatcher) ( lnrpc.SubServer, lnrpc.MacaroonPerms, error)
CreateSubServer populates the subserver's dependencies using the passed SubServerConfigDispatcher. This method should fully initialize the sub-server instance, making it ready for action. It returns the macaroon permissions that the sub-server wishes to pass on to the root server for all methods routed towards it.
NOTE: This is part of the lnrpc.GrpcHandler interface.
func (*ServerShell) RegisterWithRestServer ¶ added in v0.5.0
func (r *ServerShell) RegisterWithRestServer(ctx context.Context, mux *runtime.ServeMux, dest string, opts []grpc.DialOption) error
RegisterWithRestServer will be called by the root REST mux to direct a sub RPC server to register itself with the main REST mux server. Until this is called, each sub-server won't be able to have requests routed towards it.
NOTE: This is part of the lnrpc.GrpcHandler interface.
func (*ServerShell) RegisterWithRootServer ¶ added in v0.5.0
func (r *ServerShell) RegisterWithRootServer(grpcServer *grpc.Server) error
RegisterWithRootServer will be called by the root gRPC server to direct a sub RPC server to register itself with the main gRPC root server. Until this is called, each sub-server won't be able to have requests routed towards it.
NOTE: This is part of the lnrpc.GrpcHandler interface.
type SettleInvoiceMsg ¶
type SettleInvoiceMsg struct { // 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"` // contains filtered or unexported fields }
func (*SettleInvoiceMsg) Descriptor
deprecated
func (*SettleInvoiceMsg) Descriptor() ([]byte, []int)
Deprecated: Use SettleInvoiceMsg.ProtoReflect.Descriptor instead.
func (*SettleInvoiceMsg) GetPreimage ¶
func (x *SettleInvoiceMsg) GetPreimage() []byte
func (*SettleInvoiceMsg) ProtoMessage ¶
func (*SettleInvoiceMsg) ProtoMessage()
func (*SettleInvoiceMsg) ProtoReflect ¶ added in v0.3.0
func (x *SettleInvoiceMsg) ProtoReflect() protoreflect.Message
func (*SettleInvoiceMsg) Reset ¶
func (x *SettleInvoiceMsg) Reset()
func (*SettleInvoiceMsg) String ¶
func (x *SettleInvoiceMsg) String() string
type SettleInvoiceResp ¶
type SettleInvoiceResp struct {
// contains filtered or unexported fields
}
func (*SettleInvoiceResp) Descriptor
deprecated
func (*SettleInvoiceResp) Descriptor() ([]byte, []int)
Deprecated: Use SettleInvoiceResp.ProtoReflect.Descriptor instead.
func (*SettleInvoiceResp) ProtoMessage ¶
func (*SettleInvoiceResp) ProtoMessage()
func (*SettleInvoiceResp) ProtoReflect ¶ added in v0.3.0
func (x *SettleInvoiceResp) ProtoReflect() protoreflect.Message
func (*SettleInvoiceResp) Reset ¶
func (x *SettleInvoiceResp) Reset()
func (*SettleInvoiceResp) String ¶
func (x *SettleInvoiceResp) String() string
type SubscribeSingleInvoiceRequest ¶
type SubscribeSingleInvoiceRequest struct { // 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"` // contains filtered or unexported fields }
func (*SubscribeSingleInvoiceRequest) Descriptor
deprecated
func (*SubscribeSingleInvoiceRequest) Descriptor() ([]byte, []int)
Deprecated: Use SubscribeSingleInvoiceRequest.ProtoReflect.Descriptor instead.
func (*SubscribeSingleInvoiceRequest) GetRHash ¶
func (x *SubscribeSingleInvoiceRequest) GetRHash() []byte
func (*SubscribeSingleInvoiceRequest) ProtoMessage ¶
func (*SubscribeSingleInvoiceRequest) ProtoMessage()
func (*SubscribeSingleInvoiceRequest) ProtoReflect ¶ added in v0.3.0
func (x *SubscribeSingleInvoiceRequest) ProtoReflect() protoreflect.Message
func (*SubscribeSingleInvoiceRequest) Reset ¶
func (x *SubscribeSingleInvoiceRequest) Reset()
func (*SubscribeSingleInvoiceRequest) String ¶
func (x *SubscribeSingleInvoiceRequest) String() string
type UnimplementedInvoicesServer ¶ added in v0.3.0
type UnimplementedInvoicesServer struct { }
UnimplementedInvoicesServer can be embedded to have forward compatible implementations.
func (*UnimplementedInvoicesServer) AddHoldInvoice ¶ added in v0.3.0
func (*UnimplementedInvoicesServer) AddHoldInvoice(context.Context, *AddHoldInvoiceRequest) (*AddHoldInvoiceResp, error)
func (*UnimplementedInvoicesServer) CancelInvoice ¶ added in v0.3.0
func (*UnimplementedInvoicesServer) CancelInvoice(context.Context, *CancelInvoiceMsg) (*CancelInvoiceResp, error)
func (*UnimplementedInvoicesServer) LookupInvoiceV2 ¶ added in v0.6.0
func (*UnimplementedInvoicesServer) LookupInvoiceV2(context.Context, *LookupInvoiceMsg) (*lnrpc.Invoice, error)
func (*UnimplementedInvoicesServer) SettleInvoice ¶ added in v0.3.0
func (*UnimplementedInvoicesServer) SettleInvoice(context.Context, *SettleInvoiceMsg) (*SettleInvoiceResp, error)
func (*UnimplementedInvoicesServer) SubscribeSingleInvoice ¶ added in v0.3.0
func (*UnimplementedInvoicesServer) SubscribeSingleInvoice(*SubscribeSingleInvoiceRequest, Invoices_SubscribeSingleInvoiceServer) error