operation

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPaymentAnalyzer

func NewPaymentAnalyzer(feeWindow *FeeWindow, nts *NextTransactionSize) *paymentAnalyzer

Types

type AnalysisStatus

type AnalysisStatus string
const (
	AnalysisStatusOk                       AnalysisStatus = "Ok"
	AnalysisStatusAmountGreaterThanBalance AnalysisStatus = "GreaterThanBalance"
	AnalysisStatusAmountTooSmall           AnalysisStatus = "AmountTooSmall"
	AnalysisStatusUnpayable                AnalysisStatus = "Unpayable"
)

type FeeWindow

type FeeWindow struct {
	TargetedFees map[uint]float64
}

TODO: we should make FeeWindow enforce a non empty Map of TargetedFees via constructor

func (*FeeWindow) SwapFeeRate

func (f *FeeWindow) SwapFeeRate(confirmationsNeeded uint) (float64, error)

Get the appropriate fee rate for a given swap (depends on confirmations needed). Useful method for when swap doesn't have a fixed amount (e.g AmountLessInvoices + use all funds).

type NextTransactionSize

type NextTransactionSize struct {
	SizeProgression     []SizeForAmount
	ValidAtOperationHid int64 // Just for debugging reasons
	ExpectedDebtInSat   int64
}

func (*NextTransactionSize) TotalBalance

func (nts *NextTransactionSize) TotalBalance() int64

func (*NextTransactionSize) UtxoBalance

func (nts *NextTransactionSize) UtxoBalance() int64

type PaymentAnalysis

type PaymentAnalysis struct {
	Status      AnalysisStatus
	AmountInSat int64
	FeeInSat    int64
	SwapFees    *fees.SwapFees
	TotalInSat  int64
}

type PaymentToAddress

type PaymentToAddress struct {
	TakeFeeFromAmount     bool
	AmountInSat           int64
	FeeRateInSatsPerVByte float64
}

type PaymentToInvoice

type PaymentToInvoice struct {
	TakeFeeFromAmount     bool
	AmountInSat           int64
	SwapFees              *fees.SwapFees              // Nullable before we know the paymentAmount for amountless invoice
	BestRouteFees         []fees.BestRouteFees        // Nullable when we know the amount beforehand (invoice with amount)
	FundingOutputPolicies *fees.FundingOutputPolicies // Nullable when we know the amount beforehand (invoice with amount)
}

type SizeForAmount

type SizeForAmount struct {
	AmountInSat int64
	SizeInVByte int64
}

Jump to

Keyboard shortcuts

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