account

package
v0.0.0-...-43b4f2a Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: GPL-3.0 Imports: 65 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLnurlLSP

func NewLnurlLSP(lnurl string) (*lnurlLSP, error)

func NewRegularLSP

func NewRegularLSP(lspID string) *regularLSP

func NewRpcSigner

func NewRpcSigner(s signrpc.SignerClient) *rpcSigner

func NewRpcUtxoSource

func NewRpcUtxoSource(c lnrpc.LightningClient) *rpcUtxoSource

Types

type LnurlPayMetadata

type LnurlPayMetadata struct {
	// contains filtered or unexported fields
}

Service is the account service that controls all aspects of routing node connection and user channels as an abstracted account.

type LoginResponse

type LoginResponse struct {
	lnurl.LNURLResponse
	Token string `json:"token"`
}

type PaymentResponse

type PaymentResponse struct {
	PaymentError string
	TraceReport  string
}

PaymentResponse is the response of a payment attempt.

type Service

type Service struct {
	TorConfig *tor.TorConfig
	// contains filtered or unexported fields
}

func NewService

func NewService(
	cfg *config.Config,
	breezDB *db.DB,
	breezAPI services.API,
	daemonAPI lnnode.API,
	requestBackup func(),
	onServiceEvent func(data.NotificationEvent)) (*Service, error)

NewService creates a new account service

func (*Service) AddInvoice

func (a *Service) AddInvoice(invoiceRequest *data.AddInvoiceRequest) (paymentRequest string, lspFee int64, err error)

AddInvoice encapsulate a given amount and description in a payment request

func (*Service) ConnectChannelsPeers

func (a *Service) ConnectChannelsPeers() error

ConnectChannelsPeers connects to all peers associated with a non active channel.

func (*Service) ConnectLSPPeer

func (a *Service) ConnectLSPPeer(lspID string) error

ConnectLSPPeer connects to the LSP peer.

func (*Service) ConnectPeer

func (a *Service) ConnectPeer(pubkey, host string) error

func (*Service) DecodePaymentRequest

func (a *Service) DecodePaymentRequest(paymentRequest string) (*data.InvoiceMemo, error)

DecodePaymentRequest is used by the payer to decode the payment request and read the invoice details.

func (*Service) DecryptLNUrlPayMessage

func (a *Service) DecryptLNUrlPayMessage(paymentHash string, preimage []byte) (string, error)

func (*Service) EnableAccount

func (a *Service) EnableAccount(enabled bool) error

EnableAccount controls whether the account will be enabled or disabled. When disbled, no attempt will be made to open a channel with breez node.

func (*Service) FinishLNURLAuth

func (a *Service) FinishLNURLAuth(authParams *data.LNURLAuth) (string, error)

FinishLNURLAuth logs in using lnurl auth protocol

func (*Service) FinishLNURLPay

func (a *Service) FinishLNURLPay(params *data.LNURLPayResponse1) (*data.LNUrlPayInfo, error)

func (*Service) FinishLNURLWithdraw

func (a *Service) FinishLNURLWithdraw(bolt11 string) (err error)

func (*Service) GetAccountInfo

func (a *Service) GetAccountInfo() (*data.Account, error)

GetAccountInfo is responsible for retrieving some general account details such as balance, status, etc...

func (*Service) GetAccountLimits

func (a *Service) GetAccountLimits() (maxReceive, maxPay, maxReserve int64, err error)

GetAccountLimits returns the account limits.

func (*Service) GetDefaultSatPerByteFee

func (a *Service) GetDefaultSatPerByteFee() (int64, error)

GetDefaultSatPerByteFee returns the default sat per byte fee for on chain transactions

func (*Service) GetGlobalMaxReceiveLimit

func (a *Service) GetGlobalMaxReceiveLimit() (maxReceive int64, err error)

GetGlobalMaxReceiveLimit returns the account global max receive limit.

func (*Service) GetKeyPair

func (a *Service) GetKeyPair() (string, error)

func (*Service) GetMaxAmount

func (a *Service) GetMaxAmount(destination string, routeHints []*lnrpc.RouteHint, lastHopPubkey []byte) (uint64, error)

func (*Service) GetPaymentRequestHash

