From 01a5ee717d1ec94f3f0b0ef2ef8e64c98c1fc67a Mon Sep 17 00:00:00 2001 From: Dzmitry Shuysky Date: Fri, 2 Aug 2024 17:46:59 +0200 Subject: [PATCH] Add KnownWallet helper --- Makefile | 2 +- examples/AdditionalUtxos.purs | 5 +- examples/AlwaysMints.purs | 5 +- examples/AlwaysSucceeds.purs | 5 +- examples/AwaitTxConfirmedWithTimeout.purs | 5 +- examples/ByUrl.purs | 85 ++++++++----------- examples/Cip30.purs | 5 +- examples/DropTokens.purs | 5 +- examples/ExUnits.purs | 5 +- examples/Gov/DelegateVoteAbstain.purs | 5 +- examples/Gov/ManageDrep.purs | 5 +- examples/Gov/ManageDrepScript.purs | 5 +- examples/Gov/SubmitVote.purs | 5 +- examples/Gov/SubmitVoteScript.purs | 5 +- examples/IncludeDatum.purs | 5 +- examples/Lose7Ada.purs | 5 +- examples/ManyAssets.purs | 5 +- examples/MintsMultipleTokens.purs | 5 +- examples/NativeScriptMints.purs | 5 +- examples/OneShotMinting.purs | 11 ++- examples/PaysWithDatum.purs | 5 +- examples/Pkh2Pkh.purs | 5 +- examples/PlutusV2/AlwaysSucceeds.purs | 21 ++--- examples/PlutusV2/InlineDatum.purs | 5 +- examples/PlutusV2/OneShotMinting.purs | 12 ++- .../PlutusV2/ReferenceInputsAndScripts.purs | 5 +- examples/SendsToken.purs | 5 +- examples/SignData.purs | 5 +- examples/SignMultiple.purs | 9 +- examples/TxChaining.purs | 5 +- examples/Utxos.purs | 5 +- src/Contract/Config.purs | 2 + src/Contract/Wallet.purs | 4 +- src/Internal/Wallet/Spec.purs | 20 ++++- test/Testnet/Contract.purs | 44 +++++----- 35 files changed, 207 insertions(+), 128 deletions(-) diff --git a/Makefile b/Makefile index 0bc1a80a0..265946a7b 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ purs-args := "--stash --censor-lib --censor-codes=UserDefinedWarning,ImplicitImp ### Bundler setup # The main Purescript module -ps-entrypoint := Ctl.Examples.ByUrl +ps-entrypoint := Ctl.Examples.Gov.SubmitVoteScript # The entry point function in the main PureScript module ps-entrypoint-function := main # Whether to bundle for the browser ("1") or the node ("") diff --git a/examples/AdditionalUtxos.purs b/examples/AdditionalUtxos.purs index 8ef60f44d..7a8780ca3 100644 --- a/examples/AdditionalUtxos.purs +++ b/examples/AdditionalUtxos.purs @@ -30,8 +30,10 @@ import Contract.BalanceTxConstraints ) import Contract.Config ( ContractParams + , KnownWallet(Nami) , WalletSpec(ConnectToGenericCip30) , testnetConfig + , walletName ) import Contract.Log (logInfo') import Contract.Monad (Contract, launchAff_, runContract) @@ -58,7 +60,8 @@ import Test.QuickCheck.Gen (randomSampleOne) main :: Effect Unit main = example $ testnetConfig - { walletSpec = Just $ ConnectToGenericCip30 "nami" { cip95: false } + { walletSpec = + Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false } } example :: ContractParams -> Effect Unit diff --git a/examples/AlwaysMints.purs b/examples/AlwaysMints.purs index f4358e556..fcbe98752 100644 --- a/examples/AlwaysMints.purs +++ b/examples/AlwaysMints.purs @@ -23,8 +23,10 @@ import Cardano.Types.RedeemerDatum as RedeemerDatum import Cardano.Types.Transaction as Transaction import Contract.Config ( ContractParams + , KnownWallet(Nami) , WalletSpec(ConnectToGenericCip30) , testnetConfig + , walletName ) import Contract.Log (logInfo') import Contract.Monad (Contract, launchAff_, liftContractM, runContract) @@ -35,7 +37,8 @@ import Data.Map as Map main :: Effect Unit main = example $ testnetConfig - { walletSpec = Just $ ConnectToGenericCip30 "nami" { cip95: false } + { walletSpec = + Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false } } contract :: Contract Unit diff --git a/examples/AlwaysSucceeds.purs b/examples/AlwaysSucceeds.purs index a5fb25b88..5e2041ad7 100644 --- a/examples/AlwaysSucceeds.purs +++ b/examples/AlwaysSucceeds.purs @@ -38,8 +38,10 @@ import Cardano.Types.TransactionUnspentOutput (toUtxoMap) import Contract.Address (mkAddress) import Contract.Config ( ContractParams + , KnownWallet(Nami) , WalletSpec(ConnectToGenericCip30) , testnetConfig + , walletName ) import Contract.Log (logInfo') import Contract.Monad (Contract, launchAff_, runContract) @@ -59,7 +61,8 @@ import Effect.Exception (error) main :: Effect Unit main = example $ testnetConfig - { walletSpec = Just $ ConnectToGenericCip30 "nami" { cip95: false } + { walletSpec = + Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false } } contract :: Contract Unit diff --git a/examples/AwaitTxConfirmedWithTimeout.purs b/examples/AwaitTxConfirmedWithTimeout.purs index 6aff846d1..d465229f8 100644 --- a/examples/AwaitTxConfirmedWithTimeout.purs +++ b/examples/AwaitTxConfirmedWithTimeout.purs @@ -13,8 +13,10 @@ import Contract.Prelude import Cardano.AsCbor (decodeCbor) import Contract.Config ( ContractParams + , KnownWallet(Nami) , WalletSpec(ConnectToGenericCip30) , testnetConfig + , walletName ) import Contract.Log (logInfo') import Contract.Monad (Contract, launchAff_, runContract, throwContractError) @@ -25,7 +27,8 @@ import Partial.Unsafe (unsafePartial) main :: Effect Unit main = example $ testnetConfig - { walletSpec = Just $ ConnectToGenericCip30 "nami" { cip95: false } + { walletSpec = + Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false } } example :: ContractParams -> Effect Unit diff --git a/examples/ByUrl.purs b/examples/ByUrl.purs index 25c7645cd..57ef2b7a2 100644 --- a/examples/ByUrl.purs +++ b/examples/ByUrl.purs @@ -4,12 +4,14 @@ import Prelude import Contract.Config ( ContractParams + , KnownWallet(Nami, Gero, Flint, Eternl, Lode, Lace, NuFi) , WalletSpec(ConnectToGenericCip30) , blockfrostPublicPreprodServerConfig , blockfrostPublicPreviewServerConfig , mainnetConfig , mkBlockfrostBackendParams , testnetConfig + , walletName ) import Contract.Log (logInfo') import Contract.Monad (Contract) @@ -50,25 +52,6 @@ import Web.HTML (window) import Web.HTML.Window (localStorage) import Web.Storage.Storage (getItem) -data Wallet - = NamiWallet - | GeroWallet - | FlintWallet - | EternlWallet - | LodeWallet - | LaceWallet - | NuFiWallet - -walletName :: Wallet -> String -walletName = case _ of - NamiWallet -> "nami" - GeroWallet -> "gerowallet" - FlintWallet -> "flint" - EternlWallet -> "eternl" - LodeWallet -> "LodeWallet" - LaceWallet -> "lace" - NuFiWallet -> "nufi" - main :: Effect Unit main = do -- Read Blockfrost API key from the browser storage. @@ -84,59 +67,59 @@ main = do Map.fromFoldable [ "blockfrost-nami-preview" /\ (mkBlockfrostPreviewConfig mbApiKey) - { walletSpec = connectTo NamiWallet } + { walletSpec = connectTo Nami } /\ Nothing , "blockfrost-gero-preview" /\ (mkBlockfrostPreviewConfig mbApiKey) - { walletSpec = connectTo GeroWallet } + { walletSpec = connectTo Gero } /\ Nothing , "blockfrost-eternl-preview" /\ (mkBlockfrostPreviewConfig mbApiKey) - { walletSpec = connectTo EternlWallet } + { walletSpec = connectTo Eternl } /\ Nothing , "blockfrost-lode-preview" /\ (mkBlockfrostPreviewConfig mbApiKey) - { walletSpec = connectTo LodeWallet } + { walletSpec = connectTo Lode } /\ Nothing , "blockfrost-flint-preview" /\ (mkBlockfrostPreviewConfig mbApiKey) - { walletSpec = connectTo FlintWallet } + { walletSpec = connectTo Flint } /\ Nothing , "blockfrost-nufi-preview" /\ (mkBlockfrostPreviewConfig mbApiKey) - { walletSpec = connectTo NuFiWallet } + { walletSpec = connectTo NuFi } /\ Nothing , "blockfrost-lace-preview" /\ (mkBlockfrostPreviewConfig mbApiKey) - { walletSpec = connectTo LaceWallet } + { walletSpec = connectTo Lace } /\ Nothing , "blockfrost-nami-preprod" /\ (mkBlockfrostPreprodConfig mbApiKey) - { walletSpec = connectTo NamiWallet } + { walletSpec = connectTo Nami } /\ Nothing , "blockfrost-gero-preprod" /\ (mkBlockfrostPreprodConfig mbApiKey) - { walletSpec = connectTo GeroWallet } + { walletSpec = connectTo Gero } /\ Nothing , "blockfrost-eternl-preprod" /\ (mkBlockfrostPreprodConfig mbApiKey) - { walletSpec = connectTo EternlWallet } + { walletSpec = connectTo Eternl } /\ Nothing , "blockfrost-lode-preprod" /\ (mkBlockfrostPreprodConfig mbApiKey) - { walletSpec = connectTo LodeWallet } + { walletSpec = connectTo Lode } /\ Nothing , "blockfrost-flint-preprod" /\ (mkBlockfrostPreprodConfig mbApiKey) - { walletSpec = connectTo FlintWallet } + { walletSpec = connectTo Flint } /\ Nothing , "blockfrost-nufi-preprod" /\ (mkBlockfrostPreprodConfig mbApiKey) - { walletSpec = connectTo NuFiWallet } + { walletSpec = connectTo NuFi } /\ Nothing , "blockfrost-lace-preprod" /\ (mkBlockfrostPreprodConfig mbApiKey) - { walletSpec = connectTo LaceWallet } + { walletSpec = connectTo Lace } /\ Nothing ] addLinks walletsWithBlockfrost examples @@ -155,26 +138,26 @@ getBlockfrostApiKey = do wallets :: Map E2EConfigName (ContractParams /\ Maybe String) wallets = map (map walletName) <$> Map.fromFoldable - [ "nami" /\ testnetConfig' NamiWallet /\ Nothing - , "gero" /\ testnetConfig' GeroWallet /\ Nothing - , "flint" /\ testnetConfig' FlintWallet /\ Nothing - , "eternl" /\ testnetConfig' EternlWallet /\ Nothing - , "lode" /\ testnetConfig' LodeWallet /\ Nothing - , "nufi" /\ testnetConfig' NuFiWallet /\ Nothing - , "lace" /\ testnetConfig' LaceWallet /\ Nothing + [ "nami" /\ testnetConfig' Nami /\ Nothing + , "gero" /\ testnetConfig' Gero /\ Nothing + , "flint" /\ testnetConfig' Flint /\ Nothing + , "eternl" /\ testnetConfig' Eternl /\ Nothing + , "lode" /\ testnetConfig' Lode /\ Nothing + , "nufi" /\ testnetConfig' NuFi /\ Nothing + , "lace" /\ testnetConfig' Lace /\ Nothing , "nami-mainnet" /\ mainnetNamiConfig /\ Nothing - , "nami-mock" /\ testnetConfig' NamiWallet /\ Just NamiWallet - , "gero-mock" /\ testnetConfig' GeroWallet /\ Just GeroWallet - , "flint-mock" /\ testnetConfig' FlintWallet /\ Just FlintWallet - , "lode-mock" /\ testnetConfig' LodeWallet /\ Just LodeWallet - , "plutip-nami-mock" /\ testnetConfig' NamiWallet /\ Just NamiWallet - , "plutip-gero-mock" /\ testnetConfig' GeroWallet /\ Just GeroWallet - , "plutip-flint-mock" /\ testnetConfig' FlintWallet /\ Just FlintWallet - , "plutip-lode-mock" /\ testnetConfig' LodeWallet /\ Just LodeWallet - , "plutip-nufi-mock" /\ testnetConfig' NuFiWallet /\ Just NuFiWallet + , "nami-mock" /\ testnetConfig' Nami /\ Just Nami + , "gero-mock" /\ testnetConfig' Gero /\ Just Gero + , "flint-mock" /\ testnetConfig' Flint /\ Just Flint + , "lode-mock" /\ testnetConfig' Lode /\ Just Lode + , "plutip-nami-mock" /\ testnetConfig' Nami /\ Just Nami + , "plutip-gero-mock" /\ testnetConfig' Gero /\ Just Gero + , "plutip-flint-mock" /\ testnetConfig' Flint /\ Just Flint + , "plutip-lode-mock" /\ testnetConfig' Lode /\ Just Lode + , "plutip-nufi-mock" /\ testnetConfig' NuFi /\ Just NuFi ] where - testnetConfig' :: Wallet -> ContractParams + testnetConfig' :: KnownWallet -> ContractParams testnetConfig' wallet = testnetConfig { walletSpec = @@ -185,7 +168,7 @@ wallets = map (map walletName) <$> Map.fromFoldable mainnetNamiConfig = mainnetConfig { walletSpec = - Just $ ConnectToGenericCip30 (walletName NamiWallet) { cip95: false } + Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false } } mkBlockfrostPreviewConfig :: Maybe String -> ContractParams diff --git a/examples/Cip30.purs b/examples/Cip30.purs index ec7e82464..eb45938f2 100644 --- a/examples/Cip30.purs +++ b/examples/Cip30.purs @@ -17,8 +17,10 @@ import Cardano.Wallet.Cip30 import Cardano.Wallet.Cip30.TypeSafe as Cip30 import Contract.Config ( ContractParams + , KnownWallet(Nami) , WalletSpec(ConnectToGenericCip30) , testnetConfig + , walletName ) import Contract.Log (logInfo') import Contract.Monad (Contract, launchAff_, liftContractAffM, runContract) @@ -35,7 +37,8 @@ import Effect.Exception (error) main :: Effect Unit main = example $ testnetConfig - { walletSpec = Just $ ConnectToGenericCip30 "nami" { cip95: false } + { walletSpec = + Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false } } example :: ContractParams -> Effect Unit diff --git a/examples/DropTokens.purs b/examples/DropTokens.purs index 99a2f1fc6..5381ddf79 100644 --- a/examples/DropTokens.purs +++ b/examples/DropTokens.purs @@ -8,8 +8,10 @@ import Cardano.Types.MultiAsset as MultiAsset import Cardano.Types.Value as Value import Contract.Config ( ContractParams + , KnownWallet(Nami) , WalletSpec(ConnectToGenericCip30) , testnetConfig + , walletName ) import Contract.Log (logInfo') import Contract.Monad (Contract, launchAff_, runContract) @@ -25,7 +27,8 @@ import Test.Ctl.Fixtures (nullPaymentPubKeyHash) main :: Effect Unit main = example $ testnetConfig - { walletSpec = Just $ ConnectToGenericCip30 "nami" { cip95: false } + { walletSpec = + Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false } } example :: ContractParams -> Effect Unit diff --git a/examples/ExUnits.purs b/examples/ExUnits.purs index e39efb4f1..1fdb5dfa0 100644 --- a/examples/ExUnits.purs +++ b/examples/ExUnits.purs @@ -20,8 +20,10 @@ import Cardano.Types.TransactionUnspentOutput (toUtxoMap) import Contract.Address (mkAddress) import Contract.Config ( ContractParams + , KnownWallet(Nami) , WalletSpec(ConnectToGenericCip30) , testnetConfig + , walletName ) import Contract.Credential (Credential(PubKeyHashCredential)) import Contract.Log (logInfo') @@ -47,7 +49,8 @@ import JS.BigInt as BigInt main :: Effect Unit main = example $ testnetConfig - { walletSpec = Just $ ConnectToGenericCip30 "nami" { cip95: false } + { walletSpec = + Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false } } contract :: Contract Unit diff --git a/examples/Gov/DelegateVoteAbstain.purs b/examples/Gov/DelegateVoteAbstain.purs index 7387e82fb..48d72e4bb 100644 --- a/examples/Gov/DelegateVoteAbstain.purs +++ b/examples/Gov/DelegateVoteAbstain.purs @@ -14,8 +14,10 @@ import Cardano.Types.PublicKey (hash) as PublicKey import Cardano.Types.Transaction (hash) as Transaction import Contract.Config ( ContractParams + , KnownWallet(Eternl) , WalletSpec(ConnectToGenericCip30) , testnetConfig + , walletName ) import Contract.Log (logDebug', logInfo') import Contract.Monad (Contract, launchAff_, runContract) @@ -28,7 +30,8 @@ import Effect.Exception (error) main :: Effect Unit main = example $ testnetConfig - { walletSpec = Just $ ConnectToGenericCip30 "eternl" { cip95: true } + { walletSpec = + Just $ ConnectToGenericCip30 (walletName Eternl) { cip95: true } } example :: ContractParams -> Effect Unit diff --git a/examples/Gov/ManageDrep.purs b/examples/Gov/ManageDrep.purs index d0b6bab65..0966b7a22 100644 --- a/examples/Gov/ManageDrep.purs +++ b/examples/Gov/ManageDrep.purs @@ -18,8 +18,10 @@ import Cardano.Types import Cardano.Types.Transaction (hash) as Transaction import Contract.Config ( ContractParams + , KnownWallet(Eternl) , WalletSpec(ConnectToGenericCip30) , testnetConfig + , walletName ) import Contract.Log (logInfo') import Contract.Monad (Contract, launchAff_, runContract) @@ -35,7 +37,8 @@ import Effect.Exception (message) main :: Effect Unit main = example $ testnetConfig - { walletSpec = Just $ ConnectToGenericCip30 "eternl" { cip95: true } + { walletSpec = + Just $ ConnectToGenericCip30 (walletName Eternl) { cip95: true } } example :: ContractParams -> Effect Unit diff --git a/examples/Gov/ManageDrepScript.purs b/examples/Gov/ManageDrepScript.purs index 6eeccab1b..e5595676d 100644 --- a/examples/Gov/ManageDrepScript.purs +++ b/examples/Gov/ManageDrepScript.purs @@ -24,8 +24,10 @@ import Cardano.Types.RedeemerDatum (unit) as RedeemerDatum import Cardano.Types.Transaction (hash) as Transaction import Contract.Config ( ContractParams + , KnownWallet(Eternl) , WalletSpec(ConnectToGenericCip30) , testnetConfig + , walletName ) import Contract.Log (logInfo') import Contract.Monad (Contract, launchAff_, runContract) @@ -41,7 +43,8 @@ import Effect.Exception (message) main :: Effect Unit main = example $ testnetConfig - { walletSpec = Just $ ConnectToGenericCip30 "eternl" { cip95: true } + { walletSpec = + Just $ ConnectToGenericCip30 (walletName Eternl) { cip95: true } } example :: ContractParams -> Effect Unit diff --git a/examples/Gov/SubmitVote.purs b/examples/Gov/SubmitVote.purs index a89c8c069..7b8b05940 100644 --- a/examples/Gov/SubmitVote.purs +++ b/examples/Gov/SubmitVote.purs @@ -21,8 +21,10 @@ import Cardano.Types (GovernanceAction(Info)) as GovAction import Cardano.Types.Transaction (hash) as Transaction import Contract.Config ( ContractParams + , KnownWallet(Eternl) , WalletSpec(ConnectToGenericCip30) , testnetConfig + , walletName ) import Contract.Log (logInfo') import Contract.Monad (Contract, launchAff_, liftedM, runContract) @@ -36,7 +38,8 @@ import Data.Map (empty, singleton) as Map main :: Effect Unit main = example $ testnetConfig - { walletSpec = Just $ ConnectToGenericCip30 "eternl" { cip95: true } + { walletSpec = + Just $ ConnectToGenericCip30 (walletName Eternl) { cip95: true } } example :: ContractParams -> Effect Unit diff --git a/examples/Gov/SubmitVoteScript.purs b/examples/Gov/SubmitVoteScript.purs index 807044c81..5f0222b60 100644 --- a/examples/Gov/SubmitVoteScript.purs +++ b/examples/Gov/SubmitVoteScript.purs @@ -25,8 +25,10 @@ import Cardano.Types.RedeemerDatum (unit) as RedeemerDatum import Cardano.Types.Transaction (hash) as Transaction import Contract.Config ( ContractParams + , KnownWallet(Eternl) , WalletSpec(ConnectToGenericCip30) , testnetConfig + , walletName ) import Contract.Log (logInfo') import Contract.Monad (Contract, launchAff_, liftedM, runContract) @@ -41,7 +43,8 @@ import Data.Map (empty, singleton) as Map main :: Effect Unit main = example $ testnetConfig - { walletSpec = Just $ ConnectToGenericCip30 "eternl" { cip95: true } + { walletSpec = + Just $ ConnectToGenericCip30 (walletName Eternl) { cip95: true } } example :: ContractParams -> Effect Unit diff --git a/examples/IncludeDatum.purs b/examples/IncludeDatum.purs index 449d3030e..7074c37d1 100644 --- a/examples/IncludeDatum.purs +++ b/examples/IncludeDatum.purs @@ -32,8 +32,10 @@ import Cardano.Types.TransactionUnspentOutput (toUtxoMap) import Contract.Address (mkAddress) import Contract.Config ( ContractParams + , KnownWallet(Nami) , WalletSpec(ConnectToGenericCip30) , testnetConfig + , walletName ) import Contract.Log (logInfo') import Contract.Monad (Contract, launchAff_, liftContractM, runContract) @@ -56,7 +58,8 @@ import JS.BigInt as BigInt main :: Effect Unit main = example $ testnetConfig - { walletSpec = Just $ ConnectToGenericCip30 "nami" { cip95: false } + { walletSpec = + Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false } } example :: ContractParams -> Effect Unit diff --git a/examples/Lose7Ada.purs b/examples/Lose7Ada.purs index 911389ab2..9d6193931 100644 --- a/examples/Lose7Ada.purs +++ b/examples/Lose7Ada.purs @@ -33,8 +33,10 @@ import Cardano.Types.TransactionUnspentOutput (toUtxoMap) import Contract.Address (mkAddress) import Contract.Config ( ContractParams + , KnownWallet(Nami) , WalletSpec(ConnectToGenericCip30) , testnetConfig + , walletName ) import Contract.Log (logInfo') import Contract.Monad (Contract, launchAff_, runContract) @@ -65,7 +67,8 @@ import Test.Spec.Assertions (shouldEqual) main :: Effect Unit main = example $ testnetConfig - { walletSpec = Just $ ConnectToGenericCip30 "nami" { cip95: false } + { walletSpec = + Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false } } example :: ContractParams -> Effect Unit diff --git a/examples/ManyAssets.purs b/examples/ManyAssets.purs index 6ed62c8ae..b640702ae 100644 --- a/examples/ManyAssets.purs +++ b/examples/ManyAssets.purs @@ -19,8 +19,10 @@ import Cardano.Types.RedeemerDatum as RedeemerDatum import Cardano.Types.Transaction as Transaction import Contract.Config ( ContractParams + , KnownWallet(Nami) , WalletSpec(ConnectToGenericCip30) , testnetConfig + , walletName ) import Contract.Log (logInfo') import Contract.Monad (Contract, launchAff_, runContract) @@ -32,7 +34,8 @@ import Data.Map as Map main :: Effect Unit main = example $ testnetConfig - { walletSpec = Just $ ConnectToGenericCip30 "nami" { cip95: false } + { walletSpec = + Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false } } example :: ContractParams -> Effect Unit diff --git a/examples/MintsMultipleTokens.purs b/examples/MintsMultipleTokens.purs index 031ad9199..c3b8d414f 100644 --- a/examples/MintsMultipleTokens.purs +++ b/examples/MintsMultipleTokens.purs @@ -23,8 +23,10 @@ import Cardano.Types.PlutusScript as PlutusScript import Cardano.Types.Transaction as Transaction import Contract.Config ( ContractParams + , KnownWallet(Nami) , WalletSpec(ConnectToGenericCip30) , testnetConfig + , walletName ) import Contract.Log (logInfo') import Contract.Monad (Contract, launchAff_, runContract) @@ -39,7 +41,8 @@ import JS.BigInt (fromInt) as BigInt main :: Effect Unit main = example $ testnetConfig - { walletSpec = Just $ ConnectToGenericCip30 "nami" { cip95: false } + { walletSpec = + Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false } } contract :: Contract Unit diff --git a/examples/NativeScriptMints.purs b/examples/NativeScriptMints.purs index 51c7f8f41..62fe5fa1b 100644 --- a/examples/NativeScriptMints.purs +++ b/examples/NativeScriptMints.purs @@ -23,8 +23,10 @@ import Cardano.Types.Transaction as Transaction import Contract.Address (PaymentPubKeyHash, mkAddress) import Contract.Config ( ContractParams + , KnownWallet(Nami) , WalletSpec(ConnectToGenericCip30) , testnetConfig + , walletName ) import Contract.Log (logInfo') import Contract.Monad (Contract, launchAff_, liftedM, runContract) @@ -40,7 +42,8 @@ import JS.BigInt as BigInt main :: Effect Unit main = example $ testnetConfig - { walletSpec = Just $ ConnectToGenericCip30 "nami" { cip95: false } + { walletSpec = + Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false } } contract :: Contract Unit diff --git a/examples/OneShotMinting.purs b/examples/OneShotMinting.purs index 589817e09..694fc63e0 100644 --- a/examples/OneShotMinting.purs +++ b/examples/OneShotMinting.purs @@ -19,11 +19,7 @@ import Cardano.Transaction.Builder , ScriptWitness(ScriptValue) , TransactionBuilderStep(SpendOutput, MintAsset) ) -import Cardano.Types - ( _body - , _fee - , _input - ) +import Cardano.Types (_body, _fee, _input) import Cardano.Types.BigNum as BigNum import Cardano.Types.Int as Int import Cardano.Types.PlutusScript as PlutusScript @@ -32,8 +28,10 @@ import Cardano.Types.Transaction as Transaction import Cardano.Types.TransactionUnspentOutput (fromUtxoMap) import Contract.Config ( ContractParams + , KnownWallet(Nami) , WalletSpec(ConnectToGenericCip30) , testnetConfig + , walletName ) import Contract.Log (logInfo') import Contract.Monad @@ -71,7 +69,8 @@ import JS.BigInt (BigInt) main :: Effect Unit main = example $ testnetConfig - { walletSpec = Just $ ConnectToGenericCip30 "nami" { cip95: false } + { walletSpec = + Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false } } example :: ContractParams -> Effect Unit diff --git a/examples/PaysWithDatum.purs b/examples/PaysWithDatum.purs index fb04de018..bea549b6a 100644 --- a/examples/PaysWithDatum.purs +++ b/examples/PaysWithDatum.purs @@ -13,8 +13,10 @@ import Cardano.Types.BigNum as BigNum import Contract.Address (Address) import Contract.Config ( ContractParams + , KnownWallet(Nami) , WalletSpec(ConnectToGenericCip30) , testnetConfig + , walletName ) import Contract.Hashing (datumHash) import Contract.Log (logInfo') @@ -62,7 +64,8 @@ type ContractResult = main :: Effect Unit main = example $ testnetConfig - { walletSpec = Just $ ConnectToGenericCip30 "nami" { cip95: false } + { walletSpec = + Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false } } example :: ContractParams -> Effect Unit diff --git a/examples/Pkh2Pkh.purs b/examples/Pkh2Pkh.purs index 67d311c41..fe1ff3650 100644 --- a/examples/Pkh2Pkh.purs +++ b/examples/Pkh2Pkh.purs @@ -16,8 +16,10 @@ import Cardano.Types.PlutusData as PlutusData import Cardano.Types.Transaction as Transaction import Contract.Config ( ContractParams + , KnownWallet(Nami) , WalletSpec(ConnectToGenericCip30) , testnetConfig + , walletName ) import Contract.Log (logInfo') import Contract.Monad (Contract, launchAff_, liftedM, runContract) @@ -29,7 +31,8 @@ import Data.Map as Map main :: Effect Unit main = example $ testnetConfig - { walletSpec = Just $ ConnectToGenericCip30 "nami" { cip95: false } + { walletSpec = + Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false } } contract :: Contract Unit diff --git a/examples/PlutusV2/AlwaysSucceeds.purs b/examples/PlutusV2/AlwaysSucceeds.purs index 62e493a0e..ba43f5b11 100644 --- a/examples/PlutusV2/AlwaysSucceeds.purs +++ b/examples/PlutusV2/AlwaysSucceeds.purs @@ -1,25 +1,25 @@ -- | This module demonstrates how the `Contract` interface can be used to build, -- | balance, and submit a smart-contract transaction. It creates a transaction -- | that pays two Ada to the `AlwaysSucceeds` script address -module Ctl.Examples.PlutusV2.AlwaysSucceeds (main, example, contract) where +module Ctl.Examples.PlutusV2.AlwaysSucceeds + ( contract + , example + , main + ) where import Contract.Prelude import Contract.Config ( ContractParams + , KnownWallet(Nami) , WalletSpec(ConnectToGenericCip30) , testnetConfig + , walletName ) import Contract.Log (logInfo') -import Contract.Monad - ( Contract - , launchAff_ - , runContract - ) +import Contract.Monad (Contract, launchAff_, runContract) import Contract.Scripts (validatorHash) -import Contract.Transaction - ( awaitTxConfirmed - ) +import Contract.Transaction (awaitTxConfirmed) import Ctl.Examples.AlwaysSucceeds ( payToAlwaysSucceeds , spendFromAlwaysSucceeds @@ -28,7 +28,8 @@ import Ctl.Examples.PlutusV2.Scripts.AlwaysSucceeds (alwaysSucceedsScriptV2) main :: Effect Unit main = example $ testnetConfig - { walletSpec = Just $ ConnectToGenericCip30 "nami" { cip95: false } + { walletSpec = + Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false } } contract :: Contract Unit diff --git a/examples/PlutusV2/InlineDatum.purs b/examples/PlutusV2/InlineDatum.purs index 1c668e77b..a0d1e7e7c 100644 --- a/examples/PlutusV2/InlineDatum.purs +++ b/examples/PlutusV2/InlineDatum.purs @@ -18,8 +18,10 @@ import Cardano.Types.BigNum as BigNum import Contract.Address (mkAddress) import Contract.Config ( ContractParams + , KnownWallet(Nami) , WalletSpec(ConnectToGenericCip30) , testnetConfig + , walletName ) import Contract.Log (logInfo') import Contract.Monad (Contract, launchAff_, runContract) @@ -46,7 +48,8 @@ import Test.Spec.Assertions (shouldEqual) main :: Effect Unit main = example $ testnetConfig - { walletSpec = Just $ ConnectToGenericCip30 "nami" { cip95: false } + { walletSpec = + Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false } } example :: ContractParams -> Effect Unit diff --git a/examples/PlutusV2/OneShotMinting.purs b/examples/PlutusV2/OneShotMinting.purs index a31a16377..e8ec3979e 100644 --- a/examples/PlutusV2/OneShotMinting.purs +++ b/examples/PlutusV2/OneShotMinting.purs @@ -13,15 +13,12 @@ import Contract.Prelude import Contract.Config ( ContractParams + , KnownWallet(Nami) , WalletSpec(ConnectToGenericCip30) , testnetConfig + , walletName ) -import Contract.Monad - ( Contract - , launchAff_ - , liftContractE - , runContract - ) +import Contract.Monad (Contract, launchAff_, liftContractE, runContract) import Contract.Scripts (PlutusScript) import Contract.TextEnvelope (decodeTextEnvelope, plutusScriptFromEnvelope) import Contract.Transaction (TransactionInput) @@ -34,7 +31,8 @@ import Effect.Exception (error) main :: Effect Unit main = example $ testnetConfig - { walletSpec = Just $ ConnectToGenericCip30 "nami" { cip95: false } + { walletSpec = + Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false } } example :: ContractParams -> Effect Unit diff --git a/examples/PlutusV2/ReferenceInputsAndScripts.purs b/examples/PlutusV2/ReferenceInputsAndScripts.purs index dd2735ed5..3b379e1e6 100644 --- a/examples/PlutusV2/ReferenceInputsAndScripts.purs +++ b/examples/PlutusV2/ReferenceInputsAndScripts.purs @@ -28,8 +28,10 @@ import Cardano.Types.Transaction as Transaction import Contract.Address (mkAddress) import Contract.Config ( ContractParams + , KnownWallet(Nami) , WalletSpec(ConnectToGenericCip30) , testnetConfig + , walletName ) import Contract.Log (logInfo') import Contract.Monad (Contract, launchAff_, liftContractM, runContract) @@ -54,7 +56,8 @@ import Effect.Exception (error) main :: Effect Unit main = example $ testnetConfig - { walletSpec = Just $ ConnectToGenericCip30 "nami" { cip95: false } + { walletSpec = + Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false } } example :: ContractParams -> Effect Unit diff --git a/examples/SendsToken.purs b/examples/SendsToken.purs index ee9caf4f4..6b4efcff9 100644 --- a/examples/SendsToken.purs +++ b/examples/SendsToken.purs @@ -28,8 +28,10 @@ import Cardano.Types.Transaction as Transaction import Contract.Address (mkAddress) import Contract.Config ( ContractParams + , KnownWallet(Nami) , WalletSpec(ConnectToGenericCip30) , testnetConfig + , walletName ) import Contract.Log (logInfo') import Contract.Monad (Contract, launchAff_, liftedM, runContract) @@ -48,7 +50,8 @@ import Data.Map as Map main :: Effect Unit main = example $ testnetConfig - { walletSpec = Just $ ConnectToGenericCip30 "nami" { cip95: false } + { walletSpec = + Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false } } example :: ContractParams -> Effect Unit diff --git a/examples/SignData.purs b/examples/SignData.purs index e19f25745..cecba781f 100644 --- a/examples/SignData.purs +++ b/examples/SignData.purs @@ -10,8 +10,10 @@ import Cardano.Wallet.Cip30.SignData (COSEKey, COSESign1) import Contract.Address (Address) import Contract.Config ( ContractParams + , KnownWallet(Nami) , WalletSpec(ConnectToGenericCip30) , testnetConfig + , walletName ) import Contract.Log (logInfo') import Contract.Monad (Contract, launchAff_, liftedM, runContract) @@ -26,7 +28,8 @@ import Partial.Unsafe (unsafePartial) main :: Effect Unit main = example $ testnetConfig - { walletSpec = Just $ ConnectToGenericCip30 "nami" { cip95: false } + { walletSpec = + Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false } } example :: ContractParams -> Effect Unit diff --git a/examples/SignMultiple.purs b/examples/SignMultiple.purs index 2b12581e7..047fd12df 100644 --- a/examples/SignMultiple.purs +++ b/examples/SignMultiple.purs @@ -5,9 +5,7 @@ module Ctl.Examples.SignMultiple (example, contract, main) where import Contract.Prelude -import Cardano.Transaction.Builder - ( TransactionBuilderStep(Pay) - ) +import Cardano.Transaction.Builder (TransactionBuilderStep(Pay)) import Cardano.Types ( Credential(PubKeyHashCredential) , OutputDatum(OutputDatumHash) @@ -22,8 +20,10 @@ import Cardano.Types.Transaction as Transaction import Contract.Address (mkAddress) import Contract.Config ( ContractParams + , KnownWallet(Nami) , WalletSpec(ConnectToGenericCip30) , testnetConfig + , walletName ) import Contract.Log (logInfo', logWarn') import Contract.Monad @@ -61,7 +61,8 @@ import Effect.Ref as Ref main :: Effect Unit main = example $ testnetConfig - { walletSpec = Just $ ConnectToGenericCip30 "nami" { cip95: false } + { walletSpec = + Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false } } getLockedInputs diff --git a/examples/TxChaining.purs b/examples/TxChaining.purs index 9de5d3923..bcafe5c2f 100644 --- a/examples/TxChaining.purs +++ b/examples/TxChaining.purs @@ -27,8 +27,10 @@ import Contract.BalanceTxConstraints ) import Contract.Config ( ContractParams + , KnownWallet(Nami) , WalletSpec(ConnectToGenericCip30) , testnetConfig + , walletName ) import Contract.Log (logInfo') import Contract.Monad (Contract, launchAff_, liftedM, runContract) @@ -49,7 +51,8 @@ import Effect.Exception (throw) main :: Effect Unit main = example $ testnetConfig - { walletSpec = Just $ ConnectToGenericCip30 "nami" { cip95: false } + { walletSpec = + Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false } } example :: ContractParams -> Effect Unit diff --git a/examples/Utxos.purs b/examples/Utxos.purs index c987a89bd..780f5be22 100644 --- a/examples/Utxos.purs +++ b/examples/Utxos.purs @@ -23,8 +23,10 @@ import Cardano.Types.Transaction as Transaction import Contract.Address (mkAddress) import Contract.Config ( ContractParams + , KnownWallet(Nami) , WalletSpec(ConnectToGenericCip30) , testnetConfig + , walletName ) import Contract.Log (logInfo, logInfo') import Contract.Monad @@ -59,7 +61,8 @@ import Test.QuickCheck.Gen (randomSampleOne) main :: Effect Unit main = example $ testnetConfig - { walletSpec = Just $ ConnectToGenericCip30 "nami" { cip95: false } + { walletSpec = + Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false } } example :: ContractParams -> Effect Unit diff --git a/src/Contract/Config.purs b/src/Contract/Config.purs index 4c19e75cd..cc50b759f 100644 --- a/src/Contract/Config.purs +++ b/src/Contract/Config.purs @@ -60,11 +60,13 @@ import Ctl.Internal.ServerConfig ) import Ctl.Internal.Wallet.Spec ( Cip1852DerivationPath + , KnownWallet(Nami, Gero, Flint, Eternl, Lode, Lace, NuFi) , MnemonicSource(MnemonicString, MnemonicFile) , PrivatePaymentKeySource(PrivatePaymentKeyFile, PrivatePaymentKeyValue) , PrivateStakeKeySource(PrivateStakeKeyFile, PrivateStakeKeyValue) , StakeKeyPresence(WithStakeKey, WithoutStakeKey) , WalletSpec(UseKeys, UseMnemonic, ConnectToGenericCip30) + , walletName ) import Data.Log.Level (LogLevel(Trace, Debug, Info, Warn, Error)) import Data.Log.Message (Message) diff --git a/src/Contract/Wallet.purs b/src/Contract/Wallet.purs index fdca5d065..118c0fda5 100644 --- a/src/Contract/Wallet.purs +++ b/src/Contract/Wallet.purs @@ -68,10 +68,12 @@ import Ctl.Internal.Wallet.Spec , mkKeyWalletFromMnemonic ) import Ctl.Internal.Wallet.Spec - ( MnemonicSource(MnemonicString, MnemonicFile) + ( KnownWallet(Nami, Gero, Flint, Eternl, Lode, Lace, NuFi) + , MnemonicSource(MnemonicString, MnemonicFile) , PrivatePaymentKeySource(PrivatePaymentKeyFile, PrivatePaymentKeyValue) , PrivateStakeKeySource(PrivateStakeKeyFile, PrivateStakeKeyValue) , WalletSpec(UseKeys, UseMnemonic, ConnectToGenericCip30) + , walletName ) as X import Data.Array (head) import Data.Array as Array diff --git a/src/Internal/Wallet/Spec.purs b/src/Internal/Wallet/Spec.purs index 53c0603c5..ae440e284 100644 --- a/src/Internal/Wallet/Spec.purs +++ b/src/Internal/Wallet/Spec.purs @@ -1,13 +1,15 @@ module Ctl.Internal.Wallet.Spec - ( WalletSpec(UseKeys, UseMnemonic, ConnectToGenericCip30) - , Cip1852DerivationPath - , StakeKeyPresence(WithStakeKey, WithoutStakeKey) + ( Cip1852DerivationPath + , KnownWallet(Nami, Gero, Flint, Eternl, Lode, Lace, NuFi) , MnemonicSource(MnemonicString, MnemonicFile) , PrivateDrepKeySource(PrivateDrepKeyValue) , PrivateStakeKeySource(PrivateStakeKeyFile, PrivateStakeKeyValue) , PrivatePaymentKeySource(PrivatePaymentKeyFile, PrivatePaymentKeyValue) + , StakeKeyPresence(WithStakeKey, WithoutStakeKey) + , WalletSpec(UseKeys, UseMnemonic, ConnectToGenericCip30) , mkWalletBySpec , mkKeyWalletFromMnemonic + , walletName ) where import Prelude @@ -103,6 +105,18 @@ derive instance Generic WalletSpec _ instance Show WalletSpec where show = genericShow +data KnownWallet = Nami | Gero | Flint | Eternl | Lode | Lace | NuFi + +walletName :: KnownWallet -> String +walletName = case _ of + Nami -> "nami" + Gero -> "gerowallet" + Flint -> "flint" + Eternl -> "eternl" + Lode -> "LodeWallet" + Lace -> "lace" + NuFi -> "nufi" + -- | Contains non-constant parameters for a CIP-1852 derivation path. -- | See https://cips.cardano.org/cips/cip1852/ and `doc/key-management.md`. type Cip1852DerivationPath = diff --git a/test/Testnet/Contract.purs b/test/Testnet/Contract.purs index daf83fa04..95cf614de 100644 --- a/test/Testnet/Contract.purs +++ b/test/Testnet/Contract.purs @@ -50,6 +50,10 @@ import Contract.BalanceTxConstraints , mustUseCollateralUtxos ) import Contract.Chain (currentTime, waitUntilSlot) +import Contract.Config + ( KnownWallet(Nami, Gero, Flint, Lode, NuFi) + , walletName + ) import Contract.Hashing (datumHash, nativeScriptHash) import Contract.Keys (privateKeyFromBytes) import Contract.Log (logInfo') @@ -1898,33 +1902,33 @@ suite = do ] withWallets distribution \alice -> do - let nami = "nami" + let nami = walletName Nami withCip30Mock alice nami do (liftEffect $ isWalletAvailable nami) >>= shouldEqual true try (liftEffect $ isWalletAvailable nami) >>= hush >>> shouldEqual (Just false) - let gerowallet = "gerowallet" + let gerowallet = walletName Gero withCip30Mock alice gerowallet do (liftEffect $ isWalletAvailable gerowallet) >>= shouldEqual true try (liftEffect $ isWalletAvailable gerowallet) >>= hush >>> shouldEqual (Just false) - let flint = "flint" + let flint = walletName Flint withCip30Mock alice flint do (liftEffect $ isWalletAvailable flint) >>= shouldEqual true try (liftEffect $ isWalletAvailable flint) >>= hush >>> shouldEqual (Just false) - let nufi = "nufi" + let nufi = walletName NuFi withCip30Mock alice nufi do (liftEffect $ isWalletAvailable nufi) >>= shouldEqual true try (liftEffect $ isWalletAvailable nufi) >>= hush >>> shouldEqual (Just false) - let lode = "LodeWallet" + let lode = walletName Lode withCip30Mock alice lode do (liftEffect $ isWalletAvailable lode) >>= shouldEqual true try (liftEffect $ isWalletAvailable lode) >>= hush >>> @@ -1939,7 +1943,7 @@ suite = do , BigNum.fromInt 50_000_000 ] withWallets distribution \alice -> do - withCip30Mock alice "nami" do + withCip30Mock alice (walletName Nami) do getWalletCollateral >>= liftEffect <<< case _ of Nothing -> throw "Unable to get collateral" Just @@ -1962,7 +1966,7 @@ suite = do , BigNum.fromInt 50_000_000 ] withWallets distribution \alice -> do - utxos <- withCip30Mock alice "nami" do + utxos <- withCip30Mock alice (walletName Nami) do getWalletUtxos utxos `shouldSatisfy` isJust @@ -1974,7 +1978,7 @@ suite = do , BigNum.fromInt 50_000_000 ] withWallets distribution \alice -> do - mockAddress <- withCip30Mock alice "nami" do + mockAddress <- withCip30Mock alice (walletName Nami) do mbAddr <- head <$> getWalletAddresses mbAddr `shouldSatisfy` isJust pure mbAddr @@ -1990,7 +1994,7 @@ suite = do , BigNum.fromInt 50_000_000 ] withWallets distribution \alice -> do - withCip30Mock alice "nami" do + withCip30Mock alice (walletName Nami) do pkh <- liftedM "Failed to get PKH" $ head <$> ownPaymentPubKeyHashes stakePkh <- join <<< head <$> ownStakePubKeyHashes @@ -2008,7 +2012,7 @@ suite = do getWalletBalance >>= shouldEqual ( Just $ coinToValue $ Coin $ BigNum.fromInt 1_050_000_000 ) - withCip30Mock alice "nami" do + withCip30Mock alice (walletName Nami) do getWalletBalance >>= shouldEqual ( Just $ coinToValue $ Coin $ BigNum.fromInt 1_050_000_000 ) @@ -2022,7 +2026,7 @@ suite = do , BigNum.fromInt 1_000_000 ] withWallets distribution \alice -> do - withCip30Mock alice "nami" do + withCip30Mock alice (walletName Nami) do getWalletBalance >>= flip shouldSatisfy (eq $ Just $ coinToValue $ Coin $ BigNum.fromInt 8_000_000) @@ -2038,7 +2042,7 @@ suite = do , drepKey: Just privateDrepKey } withWallets walletSpec \alice -> - withCip30Mock alice "nami" $ + withCip30Mock alice (walletName Nami) $ ownDrepPubKey `shouldReturn` PrivateKey.toPublicKey (unwrap privateDrepKey) @@ -2054,7 +2058,7 @@ suite = do , drepKey: Just privateDrepKey } withWallets walletSpec \alice -> - withCip30Mock alice "nami" $ + withCip30Mock alice (walletName Nami) $ ownDrepPubKeyHash `shouldReturn` PublicKey.hash (PrivateKey.toPublicKey $ unwrap privateDrepKey) @@ -2070,7 +2074,7 @@ suite = do , drepKey: Nothing } withWallets walletSpec \alice -> - withCip30Mock alice "nami" $ + withCip30Mock alice (walletName Nami) $ ownRegisteredPubStakeKeys `shouldReturn` Array.singleton (PrivateKey.toPublicKey $ unwrap privateStakeKey) @@ -2086,7 +2090,7 @@ suite = do , drepKey: Nothing } withWallets walletSpec \alice -> - withCip30Mock alice "nami" $ + withCip30Mock alice (walletName Nami) $ ownUnregisteredPubStakeKeys `shouldReturn` Array.singleton (PrivateKey.toPublicKey $ unwrap privateStakeKey) @@ -2102,7 +2106,7 @@ suite = do , drepKey: Just privateDrepKey } withWallets walletSpec \alice -> - withCip30Mock alice "nami" do + withCip30Mock alice (walletName Nami) do networkId <- getNetworkId drepCred <- wrap <<< PubKeyHashCredential <$> ownDrepPubKeyHash let @@ -2119,9 +2123,9 @@ suite = do ] withWallets (distribution /\ distribution) \(alice /\ bob) -> do bobAddr <- - withCip30Mock bob "nami" do + withCip30Mock bob (walletName Nami) do liftedM "Could not get Bob's address" (head <$> getWalletAddresses) - withCip30Mock alice "nami" do + withCip30Mock alice (walletName Nami) do expectError $ signData bobAddr mempty test "CIP-30 utilities" do @@ -2132,7 +2136,7 @@ suite = do , BigNum.fromInt 50_000_000 ] withWallets distribution \alice -> do - withCip30Mock alice "nami" do + withCip30Mock alice (walletName Nami) do Cip30.contract test "ECDSA example" do @@ -2145,7 +2149,7 @@ suite = do , BigNum.fromInt 2_000_000_000 ] withWallets distribution \alice -> do - withCip30Mock alice "nami" $ ECDSA.contract + withCip30Mock alice (walletName Nami) $ ECDSA.contract group "CIP-49 Plutus Crypto Primitives" do test "ECDSA: a script that checks if a signature is correct" do