plutus-contract-1.2.0.0
Safe HaskellNone
LanguageHaskell2010

Wallet.Emulator.Wallet

Synopsis

Documentation

newtype SigningProcess Source #

Constructors

SigningProcess 

Fields

Instances

Instances details
Show SigningProcess Source # 
Instance details

Defined in Wallet.Emulator.Wallet

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 #

FromJSON Wallet Source # 
Instance details

Defined in Wallet.Emulator.Wallet

Methods

parseJSON :: Value -> Parser Wallet

parseJSONList :: Value -> Parser [Wallet]

ToJSON Wallet Source # 
Instance details

Defined in Wallet.Emulator.Wallet

Methods

toJSON :: Wallet -> Value

toEncoding :: Wallet -> Encoding

toJSONList :: [Wallet] -> Value

toEncodingList :: [Wallet] -> Encoding

ToJSONKey Wallet Source # 
Instance details

Defined in Wallet.Emulator.Wallet

Methods

toJSONKey :: ToJSONKeyFunction Wallet

toJSONKeyList :: ToJSONKeyFunction [Wallet]

Pretty Wallet Source # 
Instance details

Defined in Wallet.Emulator.Wallet

Methods

pretty :: Wallet -> Doc ann

prettyList :: [Wallet] -> Doc ann

FromHttpApiData Wallet Source # 
Instance details

Defined in Wallet.Emulator.Wallet

Methods

parseUrlPiece :: Text -> Either Text Wallet

parseHeader :: ByteString -> Either Text Wallet

parseQueryParam :: Text -> Either Text Wallet

ToHttpApiData Wallet Source # 
Instance details

Defined in Wallet.Emulator.Wallet

Methods

toUrlPiece :: Wallet -> Text

toEncodedUrlPiece :: Wallet -> Builder

toHeader :: Wallet -> ByteString

toQueryParam :: Wallet -> Text

type Rep Wallet Source # 
Instance details

Defined in Wallet.Emulator.Wallet

type Rep Wallet = D1 ('MetaData "Wallet" "Wallet.Emulator.Wallet" "plutus-contract-1.2.0.0-FH8LC9wh7UV4Nmv68NHXrC" '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 #

FromJSON WalletId Source # 
Instance details

Defined in Wallet.Emulator.Wallet

Methods

parseJSON :: Value -> Parser WalletId

parseJSONList :: Value -> Parser [WalletId]

ToJSON WalletId Source # 
Instance details

Defined in Wallet.Emulator.Wallet

Methods

toJSON :: WalletId -> Value

toEncoding :: WalletId -> Encoding

toJSONList :: [WalletId] -> Value

toEncodingList :: [WalletId] -> Encoding

ToJSONKey WalletId Source # 
Instance details

Defined in Wallet.Emulator.Wallet

Methods

toJSONKey :: ToJSONKeyFunction WalletId

toJSONKeyList :: ToJSONKeyFunction [WalletId]

FromHttpApiData WalletId Source # 
Instance details

Defined in Wallet.Emulator.Wallet

Methods

parseUrlPiece :: Text -> Either Text WalletId

parseHeader :: ByteString -> Either Text WalletId

parseQueryParam :: Text -> Either Text WalletId

ToHttpApiData WalletId Source # 
Instance details

Defined in Wallet.Emulator.Wallet

Methods

toUrlPiece :: WalletId -> Text

toEncodedUrlPiece :: WalletId -> Builder

toHeader :: WalletId -> ByteString

toQueryParam :: WalletId -> Text

type Rep WalletId Source # 
Instance details

Defined in Wallet.Emulator.Wallet

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

walletToMockWallet :: Wallet -> Maybe MockWallet Source #

The MockWallet whose ID is the given wallet ID (if it exists)

walletToMockWallet' :: Wallet -> MockWallet Source #

The same as walletToMockWallet but fails with an error instead of returning Nothing.

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).

mockWalletAddress :: Wallet -> CardanoAddress Source #

Get the cardano address of a mock wallet. (Fails if the wallet is not a mock wallet).

data WalletEvent Source #

Instances

Instances details
Eq WalletEvent Source # 
Instance details

Defined in Wallet.Emulator.Wallet

Show WalletEvent Source # 
Instance details

