| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Wallet.Emulator.Types
Synopsis
- data Wallet = Wallet {}
- newtype WalletId = WalletId {}
- data XPrv
- data XPub
- mockWalletAddress :: Wallet -> CardanoAddress
- mockWalletPaymentPubKey :: Wallet -> PaymentPubKey
- mockWalletPaymentPubKeyHash :: Wallet -> PaymentPubKeyHash
- addSignature :: PrivateKey -> Passphrase -> Tx -> Tx
- knownWallets :: [Wallet]
- knownWallet :: Integer -> Wallet
- newtype WalletNumber = WalletNumber {}
- toWalletNumber :: MockWallet -> WalletNumber
- fromWalletNumber :: WalletNumber -> Wallet
- data MockWallet = MockWallet {
- mwWalletId :: Digest Blake2b_160
- mwPaymentKey :: MockPrivateKey
- mwStakeKey :: Maybe MockPrivateKey
- mwPrintAs :: Maybe String
- type TxPool = [CardanoTx]
- type EmulatorEffs = '[MultiAgentEffect, ChainEffect, ChainControlEffect]
- data Assertion
- assert :: Members MultiAgentEffs effs => Assertion -> Eff effs ()
- assertIsValidated :: Member MultiAgentControlEffect effs => CardanoTx -> Eff effs ()
- newtype AssertionError = GenericAssertion {}
- class AsAssertionError r where
- data ChainClientNotification
- type EmulatorEvent = EmulatorTimeEvent EmulatorEvent'
- data EmulatorEvent'
- data EmulatorTimeEvent e = EmulatorTimeEvent {
- _eteEmulatorTime :: Slot
- _eteEvent :: e
- data WalletState = WalletState {}
- emptyWalletState :: Wallet -> Maybe WalletState
- ownPaymentPrivateKey :: WalletState -> PaymentPrivateKey
- ownAddress :: WalletState -> CardanoAddress
- walletAction :: Member MultiAgentEffect effs => Wallet -> Eff EmulatedWalletEffects r -> Eff effs r
- assertion :: Member MultiAgentControlEffect effs => Assertion -> Eff effs ()
- assertOwnFundsEq :: Member MultiAgentControlEffect effs => Wallet -> Value -> Eff effs ()
- ownFundsEqual :: Members MultiAgentEffs effs => Wallet -> Value -> Eff effs ()
- data EmulatorState = EmulatorState {}
- emptyEmulatorState :: EmulatorState
- emulatorState :: Blockchain -> EmulatorState
- emulatorStatePool :: TxPool -> EmulatorState
- emulatorStateInitialDist :: Params -> Map PaymentPubKeyHash Value -> Either ToCardanoError EmulatorState
- txPool :: Lens' ChainState TxPool
- walletStates :: Lens' EmulatorState (Map Wallet WalletState)
- index :: Lens' ChainState UtxoIndex
- chainState :: Lens' EmulatorState ChainState
- chainCurrentSlot :: Lens' ChainState Slot
- processEmulated :: forall effs. (Member (Error WalletAPIError) effs, Member (Error ChainIndexError) effs, Member (Error AssertionError) effs, Member (State EmulatorState) effs, Member (LogMsg EmulatorEvent') effs) => Params -> Eff (MultiAgentEffect ': (MultiAgentControlEffect ': (ChainEffect ': (ChainControlEffect ': effs)))) ~> Eff effs
- fundsDistribution :: EmulatorState -> Map Wallet Value
- emLog :: EmulatorState -> [LogMessage EmulatorEvent]
Wallets
A wallet identifier
Constructors
| Wallet | |
Fields | |
Instances
Constructors
| WalletId | |
Fields | |
Instances
Instances
| Eq XPub | |
| Ord XPub | |
Defined in Cardano.Crypto.Wallet | |
| Show XPub | |
| Generic XPub | |
| NFData XPub | |
Defined in Cardano.Crypto.Wallet | |
| Hashable XPub | |
| type Rep XPub | |
Defined in Cardano.Crypto.Wallet type Rep XPub = D1 ('MetaData "XPub" "Cardano.Crypto.Wallet" "cardano-crypto-1.1.1-AR10YQhE07qCYnMgL8MnSo" 'False) (C1 ('MetaCons "XPub" 'PrefixI 'True) (S1 ('MetaSel ('Just "xpubPublicKey") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ByteString) :*: S1 ('MetaSel ('Just "xpubChaincode") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ChainCode))) | |
mockWalletAddress :: Wallet -> CardanoAddress Source #
Get the cardano address of a mock wallet. (Fails if the wallet is not a mock wallet).
mockWalletPaymentPubKey :: Wallet -> PaymentPubKey Source #
The public key of a mock wallet. (Fails if the wallet is not a mock wallet).
mockWalletPaymentPubKeyHash :: Wallet -> PaymentPubKeyHash Source #
The payment public key hash of a mock wallet. (Fails if the wallet is not a mock wallet).
addSignature :: PrivateKey -> Passphrase -> Tx -> Tx Source #
Sign the transaction with a PrivateKey and passphrase (ByteString) and add the signature to the
transaction's list of signatures.
knownWallets :: [Wallet] Source #
knownWallet :: Integer -> Wallet Source #
newtype WalletNumber Source #
Wrapper for config files and APIs
Constructors
| WalletNumber | |
Instances
data MockWallet Source #
Emulated wallet with a key and a passphrase
Constructors
| MockWallet | |
Fields
| |
Instances
| Show MockWallet | |
Defined in Ledger.CardanoWallet | |
Emulator
type EmulatorEffs = '[MultiAgentEffect, ChainEffect, ChainControlEffect] Source #
Assertions which will be checked during execution of the emulator.
Constructors
| IsValidated CardanoTx | Assert that the given transaction is validated. |
| OwnFundsEqual Wallet Value | Assert that the funds belonging to a wallet's public-key address are equal to a value. |
assertIsValidated :: Member MultiAgentControlEffect effs => CardanoTx -> Eff effs () Source #
Issue an assertion that the given transaction has been validated.
newtype AssertionError Source #
An error emitted when an Assertion fails.
Constructors
| GenericAssertion | |
Fields | |
Instances
class AsAssertionError r where Source #
Minimal complete definition
Methods
_AssertionError :: Prism' r AssertionError Source #
_GenericAssertion :: Prism' r Text Source #
Instances
| AsAssertionError Text Source # | This lets people use |
Defined in Plutus.Contract.Error Methods | |
| AsAssertionError AssertionError Source # | |
Defined in Plutus.Contract.Error | |
| AsAssertionError ContractError Source # | |
Defined in Plutus.Contract.Error | |
| AsAssertionError (TraceError e) Source # | |
Defined in Plutus.Contract.Trace Methods _AssertionError :: Prism' (TraceError e) AssertionError Source # _GenericAssertion :: Prism' (TraceError e) Text Source # | |
data ChainClientNotification Source #
Constructors
| BlockValidated Block | |
| SlotChanged Slot |
Instances
| Eq ChainClientNotification Source # | |
Defined in Wallet.Emulator.NodeClient Methods (==) :: ChainClientNotification -> ChainClientNotification -> Bool Source # (/=) :: ChainClientNotification -> ChainClientNotification -> Bool Source # | |
| Show ChainClientNotification Source # | |
Defined in Wallet.Emulator.NodeClient | |
data EmulatorEvent' Source #
Events produced by the blockchain emulator.
Instances
data EmulatorTimeEvent e Source #
An event with a timestamp measured in emulator time
(currently: Slot)
Constructors
| EmulatorTimeEvent | |
Fields
| |
Instances
Wallet state
data WalletState Source #
The state used by the mock wallet environment.
Constructors
| WalletState | |
Fields
| |
Instances
| Show WalletState Source # | |
Defined in Wallet.Emulator.Wallet | |
ownAddress :: WalletState -> CardanoAddress Source #
Get the user's own payment public-key address.
Traces
walletAction :: Member MultiAgentEffect effs => Wallet -> Eff EmulatedWalletEffects r -> Eff effs r Source #
Run an action in the context of a wallet (ie. agent)
assertOwnFundsEq :: Member MultiAgentControlEffect effs => Wallet -> Value -> Eff effs () Source #
Issue an assertion that the funds for a given wallet have the given value.
ownFundsEqual :: Members MultiAgentEffs effs => Wallet -> Value -> Eff effs () Source #
Issue an assertion that the funds for a given wallet have the given value.
Emulator internals
data EmulatorState Source #
The state of the emulator itself.
Constructors
| EmulatorState | |
Fields
| |
Instances
| Show EmulatorState Source # | |
Defined in Wallet.Emulator.MultiAgent | |
emulatorState :: Blockchain -> EmulatorState Source #
Initialise the emulator state with a blockchain.
emulatorStatePool :: TxPool -> EmulatorState Source #
Initialise the emulator state with a pool of pending transactions.
emulatorStateInitialDist :: Params -> Map PaymentPubKeyHash Value -> Either ToCardanoError EmulatorState Source #
Initialise the emulator state with a single pending transaction that creates the initial distribution of funds to public key addresses.
processEmulated :: forall effs. (Member (Error WalletAPIError) effs, Member (Error ChainIndexError) effs, Member (Error AssertionError) effs, Member (State EmulatorState) effs, Member (LogMsg EmulatorEvent') effs) => Params -> Eff (MultiAgentEffect ': (MultiAgentControlEffect ': (ChainEffect ': (ChainControlEffect ': effs)))) ~> Eff effs Source #
fundsDistribution :: EmulatorState -> Map Wallet Value Source #
Get a map with the total value of each wallet's "own funds".
emLog :: EmulatorState -> [LogMessage EmulatorEvent] Source #
Get the emulator log.