Documentation ¶
Index ¶
- type Amount
- type MulticurrencyPaymentData
- type PaymentAccountPool
- func (p *PaymentAccountPool) AwaitConclusionOfInFlightPayments(collectorAccount string)
- func (p *PaymentAccountPool) DefaultCollectorAccountAddress() string
- func (p *PaymentAccountPool) ReceiveMulticurrencyPayment(ctx context.Context, expectedAmounts []Amount, ...) (PaymentReceiver, error)
- func (p *PaymentAccountPool) ReceivePayment() (PaymentReceiver, error)
- func (p *PaymentAccountPool) ReceivePaymentIntoCollectorAccount(collectorAccountAddress string) (PaymentReceiver, error)
- func (p *PaymentAccountPool) RequestAccount() (*wallet.Account, error)
- func (p *PaymentAccountPool) ReturnAccount(account *wallet.Account)
- func (p *PaymentAccountPool) SetMulticurrencyPaymentsEnabled(enabled bool)
- func (p *PaymentAccountPool) Worker(ctx context.Context, interval time.Duration) error
- type PaymentReceivedEventArgs
- type PaymentReceiver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Amount ¶
func NewAmountFromAPIString ¶
func NewAmountFromDecimal ¶
func (Amount) SerializeForAPI ¶
type MulticurrencyPaymentData ¶
type MulticurrencyPaymentData struct { Currency nanswapclient.Ticker PaymentAddress string ExpectedAmounts []Amount OrderID string }
type PaymentAccountPool ¶
type PaymentAccountPool struct {
// contains filtered or unexported fields
}
func New ¶
func New(log *log.Logger, statsClient *statsd.Client, w *wallet.Wallet, repAddress string, modLogWebhook api.WebhookClient, dustThreshold Amount, defaultCollectorAccountAddress string, nanswapClient *nanswapclient.Client) *PaymentAccountPool
func (*PaymentAccountPool) AwaitConclusionOfInFlightPayments ¶
func (p *PaymentAccountPool) AwaitConclusionOfInFlightPayments(collectorAccount string)
func (*PaymentAccountPool) DefaultCollectorAccountAddress ¶
func (p *PaymentAccountPool) DefaultCollectorAccountAddress() string
func (*PaymentAccountPool) ReceiveMulticurrencyPayment ¶
func (p *PaymentAccountPool) ReceiveMulticurrencyPayment(ctx context.Context, expectedAmounts []Amount, extraCurrencies []nanswapclient.Ticker, swapTimeout time.Duration) (PaymentReceiver, error)
func (*PaymentAccountPool) ReceivePayment ¶
func (p *PaymentAccountPool) ReceivePayment() (PaymentReceiver, error)
func (*PaymentAccountPool) ReceivePaymentIntoCollectorAccount ¶
func (p *PaymentAccountPool) ReceivePaymentIntoCollectorAccount(collectorAccountAddress string) (PaymentReceiver, error)
func (*PaymentAccountPool) RequestAccount ¶
func (p *PaymentAccountPool) RequestAccount() (*wallet.Account, error)
func (*PaymentAccountPool) ReturnAccount ¶
func (p *PaymentAccountPool) ReturnAccount(account *wallet.Account)
func (*PaymentAccountPool) SetMulticurrencyPaymentsEnabled ¶
func (p *PaymentAccountPool) SetMulticurrencyPaymentsEnabled(enabled bool)
type PaymentReceivedEventArgs ¶
type PaymentReceivedEventArgs struct { Amount Amount SenderAmount Amount // the amount as "seen" by the sender in SenderCurrency units, before swap/conversion SenderCurrency nanswapclient.Ticker From string Balance Amount BlockHash string }
PaymentReceivedEventArgs contains the data associated with the event that is fired when a payment is received
type PaymentReceiver ¶
type PaymentReceiver interface { Address() string MulticurrencyPaymentData() []MulticurrencyPaymentData PaymentReceived() event.Event[PaymentReceivedEventArgs] MulticurrencyPaymentDataAvailable() event.Event[[]MulticurrencyPaymentData] // ReceivableBalance may block for a significant amount of time when receiving multicurrency payments // (refactor the Nanswap order fetching code in processPaymentsToAccount to fix this) ReceivableBalance() Amount // Revert should be called when one wants to return anything that was received. // Does not terminate the payment flow (to do so, call Close) Revert(refundAddress string) error // Close must be called to terminate the payment flow, asynchronously sending the funds in the payment account to the collector account for this flow. // It returns a channel that closes when the funds are done being sent to the collector account Close() <-chan struct{} }
PaymentReceiver represents a payment flow (one monitored account)
Click to show internal directories.
Click to hide internal directories.