Skip to content

Commit

Permalink
Redo tx body construction, with era-dependent fields.
Browse files Browse the repository at this point in the history
Introduce a TxBodyContent type containing all the tx body fields. This
type now covers all eras, including Byron. All the fields other than
inputs and outputs are era-dependent: whether they're supported, and if
so required or optional.

We introduce a slew of types to cover which fields are supported in
which eras. This makes a lot of things more uniform.

Also complete the conversion functions into the underlying ledger types.
This should now provide full support for the current Allegra and Mary
eras. It has stubs for the auxiliary scripts which will be supported in
the ledger shortly.

This patch does not update the tests or CLI. We may yet find we need
some more type classes, or extensions to existing classes to make using
this convenient.
  • Loading branch information
dcoutts committed Nov 24, 2020
1 parent dde3664 commit 23a2133
Show file tree
Hide file tree
Showing 3 changed files with 625 additions and 145 deletions.
56 changes: 42 additions & 14 deletions cardano-api/src/Cardano/API.hs
Expand Up @@ -114,24 +114,49 @@ module Cardano.API (

-- * Building transactions
-- | Constructing and inspecting transactions

-- ** Transaction bodies
TxBody,
makeTransactionBody,
TxBodyContent(..),
makeByronTxBodyContent,
makeShelleyTxBodyContent,

-- ** Transaction Ids
TxId,
getTxId,

-- ** Transaction inputs
TxIn(TxIn),
TxIx(TxIx),

-- ** Transaction outputs
TxOut(TxOut),
TxOutValue(..),
AdaOnlyInEra(..),
MultiAssetInEra(..),
TTL,
TxFee,
MintValue(..),
makeByronTransaction,
makeShelleyTransaction,
SlotNo,
TxExtraContent,
txExtraContentEmpty,
Certificate,

-- ** Other transaction body types
TxFee(..),
TxValidityLowerBound(..),
TxValidityUpperBound(..),
SlotNo(..),
TxMetadataInEra(..),
TxAuxScripts(..),
TxWithdrawals(..),
TxCertificates(..),
TxUpdateProposal(..),
TxMintValue(..),

-- ** Era-dependent transaction body features
OnlyAdaSupportedInEra(..),
MultiAssetSupportedInEra(..),
ValidityUpperBoundSupportedInEra(..),
ValidityNoUpperBoundSupportedInEra(..),
ValidityLowerBoundSupportedInEra(..),
TxMetadataSupportedInEra(..),
AuxScriptsSupportedInEra(..),
WithdrawalsSupportedInEra(..),
CertificatesSupportedInEra(..),
UpdateProposalSupportedInEra(..),

-- * Signing transactions
-- | Creating transaction witnesses one by one, or all in one go.
Expand Down Expand Up @@ -176,15 +201,18 @@ module Cardano.API (
TxMetadataJsonError (..),
TxMetadataJsonSchemaError (..),

-- * Registering stake address and delegating
-- * Certificates
Certificate,

-- ** Registering stake address and delegating
-- | Certificates that are embedded in transactions for registering and
-- unregistering stake address, and for setting the stake pool delegation
-- choice for a stake address.
makeStakeAddressRegistrationCertificate,
makeStakeAddressDeregistrationCertificate,
makeStakeAddressDelegationCertificate,

-- * Registering stake pools
-- ** Registering stake pools
-- | Certificates that are embedded in transactions for registering and
-- retiring stake pools. This includes updating the stake pool parameters.
makeStakePoolRegistrationCertificate,
Expand All @@ -193,7 +221,7 @@ module Cardano.API (
StakePoolRelay,
StakePoolMetadataReference,

-- ** Stake pool off-chain metadata
-- * Stake pool off-chain metadata
StakePoolMetadata,
validateAndHashStakePoolMetadata,
StakePoolMetadataValidationError,
Expand Down

0 comments on commit 23a2133

Please sign in to comment.