Skip to content

Commit 1638513

Browse files
authored
Merge pull request #885 from IntersectMBO/mgalazyn/feature/add-cardano-rpc
Add cardano-rpc package
2 parents 23eb6aa + 30b9187 commit 1638513

File tree

35 files changed

+805
-69
lines changed

35 files changed

+805
-69
lines changed

.github/workflows/haskell.yml

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
strategy:
2121
fail-fast: false
2222
matrix:
23-
ghc: ["9.6", "9.12"]
23+
ghc: ["9.6", "9.10"]
2424
cabal: ["3.14"]
2525
sys:
2626
- { os: windows-latest, shell: 'C:/msys64/usr/bin/bash.exe -e {0}' }
@@ -80,6 +80,25 @@ jobs:
8080
with:
8181
use-sodium-vrf: true # default is true
8282

83+
- name: "[Linux] Install grpc dependencies"
84+
if: runner.os == 'Linux'
85+
run: sudo apt install libsnappy-dev protobuf-compiler
86+
87+
- name: "[Windows] Install grpc dependencies"
88+
if: runner.os == 'Windows'
89+
run: /usr/bin/pacman --noconfirm -S mingw-w64-x86_64-snappy mingw-w64-x86_64-protobuf
90+
91+
- name: "[macOS] Install grpc dependencies"
92+
if: runner.os == 'macOS'
93+
run: |
94+
brew install snappy protobuf
95+
SNAPPY_PREFIX=$(brew --prefix snappy)
96+
# TODO generalise and move these paths fixups to https://github.com/input-output-hk/actions/blob/latest/base/action.yml
97+
cat <<EOF >> $GITHUB_ENV
98+
LIBRARY_PATH=$SNAPPY_PREFIX/lib
99+
CPATH=$SNAPPY_PREFIX/include
100+
EOF
101+
83102
- uses: actions/checkout@v4
84103

85104
- name: Cabal update
@@ -159,10 +178,10 @@ jobs:
159178
# and will silently fail if msys2 is not in path. See the "Run tests" step.
160179
#
161180
# - name: Setup tmate session
162-
# if: ${{ failure() }}
163-
# uses: mxschmitt/action-tmate@v3
164-
# with:
165-
# limit-access-to-actor: true
181+
# if: ${{ failure() }}
182+
# uses: mxschmitt/action-tmate@v3
183+
# with:
184+
# limit-access-to-actor: true
166185

167186
build-complete:
168187
needs: [build]

.github/workflows/hls.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,10 @@ jobs:
113113
114114
- name: Test HLS works
115115
if: steps.check_trivial_changes.outputs.CHECK_HLS_WORKS > 0
116-
run: haskell-language-server
116+
run: |
117+
# workaround for https://github.com/haskell/haskell-language-server/issues/3735
118+
cat <<EOF > hie.yaml
119+
cradle:
120+
cabal:
121+
EOF
122+
haskell-language-server

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ The changelogs of constituent packages:
55

66
### `cardano-api-gen`
77
[./cardano-api-gen/CHANGELOG.md](./cardano-api-gen/CHANGELOG.md)
8+
9+
### `cardano-rpc`
10+
[./cardano-rpc/CHANGELOG.md](./cardano-rpc/CHANGELOG.md)

NOTICE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2021-2023 Input Output Global Inc (IOG).
1+
Copyright 2021-2025 Input Output Global Inc (IOG).
22

33
Licensed under the Apache License, Version 2.0 (the "License");
44
you may not use this file except in compliance with the License.

cabal.project

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ packages:
2020
cardano-api
2121
cardano-api-gen
2222
cardano-wasm
23+
cardano-rpc
2324

2425
extra-packages: Cabal, process
2526

@@ -51,10 +52,6 @@ write-ghc-environment-files: always
5152
jobs: $ncpus
5253
semaphore: True
5354

54-
-- IMPORTANT
55-
-- Do NOT add more source-repository-package stanzas here unless they are strictly
56-
-- temporary! Please read the section in CONTRIBUTING about updating dependencies.
57-
5855
if impl (ghc >= 9.12)
5956
allow-newer:
6057
-- https://github.com/kapralVV/Unique/issues/11
@@ -151,3 +148,7 @@ if arch(wasm32)
151148
package crypton
152149
ghc-options: -optc-DARGON2_NO_THREADS
153150

