plutus-wallet-api-0.1.0.0: Wallet API

Safe HaskellNone
LanguageHaskell2010

Wallet.API

Contents

Description

The interface between the wallet and Plutus client code.

Synopsis

Documentation

class WalletAPI m where Source #

Used by Plutus client to interact with wallet

Methods

submitTxn :: Tx -> m () Source #

Submit a transaction to the blockchain.

ownPubKey :: m PubKey Source #

Access the wallet's PublicKey.

sign :: ByteString -> m Signature Source #

Sign a message using the wallet's private key NOTE: In the future this won't be part of WalletAPI to allow the signing to be handled by a different process

createPaymentWithChange :: Value -> m (Set TxIn, Maybe TxOut) Source #

Select enough inputs from the user's UTxOs to make a payment of the given value. Includes an output for any leftover funds, if there are any. Fails if we don't have enough funds.

registerOnce :: EventTrigger -> EventHandler m -> m () Source #

Register a EventHandler in m () to be run a single time when the condition is true.

  • The action will be run when the condition holds for the first time. For example, registerOnce (slotRangeT (Interval 3 6)) a causes a to be run at block 3. See register for a variant that runs the action multiple times.
  • Each time the wallet is notified of a new block, all triggers are checked and the matching ones are run in an unspecified order and then deleted.
  • The wallet will only watch "known" addresses. There are two ways an address can become a known address. 1. When a trigger is registered for it 2. When a transaction submitted by this wallet produces an output for it When an address is added to the set of known addresses, it starts out with an initial value of 0. If there already exist unspent transaction outputs at that address on the chain, then those will be ignored.
  • Triggers are run in order, so: register c a >> register c b = register c (a >> b)

watchedAddresses :: m AddressMap Source #

The AddressMap of all addresses currently watched by the wallet.

startWatching :: Address -> m () Source #

Start watching an address.

slot :: m Slot Source #

The current slot.

class MonadError WalletAPIError m => WalletDiagnostics m where Source #

The ability to log messages and throw errors.

Methods

logMsg :: Text -> m () Source #

Write some information to the log.

newtype EventHandler m Source #

An action that can be run in response to a blockchain event.

An action receives the EventTrigger which triggered it, annotated with truth values. This allows it to discern how exactly the condition was made true, which is important in case it is a disjunction. For example, if the trigger is "the funds at my address are between 0 and 10 or between 50 and 100" it may be very important to know which of these is the case.

Constructors

EventHandler 

newtype PubKey Source #

A cryptographic public key.

Constructors

PubKey 
Instances
Eq PubKey 
Instance details

Defined in Ledger.Crypto

Ord PubKey 
Instance details

Defined in Ledger.Crypto

Show PubKey 
Instance details

Defined in Ledger.Crypto

Generic PubKey 
Instance details

Defined in Ledger.Crypto

Associated Types

type Rep PubKey :: Type -> Type Source #

IotsType PubKey 
Instance details

Defined in Ledger.Crypto

ToSchema PubKey 
Instance details

Defined in Ledger.Crypto

Eq PubKey 
Instance details

Defined in Ledger.Crypto

Methods

(==) :: PubKey -> PubKey -> Bool

Ord PubKey 
Instance details

Defined in Ledger.Crypto

Lift PubKey 
Instance details

Defined in Ledger.Crypto

Methods

lift :: PubKey -> RTCompile (Term TyName Name ())

Serialise PubKey 
Instance details

Defined in Ledger.Crypto

Methods

encode :: PubKey -> Encoding

decode :: Decoder s PubKey

encodeList :: [PubKey] -> Encoding

decodeList :: Decoder s [PubKey]

FromJSON PubKey 
Instance details

Defined in Ledger.Crypto

Methods

parseJSON :: Value -> Parser PubKey

parseJSONList :: Value -> Parser [PubKey]

FromJSONKey PubKey 
Instance details

Defined in Ledger.Crypto

Methods

fromJSONKey :: FromJSONKeyFunction PubKey

fromJSONKeyList :: FromJSONKeyFunction [PubKey]

ToJSON PubKey 
Instance details

Defined in Ledger.Crypto

Methods

toJSON :: PubKey -> Value

toEncoding :: PubKey -> Encoding

