Skip to content

Commit

Permalink
bump dependencies and add Shelley network constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
paweljakubas committed Aug 3, 2020
1 parent a68107c commit 77d96dc
Show file tree
Hide file tree
Showing 3 changed files with 142 additions and 4 deletions.
6 changes: 4 additions & 2 deletions cardano-transactions.cabal
@@ -1,10 +1,10 @@
cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.31.2.
-- This file has been generated from package.yaml by hpack version 0.33.0.
--
-- see: https://github.com/sol/hpack
--
-- hash: bb07e37f882f89fbc02bca7bc78436aaa4ecca901ec7cd41b52577641ebd852d
-- hash: 6fa5d8537d9df3cbcb0caac4be815b9526e9c319137d49264e67a9a06ddaf2fa

name: cardano-transactions
version: 1.0.0
Expand Down Expand Up @@ -33,6 +33,7 @@ library
exposed-modules:
Data.UTxO.Transaction
Data.UTxO.Transaction.Cardano.Byron
Data.UTxO.Transaction.Cardano.Shelley
other-modules:
Paths_cardano_transactions
hs-source-dirs:
Expand All @@ -50,6 +51,7 @@ library
, cryptonite
, extra
, memory
, shelley-spec-ledger
, text
if flag(release)
ghc-options: -Werror
Expand Down
87 changes: 87 additions & 0 deletions src/Data/UTxO/Transaction/Cardano/Shelley.hs
@@ -0,0 +1,87 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}

{-# OPTIONS_HADDOCK prune #-}
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-} -- needed for {#- HLINT ... #-}

module Data.UTxO.Transaction.Cardano.Shelley
(
-- * Initialization
mkInit
, mainnetMagic
, testnetMagic

-- Internal
, Shelley
) where

import Cardano.Chain.UTxO
( TxIn (..), TxInWitness (..), TxOut (..), TxSigData (..) )
import Cardano.Crypto.Signing
( SigningKey (..) )
import Data.List.NonEmpty
( NonEmpty )
import Data.UTxO.Transaction
( ErrMkPayment (..), MkPayment (..) )
import Shelley.Spec.Ledger.BaseTypes
( Network (..) )


-- | Construct a payment 'Init' for /Shelley/ from primitive types.
--
-- __examples__:
--
-- >>> mkInit Mainnet == mainnetMagic
-- True
--
-- >>> mkInit Testnet == testnetMagic
-- True
--
-- @since 2.0.0
mkInit
:: Network
-- ^ A network tag
-> Init Shelley
mkInit net = net

-- | Pre-defined 'Init' magic for /Shelley/ MainNet.
--
-- @since 2.0.0
mainnetMagic :: Init Shelley
mainnetMagic = mkInit Mainnet

-- | Pre-defined 'Init' magic for /Shelley/ TestNet.
--
-- @since 2.0.0
testnetMagic :: Init Shelley
testnetMagic = mkInit Testnet

--
-- MkPayment instance
--

-- Type-level constructor capturing types for 'Shelley'.
data Shelley

instance MkPayment Shelley where
type Init Shelley = Network

type Input Shelley = TxIn
type Output Shelley = TxOut
type SignKey Shelley = SigningKey

type CoinSel Shelley =
(Network, [TxIn], [TxOut])

type Tx Shelley = Either
ErrMkPayment
(Network, NonEmpty TxIn, NonEmpty TxOut, TxSigData, [TxInWitness])

empty = undefined
addInput = undefined
addOutput = undefined
lock = undefined
signWith = undefined
serialize = undefined
53 changes: 51 additions & 2 deletions stack.yaml
@@ -1,4 +1,4 @@
resolver: https://raw.githubusercontent.com/input-output-hk/cardano-haskell/633f6141c3e7211dbb0c6ae6ad50d4976313e190/snapshots/cardano-1.14.2.yaml
resolver: lts-14.25

# Generate files required by Weeder.
# See https://github.com/ndmitchell/weeder/issues/53
Expand All @@ -8,7 +8,56 @@ packages:
- .

extra-deps:
- hedgehog-quickcheck-0.1.1
- hedgehog-quickcheck-0.1.1
- base58-bytestring-0.1.0
- canonical-json-0.6.0.0
- quiet-0.2
- streaming-binary-0.3.0.1
- moo-1.2
- gray-code-0.3.1
- Unique-0.4.7.7
- generic-monoid-0.1.0.1

- git: https://github.com/input-output-hk/cardano-prelude
commit: 316c854d1d3089f480708ad5cd5ecf8a74423ddd
subdirs:
- .
- test

- git: https://github.com/input-output-hk/cardano-base
commit: 7d795c3040ea7785812efa1c97864bbb41b15d3e
subdirs:
- binary
- binary/test
- cardano-crypto-class
- slotting
- cardano-crypto-praos

- git: https://github.com/input-output-hk/cardano-crypto
commit: 2547ad1e80aeabca2899951601079408becbc92c

- git: https://github.com/input-output-hk/cardano-ledger-specs
commit: 183a70c001587d9b1977541deae28c3e44713907
subdirs:
- byron/ledger/impl
- byron/crypto
- byron/ledger/impl/test
- byron/crypto/test
- byron/chain/executable-spec
- byron/ledger/executable-spec
- semantics/executable-spec
- semantics/small-steps-test
- shelley/chain-and-ledger/dependencies/non-integer
- shelley/chain-and-ledger/executable-spec
- shelley/chain-and-ledger/executable-spec/test

- git: https://github.com/input-output-hk/iohk-monitoring-framework
commit: efa4b5ecd7f0a13124616b12679cd42517cd905a
subdirs:
- contra-tracer

- git: https://github.com/input-output-hk/goblins
commit: 26d35ad52fe9ade3391532dbfeb2f416f07650bc

flags:
# Bundle VRF crypto in libsodium and do not rely on an external fork to have it.
Expand Down

0 comments on commit 77d96dc

Please sign in to comment.