Copyright | © 2022 IOHK |
---|---|
License | Apache-2.0 |
Safe Haskell | None |
Language | Haskell2010 |
Data type
TxHistory
for storing a set of transactions.
Transactions are encoded "as" expressed in DB tables.
Synopsis
- data DeltaTxHistory
- type TxHistory = TxHistoryF ' Without
- newtype TxHistoryF f = TxHistoryF ( Map TxId ( TxRelationF f))
-
data
TxRelationF
(f ::
Decoration
) =
TxRelationF
{
- ins :: [DecorateWithTxOut f TxIn ]
- collateralIns :: [DecorateWithTxOut f TxCollateral ]
- outs :: [( TxOut , [ TxOutToken ])]
- collateralOuts :: Maybe ( TxCollateralOut , [ TxCollateralOutToken ])
- withdrawals :: [ TxWithdrawal ]
- tokenCollateralOrd :: TxCollateralOutToken -> ( TokenPolicyId , TokenName )
- tokenOutOrd :: TxOutToken -> ( TokenPolicyId , TokenName )
- mkTxHistory :: [ Tx ] -> TxHistory
- data Decoration
-
data
WithTxOut
txin =
WithTxOut
{
- txIn :: txin
- context :: Maybe ( TxOut , [ TxOutToken ])
- decorateWithTxOuts :: TxHistoryF ' Without -> TxHistoryF ' With
- mkTxIn :: TxId -> ( Int , ( TxIn , Coin )) -> TxIn
- mkTxCollateral :: TxId -> ( Int , ( TxIn , Coin )) -> TxCollateral
- mkTxOut :: TxId -> ( Word32 , TxOut ) -> ( TxOut , [ TxOutToken ])
- undecorateFromTxOuts :: TxHistoryF ' With -> TxHistoryF ' Without
Documentation
data DeltaTxHistory Source #
Verbs to change a
TxHistory
.
Append TxHistory |
Add new set of transactions.
Overwrites transactions whose id is already present in the
|
DeleteTx TxId |
Try to remove the transaction at the given transaction id. |
Instances
type TxHistory = TxHistoryF ' Without Source #
Shortcut type for transaction history where inputs are not
decorated with their corresponding
TxOut
.
newtype TxHistoryF f Source #
Transactions history is
TxRelationF
s indexed by
TxId
TxHistoryF ( Map TxId ( TxRelationF f)) |
Instances
data TxRelationF (f :: Decoration ) Source #
A low level definition of a transaction covering all transaction content by collecting all related-to-index database rows. Normalization is performed anyway after the first relation level. All values used here are records in the database. Foreign keys are used to group data correctly, but they are not removed from the data.
TxRelationF | |
|
Instances
( Eq (DecorateWithTxOut f TxIn ), Eq (DecorateWithTxOut f TxCollateral )) => Eq ( TxRelationF f) Source # | |
Defined in Cardano.Wallet.DB.Store.Transactions.Model (==) :: TxRelationF f -> TxRelationF f -> Bool Source # (/=) :: TxRelationF f -> TxRelationF f -> Bool Source # |
|
( Show (DecorateWithTxOut f TxIn ), Show (DecorateWithTxOut f TxCollateral )) => Show ( TxRelationF f) Source # | |
Defined in Cardano.Wallet.DB.Store.Transactions.Model |
|
Generic ( TxRelationF f) Source # | |
Defined in Cardano.Wallet.DB.Store.Transactions.Model from :: TxRelationF f -> Rep ( TxRelationF f) x Source # to :: Rep ( TxRelationF f) x -> TxRelationF f Source # |
|
type Rep ( TxRelationF f) Source # | |
Defined in Cardano.Wallet.DB.Store.Transactions.Model |
tokenCollateralOrd :: TxCollateralOutToken -> ( TokenPolicyId , TokenName ) Source #
tokenOutOrd :: TxOutToken -> ( TokenPolicyId , TokenName ) Source #
mkTxHistory :: [ Tx ] -> TxHistory Source #
Convert high level transactions definition in low level DB history
data Decoration Source #
A kind to index the 2 flavours of a
TxRelationF
, with or without
TxOuts
A context that carries a TxOut together with its tokens
(this will be needed in the future for the DB Layer
to reconstruct
TransactionInfo
).
decorateWithTxOuts :: TxHistoryF ' Without -> TxHistoryF ' With Source #
mkTxCollateral :: TxId -> ( Int , ( TxIn , Coin )) -> TxCollateral Source #
undecorateFromTxOuts :: TxHistoryF ' With -> TxHistoryF ' Without Source #