Skip to content

Commit

Permalink
Export pabBridge and pabTypes (fix #3325). (#3326)
Browse files Browse the repository at this point in the history
  • Loading branch information
ak3n committed Jun 9, 2021
1 parent ea59a6a commit 989f1ca
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions plutus-pab/app/PSGenerator.hs
Expand Up @@ -11,6 +11,8 @@

module PSGenerator
( generate
, pabBridge
, pabTypes
) where

import Cardano.Metadata.Types (AnnotatedSignature, HashFunction, Property, PropertyKey,
Expand Down Expand Up @@ -54,8 +56,9 @@ import Servant.PureScript (HasBridge, Settings
writeAPIModuleWithSettings)
import Wallet.Effects (AddressChangeRequest (..), AddressChangeResponse (..))

myBridge :: BridgePart
myBridge =
-- | PAB's main bridge that includes common bridges
pabBridge :: BridgePart
pabBridge =
PSGenerator.Common.aesonBridge <|>
PSGenerator.Common.containersBridge <|>
PSGenerator.Common.languageBridge <|>
Expand All @@ -77,16 +80,17 @@ metadataBridge = do
name <- view (haskType . typeName)
pure $ TypeInfo "plutus-pab" moduleName name []

data MyBridge
data PabBridge

myBridgeProxy :: Proxy MyBridge
myBridgeProxy = Proxy
pabBridgeProxy :: Proxy PabBridge
pabBridgeProxy = Proxy

instance HasBridge MyBridge where
languageBridge _ = buildBridge myBridge
instance HasBridge PabBridge where
languageBridge _ = buildBridge pabBridge

myTypes :: [SumType 'Haskell]
myTypes =
-- | PAB's list of types that includes common types
pabTypes :: [SumType 'Haskell]
pabTypes =
PSGenerator.Common.ledgerTypes <>
PSGenerator.Common.playgroundTypes <>
PSGenerator.Common.walletTypes <>
Expand Down Expand Up @@ -149,11 +153,11 @@ generate outputDir = do
writeAPIModuleWithSettings
mySettings
outputDir
myBridgeProxy
pabBridgeProxy
(Proxy @(API.API ContractExe :<|> API.NewAPI ContractExe Text.Text :<|> (API.WalletProxy Text.Text)))
writePSTypesWith
(genForeign (ForeignOptions {unwrapSingleConstructors = True}))
outputDir
(buildBridge myBridge)
myTypes
(buildBridge pabBridge)
pabTypes
putStrLn $ "Done: " <> outputDir

0 comments on commit 989f1ca

Please sign in to comment.