package
0.18.4-beta.rc2
Repository: https://github.com/lightningnetwork/lnd.git
Documentation: pkg.go.dev
# README
zpay32
The zpay32 package implements a basic scheme for the encoding of payment
requests between two lnd
nodes within the Lightning Network. The zpay32
encoding scheme uses the
zbase32
scheme along with a checksum to encode a serialized payment request.
The payment request serialized by the package consist of: the destination's public key, the payment hash to use for the payment, and the value of payment to send.
Installation and Updating
$ go get -u github.com/lightningnetwork/lnd/zpay32
# Functions
Amount is a functional option that allows callers of NewInvoice to set the amount in millisatoshis that the Invoice should encode.
CLTVExpiry is an optional value which allows the receiver of the payment to specify the delta between the current height and the HTLC extended to the receiver.
Decode parses the provided encoded invoice and returns a decoded Invoice if it is valid by BOLT-0011 and matches the provided active network.
DecodeBlindedHop reads a sphinx.BlindedHopInfo from the passed reader.
DecodeBlindedPayment attempts to parse a BlindedPaymentPath from the passed reader.
Description is a functional option that allows callers of NewInvoice to set the payment description of the created Invoice.
DescriptionHash is a functional option that allows callers of NewInvoice to set the payment description hash of the created Invoice.
Destination is a functional option that allows callers of NewInvoice to explicitly set the pubkey of the Invoice's destination node.
EncodeBlindedHop writes the passed BlindedHopInfo to the given writer.
Expiry is a functional option that allows callers of NewInvoice to set the expiry of the created Invoice.
FallbackAddr is a functional option that allows callers of NewInvoice to set the Invoice's fallback on-chain address that can be used for payment in case the Lightning payment fails.
Features is a functional option that allows callers of NewInvoice to set the desired feature bits that are advertised on the invoice.
Metadata is a functional option that allows callers of NewInvoice to set the desired payment Metadata that is advertised on the invoice.
NewInvoice creates a new Invoice object.
PaymentAddr is a functional option that allows callers of NewInvoice to set the desired payment address that is advertised on the invoice.
RouteHint is a functional option that allows callers of NewInvoice to add one or more hop hints that represent a private route to the destination.
WithBlindedPaymentPath is a functional option that allows a caller of NewInvoice to attach a blinded payment path to the invoice.
WithErrorOnUnknownFeatureBit is a functional option that will cause the Decode function to return an error if the decoded invoice contains an unknown feature bit.
WithKnownFeatureBits is a functional option that overwrites the set of known feature bits.
# Constants
DefaultAssumedFinalCLTVDelta is the default value to be used as the final CLTV delta for a route if one is unspecified in the payment request.
DefaultInvoiceExpiry is the default expiry duration from the creation timestamp if expiry is set to zero.
# Variables
ErrBrokenTaggedField is returned when the last tagged field is incorrectly formatted and doesn't have enough bytes to be read.
ErrInvalidFieldLength is returned when a tagged field was specified with a length larger than the left over bytes of the data field.
ErrInvoiceTooLarge is returned when an invoice exceeds maxInvoiceLength.
# Structs
BlindedPaymentPath holds all the information a payer needs to know about a blinded path to a receiver of a payment.
HopHint is a routing hint that contains the minimum information of a channel required for an intermediate hop in a route to forward the payment to the next.
Invoice represents a decoded invoice, or to-be-encoded invoice.
MessageSigner is passed to the Encode method to provide a signature corresponding to the node's pubkey.
# Type aliases
DecodeOption is a type that can be used to supply functional options to the Decode function.