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
-
data
Tx
=
Tx
{
- txId :: Hash "Tx"
- fee :: !( Maybe Coin )
- resolvedInputs :: ![( TxIn , Coin )]
- resolvedCollateralInputs :: ![( TxIn , Coin )]
- outputs :: ![ TxOut ]
- collateralOutput :: !( Maybe TxOut )
- withdrawals :: !( Map RewardAccount Coin )
- metadata :: !( Maybe TxMetadata )
- scriptValidity :: !( Maybe TxScriptValidity )
- data TxIn = TxIn { }
-
data
TxOut
=
TxOut
{
- address :: ! Address
- tokens :: ! TokenBundle
- data TxChange derivationPath = TxChange { }
- data TxMeta = TxMeta { }
- newtype TxMetadata = TxMetadata ( Map Word64 TxMetadataValue )
-
data
TxMetadataValue
- = TxMetaMap [( TxMetadataValue , TxMetadataValue )]
- | TxMetaList [ TxMetadataValue ]
- | TxMetaNumber Integer
- | TxMetaBytes ByteString
- | TxMetaText Text
- data TxStatus
-
data
UnsignedTx
input output change withdrawal =
UnsignedTx
{
- unsignedCollateral :: [input]
- unsignedInputs :: [input]
- unsignedOutputs :: [output]
- unsignedChange :: [change]
- unsignedWithdrawals :: [withdrawal]
-
data
TransactionInfo
=
TransactionInfo
{
- txInfoId :: !( Hash "Tx")
- txInfoFee :: !( Maybe Coin )
- txInfoInputs :: ![( TxIn , Coin , Maybe TxOut )]
- txInfoCollateralInputs :: ![( TxIn , Coin , Maybe TxOut )]
- txInfoOutputs :: ![ TxOut ]
- txInfoCollateralOutput :: !( Maybe TxOut )
- txInfoWithdrawals :: !( Map RewardAccount Coin )
- txInfoMeta :: ! TxMeta
- txInfoDepth :: Quantity "block" Natural
- txInfoTime :: UTCTime
- txInfoMetadata :: !( Maybe TxMetadata )
- txInfoScriptValidity :: !( Maybe TxScriptValidity )
- data Direction
-
data
LocalTxSubmissionStatus
tx =
LocalTxSubmissionStatus
{
- txId :: !( Hash "Tx")
- submittedTx :: !tx
- firstSubmission :: ! SlotNo
- latestSubmission :: ! SlotNo
- newtype TokenBundleSizeAssessor = TokenBundleSizeAssessor { }
- data TokenBundleSizeAssessment
- data TxScriptValidity
- data ScriptWitnessIndex
- data SealedTx
- cardanoTxIdeallyNoLaterThan :: AnyCardanoEra -> SealedTx -> InAnyCardanoEra Tx
- sealedTxFromBytes :: ByteString -> Either DecoderError SealedTx
- sealedTxFromBytes' :: AnyCardanoEra -> ByteString -> Either DecoderError SealedTx
- sealedTxFromCardano :: InAnyCardanoEra Tx -> SealedTx
- sealedTxFromCardano' :: IsCardanoEra era => Tx era -> SealedTx
- sealedTxFromCardanoBody :: IsCardanoEra era => TxBody era -> SealedTx
- getSerialisedTxParts :: SealedTx -> SerialisedTxParts
- unsafeSealedTxFromBytes :: HasCallStack => ByteString -> SealedTx
- newtype SerialisedTx = SerialisedTx { }
- data SerialisedTxParts = SerialisedTxParts { }
- getSealedTxBody :: SealedTx -> InAnyCardanoEra TxBody
- getSealedTxWitnesses :: SealedTx -> [ InAnyCardanoEra KeyWitness ]
- persistSealedTx :: SealedTx -> ByteString
- unPersistSealedTx :: ByteString -> Either Text SealedTx
- mockSealedTx :: HasCallStack => ByteString -> SealedTx
- withinEra :: AnyCardanoEra -> AnyCardanoEra -> Bool
- fromTransactionInfo :: TransactionInfo -> Tx
- inputs :: Tx -> [ TxIn ]
- collateralInputs :: Tx -> [ TxIn ]
- isPending :: TxMeta -> Bool
- toTxHistory :: TransactionInfo -> ( Tx , TxMeta )
- txIns :: Set Tx -> Set TxIn
- txMetadataIsNull :: TxMetadata -> Bool
- txOutCoin :: TxOut -> Coin
- txOutAddCoin :: Coin -> TxOut -> TxOut
- txOutSubtractCoin :: Coin -> TxOut -> TxOut
- txScriptInvalid :: Tx -> Bool
- txOutMinCoin :: Coin
- txOutMaxCoin :: Coin
- txOutMinTokenQuantity :: TokenQuantity
- txOutMaxTokenQuantity :: TokenQuantity
- txMintBurnMaxTokenQuantity :: TokenQuantity
-
data
TxConstraints
=
TxConstraints
{
- txBaseCost :: Coin
- txBaseSize :: TxSize
- txInputCost :: Coin
- txInputSize :: TxSize
- txOutputCost :: TokenBundle -> Coin
- txOutputSize :: TokenBundle -> TxSize
- txOutputMaximumSize :: TxSize
- txOutputMaximumTokenQuantity :: TokenQuantity
- txOutputMinimumAdaQuantity :: Address -> TokenMap -> Coin
- txOutputBelowMinimumAdaQuantity :: Address -> TokenBundle -> Bool
- txRewardWithdrawalCost :: Coin -> Coin
- txRewardWithdrawalSize :: Coin -> TxSize
- txMaximumSize :: TxSize
- txOutputCoinCost :: TxConstraints -> Coin -> Coin
- txOutputCoinSize :: TxConstraints -> Coin -> TxSize
- txOutputHasValidSize :: TxConstraints -> TokenBundle -> Bool
- txOutputHasValidTokenQuantities :: TxConstraints -> TokenMap -> Bool
- newtype TxSize = TxSize { }
- txSizeDistance :: TxSize -> TxSize -> TxSize
- txAssetIds :: Tx -> Set AssetId
- txOutAssetIds :: TxOut -> Set AssetId
- txMapAssetIds :: ( AssetId -> AssetId ) -> Tx -> Tx
- txMapTxIds :: ( Hash "Tx" -> Hash "Tx") -> Tx -> Tx
- txRemoveAssetId :: Tx -> AssetId -> Tx
- txOutMapAssetIds :: ( AssetId -> AssetId ) -> TxOut -> TxOut
- txOutRemoveAssetId :: TxOut -> AssetId -> TxOut
- coinIsValidForTxOut :: Coin -> Bool
- unsafeCoinToTxOutCoinValue :: HasCallStack => Coin -> Word64
Types
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
|
Instances
Instances
Eq TxIn Source # | |
Ord TxIn Source # | |
Defined in Cardano.Wallet.Primitive.Types.Tx |
|
Read TxIn Source # | |
Show TxIn Source # | |
Generic TxIn Source # | |
NFData TxIn Source # | |
Defined in Cardano.Wallet.Primitive.Types.Tx |
|
Buildable TxIn Source # | |
ToJSON ( ApiT TxIn ) Source # | |
FromJSON ( ApiT TxIn ) Source # | |
Buildable ( TxIn , TxOut ) Source # | |
type Rep TxIn Source # | |
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
)))
|
Constructors
TxOut | |
Fields
|
Instances
Eq TxOut Source # | |
Ord TxOut Source # | |
Defined in Cardano.Wallet.Primitive.Types.Tx |
|
Read TxOut Source # | |
Show TxOut Source # | |
Generic TxOut Source # | |
NFData TxOut Source # | |
Defined in Cardano.Wallet.Primitive.Types.Tx |
|
Buildable TxOut Source # | |
Buildable ( SelectionOf TxOut ) Source # | |
Defined in Cardano.Wallet.CoinSelection |
|
Buildable ( TxIn , TxOut ) Source # | |
type Rep TxOut Source # | |
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 #
Constructors
TxChange | |
Instances
Eq derivationPath => Eq ( TxChange derivationPath) Source # | |
( TypeError (' Text "Ord not supported for token maps") :: Constraint , Ord derivationPath) => Ord ( TxChange derivationPath) Source # | |
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 # | |
Generic ( TxChange derivationPath) Source # | |
type Rep ( TxChange derivationPath) Source # | |
Defined in Cardano.Wallet.Primitive.Types.Tx
type
Rep
(
TxChange
derivationPath) =
D1
('
MetaData
"TxChange" "Cardano.Wallet.Primitive.Types.Tx" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" '
False
) (
C1
('
MetaCons
"TxChange" '
PrefixI
'
True
) ((
S1
('
MetaSel
('
Just
"address") '
NoSourceUnpackedness
'
SourceStrict
'
DecidedStrict
) (
Rec0
Address
)
:*:
S1
('
MetaSel
('
Just
"amount") '
NoSourceUnpackedness
'
SourceStrict
'
DecidedStrict
) (
Rec0
Coin
))
:*:
(
S1
('
MetaSel
('
Just
"assets") '
NoSourceUnpackedness
'
SourceStrict
'
DecidedStrict
) (
Rec0
TokenMap
)
:*:
S1
('
MetaSel
('
Just
"derivationPath") '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedLazy
) (
Rec0
derivationPath))))
|
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
newtype TxMetadata Source #
Constructors
TxMetadata ( Map Word64 TxMetadataValue ) |
Instances
data TxMetadataValue Source #
Constructors
TxMetaMap [( TxMetadataValue , TxMetadataValue )] | |
TxMetaList [ TxMetadataValue ] | |
TxMetaNumber Integer | |
TxMetaBytes ByteString | |
TxMetaText Text |
Instances
Eq TxMetadataValue | |
Defined in Cardano.Api.TxMetadata Methods (==) :: TxMetadataValue -> TxMetadataValue -> Bool Source # (/=) :: TxMetadataValue -> TxMetadataValue -> Bool Source # |
|
Ord TxMetadataValue | |
Defined in Cardano.Api.TxMetadata Methods compare :: TxMetadataValue -> TxMetadataValue -> Ordering Source # (<) :: TxMetadataValue -> TxMetadataValue -> Bool Source # (<=) :: TxMetadataValue -> TxMetadataValue -> Bool Source # (>) :: TxMetadataValue -> TxMetadataValue -> Bool Source # (>=) :: TxMetadataValue -> TxMetadataValue -> Bool Source # max :: TxMetadataValue -> TxMetadataValue -> TxMetadataValue Source # min :: TxMetadataValue -> TxMetadataValue -> TxMetadataValue Source # |
|
Show TxMetadataValue | |
Defined in Cardano.Api.TxMetadata |
|
NFData TxMetadataValue Source # | |
Defined in Cardano.Wallet.Orphans Methods rnf :: TxMetadataValue -> () 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
data UnsignedTx input output change withdrawal Source #
An unsigned transaction.
See
Tx
for a signed transaction.
Constructors
UnsignedTx | |
Fields
|
Instances
( Eq input, Eq output, Eq change, Eq withdrawal) => Eq ( UnsignedTx input output change withdrawal) Source # | |
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 # | |
Defined in Cardano.Wallet.Primitive.Types.Tx |
|
Generic ( UnsignedTx input output change withdrawal) Source # | |
Defined in Cardano.Wallet.Primitive.Types.Tx 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 # | |
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
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
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
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
Constructors
TokenBundleSizeAssessor | |
Fields |
Instances
Generic TokenBundleSizeAssessor Source # | |
Defined in Cardano.Wallet.Primitive.Types.Tx Methods from :: TokenBundleSizeAssessor -> Rep TokenBundleSizeAssessor x Source # to :: Rep TokenBundleSizeAssessor x -> TokenBundleSizeAssessor Source # |
|
type Rep TokenBundleSizeAssessor Source # | |
Defined in Cardano.Wallet.Primitive.Types.Tx
type
Rep
TokenBundleSizeAssessor
=
D1
('
MetaData
"TokenBundleSizeAssessor" "Cardano.Wallet.Primitive.Types.Tx" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" '
True
) (
C1
('
MetaCons
"TokenBundleSizeAssessor" '
PrefixI
'
True
) (
S1
('
MetaSel
('
Just
"assessTokenBundleSize") '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedLazy
) (
Rec0
(
TokenBundle
->
TokenBundleSizeAssessment
))))
|
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. |
Instances
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
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
|
ScriptWitnessIndexMint ! Word | |
ScriptWitnessIndexCertificate ! Word |
The n'th certificate, in the list order of the certificates. |
ScriptWitnessIndexWithdrawal ! Word |
The n'th withdrawal, in the order of the
|
Instances
Eq ScriptWitnessIndex | |
Defined in Cardano.Api.TxBody Methods (==) :: ScriptWitnessIndex -> ScriptWitnessIndex -> Bool Source # (/=) :: ScriptWitnessIndex -> ScriptWitnessIndex -> Bool Source # |
|
Ord ScriptWitnessIndex | |
Defined in Cardano.Api.TxBody Methods compare :: ScriptWitnessIndex -> ScriptWitnessIndex -> Ordering Source # (<) :: ScriptWitnessIndex -> ScriptWitnessIndex -> Bool Source # (<=) :: ScriptWitnessIndex -> ScriptWitnessIndex -> Bool Source # (>) :: ScriptWitnessIndex -> ScriptWitnessIndex -> Bool Source # (>=) :: ScriptWitnessIndex -> ScriptWitnessIndex -> Bool Source # max :: ScriptWitnessIndex -> ScriptWitnessIndex -> ScriptWitnessIndex Source # min :: ScriptWitnessIndex -> ScriptWitnessIndex -> ScriptWitnessIndex Source # |
|
Show ScriptWitnessIndex | |
Defined in Cardano.Api.TxBody |
Serialisation
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
sealedTxFromBytes :: ByteString -> Either DecoderError SealedTx Source #
Deserialise a transaction to construct a
SealedTx
.
Arguments
:: AnyCardanoEra |
Most recent era |
-> ByteString |
Serialised transaction |
-> Either DecoderError SealedTx |
Deserialise a transaction to construct a
SealedTx
.
sealedTxFromCardano :: InAnyCardanoEra Tx -> SealedTx Source #
Construct a
SealedTx
from a
Cardano.Api
transaction.
sealedTxFromCardano' :: IsCardanoEra era => Tx era -> SealedTx Source #
Construct a
SealedTx
from a
Cardano.Api
transaction.
sealedTxFromCardanoBody :: IsCardanoEra era => TxBody era -> SealedTx Source #
getSerialisedTxParts :: SealedTx -> SerialisedTxParts Source #
Get the serialised transaction body and witnesses from a
SealedTx
.
unsafeSealedTxFromBytes :: HasCallStack => ByteString -> SealedTx Source #
Only use this for tests.
newtype SerialisedTx Source #
A serialised transaction that may be only partially signed, or even invalid.
Constructors
SerialisedTx | |
Fields |
Instances
data SerialisedTxParts Source #
SerialisedTxParts
is a serialised transaction body, and a possibly
incomplete set of serialised witnesses.
Constructors
SerialisedTxParts | |
Fields |
Instances
getSealedTxWitnesses :: SealedTx -> [ InAnyCardanoEra KeyWitness ] Source #
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 #
withinEra :: AnyCardanoEra -> AnyCardanoEra -> Bool Source #
Functions
fromTransactionInfo :: TransactionInfo -> Tx Source #
Reconstruct a transaction info from a transaction.
collateralInputs :: Tx -> [ TxIn ] Source #
toTxHistory :: TransactionInfo -> ( Tx , TxMeta ) Source #
Drop time-specific information
txMetadataIsNull :: TxMetadata -> Bool Source #
Test whether the given metadata map is empty.
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
txOutputCoinCost :: TxConstraints -> Coin -> Coin Source #
txOutputCoinSize :: TxConstraints -> Coin -> TxSize Source #
txOutputHasValidSize :: TxConstraints -> TokenBundle -> Bool Source #
The size of a transaction, or part of a transaction, in bytes.
Instances
Eq TxSize Source # | |
Ord TxSize Source # | |
Defined in Cardano.Wallet.Primitive.Types.Tx |
|
Show TxSize Source # | |
Generic TxSize Source # | |
Semigroup TxSize Source # | |
Monoid TxSize Source # | |
NFData TxSize Source # | |
Defined in Cardano.Wallet.Primitive.Types.Tx |
|
type Rep TxSize Source # | |
Defined in Cardano.Wallet.Primitive.Types.Tx |
txSizeDistance :: TxSize -> TxSize -> TxSize Source #
Computes the absolute distance between two transaction size quantities.
Queries
Transformations
Checks
coinIsValidForTxOut :: Coin -> Bool Source #
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:
-
not smaller than
txOutMinCoin
-
not greater than
txOutMaxCoin
This function throws a run-time error if the pre-condition is violated.