PaymentsDb

interface PaymentsDb : IncomingPaymentsDb, OutgoingPaymentsDb

Functions

addAndReceivePayment
Link copied to clipboard
common
abstract suspend fun addAndReceivePayment(preimage: ByteVector32, origin: IncomingPayment.Origin, receivedWith: Set<IncomingPayment.ReceivedWith>, createdAt: Long = currentTimestampMillis(), receivedAt: Long = currentTimestampMillis())

Simultaneously add and receive a payment. Use this method when receiving a spontaneous payment, for example a swap-in payment.

addIncomingPayment
Link copied to clipboard
common
abstract suspend fun addIncomingPayment(preimage: ByteVector32, origin: IncomingPayment.Origin, createdAt: Long = currentTimestampMillis())

Add a new expected incoming payment (not yet received).

addOutgoingParts
Link copied to clipboard
common
abstract suspend fun addOutgoingParts(parentId: UUID, parts: List<OutgoingPayment.Part>)

Add new partial payments to a pending outgoing payment.

addOutgoingPayment
Link copied to clipboard
common
abstract suspend fun addOutgoingPayment(outgoingPayment: OutgoingPayment)

Add a new pending outgoing payment (not yet settled).

completeOutgoingPayment
Link copied to clipboard
common
abstract suspend fun completeOutgoingPayment(id: UUID, completed: OutgoingPayment.Status.Completed)

Mark an outgoing payment as completed (failed, succeeded, mined).

open suspend fun completeOutgoingPayment(id: UUID, preimage: ByteVector32, completedAt: Long = currentTimestampMillis())
open suspend fun completeOutgoingPayment(id: UUID, finalFailure: FinalFailure, completedAt: Long = currentTimestampMillis())
getIncomingPayment
Link copied to clipboard
common
abstract suspend fun getIncomingPayment(paymentHash: ByteVector32): IncomingPayment?

Get information about an incoming payment (paid or not) for the given payment hash, if any.

getOutgoingPart
Link copied to clipboard
common
abstract suspend fun getOutgoingPart(partId: UUID): OutgoingPayment?

Get information about an outgoing payment from the id of one of its parts.

getOutgoingPayment
Link copied to clipboard
common
abstract suspend fun getOutgoingPayment(id: UUID): OutgoingPayment?

Get information about an outgoing payment (settled or not).

listExpiredPayments
Link copied to clipboard
common
abstract suspend fun listExpiredPayments(fromCreatedAt: Long = 0, toCreatedAt: Long = currentTimestampMillis()): List<IncomingPayment>

List expired unpaid normal payments created within specified time range (with the most recent payments first).

listIncomingPayments
Link copied to clipboard
common
abstract suspend fun listIncomingPayments(count: Int, skip: Int, filters: Set<PaymentTypeFilter> = setOf()): List<IncomingPayment>

List incoming payments (with the most recent payments first).

listOutgoingPayments
Link copied to clipboard
common
abstract suspend fun listOutgoingPayments(paymentHash: ByteVector32): List<OutgoingPayment>

List all the outgoing payment attempts that tried to pay the given payment hash.

abstract suspend fun listOutgoingPayments(count: Int, skip: Int, filters: Set<PaymentTypeFilter> = setOf()): List<OutgoingPayment>

List outgoing payments (with most recent payments first).

listPayments
Link copied to clipboard
common
abstract suspend fun listPayments(count: Int, skip: Int, filters: Set<PaymentTypeFilter> = setOf()): List<WalletPayment>

List sent and received payments (with most recent payments first).

listReceivedPayments
Link copied to clipboard
common
abstract suspend fun listReceivedPayments(count: Int, skip: Int, filters: Set<PaymentTypeFilter> = setOf()): List<IncomingPayment>

List received payments (with most recent payments first).

receivePayment
Link copied to clipboard
common
abstract suspend fun receivePayment(paymentHash: ByteVector32, receivedWith: Set<IncomingPayment.ReceivedWith>, receivedAt: Long = currentTimestampMillis())

Mark an incoming payment as received (paid). Note that this function assumes that there is a matching payment request in the DB, otherwise it will be a no-op.

removeIncomingPayment
Link copied to clipboard
common
abstract suspend fun removeIncomingPayment(paymentHash: ByteVector32): Boolean

Remove a pending incoming payment.

updateNewChannelReceivedWithChannelId
Link copied to clipboard
common
abstract suspend fun updateNewChannelReceivedWithChannelId(paymentHash: ByteVector32, channelId: ByteVector32)

Update the channel id of the payments parts that have been received with a new channel, for a given payment hash. If there is no payments for this payment hash, or if the payment has not received any payment parts yet, then this method is a no-op.

updateOutgoingPart
Link copied to clipboard
common
abstract suspend fun updateOutgoingPart(partId: UUID, preimage: ByteVector32, completedAt: Long = currentTimestampMillis())

Mark an outgoing payment part as succeeded. This should not update the parent payment, since some parts may still be pending.

abstract suspend fun updateOutgoingPart(partId: UUID, failure: Either<ChannelException, FailureMessage>, completedAt: Long = currentTimestampMillis())

Mark an outgoing payment part as failed.

Inheritors

InMemoryPaymentsDb
Link copied to clipboard