toJSONList :: [PubKey] -> Value

toEncodingList :: [PubKey] -> Encoding

ToJSONKey PubKey 
Instance details

Defined in Ledger.Crypto

Methods

toJSONKey :: ToJSONKeyFunction PubKey

toJSONKeyList :: ToJSONKeyFunction [PubKey]

Newtype PubKey 
Instance details

Defined in Ledger.Crypto

Associated Types

type O PubKey :: Type

Methods

pack :: O PubKey -> PubKey

unpack :: PubKey -> O PubKey

Typeable PubKey 
Instance details

Defined in Ledger.Crypto

Methods

typeRep :: Proxy PubKey -> RTCompile (Type TyName ())

type Rep PubKey 
Instance details

Defined in Ledger.Crypto

type Rep PubKey = D1 (MetaData "PubKey" "Ledger.Crypto" "plutus-wallet-api-0.1.0.0-BdsTjp7uGUGANkPkvyfvD2-plutus-ledger" True) (C1 (MetaCons "PubKey" PrefixI True) (S1 (MetaSel (Just "getPubKey") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 LedgerBytes)))
type O PubKey 
Instance details

Defined in Ledger.Crypto

type O PubKey = GO (Rep PubKey)

signTxn :: (WalletAPI m, Monad m) => Tx -> m Tx Source #

Sign the transaction with the wallet's private key and add the signature to the transaction's list of signatures.

NOTE: In the future this won't be part of WalletAPI to allow the signing to be handled by a different process

signTxnWithKey :: (WalletAPI m, MonadError WalletAPIError m) => Tx -> PubKey -> m Tx Source #

Sign the transaction with the private key of the given public key. Fails if the wallet doesn't have the private key.

createTxAndSubmit :: (Monad m, WalletAPI m) => SlotRange -> Set TxIn -> [TxOut] -> m Tx Source #

Create a transaction, sign it with the wallet's private key, and submit it. TODO: This is here to make the calculation of fees easier for old-style contracts and should be removed when all contracts have been ported to the new API.

signTxAndSubmit :: (Monad m, WalletAPI m) => Tx -> m Tx Source #

Add the wallet's signature to the transaction and submit it. Returns the transaction with the wallet's signature.

signTxAndSubmit_ :: (Monad m, WalletAPI m) => Tx -> m () Source #

A version of signTxAndSubmit that discards the result.

payToScript :: (Monad m, WalletAPI m) => SlotRange -> Address -> Value -> DataScript -> m Tx Source #

Transfer some funds to an address locked by a script, returning the transaction that was submitted.

payToScript_ :: (Monad m, WalletAPI m) => SlotRange -> Address -> Value -> DataScript -> m () Source #

Transfer some funds to an address locked by a script.

payToPublicKey :: (Monad m, WalletAPI m) => SlotRange -> Value -> PubKey -> m Tx Source #

Transfer some funds to an address locked by a public key, returning the transaction that was submitted.

payToPublicKey_ :: (Monad m, WalletAPI m) => SlotRange -> Value -> PubKey -> m () Source #

Transfer some funds to an address locked by a public key.

payToScripts :: (Monad m, WalletAPI m) => SlotRange -> [(Address, Value, DataScript)] -> m Tx Source #

Transfer some funds to a number of script addresses, returning the transaction that was submitted.

payToScripts_ :: (Monad m, WalletAPI m) => SlotRange -> [(Address, Value, DataScript)] -> m () Source #

Transfer some funds to a number of script addresses.

collectFromScript :: (WalletDiagnostics m, WalletAPI m) => SlotRange -> ValidatorScript -> RedeemerScript -> m () Source #

Collect all unspent outputs from a pay to script address and transfer them to a public key owned by us.

collectFromScriptTxn :: (WalletAPI m, WalletDiagnostics m) => SlotRange -> ValidatorScript -> RedeemerScript -> TxId -> m () Source #

Given the pay to script address of the ValidatorScript, collect from it all the outputs that were produced by a specific transaction, using the RedeemerScript.

spendScriptOutputs :: (Monad m, WalletAPI m) => Address -> ValidatorScript -> RedeemerScript -> m [(TxIn, Value)] Source #

Take all known outputs at an Address and spend them using the validator and redeemer scripts.