151+
-- IMPORTANT
152+
-- Do NOT add more source-repository-package stanzas here unless they are strictly
153+
-- temporary! Please read the section in CONTRIBUTING about updating dependencies.
154+

cardano-api-gen/NOTICE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2020-2023 Input Output Global Inc (IOG).
1+
Copyright 2020-2025 Input Output Global Inc (IOG).
22

33
Licensed under the Apache License, Version 2.0 (the "License");
44
you may not use this file except in compliance with the License.

cardano-api/NOTICE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2020-2023 Input Output Global Inc (IOG).
1+
Copyright 2020-2025 Input Output Global Inc (IOG).
22

33
Licensed under the Apache License, Version 2.0 (the "License");
44
you may not use this file except in compliance with the License.

cardano-api/src/Cardano/Api/Experimental/Era.hs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import Cardano.Api.Era.Internal.Eon.Convert
3939
import Cardano.Api.Era.Internal.Eon.ConwayEraOnwards
4040
import Cardano.Api.Era.Internal.Eon.MaryEraOnwards
4141
import Cardano.Api.Era.Internal.Eon.ShelleyBasedEra (ShelleyBasedEra (..), ShelleyLedgerEra)
42+
import Cardano.Api.Error
4243
import Cardano.Api.Ledger.Internal.Reexport qualified as L
4344
import Cardano.Api.Pretty.Internal.ShowOf
4445

@@ -232,6 +233,10 @@ newtype DeprecatedEra era
232233

233234
deriving via (ShowOf (DeprecatedEra era)) instance Pretty (DeprecatedEra era)
234235

236+
instance Error (DeprecatedEra era) where
237+
prettyError (DeprecatedEra era) =
238+
"The era " <> pretty (show era) <> " is deprecated and no longer supported."
239+
235240
sbeToEra
236241
:: MonadError (DeprecatedEra era) m
237242
=> ShelleyBasedEra era

cardano-api/src/Cardano/Api/Governance/Internal/Action/VotingProcedure.hs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ module Cardano.Api.Governance.Internal.Action.VotingProcedure where
1717
import Cardano.Api.Address
1818
import Cardano.Api.Era.Internal.Eon.ConwayEraOnwards
1919
import Cardano.Api.Era.Internal.Eon.ShelleyBasedEra
20+
import Cardano.Api.Error
2021
import Cardano.Api.Governance.Internal.Action.ProposalProcedure
2122
import Cardano.Api.HasTypeProxy
2223
import Cardano.Api.Ledger.Internal.Reexport qualified as Ledger
24+
import Cardano.Api.Pretty (pshow)
2325
import Cardano.Api.Serialise.Cbor
2426
import Cardano.Api.Serialise.TextEnvelope.Internal
2527

@@ -144,6 +146,9 @@ newtype VotesMergingConflict era
144146
)
145147
deriving Show
146148

149+
instance Error (VotesMergingConflict era) where
150+
prettyError = pshow
151+
147152
-- | @mergeVotingProcedures vote1 vote2@ merges @vote1@ and @vote2@ into a single vote,
148153
-- or fails if the votes are incompatible.
149154
mergeVotingProcedures

cardano-api/src/Cardano/Api/Governance/Internal/Poll.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ module Cardano.Api.Governance.Internal.Poll
3737
where
3838

3939
import Cardano.Api.Era
40+
import Cardano.Api.Error
4041
import Cardano.Api.HasTypeProxy
4142
import Cardano.Api.Hash
4243
import Cardano.Api.Key.Internal
@@ -278,6 +279,9 @@ data GovernancePollError
278279
| ErrGovernancePollInvalidAnswer GovernancePollInvalidAnswerError
279280
deriving Show
280281

282+
instance Error GovernancePollError where
283+
prettyError = pretty . renderGovernancePollError
284+
281285
data GovernancePollInvalidAnswerError = GovernancePollInvalidAnswerError
282286
{ invalidAnswerAcceptableAnswers :: [(Word, Text)]
283287
, invalidAnswerReceivedAnswer :: Word

0 commit comments

Comments
 (0)