func (a *Service) GetPaymentRequestHash(paymentRequest string) (string, error)

func (*Service) GetPayments

func (a *Service) GetPayments() (*data.PaymentsList, error)

GetPayments is responsible for retrieving the payment were made in this account

func (*Service) GetRelatedInvoice

func (a *Service) GetRelatedInvoice(paymentRequest string) (*data.Invoice, error)

GetRelatedInvoice is used by the payee to fetch the related invoice of its sent payment request so he can see if it is settled.

func (*Service) HandleLNURL

func (a *Service) HandleLNURL(rawString string) (result *data.LNUrlResponse, err error)

func (*Service) LSPActivity

func (a *Service) LSPActivity(lspList *data.LSPList) (*data.LSPActivity, error)

func (*Service) OnResume

func (a *Service) OnResume()

func (*Service) OpenDirectLnurlChannel

func (a *Service) OpenDirectLnurlChannel(k1, callback, URI string) error

OpenDirectLnurlChannel is responsible for creating a new channel using lnURL

data

func (*Service) OpenLSPChannel

func (a *Service) OpenLSPChannel(lspID string) error

OpenLSPChannel is responsible for creating a new channel with the LSP

func (*Service) OpenLnurlChannel

func (a *Service) OpenLnurlChannel(lnurl string) error

OpenLnurlChannel is responsible for creating a new channel using a lnURL

func (*Service) PublishTransaction

func (a *Service) PublishTransaction(txHex []byte) error

func (*Service) RegisterChannelOpenedNotification

func (a *Service) RegisterChannelOpenedNotification(token string) error

RegisterChannelOpenedNotification register in breez server for notification regarding the confirmation of an existing pending channel. If there is not channels and no pending channels then this function waits for for a channel to be opened.

func (*Service) RegisterPeriodicSync

func (a *Service) RegisterPeriodicSync(token string) error

RegisterPeriodicSync registeres this token for periodic sync notifications.

func (*Service) RegisterReceivePaymentReadyNotification

func (a *Service) RegisterReceivePaymentReadyNotification(token string) error

RegisterReceivePaymentReadyNotification register in breez server for notification regarding the confirmation of an existing pending channel. If there is not channels and no pending channels then this function waits for for a channel to be opened.

func (*Service) SendPaymentFailureBugReport

func (a *Service) SendPaymentFailureBugReport(jsonReport string) error

SendPaymentFailureBugReport is used for investigating payment failures. It should be used if the user agrees to send his payment details and the response of QueryRoutes running in his node. The information is sent to the "bugreporturl" service.

func (*Service) SendPaymentForRequest

func (a *Service) SendPaymentForRequest(paymentRequest string, amountSatoshi int64, fee int64) (string, error)

SendPaymentForRequest send the payment according to the details specified in the bolt 11 payment request. If the payment was failed an error is returned

func (*Service) SendPaymentForRequestV2

func (a *Service) SendPaymentForRequestV2(paymentRequest string, amountSatoshi int64, lastHopPubkey []byte, fee int64) (string, error)

SendPaymentForRequestV2 send the payment according to the details specified in the bolt 11 payment request. If the payment was failed an error is returned

func (*Service) SendSpontaneousPayment

func (a *Service) SendSpontaneousPayment(destNode string,
	description string, amount int64, feeLimitMSat int64,
	groupKey, groupName string, tlv map[int64]string) (string, error)

SendSpontaneousPayment send a payment without a payment request.

func (*Service) SendWalletCoins

func (a *Service) SendWalletCoins(address string, satPerByteFee int64) (string, error)

SendWalletCoins executes a request to send wallet coins to a particular address.

func (*Service) Start

func (a *Service) Start() error

Start starts the account service

func (*Service) Stop

func (a *Service) Stop() error

Stop stops the account service

func (*Service) SweepAllCoinsTransactions

func (a *Service) SweepAllCoinsTransactions(address string) (*data.SweepAllCoinsTransactions, error)

SweepAllCoinsTransactions executes a request to send wallet coins to a particular address.

func (*Service) ValidateAddress

func (a *Service) ValidateAddress(address string) error

ValidateAddress validates a bitcoin address based on the network type

Jump to

Keyboard shortcuts

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