| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Wallet.API
Contents
Description
Mock wallet implementation
Synopsis
- data WalletEffect r
- submitTxn :: forall effs. Member WalletEffect effs => CardanoTx -> Eff effs ()
- ownPaymentPubKeyHash :: (Member WalletEffect effs, Member (Error WalletAPIError) effs) => Eff effs PaymentPubKeyHash
- ownPaymentPubKeyHashes :: Member WalletEffect effs => Eff effs [PaymentPubKeyHash]
- ownFirstPaymentPubKeyHash :: (Member WalletEffect effs, Member (Error WalletAPIError) effs) => Eff effs PaymentPubKeyHash
- ownAddresses :: forall effs. Member WalletEffect effs => Eff effs (NonEmpty CardanoAddress)
- balanceTx :: forall effs. Member WalletEffect effs => UnbalancedTx -> Eff effs (Either WalletAPIError CardanoTx)
- yieldUnbalancedTx :: forall effs. Member WalletEffect effs => UnbalancedTx -> Eff effs ()
- data NodeClientEffect r
- publishTx :: forall effs. Member NodeClientEffect effs => CardanoTx -> Eff effs ()
- getClientSlot :: forall effs. Member NodeClientEffect effs => Eff effs Slot
- getClientParams :: forall effs. Member NodeClientEffect effs => Eff effs Params
- newtype PubKey = PubKey {}
- newtype PubKeyHash = PubKeyHash {}
- signTxAndSubmit :: Member WalletEffect effs => CardanoTx -> Eff effs CardanoTx
- signTxAndSubmit_ :: Member WalletEffect effs => CardanoTx -> Eff effs ()
- payToAddress :: (Member WalletEffect effs, Member (Error WalletAPIError) effs, Member (LogMsg Text) effs, Member (LogMsg RequestHandlerLogMsg) effs) => Params -> SlotRange -> Value -> Address -> Eff effs CardanoTx
- payToAddress_ :: (Member WalletEffect effs, Member (Error WalletAPIError) effs, Member (LogMsg Text) effs, Member (LogMsg RequestHandlerLogMsg) effs) => Params -> SlotRange -> Value -> Address -> Eff effs ()
- payToPaymentPublicKeyHash :: (Member WalletEffect effs, Member (Error WalletAPIError) effs, Member (LogMsg Text) effs, Member (LogMsg RequestHandlerLogMsg) effs) => Params -> SlotRange -> Value -> PaymentPubKeyHash -> Eff effs CardanoTx
- payToPaymentPublicKeyHash_ :: (Member WalletEffect effs, Member (Error WalletAPIError) effs, Member (LogMsg Text) effs, Member (LogMsg RequestHandlerLogMsg) effs) => Params -> SlotRange -> Value -> PaymentPubKeyHash -> Eff effs ()
- data Params = Params {}
- data Interval a = Interval {
- ivFrom :: LowerBound a
- ivTo :: UpperBound a
- data Slot
- type SlotRange = Interval Slot
- width :: SlotRange -> Maybe Integer
- defaultSlotRange :: SlotRange
- interval :: a -> a -> Interval a
- singleton :: a -> Interval a
- isEmpty :: (Enum a, Ord a) => Interval a -> Bool
- always :: Interval a
- member :: Ord a => a -> Interval a -> Bool
- before :: Ord a => a -> Interval a -> Bool
- after :: Ord a => a -> Interval a -> Bool
- contains :: Ord a => Interval a -> Interval a -> Bool
- data WalletAPIError
- throwInsufficientFundsError :: Member (Error WalletAPIError) effs => Text -> Eff effs a
- throwOtherError :: Member (Error WalletAPIError) effs => Text -> Eff effs a
Documentation
data WalletEffect r Source #
ownPaymentPubKeyHash :: (Member WalletEffect effs, Member (Error WalletAPIError) effs) => Eff effs PaymentPubKeyHash Source #
Deprecated: Use ownFirstPaymentPubKeyHash, ownPaymentPubKeyHashes or ownAddresses instead
ownPaymentPubKeyHashes :: Member WalletEffect effs => Eff effs [PaymentPubKeyHash] Source #
ownFirstPaymentPubKeyHash :: (Member WalletEffect effs, Member (Error WalletAPIError) effs) => Eff effs PaymentPubKeyHash Source #
ownAddresses :: forall effs. Member WalletEffect effs => Eff effs (NonEmpty CardanoAddress) Source #
balanceTx :: forall effs. Member WalletEffect effs => UnbalancedTx -> Eff effs (Either WalletAPIError CardanoTx) Source #
yieldUnbalancedTx :: forall effs. Member WalletEffect effs => UnbalancedTx -> Eff effs () Source #
data NodeClientEffect r Source #
getClientSlot :: forall effs. Member NodeClientEffect effs => Eff effs Slot Source #
getClientParams :: forall effs. Member NodeClientEffect effs => Eff effs Params Source #
Constructors
| PubKey | |
Fields | |
Instances
newtype PubKeyHash Source #
The hash of a public key. This is frequently used to identify the public key, rather than the key itself.
Constructors
| PubKeyHash | |
Fields | |
Instances
signTxAndSubmit :: Member WalletEffect effs => CardanoTx -> Eff effs CardanoTx Source #
Add the wallet's signature to the transaction and submit it. Returns the transaction with the wallet's signature.
signTxAndSubmit_ :: Member WalletEffect effs => CardanoTx -> Eff effs () Source #
A version of signTxAndSubmit that discards the result.
payToAddress :: (Member WalletEffect effs, Member (Error WalletAPIError) effs, Member (LogMsg Text) effs, Member (LogMsg RequestHandlerLogMsg) effs) => Params -> SlotRange -> Value -> Address -> Eff effs CardanoTx Source #
Transfer some funds to an address, returning the transaction that was submitted.
Note: Due to a constraint in the Cardano ledger, each tx output must have a
minimum amount of Ada. Therefore, the funds to transfer will be adjusted
to satisfy that constraint. See adjustUnbalancedTx.
payToAddress_ :: (Member WalletEffect effs, Member (Error WalletAPIError) effs, Member (LogMsg Text) effs, Member (LogMsg RequestHandlerLogMsg) effs) => Params -> SlotRange -> Value -> Address -> Eff effs () Source #
Transfer some funds to an address.
payToPaymentPublicKeyHash :: (Member WalletEffect effs, Member (Error WalletAPIError) effs, Member (LogMsg Text) effs, Member (LogMsg RequestHandlerLogMsg) effs) => Params -> SlotRange -> Value -> PaymentPubKeyHash -> Eff effs CardanoTx Source #
Transfer some funds to an address locked by a public key, returning the transaction that was submitted.
Note: Due to a constraint in the Cardano ledger, each tx output must have a
minimum amount of Ada. Therefore, the funds to transfer will be adjusted
to satisfy that constraint. See adjustUnbalancedTx.
payToPaymentPublicKeyHash_ :: (Member WalletEffect effs, Member (Error WalletAPIError) effs, Member (LogMsg Text) effs, Member (LogMsg RequestHandlerLogMsg) effs) => Params -> SlotRange -> Value -> PaymentPubKeyHash -> Eff effs () Source #
Transfer some funds to an address locked by a public key.
Constructors
| Params | |
Fields | |
Instances
| Eq Params | |
| Show Params | |
| Generic Params | |
| ToJSON Params | |
| FromJSON Params | |
| Default Params | |
Defined in Cardano.Node.Emulator.Params | |
| Pretty Params | |
| type Rep Params | |
Defined in Cardano.Node.Emulator.Params type Rep Params = D1 ('MetaData "Params" "Cardano.Node.Emulator.Params" "cardano-node-emulator-1.1.0.0-86RbaXcxDhk56O3Y8j0lgb" 'False) (C1 ('MetaCons "Params" 'PrefixI 'True) (S1 ('MetaSel ('Just "pSlotConfig") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SlotConfig) :*: (S1 ('MetaSel ('Just "emulatorPParams") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PParams) :*: S1 ('MetaSel ('Just "pNetworkId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NetworkId)))) | |
Slot ranges
An interval of as.
The interval may be either closed or open at either end, meaning that the endpoints may or may not be included in the interval.
The interval can also be unbounded on either side.
Constructors
| Interval | |
Fields
| |
Instances
The slot number. This is a good proxy for time, since on the Cardano blockchain slots pass at a constant rate.
Instances
width :: SlotRange -> Maybe Integer Source #
Number of Slots covered by the interval, if finite. width (from x) == Nothing.
defaultSlotRange :: SlotRange Source #
The default slot validity range for transactions.
interval :: a -> a -> Interval a Source #
interval a b includes all values that are greater than or equal to a
and smaller than or equal to b. Therefore it includes a and b.
before :: Ord a => a -> Interval a -> Bool Source #
Check if a value is earlier than the beginning of an Interval.
after :: Ord a => a -> Interval a -> Bool Source #
Check if a value is later than the end of a Interval.
Error handling
data WalletAPIError Source #
An error thrown by wallet interactions.
Constructors
| InsufficientFunds Text | There were insufficient funds to perform the desired operation. |
| ChangeHasLessThanNAda Value Ada | The change when selecting coins contains less than the minimum amount of Ada. |
| NoPaymentPubKeyHashError | The wallet doesn't have any payment key hash, which should not be possible. |
| PaymentPrivateKeyNotFound PaymentPubKeyHash | The private key of this public key hash is not known to the wallet. |
| ValidationError ValidationError | There was an error during off-chain validation. |
| ToCardanoError ToCardanoError | There was an error while converting to Cardano.API format. |
| PaymentMkTxError MkTxError | There was an error while creating a payment transaction |
| RemoteClientFunctionNotYetSupported Text | The called wallet effect is not yet supported in a remote wallet client scenario. |
| OtherError Text | Some other error occurred. |
Instances
throwInsufficientFundsError :: Member (Error WalletAPIError) effs => Text -> Eff effs a Source #
throwOtherError :: Member (Error WalletAPIError) effs => Text -> Eff effs a Source #