ownPubKeyTxOut :: (Monad m, WalletAPI m) => Value -> m TxOut Source #

Create a TxOut that pays to the public key owned by us.

outputsAt :: (Functor m, WalletAPI m) => Address -> m (Map TxOutRef TxOut) Source #

Retrieve the unspent transaction outputs known to the wallet at an adresss.

register :: (WalletAPI m, Monad m) => EventTrigger -> EventHandler m -> m () Source #

A variant of register that registers the trigger again immediately after running the action. This is useful if you want to run the same action every time the condition holds, instead of only the first time.

Slot ranges

data Interval a Source #

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
ToSchema SlotRange 
Instance details

Defined in Ledger.Slot

Eq a => Eq (Interval a) 
Instance details

Defined in Ledger.Interval

Methods

(==) :: Interval a -> Interval a -> Bool Source #

(/=) :: Interval a -> Interval a -> Bool Source #

Ord a => Ord (Interval a) 
Instance details

Defined in Ledger.Interval

Show a => Show (Interval a) 
Instance details

Defined in Ledger.Interval

Generic (Interval a) 
Instance details

Defined in Ledger.Interval

Associated Types

type Rep (Interval a) :: Type -> Type Source #

Methods

from :: Interval a -> Rep (Interval a) x Source #

to :: Rep (Interval a) x -> Interval a Source #

Ord a => BoundedJoinSemiLattice (Interval a) 
Instance details

Defined in Ledger.Interval

Methods

bottom :: Interval a

Ord a => BoundedMeetSemiLattice (Interval a) 
Instance details

Defined in Ledger.Interval

Methods

top :: Interval a

Ord a => JoinSemiLattice (Interval a) 
Instance details

Defined in Ledger.Interval

Methods

(\/) :: Interval a -> Interval a -> Interval a

Ord a => MeetSemiLattice (Interval a) 
Instance details

Defined in Ledger.Interval

Methods

(/\) :: Interval a -> Interval a -> Interval a

(Typeable a, Lift (LowerBound a), Lift (UpperBound a)) => Lift (Interval a) 
Instance details

Defined in Ledger.Interval

Methods

lift :: Interval a -> RTCompile (Term TyName Name ())

Serialise a => Serialise (Interval a) 
Instance details

Defined in Ledger.Interval

Methods

encode :: Interval a -> Encoding

decode :: Decoder s (Interval a)

encodeList :: [Interval a] -> Encoding

decodeList :: Decoder s [Interval a]

FromJSON a => FromJSON (Interval a) 
Instance details

Defined in Ledger.Interval

Methods

parseJSON :: Value -> Parser (Interval a)

parseJSONList :: Value -> Parser [Interval a]

Hashable a => Hashable (Interval a) 
Instance details

Defined in Ledger.Interval

Methods

hashWithSalt :: Int -> Interval a -> Int

hash :: Interval a -> Int

ToJSON a => ToJSON (Interval a) 
Instance details

Defined in Ledger.Interval

Methods

toJSON :: Interval a -> Value

toEncoding :: Interval a -> Encoding

toJSONList :: [Interval a] -> Value

toEncodingList :: [Interval a] -> Encoding

Typeable Interval 
Instance details

Defined in Ledger.Interval

Methods

typeRep :: Proxy Interval -> RTCompile (Type TyName ())

type Rep (Interval a) 
Instance details

Defined in Ledger.Interval

type Rep (Interval a) = D1 (MetaData "Interval" "Ledger.Interval" "plutus-wallet-api-0.1.0.0-BdsTjp7uGUGANkPkvyfvD2-plutus-ledger" False) (C1 (MetaCons "Interval" PrefixI True) (S1 (MetaSel (Just "ivFrom") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (LowerBound a)) :*: S1 (MetaSel (Just "ivTo") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (UpperBound a))))

data Slot Source #

The slot number. This is a good proxy for time, since on the Cardano blockchain slots pass at a constant rate.

Instances
Enum Slot 
Instance details

Defined in Ledger.Slot

Eq Slot 
Instance details

Defined in Ledger.Slot

Methods

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

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

Integral Slot 
Instance details

Defined in Ledger.Slot

Num Slot 
Instance details

Defined in Ledger.Slot

