Skip to content

Commit c4f3c7b

Browse files
committed
WIP
1 parent fbd4f0c commit c4f3c7b

File tree

10 files changed

+993
-361
lines changed

10 files changed

+993
-361
lines changed

cardano-api/cardano-api.cabal

+3-2
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ library internal
123123
Cardano.Api.Orphans
124124
Cardano.Api.Pretty
125125
Cardano.Api.Protocol
126-
Cardano.Api.Protocol.Version
126+
Cardano.Api.Protocol.AvailableEras
127127
Cardano.Api.ProtocolParameters
128128
Cardano.Api.Query
129129
Cardano.Api.Query.Expr
@@ -132,6 +132,8 @@ library internal
132132
Cardano.Api.ReexposeNetwork
133133
Cardano.Api.Rewards
134134
Cardano.Api.Script
135+
Cardano.Api.Experimental.Eras
136+
Cardano.Api.Experimental.Tx
135137
Cardano.Api.ScriptData
136138
Cardano.Api.SerialiseBech32
137139
Cardano.Api.SerialiseCBOR
@@ -237,7 +239,6 @@ library
237239
Cardano.Api.ChainSync.Client
238240
Cardano.Api.ChainSync.ClientPipelined
239241
Cardano.Api.Crypto.Ed25519Bip32
240-
Cardano.Api.Experimental
241242
Cardano.Api.Ledger
242243
Cardano.Api.Network
243244
Cardano.Api.Shelley

cardano-api/internal/Cardano/Api/Convenience/Construction.hs

+14-3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ where
1717
import Cardano.Api.Address
1818
import Cardano.Api.Certificate
1919
import Cardano.Api.Eon.ShelleyBasedEra
20+
import Cardano.Api.Eras
21+
import Cardano.Api.Experimental.Eras (sbeToEra)
22+
import Cardano.Api.Experimental.Tx
2023
import Cardano.Api.Fees
2124
import Cardano.Api.ProtocolParameters
2225
import Cardano.Api.Query
@@ -31,6 +34,7 @@ import qualified Cardano.Ledger.Keys as L
3134

3235
import qualified Data.List as List
3336
import qualified Data.Map.Strict as Map
37+
import Data.Maybe
3438
import Data.Set (Set)
3539
import qualified Data.Set as Set
3640
import Data.Text (Text)
@@ -72,7 +76,9 @@ constructBalancedTx
7276
stakeDelegDeposits
7377
drepDelegDeposits
7478
shelleyWitSigningKeys = do
75-
BalancedTxBody _ txbody _txBalanceOutput _fee <-
79+
let availableEra = fromMaybe (error "TODO") $ sbeToEra sbe
80+
81+
BalancedTxBody _ unsignedTx _txBalanceOutput _fee <-
7682
makeTransactionBodyAutoBalance
7783
sbe
7884
systemStart
@@ -86,8 +92,13 @@ constructBalancedTx
8692
changeAddr
8793
mOverrideWits
8894

89-
let keyWits = map (makeShelleyKeyWitness sbe txbody) shelleyWitSigningKeys
90-
return $ makeSignedTransaction keyWits txbody
95+
let alternateKeyWits = map (makeKeyWitness availableEra unsignedTx) shelleyWitSigningKeys
96+
signedTx = signTx availableEra [] alternateKeyWits unsignedTx
97+
98+
caseShelleyToAlonzoOrBabbageEraOnwards
99+
(const $ error "constructBalancedTx: TODO Fail")
100+
(\w -> return $ ShelleyTx sbe $ obtainShimConstraints w signedTx)
101+
sbe
91102

92103
data TxInsExistError
93104
= TxInsDoNotExist [TxIn]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module Cardano.Api.Experimental.Eras
2+
( -- * New Era interface
3+
BabbageEra
4+
, ConwayEra
5+
, Era (..)
6+
, UseEra
7+
, AvailableErasToSbe
8+
, SbeToAvailableEras
9+
, ToConstrainedEra
10+
, useEra
11+
, protocolVersionToSbe
12+
, sbeToEra
13+
)
14+
where
15+
16+
import Cardano.Api.Protocol.AvailableEras

0 commit comments

Comments
 (0)