File tree Expand file tree Collapse file tree 16 files changed +204
-73
lines changed
src/Cardano/PlutusExample Expand file tree Collapse file tree 16 files changed +204
-73
lines changed Original file line number Diff line number Diff line change @@ -112,6 +112,7 @@ library
112112 , plutus-core
113113 , plutus-ledger
114114 , plutus-ledger-api
115+ , plutus-ledger-constraints
115116 , plutus-pab
116117 , plutus-tx
117118 , plutus-tx-plugin
@@ -170,6 +171,7 @@ test-suite bot-plutus-interface-test
170171 , plutus-core
171172 , plutus-ledger
172173 , plutus-ledger-api
174+ , plutus-ledger-constraints
173175 , plutus-pab
174176 , plutus-tx
175177 , plutus-tx-plugin
Original file line number Diff line number Diff line change @@ -9,12 +9,13 @@ source-repository-package
99 plutus-chain-index-core
1010 plutus-contract
1111 plutus-ledger
12+ plutus-ledger-constraints
1213 plutus-pab
1314 plutus-playground-server
1415 plutus-use-cases
1516 quickcheck-dynamic
1617 web-ghc
17- tag: 7f7aca8500105d3a0830b40627f1821c9ac7b58e
18+ tag: 75a581c6eb98d36192ce3d3f86ea60a04bc4a52a
1819
1920-- The following sections are copied from the 'plutus-pab' repository cabal.project at the revision
2021-- given above.
@@ -236,7 +237,7 @@ source-repository-package
236237source-repository-package
237238 type: git
238239 location: https://github.com/input-output-hk/plutus
239- tag: 3f089ccf0ca746b399c99afe51e063b0640af547
240+ tag: c8c5183f7facd967d48fe07b3b14465b8dd48fe7
240241 subdir:
241242 plutus-core
242243 plutus-ledger-api
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import Cardano.PlutusExample.Game (
2222import Data.Aeson qualified as JSON
2323import Data.Aeson.TH (defaultOptions , deriveJSON )
2424import Data.ByteString.Lazy qualified as LazyByteString
25+ import Data.Maybe (fromMaybe )
2526import Playground.Types (FunctionSchema )
2627import Schema (FormSchema )
2728import Servant.Client.Core (BaseUrl (BaseUrl ), Scheme (Http ))
@@ -46,7 +47,9 @@ $(deriveJSON defaultOptions ''GameContracts)
4647
4748main :: IO ()
4849main = do
49- protocolParams <- JSON. decode <$> LazyByteString. readFile " protocol.json"
50+ protocolParams <-
51+ fromMaybe (error " protocol.json file not found" ) . JSON. decode
52+ <$> LazyByteString. readFile " protocol.json"
5053 let pabConf =
5154 PABConfig
5255 { pcCliLocation = Local
Original file line number Diff line number Diff line change @@ -74,9 +74,9 @@ library
7474 import : common-lang
7575 exposed-modules : Cardano.PlutusExample.Game
7676 build-depends :
77- , aeson ^>= 1.5.0.0
78- , attoparsec >= 0.13.2.2
79- , bytestring ^>= 0.10.12.0
77+ , aeson ^>= 1.5.0.0
78+ , attoparsec >= 0.13.2.2
79+ , bytestring ^>= 0.10.12.0
8080 , cardano-api
8181 , cardano-crypto
8282 , cardano-ledger-alonzo
@@ -99,6 +99,7 @@ library
9999 , plutus-core
100100 , plutus-ledger
101101 , plutus-ledger-api
102+ , plutus-ledger-constraints
102103 , plutus-pab
103104 , plutus-tx
104105 , plutus-tx-plugin
@@ -111,7 +112,7 @@ library
111112 , servant-websockets
112113 , split
113114 , stm
114- , text ^>= 1.2.4.0
115+ , text ^>= 1.2.4.0
115116 , transformers
116117 , transformers-either
117118 , uuid
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import Cardano.PlutusExample.NFT (
2020import Data.Aeson qualified as JSON
2121import Data.Aeson.TH (defaultOptions , deriveJSON )
2222import Data.ByteString.Lazy qualified as LazyByteString
23+ import Data.Maybe (fromMaybe )
2324import Ledger.Value (TokenName )
2425import Playground.Types (FunctionSchema )
2526import Schema (FormSchema )
@@ -46,7 +47,9 @@ $(deriveJSON defaultOptions ''MintNFTContracts)
4647
4748main :: IO ()
4849main = do
49- protocolParams <- JSON. decode <$> LazyByteString. readFile " protocol.json"
50+ protocolParams <-
51+ fromMaybe (error " protocol.json file not found" ) . JSON. decode
52+ <$> LazyByteString. readFile " protocol.json"
5053 let pabConf =
5154 PABConfig
5255 { pcCliLocation = Local
Original file line number Diff line number Diff line change @@ -74,9 +74,9 @@ library
7474 import : common-lang
7575 exposed-modules : Cardano.PlutusExample.NFT
7676 build-depends :
77- , aeson ^>= 1.5.0.0
78- , attoparsec >= 0.13.2.2
79- , bytestring ^>= 0.10.12.0
77+ , aeson ^>= 1.5.0.0
78+ , attoparsec >= 0.13.2.2
79+ , bytestring ^>= 0.10.12.0
8080 , cardano-api
8181 , cardano-crypto
8282 , cardano-ledger-alonzo
@@ -99,6 +99,7 @@ library
9999 , plutus-core
100100 , plutus-ledger
101101 , plutus-ledger-api
102+ , plutus-ledger-constraints
102103 , plutus-pab
103104 , plutus-tx
104105 , plutus-tx-plugin
@@ -111,7 +112,7 @@ library
111112 , servant-websockets
112113 , split
113114 , stm
114- , text ^>= 1.2.4.0
115+ , text ^>= 1.2.4.0
115116 , transformers
116117 , transformers-either
117118 , uuid
Original file line number Diff line number Diff line change @@ -65,8 +65,8 @@ type NFTSchema =
6565
6666mintNft :: TokenName -> Contract (Last Text ) NFTSchema Text ()
6767mintNft tn = do
68- pkh <- Contract. ownPubKeyHash
69- utxos <- utxosAt (pubKeyHashAddress pkh)
68+ pkh <- Contract. ownPaymentPubKeyHash
69+ utxos <- utxosAt (pubKeyHashAddress pkh Nothing )
7070 tell $ Last $ Just " Contract started with "
7171 case Map. keys utxos of
7272 [] -> Contract. logError @ String " no utxo found"
Original file line number Diff line number Diff line change 235235 "homepage" : " " ,
236236 "owner" : " input-output-hk" ,
237237 "repo" : " plutus" ,
238- "rev" : " 3f089ccf0ca746b399c99afe51e063b0640af547 " ,
239- "sha256" : " 1nx8xmdgwmnsla4qg4k67f5md8vm3p1p9i25ndalrqdg40z90486 " ,
238+ "rev" : " c8c5183f7facd967d48fe07b3b14465b8dd48fe7 " ,
239+ "sha256" : " 01fmakdp589h9nllc31s3mkys6gic6ba38s9r3ycfb9r1j5n1cja " ,
240240 "type" : " tarball" ,
241- "url" : " https://github.com/input-output-hk/plutus/archive/3f089ccf0ca746b399c99afe51e063b0640af547 .tar.gz" ,
241+ "url" : " https://github.com/input-output-hk/plutus/archive/c8c5183f7facd967d48fe07b3b14465b8dd48fe7 .tar.gz" ,
242242 "url_template" : " https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
243243 },
244244 "plutus-apps" : {
247247 "homepage" : null ,
248248 "owner" : " input-output-hk" ,
249249 "repo" : " plutus-apps" ,
250- "rev" : " 7f7aca8500105d3a0830b40627f1821c9ac7b58e " ,
251- "sha256" : " 1zn8mhwdwk5ya0i4x8pj906glica62y5pi95l26nav4xldwj8zv0 " ,
250+ "rev" : " 75a581c6eb98d36192ce3d3f86ea60a04bc4a52a " ,
251+ "sha256" : " 06f0ghj3v2q6gh73kgsr3vqbhr7f7gkbar0c9ry3jmmxny30q6dv " ,
252252 "type" : " tarball" ,
253- "url" : " https://github.com/input-output-hk/plutus-apps/archive/7f7aca8500105d3a0830b40627f1821c9ac7b58e .tar.gz" ,
253+ "url" : " https://github.com/input-output-hk/plutus-apps/archive/75a581c6eb98d36192ce3d3f86ea60a04bc4a52a .tar.gz" ,
254254 "url_template" : " https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
255255 },
256256 "purescript-bridge" : {
Original file line number Diff line number Diff line change @@ -181,7 +181,7 @@ buildTx ::
181181buildTx pabConf ownPkh buildMode tx =
182182 callCommand @ w $ ShellArgs " cardano-cli" opts (const () )
183183 where
184- ownAddr = Ledger. pubKeyHashAddress ownPkh
184+ ownAddr = Ledger. pubKeyHashAddress ( Ledger. PaymentPubKeyHash ownPkh) Nothing
185185 requiredSigners =
186186 concatMap
187187 (\ pubKey -> [" --required-signer" , signingKeyFilePath pabConf (Ledger. pubKeyHash pubKey)])
Original file line number Diff line number Diff line change @@ -6,7 +6,11 @@ import BotPlutusInterface.Types (PABConfig)
66import Data.Kind (Type )
77import Network.HTTP.Client (defaultManagerSettings , newManager )
88import Network.HTTP.Types (Status (statusCode ))
9- import Plutus.ChainIndex.Api (UtxoAtAddressRequest (UtxoAtAddressRequest ), UtxoWithCurrencyRequest (UtxoWithCurrencyRequest ))
9+ import Plutus.ChainIndex.Api (
10+ TxoAtAddressRequest (TxoAtAddressRequest ),
11+ UtxoAtAddressRequest (UtxoAtAddressRequest ),
12+ UtxoWithCurrencyRequest (UtxoWithCurrencyRequest ),
13+ )
1014import Plutus.ChainIndex.Client qualified as ChainIndexClient
1115import Plutus.Contract.Effects (ChainIndexQuery (.. ), ChainIndexResponse (.. ))
1216import Servant.Client (
@@ -52,6 +56,12 @@ handleChainIndexReq pabConf = \case
5256 (ChainIndexClient. getUtxoSetWithCurrency (UtxoWithCurrencyRequest (Just page) assetClass))
5357 GetTip ->
5458 GetTipResponse <$> chainIndexQueryMany pabConf ChainIndexClient. getTip
59+ TxsFromTxIds txIds -> TxIdsResponse <$> chainIndexQueryMany pabConf (ChainIndexClient. getTxs txIds)
60+ TxoSetAtAddress page credential ->
61+ TxoSetAtResponse
62+ <$> chainIndexQueryMany
63+ pabConf
64+ (ChainIndexClient. getTxoSetAtAddress (TxoAtAddressRequest (Just page) credential))
5565
5666chainIndexQuery' :: forall (a :: Type ). PABConfig -> ClientM a -> IO (Either ClientError a )
5767chainIndexQuery' pabConf endpoint = do
You can’t perform that action at this time.
0 commit comments