Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype SigningProcess = SigningProcess {
- unSigningProcess :: forall effs. Member (Error WalletAPIError) effs => [PaymentPubKeyHash] -> CardanoTx -> Eff effs CardanoTx
- data Wallet = Wallet {}
- toMockWallet :: MockWallet -> Wallet
- knownWallets :: [Wallet]
- knownWallet :: Integer -> Wallet
- fromWalletNumber :: WalletNumber -> Wallet
- newtype WalletId = WalletId {
- unWalletId :: Digest Blake2b_160
- toBase16 :: WalletId -> Text
- fromBase16 :: Text -> Either String WalletId
- walletToMockWallet :: Wallet -> Maybe MockWallet
- walletToMockWallet' :: Wallet -> MockWallet
- mockWalletPaymentPubKey :: Wallet -> PaymentPubKey
- mockWalletPaymentPubKeyHash :: Wallet -> PaymentPubKeyHash
- mockWalletAddress :: Wallet -> CardanoAddress
- data WalletEvent
- _TxBalanceLog :: Prism' WalletEvent TxBalanceMsg
- _RequestHandlerLog :: Prism' WalletEvent RequestHandlerLogMsg
- _CheckpointLog :: Prism' WalletEvent CheckpointLogMsg
- _GenericLog :: Prism' WalletEvent Text
- data WalletState = WalletState {
- _mockWallet :: MockWallet
- _nodeClient :: NodeClientState
- _chainIndexEmulatorState :: ChainIndexEmulatorState
- _signingProcess :: Maybe SigningProcess
- signingProcess :: Lens' WalletState (Maybe SigningProcess)
- nodeClient :: Lens' WalletState NodeClientState
- mockWallet :: Lens' WalletState MockWallet
- chainIndexEmulatorState :: Lens' WalletState ChainIndexEmulatorState
- ownPaymentPrivateKey :: WalletState -> PaymentPrivateKey
- ownPaymentPublicKey :: WalletState -> PaymentPubKey
- ownAddress :: WalletState -> CardanoAddress
- fromMockWallet :: MockWallet -> WalletState
- emptyWalletState :: Wallet -> Maybe WalletState
- handleWallet :: (Member (Error WalletAPIError) effs, Member NodeClientEffect effs, Member ChainIndexQueryEffect effs, Member (State WalletState) effs, Member (LogMsg TxBalanceMsg) effs) => WalletEffect ~> Eff effs
- handleBalance :: (Member NodeClientEffect effs, Member ChainIndexQueryEffect effs, Member (State WalletState) effs, Member (LogMsg TxBalanceMsg) effs, Member (Error WalletAPIError) effs) => UnbalancedTx -> Eff effs CardanoTx
- handleAddSignature :: (Member (State WalletState) effs, Member (Error WalletAPIError) effs) => CardanoTx -> Eff effs CardanoTx
- ownOutputs :: forall effs. (Member ChainIndexQueryEffect effs, Member (State WalletState) effs, Member NodeClientEffect effs, Member (Error WalletAPIError) effs) => Eff effs UtxoIndex
- defaultSigningProcess :: MockWallet -> SigningProcess
- signWithPrivateKey :: PaymentPrivateKey -> SigningProcess
- signWallet :: MockWallet -> SigningProcess
- signTxnWithKey :: Member (Error WalletAPIError) r => MockWallet -> CardanoTx -> PaymentPubKeyHash -> Eff r CardanoTx
- signTxWithPrivateKey :: Member (Error WalletAPIError) r => PaymentPrivateKey -> CardanoTx -> PaymentPubKeyHash -> Eff r CardanoTx
- signPrivateKeys :: [PaymentPrivateKey] -> SigningProcess
- data SigningProcessControlEffect r where
- setSigningProcess :: forall effs. Member SigningProcessControlEffect effs => Maybe SigningProcess -> Eff effs ()
- type SigningProcessEffs = '[State (Maybe SigningProcess), Error WalletAPIError]
- handleSigningProcessControl :: Members SigningProcessEffs effs => Eff (SigningProcessControlEffect ': effs) ~> Eff effs
- data Entity
- = WalletEntity Wallet
- | PubKeyHashEntity PubKeyHash
- | ScriptEntity ValidatorHash
- type WalletSet = Map Wallet WalletState
- walletPaymentPubKeyHashes :: WalletSet -> Map PaymentPubKeyHash Wallet
- balances :: ChainState -> WalletSet -> Map Entity Value
Documentation
newtype SigningProcess Source #
SigningProcess | |
|
Instances
Show SigningProcess Source # | |
Defined in Wallet.Emulator.Wallet |
A wallet identifier
Instances
Eq Wallet Source # | |
Data Wallet Source # | |
Defined in Wallet.Emulator.Wallet 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 # | |
Defined in Wallet.Emulator.Wallet | |
Show Wallet Source # | |
Generic Wallet Source # | |
FromJSON Wallet Source # | |
Defined in Wallet.Emulator.Wallet parseJSON :: Value -> Parser Wallet parseJSONList :: Value -> Parser [Wallet] | |
ToJSON Wallet Source # | |
Defined in Wallet.Emulator.Wallet toEncoding :: Wallet -> Encoding toJSONList :: [Wallet] -> Value toEncodingList :: [Wallet] -> Encoding | |
ToJSONKey Wallet Source # | |
Defined in Wallet.Emulator.Wallet toJSONKey :: ToJSONKeyFunction Wallet toJSONKeyList :: ToJSONKeyFunction [Wallet] | |
Pretty Wallet Source # | |
Defined in Wallet.Emulator.Wallet prettyList :: [Wallet] -> Doc ann | |
FromHttpApiData Wallet Source # | |
Defined in Wallet.Emulator.Wallet parseUrlPiece :: Text -> Either Text Wallet parseHeader :: ByteString -> Either Text Wallet parseQueryParam :: Text -> Either Text Wallet | |
ToHttpApiData Wallet Source # | |
Defined in Wallet.Emulator.Wallet toUrlPiece :: Wallet -> Text toEncodedUrlPiece :: Wallet -> Builder toHeader :: Wallet -> ByteString toQueryParam :: Wallet -> Text | |
type Rep Wallet Source # | |
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))) |
toMockWallet :: MockWallet -> Wallet Source #
knownWallets :: [Wallet] Source #
knownWallet :: Integer -> Wallet Source #
WalletId | |
|
Instances
Eq WalletId Source # | |
Data WalletId Source # | |
Defined in Wallet.Emulator.Wallet 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 # | |
Defined in Wallet.Emulator.Wallet | |
Show WalletId Source # | |
Generic WalletId Source # | |
FromJSON WalletId Source # | |
Defined in Wallet.Emulator.Wallet parseJSON :: Value -> Parser WalletId parseJSONList :: Value -> Parser [WalletId] | |
ToJSON WalletId Source # | |
Defined in Wallet.Emulator.Wallet toEncoding :: WalletId -> Encoding toJSONList :: [WalletId] -> Value toEncodingList :: [WalletId] -> Encoding | |
ToJSONKey WalletId Source # | |
Defined in Wallet.Emulator.Wallet toJSONKey :: ToJSONKeyFunction WalletId toJSONKeyList :: ToJSONKeyFunction [WalletId] | |
FromHttpApiData WalletId Source # | |
Defined in Wallet.Emulator.Wallet parseUrlPiece :: Text -> Either Text WalletId parseHeader :: ByteString -> Either Text WalletId parseQueryParam :: Text -> Either Text WalletId | |
ToHttpApiData WalletId Source # | |
Defined in Wallet.Emulator.Wallet toUrlPiece :: WalletId -> Text toEncodedUrlPiece :: WalletId -> Builder toHeader :: WalletId -> ByteString toQueryParam :: WalletId -> Text | |
type Rep WalletId Source # | |
Defined in Wallet.Emulator.Wallet |
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 #
GenericLog Text | |
CheckpointLog CheckpointLogMsg | |
RequestHandlerLog RequestHandlerLogMsg | |
TxBalanceLog TxBalanceMsg |
Instances
_TxBalanceLog :: Prism' WalletEvent TxBalanceMsg Source #
_RequestHandlerLog :: Prism' WalletEvent RequestHandlerLogMsg Source #
_CheckpointLog :: Prism' WalletEvent CheckpointLogMsg Source #
_GenericLog :: Prism' WalletEvent Text Source #
data WalletState Source #
The state used by the mock wallet environment.
WalletState | |
|
Instances
Show WalletState Source # | |
Defined in Wallet.Emulator.Wallet |
signingProcess :: Lens' WalletState (Maybe SigningProcess) Source #
nodeClient :: Lens' WalletState NodeClientState Source #
mockWallet :: Lens' WalletState MockWallet Source #
chainIndexEmulatorState :: Lens' WalletState ChainIndexEmulatorState Source #
ownPaymentPrivateKey :: WalletState -> PaymentPrivateKey Source #
ownPaymentPublicKey :: WalletState -> PaymentPubKey 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.
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 #
defaultSigningProcess :: MockWallet -> SigningProcess Source #
The default signing process is signWallet
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.
data SigningProcessControlEffect r where Source #
setSigningProcess :: forall effs. Member SigningProcessControlEffect effs => Maybe SigningProcess -> Eff effs () Source #
type SigningProcessEffs = '[State (Maybe SigningProcess), Error WalletAPIError] Source #
handleSigningProcessControl :: Members SigningProcessEffs effs => Eff (SigningProcessControlEffect ': effs) ~> Eff effs 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.
WalletEntity Wallet | |
PubKeyHashEntity PubKeyHash | |
ScriptEntity ValidatorHash |
type WalletSet = Map Wallet WalletState Source #
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.