Skip to content

Commit

Permalink
Improve Haskell Documentation (#82)
Browse files Browse the repository at this point in the history
* Improve documentation and move it to package description

* Move description back to README to gain markdown support

* Remove markdown style header from package description
  • Loading branch information
domMayhew committed Mar 14, 2024
1 parent 262de23 commit 15bafe0
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
32 changes: 29 additions & 3 deletions gen/haskell/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,33 @@
# UTxO RPC

This package contains the generated code from [the UTxO RPC specification](https://utxorpc.org/). Codegen was performed using `proto-lens-protoc` and contains `Message` types useful for serde.
This package is generated by `proto-lens-protoc` from the [u5c specification](https://utxorpc.org) and contains `Data.ProtoLens.Message.Message` instances useful for serde. It is designed to be used with the [client](https://hackage.haskell.org/package/utxorpc-client) or [server](https://hackage.haskell.org/package/utxorpc-server) SDK. Build a message with the `lens` library by importing the relevant `utxorpc` modules and calling `Data.ProtoLens.Message.defMessage`:

Users: For more support for implementing a UTxO RPC client or service, see [the SDK](https://www.github.com/utxorpc/haskell-sdk).
```haskell
import Control.Lens.Operators ((&), (.~))
import Data.ProtoLens.Message (Message (defMessage))
import qualified Data.Text.Encoding as T
import Proto.Utxorpc.V1.Sync.Sync (FetchBlockRequest)
import Proto.Utxorpc.V1.Sync.Sync_Fields (hash, index)

Maintainers: See [the UTxO spec repo README](https://github.com/utxorpc/spec#readme).
fetchBlockRequest :: FetchBlockRequest
fetchBlockRequest =
defMessage
& ref .~
[ defMessage
& index .~ 116541970
& hash .~ T.encodeUtf8 "9d5abce5b1a7d94b141a597fd621a1ff9dcd46579ff1939664364311cd1be338"
]
```

The easieset way to send requests or run a service is through the SDKs: [utxorpc-client](https://hackage.haskell.org/package/utxorpc-client) and [utxorpc-server](https://hackage.haskell.org/package/utxorpc-server).

# Generating this package from the spec
Please see the u5c project [README](https://github.com/utxorpc/spec#readme) for information on how this package was generated. To generate this code yourself, please see [`proto-lens`](https://github.com/google/proto-lens#readme).

NOTE: `proto-lens-protobuf-types` version >= 0.7.2 is required to build this package, as it includes support of the `FieldMask` well-known type.

# Maintainers
See [the UTxO spec repo README](https://github.com/utxorpc/spec#readme).

> [!NOTE]
> `proto-lens-protobuf-types` version >= 0.7.2 is required to build this package as it contains support for the `FieldMask` well-known type.
4 changes: 3 additions & 1 deletion gen/haskell/utxorpc.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ cabal-version: 3.0
name: utxorpc
version: 0.0.4.0
synopsis: A gRPC interface for UTxO Blockchains
description: UTxO RPC (u5c for short) is an interface tailored for interactions with UTxO-based blockchains, prioritizing performance and developer experience. By providing a common contract, a range of SDKs, and thorough documentation, UTxO RPC aims to facilitate:
description: [UTxO]((https://utxorpc.org/) RPC (u5c for short) is an interface tailored for interactions with UTxO-based blockchains, prioritizing performance and developer experience. By providing a common contract, a range of SDKs, and thorough documentation, UTxO RPC aims to facilitate:

* Reusability: Enabling shared components that can be reused across different projects to simplify the integration effort.
* Interoperability: A common interface to simplify integrations between different parties and avoid the common pitfall of vendor lock-in.
* Performance: A serialized binary format which is compact and efficient, resulting in smaller message sizes and reduced network overhead compared to its JSON counterpart

Please note that UTxO RPC is just a specification of an interface between agents and the blockchain, it doesn't provide any concrete client / provider implementations. The primary purpose of u5c is to define a set of standardized methods, data structures, and communication patterns.

category: Network, GRPC, Blockchain, Cardano
homepage: https://github.com/utxorpc/spec#readme
bug-reports: https://github.com/utxorpc/spec/issues
Expand Down Expand Up @@ -38,6 +39,7 @@ library
build-depends:
base >=4.7 && <5
, proto-lens >= 0.7.1 && < 0.8
-- >= 0.7.2 required as it contains support for `FieldMask`
, proto-lens-protobuf-types >= 0.7.2 && < 0.8
, proto-lens-runtime >= 0.7.0 && < 0.8
default-language: Haskell2010

0 comments on commit 15bafe0

Please sign in to comment.