Documentation
¶
Index ¶
- Constants
- Variables
- func CreateFakeInvoice(amount uint64, failPayment bool) (string, string, string, error)
- type CLNClient
- func (cln *CLNClient) ConnectionStatus() error
- func (cln *CLNClient) CreateInvoice(amount uint64) (Invoice, error)
- func (cln *CLNClient) FeeReserve(amount uint64) uint64
- func (cln *CLNClient) InvoiceStatus(hash string) (Invoice, error)
- func (cln *CLNClient) OutgoingPaymentStatus(ctx context.Context, paymentHash string) (PaymentStatus, error)
- func (cln *CLNClient) PayPartialAmount(ctx context.Context, request string, amountMsat uint64, maxFee uint64) (PaymentStatus, error)
- func (cln *CLNClient) Post(ctx context.Context, url string, body interface{}) (*http.Response, error)
- func (cln *CLNClient) SendPayment(ctx context.Context, request string, maxFee uint64) (PaymentStatus, error)
- func (cln *CLNClient) SubscribeInvoice(ctx context.Context, paymentHash string) (InvoiceSubscriptionClient, error)
- type CLNConfig
- type CLNInvoiceSub
- type Client
- type ErrorResponse
- type FakeBackend
- func (fb *FakeBackend) ConnectionStatus() error
- func (fb *FakeBackend) CreateInvoice(amount uint64) (Invoice, error)
- func (fb *FakeBackend) FeeReserve(amount uint64) uint64
- func (fb *FakeBackend) InvoiceStatus(hash string) (Invoice, error)
- func (fb *FakeBackend) OutgoingPaymentStatus(ctx context.Context, hash string) (PaymentStatus, error)
- func (fb *FakeBackend) PayPartialAmount(ctx context.Context, request string, amountMsat, maxFee uint64) (PaymentStatus, error)
- func (fb *FakeBackend) SendPayment(ctx context.Context, request string, maxFee uint64) (PaymentStatus, error)
- func (fb *FakeBackend) SetInvoiceStatus(hash string, status State)
- func (fb *FakeBackend) SubscribeInvoice(ctx context.Context, paymentHash string) (InvoiceSubscriptionClient, error)
- type FakeBackendInvoice
- type FakeInvoiceSub
- type Invoice
- type InvoiceSubscriptionClient
- type LndClient
- func (lnd *LndClient) ConnectionStatus() error
- func (lnd *LndClient) CreateInvoice(amount uint64) (Invoice, error)
- func (lnd *LndClient) FeeReserve(amount uint64) uint64
- func (lnd *LndClient) InvoiceStatus(hash string) (Invoice, error)
- func (lnd *LndClient) OutgoingPaymentStatus(ctx context.Context, hash string) (PaymentStatus, error)
- func (lnd *LndClient) PayPartialAmount(ctx context.Context, request string, amountMsat uint64, maxFee uint64) (PaymentStatus, error)
- func (lnd *LndClient) SendPayment(ctx context.Context, request string, maxFee uint64) (PaymentStatus, error)
- func (lnd *LndClient) SubscribeInvoice(ctx context.Context, paymentHash string) (InvoiceSubscriptionClient, error)
- type LndConfig
- type LndInvoiceSub
- type PaymentStatus
- type State
Constants ¶
View Source
const ( InvoiceExpiry = 3600 FakePreimage = "0000000000000000" FailPaymentDescription = "fail the payment" )
View Source
const ( // 1 hour InvoiceExpiryTime = 3600 FeePercent float64 = 0.01 )
Variables ¶
View Source
var (
OutgoingPaymentNotFound = errors.New("outgoing payment not found")
)
Functions ¶
Types ¶
type CLNClient ¶
type CLNClient struct {
// contains filtered or unexported fields
}
func SetupCLNClient ¶
func (*CLNClient) ConnectionStatus ¶
func (*CLNClient) CreateInvoice ¶
func (*CLNClient) FeeReserve ¶
func (*CLNClient) OutgoingPaymentStatus ¶
func (*CLNClient) PayPartialAmount ¶
func (*CLNClient) SendPayment ¶
func (*CLNClient) SubscribeInvoice ¶
type CLNInvoiceSub ¶
type CLNInvoiceSub struct {
// contains filtered or unexported fields
}
func (*CLNInvoiceSub) Recv ¶
func (clnSub *CLNInvoiceSub) Recv() (Invoice, error)
type Client ¶
type Client interface { ConnectionStatus() error CreateInvoice(amount uint64) (Invoice, error) InvoiceStatus(hash string) (Invoice, error) SendPayment(ctx context.Context, request string, maxFee uint64) (PaymentStatus, error) PayPartialAmount(ctx context.Context, request string, amountMsat uint64, maxFee uint64) (PaymentStatus, error) OutgoingPaymentStatus(ctx context.Context, hash string) (PaymentStatus, error) FeeReserve(amount uint64) uint64 SubscribeInvoice(ctx context.Context, paymentHash string) (InvoiceSubscriptionClient, error) }
Client interface to interact with a Lightning backend
type ErrorResponse ¶
type FakeBackend ¶
type FakeBackend struct { Invoices []FakeBackendInvoice PaymentDelay int64 }
func (*FakeBackend) ConnectionStatus ¶
func (fb *FakeBackend) ConnectionStatus() error
func (*FakeBackend) CreateInvoice ¶
func (fb *FakeBackend) CreateInvoice(amount uint64) (Invoice, error)
func (*FakeBackend) FeeReserve ¶
func (fb *FakeBackend) FeeReserve(amount uint64) uint64
func (*FakeBackend) InvoiceStatus ¶
func (fb *FakeBackend) InvoiceStatus(hash string) (Invoice, error)
func (*FakeBackend) OutgoingPaymentStatus ¶
func (fb *FakeBackend) OutgoingPaymentStatus(ctx context.Context, hash string) (PaymentStatus, error)
func (*FakeBackend) PayPartialAmount ¶
func (fb *FakeBackend) PayPartialAmount(ctx context.Context, request string, amountMsat, maxFee uint64) (PaymentStatus, error)
func (*FakeBackend) SendPayment ¶
func (fb *FakeBackend) SendPayment(ctx context.Context, request string, maxFee uint64) (PaymentStatus, error)
func (*FakeBackend) SetInvoiceStatus ¶
func (fb *FakeBackend) SetInvoiceStatus(hash string, status State)
func (*FakeBackend) SubscribeInvoice ¶
func (fb *FakeBackend) SubscribeInvoice(ctx context.Context, paymentHash string) (InvoiceSubscriptionClient, error)
type FakeBackendInvoice ¶
type FakeBackendInvoice struct { PaymentRequest string PaymentHash string Preimage string Status State Amount uint64 Expiry uint64 }
func (*FakeBackendInvoice) ToInvoice ¶
func (i *FakeBackendInvoice) ToInvoice() Invoice
type FakeInvoiceSub ¶
type FakeInvoiceSub struct {
// contains filtered or unexported fields
}
func (*FakeInvoiceSub) Recv ¶
func (fakeSub *FakeInvoiceSub) Recv() (Invoice, error)
type InvoiceSubscriptionClient ¶
type InvoiceSubscriptionClient interface { // This blocks until there is an update Recv() (Invoice, error) }
InvoiceSubscriptionClient subscribes to get updates on the status of an invoice
type LndClient ¶
type LndClient struct {
// contains filtered or unexported fields
}
func SetupLndClient ¶
func (*LndClient) ConnectionStatus ¶
func (*LndClient) CreateInvoice ¶
func (*LndClient) FeeReserve ¶
func (*LndClient) OutgoingPaymentStatus ¶
func (*LndClient) PayPartialAmount ¶
func (*LndClient) SendPayment ¶
func (*LndClient) SubscribeInvoice ¶
type LndConfig ¶
type LndConfig struct { GRPCHost string Cert credentials.TransportCredentials Macaroon macaroons.MacaroonCredential }
type LndInvoiceSub ¶
type LndInvoiceSub struct {
// contains filtered or unexported fields
}
func (*LndInvoiceSub) Recv ¶
func (lndSub *LndInvoiceSub) Recv() (Invoice, error)
type PaymentStatus ¶
Click to show internal directories.
Click to hide internal directories.