Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bootstrapped the public facing API of cardano-ledger-api
* Created the `Cardano.Ledger.Api` module which exports anything the end-user will need in order to build and inspect transactions. * Completing some missing exports in lower modules * Bootstrapped very simple documentation on how to build and inspect transactions
- Loading branch information
1 parent
064acb8
commit 65946a5
Showing
6 changed files
with
145 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
-- | This module provides a library interface for working with types that will allow a user to | ||
-- interact with Cardano. | ||
-- | ||
-- It is intended to be the complete API covering everything but without exposing constructors that | ||
-- reveal any lower level types. | ||
-- | ||
-- In the interest of simplicity it glosses over some details of the system. | ||
-- Most simple tools should be able to work just using this interface, however you can go deeper and | ||
-- expose the types from the underlying libraries using "Cardano.Ledger.Core", | ||
-- "Cardano.Ledger.Shelley", "Cardano.Ledger.Babbage", etc. | ||
module Cardano.Ledger.Api | ||
( -- * Eras | ||
|
||
-- ** Shelley | ||
Shelley, | ||
ShelleyEra, | ||
|
||
-- ** Allegra | ||
Allegra, | ||
AllegraEra, | ||
|
||
-- ** Mary | ||
Mary, | ||
MaryEra, | ||
|
||
-- ** Alonzo | ||
Alonzo, | ||
AlonzoEra, | ||
|
||
-- ** Babbage | ||
Babbage, | ||
BabbageEra, | ||
|
||
-- ** Conway | ||
Conway, | ||
ConwayEra, | ||
|
||
-- * Crypto | ||
StandardCrypto, | ||
Crypto (..), | ||
|
||
-- * Protocol parameters | ||
EraPParams (..), | ||
|
||
-- * Building and inspecting transactions | ||
|
||
-- | ||
|
||
-- | Transaction building and inspecting relies heavily on lenses (`microlens`). Therefore, some | ||
-- familiarity with those is necessary. However, you can probably go a long way by simply | ||
-- looking at the examples and try to go from there. | ||
-- | ||
-- Here's an example on how to build a very simple unbalanced transaction using the provided | ||
-- interface. | ||
-- | ||
-- >>> import Test.QuickCheck | ||
-- >>> import qualified Data.Sequence.Strict as StrictSeq | ||
-- >>> import Test.Cardano.Ledger.Babbage.Serialisation.Generators () | ||
-- prop> \txOut -> | ||
-- let | ||
-- -- Defining a Babbage era transaction body with a single random transaction output | ||
-- txBody = mkBasicTxBody | ||
-- & outputsTxBodyL <>~ StrictSeq.singleton (txOut :: TxOut Babbage) | ||
-- -- Defining a basic transaction with our transaction body | ||
-- tx = mkBasicTx txBody | ||
-- in | ||
-- -- We verify that the transaction's outputs contains our single random output | ||
-- tx ^. bodyTxL . outputsTxBodyL == StrictSeq.singleton txOut | ||
EraTx (..), | ||
ShelleyTx, | ||
AlonzoTx, | ||
AlonzoEraTx (..), | ||
|
||
-- ** Transaction bodies | ||
EraTxBody (..), | ||
ShelleyTxBody, | ||
ShelleyEraTxBody (..), | ||
ShelleyMAEraTxBody, | ||
AlonzoTxBody, | ||
AlonzoEraTxBody (..), | ||
BabbageTxBody, | ||
BabbageEraTxBody (..), | ||
|
||
-- ** Transaction outputs | ||
EraTxOut (..), | ||
ShelleyTxOut, | ||
AlonzoTxOut, | ||
AlonzoEraTxOut (..), | ||
BabbageTxOut, | ||
BabbageEraTxOut (..), | ||
setMinCoinTxOut, | ||
setMinCoinSizedTxOut, | ||
) | ||
where | ||
|
||
import Cardano.Ledger.Api.Era | ||
import Cardano.Ledger.Api.PParams | ||
import Cardano.Ledger.Api.Tx | ||
import Cardano.Ledger.Api.Tx.Body | ||
import Cardano.Ledger.Api.Tx.Out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module Cardano.Ledger.Api.PParams | ||
( EraPParams (..), | ||
) | ||
where | ||
|
||
import Cardano.Ledger.Core (EraPParams (..)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE FlexibleContexts #-} | ||
{-# LANGUAGE RankNTypes #-} | ||
{-# LANGUAGE ScopedTypeVariables #-} | ||
|
||
module Cardano.Ledger.Api.Tx.Body | ||
( EraTxBody (..), | ||
|
||
-- * Shelley Era | ||
ShelleyTxBody, | ||
ShelleyEraTxBody (..), | ||
|
||
-- * Allegra and Mary Era | ||
ShelleyMAEraTxBody, | ||
|
||
-- * Alonzo Era | ||
AlonzoTxBody, | ||
AlonzoEraTxBody (..), | ||
|
||
-- * Babbage Era | ||
BabbageTxBody, | ||
BabbageEraTxBody (..), | ||
) | ||
where | ||
|
||
import Cardano.Ledger.Alonzo.TxBody (AlonzoEraTxBody (..), AlonzoTxBody) | ||
import Cardano.Ledger.Babbage.TxBody (BabbageEraTxBody (..), BabbageTxBody) | ||
import Cardano.Ledger.Core (EraTxBody (..)) | ||
import Cardano.Ledger.Shelley (ShelleyTxBody) | ||
import Cardano.Ledger.Shelley.Core (ShelleyEraTxBody (..)) | ||
import Cardano.Ledger.ShelleyMA.Core (ShelleyMAEraTxBody) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters