Skip to content

Commit

Permalink
Use Cardano.Api.Shelley.fromShelleyMetaData instead of own
Browse files Browse the repository at this point in the history
  • Loading branch information
rvl committed Oct 20, 2020
1 parent 558e296 commit e211098
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions lib/shelley/src/Cardano/Wallet/Shelley/Compatibility.hs
Expand Up @@ -102,6 +102,8 @@ import Cardano.Address.Derivation
( XPub, xpubPublicKey )
import Cardano.Address.Style.Shelley
( inspectShelleyAddress )
import Cardano.Api.Shelley
( fromShelleyMetaData )
import Cardano.Api.Shelley.Genesis
( ShelleyGenesis (..) )
import Cardano.Api.Typed
Expand Down Expand Up @@ -713,18 +715,6 @@ fromShelleyWdrl :: SL.Wdrl crypto -> Map W.ChimericAccount W.Coin
fromShelleyWdrl (SL.Wdrl wdrl) = Map.fromList $
bimap (fromStakeCredential . SL.getRwdCred) fromShelleyCoin <$> Map.toList wdrl

fromShelleyMetadata :: SL.MetaData -> Cardano.TxMetadata
fromShelleyMetadata (SL.MetaData md) = Cardano.makeTransactionMetadata md'
where
md' = fmap convert md
convert :: SL.MetaDatum -> Cardano.TxMetadataValue
convert = \case
SL.I n -> Cardano.TxMetaNumber n
SL.B bs -> Cardano.TxMetaBytes bs
SL.S s -> Cardano.TxMetaText s
SL.Map as -> Cardano.TxMetaMap (bimap convert convert <$> as)
SL.List xs -> Cardano.TxMetaList (map convert xs)

-- Convert & filter Shelley certificate into delegation certificate. Returns
-- 'Nothing' if certificates aren't delegation certificate.
fromShelleyDelegationCert
Expand Down

0 comments on commit e211098

Please sign in to comment.