plutus-contract-0.1.0.0
Safe HaskellNone
LanguageHaskell2010

Wallet.API

Description

Mock wallet implementation

Synopsis

Documentation

submitTxn :: forall effs. Member WalletEffect effs => CardanoTx -> Eff effs () Source #

yieldUnbalancedTx :: forall effs. Member WalletEffect effs => UnbalancedTx -> Eff effs () Source #

publishTx :: forall effs. Member NodeClientEffect effs => CardanoTx -> Eff effs () Source #

getClientSlot :: forall effs. Member NodeClientEffect effs => Eff effs Slot Source #

newtype PubKey Source #

A cryptographic public key.

Constructors

PubKey 

Instances

Instances details
Eq PubKey 
Instance details

Defined in Plutus.V1.Ledger.Crypto

Ord PubKey 
Instance details

Defined in Plutus.V1.Ledger.Crypto

Show PubKey 
Instance details

Defined in Plutus.V1.Ledger.Crypto

IsString PubKey 
Instance details

Defined in Plutus.V1.Ledger.Crypto

Generic PubKey 
Instance details

Defined in Plutus.V1.Ledger.Crypto

Associated Types

type Rep PubKey :: Type -> Type Source #

NFData PubKey 
Instance details

Defined in Plutus.V1.Ledger.Crypto

Methods

rnf :: PubKey -> () Source #

ToJSON PubKey 
Instance details

Defined in Plutus.V1.Ledger.Crypto

ToJSONKey PubKey 
Instance details

Defined in Plutus.V1.Ledger.Crypto

FromJSON PubKey 
Instance details

Defined in Plutus.V1.Ledger.Crypto

FromJSONKey PubKey 
Instance details

Defined in Plutus.V1.Ledger.Crypto

Newtype PubKey 
Instance details

Defined in Plutus.V1.Ledger.Crypto

Associated Types

type O PubKey Source #

Serialise PubKey 
Instance details

Defined in Plutus.V1.Ledger.Crypto

Pretty PubKey 
Instance details

Defined in Plutus.V1.Ledger.Crypto

Methods

pretty :: PubKey -> Doc ann Source #

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

UnsafeFromData PubKey 
Instance details

Defined in Plutus.V1.Ledger.Crypto

FromData PubKey 
Instance details

Defined in Plutus.V1.Ledger.Crypto

ToData PubKey 
Instance details

Defined in Plutus.V1.Ledger.Crypto

Ord PubKey 
Instance details

Defined in Plutus.V1.Ledger.Crypto

Eq PubKey 
Instance details

Defined in Plutus.V1.Ledger.Crypto

Methods

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

Lift DefaultUni PubKey 
Instance details

Defined in Plutus.V1.Ledger.Crypto

Typeable DefaultUni PubKey 
Instance details

Defined in Plutus.V1.Ledger.Crypto

type Rep PubKey 
Instance details

Defined in Plutus.V1.Ledger.Crypto

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

Defined in Plutus.V1.Ledger.Crypto

type O PubKey = GO (Rep PubKey)

newtype PubKeyHash Source #

The hash of a public key. This is frequently used to identify the public key, rather than the key itself.

Instances

Instances details
Eq PubKeyHash 
Instance details

Defined in Plutus.V1.Ledger.Crypto

Ord PubKeyHash 
Instance details

Defined in Plutus.V1.Ledger.Crypto

Show PubKeyHash 
Instance details

Defined in Plutus.V1.Ledger.Crypto

IsString PubKeyHash 
Instance details

Defined in Plutus.V1.Ledger.Crypto

Generic PubKeyHash 
Instance details

Defined in Plutus.V1.Ledger.Crypto

Associated Types

type Rep PubKeyHash :: Type -> Type Source #

NFData PubKeyHash 
Instance details

Defined in Plutus.V1.Ledger.Crypto

Methods

rnf :: PubKeyHash -> () Source #

Hashable PubKeyHash 
Instance details

Defined in Plutus.V1.Ledger.Crypto

ToJSON PubKeyHash 
Instance details

Defined in Plutus.V1.Ledger.Crypto

ToJSONKey PubKeyHash 
Instance details

Defined in Plutus.V1.Ledger.Crypto

FromJSON PubKeyHash 
Instance details

Defined in Plutus.V1.Ledger.Crypto

FromJSONKey PubKeyHash 
Instance details

Defined in Plutus.V1.Ledger.Crypto

Newtype PubKeyHash 
Instance details

Defined in Plutus.V1.Ledger.Crypto

Associated Types

type O PubKeyHash Source #

Serialise PubKeyHash 
Instance details

Defined in Plutus.V1.Ledger.Crypto

Pretty PubKeyHash 
Instance details

Defined in Plutus.V1.Ledger.Crypto

UnsafeFromData PubKeyHash 
Instance details

Defined in Plutus.V1.Ledger.Crypto

FromData PubKeyHash 
Instance details

Defined in Plutus.V1.Ledger.Crypto

