cardano-wallet-core-2022.7.1: The Wallet Backend for a Cardano node.
Copyright © 2018-2020 IOHK
License Apache-2.0
Safe Haskell None
Language Haskell2010

Cardano.Wallet.Primitive.Types.Tx

Description

This module provides the main transaction data types used by the wallet.

Synopsis

Types

data Tx Source #

Primitive Tx -type.

Currently tailored for jormungandr in that inputs are (TxIn, Coin) instead of TxIn . We might have to revisit this when supporting another node.

Constructors

Tx

Fields

  • txId :: Hash "Tx"

    Jörmungandr computes transaction id by hashing the full content of the transaction, which includes witnesses. Therefore, we need either to keep track of the witnesses to be able to re-compute the tx id every time, or, simply keep track of the id itself.

  • fee :: !( Maybe Coin )

    Explicit fee for that transaction, if available. Fee are available explicitly in Shelley, but not in Byron although in Byron they can easily be re-computed from the delta between outputs and inputs.

  • resolvedInputs :: ![( TxIn , Coin )]

    NOTE: Order of inputs matters in the transaction representation. The transaction id is computed from the binary representation of a tx, for which inputs are serialized in a specific order.

  • resolvedCollateralInputs :: ![( TxIn , Coin )]

    NOTE: The order of collateral inputs matters in the transaction representation. The transaction id is computed from the binary representation of a tx, for which collateral inputs are serialized in a specific order.

  • outputs :: ![ TxOut ]

    NOTE: Order of outputs matters in the transaction representations. Outputs are used as inputs for next transactions which refer to them using their indexes. It matters also for serialization.

  • collateralOutput :: !( Maybe TxOut )

    An output that is only created if a transaction script fails.

  • withdrawals :: !( Map RewardAccount Coin )

    Withdrawals (of funds from a registered reward account) embedded in a transaction. The order does not matter.

  • metadata :: !( Maybe TxMetadata )

    Semi-structured application-specific extension data stored in the transaction on chain.

    This is not to be confused with TxMeta , which is information about a transaction derived from the ledger.

    See Appendix E of Shelley Ledger: Delegation/Incentives Design Spec .

  • scriptValidity :: !( Maybe TxScriptValidity )

    Tag indicating whether non-native scripts in this transaction passed validation. This is added by the block creator when constructing the block. May be Nothing for pre-Alonzo and pending transactions.

Instances

Instances details
Eq Tx Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Ord Tx Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Show Tx Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Generic Tx Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Associated Types

type Rep Tx :: Type -> Type Source #

NFData Tx Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Methods

rnf :: Tx -> () Source #

Buildable Tx Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

type Rep Tx Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

data TxIn Source #

Constructors

TxIn

Instances

Instances details
Eq TxIn Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Ord TxIn Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Read TxIn Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Show TxIn Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Generic TxIn Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Associated Types

type Rep TxIn :: Type -> Type Source #

NFData TxIn Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Buildable TxIn Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

ToJSON ( ApiT TxIn ) Source #
Instance details

Defined in Cardano.Wallet.Api.Types

FromJSON ( ApiT TxIn ) Source #
Instance details

Defined in Cardano.Wallet.Api.Types

Buildable ( TxIn , TxOut ) Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

type Rep TxIn Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