Defined in Wallet.Emulator.Wallet

Generic WalletEvent Source # 
Instance details

Defined in Wallet.Emulator.Wallet

Associated Types

type Rep WalletEvent :: Type -> Type Source #

FromJSON WalletEvent Source # 
Instance details

Defined in Wallet.Emulator.Wallet

Methods

parseJSON :: Value -> Parser WalletEvent

parseJSONList :: Value -> Parser [WalletEvent]

ToJSON WalletEvent Source # 
Instance details

Defined in Wallet.Emulator.Wallet

Methods

toJSON :: WalletEvent -> Value

toEncoding :: WalletEvent -> Encoding

toJSONList :: [WalletEvent] -> Value

toEncodingList :: [WalletEvent] -> Encoding

Pretty WalletEvent Source # 
Instance details

Defined in Wallet.Emulator.Wallet

Methods

pretty :: WalletEvent -> Doc ann

prettyList :: [WalletEvent] -> Doc ann

type Rep WalletEvent Source # 
Instance details

Defined in Wallet.Emulator.Wallet

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

chainIndexEmulatorState :: Lens' WalletState ChainIndexEmulatorState Source #

ownPaymentPrivateKey :: WalletState -> PaymentPrivateKey Source #

ownAddress :: WalletState -> CardanoAddress Source #

Get the user's own payment public-key address.

fromMockWallet :: MockWallet -> WalletState Source #

An empty wallet using the given private key. for that wallet as the sole watched address.

emptyWalletState :: Wallet -> Maybe WalletState Source #

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

handleWallet :: (Member (Error WalletAPIError) effs, Member NodeClientEffect effs, Member ChainIndexQueryEffect effs, Member (State WalletState) effs, Member (LogMsg TxBalanceMsg) effs) => WalletEffect ~> Eff effs Source #

handleBalance :: (Member NodeClientEffect effs, Member ChainIndexQueryEffect effs, Member (State WalletState) effs, Member (LogMsg TxBalanceMsg) effs, Member (Error WalletAPIError) effs) => UnbalancedTx -> Eff effs CardanoTx Source #

handleAddSignature :: (Member (State WalletState) effs, Member (Error WalletAPIError) effs) => CardanoTx -> Eff effs CardanoTx Source #

ownOutputs :: forall effs. (Member ChainIndexQueryEffect effs, Member (State WalletState) effs, Member NodeClientEffect effs, Member (Error WalletAPIError) effs) => Eff effs UtxoIndex Source #

signWithPrivateKey :: PaymentPrivateKey -> SigningProcess Source #

signWallet :: MockWallet -> SigningProcess Source #

Sign the transaction by calling signTxnWithKey (throwing a PrivateKeyNotFound error if called with a key other than the wallet's private key)

signTxnWithKey :: Member (Error WalletAPIError) r => MockWallet -> CardanoTx -> PaymentPubKeyHash -> Eff r CardanoTx Source #

Sign the transaction with the private key of the mock wallet.

signTxWithPrivateKey :: Member (Error WalletAPIError) r => PaymentPrivateKey -> CardanoTx -> PaymentPubKeyHash -> Eff r CardanoTx Source #

Sign the transaction with the private key, if the hash is that of the private key.

signPrivateKeys :: [PaymentPrivateKey] -> SigningProcess Source #

Sign the transaction with the given private keys, ignoring the list of public keys that the SigningProcess is passed.

setSigningProcess :: forall effs. Member SigningProcessControlEffect effs => Maybe SigningProcess -> Eff effs () Source #

data Entity Source #

An Entity is a thing that can hold Value. Used in the balances function to compute who holds for a given chain state and set of wallets.

Instances

Instances details
Eq Entity Source # 
Instance details

Defined in Wallet.Emulator.Wallet

Ord Entity Source # 
Instance details

Defined in Wallet.Emulator.Wallet

Show Entity Source # 
Instance details

Defined in Wallet.Emulator.Wallet

walletPaymentPubKeyHashes :: WalletSet -> Map PaymentPubKeyHash Wallet Source #

Pick out all the public keys from the set of wallets and map them back to their corresponding wallets.

balances :: ChainState -> WalletSet -> Map Entity Value Source #

For a set of wallets, convert them into a map of value: entity, where entity is one of Entity.