Skip to content

Files

Latest commit

 

History

History
47 lines (38 loc) · 2.09 KB

README.md

File metadata and controls

47 lines (38 loc) · 2.09 KB

purescript-cardano-types cardano-purescript

This library contains wrappers over autogenerated bindings for cardano-data-lite (CDL) and some types adapted from cardano-api and cardano-wallet. It is primarily used in cardano-transaction-lib.

This library presents Transaction and all its structural components as PureScript algebraic data types.

  • Trivial types are implemented as newtypes over CDL
  • Variant types are implemented as ADTs
  • Records-like types are implemented as newtypes over PureScript records

Here's what is included:

  • AsCbor instances for types that are representable as binary
  • Show, Eq, Ord, Generic instances where they make sense
  • ToMetadata/FromMetadata and ToData/FromData typeclasses and some instances
  • Some pretty-printing functions that render a TagSet from monad-logger.
  • fromCdl / toCdl functions that lift values between CDL and PureScript domains (only for types ported from CDL)

Types not from CDL:

  • Asset
  • AssetClass
  • PaymentPubKeyHash
  • UtxoMap
  • Chain
  • ChainTip
  • BlockHeaderHash
  • DelegationsAndRewards
  • EpochLength
  • EraSummaries
  • EraSummary
  • EraSummaryParameters
  • EraSummaryTime
  • RelativeTime
  • SafeZone
  • SlotLength
  • ProtocolParameters
  • Rational
  • StakeValidatorHash
  • SystemStart

Limitations

  • Semigroup instances for Value, ExUnits and Mint are unlawful (they unsafely throw on numeric overflows)
  • No TransactionBuilder - for a framework to build transactions, see cardano-transaction-lib
  • No Block, BlockHeader - these are not needed for an in-browser dApp.
  • Recursion max-depth issues (JavaScript...)