Ord Slot 
Instance details

Defined in Ledger.Slot

Real Slot 
Instance details

Defined in Ledger.Slot

Show Slot 
Instance details

Defined in Ledger.Slot

Generic Slot 
Instance details

Defined in Ledger.Slot

Associated Types

type Rep Slot :: Type -> Type Source #

Methods

from :: Slot -> Rep Slot x Source #

to :: Rep Slot x -> Slot Source #

IotsType Slot 
Instance details

Defined in Ledger.Slot

ToSchema SlotRange 
Instance details

Defined in Ledger.Slot

ToSchema Slot 
Instance details

Defined in Ledger.Slot

Eq Slot 
Instance details

Defined in Ledger.Slot

Methods

(==) :: Slot -> Slot -> Bool

AdditiveGroup Slot 
Instance details

Defined in Ledger.Slot

Methods

(-) :: Slot -> Slot -> Slot

AdditiveMonoid Slot 
Instance details

Defined in Ledger.Slot

Methods

zero :: Slot

AdditiveSemigroup Slot 
Instance details

Defined in Ledger.Slot

Methods

(+) :: Slot -> Slot -> Slot

Ord Slot 
Instance details

Defined in Ledger.Slot

Methods

compare :: Slot -> Slot -> Ordering

(<) :: Slot -> Slot -> Bool

(<=) :: Slot -> Slot -> Bool

(>) :: Slot -> Slot -> Bool

(>=) :: Slot -> Slot -> Bool

max :: Slot -> Slot -> Slot

min :: Slot -> Slot -> Slot

Lift Slot 
Instance details

Defined in Ledger.Slot

Methods

lift :: Slot -> RTCompile (Term TyName Name ())

Serialise Slot 
Instance details

Defined in Ledger.Slot

Methods

encode :: Slot -> Encoding

decode :: Decoder s Slot

encodeList :: [Slot] -> Encoding

decodeList :: Decoder s [Slot]

FromJSON Slot 
Instance details

Defined in Ledger.Slot

Methods

parseJSON :: Value -> Parser Slot

parseJSONList :: Value -> Parser [Slot]

FromJSONKey Slot 
Instance details

Defined in Ledger.Slot

Methods

fromJSONKey :: FromJSONKeyFunction Slot

fromJSONKeyList :: FromJSONKeyFunction [Slot]

Hashable Slot 
Instance details

Defined in Ledger.Slot

Methods

hashWithSalt :: Int -> Slot -> Int

hash :: Slot -> Int

ToJSON Slot 
Instance details

Defined in Ledger.Slot

Methods

toJSON :: Slot -> Value

toEncoding :: Slot -> Encoding

toJSONList :: [Slot] -> Value

toEncodingList :: [Slot] -> Encoding

ToJSONKey Slot 
Instance details

Defined in Ledger.Slot

Methods

toJSONKey :: ToJSONKeyFunction Slot

toJSONKeyList :: ToJSONKeyFunction [Slot]

Typeable Slot 
Instance details

Defined in Ledger.Slot

Methods

typeRep :: Proxy Slot -> RTCompile (Type TyName ())

type Rep Slot 
Instance details

Defined in Ledger.Slot

type Rep Slot = D1 (MetaData "Slot" "Ledger.Slot" "plutus-wallet-api-0.1.0.0-BdsTjp7uGUGANkPkvyfvD2-plutus-ledger" True) (C1 (MetaCons "Slot" PrefixI True) (S1 (MetaSel (Just "getSlot") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Integer)))

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 b. Therefore it includes a but not it does not include b.

intervalTo :: a -> Interval a Source #

See to.

isEmpty :: Ord a => Interval a -> Bool Source #

Check if an Interval is empty.

always :: Interval a Source #

An Interval that covers every slot.

member :: Ord a => a -> Interval a -> Bool Source #

Check whether a value is in an interval.

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.

contains :: Ord a => Interval a -> Interval a -> Bool Source #

a contains b is true if the Interval b is entirely contained in a. That is, a contains b if for every entry s, if member s b then member s a.

Triggers

type EventTrigger = Fix EventTriggerF Source #

