comms

package
v0.0.0-...-c6a72db Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FAKE_WALLET          = "FakeWallet"
	LND_WALLET           = "LndGrpcWallet"
	LND_HOST             = "LND_GRPC_HOST"
	LND_TLS_CERT         = "LND_TLS_CERT"
	LND_MACAROON         = "LND_MACAROON"
	LNBITS_WALLET        = "LNbitsWallet"
	MINT_LNBITS_ENDPOINT = "MINT_LNBITS_ENDPOINT"
	MINT_LNBITS_KEY      = "MINT_LNBITS_KEY"
)

Variables

This section is empty.

Functions

func ExtractInternalFile

func ExtractInternalFile(ctx context.Context, container testcontainers.Container, path string) (string, error)

func ReadDataFromReader

func ReadDataFromReader(reader io.Reader) (string, error)

func SetUpLightingNetworkTestEnviroment

func SetUpLightingNetworkTestEnviroment(ctx context.Context, names string) (testcontainers.Container, testcontainers.Container, testcontainers.Container, testcontainers.Container, error)

This is used for testing purpose returns alice, bob, btcNode, aliceLnBits, error

Types

type LNBitsData

type LNBitsData struct {
	Key      string
	Endpoint string
}

type LightingComms

type LightingComms struct {
	LndRpcClient     *grpc.ClientConn
	Macaroon         string
	LightningBackend LightningBackend
	LnBitsData       LNBitsData
}

func SetupLightingComms

func SetupLightingComms(ctx context.Context) (*LightingComms, error)

func (*LightingComms) CheckIfInvoicePayed

func (l *LightingComms) CheckIfInvoicePayed(quote string) (cashu.ACTION_STATE, string, error)

func (*LightingComms) LnbitsInvoiceRequest

func (l *LightingComms) LnbitsInvoiceRequest(method string, endpoint string, reqBody any, responseType any) error

func (*LightingComms) PayInvoice

func (l *LightingComms) PayInvoice(invoice string, feeReserve uint64) (*LightningPaymentResponse, error)

func (*LightingComms) QueryPayment

func (l *LightingComms) QueryPayment(zpayInvoice *zpay32.Invoice, invoice string) (*QueryRoutesResponse, error)

func (*LightingComms) RequestInvoice

func (l *LightingComms) RequestInvoice(amount int64) (LightningInvoiceResponse, error)

type LightningBackend

type LightningBackend uint
const LNBITS LightningBackend = iota + 2
const LNDGRPC LightningBackend = iota + 1

type LightningInvoiceRequest

type LightningInvoiceRequest struct {
	Amount int64  `json:"amount"`
	Unit   string `json:"unit"`
	Memo   string `json:"memo"`
	Out    bool   `json:"out"`
	Expiry int64  `json:"expiry"`
	Bolt11 string `json:"bolt11"`
}

type LightningInvoiceResponse

type LightningInvoiceResponse struct {
	PaymentRequest string
	Rhash          string
}

type LightningPaymentResponse

type LightningPaymentResponse struct {
	Preimage       string
	PaymentError   error
	PaymentRequest string
	Rhash          string
}

type QueryRoutesResponse

type QueryRoutesResponse struct {
	FeeReserve uint64 `json:"fee_reserve"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL