Module

Contract.Test.Cip30Mock

A module for mocking CIP30 wallets.

Re-exports from Ctl.Internal.Wallet.Cip30Mock

#withCip30Mock

withCip30Mock :: forall (a :: Type). KeyWallet -> String -> Contract a -> Contract a

Construct a CIP-30 + CIP-95 wallet mock that exposes KeyWallet functionality behind a CIP-30 interface and uses Ogmios to submit Txs. The wallet is injected directly to window.cardano object, under the name corresponding to provided WalletMock. It works even in NodeJS (we introduce a global window object and delete it afterwards).

Note that this function will refuse to overwrite existing wallet with the mock, so the users should disable their browser extensions before running it in the browser.

Note that this function implements single-address light wallet logic, so it will have to be changed a lot to successfully mimic the behavior of multi-address wallets, like Eternl.

WARNING: KeyWallet does not distinguish between registered and unregistered stake keys due to the limitations of the underlying query layer. This means that all controlled stake keys are returned as part of getUnregisteredPubStakeKeys, and the response of getRegisteredPubStakeKeys is always an empty array.

Modules