Skip to content

Commit

Permalink
Expose cardano-cli requirements from cardano-ledger-byron
Browse files Browse the repository at this point in the history
  • Loading branch information
palas committed Oct 1, 2024
1 parent d44459c commit 0264483
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 9 deletions.
1 change: 1 addition & 0 deletions cardano-api/cardano-api.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ library internal
Cardano.Api.Address
Cardano.Api.Anchor
Cardano.Api.Block
Cardano.Api.ByronDelegation
Cardano.Api.Certificate
Cardano.Api.Convenience.Construction
Cardano.Api.Convenience.Query
Expand Down
9 changes: 9 additions & 0 deletions cardano-api/internal/Cardano/Api/ByronDelegation.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- | Functions and types for working with delegation certificates in Byron
module Cardano.Api.ByronDelegation
( ACertificate (..)
, isValid
, signCertificate
)
where

import Cardano.Chain.Delegation (ACertificate (..), isValid, signCertificate)
89 changes: 83 additions & 6 deletions cardano-api/internal/Cardano/Api/ReexposeLedger.hs
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,74 @@ module Cardano.Api.ReexposeLedger
, drepDepositL
, csCommitteeCredsL
-- Byron
, AddrAttributes (..)
, Address
, addressDetailedF
, addressF
, addressHash
, ApplicationName (..)
, Annotated (..)
, Byron.Tx (..)
, aTaAnnotation
, BlockCount (..)
, Byron.CompactTxIn
, Byron.CompactTxOut
, Byron.fromCompactTxIn
, Byron.fromCompactTxOut
, byronProtVer
, serialize'
, toPlainDecoder
, toCBOR
, fromCBOR
, Byron.Tx (..)
, Byron.unUTxO
, ByteSpan (..)
, slice
, Certificate
, checkApplicationName
, checkVerKeyAddress
, checkSystemTag
, Config (..)
, decCBORABlockOrBoundary
, decodeAddressBase58
, Decoder
, defaultUTxOConfiguration
, EpochNumber (..)
, FakeAvvmOptions (..)
, fromCBOR
, GeneratedSecrets (..)
, generateGenesisData
, GenesisAvvmBalances (..)
, GenesisData (..)
, GenesisDataError (..)
, GenesisDataGenerationError (..)
, GenesisDelegation (..)
, GenesisDelegationError
, GenesisHash (..)
, GenesisInitializer (..)
, GenesisSpec (..)
, genesisUtxo
, InstallerHash (..)
, Lovelace
, LovelacePortion
, lovelacePortionToRational
, mkAttributes
, mkGenesisDelegation
, mkGenesisSpec
, mkKnownLovelace
, NetworkMagic (..)
, NumSoftwareVersion
, PoorSecret (..)
, Proposal
, ProtocolParameters (..)
, rationalToLovelacePortion
, readGenesisData
, serialize'
, slice
, SlotNumber (..)
, SoftforkRule (..)
, SoftwareVersion (..)
, SystemTag (..)
, TestnetBalanceOptions (..)
, TxFeePolicy (..)
, TxSizeLinear (..)
, toCBOR
, toPlainDecoder
, txOutAddress
-- Shelley
, secondsToNominalDiffTimeMicro
-- Babbage
Expand Down Expand Up @@ -141,6 +199,25 @@ module Cardano.Api.ReexposeLedger
)
where

import Cardano.Chain.Block (decCBORABlockOrBoundary)
import Cardano.Chain.Common (AddrAttributes (..), Address, BlockCount (..), Lovelace,
LovelacePortion, NetworkMagic (..), TxFeePolicy (..), TxSizeLinear (..),
addressDetailedF, addressF, addressHash, checkVerKeyAddress, decodeAddressBase58,
lovelacePortionToRational, mkAttributes, mkKnownLovelace,
rationalToLovelacePortion)
import Cardano.Chain.Delegation (Certificate)
import Cardano.Chain.Genesis (Config (..), FakeAvvmOptions (..), GeneratedSecrets (..),
GenesisAvvmBalances (..), GenesisData (..), GenesisDataError (..),
GenesisDataGenerationError (..), GenesisDelegation (..), GenesisDelegationError,
GenesisHash (..), GenesisInitializer (..), GenesisSpec (..), PoorSecret,
TestnetBalanceOptions (..), generateGenesisData, mkGenesisDelegation,
mkGenesisSpec, poorSecretToKey, readGenesisData)
import Cardano.Chain.Slotting (EpochNumber (..), SlotNumber (..))
import Cardano.Chain.Update (ApplicationName (..), InstallerHash (..), NumSoftwareVersion,
Proposal, ProtocolParameters (..), SoftforkRule (..), SoftwareVersion (..),
SystemTag (..), checkApplicationName, checkSystemTag)
import Cardano.Chain.UTxO (aTaAnnotation, defaultUTxOConfiguration, genesisUtxo,
txOutAddress)
import qualified Cardano.Chain.UTxO as Byron
import Cardano.Crypto.Hash.Class (hashFromBytes, hashToBytes)
import Cardano.Ledger.Alonzo.Core (AsIxItem (AsIxItem), CoinPerWord (..),
Expand Down
9 changes: 6 additions & 3 deletions cardano-api/internal/Cardano/Api/SpecialByron.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ module Cardano.Api.SpecialByron
, applicationName
, applicationVersion
, softwareVersion
, KeyHash
, ProtocolVersion (..)
, Vote
)
where

