Skip to content

Commit 7345a74

Browse files
author
gege251
committed
Merge branch 'gergely/wait-slots' of github.com:mlabs-haskell/bot-plutus-interface into gergely/manual-sign
2 parents 8fe4ed0 + c177ea0 commit 7345a74

File tree

17 files changed

+172
-136
lines changed

17 files changed

+172
-136
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ data MyContracts
3939
2. Define a HasDefinitions instance for the endpoints
4040

4141
```haskell
42+
import BotPlutusInterface.Types (HasDefinitions (..), SomeBuiltin (..), endpointsToSchemas)
43+
import Playground.Types (FunctionSchema)
44+
import Schema (FormSchema)
45+
4246
instance HasDefinitions MyContracts where
4347
getDefinitions :: [MyContract]
4448
getDefinitions = []
@@ -61,6 +65,13 @@ instance HasDefinitions MyContracts where
6165
3. Write your main entrypoint for the application, with the preferred configurations
6266

6367
```haskell
68+
import BotPlutusInterface.Types (CLILocation (Local), LogLevel (Debug), PABConfig (..))
69+
import Cardano.Api (NetworkId (Testnet), NetworkMagic (..))
70+
import Data.Aeson qualified as JSON
71+
import Data.ByteString.Lazy qualified as LazyByteString
72+
import Data.Default (def)
73+
import Servant.Client.Core (BaseUrl (BaseUrl), Scheme (Http))
74+
6475
main :: IO ()
6576
main = do
6677
protocolParams <- JSON.decode <$> LazyByteString.readFile "protocol.json"
@@ -72,6 +83,8 @@ main = do
7283
, pcChainIndexUrl = BaseUrl Http "localhost" 9083 ""
7384
, pcPort = 9080
7485
, pcProtocolParams = protocolParams
86+
, -- | Slot configuration of the network, the default value can be used for the mainnet
87+
pcSlotConfig = def
7588
, pcOwnPubKeyHash = "0f45aaf1b2959db6e5ff94dbb1f823bf257680c3c723ac2d49f97546"
7689
, -- Directory name of the script and data files
7790
pcScriptFileDir = "./scripts"

cabal-haskell.nix.project

Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ source-repository-package
1111
plutus-ledger
1212
plutus-ledger-constraints
1313
plutus-pab
14+
plutus-pab-executables
1415
plutus-playground-server
1516
plutus-use-cases
1617
quickcheck-dynamic
1718
web-ghc
18-
tag: 75a581c6eb98d36192ce3d3f86ea60a04bc4a52a
19+
tag: 34fe6eeff441166fee0cd0ceba68c1439f0e93d2
1920

2021
-- The following sections are copied from the 'plutus-pab' repository cabal.project at the revision
2122
-- given above.
@@ -61,6 +62,16 @@ package ouroboros-consensus-cardano
6162
optimization: False
6263
package cardano-api
6364
optimization: False
65+
package cardano-wallet
66+
optimization: False
67+
package cardano-wallet-core
68+
optimization: False
69+
package cardano-wallet-cli
70+
optimization: False
71+
package cardano-wallet-launcher
72+
optimization: False
73+
package cardano-wallet-core-integration
74+
optimization: False
6475

6576
-- Copied from plutus-core
6677
source-repository-package
@@ -83,13 +94,15 @@ source-repository-package
8394
source-repository-package
8495
type: git
8596
location: https://github.com/input-output-hk/cardano-crypto.git
86-
tag: 07397f0e50da97eaa0575d93bee7ac4b2b2576ec
97+
tag: f73079303f663e028288f9f4a9e08bcca39a923e
98+
--sha256: 1n87i15x54s0cjkh3nsxs4r1x016cdw1fypwmr68936n3xxsjn6q
8799

88100
-- Copied from plutus-core
89101
source-repository-package
90102
type: git
91103
location: https://github.com/input-output-hk/cardano-base
92-
tag: 4ea7e2d927c9a7f78ddc69738409a5827ab66b98
104+
tag: 654f5b7c76f7cc57900b4ddc664a82fc3b925fb0
105+
--sha256: 0j4x9zbx5dkww82sqi086h39p456iq5xr476ylmrnpwcpfb4xai4
93106
subdir:
94107
base-deriving-via
95108
binary
@@ -106,7 +119,8 @@ source-repository-package
106119
source-repository-package
107120
type: git
108121
location: https://github.com/input-output-hk/cardano-prelude
109-
tag: fd773f7a58412131512b9f694ab95653ac430852
122+
tag: bb4ed71ba8e587f672d06edf9d2e376f4b055555
123+
--sha256: 00h10l5mmiza9819p9v5q5749nb9pzgi20vpzpy1d34zmh6gf1cj
110124
subdir:
111125
cardano-prelude
112126
cardano-prelude-test
@@ -121,9 +135,11 @@ source-repository-package
121135

