case class SpendingInfoDAO()(implicit ec: ExecutionContext, appConfig: WalletAppConfig) extends CRUDAutoInc[UTXORecord] with Product with Serializable
- Alphabetic
- By Inheritance
- SpendingInfoDAO
- Serializable
- Product
- Equals
- CRUDAutoInc
- TableAutoIncComponent
- CRUD
- CRUDAction
- JdbcProfileComponent
- BitcoinSLogger
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new SpendingInfoDAO()(implicit ec: ExecutionContext, appConfig: WalletAppConfig)
Type Members
- abstract class TableAutoInc extends slick.jdbc.JdbcProfile.JdbcAPI.Table[T]
- Definition Classes
- TableAutoIncComponent
- case class SpendingInfoTable(tag: slick.jdbc.JdbcProfile.JdbcAPI.Tag) extends TableAutoInc with Product with Serializable
This table stores the necessary information to spend a transaction output (TXO) at a later point in time.
This table stores the necessary information to spend a transaction output (TXO) at a later point in time. It also stores how many confirmations it has, whether or not it is spent (i.e. if it is a UTXO or not) and the TXID of the transaction that created this output.
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def _findAllUnspent(): Future[Vector[UTXORecord]]
Enumerates all unspent TX outputs in the wallet with the state TxoState.PendingConfirmationsReceived or TxoState.ConfirmedReceived
- def _findAllUnspentAction(): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[Vector[UTXORecord], slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Read]
Enumerates all unspent TX outputs in the wallet with the state TxoState.PendingConfirmationsReceived or TxoState.ConfirmedReceived
- def _findByStateAction(states: Vector[TxoState]): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[Vector[UTXORecord], slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Read]
- implicit val appConfig: WalletAppConfig
- Definition Classes
- SpendingInfoDAO → CRUDAutoInc → CRUD → CRUDAction → JdbcProfileComponent
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def count(): Future[Int]
Returns number of rows in the table
Returns number of rows in the table
- Definition Classes
- CRUD
- def countAction: slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[Int, slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Read]
- Definition Classes
- CRUDAction
- def create(si: SpendingInfoDb): Future[SpendingInfoDb]
- def create(t: UTXORecord): Future[UTXORecord]
create a record in the database
create a record in the database
- t
\- the record to be inserted
- returns
the inserted record
- Definition Classes
- CRUD
- def createAction(t: UTXORecord): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[UTXORecord, slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Write]
- Definition Classes
- CRUDAction
- def createAll(ts: Vector[UTXORecord]): Future[Vector[UTXORecord]]
- Definition Classes
- CRUDAutoInc → CRUD
- def createAllAction(ts: Vector[UTXORecord]): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[Vector[UTXORecord], slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Write]
- Definition Classes
- CRUDAutoInc → CRUDAction
- def createUnless(si: SpendingInfoDb)(condition: (UTXORecord, UTXORecord) => Boolean): Future[SpendingInfoDb]
- def createUnlessAction(si: SpendingInfoDb)(condition: (UTXORecord, UTXORecord) => Boolean): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[SpendingInfoDb, slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Write with Read]
- lazy val database: JdbcDatabaseDef
The database we are connecting to
The database we are connecting to
- Definition Classes
- JdbcProfileComponent
- lazy val dbConfig: DatabaseConfig[JdbcProfile]
The configuration details for connecting/using the database for our projects that require database connections
The configuration details for connecting/using the database for our projects that require database connections
- Definition Classes
- JdbcProfileComponent
- def delete(si: SpendingInfoDb): Future[Int]
- def delete(t: UTXORecord): Future[Int]
delete the corresponding record in the database
delete the corresponding record in the database
- t
\- the record to be deleted
- returns
int - the number of rows affected by the deletion
- Definition Classes
- CRUD
- def deleteAction(si: SpendingInfoDb): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[Int, slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Write]
- def deleteAction(t: UTXORecord): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[Int, slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Write]
- Definition Classes
- CRUDAction
- def deleteAll(): Future[Int]
delete all records from the table
delete all records from the table
- Definition Classes
- CRUD
- def deleteAll(ts: Vector[UTXORecord]): Future[Int]
- Definition Classes
- CRUD
- def deleteAllAction(): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[Int, slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Write with Transactional]
WARNING: Deletes all rows in table, use with care
WARNING: Deletes all rows in table, use with care
- Definition Classes
- CRUDAction
- def deleteAllAction(ts: Vector[UTXORecord]): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[Int, slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Write]
- Definition Classes
- CRUDAction
- def deleteSpendingInfoDbAllAction(sis: Vector[SpendingInfoDb]): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[Int, slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Write]
- implicit val ec: ExecutionContext
- Definition Classes
- SpendingInfoDAO → CRUD → CRUDAction
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def find(t: UTXORecord): slick.jdbc.JdbcProfile.JdbcAPI.Query[slick.jdbc.JdbcProfile.JdbcAPI.Table[UTXORecord], UTXORecord, Seq]
- Attributes
- protected
- Definition Classes
- CRUDAction
- def findAll(ts: Vector[UTXORecord]): slick.jdbc.JdbcProfile.JdbcAPI.Query[slick.jdbc.JdbcProfile.JdbcAPI.Table[UTXORecord], UTXORecord, Seq]
- Definition Classes
- CRUDAutoInc → CRUDAction
- def findAll(): Future[Vector[UTXORecord]]
Finds all elements in the table
Finds all elements in the table
- Definition Classes
- CRUD
- def findAllAction(): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[Vector[UTXORecord], slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Read]
- Definition Classes
- CRUDAction
- def findAllForAccount(hdAccount: HDAccount): Future[Vector[SpendingInfoDb]]
- def findAllForAccountAction(hdAccount: HDAccount): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[Vector[SpendingInfoDb], slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Read]
- def findAllInMempool: Future[Vector[SpendingInfoDb]]
Enumerates all TX outputs in the wallet with the state TxoState.BroadcastSpent or TxoState.BroadcastReceived
- def findAllOutpoints(): Future[Vector[TransactionOutPoint]]
Enumerates all TX outpoints in the wallet
- def findAllPendingConfirmation: Future[Vector[SpendingInfoDb]]
Enumerates all TX outputs in the wallet with the state TxoState.PendingConfirmationsReceived or TxoState.PendingConfirmationsSpent
- def findAllSpendingInfos(): Future[Vector[SpendingInfoDb]]
- def findAllSpendingInfosAction(): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[Vector[SpendingInfoDb], slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Read]
- def findAllUnspent(): Future[Vector[SpendingInfoDb]]
- def findAllUnspentAction(): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[Vector[SpendingInfoDb], slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Read]
- def findAllUnspentForAccount(hdAccount: HDAccount): Future[Vector[SpendingInfoDb]]
Finds all utxos for a given account
- def findAllUnspentForAccountAction(hdAccount: HDAccount): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[Vector[SpendingInfoDb], slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Read]
- def findAllUnspentForTag(tag: AddressTag): Future[Vector[SpendingInfoDb]]
- def findAllUnspentForTagAction(tag: AddressTag): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[Vector[SpendingInfoDb], slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Read]
- def findByOutPoint(outPoint: TransactionOutPoint): Future[Option[SpendingInfoDb]]
- def findByOutPoints(outPoints: Vector[TransactionOutPoint]): Future[Vector[SpendingInfoDb]]
Enumerates all TX outpoints in the wallet
- def findByPrimaryKey(id: Long): slick.jdbc.JdbcProfile.JdbcAPI.Query[TableAutoInc, UTXORecord, Seq]
return all rows that have a certain primary key
return all rows that have a certain primary key
- id
primary key of the row to return
- returns
Query object corresponding to the selected rows
- Attributes
- protected
- Definition Classes
- CRUDAutoInc → CRUDAction
- def findByPrimaryKeyAction(id: Long): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[Option[UTXORecord], slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Read]
- Definition Classes
- CRUDAction
- def findByPrimaryKeys(ids: Vector[Long]): slick.jdbc.JdbcProfile.JdbcAPI.Query[TableAutoInc, UTXORecord, Seq]
Finds the rows that correlate to the given primary keys
Finds the rows that correlate to the given primary keys
- Definition Classes
- CRUDAutoInc → CRUDAction
- def findByPrimaryKeysAction(ids: Vector[Long]): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[Vector[UTXORecord], slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Read]
- Definition Classes
- CRUDAction
- def findByScriptPubKey(scriptPubKey: ScriptPubKey): Future[Vector[SpendingInfoDb]]
- def findByScriptPubKeyId(scriptPubKeyId: Long): Future[Vector[UTXORecord]]
- def findByTxoState(state: TxoState): Future[Vector[SpendingInfoDb]]
- def findDbsForTx(txid: DoubleSha256DigestBE): Future[Vector[UTXORecord]]
Fetches all the incoming TXOs in our DB that are in the transaction with the given TXID
- def findOutputsBeingSpent(txs: Vector[Transaction]): Future[Vector[SpendingInfoDb]]
- def findOutputsBeingSpent(tx: Transaction): Future[Vector[SpendingInfoDb]]
Finds all the outputs being spent in the given transaction
- def findOutputsBeingSpentAction(txs: Vector[Transaction]): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[Vector[SpendingInfoDb], slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Read]
- def findOutputsReceived(txids: Vector[DoubleSha256DigestBE]): Future[Vector[SpendingInfoDb]]
Fetches all the incoming TXOs in our DB that are in the transaction with the given TXID
- def findOutputsReceivedAction(txids: Vector[DoubleSha256DigestBE]): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[Vector[SpendingInfoDb], slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Read]
Fetches all the incoming TXOs in our DB that are in the transaction with the given TXID
- def findTx(tx: Transaction): Future[Vector[SpendingInfoDb]]
Fetches all the received TXOs in our DB that are in the given TX
- def findTxAction(tx: Transaction): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[Vector[SpendingInfoDb], slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Read]
- def findTxs(txs: Vector[Transaction]): Future[Vector[SpendingInfoDb]]
Fetches all received txos in our db that are in the given txs
- def findTxsAction(txs: Vector[Transaction]): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[Vector[SpendingInfoDb], slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Read]
Fetches all received txos in our db that are in the given txs
- def getBalanceAction(accountOpt: Option[HDAccount] = None): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[CurrencyUnit, slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Read]
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def getConfirmedBalanceAction(accountOpt: Option[HDAccount] = None): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[CurrencyUnit, slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Read]
- def getUnconfirmedBalanceAction(accountOpt: Option[HDAccount] = None): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[CurrencyUnit, slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Read]
- def hasDuplicates(): Future[Boolean]
- def infoToUtxo(infos: Vector[SpendingInfoDb]): Future[Vector[UTXORecord]]
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def logger: Logger
- Definition Classes
- BitcoinSLogger
- def markAsReserved(ts: Vector[SpendingInfoDb]): Future[Vector[SpendingInfoDb]]
- def markAsReservedAction(ts: Vector[SpendingInfoDb]): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[Vector[SpendingInfoDb], slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Read with Write]
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- lazy val numThreads: Int
- Definition Classes
- JdbcProfileComponent
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- lazy val profile: JdbcProfile
- Definition Classes
- JdbcProfileComponent
- def read(id: Long): Future[Option[UTXORecord]]
read a record from the database
read a record from the database
- id
\- the id of the record to be read
- returns
Option[T] - the record if found, else none
- Definition Classes
- CRUD
- def safeDatabase: SafeDatabase
Binding to the actual database itself, this is what is used to run querys
Binding to the actual database itself, this is what is used to run querys
- Definition Classes
- CRUD
- val schemaName: Option[String]
- Definition Classes
- CRUD
- def startHikariLogger(interval: Duration): HikariLogging
Starts the background logger for hikari
Starts the background logger for hikari
- interval
\- how often hikari logs database connection pool information
- Attributes
- protected
- Definition Classes
- JdbcProfileComponent
- def stopHikariLogger(): Unit
- Attributes
- protected
- Definition Classes
- JdbcProfileComponent
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- val table: slick.jdbc.JdbcProfile.JdbcAPI.TableQuery[SpendingInfoTable]
The table inside our database we are inserting into
The table inside our database we are inserting into
- Definition Classes
- SpendingInfoDAO → CRUDAutoInc → CRUDAction
- implicit def tableQuerySafeSubtypeCast[SpecificT <: AbstractTable[_], SomeT <: SpecificT](tableQuery: slick.jdbc.JdbcProfile.JdbcAPI.TableQuery[SomeT]): slick.jdbc.JdbcProfile.JdbcAPI.TableQuery[SpecificT]
We need to cast from TableQuery's of internal types (e.g.
We need to cast from TableQuery's of internal types (e.g. AddressDAO#AddressTable) to external versions of them (e.g. AddressDAO().table). You'll notice that although the latter is a subtype of the first, this requires a cast since TableQuery is not covariant in its type parameter.
However, since Query is covariant in its first type parameter, I believe the cast from TableQuery[T1] to TableQuery[T2] will always be safe so long as T1 is a subtype of T2 AND T1#TableElementType is equal to T2#TableElementType.
The above conditions are always the case when this is called within DAOs as it is only ever used for things of the form TableQuery[XDAO().table] -> TableQuery[XDAO#XTable].
- Attributes
- protected
- Definition Classes
- CRUD
- def update(si: SpendingInfoDb): Future[SpendingInfoDb]
- def update(t: UTXORecord): Future[UTXORecord]
Update the corresponding record in the database
Update the corresponding record in the database
- Definition Classes
- CRUD
- def updateAction(si: SpendingInfoDb): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[SpendingInfoDb, slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Read with Write]
- def updateAction(t: UTXORecord): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[UTXORecord, slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Write]
- Definition Classes
- CRUDAction
- def updateAll(ts: Vector[UTXORecord]): Future[Vector[UTXORecord]]
- Definition Classes
- CRUD
- def updateAllAction(ts: Vector[UTXORecord]): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[Vector[UTXORecord], slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Write]
Updates all of the given ts.
Updates all of the given ts. Returns all ts that actually existed in the database and got updated This method discards things that did not exist in the database, thus could not be updated
- Definition Classes
- CRUDAction
- def updateAllSpendingInfoDb(ts: Vector[SpendingInfoDb]): Future[Vector[SpendingInfoDb]]
- def updateAllSpendingInfoDbAction(ts: Vector[SpendingInfoDb]): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[Vector[SpendingInfoDb], slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Read with Write]
- def upsert(si: SpendingInfoDb): Future[SpendingInfoDb]
- def upsert(t: UTXORecord): Future[UTXORecord]
insert the record if it does not exist, update it if it does
insert the record if it does not exist, update it if it does
- t
\- the record to inserted / updated
- returns
t - the record that has been inserted / updated
- Definition Classes
- CRUD
- def upsertAction(si: SpendingInfoDb): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[SpendingInfoDb, slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Read with Write]
- def upsertAction(t: UTXORecord): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[UTXORecord, slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Write with Read]
- Definition Classes
- CRUDAction
- def upsertAll(ts: Vector[UTXORecord]): Future[Vector[UTXORecord]]
Upserts all of the given ts in the database, then returns the upserted values
Upserts all of the given ts in the database, then returns the upserted values
- Definition Classes
- CRUD
- def upsertAllAction(ts: Vector[UTXORecord]): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[Vector[UTXORecord], slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Write with Read]
Upsert all of the given ts.
Upsert all of the given ts. Returns all ts that were inserted or updated
- Definition Classes
- CRUDAction
- See also
https://scala-slick.org/doc/3.3.3/queries.html#upserting
- def upsertAllSpendingInfoDb(ts: Vector[SpendingInfoDb]): Future[Vector[SpendingInfoDb]]
- def upsertAllSpendingInfoDbAction(ts: Vector[SpendingInfoDb]): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[Vector[SpendingInfoDb], slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Read with Write]
- def utxoToInfo(utxos: Vector[UTXORecord]): Future[Vector[SpendingInfoDb]]
- def utxoToInfoAction(utxos: Vector[UTXORecord]): slick.jdbc.JdbcProfile.JdbcAPI.DBIOAction[Vector[SpendingInfoDb], slick.jdbc.JdbcProfile.JdbcAPI.NoStream, Read]
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- def withAddress(txid: DoubleSha256DigestBE): Future[Vector[(SpendingInfoDb, AddressDb)]]
Given a TXID, fetches all incoming TXOs and the address the TXO pays to