Expand All @@ -24,11 +27,11 @@ import Cardano.Api.NetworkId (NetworkId, toByronProtocolMagicId)
import Cardano.Api.SerialiseRaw

import qualified Cardano.Binary as Binary
import Cardano.Chain.Common (LovelacePortion, TxFeePolicy)
import Cardano.Chain.Common (KeyHash, LovelacePortion, TxFeePolicy)
import Cardano.Chain.Slotting
import Cardano.Chain.Update (AProposal (aBody, annotation), InstallerHash,
ProposalBody (ProposalBody), ProtocolParametersUpdate (..), ProtocolVersion,
SoftforkRule, SoftwareVersion, SystemTag, UpId, mkVote, recoverUpId,
ProposalBody (ProposalBody), ProtocolParametersUpdate (..), ProtocolVersion (..),
SoftforkRule, SoftwareVersion, SystemTag, UpId, Vote, mkVote, recoverUpId,
recoverVoteId, signProposal)
import qualified Cardano.Chain.Update as Update
import qualified Cardano.Chain.Update.Vote as ByronVote
Expand Down
2 changes: 2 additions & 0 deletions cardano-api/internal/Cardano/Api/Tx/Body.hs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ module Cardano.Api.Tx.Body
, TxIx (..)
, genesisUTxOPseudoTxIn
, getReferenceInputsSizeForTxIds
, ByronTxIn

-- * Transaction outputs
, CtxTx
Expand All @@ -95,6 +96,7 @@ module Cardano.Api.Tx.Body
, parseHash
, TxOutInAnyEra (..)
, txOutInAnyEra
, ByronTxOut

-- * Other transaction body types
, TxInsCollateral (..)
Expand Down
6 changes: 6 additions & 0 deletions cardano-api/internal/Cardano/Api/TxIn.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ module Cardano.Api.TxIn
( -- * Transaction inputs
TxIn (..)
, TxIx (..)
, ByronTxIn
, ByronTxOut

-- * Transaction Ids
, TxId (..)
Expand Down Expand Up @@ -170,3 +172,7 @@ toShelleyTxIn (TxIn txid (TxIx txix)) =
fromShelleyTxIn :: Ledger.TxIn StandardCrypto -> TxIn
fromShelleyTxIn (Ledger.TxIn txid (Ledger.TxIx txix)) =
TxIn (fromShelleyTxId txid) (TxIx (fromIntegral txix))

type ByronTxIn = Byron.TxIn

type ByronTxOut = Byron.TxOut
11 changes: 11 additions & 0 deletions cardano-api/src/Cardano/Api/Byron.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ module Cardano.Api.Byron
, SigningKey (..)
, SomeByronSigningKey (..)

-- * Delegation
, Dlg.ACertificate (..)
, Dlg.isValid
, Dlg.signCertificate

-- * Hashes
, Hash (..)

Expand Down Expand Up @@ -71,8 +76,13 @@ module Cardano.Api.Byron
, ByronVote (..)
, makeByronVote
, toByronLedgertoByronVote
, KeyHash
, ProtocolVersion (..)
, Vote

-- ** Conversions
, ByronTxIn
, ByronTxOut
, fromByronTxIn
, toByronLovelace
, toByronNetworkMagic
Expand All @@ -92,6 +102,7 @@ where

import Cardano.Api
import Cardano.Api.Address
import Cardano.Api.ByronDelegation as Dlg
import Cardano.Api.Keys.Byron
import Cardano.Api.NetworkId
import Cardano.Api.SerialiseLedgerCddl
Expand Down

0 comments on commit 0264483

Please sign in to comment.