122136
source-repository-package
123137
type: git
124-
location: https://github.com/j-mueller/cardano-wallet
125-
tag: 6be73ab852c0592713dfe78218856d4a8a0ee69e
138+
location: https://github.com/input-output-hk/cardano-wallet
139+
tag: 760140e238a5fbca61d1b286d7a80ece058dc729
140+
--sha256: 014njpddrlqm9bbab636h2gf58zkm0bx04i1jsn07vh5j3k0gri6
126141
subdir:
142+
lib/dbvar
127143
lib/text-class
128144
lib/strict-non-empty-containers
129145
lib/core
@@ -137,7 +153,8 @@ source-repository-package
137153
source-repository-package
138154
type: git
139155
location: https://github.com/input-output-hk/ouroboros-network
140-
tag: 1f4973f36f689d6da75b5d351fb124d66ef1057d
156+
tag: d613de3d872ec8b4a5da0c98afb443f322dc4dab
157+
--sha256: 0lfbipfdrzay8v1pcazx0qgkda3d1j0505yig9jrml9j7991rmhl
141158
subdir:
142159
monoidal-synchronisation
143160
typed-protocols
@@ -181,8 +198,9 @@ source-repository-package
181198

182199
source-repository-package
183200
type: git
184-
location: https://github.com/input-output-hk/cardano-ledger-specs
201+
location: https://github.com/input-output-hk/cardano-ledger
185202
tag: bf008ce028751cae9fb0b53c3bef20f07c06e333
203+
--sha256: 0my3801w1vinc0kf5yh9lxl6saqxgwm6ccg0vvzi104pafcwwcqx
186204
subdir:
187205
byron/ledger/impl
188206
cardano-ledger-core
@@ -203,23 +221,13 @@ source-repository-package
203221
libs/cardano-ledger-pretty
204222
semantics/small-steps-test
205223

206-
-- A lot of plutus-apps dependencies have to be synchronized with the dependencies of
207-
-- cardano-node. If you update cardano-node, please make sure that all dependencies
208-
-- of cardano-node are also updated.
209224
source-repository-package
210225
type: git
211226
location: https://github.com/input-output-hk/cardano-node.git
212-
tag: b6ca519f97a0e795611a63174687e6bb70c9f752
227+
tag: 4f65fb9a27aa7e3a1873ab4211e412af780a3648
228+
--sha256: 00k9fqrm0gphjji23x0nc9z6bqh8bqrncgivn3mi3csacjzicrrx
213229
subdir:
214230
cardano-api
215-
cardano-node
216-
cardano-cli
217-
cardano-config
218-
219-
source-repository-package
220-
type: git
221-
location: https://github.com/input-output-hk/optparse-applicative
222-
tag: 7497a29cb998721a9068d5725d49461f2bba0e7a
223231

224232
source-repository-package
225233
type: git
@@ -235,14 +243,14 @@ source-repository-package
235243
-- plutus. If you update plutus, please make sure that all dependencies of plutus
236244
-- are also updated
237245
source-repository-package
238-
type: git
239-
location: https://github.com/input-output-hk/plutus
240-
tag: c8c5183f7facd967d48fe07b3b14465b8dd48fe7
241-
subdir:
242-
plutus-core
243-
plutus-ledger-api
244-
plutus-tx
245-
plutus-tx-plugin
246-
word-array
247-
prettyprinter-configurable
248-
stubs/plutus-ghc-stub
246+
type: git
247+
location: https://github.com/input-output-hk/plutus
248+
tag: 65bad0fd53e432974c3c203b1b1999161b6c2dce
249+
subdir:
250+
plutus-ledger-api
251+
word-array
252+
prettyprinter-configurable
253+
stubs/plutus-ghc-stub
254+
plutus-core
255+
plutus-tx
256+
plutus-tx-plugin