ToData PubKeyHash 
Instance details

Defined in Plutus.V1.Ledger.Crypto

Ord PubKeyHash 
Instance details

Defined in Plutus.V1.Ledger.Crypto

Eq PubKeyHash 
Instance details

Defined in Plutus.V1.Ledger.Crypto

Lift DefaultUni PubKeyHash 
Instance details

Defined in Plutus.V1.Ledger.Crypto

Typeable DefaultUni PubKeyHash 
Instance details

Defined in Plutus.V1.Ledger.Crypto

type Rep PubKeyHash 
Instance details

Defined in Plutus.V1.Ledger.Crypto

type Rep PubKeyHash = D1 ('MetaData "PubKeyHash" "Plutus.V1.Ledger.Crypto" "plutus-ledger-api-0.1.0.0-6XBf4FRRdNK1B20rg7kZGy" 'True) (C1 ('MetaCons "PubKeyHash" 'PrefixI 'True) (S1 ('MetaSel ('Just "getPubKeyHash") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BuiltinByteString)))
type O PubKeyHash 
Instance details

Defined in Plutus.V1.Ledger.Crypto

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.

payToPaymentPublicKeyHash :: (Member WalletEffect effs, Member (Error WalletAPIError) effs, Member (LogMsg Text) effs) => 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 'Ledger.Constraints.OffChain.adjustUnbalancedTx.

payToPaymentPublicKeyHash_ :: (Member WalletEffect effs, Member (Error WalletAPIError) effs, Member (LogMsg Text) effs) => SlotRange -> Value -> PaymentPubKeyHash -> Eff effs () Source #

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

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

Instances details
Functor Interval 
Instance details

Defined in Plutus.V1.Ledger.Interval

Methods

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

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

Defined in Plutus.V1.Ledger.Interval

Eq a => Eq (Interval a) 
Instance details

Defined in Plutus.V1.Ledger.Interval

Methods

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

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

Ord a => Ord (Interval a) 
Instance details

Defined in Plutus.V1.Ledger.Interval

Show a => Show (Interval a) 
Instance details

Defined in Plutus.V1.Ledger.Interval

Generic (Interval a) 
Instance details

Defined in Plutus.V1.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 #

NFData a => NFData (Interval a) 
Instance details

Defined in Plutus.V1.Ledger.Interval

Methods

rnf :: Interval a -> () Source #

Hashable a => Hashable (Interval a) 
Instance details

Defined in Plutus.V1.Ledger.Interval

ToJSON a => ToJSON (Interval a) 
Instance details

Defined in Plutus.V1.Ledger.Interval

FromJSON a => FromJSON (Interval a) 
Instance details

Defined in Plutus.V1.Ledger.Interval

Serialise a => Serialise (Interval a) 
Instance details

Defined in Plutus.V1.Ledger.Interval

Pretty a => Pretty (Interval a) 
Instance details

Defined in Plutus.V1.Ledger.Interval

Methods

pretty :: Interval a -> Doc ann Source #

prettyList :: [Interval a] -> Doc ann Source #

UnsafeFromData a => UnsafeFromData (Interval a) 
Instance details

Defined in Plutus.V1.Ledger.Interval

FromData a => FromData (Interval a) 
Instance details

Defined in Plutus.V1.Ledger.Interval

ToData a => ToData (Interval a) 
Instance details

Defined in Plutus.V1.Ledger.Interval

Ord a => JoinSemiLattice (Interval a) 
Instance details

Defined in Plutus.V1.Ledger.Interval

Methods

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

Ord a => MeetSemiLattice (Interval a) 
Instance details

Defined in Plutus.V1.Ledger.Interval

Methods

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

Ord a => BoundedJoinSemiLattice (Interval a) 
Instance details

Defined in Plutus.V1.Ledger.Interval

Methods

bottom :: Interval a Source #

Ord a => BoundedMeetSemiLattice (Interval a) 
Instance details

Defined in Plutus.V1.Ledger.Interval

Methods

top :: Interval a Source #

Eq a => Eq (Interval a) 
Instance details

Defined in Plutus.V1.Ledger.Interval

Methods

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

Typeable DefaultUni Interval 
Instance details

Defined in Plutus.V1.Ledger.Interval

type Rep (Interval a) 
Instance details

Defined in Plutus.V1.Ledger.Interval

type Rep (Interval a) = D1 ('MetaData "Interval" "Plutus.V1.Ledger.Interval" "plutus-ledger-api-0.1.0.0-6XBf4FRRdNK1B20rg7kZGy" '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

Instances details
Enum Slot 
Instance details

Defined in Plutus.V1.Ledger.Slot

Eq Slot 
Instance details

Defined in Plutus.V1.Ledger.Slot

Methods

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

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

Integral Slot 
Instance details

Defined in Plutus.V1.Ledger.Slot

Data Slot 
Instance details

Defined in Plutus.V1.Ledger.Slot

Methods

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

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

toConstr :: Slot -> Constr Source #

dataTypeOf :: Slot -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Num Slot 
Instance details

Defined in Plutus.V1.Ledger.Slot

Ord Slot 
Instance details

Defined in Plutus.V1.Ledger.Slot

Real Slot 
Instance details

Defined in Plutus.V1.Ledger.Slot

Show Slot 
Instance details

Defined in Plutus.V1.Ledger.Slot

Generic Slot 
Instance details

Defined in Plutus.V1.Ledger.Slot

Associated Types

type Rep Slot :: Type -> Type Source #

Methods

from :: Slot -> Rep Slot x Source #

to :: Rep Slot x -> Slot Source #

NFData Slot 
Instance details

Defined in Plutus.V1.Ledger.Slot

Methods

rnf :: Slot -> () Source #

Hashable Slot 
Instance details

Defined in Plutus.V1.Ledger.Slot

ToJSON Slot 
Instance details

Defined in Plutus.V1.Ledger.Slot

ToJSONKey Slot 
Instance details

Defined in Plutus.V1.Ledger.Slot

FromJSON Slot 
Instance details

Defined in Plutus.V1.Ledger.Slot

FromJSONKey Slot 
Instance details

Defined in Plutus.V1.Ledger.Slot

Serialise Slot 
Instance details

Defined in Plutus.V1.Ledger.Slot

Pretty Slot 
Instance details

Defined in Plutus.V1.Ledger.Slot

Methods

pretty :: Slot -> Doc ann Source #

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

HasDbType Slot 
Instance details

Defined in Plutus.ChainIndex.DbSchema

Associated Types

type DbType Slot Source #

UnsafeFromData Slot 
Instance details

Defined in Plutus.V1.Ledger.Slot

FromData Slot 
Instance details

Defined in Plutus.V1.Ledger.Slot

ToData Slot 
Instance details

Defined in Plutus.V1.Ledger.Slot

Enum Slot 
Instance details

Defined in Plutus.V1.Ledger.Slot

AdditiveSemigroup Slot 
Instance details

Defined in Plutus.V1.Ledger.Slot

Methods

(+) :: Slot -> Slot -> Slot Source #

AdditiveMonoid Slot 
Instance details

Defined in Plutus.V1.Ledger.Slot

Methods

zero :: Slot Source #

AdditiveGroup Slot 
Instance details

Defined in Plutus.V1.Ledger.Slot

Methods

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

Ord Slot 
Instance details

Defined in Plutus.V1.Ledger.Slot

Eq Slot 
Instance details

Defined in Plutus.V1.Ledger.Slot

Methods

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

Lift DefaultUni Slot 
Instance details

Defined in Plutus.V1.Ledger.Slot

Typeable DefaultUni Slot 
Instance details

Defined in Plutus.V1.Ledger.Slot

type Rep Slot 
Instance details

Defined in Plutus.V1.Ledger.Slot

type Rep Slot = D1 ('MetaData "Slot" "Plutus.V1.Ledger.Slot" "plutus-ledger-api-0.1.0.0-6XBf4FRRdNK1B20rg7kZGy" 'True) (C1 ('MetaCons "Slot" 'PrefixI 'True) (S1 ('MetaSel ('Just "getSlot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer)))
type DbType Slot 
Instance details

Defined in Plutus.ChainIndex.DbSchema

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.

isEmpty :: (Enum a, 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.

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.

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

Instances details
Eq WalletAPIError Source # 
Instance details

Defined in Wallet.Emulator.Error

Show WalletAPIError Source # 
Instance details

Defined in Wallet.Emulator.Error

Generic WalletAPIError Source # 
Instance details

Defined in Wallet.Emulator.Error

Associated Types

type Rep WalletAPIError :: Type -> Type Source #

ToJSON WalletAPIError Source # 
Instance details

Defined in Wallet.Emulator.Error

FromJSON WalletAPIError Source # 
Instance details

Defined in Wallet.Emulator.Error

Pretty WalletAPIError Source # 
Instance details

Defined in Wallet.Emulator.Error

type Rep WalletAPIError Source # 
Instance details

Defined in Wallet.Emulator.Error

type Rep WalletAPIError = D1 ('MetaData "WalletAPIError" "Wallet.Emulator.Error" "plutus-contract-0.1.0.0-2DbvKQdtEvHK4UkDq1ndDW" 'False) (((C1 ('MetaCons "InsufficientFunds" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :+: C1 ('MetaCons "ChangeHasLessThanNAda" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Value) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Ada))) :+: (C1 ('MetaCons "PaymentPrivateKeyNotFound" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PaymentPubKeyHash)) :+: C1 ('MetaCons "ValidationError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ValidationError)))) :+: ((C1 ('MetaCons "ToCardanoError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ToCardanoError)) :+: C1 ('MetaCons "PaymentMkTxError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MkTxError))) :+: (C1 ('MetaCons "RemoteClientFunctionNotYetSupported" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :+: C1 ('MetaCons "OtherError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))))