Skip to content

Commit

Permalink
Remove deprecated Nami wallet; Fix e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
errfrom committed Feb 10, 2025
1 parent 53f42ed commit 6a8f5a7
Show file tree
Hide file tree
Showing 44 changed files with 158 additions and 265 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ You can also access [PureScript documentation for CTL and its dependencies](http
- [`cardano-serialization-lib`](https://github.com/Emurgo/cardano-serialization-lib/)
- [Ogmios](https://ogmios.dev) for chain queries
- [Kupo](https://cardanosolutions.github.io/kupo/) for chain queries
- [CIP-30](https://github.com/cardano-foundation/CIPs/tree/master/CIP-0030) (wallet interface - Nami partially implements this)
- [Nami docs](https://github.com/Berry-Pool/nami-wallet)
- [CIP-30](https://github.com/cardano-foundation/CIPs/tree/master/CIP-0030) (wallet interface)
- [Alonzo CDDL spec](https://github.com/input-output-hk/cardano-ledger/blob/0738804155245062f05e2f355fadd1d16f04cd56/alonzo/impl/cddl-files/alonzo.cddl)

## Available support channels info
Expand Down
15 changes: 4 additions & 11 deletions doc/e2e-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ For purposes of testing, there are two parts to using a wallet: providing the ri
### Where to Find the Installed Extensions

1. Locate your browser profile directory. Commonly used locations include: `~/.config/{google-chrome,chromium}/Default` (where `Default` is the profile name), `~/snap/chromium/common/chromium/Default`.
2. Make sure that inside the profile, your desired extension is unpacked. Nami should be in `Extensions/lpfcbjknijpeeillifnkikgncikgfhdo`, Gero (testnet version) in `Extensions/iifeegfcfhlhhnilhfoeihllenamcfgc`.
2. Make sure that inside the profile, your desired extension is unpacked. Gero (testnet version) should be in `Extensions/iifeegfcfhlhhnilhfoeihllenamcfgc`.
3. Add the version as a subdirectory, too. The final path may look like `/home/user/.config/google-chrome/Default/Extensions/iifeegfcfhlhhnilhfoeihllenamcfgc/1.10.9_0`

### How to Use a Different User Wallet
Expand Down Expand Up @@ -125,10 +125,6 @@ The tests can set up using CLI arguments, environment variables, or both. CLI ar
| Lode CRX URL | `--lode-crx-url` | `LODE_CRX_URL` |
| Lode password | `--lode-password` | `LODE_PASSWORD` |
| Lode Extension ID | `--lode-extid` | `LODE_EXTID` |
| Nami CRX URL | `--nami-crx-url` | `NAMI_CRX_URL` |
| Nami CRX file | `--nami-crx` | `NAMI_CRX` |
| Nami password | `--nami-password` | `NAMI_PASSWORD` |
| Nami Extension ID | `--nami-extid` | `NAMI_EXTID` |
| Flint CRX URL | `--flint-crx-url` | `FLINT_CRX_URL` |
| Flint CRX file | `--flint-crx` | `FLINT_CRX` |
| Flint password | `--flint-password` | `FLINT_PASSWORD` |
Expand Down Expand Up @@ -231,12 +227,10 @@ main = do
configs :: Map E2EConfigName (ContractParams /\ Maybe WalletMock)
configs = Map.fromFoldable
[ "nami" /\ testnetNamiConfig /\ Nothing
, "gero" /\ testnetGeroConfig /\ Nothing
[ "gero" /\ testnetGeroConfig /\ Nothing
, "flint" /\ testnetFlintConfig /\ Nothing
, "eternl" /\ testnetEternlConfig /\ Nothing
, "lode" /\ testnetLodeConfig /\ Nothing
, "nami-mock" /\ testnetNamiConfig /\ Just MockNami
, "gero-mock" /\ testnetGeroConfig /\ Just MockGero
, "flint-mock" /\ testnetFlintConfig /\ Just MockFlint
, "lode-mock" /\ testnetLodeConfig /\ Just MockLode
Expand Down Expand Up @@ -300,15 +294,14 @@ It's possible to run headless browser tests on top of a Cardano Testnet cluster.
To do that, it's enough to define a config name that:

- uses a `ContractParams` value with `networkId` set to `MainnetId`.
- Specifies a wallet mock (e.g. `MockNami`)
- Specifies a wallet mock (e.g. `MockGero`)

E.g.:

```purescript
wallets :: Map E2EConfigName (ContractParams /\ Maybe WalletMock)
wallets = Map.fromFoldable
[ "testnet-nami-mock" /\ mainnetNamiConfig /\ Just MockNami
, "testnet-gero-mock" /\ mainnetGeroConfig /\ Just MockGero
[ "testnet-gero-mock" /\ mainnetGeroConfig /\ Just MockGero
, "testnet-flint-mock" /\ mainnetFlintConfig /\ Just MockFlint
, "testnet-lode-mock" /\ mainnetLodeConfig /\ Just MockLode
]
Expand Down
12 changes: 10 additions & 2 deletions doc/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,17 @@ main = Contract.Monad.launchAff_ do -- we re-export this for you
Then use the eliminator `Contract.Monad.runContract` with a config specifying network and wallet:

```purescript
testnetEternlConfig :: Contract.Monad.ContractParams
testnetEternlConfig =
Contract.Config.testnetConfig
{ walletSpec =
Just $ ConnectToGenericCip30 (walletName Eternl) { cip95: false }
}
main :: Effect Unit
main = Contract.Monad.launchAff_ do
runContract Contract.Config.testnetNamiConfig do
runContract testnetEternlConfig do
...
```

Expand All @@ -135,7 +143,7 @@ main = Contract.Monad.launchAff_ do -- we re-export this for you
, kupoConfig: defaultKupoServerConfig
}
, networkId: TestnetId
, walletSpec: Just ConnectToNami
, walletSpec: Just $ ConnectToGenericCip30 (walletName Eternl) { cip95: false }
, logLevel: Trace
, customLogger: Nothing
, suppressLogs: false
Expand Down
4 changes: 2 additions & 2 deletions examples/AdditionalUtxos.purs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import Contract.BalanceTxConstraints
)
import Contract.Config
( ContractParams
, KnownWallet(Nami)
, KnownWallet(Eternl)
, WalletSpec(ConnectToGenericCip30)
, testnetConfig
, walletName
Expand Down Expand Up @@ -61,7 +61,7 @@ import Test.QuickCheck.Gen (randomSampleOne)
main :: Effect Unit
main = example $ testnetConfig
{ walletSpec =
Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false }
Just $ ConnectToGenericCip30 (walletName Eternl) { cip95: false }
}

example :: ContractParams -> Effect Unit
Expand Down
4 changes: 2 additions & 2 deletions examples/AlwaysMints.purs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import Cardano.Types.RedeemerDatum as RedeemerDatum
import Cardano.Types.Transaction as Transaction
import Contract.Config
( ContractParams
, KnownWallet(Nami)
, KnownWallet(Eternl)
, WalletSpec(ConnectToGenericCip30)
, testnetConfig
, walletName
Expand All @@ -38,7 +38,7 @@ import Data.Map as Map
main :: Effect Unit
main = example $ testnetConfig
{ walletSpec =
Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false }
Just $ ConnectToGenericCip30 (walletName Eternl) { cip95: false }
}

contract :: Contract Unit
Expand Down
4 changes: 2 additions & 2 deletions examples/AlwaysSucceeds.purs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import Cardano.Types.TransactionUnspentOutput (toUtxoMap)
import Contract.Address (mkAddress)
import Contract.Config
( ContractParams
, KnownWallet(Nami)
, KnownWallet(Eternl)
, WalletSpec(ConnectToGenericCip30)
, testnetConfig
, walletName
Expand All @@ -62,7 +62,7 @@ import Effect.Exception (error)
main :: Effect Unit
main = example $ testnetConfig
{ walletSpec =
Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false }
Just $ ConnectToGenericCip30 (walletName Eternl) { cip95: false }
}

contract :: Contract Unit
Expand Down
4 changes: 2 additions & 2 deletions examples/AwaitTxConfirmedWithTimeout.purs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Contract.Prelude
import Cardano.AsCbor (decodeCbor)
import Contract.Config
( ContractParams
, KnownWallet(Nami)
, KnownWallet(Eternl)
, WalletSpec(ConnectToGenericCip30)
, testnetConfig
, walletName
Expand All @@ -28,7 +28,7 @@ import Partial.Unsafe (unsafePartial)
main :: Effect Unit
main = example $ testnetConfig
{ walletSpec =
Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false }
Just $ ConnectToGenericCip30 (walletName Eternl) { cip95: false }
}

example :: ContractParams -> Effect Unit
Expand Down
35 changes: 8 additions & 27 deletions examples/ByUrl.purs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import Prelude

import Contract.Config
( ContractParams
, KnownWallet(Nami, Gero, Flint, Eternl, Lode, Lace, NuFi)
, KnownWallet(Gero, Flint, Eternl, Lode, Lace, NuFi)
, WalletSpec(ConnectToGenericCip30)
, blockfrostPublicPreprodServerConfig
, blockfrostPublicPreviewServerConfig
, mainnetConfig
, mkBlockfrostBackendParams
, testnetConfig
, walletName
Expand Down Expand Up @@ -65,11 +64,7 @@ main = do
if isNothing mbApiKey then Map.empty
else
Map.fromFoldable
[ "blockfrost-nami-preview"
/\ (mkBlockfrostPreviewConfig mbApiKey)
{ walletSpec = connectTo Nami }
/\ Nothing
, "blockfrost-gero-preview"
[ "blockfrost-gero-preview"
/\ (mkBlockfrostPreviewConfig mbApiKey)
{ walletSpec = connectTo Gero }
/\ Nothing
Expand All @@ -93,10 +88,6 @@ main = do
/\ (mkBlockfrostPreviewConfig mbApiKey)
{ walletSpec = connectTo Lace }
/\ Nothing
, "blockfrost-nami-preprod"
/\ (mkBlockfrostPreprodConfig mbApiKey)
{ walletSpec = connectTo Nami }
/\ Nothing
, "blockfrost-gero-preprod"
/\ (mkBlockfrostPreprodConfig mbApiKey)
{ walletSpec = connectTo Gero }
Expand Down Expand Up @@ -138,23 +129,20 @@ getBlockfrostApiKey = do

wallets :: Map E2EConfigName (ContractParams /\ Maybe String)
wallets = map (map walletName) <$> Map.fromFoldable
[ "nami" /\ testnetConfig' Nami /\ Nothing
, "gero" /\ testnetConfig' Gero /\ 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' 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
, "localnet-eternl-mock" /\ testnetConfig' Eternl /\ Just Eternl
, "localnet-gero-mock" /\ testnetConfig' Gero /\ Just Gero
, "localnet-flint-mock" /\ testnetConfig' Flint /\ Just Flint
, "localnet-lode-mock" /\ testnetConfig' Lode /\ Just Lode
, "localnet-nufi-mock" /\ testnetConfig' NuFi /\ Just NuFi
]
where
testnetConfig' :: KnownWallet -> ContractParams
Expand All @@ -164,13 +152,6 @@ wallets = map (map walletName) <$> Map.fromFoldable
Just $ ConnectToGenericCip30 (walletName wallet) { cip95: false }
}

mainnetNamiConfig :: ContractParams
mainnetNamiConfig =
mainnetConfig
{ walletSpec =
Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false }
}

mkBlockfrostPreviewConfig :: Maybe String -> ContractParams
mkBlockfrostPreviewConfig apiKey =
testnetConfig
Expand Down
4 changes: 2 additions & 2 deletions examples/Cip30.purs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import Cardano.Wallet.Cip30
import Cardano.Wallet.Cip30.TypeSafe as Cip30
import Contract.Config
( ContractParams
, KnownWallet(Nami)
, KnownWallet(Eternl)
, WalletSpec(ConnectToGenericCip30)
, testnetConfig
, walletName
Expand All @@ -38,7 +38,7 @@ import Effect.Exception (error)
main :: Effect Unit
main = example $ testnetConfig
{ walletSpec =
Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false }
Just $ ConnectToGenericCip30 (walletName Eternl) { cip95: false }
}

example :: ContractParams -> Effect Unit
Expand Down
4 changes: 2 additions & 2 deletions examples/DropTokens.purs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Cardano.Types.MultiAsset as MultiAsset
import Cardano.Types.Value as Value
import Contract.Config
( ContractParams
, KnownWallet(Nami)
, KnownWallet(Eternl)
, WalletSpec(ConnectToGenericCip30)
, testnetConfig
, walletName
Expand All @@ -28,7 +28,7 @@ import Test.Ctl.Fixtures (nullPaymentPubKeyHash)
main :: Effect Unit
main = example $ testnetConfig
{ walletSpec =
Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false }
Just $ ConnectToGenericCip30 (walletName Eternl) { cip95: false }
}

example :: ContractParams -> Effect Unit
Expand Down
4 changes: 2 additions & 2 deletions examples/ExUnits.purs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Cardano.Types.TransactionUnspentOutput (toUtxoMap)
import Contract.Address (mkAddress)
import Contract.Config
( ContractParams
, KnownWallet(Nami)
, KnownWallet(Eternl)
, WalletSpec(ConnectToGenericCip30)
, testnetConfig
, walletName
Expand Down Expand Up @@ -50,7 +50,7 @@ import JS.BigInt as BigInt
main :: Effect Unit
main = example $ testnetConfig
{ walletSpec =
Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false }
Just $ ConnectToGenericCip30 (walletName Eternl) { cip95: false }
}

contract :: Contract Unit
Expand Down
4 changes: 2 additions & 2 deletions examples/IncludeDatum.purs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import Cardano.Types.TransactionUnspentOutput (toUtxoMap)
import Contract.Address (mkAddress)
import Contract.Config
( ContractParams
, KnownWallet(Nami)
, KnownWallet(Eternl)
, WalletSpec(ConnectToGenericCip30)
, testnetConfig
, walletName
Expand All @@ -59,7 +59,7 @@ import JS.BigInt as BigInt
main :: Effect Unit
main = example $ testnetConfig
{ walletSpec =
Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false }
Just $ ConnectToGenericCip30 (walletName Eternl) { cip95: false }
}

example :: ContractParams -> Effect Unit
Expand Down
4 changes: 2 additions & 2 deletions examples/Lose7Ada.purs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import Cardano.Types.TransactionUnspentOutput (toUtxoMap)
import Contract.Address (mkAddress)
import Contract.Config
( ContractParams
, KnownWallet(Nami)
, KnownWallet(Eternl)
, WalletSpec(ConnectToGenericCip30)
, testnetConfig
, walletName
Expand Down Expand Up @@ -68,7 +68,7 @@ import Test.Spec.Assertions (shouldEqual)
main :: Effect Unit
main = example $ testnetConfig
{ walletSpec =
Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false }
Just $ ConnectToGenericCip30 (walletName Eternl) { cip95: false }
}

example :: ContractParams -> Effect Unit
Expand Down
4 changes: 2 additions & 2 deletions examples/ManyAssets.purs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import Cardano.Types.RedeemerDatum as RedeemerDatum
import Cardano.Types.Transaction as Transaction
import Contract.Config
( ContractParams
, KnownWallet(Nami)
, KnownWallet(Eternl)
, WalletSpec(ConnectToGenericCip30)
, testnetConfig
, walletName
Expand All @@ -35,7 +35,7 @@ import Data.Map as Map
main :: Effect Unit
main = example $ testnetConfig
{ walletSpec =
Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false }
Just $ ConnectToGenericCip30 (walletName Eternl) { cip95: false }
}

example :: ContractParams -> Effect Unit
Expand Down
4 changes: 2 additions & 2 deletions examples/MintsMultipleTokens.purs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import Cardano.Types.PlutusScript as PlutusScript
import Cardano.Types.Transaction as Transaction
import Contract.Config
( ContractParams
, KnownWallet(Nami)
, KnownWallet(Eternl)
, WalletSpec(ConnectToGenericCip30)
, testnetConfig
, walletName
Expand All @@ -42,7 +42,7 @@ import JS.BigInt (fromInt) as BigInt
main :: Effect Unit
main = example $ testnetConfig
{ walletSpec =
Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false }
Just $ ConnectToGenericCip30 (walletName Eternl) { cip95: false }
}

contract :: Contract Unit
Expand Down
4 changes: 2 additions & 2 deletions examples/NativeScriptMints.purs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import Cardano.Types.Transaction as Transaction
import Contract.Address (PaymentPubKeyHash, mkAddress)
import Contract.Config
( ContractParams
, KnownWallet(Nami)
, KnownWallet(Eternl)
, WalletSpec(ConnectToGenericCip30)
, testnetConfig
, walletName
Expand All @@ -43,7 +43,7 @@ import JS.BigInt as BigInt
main :: Effect Unit
main = example $ testnetConfig
{ walletSpec =
Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false }
Just $ ConnectToGenericCip30 (walletName Eternl) { cip95: false }
}

contract :: Contract Unit
Expand Down
Loading

0 comments on commit 6a8f5a7

Please sign in to comment.