Documentation
¶
Index ¶
- Variables
- func NewBasicClient(lndHost, tlsPath, macDir, network string, basicOptions ...BasicClientOption) (lnrpc.LightningClient, error)
- type BasicClientOption
- type ChainNotifierClient
- type GrpcLndServices
- type Info
- type InvoiceUpdate
- type InvoicesClient
- type LightningClient
- type LndServices
- type PaymentResult
- type PaymentStatus
- type RouterClient
- type SendPaymentRequest
- type SignerClient
- type WalletKitClient
Constants ¶
This section is empty.
Variables ¶
var ( // ErrMalformedServerResponse is returned when the swap and/or prepay // invoice is malformed. ErrMalformedServerResponse = errors.New( "one or more invoices are malformed", ) // ErrNoRouteToServer is returned if no quote can returned because there // is no route to the server. ErrNoRouteToServer = errors.New("no off-chain route to server") // PaymentResultUnknownPaymentHash is the string result returned by // SendPayment when the final node indicates the hash is unknown. PaymentResultUnknownPaymentHash = "UnknownPaymentHash" // PaymentResultSuccess is the string result returned by SendPayment // when the payment was successful. PaymentResultSuccess = "" // PaymentResultAlreadyPaid is the string result returned by SendPayment // when the payment was already completed in a previous SendPayment // call. PaymentResultAlreadyPaid = channeldb.ErrAlreadyPaid.Error() // PaymentResultInFlight is the string result returned by SendPayment // when the payment was initiated in a previous SendPayment call and // still in flight. PaymentResultInFlight = channeldb.ErrPaymentInFlight.Error() )
Functions ¶
func NewBasicClient ¶
func NewBasicClient(lndHost, tlsPath, macDir, network string, basicOptions ...BasicClientOption) ( lnrpc.LightningClient, error)
NewBasicClient creates a new basic gRPC client to lnd. We call this client "basic" as it falls back to expected defaults if the arguments aren't provided.
Types ¶
type BasicClientOption ¶
type BasicClientOption func(*basicClientOptions)
BasicClientOption is a functional option argument that allows adding arbitrary lnd basic client configuration overrides, without forcing existing users of NewBasicClient to update their invocation. These are always processed in order, with later options overriding earlier ones.
func MacFilename ¶
func MacFilename(macFilename string) BasicClientOption
MacFilename is a basic client option that sets the name of the macaroon file to use.
type ChainNotifierClient ¶
type ChainNotifierClient interface { RegisterBlockEpochNtfn(ctx context.Context) ( chan int32, chan error, error) RegisterConfirmationsNtfn(ctx context.Context, txid *chainhash.Hash, pkScript []byte, numConfs, heightHint int32) ( chan *chainntnfs.TxConfirmation, chan error, error) RegisterSpendNtfn(ctx context.Context, outpoint *wire.OutPoint, pkScript []byte, heightHint int32) ( chan *chainntnfs.SpendDetail, chan error, error) }
ChainNotifierClient exposes base lightning functionality.
type GrpcLndServices ¶
type GrpcLndServices struct { LndServices // contains filtered or unexported fields }
GrpcLndServices constitutes a set of required RPC services.
func NewLndServices ¶
func NewLndServices(lndAddress, application, network, macaroonDir, tlsPath string) (*GrpcLndServices, error)
NewLndServices creates a set of required RPC services.
func (*GrpcLndServices) Close ¶
func (s *GrpcLndServices) Close()
Close closes the lnd connection and waits for all sub server clients to finish their goroutines.
type InvoiceUpdate ¶
type InvoiceUpdate struct { State channeldb.ContractState AmtPaid btcutil.Amount }
InvoiceUpdate contains a state update for an invoice.
type InvoicesClient ¶
type InvoicesClient interface { SubscribeSingleInvoice(ctx context.Context, hash lntypes.Hash) ( <-chan InvoiceUpdate, <-chan error, error) SettleInvoice(ctx context.Context, preimage lntypes.Preimage) error CancelInvoice(ctx context.Context, hash lntypes.Hash) error AddHoldInvoice(ctx context.Context, in *invoicesrpc.AddInvoiceData) ( string, error) }
InvoicesClient exposes invoice functionality.
type LightningClient ¶
type LightningClient interface { PayInvoice(ctx context.Context, invoice string, maxFee btcutil.Amount, outgoingChannel *uint64) chan PaymentResult GetInfo(ctx context.Context) (*Info, error) EstimateFeeToP2WSH(ctx context.Context, amt btcutil.Amount, confTarget int32) (btcutil.Amount, error) ConfirmedWalletBalance(ctx context.Context) (btcutil.Amount, error) AddInvoice(ctx context.Context, in *invoicesrpc.AddInvoiceData) ( lntypes.Hash, string, error) }
LightningClient exposes base lightning functionality.
type LndServices ¶
type LndServices struct { Client LightningClient WalletKit WalletKitClient ChainNotifier ChainNotifierClient Signer SignerClient Invoices InvoicesClient Router RouterClient ChainParams *chaincfg.Params // contains filtered or unexported fields }
LndServices constitutes a set of required services.
type PaymentResult ¶
type PaymentResult struct { Err error Preimage lntypes.Preimage PaidFee btcutil.Amount PaidAmt btcutil.Amount }
PaymentResult signals the result of a payment.
type PaymentStatus ¶
type PaymentStatus struct { State routerrpc.PaymentState Preimage lntypes.Preimage Fee lnwire.MilliSatoshi Route *route.Route }
PaymentStatus describe the state of a payment.
type RouterClient ¶
type RouterClient interface { // SendPayment attempts to route a payment to the final destination. The // call returns a payment update stream and an error stream. SendPayment(ctx context.Context, request SendPaymentRequest) ( chan PaymentStatus, chan error, error) // TrackPayment picks up a previously started payment and returns a // payment update stream and an error stream. TrackPayment(ctx context.Context, hash lntypes.Hash) ( chan PaymentStatus, chan error, error) }
RouterClient exposes payment functionality.
type SendPaymentRequest ¶
type SendPaymentRequest struct { Invoice string MaxFee btcutil.Amount MaxCltv *int32 OutgoingChannel *uint64 Timeout time.Duration }
SendPaymentRequest defines the payment parameters for a new payment.
type SignerClient ¶
type SignerClient interface { SignOutputRaw(ctx context.Context, tx *wire.MsgTx, signDescriptors []*input.SignDescriptor) ([][]byte, error) }
SignerClient exposes sign functionality.
type WalletKitClient ¶
type WalletKitClient interface { DeriveNextKey(ctx context.Context, family int32) ( *keychain.KeyDescriptor, error) DeriveKey(ctx context.Context, locator *keychain.KeyLocator) ( *keychain.KeyDescriptor, error) NextAddr(ctx context.Context) (btcutil.Address, error) PublishTransaction(ctx context.Context, tx *wire.MsgTx) error SendOutputs(ctx context.Context, outputs []*wire.TxOut, feeRate lnwallet.SatPerKWeight) (*wire.MsgTx, error) EstimateFee(ctx context.Context, confTarget int32) (lnwallet.SatPerKWeight, error) }
WalletKitClient exposes wallet functionality.