Skip to content

Commit

Permalink
Add LocalTxSubmissionStatus type
Browse files Browse the repository at this point in the history
  • Loading branch information
rvl committed Apr 15, 2021
1 parent 1778e70 commit 353159b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
14 changes: 13 additions & 1 deletion lib/core/src/Cardano/Wallet/Primitive/Types/Tx.hs
Expand Up @@ -28,6 +28,7 @@ module Cardano.Wallet.Primitive.Types.Tx
, UnsignedTx (..)
, TransactionInfo (..)
, Direction (..)
, LocalTxSubmissionStatus (..)
, TokenBundleSizeAssessor (..)
, TokenBundleSizeAssessment (..)

Expand Down Expand Up @@ -386,7 +387,7 @@ instance Buildable a => Buildable (WithDirection a) where
-- to the node.
newtype SealedTx = SealedTx { getSealedTx :: ByteString }
deriving stock (Show, Eq, Generic)
deriving newtype (ByteArrayAccess)
deriving newtype (ByteArrayAccess, NFData)

-- | True if the given metadata refers to a pending transaction
isPending :: TxMeta -> Bool
Expand Down Expand Up @@ -438,6 +439,17 @@ toTxHistory :: TransactionInfo -> (Tx, TxMeta)
toTxHistory info =
(fromTransactionInfo info, txInfoMeta info)

-- | Information about when a transaction was submitted to the local node.
-- This is used for scheduling resubmissions.
data LocalTxSubmissionStatus tx = LocalTxSubmissionStatus
{ txId :: !(Hash "Tx")
, submittedTx :: !tx
, firstSubmission :: !SlotNo
-- ^ Time of first successful submission to the local node.
, latestSubmission :: !SlotNo
-- ^ Time of most recent resubmission attempt.
} deriving (Generic, Show, Eq)

-- | A function capable of assessing the size of a token bundle relative to the
-- upper limit of what can be included in a single transaction output.
--
Expand Down
1 change: 0 additions & 1 deletion lib/core/test/unit/Cardano/Wallet/Primitive/ModelSpec.hs
Expand Up @@ -62,7 +62,6 @@ import Cardano.Wallet.Primitive.Types.Tx
, TxIn (..)
, TxMeta (direction)
, TxOut (..)
, txId
, txIns
, txOutCoin
)
Expand Down
1 change: 0 additions & 1 deletion lib/core/test/unit/Cardano/WalletSpec.hs
Expand Up @@ -104,7 +104,6 @@ import Cardano.Wallet.Primitive.Types.Tx
, TxMetadata
, TxOut (..)
, TxStatus (..)
, txId
, txOutCoin
)
import Cardano.Wallet.Primitive.Types.UTxO
Expand Down

0 comments on commit 353159b

Please sign in to comment.