Documentation
¶
Index ¶
- Constants
- Variables
- func CalculateFeeLimit(invoice string, chainParams *chaincfg.Params, feeLimitPpm uint64) (uint, error)
- func CheckInvoiceIsForOffer(invoice string, offer string) bool
- func SerializeChanId(chanId ChanId) *lightzrpc.ChannelId
- func SerializeChanIds(chanIds []ChanId) (result []*lightzrpc.ChannelId)
- type AddInvoiceResponse
- type ChanId
- type ChannelPoint
- type DecodedInvoice
- type LightningChannel
- type LightningInfo
- type LightningNode
- type LightningNodeType
- type Offer
- type PayInvoiceResponse
- type PaymentState
- type PaymentStatus
- type PaymentUpdate
Constants ¶
View Source
const ( PaymentSucceeded PaymentState = "succeeded" PaymentFailed PaymentState = "failed" PaymentPending PaymentState = "pending" NodeTypeLnd LightningNodeType = "LND" NodeTypeCln LightningNodeType = "CLN" // The cltv expiry has to be lowered in regtest to allow for lower swap timeouts RegtestCltv = 18 )
Variables ¶
View Source
var ErrInvoiceNotFound = errors.New("invoice not found")
View Source
var ErrUnsupported = fmt.Errorf("lightning: %w", errors.ErrUnsupported)
Functions ¶
func CalculateFeeLimit ¶
func CalculateFeeLimit(invoice string, chainParams *chaincfg.Params, feeLimitPpm uint64) (uint, error)
CalculateFeeLimit calculates the fee limit of a payment in sat
func CheckInvoiceIsForOffer ¶
func SerializeChanId ¶
func SerializeChanIds ¶
Types ¶
type AddInvoiceResponse ¶
type ChannelPoint ¶
type DecodedInvoice ¶
type DecodedInvoice struct {
AmountSat uint64
PaymentHash [32]byte
Expiry time.Time
MagicRoutingHint *btcec.PublicKey
}
func DecodeBolt12Invoice ¶
func DecodeBolt12Invoice(bolt12 string) (*DecodedInvoice, error)
func DecodeInvoice ¶
func DecodeInvoice(invoice string, network *chaincfg.Params) (*DecodedInvoice, error)
type LightningChannel ¶
type LightningChannel struct {
OutboundSat uint64
InboundSat uint64
Capacity uint64
Id ChanId
PeerId string
Point *ChannelPoint
}
func (*LightningChannel) GetId ¶
func (channel *LightningChannel) GetId() ChanId
type LightningInfo ¶
type LightningNode ¶
type LightningNode interface {
onchain.Wallet
Connect() error
Name() string
PaymentStatus(paymentHash []byte) (*PaymentStatus, error)
PayInvoice(ctx context.Context, invoice string, feeLimit uint, timeoutSeconds uint, channelIds []ChanId) (*PayInvoiceResponse, error)
CreateInvoice(value uint64, preimage []byte, expiry int64, memo string) (*AddInvoiceResponse, error)
NewAddress() (string, error)
GetInfo() (*LightningInfo, error)
ListChannels() ([]*LightningChannel, error)
SetupWallet(info onchain.WalletInfo)
}
type LightningNodeType ¶
type LightningNodeType string
type PayInvoiceResponse ¶
type PayInvoiceResponse struct {
FeeMsat uint
}
type PaymentState ¶
type PaymentState string
type PaymentStatus ¶
type PaymentStatus struct {
State PaymentState
FailureReason string
Preimage string
FeeMsat uint64
}
type PaymentUpdate ¶
type PaymentUpdate struct {
IsLastUpdate bool
Update PaymentStatus
}
Click to show internal directories.
Click to hide internal directories.