plutus-contract-0.1.0.0
Safe HaskellNone
LanguageHaskell2010

Wallet.Emulator.Types

Synopsis

Wallets

data Wallet Source #

A wallet identifier

Instances

Instances details
Eq Wallet Source # 
Instance details

Defined in Wallet.Emulator.Wallet

Data Wallet Source # 
Instance details

Defined in Wallet.Emulator.Wallet

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Wallet -> c Wallet Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Wallet Source #

toConstr :: Wallet -> Constr Source #

dataTypeOf :: Wallet -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Wallet) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Wallet) Source #

gmapT :: (forall b. Data b => b -> b) -> Wallet -> Wallet Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Wallet -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Wallet -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Wallet -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Wallet -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Wallet -> m Wallet Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Wallet -> m Wallet Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Wallet -> m Wallet Source #

Ord Wallet Source # 
Instance details

Defined in Wallet.Emulator.Wallet

Show Wallet Source # 
Instance details

Defined in Wallet.Emulator.Wallet

Generic Wallet Source # 
Instance details

Defined in Wallet.Emulator.Wallet

Associated Types

type Rep Wallet :: Type -> Type Source #

ToJSON Wallet Source # 
Instance details

Defined in Wallet.Emulator.Wallet

ToJSONKey Wallet Source # 
Instance details

Defined in Wallet.Emulator.Wallet

FromJSON Wallet Source # 
Instance details

Defined in Wallet.Emulator.Wallet

ToHttpApiData Wallet Source # 
Instance details

Defined in Wallet.Emulator.Wallet

FromHttpApiData Wallet Source # 
Instance details

Defined in Wallet.Emulator.Wallet

ToSchema Wallet Source # 
Instance details

Defined in Wallet.Emulator.Wallet

Pretty Wallet Source # 
Instance details

Defined in Wallet.Emulator.Wallet

Methods

pretty :: Wallet -> Doc ann Source #

prettyList :: [Wallet] -> Doc ann Source #

type Rep Wallet Source # 
Instance details

Defined in Wallet.Emulator.Wallet

