InMemoryPaymentsDb

class InMemoryPaymentsDb : PaymentsDb

Functions

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

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
open suspend override fun addIncomingPayment(preimage: ByteVector32, origin: IncomingPayment.Origin, createdAt: Long)

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

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

Add new partial payments to a pending outgoing payment.

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

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

completeOutgoingPayment
Link copied to clipboard
common
open suspend override 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
open suspend override 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
open suspend override 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
open suspend override fun getOutgoingPayment(id: UUID): OutgoingPayment?

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

listExpiredPayments
Link copied to clipboard
common
open suspend override fun listExpiredPayments(fromCreatedAt: Long, toCreatedAt: Long): List<IncomingPayment>

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

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

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

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

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

open suspend override fun listOutgoingPayments(count: Int, skip: Int, filters: Set<PaymentTypeFilter>): List<OutgoingPayment>

List outgoing payments (with most recent payments first).

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

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

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

List received payments (with most recent payments first).

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

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
open suspend override fun removeIncomingPayment(paymentHash: ByteVector32): Boolean

Remove a pending incoming payment.

updateNewChannelReceivedWithChannelId
Link copied to clipboard
common
open suspend override 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
open suspend override fun updateOutgoingPart(partId: UUID, preimage: ByteVector32, completedAt: Long)

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

open suspend override fun updateOutgoingPart(partId: UUID, failure: Either<ChannelException, FailureMessage>, completedAt: Long)

Mark an outgoing payment part as failed.