https://github.com/mlabs-haskell/purescript-cardano-types
Domain types for Cardano
https://github.com/mlabs-haskell/purescript-cardano-types
Last synced: 6 months ago
JSON representation
Domain types for Cardano
- Host: GitHub
- URL: https://github.com/mlabs-haskell/purescript-cardano-types
- Owner: mlabs-haskell
- Created: 2024-01-24T20:13:06.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-04-28T12:47:38.000Z (about 2 years ago)
- Last Synced: 2024-05-01T11:46:30.812Z (about 2 years ago)
- Language: PureScript
- Size: 203 KB
- Stars: 5
- Watchers: 6
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# purescript-cardano-types [](https://github.com/klntsky/cardano-purescript)
This library contains wrappers over [autogenerated bindings for cardano-data-lite (CDL)](https://github.com/mlabs-haskell/purescript-cardano-data-lite) and some types adapted from `cardano-api` and `cardano-wallet`. It is primarily used in [`cardano-transaction-lib`](https://github.com/Plutonomicon/cardano-transaction-lib/).
This library presents `Transaction` and all its structural components as PureScript algebraic data types.
- Trivial types are implemented as `newtype`s 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`](https://pursuit.purescript.org/packages/purescript-monad-logger/1.3.1/docs/Data.Log.Tag#t:TagSet).
- `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`](https://github.com/Plutonomicon/cardano-transaction-lib/)
- No `Block`, `BlockHeader` - these are not needed for an in-browser dApp.
- Recursion max-depth issues (JavaScript...)