class PersistentTransactionManager : OutboundTransactionManager
Facilitates persistent attempts to ensure that an outbound transaction is completed.
db
- the database where the wallet can freely write information related to pending
transactions. This database effectively serves as the mempool for transactions created by this
wallet.
<init> |
Constructor that creates the database and then executes a callback on it. PersistentTransactionManager(appContext: Context, encoder: TransactionEncoder, service: LightWalletService, dataDbName: String = "PendingTransactions.db")
Facilitates persistent attempts to ensure that an outbound transaction is completed. PersistentTransactionManager(db: PendingTransactionDb, encoder: TransactionEncoder, service: LightWalletService) |
abortTransaction |
Remove a transaction and pretend it never existed. suspend fun abortTransaction(existingTransaction: PendingTransaction): Unit |
applyMinedHeight |
Given a transaction and the height at which it was mined, update the transaction to indicate that it was mined. suspend fun applyMinedHeight(pendingTx: PendingTransaction, minedHeight: Int): Unit |
cancel |
Attempt to cancel a transaction. suspend fun cancel(pendingTx: PendingTransaction): Boolean |
encode |
Encode the pending transaction using the given spending key. This is a local operation that produces a raw transaction to submit to lightwalletd. suspend fun encode(spendingKey: String, pendingTx: PendingTransaction): PendingTransaction |
getAll |
Get all pending transactions known to this wallet as a flow that is updated anytime the list changes. fun getAll(): Flow<List<PendingTransactionEntity>> |
initSpend |
Initialize a spend with the main purpose of creating an idea to use for tracking it until completion. suspend fun initSpend(zatoshiValue: Long, toAddress: String, memo: String, fromAccountIndex: Int): PendingTransaction |
isValidShieldedAddress |
Return true when the given address is a valid t-addr. suspend fun isValidShieldedAddress(address: String): Boolean |
isValidTransparentAddress |
Return true when the given address is a valid z-addr. suspend fun isValidTransparentAddress(address: String): Boolean |
monitorById |
Generate a flow of information about the given id where a new pending transaction is emitted every time its state changes. suspend fun monitorById(id: Long): Flow<PendingTransaction> |
submit |
Submits the transaction represented by pendingTx to lightwalletd to broadcast to the network and, hopefully, include in the next block. suspend fun submit(pendingTx: PendingTransaction): PendingTransaction |
ERROR_ENCODING |
Error code for an error while encoding a transaction const val ERROR_ENCODING: Int |
ERROR_SUBMITTING |
Error code for an error while submitting a transaction const val ERROR_SUBMITTING: Int |