type Rep Wallet = D1 ('MetaData "Wallet" "Wallet.Emulator.Wallet" "plutus-contract-0.1.0.0-2DbvKQdtEvHK4UkDq1ndDW" 'False) (C1 ('MetaCons "Wallet" 'PrefixI 'True) (S1 ('MetaSel ('Just "prettyWalletName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe String)) :*: S1 ('MetaSel ('Just "getWalletId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 WalletId)))

newtype WalletId Source #

Constructors

WalletId 

Fields

Instances

Instances details
Eq WalletId Source # 
Instance details

Defined in Wallet.Emulator.Wallet

Data WalletId Source # 
Instance details

Defined in Wallet.Emulator.Wallet

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> WalletId -> c WalletId Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c WalletId Source #

toConstr :: WalletId -> Constr Source #

dataTypeOf :: WalletId -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c WalletId) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c WalletId) Source #

gmapT :: (forall b. Data b => b -> b) -> WalletId -> WalletId Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> WalletId -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> WalletId -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> WalletId -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> WalletId -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> WalletId -> m WalletId Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> WalletId -> m WalletId Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> WalletId -> m WalletId Source #

Ord WalletId Source # 
Instance details

Defined in Wallet.Emulator.Wallet

Show WalletId Source # 
Instance details

Defined in Wallet.Emulator.Wallet

Generic WalletId Source # 
Instance details

Defined in Wallet.Emulator.Wallet

Associated Types

type Rep WalletId :: Type -> Type Source #

ToJSON WalletId Source # 
Instance details

Defined in Wallet.Emulator.Wallet

ToJSONKey WalletId Source # 
Instance details

Defined in Wallet.Emulator.Wallet

FromJSON WalletId Source # 
Instance details

Defined in Wallet.Emulator.Wallet

ToHttpApiData WalletId Source # 
Instance details

Defined in Wallet.Emulator.Wallet

FromHttpApiData WalletId Source # 
Instance details

Defined in Wallet.Emulator.Wallet

ToSchema WalletId Source # 
Instance details

Defined in Wallet.Emulator.Wallet

type Rep WalletId Source # 
Instance details

Defined in Wallet.Emulator.Wallet

type Rep WalletId = D1 ('MetaData "WalletId" "Wallet.Emulator.Wallet" "plutus-contract-0.1.0.0-2DbvKQdtEvHK4UkDq1ndDW" 'True) (C1 ('MetaCons "WalletId" 'PrefixI 'True) (S1 ('MetaSel ('Just "unWalletId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 WalletId)))

data XPrv Source #

Instances

Instances details
NFData XPrv 
Instance details

Defined in Cardano.Crypto.Wallet

Methods

rnf :: XPrv -> () Source #

ByteArrayAccess XPrv 
Instance details

Defined in Cardano.Crypto.Wallet

Methods

length :: XPrv -> Int Source #

withByteArray :: XPrv -> (Ptr p -> IO a) -> IO a Source #

copyByteArrayToPtr :: XPrv -> Ptr p -> IO () Source #

data XPub Source #

Instances

Instances details
Eq XPub 
Instance details

Defined in Cardano.Crypto.Wallet

Methods

(==) :: XPub -> XPub -> Bool Source #

(/=) :: XPub -> XPub -> Bool Source #

Ord XPub 
Instance details

Defined in Cardano.Crypto.Wallet

Show XPub 
Instance details

Defined in Cardano.Crypto.Wallet

Generic XPub 
Instance details

Defined in Cardano.Crypto.Wallet

Associated Types

type Rep XPub :: Type -> Type Source #

Methods

from :: XPub -> Rep XPub x Source #

to :: Rep XPub x -> XPub Source #

NFData XPub 
Instance details

Defined in Cardano.Crypto.Wallet

Methods

rnf :: XPub -> () Source #

Hashable XPub 
Instance details

Defined in Cardano.Crypto.Wallet

type Rep XPub 
Instance details

Defined in Cardano.Crypto.Wallet

type Rep XPub = D1 ('MetaData "XPub" "Cardano.Crypto.Wallet" "cardano-crypto-1.1.0-9wFlXQG7cusFAdG48AD2Hd" 'False) (C1 ('MetaCons "XPub" 'PrefixI 'True) (S1 ('MetaSel ('Just "xpubPublicKey") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ByteString) :*: S1 ('MetaSel ('Just "xpubChaincode") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ChainCode)))

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.

newtype WalletNumber Source #

Wrapper for config files and APIs

Constructors

WalletNumber 

Fields

Instances

Instances details
Eq WalletNumber 
Instance details

Defined in Ledger.CardanoWallet

Ord WalletNumber 
Instance details

Defined in Ledger.CardanoWallet

Show WalletNumber 
Instance details

Defined in Ledger.CardanoWallet

Generic WalletNumber 
Instance details

Defined in Ledger.CardanoWallet

Associated Types

type Rep WalletNumber :: Type -> Type Source #

ToJSON WalletNumber 
Instance details

Defined in Ledger.CardanoWallet

FromJSON WalletNumber 
Instance details

Defined in Ledger.CardanoWallet

ToHttpApiData WalletNumber 
Instance details

Defined in Ledger.CardanoWallet

FromHttpApiData WalletNumber 
Instance details

Defined in Ledger.CardanoWallet

type Rep WalletNumber 
Instance details

Defined in Ledger.CardanoWallet

type Rep WalletNumber = D1 ('MetaData "WalletNumber" "Ledger.CardanoWallet" "plutus-ledger-0.1.0.0-BAhdPNOPbMF52ZvZJtxBkz" 'True) (C1 ('MetaCons "WalletNumber" 'PrefixI 'True) (S1 ('MetaSel ('Just "getWallet") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer)))

data MockWallet Source #

Emulated wallet with a key and a passphrase

Constructors

MockWallet 

Fields

Instances

Instances details
Show MockWallet 
Instance details

Defined in Ledger.CardanoWallet

type TxPool = [CardanoTx] Source #

A pool of transactions which have yet to be validated.

Emulator

data Assertion Source #

Assertions which will be checked during execution of the emulator.

Constructors

IsValidated Tx

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.

assert :: Members MultiAgentEffs effs => Assertion -> Eff effs () Source #

Issue an Assertion.

assertIsValidated :: Member MultiAgentControlEffect effs => Tx -> 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 

Instances

Instances details
Eq AssertionError Source # 
Instance details

Defined in Plutus.Contract.Error

Show AssertionError Source # 
Instance details

Defined in Plutus.Contract.Error

Generic AssertionError Source # 
Instance details

Defined in Plutus.Contract.Error

Associated Types

type Rep AssertionError :: Type -> Type Source #

ToJSON AssertionError Source # 
Instance details

Defined in Plutus.Contract.Error

FromJSON AssertionError Source # 
Instance details

Defined in Plutus.Contract.Error

Pretty AssertionError Source # 
Instance details

Defined in Plutus.Contract.Error

AsAssertionError AssertionError Source # 
Instance details

Defined in Plutus.Contract.Error

type Rep AssertionError Source # 
Instance details

Defined in Plutus.Contract.Error

type Rep AssertionError = D1 ('MetaData "AssertionError" "Plutus.Contract.Error" "plutus-contract-0.1.0.0-2DbvKQdtEvHK4UkDq1ndDW" 'True) (C1 ('MetaCons "GenericAssertion" 'PrefixI 'True) (S1 ('MetaSel ('Just "unAssertionError") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

data EmulatorEvent' Source #

Events produced by the blockchain emulator.

Instances

Instances details
Eq EmulatorEvent' Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

Show EmulatorEvent' Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

Generic EmulatorEvent' Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

Associated Types

type Rep EmulatorEvent' :: Type -> Type Source #

ToJSON EmulatorEvent' Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

FromJSON EmulatorEvent' Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

Pretty EmulatorEvent' Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

type Rep EmulatorEvent' Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

type Rep EmulatorEvent' = D1 ('MetaData "EmulatorEvent'" "Wallet.Emulator.MultiAgent" "plutus-contract-0.1.0.0-2DbvKQdtEvHK4UkDq1ndDW" 'False) ((C1 ('MetaCons "ChainEvent" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ChainEvent)) :+: (C1 ('MetaCons "ClientEvent" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Wallet) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NodeClientEvent)) :+: C1 ('MetaCons "WalletEvent" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Wallet) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 WalletEvent)))) :+: ((C1 ('MetaCons "ChainIndexEvent" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Wallet) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ChainIndexLog)) :+: C1 ('MetaCons "SchedulerEvent" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SchedulerLog))) :+: (C1 ('MetaCons "InstanceEvent" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ContractInstanceLog)) :+: C1 ('MetaCons "UserThreadEvent" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UserThreadMsg)))))

data EmulatorTimeEvent e Source #

An event with a timestamp measured in emulator time (currently: Slot)

Constructors

EmulatorTimeEvent 

Instances

Instances details
Functor EmulatorTimeEvent Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

Foldable EmulatorTimeEvent Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

Methods

fold :: Monoid m => EmulatorTimeEvent m -> m Source #

foldMap :: Monoid m => (a -> m) -> EmulatorTimeEvent a -> m Source #

foldMap' :: Monoid m => (a -> m) -> EmulatorTimeEvent a -> m Source #

foldr :: (a -> b -> b) -> b -> EmulatorTimeEvent a -> b Source #

foldr' :: (a -> b -> b) -> b -> EmulatorTimeEvent a -> b Source #

foldl :: (b -> a -> b) -> b -> EmulatorTimeEvent a -> b Source #

foldl' :: (b -> a -> b) -> b -> EmulatorTimeEvent a -> b Source #

foldr1 :: (a -> a -> a) -> EmulatorTimeEvent a -> a Source #

foldl1 :: (a -> a -> a) -> EmulatorTimeEvent a -> a Source #

toList :: EmulatorTimeEvent a -> [a] Source #

null :: EmulatorTimeEvent a -> Bool Source #

length :: EmulatorTimeEvent a -> Int Source #

elem :: Eq a => a -> EmulatorTimeEvent a -> Bool Source #

maximum :: Ord a => EmulatorTimeEvent a -> a Source #

minimum :: Ord a => EmulatorTimeEvent a -> a Source #

sum :: Num a => EmulatorTimeEvent a -> a Source #

product :: Num a => EmulatorTimeEvent a -> a Source #

Traversable EmulatorTimeEvent Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

Eq e => Eq (EmulatorTimeEvent e) Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

Show e => Show (EmulatorTimeEvent e) Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

Generic (EmulatorTimeEvent e) Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

Associated Types

type Rep (EmulatorTimeEvent e) :: Type -> Type Source #

ToJSON e => ToJSON (EmulatorTimeEvent e) Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

FromJSON e => FromJSON (EmulatorTimeEvent e) Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

Pretty e => Pretty (EmulatorTimeEvent e) Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

type Rep (EmulatorTimeEvent e) Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

type Rep (EmulatorTimeEvent e) = D1 ('MetaData "EmulatorTimeEvent" "Wallet.Emulator.MultiAgent" "plutus-contract-0.1.0.0-2DbvKQdtEvHK4UkDq1ndDW" 'False) (C1 ('MetaCons "EmulatorTimeEvent" 'PrefixI 'True) (S1 ('MetaSel ('Just "_eteEmulatorTime") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Slot) :*: S1 ('MetaSel ('Just "_eteEvent") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 e)))

Wallet state

data WalletState Source #

The state used by the mock wallet environment.

Constructors

WalletState 

Fields

Instances

Instances details
Show WalletState Source # 
Instance details

Defined in Wallet.Emulator.Wallet

emptyWalletState :: Wallet -> Maybe WalletState Source #

Empty wallet state for an emulator Wallet. Returns Nothing if the wallet is not known in the emulator.

ownAddress :: WalletState -> Address 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

Instances details
Show EmulatorState Source # 
Instance details

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 :: Map PaymentPubKeyHash Value -> EmulatorState Source #

Initialise the emulator state with a single pending transaction that creates the initial distribution of funds to public key addresses.

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.

selectCoin :: Member (Error WalletAPIError) effs => [(a, Value)] -> Value -> Eff effs ([(a, Value)], Value) Source #

Given a set of as with coin values, and a target value, select a number of a such that their total value is greater than or equal to the target.