Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Hydra.Ledger.Cardano
Contents
Synopsis
- cardanoLedger :: Globals -> LedgerEnv LedgerEra -> Ledger Tx
- mkSimpleTx :: (TxIn, TxOut CtxUTxO) -> (AddressInEra, Value) -> SigningKey PaymentKey -> Either TxBodyError Tx
- mkRangedTx :: (TxIn, TxOut CtxUTxO) -> (AddressInEra, Value) -> SigningKey PaymentKey -> (Maybe TxValidityLowerBound, Maybe TxValidityUpperBound) -> Either TxBodyError Tx
- genSigningKey :: Gen (SigningKey PaymentKey)
- genVerificationKey :: Gen (VerificationKey PaymentKey)
- genKeyPair :: Gen (VerificationKey PaymentKey, SigningKey PaymentKey)
- genSequenceOfSimplePaymentTransactions :: Gen (UTxO, [Tx])
- genFixedSizeSequenceOfSimplePaymentTransactions :: Int -> Gen (UTxO, [Tx])
- generateOneTransfer :: NetworkId -> (UTxO, (VerificationKey PaymentKey, SigningKey PaymentKey), [Tx]) -> Int -> Gen (UTxO, (VerificationKey PaymentKey, SigningKey PaymentKey), [Tx])
- genOutput :: forall ctx. VerificationKey PaymentKey -> Gen (TxOut ctx)
- genTxOutAdaOnly :: VerificationKey PaymentKey -> Gen (TxOut ctx)
- genUTxOAdaOnlyOfSize :: Int -> Gen UTxO
- genUTxOAlonzo :: Gen UTxO
- genUTxOSized :: Int -> Gen UTxO
- genUTxO1 :: Gen (TxOut CtxUTxO) -> Gen UTxO
- genTxOut :: Gen (TxOut ctx)
- genTxOutByron :: Gen (TxOut ctx)
- genTxOutWithReferenceScript :: Gen (TxOut ctx)
- genUTxOFor :: VerificationKey PaymentKey -> Gen UTxO
- genOneUTxOFor :: VerificationKey PaymentKey -> Gen UTxO
- genAddressInEra :: NetworkId -> Gen AddressInEra
- genValue :: Gen Value
- genAdaOnlyUTxO :: Gen UTxO
- adaOnly :: TxOut CtxUTxO -> TxOut CtxUTxO
- genUTxOWithSimplifiedAddresses :: Gen UTxO
- shrinkUTxO :: UTxO -> [UTxO]
- shrinkValue :: Value -> [Value]
- module Hydra.Ledger.Cardano.Builder
- data ShelleyGenesis c = ShelleyGenesis {
- sgSystemStart :: !UTCTime
- sgNetworkMagic :: !Word32
- sgNetworkId :: !Network
- sgActiveSlotsCoeff :: !PositiveUnitInterval
- sgSecurityParam :: !Word64
- sgEpochLength :: !EpochSize
- sgSlotsPerKESPeriod :: !Word64
- sgMaxKESEvolutions :: !Word64
- sgSlotLength :: !NominalDiffTimeMicro
- sgUpdateQuorum :: !Word64
- sgMaxLovelaceSupply :: !Word64
- sgProtocolParams :: !(PParams (ShelleyEra c))
- sgGenDelegs :: !(Map (KeyHash 'Genesis c) (GenDelegPair c))
- sgInitialFunds :: ListMap (Addr c) Coin
- sgStaking :: ShelleyGenesisStaking c
- type Tx = Tx Era
Documentation
cardanoLedger :: Globals -> LedgerEnv LedgerEra -> Ledger Tx Source #
Use the cardano-ledger as an in-hydra Ledger
.
Arguments
:: (TxIn, TxOut CtxUTxO) | |
-> (AddressInEra, Value) | Recipient address and amount. |
-> SigningKey PaymentKey | Sender's signing key. |
-> Either TxBodyError Tx |
Create a zero-fee, payment cardano transaction.
Arguments
:: (TxIn, TxOut CtxUTxO) | |
-> (AddressInEra, Value) | Recipient address and amount. |
-> SigningKey PaymentKey | Sender's signing key. |
-> (Maybe TxValidityLowerBound, Maybe TxValidityUpperBound) | |
-> Either TxBodyError Tx |
Create a zero-fee, payment cardano transaction with validity range.
genSigningKey :: Gen (SigningKey PaymentKey) Source #
genVerificationKey :: Gen (VerificationKey PaymentKey) Source #
genKeyPair :: Gen (VerificationKey PaymentKey, SigningKey PaymentKey) Source #
genSequenceOfSimplePaymentTransactions :: Gen (UTxO, [Tx]) Source #
Generates a sequence of simple "transfer" transactions for a single key.
The kind of transactions produced by this generator is very limited, see generateOneTransfer
.
genFixedSizeSequenceOfSimplePaymentTransactions :: Int -> Gen (UTxO, [Tx]) Source #
generateOneTransfer :: NetworkId -> (UTxO, (VerificationKey PaymentKey, SigningKey PaymentKey), [Tx]) -> Int -> Gen (UTxO, (VerificationKey PaymentKey, SigningKey PaymentKey), [Tx]) Source #
genOutput :: forall ctx. VerificationKey PaymentKey -> Gen (TxOut ctx) Source #
genTxOutAdaOnly :: VerificationKey PaymentKey -> Gen (TxOut ctx) Source #
Generate an ada-only TxOut
payed to an arbitrary public key.
genUTxOAdaOnlyOfSize :: Int -> Gen UTxO Source #
Generate a fixed size UTxO with ada-only outputs.
genUTxOAlonzo :: Gen UTxO Source #
Generate Babbage
era UTxO'
, which may contain arbitrary assets in
TxOut
s addressed to public keys *and* scripts. NOTE: This is not reducing
size when generating assets in TxOut
s, so will end up regularly with 300+
assets with generator size 30. NOTE: The Arbitrary TxIn instance from the
ledger is producing colliding values, so we replace them.
genUTxOSized :: Int -> Gen UTxO Source #
Generate a Babbage
era UTxO'
with given number of outputs. See also
genTxOut
.
genUTxO1 :: Gen (TxOut CtxUTxO) -> Gen UTxO Source #
Genereate a UTxO'
with a single entry using given TxOut
generator.
genTxOut :: Gen (TxOut ctx) Source #
Generate a Babbage
era TxOut
, which may contain arbitrary assets
addressed to public keys and scripts, as well as datums.
NOTE: This generator does * not produce byron addresses as most of the cardano ecosystem dropped support for that (including plutus), * not produce reference scripts as they are not fully "visible" from plutus, * replace stake pointers with null references as nobody uses that.
genTxOutByron :: Gen (TxOut ctx) Source #
Generate a TxOut
with a byron address. This is usually not supported by
Hydra or Plutus.
genTxOutWithReferenceScript :: Gen (TxOut ctx) Source #
Generate a TxOut
with a reference script. The standard genTxOut
is not
including reference scripts, use this generator if you are interested in
these cases.
genUTxOFor :: VerificationKey PaymentKey -> Gen UTxO Source #
Generate utxos owned by the given cardano key.
genOneUTxOFor :: VerificationKey PaymentKey -> Gen UTxO Source #
Generate a single UTXO owned by vk
.
genAddressInEra :: NetworkId -> Gen AddressInEra Source #
NOTE: See note on mkVkAddress
about NetworkId
.
genAdaOnlyUTxO :: Gen UTxO Source #
Generate UTXO entries that do not contain any assets. Useful to test / measure cases where
genUTxOWithSimplifiedAddresses :: Gen UTxO Source #
Generate "simplified" UTXO, ie. without some of the complexities required for backward-compatibility and obscure features.
shrinkUTxO :: UTxO -> [UTxO] Source #
shrinkValue :: Value -> [Value] Source #
module Hydra.Ledger.Cardano.Builder
data ShelleyGenesis c #
Constructors
ShelleyGenesis | |
Fields
|
Instances
Orphan instances
Arbitrary TxId Source # | |
Arbitrary AssetName Source # | |
Arbitrary UTxO Source # | |
Arbitrary Tx Source # | |
FromJSON Tx Source # | |
ToJSON Tx Source # | |
FromCBOR UTxO Source # | |
FromCBOR Tx Source # | |
ToCBOR UTxO Source # | |
Methods toCBOR :: UTxO -> Encoding encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy UTxO -> Size encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [UTxO] -> Size | |
ToCBOR Tx Source # | |
Methods encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy Tx -> Size encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [Tx] -> Size | |
IsTx Tx Source # | |
Arbitrary (Hash PaymentKey) Source # | |
Arbitrary (VerificationKey PaymentKey) Source # | |
Methods arbitrary :: Gen (VerificationKey PaymentKey) shrink :: VerificationKey PaymentKey -> [VerificationKey PaymentKey] | |
Arbitrary (TxOut CtxUTxO) Source # | |