examples/plutus-game/app/Main.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import Cardano.PlutusExample.Game (
2222
import Data.Aeson qualified as JSON
2323
import Data.Aeson.TH (defaultOptions, deriveJSON)
2424
import Data.ByteString.Lazy qualified as LazyByteString
25+
import Data.Default (def)
2526
import Data.Maybe (fromMaybe)
2627
import Playground.Types (FunctionSchema)
2728
import Schema (FormSchema)
@@ -57,6 +58,7 @@ main = do
5758
, pcChainIndexUrl = BaseUrl Http "localhost" 9083 ""
5859
, pcPort = 9080
5960
, pcProtocolParams = protocolParams
61+
, pcSlotConfig = def
6062
, pcOwnPubKeyHash = "0f45aaf1b2959db6e5ff94dbb1f823bf257680c3c723ac2d49f97546"
6163
, pcScriptFileDir = "./scripts"
6264
, pcSigningKeyFileDir = "./signing-keys"

examples/plutus-game/plutus-game.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ executable plutus-game-pab
129129
, bot-plutus-interface
130130
, bytestring
131131
, cardano-api
132+
, data-default
132133
, playground-common
133134
, plutus-game
134135
, plutus-ledger

examples/plutus-nft/app/Main.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import Cardano.PlutusExample.NFT (
2020
import Data.Aeson qualified as JSON
2121
import Data.Aeson.TH (defaultOptions, deriveJSON)
2222
import Data.ByteString.Lazy qualified as LazyByteString
23+
import Data.Default (def)
2324
import Data.Maybe (fromMaybe)
2425
import Ledger.Value (TokenName)
2526
import Playground.Types (FunctionSchema)
@@ -57,6 +58,7 @@ main = do
5758
, pcChainIndexUrl = BaseUrl Http "localhost" 9083 ""
5859
, pcPort = 9080
5960
, pcProtocolParams = protocolParams
61+
, pcSlotConfig = def
6062
, pcOwnPubKeyHash = "0f45aaf1b2959db6e5ff94dbb1f823bf257680c3c723ac2d49f97546"
6163
, pcScriptFileDir = "./scripts"
6264
, pcSigningKeyFileDir = "./signing-keys"

examples/plutus-nft/plutus-nft.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ executable plutus-nft-pab
129129
, bot-plutus-interface
130130
, bytestring
131131
, cardano-api
132+
, data-default
132133
, playground-common
133134
, plutus-ledger
134135
, plutus-nft

examples/plutus-transfer/app/Main.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import Cardano.PlutusExample.Transfer (
2121
import Data.Aeson qualified as JSON
2222
import Data.Aeson.TH (defaultOptions, deriveJSON)
2323
import Data.ByteString.Lazy qualified as LazyByteString
24+
import Data.Default (def)
2425
import Data.Maybe (fromMaybe)
2526
import Playground.Types (FunctionSchema)
2627
import Schema (FormSchema)
@@ -56,6 +57,7 @@ main = do
5657
, pcChainIndexUrl = BaseUrl Http "localhost" 9083 ""
5758
, pcPort = 9080
5859
, pcProtocolParams = protocolParams
60+
, pcSlotConfig = def
5961
, pcOwnPubKeyHash = "0f45aaf1b2959db6e5ff94dbb1f823bf257680c3c723ac2d49f97546"
6062
, pcScriptFileDir = "./scripts"
6163
, pcSigningKeyFileDir = "./signing-keys"

examples/plutus-transfer/plutus-transfer.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ executable plutus-transfer-pab
129129
, bot-plutus-interface
130130
, bytestring
131131
, cardano-api
132+
, data-default
132133
, playground-common
133134
, plutus-ledger
134135
, plutus-transfer

examples/plutus-transfer/src/Cardano/PlutusExample/Transfer.hs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import Data.Aeson.TH (defaultOptions, deriveJSON)
1212
import Data.Bifunctor (first)
1313
import Data.Monoid (Last (Last))
1414
import Data.Text (Text)
15+
import Data.Void (Void)
1516
import GHC.Generics (Generic)
1617
import Ledger hiding (singleton)
1718
import Ledger.Constraints as Constraints
@@ -35,10 +36,12 @@ transfer :: TransferParams -> Contract (Last Text) TransferSchema Text ()
3536
transfer (TransferParams outputPerTx allPayments) = do
3637
tell $ Last $ Just "Contract started"
3738
let txs =
38-
map (mconcat . map (uncurry Constraints.mustPayToPubKey . first PaymentPubKeyHash)) $
39-
group outputPerTx allPayments
39+
map toTx $ group outputPerTx allPayments
4040
forM_ txs $ \tx -> submitTx tx >> waitNSlots 1
4141
tell $ Last $ Just "Finished"
42+
where
43+
toTx :: [(PubKeyHash, Value)] -> TxConstraints Void Void
44+
toTx = mconcat . map (uncurry Constraints.mustPayToPubKey . first PaymentPubKeyHash)
4245

4346
group :: Int -> [a] -> [[a]]
4447
group n list

0 commit comments

Comments
 (0)