Skip to content

Commit 56e18fb

Browse files
authored
Merge pull request #131 from mlabs-haskell/gergely/vasil-with-latest-wallet
Vasil - update cardano-wallet
2 parents 936f093 + e6e0c4a commit 56e18fb

File tree

5 files changed

+82
-39
lines changed

5 files changed

+82
-39
lines changed

flake.lock

Lines changed: 44 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@
3737
};
3838
cardano-ledger = {
3939
url =
40-
"github:input-output-hk/cardano-ledger/ce3057e0863304ccb3f79d78c77136219dc786c6";
40+
"github:input-output-hk/cardano-ledger/3be8a19083fc13d9261b1640e27dd389b51bb08e";
4141
flake = false;
4242
};
4343
cardano-node = {
4444
url =
45-
"github:input-output-hk/cardano-node/1.35.0";
45+
"github:input-output-hk/cardano-node/c75451f0ffd7a60b5ad6c4263891e6c8acac105a";
4646
flake = false; # we need it to be available in shell
4747
};
4848
cardano-prelude = {
@@ -51,7 +51,7 @@
5151
flake = false;
5252
};
5353
cardano-wallet = {
54-
url = "github:input-output-hk/cardano-wallet/a73d8c9717dc4e174745f8568d6f3fe84f0f9d76";
54+
url = "github:input-output-hk/cardano-wallet/2ac308b00d9d4a3435f6b9594ded9495e2b217eb";
5555
flake = false;
5656
};
5757
ekg-forward = {
@@ -78,7 +78,7 @@
7878
flake = false;
7979
};
8080
hysterical-screams = {
81-
url = "github:raduom/hysterical-screams/f3bbd38a19f99de5c8ddc650c94330b2d09a865b";
81+
url = "github:raduom/hysterical-screams/4c523469e9efd3f0d10d17da3304923b7b0e0674";
8282
flake = false;
8383
};
8484
hw-aeson = {
@@ -107,19 +107,23 @@
107107
};
108108
plutus = {
109109
url =
110-
"github:input-output-hk/plutus/f680ac6979e069fcc013e4389ee607ff5fa6672f";
110+
"github:input-output-hk/plutus/69ab98c384703172f898eb5bcad1078ded521426";
111111
flake = false;
112112
};
113113
plutus-apps = {
114114
url =
115-
"github:input-output-hk/plutus-apps/c2b310968d0915e2af0ea4680186b41ad88ffbe9";
115+
"github:gege251/plutus-apps/62342808fa7422ebea3233a7e031d3aa00c04672";
116116
flake = false;
117117
};
118118
purescript-bridge = {
119119
url =
120120
"github:input-output-hk/purescript-bridge/47a1f11825a0f9445e0f98792f79172efef66c00";
121121
flake = false;
122122
};
123+
quickcheck-dynamic = {
124+
url = "github:input-output-hk/quickcheck-dynamic/c272906361471d684440f76c297e29ab760f6a1e";
125+
flake = false;
126+
};
123127
servant-purescript = {
124128
url =
125129
"github:input-output-hk/servant-purescript/44e7cacf109f84984cd99cd3faf185d161826963";
@@ -206,6 +210,7 @@
206210
src = inputs.cardano-ledger;
207211
subdirs = [
208212
"eras/alonzo/impl"
213+
"eras/alonzo/test-suite"
209214
"eras/babbage/impl"
210215
"eras/byron/chain/executable-spec"
211216
"eras/byron/crypto"
@@ -216,6 +221,7 @@
216221
"eras/shelley/impl"
217222
"eras/shelley/test-suite"
218223
"eras/shelley-ma/impl"
224+
"eras/shelley-ma/test-suite"
219225
"libs/cardano-data"
220226
"libs/cardano-ledger-core"
221227
"libs/cardano-ledger-pretty"
@@ -359,15 +365,20 @@
359365
"plutus-pab"
360366
"plutus-playground-server"
361367
"plutus-script-utils"
368+
"plutus-streaming"
369+
"plutus-tx-constraints"
362370
"plutus-use-cases"
363-
"quickcheck-dynamic"
364371
"web-ghc"
365372
];
366373
}
367374
{
368375
src = inputs.purescript-bridge;
369376
subdirs = [ "." ];
370377
}
378+
{
379+
src = inputs.quickcheck-dynamic;
380+
subdirs = [ "." ];
381+
}
371382
{
372383
src = inputs.servant-purescript;
373384
subdirs = [ "." ];

src/BotPlutusInterface/Balance.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ import Ledger.Tx (
5656
TxOutRef (..),
5757
)
5858
import Ledger.Tx qualified as Tx
59+
import Ledger.Tx.CardanoAPI (CardanoBuildTx)
5960
import Ledger.Value (Value)
6061
import Ledger.Value qualified as Value
6162
import Plutus.V1.Ledger.Api (
@@ -355,9 +356,10 @@ addValidRange ::
355356
forall (w :: Type) (effs :: [Type -> Type]).
356357
Member (PABEffect w) effs =>
357358
POSIXTimeRange ->
358-
Tx ->
359+
Either CardanoBuildTx Tx ->
359360
Eff effs (Either Text Tx)
360-
addValidRange timeRange tx =
361+
addValidRange _ (Left _) = pure $ Left "BPI is not using CardanoBuildTx"
362+
addValidRange timeRange (Right tx) =
361363
if validateRange timeRange
362364
then
363365
bimap (Text.pack . show) (setRange tx)

src/BotPlutusInterface/CardanoCLI.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ import Ledger.Scripts qualified as Scripts
7474
import Ledger.Tx (ChainIndexTxOut, RedeemerPtr (..), Redeemers, ScriptTag (..), Tx (..), TxId (..), TxIn (..), TxInType (..), TxOut (..), TxOutRef (..), txId)
7575
import Ledger.Value (Value)
7676
import Ledger.Value qualified as Value
77-
import Plutus.Contract.CardanoAPI (toCardanoAddress)
77+
import Ledger.Tx.CardanoAPI (toCardanoAddressInEra)
7878
import Plutus.V1.Ledger.Api (
7979
CurrencySymbol (..),
8080
ExBudget (..),
@@ -377,7 +377,7 @@ valueToCliArg val =
377377

378378
unsafeSerialiseAddress :: NetworkId -> Address -> Text
379379
unsafeSerialiseAddress network address =
380-
case serialiseAddress <$> toCardanoAddress network address of
380+
case serialiseAddress <$> toCardanoAddressInEra network address of
381381
Right a -> a
382382
Left _ -> error "Couldn't create address"
383383

src/BotPlutusInterface/Contract.hs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import Data.Aeson.Extras (encodeByteString)
4848
import Data.Aeson.KeyMap qualified as KeyMap
4949
import Data.Function (fix)
5050
import Data.Kind (Type)
51+
import Data.List.NonEmpty (NonEmpty ((:|)))
5152
import Data.Map qualified as Map
5253
import Data.Row (Row)
5354
import Data.Text (Text)
@@ -173,8 +174,13 @@ handlePABReq contractEnv req = do
173174
----------------------
174175
-- Handled requests --
175176
----------------------
176-
OwnPaymentPublicKeyHashReq ->
177-
pure $ OwnPaymentPublicKeyHashResp $ PaymentPubKeyHash contractEnv.cePABConfig.pcOwnPubKeyHash
177+
OwnAddressesReq ->
178+
pure
179+
. OwnAddressesResp
180+
. nonEmptySingleton
181+
$ Ledger.pubKeyHashAddress
182+
(PaymentPubKeyHash contractEnv.cePABConfig.pcOwnPubKeyHash)
183+
contractEnv.cePABConfig.pcOwnStakePubKeyHash
178184
OwnContractInstanceIdReq ->
179185
pure $ OwnContractInstanceIdResp (ceContractInstanceId contractEnv)
180186
ChainIndexQueryReq query ->
@@ -465,3 +471,9 @@ currentTime contractEnv =
465471
currentSlot @w contractEnv
466472
>>= slotToPOSIXTime @w
467473
>>= either (error . show) return
474+
475+
{- | Construct a 'NonEmpty' list from a single element.
476+
Should be replaced by NonEmpty.singleton after updating to base 4.15
477+
-}
478+
nonEmptySingleton :: a -> NonEmpty a
479+
nonEmptySingleton = (:| [])

0 commit comments

Comments
 (0)