A trigger for an action based on an event. This is a logical proposition over some basic assertions about the slot range and the funds at a watched address. For example, a trigger could be "the slot is between 0 and 5 and the funds at my address are between 100 and 200". andT (fundsAtAddressT addr (W.interval (Ada.toValue 100) (Ada.toValue 200)) (slotRangeT (W.interval 0 5))

type AnnotatedEventTrigger a = Fix (Compose ((,) a) EventTriggerF) Source #

An EventTrigger where each level is annotated with a value of a.

data EventTriggerF f Source #

Instances
Functor EventTriggerF Source # 
Instance details

Defined in Wallet.API

Methods

fmap :: (a -> b) -> EventTriggerF a -> EventTriggerF b Source #

(<$) :: a -> EventTriggerF b -> EventTriggerF a Source #

Foldable EventTriggerF Source # 
Instance details

Defined in Wallet.API

Methods

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

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

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

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

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

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

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

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

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

null :: EventTriggerF a -> Bool Source #

length :: EventTriggerF a -> Int Source #

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

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

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

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

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

Traversable EventTriggerF Source # 
Instance details

Defined in Wallet.API

Methods

traverse :: Applicative f => (a -> f b) -> EventTriggerF a -> f (EventTriggerF b) Source #

sequenceA :: Applicative f => EventTriggerF (f a) -> f (EventTriggerF a) Source #

mapM :: Monad m => (a -> m b) -> EventTriggerF a -> m (EventTriggerF b) Source #

sequence :: Monad m => EventTriggerF (m a) -> m (EventTriggerF a) Source #

Eq1 EventTriggerF Source # 
Instance details

Defined in Wallet.API

Methods

liftEq :: (a -> b -> Bool) -> EventTriggerF a -> EventTriggerF b -> Bool Source #

Show1 EventTriggerF Source # 
Instance details

Defined in Wallet.API

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> EventTriggerF a -> ShowS Source #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [EventTriggerF a] -> ShowS Source #

Hashable1 EventTriggerF Source # 
Instance details

Defined in Wallet.API

Methods

liftHashWithSalt :: (Int -> a -> Int) -> Int -> EventTriggerF a -> Int

FromJSON1 EventTriggerF Source # 
Instance details

Defined in Wallet.API

Methods

liftParseJSON :: (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (EventTriggerF a)

liftParseJSONList :: (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [EventTriggerF a]

ToJSON1 EventTriggerF Source # 
Instance details

Defined in Wallet.API

Methods

liftToJSON :: (a -> Value) -> ([a] -> Value) -> EventTriggerF a -> Value

liftToJSONList :: (a -> Value) -> ([a] -> Value) -> [EventTriggerF a] -> Value

liftToEncoding :: (a -> Encoding) -> ([a] -> Encoding) -> EventTriggerF a -> Encoding

liftToEncodingList :: (a -> Encoding) -> ([a] -> Encoding) -> [EventTriggerF a] -> Encoding

Eq f => Eq (EventTriggerF f) Source # 
Instance details

Defined in Wallet.API

Show f => Show (EventTriggerF f) Source # 
Instance details

Defined in Wallet.API

Generic1 EventTriggerF Source # 
Instance details

Defined in Wallet.API

Associated Types

type Rep1 EventTriggerF :: k -> Type Source #

type Rep1 EventTriggerF Source # 
Instance details

Defined in Wallet.API

type Rep1 EventTriggerF = D1 (MetaData "EventTriggerF" "Wallet.API" "plutus-wallet-api-0.1.0.0-D4PH3QwcN0T7WNKgiJJctt" False) (((C1 (MetaCons "TAnd" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) Par1 :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) Par1) :+: C1 (MetaCons "TOr" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) Par1 :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) Par1)) :+: (C1 (MetaCons "TNot" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) Par1) :+: C1 (MetaCons "TAlways" PrefixI False) (U1 :: Type -> Type))) :+: ((C1 (MetaCons "TNever" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "TSlotRange" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 SlotRange))) :+: (C1 (MetaCons "TFundsAtAddressGeq" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Address) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Value)) :+: C1 (MetaCons "TFundsAtAddressGt" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Address) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Value)))))

andT :: EventTrigger -> EventTrigger -> EventTrigger Source #

andT l r is true when l and r are true.

orT :: EventTrigger -> EventTrigger -> EventTrigger Source #

