Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
correct all except one things to make it compile
  • Loading branch information
paweljakubas committed Jul 7, 2020
1 parent 4408776 commit 7062cb4
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 29 deletions.
4 changes: 4 additions & 0 deletions lib/byron/src/Cardano/Wallet/Byron/Compatibility.hs
Expand Up @@ -126,6 +126,10 @@ import Ouroboros.Network.Block
, Point (..)
, SlotNo (..)
, Tip (..)
, blockHash
, blockNo
, blockPrevHash
, blockSlot
, genesisPoint
, getLegacyTipBlockNo
, getTipPoint
Expand Down
2 changes: 2 additions & 0 deletions lib/core/src/Ouroboros/Network/Client/Wallet.hs
Expand Up @@ -77,7 +77,9 @@ import Ouroboros.Network.Block
, Point (..)
, Serialised (..)
, Tip (..)
, blockNo
, blockPoint
, blockSlot
, castTip
, getTipPoint
, pointSlot
Expand Down
4 changes: 2 additions & 2 deletions lib/shelley/src/Cardano/Wallet/Shelley/Compatibility.hs
Expand Up @@ -90,10 +90,10 @@ import Prelude

import Cardano.Address.Derivation
( XPub, xpubPublicKey )
import Cardano.Api.Shelley.Genesis
( ShelleyGenesis (..) )
import Cardano.Binary
( fromCBOR, serialize' )
import Cardano.Config.Shelley.Genesis
( ShelleyGenesis (..) )
import Cardano.Crypto.Hash.Class
( Hash (UnsafeHash), getHash )
import Cardano.Slotting.Slot
Expand Down
4 changes: 2 additions & 2 deletions lib/shelley/src/Cardano/Wallet/Shelley/Launch.hs
Expand Up @@ -41,14 +41,14 @@ module Cardano.Wallet.Shelley.Launch

import Prelude

import Cardano.Api.Shelley.Genesis
( ShelleyGenesis (..) )
import Cardano.BM.Data.Severity
( Severity (..) )
import Cardano.BM.Data.Tracer
( HasPrivacyAnnotation (..), HasSeverityAnnotation (..) )
import Cardano.CLI
( optionT )
import Cardano.Config.Shelley.Genesis
( ShelleyGenesis (..) )
import Cardano.Launcher
( LauncherLog, ProcessHasExited (..) )
import Cardano.Launcher.Node
Expand Down
30 changes: 5 additions & 25 deletions lib/shelley/src/Cardano/Wallet/Shelley/Transaction.hs
Expand Up @@ -94,8 +94,6 @@ import Control.Monad
( forM )
import Crypto.Error
( throwCryptoError )
import Crypto.Hash.Utils
( blake2b256 )
import Data.ByteString
( ByteString )
import Data.Map.Strict
Expand All @@ -116,13 +114,10 @@ import Type.Reflection
( Typeable )

import qualified Cardano.Api as Cardano
import qualified Cardano.Byron.Codec.Cbor as CBOR
import qualified Cardano.Api.Typed as CardanoTyped
import qualified Cardano.Crypto.Hash.Class as Hash
import qualified Cardano.Crypto.Wallet as CC
import qualified Cardano.Wallet.Primitive.CoinSelection as CS
import qualified Cardano.Wallet.Primitive.Types as W
import qualified Codec.CBOR.Read as CBOR
import qualified Codec.CBOR.Write as CBOR
import qualified Crypto.PubKey.Ed25519 as Ed25519
import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy as BL
Expand Down Expand Up @@ -332,26 +327,11 @@ _decodeSignedTx
:: ByteString
-> Either ErrDecodeSignedTx (Tx, SealedTx)
_decodeSignedTx bytes = do
case Cardano.txSignedFromCBOR bytes of
Right (Cardano.TxSignedShelley txValid) ->
case CardanoTyped.deserialiseFromCBOR CardanoTyped.AsShelleyTx bytes of
Right (CardanoTyped.ShelleyTx txValid) ->
pure $ toSealed txValid
Right (Cardano.TxSignedByron{}) ->
case CBOR.deserialiseFromBytes CBOR.decodeSignedTx (BL.fromStrict bytes) of
Left e ->
Left $ ErrDecodeSignedTxWrongPayload $ T.pack $ show e
Right (_, ((inps, outs), _)) -> Right
( W.Tx
{ W.txId = Hash
$ blake2b256
$ CBOR.toStrictByteString
$ CBOR.encodeTx (inps, outs)
, W.resolvedInputs = (,Coin 0) <$> inps
, W.outputs = outs
}
, SealedTx bytes
)
Left apiErr ->
Left $ ErrDecodeSignedTxWrongPayload (Cardano.renderApiError apiErr)
Left decodeErr ->
Left $ ErrDecodeSignedTxWrongPayload (T.pack $ show decodeErr)

_minimumFee
:: forall (n :: NetworkDiscriminant). Typeable n
Expand Down

0 comments on commit 7062cb4

Please sign in to comment.