type Rep TxIn = D1 (' MetaData "TxIn" "Cardano.Wallet.Primitive.Types.Tx" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' False ) ( C1 (' MetaCons "TxIn" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "inputId") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Hash "Tx")) :*: S1 (' MetaSel (' Just "inputIx") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 Word32 )))

data TxOut Source #

Instances

Instances details
Eq TxOut Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Ord TxOut Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Read TxOut Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Show TxOut Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Generic TxOut Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

NFData TxOut Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Buildable TxOut Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Buildable ( SelectionOf TxOut ) Source #
Instance details

Defined in Cardano.Wallet.CoinSelection

Buildable ( TxIn , TxOut ) Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

type Rep TxOut Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

type Rep TxOut = D1 (' MetaData "TxOut" "Cardano.Wallet.Primitive.Types.Tx" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' False ) ( C1 (' MetaCons "TxOut" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "address") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 Address ) :*: S1 (' MetaSel (' Just "tokens") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 TokenBundle )))

data TxChange derivationPath Source #

Instances

Instances details
Eq derivationPath => Eq ( TxChange derivationPath) Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Methods

(==) :: TxChange derivationPath -> TxChange derivationPath -> Bool Source #

(/=) :: TxChange derivationPath -> TxChange derivationPath -> Bool Source #

( TypeError (' Text "Ord not supported for token maps") :: Constraint , Ord derivationPath) => Ord ( TxChange derivationPath) Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Methods

compare :: TxChange derivationPath -> TxChange derivationPath -> Ordering Source #

(<) :: TxChange derivationPath -> TxChange derivationPath -> Bool Source #

(<=) :: TxChange derivationPath -> TxChange derivationPath -> Bool Source #

(>) :: TxChange derivationPath -> TxChange derivationPath -> Bool Source #

(>=) :: TxChange derivationPath -> TxChange derivationPath -> Bool Source #

max :: TxChange derivationPath -> TxChange derivationPath -> TxChange derivationPath Source #

min :: TxChange derivationPath -> TxChange derivationPath -> TxChange derivationPath Source #

Show derivationPath => Show ( TxChange derivationPath) Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Generic ( TxChange derivationPath) Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Associated Types

type Rep ( TxChange derivationPath) :: Type -> Type Source #

Methods

from :: TxChange derivationPath -> Rep ( TxChange derivationPath) x Source #

to :: Rep ( TxChange derivationPath) x -> TxChange derivationPath Source #

type Rep ( TxChange derivationPath) Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

data TxMeta Source #

Additional information about a transaction, derived from the transaction and ledger state. This should not be confused with TxMetadata which is application-specific data included with the transaction.

TODO: TxProperties or TxProps would be a good name for this type.

Constructors

TxMeta

Fields

Instances

Instances details
Eq TxMeta Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Ord TxMeta Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Show TxMeta Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Generic TxMeta Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

NFData TxMeta Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Buildable TxMeta Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

type Rep TxMeta Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

newtype TxMetadata Source #

Instances

Instances details
Eq TxMetadata
Instance details

Defined in Cardano.Api.TxMetadata

Ord TxMetadata Source #
Instance details

Defined in Cardano.Wallet.Orphans

Show TxMetadata
Instance details

Defined in Cardano.Api.TxMetadata

Semigroup TxMetadata

Merge metadata maps. When there are clashing entries the left hand side takes precedence.

Instance details

Defined in Cardano.Api.TxMetadata

Monoid TxMetadata
Instance details

Defined in Cardano.Api.TxMetadata

NFData TxMetadata Source #
Instance details

Defined in Cardano.Wallet.Orphans

SerialiseAsCBOR TxMetadata
Instance details

Defined in Cardano.Api.TxMetadata

HasTypeProxy TxMetadata
Instance details

Defined in Cardano.Api.TxMetadata

Buildable TxMetadata Source #
Instance details

Defined in Cardano.Wallet.Orphans

PersistFieldSql TxMetadata Source #
Instance details

Defined in Cardano.Wallet.DB.Sqlite.Types

PersistField TxMetadata Source #
Instance details

Defined in Cardano.Wallet.DB.Sqlite.Types

SymbolToField "txMetadata" TxMeta ( Maybe TxMetadata ) Source #
Instance details

Defined in Cardano.Wallet.DB.Sqlite.Schema

ToJSON ( ApiT TxMetadata ) Source #
Instance details

Defined in Cardano.Wallet.Api.Types

FromJSON ( ApiT TxMetadata ) Source #
Instance details

Defined in Cardano.Wallet.Api.Types

data AsType TxMetadata
Instance details

Defined in Cardano.Api.TxMetadata

data TxStatus Source #

Constructors

Pending

Created, but not yet in a block.

InLedger

Has been found in a block.

Expired

Time to live (TTL) has passed.

Instances

Instances details
Bounded TxStatus Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Enum TxStatus Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Eq TxStatus Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Ord TxStatus Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Show TxStatus Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Generic TxStatus Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

NFData TxStatus Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Buildable TxStatus Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

PersistFieldSql TxStatus Source #
Instance details

Defined in Cardano.Wallet.DB.Sqlite.Types

PersistField TxStatus Source #
Instance details

Defined in Cardano.Wallet.DB.Sqlite.Types

ToText TxStatus Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

FromText TxStatus Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

SymbolToField "txMetaStatus" TxMeta TxStatus Source #
Instance details

Defined in Cardano.Wallet.DB.Sqlite.Schema

ToJSON ( ApiT TxStatus ) Source #
Instance details

Defined in Cardano.Wallet.Api.Types

FromJSON ( ApiT TxStatus ) Source #
Instance details

Defined in Cardano.Wallet.Api.Types

type Rep TxStatus Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

type Rep TxStatus = D1 (' MetaData "TxStatus" "Cardano.Wallet.Primitive.Types.Tx" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' False ) ( C1 (' MetaCons "Pending" ' PrefixI ' False ) ( U1 :: Type -> Type ) :+: ( C1 (' MetaCons "InLedger" ' PrefixI ' False ) ( U1 :: Type -> Type ) :+: C1 (' MetaCons "Expired" ' PrefixI ' False ) ( U1 :: Type -> Type )))

data UnsignedTx input output change withdrawal Source #

An unsigned transaction.

See Tx for a signed transaction.

Constructors

UnsignedTx

Fields

  • unsignedCollateral :: [input]
  • unsignedInputs :: [input]

    Inputs are *necessarily* non-empty because Cardano requires at least one UTxO input per transaction to prevent replayable transactions. (each UTxO being unique, including at least one UTxO in the transaction body makes it seemingly unique).

    • However* when used to represent the inputs known by the wallet, in contrast to all inputs, it can be empty.
  • unsignedOutputs :: [output]
  • unsignedChange :: [change]
  • unsignedWithdrawals :: [withdrawal]

Instances

Instances details
( Eq input, Eq output, Eq change, Eq withdrawal) => Eq ( UnsignedTx input output change withdrawal) Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Methods

(==) :: UnsignedTx input output change withdrawal -> UnsignedTx input output change withdrawal -> Bool Source #

(/=) :: UnsignedTx input output change withdrawal -> UnsignedTx input output change withdrawal -> Bool Source #

( Show input, Show output, Show change, Show withdrawal) => Show ( UnsignedTx input output change withdrawal) Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Methods

showsPrec :: Int -> UnsignedTx input output change withdrawal -> ShowS Source #

show :: UnsignedTx input output change withdrawal -> String Source #

showList :: [ UnsignedTx input output change withdrawal] -> ShowS Source #

Generic ( UnsignedTx input output change withdrawal) Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Associated Types

type Rep ( UnsignedTx input output change withdrawal) :: Type -> Type Source #

Methods

from :: UnsignedTx input output change withdrawal -> Rep ( UnsignedTx input output change withdrawal) x Source #

to :: Rep ( UnsignedTx input output change withdrawal) x -> UnsignedTx input output change withdrawal Source #

type Rep ( UnsignedTx input output change withdrawal) Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

type Rep ( UnsignedTx input output change withdrawal) = D1 (' MetaData "UnsignedTx" "Cardano.Wallet.Primitive.Types.Tx" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' False ) ( C1 (' MetaCons "UnsignedTx" ' PrefixI ' True ) (( S1 (' MetaSel (' Just "unsignedCollateral") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 [input]) :*: S1 (' MetaSel (' Just "unsignedInputs") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 [input])) :*: ( S1 (' MetaSel (' Just "unsignedOutputs") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 [output]) :*: ( S1 (' MetaSel (' Just "unsignedChange") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 [change]) :*: S1 (' MetaSel (' Just "unsignedWithdrawals") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 [withdrawal])))))

data TransactionInfo Source #

Full expanded and resolved information about a transaction, suitable for presentation to the user.

Constructors

TransactionInfo

Fields

Instances

Instances details
Eq TransactionInfo Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Show TransactionInfo Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Generic TransactionInfo Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

NFData TransactionInfo Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

type Rep TransactionInfo Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

type Rep TransactionInfo = D1 (' MetaData "TransactionInfo" "Cardano.Wallet.Primitive.Types.Tx" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' False ) ( C1 (' MetaCons "TransactionInfo" ' PrefixI ' True ) ((( S1 (' MetaSel (' Just "txInfoId") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Hash "Tx")) :*: ( S1 (' MetaSel (' Just "txInfoFee") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Maybe Coin )) :*: S1 (' MetaSel (' Just "txInfoInputs") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 [( TxIn , Coin , Maybe TxOut )]))) :*: ( S1 (' MetaSel (' Just "txInfoCollateralInputs") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 [( TxIn , Coin , Maybe TxOut )]) :*: ( S1 (' MetaSel (' Just "txInfoOutputs") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 [ TxOut ]) :*: S1 (' MetaSel (' Just "txInfoCollateralOutput") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Maybe TxOut ))))) :*: (( S1 (' MetaSel (' Just "txInfoWithdrawals") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Map RewardAccount Coin )) :*: ( S1 (' MetaSel (' Just "txInfoMeta") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 TxMeta ) :*: S1 (' MetaSel (' Just "txInfoDepth") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ( Quantity "block" Natural )))) :*: ( S1 (' MetaSel (' Just "txInfoTime") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 UTCTime ) :*: ( S1 (' MetaSel (' Just "txInfoMetadata") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Maybe TxMetadata )) :*: S1 (' MetaSel (' Just "txInfoScriptValidity") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Maybe TxScriptValidity )))))))

data Direction Source #

The effect of a Transaction on the wallet balance.

Constructors

Outgoing

The wallet balance decreases.

Incoming

The wallet balance increases or stays the same.

Instances

Instances details
Bounded Direction Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Enum Direction Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Eq Direction Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Ord Direction Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Show Direction Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Generic Direction Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

NFData Direction Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Buildable Direction Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

PersistFieldSql Direction Source #
Instance details

Defined in Cardano.Wallet.DB.Sqlite.Types

PersistField Direction Source #
Instance details

Defined in Cardano.Wallet.DB.Sqlite.Types

ToText Direction Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

FromText Direction Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

SymbolToField "txMetaDirection" TxMeta Direction Source #
Instance details

Defined in Cardano.Wallet.DB.Sqlite.Schema

ToJSON ( ApiT Direction ) Source #
Instance details

Defined in Cardano.Wallet.Api.Types

FromJSON ( ApiT Direction ) Source #
Instance details

Defined in Cardano.Wallet.Api.Types

type Rep Direction Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

type Rep Direction = D1 (' MetaData "Direction" "Cardano.Wallet.Primitive.Types.Tx" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' False ) ( C1 (' MetaCons "Outgoing" ' PrefixI ' False ) ( U1 :: Type -> Type ) :+: C1 (' MetaCons "Incoming" ' PrefixI ' False ) ( U1 :: Type -> Type ))

data LocalTxSubmissionStatus tx Source #

Information about when a transaction was submitted to the local node. This is used for scheduling resubmissions.

Constructors

LocalTxSubmissionStatus

Fields

Instances

Instances details
Functor LocalTxSubmissionStatus Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Eq tx => Eq ( LocalTxSubmissionStatus tx) Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Show tx => Show ( LocalTxSubmissionStatus tx) Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Generic ( LocalTxSubmissionStatus tx) Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

type Rep ( LocalTxSubmissionStatus tx) Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

type Rep ( LocalTxSubmissionStatus tx) = D1 (' MetaData "LocalTxSubmissionStatus" "Cardano.Wallet.Primitive.Types.Tx" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' False ) ( C1 (' MetaCons "LocalTxSubmissionStatus" ' PrefixI ' True ) (( S1 (' MetaSel (' Just "txId") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Hash "Tx")) :*: S1 (' MetaSel (' Just "submittedTx") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 tx)) :*: ( S1 (' MetaSel (' Just "firstSubmission") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 SlotNo ) :*: S1 (' MetaSel (' Just "latestSubmission") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 SlotNo ))))

newtype TokenBundleSizeAssessor Source #

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.

In general, a token bundle size assessment function f should satisfy the following properties:

  • Enlarging a bundle that exceeds the limit should also result in a bundle that exceeds the limit: f b1 == TokenBundleSizeExceedsLimit ==> f (b1 add b2) == TokenBundleSizeExceedsLimit
  • Shrinking a bundle that's within the limit should also result in a bundle that's within the limit: f b1 == TokenBundleWithinLimit ==> f (b1 difference b2) == TokenBundleWithinLimit

data TokenBundleSizeAssessment Source #

Indicates the size of a token bundle relative to the upper limit of what can be included in a single transaction output, defined by the protocol.

Constructors

TokenBundleSizeWithinLimit

Indicates that the size of a token bundle does not exceed the maximum size that can be included in a transaction output.

TokenBundleSizeExceedsLimit

Indicates that the size of a token bundle exceeds the maximum size that can be included in a transaction output.

data TxScriptValidity Source #

Indicates whether or not a transaction is marked as having an invalid script.

Pre-Alonzo era, scripts were not supported.

Constructors

TxScriptValid

The transaction is not marked as having an invalid script.

TxScriptInvalid

The transaction is marked as having an invalid script.

Instances

Instances details
Eq TxScriptValidity Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Ord TxScriptValidity Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Show TxScriptValidity Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Generic TxScriptValidity Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

NFData TxScriptValidity Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Buildable TxScriptValidity Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

PersistFieldSql TxScriptValidity Source #
Instance details

Defined in Cardano.Wallet.DB.Sqlite.Types

PersistField TxScriptValidity Source #
Instance details

Defined in Cardano.Wallet.DB.Sqlite.Types

ToJSON ( ApiT TxScriptValidity ) Source #
Instance details

Defined in Cardano.Wallet.Api.Types

FromJSON ( ApiT TxScriptValidity ) Source #
Instance details

Defined in Cardano.Wallet.Api.Types

type Rep TxScriptValidity Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

type Rep TxScriptValidity = D1 (' MetaData "TxScriptValidity" "Cardano.Wallet.Primitive.Types.Tx" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' False ) ( C1 (' MetaCons "TxScriptValid" ' PrefixI ' False ) ( U1 :: Type -> Type ) :+: C1 (' MetaCons "TxScriptInvalid" ' PrefixI ' False ) ( U1 :: Type -> Type ))

data ScriptWitnessIndex Source #

Identify the location of a ScriptWitness within the context of a TxBody . These are indexes of the objects within the transaction that need or can use script witnesses: inputs, minted assets, withdrawals and certificates. These are simple numeric indices, enumerated from zero. Thus the indices are not stable if the transaction body is modified.

Constructors

ScriptWitnessIndexTxIn ! Word

The n'th transaction input, in the order of the TxId s.

ScriptWitnessIndexMint ! Word

The n'th minting PolicyId , in the order of the PolicyId s.

ScriptWitnessIndexCertificate ! Word

The n'th certificate, in the list order of the certificates.

ScriptWitnessIndexWithdrawal ! Word

The n'th withdrawal, in the order of the StakeAddress s.

Serialisation

data SealedTx Source #

SealedTx is a transaction for any hard fork era, possibly incomplete, possibly unsigned, with dual representations to make it convenient to use.

Serialisation/deserialisation is usually done at the application boundaries (e.g. in the API server), and then the wallet core can use it either as a ByteString , or as a Tx .

Construct it with either sealedTxFromCardano or sealedTxFromBytes .

Instances

Instances details
Eq SealedTx Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Show SealedTx Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Generic SealedTx Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

NFData SealedTx Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Buildable SealedTx Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

PersistFieldSql SealedTx Source #
Instance details

Defined in Cardano.Wallet.DB.Sqlite.Types

PersistField SealedTx Source #
Instance details

Defined in Cardano.Wallet.DB.Sqlite.Types

SymbolToField "localTxSubmissionTx" LocalTxSubmission SealedTx Source #
Instance details

Defined in Cardano.Wallet.DB.Sqlite.Schema

ToJSON ( ApiT SealedTx ) Source #
Instance details

Defined in Cardano.Wallet.Api.Types

FromJSON ( ApiT SealedTx ) Source #
Instance details

Defined in Cardano.Wallet.Api.Types

MimeRender OctetStream ( ApiT SealedTx ) Source #
Instance details

Defined in Cardano.Wallet.Api.Types

MimeUnrender OctetStream ( ApiT SealedTx ) Source #
Instance details

Defined in Cardano.Wallet.Api.Types

type Rep SealedTx Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

sealedTxFromBytes' Source #

Arguments

:: AnyCardanoEra

Most recent era

-> ByteString

Serialised transaction

-> Either DecoderError SealedTx

Deserialise a transaction to construct a SealedTx .

getSerialisedTxParts :: SealedTx -> SerialisedTxParts Source #

Get the serialised transaction body and witnesses from a SealedTx .

newtype SerialisedTx Source #

A serialised transaction that may be only partially signed, or even invalid.

Instances

Instances details
Eq SerialisedTx Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Ord SerialisedTx Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Show SerialisedTx Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Generic SerialisedTx Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Semigroup SerialisedTx Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Monoid SerialisedTx Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

NFData SerialisedTx Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

ByteArray SerialisedTx Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

ByteArrayAccess SerialisedTx Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

MimeRender OctetStream ( ApiBytesT base SerialisedTx ) Source #
Instance details

Defined in Cardano.Wallet.Api.Types

MimeUnrender OctetStream ( ApiBytesT base SerialisedTx ) Source #
Instance details

Defined in Cardano.Wallet.Api.Types

type Rep SerialisedTx Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

type Rep SerialisedTx = D1 (' MetaData "SerialisedTx" "Cardano.Wallet.Primitive.Types.Tx" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' True ) ( C1 (' MetaCons "SerialisedTx" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "payload") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ByteString )))

data SerialisedTxParts Source #

SerialisedTxParts is a serialised transaction body, and a possibly incomplete set of serialised witnesses.

persistSealedTx :: SealedTx -> ByteString Source #

Serialise a SealedTx for storage in a database field. The difference between persistSealedTx and $sel:serialisedTx:SealedTx is that this function has a special check for values created by mockSealedTx .

unPersistSealedTx :: ByteString -> Either Text SealedTx Source #

Deserialise a SealedTx which has been stored in a database field. This function includes a special check for mockSealedTx values.

Unit testing helpers

mockSealedTx :: HasCallStack => ByteString -> SealedTx Source #

Construct a SealedTx from a string which need not be a well-formed serialised Cardano transaction.

Be careful using the SealedTx , because any attempt to evaluate its cardanoTx field will crash.

withinEra :: AnyCardanoEra -> AnyCardanoEra -> Bool Source #

a withinEra b is True iff b is the same era as a , or an earlier one.

Functions

fromTransactionInfo :: TransactionInfo -> Tx Source #

Reconstruct a transaction info from a transaction.

isPending :: TxMeta -> Bool Source #

True if the given metadata refers to a pending transaction

toTxHistory :: TransactionInfo -> ( Tx , TxMeta ) Source #

Drop time-specific information

txMetadataIsNull :: TxMetadata -> Bool Source #

Test whether the given metadata map is empty.

txOutAddCoin :: Coin -> TxOut -> TxOut Source #

Increments the Coin value of a TxOut .

Satisfies the following property for all values of c :

>>> txOutSubtractCoin c . txOutAddCoin c == id

txOutSubtractCoin :: Coin -> TxOut -> TxOut Source #

Decrements the Coin value of a TxOut .

Satisfies the following property for all values of c :

>>> txOutSubtractCoin c . txOutAddCoin c == id

If the given Coin is greater than the Coin value of the given TxOut , the resulting TxOut will have a Coin value of zero.

txScriptInvalid :: Tx -> Bool Source #

Returns True if (and only if) the given transaction is marked as having an invalid script.

This function does not actually verify the validity of scripts; it merely checks for the presence or absence of the TxScriptInvalid marker.

Constants

txOutMinCoin :: Coin Source #

The smallest quantity of lovelace that can appear in a transaction output's token bundle.

txOutMaxCoin :: Coin Source #

The greatest quantity of lovelace that can appear in a transaction output's token bundle.

txOutMinTokenQuantity :: TokenQuantity Source #

The smallest token quantity that can appear in a transaction output's token bundle.

txOutMaxTokenQuantity :: TokenQuantity Source #

The greatest token quantity that can appear in a transaction output's token bundle.

Although the ledger specification allows token quantities of unlimited sizes, in practice we'll only see transaction outputs where the token quantities are bounded by the size of a Word64 .

txMintBurnMaxTokenQuantity :: TokenQuantity Source #

The greatest quantity of any given token that can be minted or burned in a transaction.

Constraints

data TxConstraints Source #

Provides an abstract cost and size model for transactions.

This allows parts of a transaction to be costed (or sized) individually, without having to compute the cost (or size) of an entire transaction.

Note that the following functions assume one witness is required per input:

This will lead to slight overestimation in the case of UTxOs that share the same payment key.

Constructors

TxConstraints

Fields

Instances

Instances details
Generic TxConstraints Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

type Rep TxConstraints Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

type Rep TxConstraints = D1 (' MetaData "TxConstraints" "Cardano.Wallet.Primitive.Types.Tx" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' False ) ( C1 (' MetaCons "TxConstraints" ' PrefixI ' True ) ((( S1 (' MetaSel (' Just "txBaseCost") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Coin ) :*: ( S1 (' MetaSel (' Just "txBaseSize") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 TxSize ) :*: S1 (' MetaSel (' Just "txInputCost") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Coin ))) :*: ( S1 (' MetaSel (' Just "txInputSize") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 TxSize ) :*: ( S1 (' MetaSel (' Just "txOutputCost") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ( TokenBundle -> Coin )) :*: S1 (' MetaSel (' Just "txOutputSize") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ( TokenBundle -> TxSize ))))) :*: (( S1 (' MetaSel (' Just "txOutputMaximumSize") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 TxSize ) :*: ( S1 (' MetaSel (' Just "txOutputMaximumTokenQuantity") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 TokenQuantity ) :*: S1 (' MetaSel (' Just "txOutputMinimumAdaQuantity") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ( Address -> TokenMap -> Coin )))) :*: (( S1 (' MetaSel (' Just "txOutputBelowMinimumAdaQuantity") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ( Address -> TokenBundle -> Bool )) :*: S1 (' MetaSel (' Just "txRewardWithdrawalCost") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ( Coin -> Coin ))) :*: ( S1 (' MetaSel (' Just "txRewardWithdrawalSize") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ( Coin -> TxSize )) :*: S1 (' MetaSel (' Just "txMaximumSize") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 TxSize ))))))

newtype TxSize Source #

The size of a transaction, or part of a transaction, in bytes.

Constructors

TxSize

Instances

Instances details
Eq TxSize Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Ord TxSize Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Show TxSize Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Generic TxSize Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Semigroup TxSize Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

Monoid TxSize Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

NFData TxSize Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

type Rep TxSize Source #
Instance details

Defined in Cardano.Wallet.Primitive.Types.Tx

type Rep TxSize = D1 (' MetaData "TxSize" "Cardano.Wallet.Primitive.Types.Tx" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' True ) ( C1 (' MetaCons "TxSize" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "unTxSize") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Natural )))

txSizeDistance :: TxSize -> TxSize -> TxSize Source #

Computes the absolute distance between two transaction size quantities.

Queries

Transformations

Checks

Conversions (Unsafe)

unsafeCoinToTxOutCoinValue :: HasCallStack => Coin -> Word64 Source #

Converts the given Coin value to a value that can be included in a transaction output.

Callers of this function must take responsibility for checking that the given value is:

This function throws a run-time error if the pre-condition is violated.