orT l r is true when l or r are true.

notT :: EventTrigger -> EventTrigger Source #

notT t is true when t is false.

alwaysT :: EventTrigger Source #

alwaysT is always true.

neverT :: EventTrigger Source #

neverT is never true.

slotRangeT :: SlotRange -> EventTrigger Source #

slotRangeT r is true when the slot number is in the range r.

fundsAtAddressGeqT :: Address -> Value -> EventTrigger Source #

fundsAtAddressGeqT a t is true when the funds at a are greater than or equal to the threshold t.

fundsAtAddressGtT :: Address -> Value -> EventTrigger Source #

fundsAtAddressGtT a t is true when the funds at a are strictly greater than the threshold t.

checkTrigger :: Slot -> Map Address Value -> EventTrigger -> Bool Source #

Check if the given slot number and watched addresses match the conditions of an EventTrigger.

addresses :: EventTrigger -> [Address] Source #

The addresses that an EventTrigger refers to.

getAnnot :: AnnotatedEventTrigger a -> a Source #

Get the annotation on an AnnotatedEventTrigger.

annTruthValue :: Slot -> Map Address Value -> EventTrigger -> AnnotatedEventTrigger Bool Source #

Annotate each node in an EventTriggerF with its truth value given a slot and a set of watched addresses.

Error handling

data WalletAPIError Source #

An error thrown by wallet interactions.

Constructors

InsufficientFunds Text

There were insufficient funds to perform the desired operation.

PrivateKeyNotFound PubKey

The private key of this public key is not known to the wallet.

OtherError Text

Some other error occurred.

Instances
Eq WalletAPIError Source # 
Instance details

Defined in Wallet.API

Ord WalletAPIError Source # 
Instance details

Defined in Wallet.API

Show WalletAPIError Source # 
Instance details

Defined in Wallet.API

Generic WalletAPIError Source # 
Instance details

Defined in Wallet.API

Associated Types

type Rep WalletAPIError :: Type -> Type Source #

FromJSON WalletAPIError Source # 
Instance details

Defined in Wallet.API

Methods

parseJSON :: Value -> Parser WalletAPIError

parseJSONList :: Value -> Parser [WalletAPIError]

ToJSON WalletAPIError Source # 
Instance details

Defined in Wallet.API

Methods

toJSON :: WalletAPIError -> Value

toEncoding :: WalletAPIError -> Encoding

toJSONList :: [WalletAPIError] -> Value

toEncodingList :: [WalletAPIError] -> Encoding

type Rep WalletAPIError Source # 
Instance details

Defined in Wallet.API

Logging

newtype WalletLog Source #

Constructors

WalletLog 

Fields

Instances
Eq WalletLog Source # 
Instance details

Defined in Wallet.API

Ord WalletLog Source # 
Instance details

Defined in Wallet.API

Show WalletLog Source # 
Instance details

Defined in Wallet.API

Generic WalletLog Source # 
Instance details

Defined in Wallet.API

Associated Types

type Rep WalletLog :: Type -> Type Source #

Semigroup WalletLog Source # 
Instance details

Defined in Wallet.API

Monoid WalletLog Source # 
Instance details

Defined in Wallet.API

FromJSON WalletLog Source # 
Instance details

Defined in Wallet.API

Methods

parseJSON :: Value -> Parser WalletLog

parseJSONList :: Value -> Parser [WalletLog]

ToJSON WalletLog Source # 
Instance details

Defined in Wallet.API

Methods

toJSON :: WalletLog -> Value

toEncoding :: WalletLog -> Encoding

toJSONList :: [WalletLog] -> Value

toEncodingList :: [WalletLog] -> Encoding

type Rep WalletLog Source # 
Instance details

Defined in Wallet.API

type Rep WalletLog = D1 (MetaData "WalletLog" "Wallet.API" "plutus-wallet-api-0.1.0.0-D4PH3QwcN0T7WNKgiJJctt" True) (C1 (MetaCons "WalletLog" PrefixI True) (S1 (MetaSel (Just "getWalletLog") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Text])))

Orphan instances

Hashable1 f => Hashable (Fix f) Source # 
Instance details

Methods

hashWithSalt :: Int -> Fix f -> Int

hash :: Fix f -> Int