Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vasil - update cardano-wallet #131

Merged
merged 4 commits into from
Jul 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 44 additions & 26 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 18 additions & 7 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
};
cardano-ledger = {
url =
"github:input-output-hk/cardano-ledger/ce3057e0863304ccb3f79d78c77136219dc786c6";
"github:input-output-hk/cardano-ledger/3be8a19083fc13d9261b1640e27dd389b51bb08e";
flake = false;
};
cardano-node = {
url =
"github:input-output-hk/cardano-node/1.35.0";
"github:input-output-hk/cardano-node/c75451f0ffd7a60b5ad6c4263891e6c8acac105a";
flake = false; # we need it to be available in shell
};
cardano-prelude = {
Expand All @@ -51,7 +51,7 @@
flake = false;
};
cardano-wallet = {
url = "github:input-output-hk/cardano-wallet/a73d8c9717dc4e174745f8568d6f3fe84f0f9d76";
url = "github:input-output-hk/cardano-wallet/2ac308b00d9d4a3435f6b9594ded9495e2b217eb";
flake = false;
};
ekg-forward = {
Expand All @@ -78,7 +78,7 @@
flake = false;
};
hysterical-screams = {
url = "github:raduom/hysterical-screams/f3bbd38a19f99de5c8ddc650c94330b2d09a865b";
url = "github:raduom/hysterical-screams/4c523469e9efd3f0d10d17da3304923b7b0e0674";
flake = false;
};
hw-aeson = {
Expand Down Expand Up @@ -107,19 +107,23 @@
};
plutus = {
url =
"github:input-output-hk/plutus/f680ac6979e069fcc013e4389ee607ff5fa6672f";
"github:input-output-hk/plutus/69ab98c384703172f898eb5bcad1078ded521426";
flake = false;
};
plutus-apps = {
url =
"github:input-output-hk/plutus-apps/c2b310968d0915e2af0ea4680186b41ad88ffbe9";
"github:gege251/plutus-apps/62342808fa7422ebea3233a7e031d3aa00c04672";
flake = false;
};
purescript-bridge = {
url =
"github:input-output-hk/purescript-bridge/47a1f11825a0f9445e0f98792f79172efef66c00";
flake = false;
};
quickcheck-dynamic = {
url = "github:input-output-hk/quickcheck-dynamic/c272906361471d684440f76c297e29ab760f6a1e";
flake = false;
};
servant-purescript = {
url =
"github:input-output-hk/servant-purescript/44e7cacf109f84984cd99cd3faf185d161826963";
Expand Down Expand Up @@ -206,6 +210,7 @@
src = inputs.cardano-ledger;
subdirs = [
"eras/alonzo/impl"
"eras/alonzo/test-suite"
"eras/babbage/impl"
"eras/byron/chain/executable-spec"
"eras/byron/crypto"
Expand All @@ -216,6 +221,7 @@
"eras/shelley/impl"
"eras/shelley/test-suite"
"eras/shelley-ma/impl"
"eras/shelley-ma/test-suite"
"libs/cardano-data"
"libs/cardano-ledger-core"
"libs/cardano-ledger-pretty"
Expand Down Expand Up @@ -359,15 +365,20 @@
"plutus-pab"
"plutus-playground-server"
"plutus-script-utils"
"plutus-streaming"
"plutus-tx-constraints"
"plutus-use-cases"
"quickcheck-dynamic"
"web-ghc"
];
}
{
src = inputs.purescript-bridge;
subdirs = [ "." ];
}
{
src = inputs.quickcheck-dynamic;
subdirs = [ "." ];
}
{
src = inputs.servant-purescript;
subdirs = [ "." ];
Expand Down
6 changes: 4 additions & 2 deletions src/BotPlutusInterface/Balance.hs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import Ledger.Tx (
TxOutRef (..),
)
import Ledger.Tx qualified as Tx
import Ledger.Tx.CardanoAPI (CardanoBuildTx)
import Ledger.Value (Value)
import Ledger.Value qualified as Value
import Plutus.V1.Ledger.Api (
Expand Down Expand Up @@ -355,9 +356,10 @@ addValidRange ::
forall (w :: Type) (effs :: [Type -> Type]).
Member (PABEffect w) effs =>
POSIXTimeRange ->
Tx ->
Either CardanoBuildTx Tx ->
Eff effs (Either Text Tx)
addValidRange timeRange tx =
addValidRange _ (Left _) = pure $ Left "BPI is not using CardanoBuildTx"
addValidRange timeRange (Right tx) =
if validateRange timeRange
then
bimap (Text.pack . show) (setRange tx)
Expand Down
4 changes: 2 additions & 2 deletions src/BotPlutusInterface/CardanoCLI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ import Ledger.Scripts qualified as Scripts
import Ledger.Tx (ChainIndexTxOut, RedeemerPtr (..), Redeemers, ScriptTag (..), Tx (..), TxId (..), TxIn (..), TxInType (..), TxOut (..), TxOutRef (..), txId)
import Ledger.Value (Value)
import Ledger.Value qualified as Value
import Plutus.Contract.CardanoAPI (toCardanoAddress)
import Ledger.Tx.CardanoAPI (toCardanoAddressInEra)
import Plutus.V1.Ledger.Api (
CurrencySymbol (..),
ExBudget (..),
Expand Down Expand Up @@ -377,7 +377,7 @@ valueToCliArg val =

unsafeSerialiseAddress :: NetworkId -> Address -> Text
unsafeSerialiseAddress network address =
case serialiseAddress <$> toCardanoAddress network address of
case serialiseAddress <$> toCardanoAddressInEra network address of
Right a -> a
Left _ -> error "Couldn't create address"

Expand Down
16 changes: 14 additions & 2 deletions src/BotPlutusInterface/Contract.hs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import Data.Aeson.Extras (encodeByteString)
import Data.Aeson.KeyMap qualified as KeyMap
import Data.Function (fix)
import Data.Kind (Type)
import Data.List.NonEmpty (NonEmpty ((:|)))
import Data.Map qualified as Map
import Data.Row (Row)
import Data.Text (Text)
Expand Down Expand Up @@ -173,8 +174,13 @@ handlePABReq contractEnv req = do
----------------------
-- Handled requests --
----------------------
OwnPaymentPublicKeyHashReq ->
pure $ OwnPaymentPublicKeyHashResp $ PaymentPubKeyHash contractEnv.cePABConfig.pcOwnPubKeyHash
OwnAddressesReq ->
pure
. OwnAddressesResp
. nonEmptySingleton
$ Ledger.pubKeyHashAddress
(PaymentPubKeyHash contractEnv.cePABConfig.pcOwnPubKeyHash)
contractEnv.cePABConfig.pcOwnStakePubKeyHash
OwnContractInstanceIdReq ->
pure $ OwnContractInstanceIdResp (ceContractInstanceId contractEnv)
ChainIndexQueryReq query ->
Expand Down Expand Up @@ -465,3 +471,9 @@ currentTime contractEnv =
currentSlot @w contractEnv
>>= slotToPOSIXTime @w
>>= either (error . show) return

{- | Construct a 'NonEmpty' list from a single element.
Should be replaced by NonEmpty.singleton after updating to base 4.15
-}
nonEmptySingleton :: a -> NonEmpty a
nonEmptySingleton = (:| [])