Skip to content

Commit

Permalink
PLT-313 Add ownAddresses request in Contract API which will replace o…
Browse files Browse the repository at this point in the history
…wnPaymentPubKeyHash.

* `ownPaymentPubKeyHash` is marked as deprecated

* All plutus-use-cases examples replace usage of `ownPaymentPubKeyHash` with `ownAddresses`
  • Loading branch information
koslambrou committed Jun 27, 2022
1 parent 358fb5f commit 8f31273
Show file tree
Hide file tree
Showing 49 changed files with 309 additions and 105 deletions.
8 changes: 6 additions & 2 deletions playground-common/src/Playground/Contract.hs
Expand Up @@ -42,6 +42,9 @@ module Playground.Contract
, type (.\/)
, interval
, ownPaymentPubKeyHash
, ownFirstPaymentPubKeyHash
, ownPaymentPubKeyHashes
, ownAddresses
, awaitSlot
, modifiesUtxoSet
, utxosAt
Expand All @@ -66,8 +69,9 @@ import Playground.Interpreter.Util
import Playground.Schema (endpointsToSchemas)
import Playground.TH (ensureKnownCurrencies, mkFunction, mkFunctions, mkKnownCurrencies, mkSchemaDefinitions)
import Playground.Types (Expression, FunctionSchema, KnownCurrency (KnownCurrency), adaCurrency)
import Plutus.Contract (AsContractError, Contract, Endpoint, awaitSlot, endpoint, ownPaymentPubKeyHash, submitTx,
type (.\/), utxosAt, watchAddressUntilSlot)
import Plutus.Contract (AsContractError, Contract, Endpoint, awaitSlot, endpoint, ownAddresses,
ownFirstPaymentPubKeyHash, ownPaymentPubKeyHash, ownPaymentPubKeyHashes, submitTx, type (.\/),
utxosAt, watchAddressUntilSlot)
import Plutus.Contract.Trace (TraceError (..))
import Schema (FormSchema, ToArgument, ToSchema)
import Wallet.Emulator.Types (Wallet (..))
Expand Down
2 changes: 2 additions & 0 deletions plutus-chain-index-core/src/Plutus/ChainIndex/Types.hs
Expand Up @@ -162,6 +162,8 @@ data Tip =
deriving stock (Eq, Show, Generic)
deriving anyclass (ToJSON, FromJSON, OpenApi.ToSchema)

makePrisms ''Tip

-- | When performing a rollback the chain sync protocol does not provide a block
-- number where to resume from.
data Point =
Expand Down
6 changes: 5 additions & 1 deletion plutus-contract/src/Plutus/Contract.hs
Expand Up @@ -62,8 +62,12 @@ module Plutus.Contract(
, Request.utxosAt
, Request.utxosTxOutTxFromTx
, Request.getTip
-- * Wallet's own public key
-- * Wallet's information
, Request.ownPaymentPubKeyHash
, Request.ownPaymentPubKeyHashes
, Request.ownFirstPaymentPubKeyHash
, Request.ownAddresses
, Request.ownUtxos
-- * Contract instance Id
, Wallet.Types.ContractInstanceId
, Request.ownInstanceId
Expand Down
9 changes: 8 additions & 1 deletion plutus-contract/src/Plutus/Contract/Effects.hs
Expand Up @@ -19,6 +19,7 @@ module Plutus.Contract.Effects( -- TODO: Move to Requests.Internal
_AwaitTxOutStatusChangeReq,
_OwnContractInstanceIdReq,
_OwnPaymentPublicKeyHashReq,
_OwnAddressesReq,
_ChainIndexQueryReq,
_BalanceTxReq,
_WriteBalancedTxReq,
Expand Down Expand Up @@ -53,6 +54,7 @@ module Plutus.Contract.Effects( -- TODO: Move to Requests.Internal
_AwaitTxOutStatusChangeResp,
_OwnContractInstanceIdResp,
_OwnPaymentPublicKeyHashResp,
_OwnAddressesResp,
_ChainIndexQueryResp,
_BalanceTxResp,
_WriteBalancedTxResp,
Expand Down Expand Up @@ -125,6 +127,7 @@ data PABReq =
| CurrentTimeReq
| OwnContractInstanceIdReq
| OwnPaymentPublicKeyHashReq
| OwnAddressesReq
| ChainIndexQueryReq ChainIndexQuery
| BalanceTxReq UnbalancedTx
| WriteBalancedTxReq CardanoTx
Expand All @@ -147,6 +150,7 @@ instance Pretty PABReq where
AwaitTxOutStatusChangeReq ref -> "Await txout status change:" <+> pretty ref
OwnContractInstanceIdReq -> "Own contract instance ID"
OwnPaymentPublicKeyHashReq -> "Own public key"
OwnAddressesReq -> "Own addresses"
ChainIndexQueryReq q -> "Chain index query:" <+> pretty q
BalanceTxReq utx -> "Balance tx:" <+> pretty utx
WriteBalancedTxReq tx -> "Write balanced tx:" <+> onCardanoTx pretty (fromString . show) tx
Expand All @@ -167,6 +171,7 @@ data PABResp =
| CurrentTimeResp POSIXTime
| OwnContractInstanceIdResp ContractInstanceId
| OwnPaymentPublicKeyHashResp PaymentPubKeyHash
| OwnAddressesResp (NonEmpty Address)
| ChainIndexQueryResp ChainIndexResponse
| BalanceTxResp BalanceTxResponse
| WriteBalancedTxResp WriteBalancedTxResponse
Expand All @@ -189,6 +194,7 @@ instance Pretty PABResp where
AwaitTxOutStatusChangeResp ref status -> "Status of" <+> pretty ref <+> "changed to" <+> pretty status
OwnContractInstanceIdResp i -> "Own contract instance ID:" <+> pretty i
OwnPaymentPublicKeyHashResp k -> "Own public key:" <+> pretty k
OwnAddressesResp addrs -> "Own addresses:" <+> pretty addrs
ChainIndexQueryResp rsp -> pretty rsp
BalanceTxResp r -> "Balance tx:" <+> pretty r
WriteBalancedTxResp r -> "Write balanced tx:" <+> pretty r
Expand All @@ -208,7 +214,8 @@ matches a b = case (a, b) of
(AwaitTxStatusChangeReq i, AwaitTxStatusChangeResp i' _) -> i == i'
(AwaitTxOutStatusChangeReq i, AwaitTxOutStatusChangeResp i' _) -> i == i'
(OwnContractInstanceIdReq, OwnContractInstanceIdResp{}) -> True
(OwnPaymentPublicKeyHashReq, OwnPaymentPublicKeyHashResp{}) -> True
(OwnPaymentPublicKeyHashReq, OwnPaymentPublicKeyHashResp{}) -> True
(OwnAddressesReq, OwnAddressesResp {}) -> True
(ChainIndexQueryReq r, ChainIndexQueryResp r') -> chainIndexMatches r r'
(BalanceTxReq{}, BalanceTxResp{}) -> True
(WriteBalancedTxReq{}, WriteBalancedTxResp{}) -> True
Expand Down
46 changes: 42 additions & 4 deletions plutus-contract/src/Plutus/Contract/Request.hs
Expand Up @@ -76,8 +76,12 @@ module Plutus.Contract.Request(
, endpointDescription
, endpointReq
, endpointResp
-- ** Public key hashes
-- ** Wallet information
, ownPaymentPubKeyHash
, ownPaymentPubKeyHashes
, ownFirstPaymentPubKeyHash
, ownAddresses
, ownUtxos
-- ** Submitting transactions
, adjustUnbalancedTx
, submitUnbalancedTx
Expand Down Expand Up @@ -116,8 +120,8 @@ import Data.Void (Void)
import GHC.Generics (Generic)
import GHC.Natural (Natural)
import GHC.TypeLits (Symbol, symbolVal)
import Ledger (AssetClass, DiffMilliSeconds, POSIXTime, PaymentPubKeyHash, Slot, TxId, TxOutRef, Value,
addressCredential, fromMilliSeconds, txOutRefId)
import Ledger (AssetClass, DiffMilliSeconds, POSIXTime, PaymentPubKeyHash (PaymentPubKeyHash), Slot, TxId, TxOutRef,
Value, addressCredential, fromMilliSeconds, txOutRefId)
import Ledger.Constraints (TxConstraints)
import Ledger.Constraints.OffChain (ScriptLookups, UnbalancedTx)
import Ledger.Constraints.OffChain qualified as Constraints
Expand All @@ -130,21 +134,25 @@ import Plutus.V1.Ledger.Api (Address, Datum, DatumHash, MintingPolicy, MintingPo
import PlutusTx qualified

import Plutus.Contract.Effects (ActiveEndpoint (ActiveEndpoint, aeDescription, aeMetadata),
PABReq (AdjustUnbalancedTxReq, AwaitSlotReq, AwaitTimeReq, AwaitTxOutStatusChangeReq, AwaitTxStatusChangeReq, AwaitUtxoProducedReq, AwaitUtxoSpentReq, BalanceTxReq, ChainIndexQueryReq, CurrentSlotReq, CurrentTimeReq, ExposeEndpointReq, OwnContractInstanceIdReq, OwnPaymentPublicKeyHashReq, WriteBalancedTxReq, YieldUnbalancedTxReq),
PABReq (AdjustUnbalancedTxReq, AwaitSlotReq, AwaitTimeReq, AwaitTxOutStatusChangeReq, AwaitTxStatusChangeReq, AwaitUtxoProducedReq, AwaitUtxoSpentReq, BalanceTxReq, ChainIndexQueryReq, CurrentSlotReq, CurrentTimeReq, ExposeEndpointReq, OwnAddressesReq, OwnContractInstanceIdReq, OwnPaymentPublicKeyHashReq, WriteBalancedTxReq, YieldUnbalancedTxReq),
PABResp (ExposeEndpointResp))
import Plutus.Contract.Effects qualified as E
import Plutus.Contract.Logging (logDebug)
import Plutus.Contract.Schema (Input, Output)
import Wallet.Types (ContractInstanceId, EndpointDescription (EndpointDescription),
EndpointValue (EndpointValue, unEndpointValue))

import Data.Foldable (fold)
import Data.List.NonEmpty qualified as NonEmpty
import Plutus.ChainIndex (ChainIndexTx, Page (nextPageQuery, pageItems), PageQuery, txOutRefs)
import Plutus.ChainIndex.Api (IsUtxoResponse, TxosResponse, UtxosResponse (page), paget)
import Plutus.ChainIndex.Types (RollbackState (Unknown), Tip, TxOutStatus, TxStatus)
import Plutus.Contract.Error (AsContractError (_ChainIndexContractError, _ConstraintResolutionContractError, _EndpointDecodeContractError, _ResumableContractError, _TxToCardanoConvertContractError, _WalletContractError))
import Plutus.Contract.Resumable (prompt)
import Plutus.Contract.Types (Contract (Contract), MatchingError (WrongVariantError), Promise (Promise), mapError,
runError, throwError)
import Plutus.V1.Ledger.Address (toPubKeyHash)
import Wallet.Emulator.Error (WalletAPIError (NoPaymentPubKeyHashError))

-- | Constraints on the contract schema, ensuring that the labels of the schema
-- are unique.
Expand Down Expand Up @@ -424,6 +432,12 @@ foldUtxoRefsAt f ini addr = go ini (Just def)
newAcc <- f acc page
go newAcc (nextPageQuery page)

-- | Get all utxos belonging to the wallet that runs this contract.
ownUtxos :: forall w s e. (AsContractError e) => Contract w s e (Map TxOutRef ChainIndexTxOut)
ownUtxos = do
addrs <- ownAddresses
fold <$> mapM utxosAt (NonEmpty.toList addrs)

-- | Get the unspent transaction outputs at an address.
utxosAt ::
forall w s e.
Expand Down Expand Up @@ -785,6 +799,7 @@ endpointWithMeta meta f = Promise $ do
endpointDescription :: forall l. KnownSymbol l => Proxy l -> EndpointDescription
endpointDescription = EndpointDescription . symbolVal

{-# DEPRECATED ownPaymentPubKeyHash "Use ownPaymentPubKeyHashes or ownAddresses instead" #-}
-- | Get the hash of a public key belonging to the wallet that runs this contract.
-- * Any funds paid to this public key hash will be treated as the wallet's own
-- funds
Expand All @@ -796,6 +811,29 @@ endpointDescription = EndpointDescription . symbolVal
ownPaymentPubKeyHash :: forall w s e. (AsContractError e) => Contract w s e PaymentPubKeyHash
ownPaymentPubKeyHash = pabReq OwnPaymentPublicKeyHashReq E._OwnPaymentPublicKeyHashResp

-- | Get the addresses belonging to the wallet that runs this contract.
-- * Any funds paid to one of these addresses will be treated as the wallet's own
-- funds
-- * The wallet is able to sign transactions with the private key of one of its
-- public key, for example, if the public key is added to the
-- 'requiredSignatures' field of 'Tx'.
-- * There is a 1-n relationship between wallets and addresses (although in
-- the mockchain n=1)
ownAddresses :: forall w s e. (AsContractError e) => Contract w s e (NonEmpty Address)
ownAddresses = pabReq OwnAddressesReq E._OwnAddressesResp

ownPaymentPubKeyHashes :: forall w s e. (AsContractError e) => Contract w s e [PaymentPubKeyHash]
ownPaymentPubKeyHashes = do
addrs <- ownAddresses
pure $ fmap PaymentPubKeyHash $ mapMaybe toPubKeyHash $ NonEmpty.toList addrs

ownFirstPaymentPubKeyHash :: forall w s e. (AsContractError e) => Contract w s e PaymentPubKeyHash
ownFirstPaymentPubKeyHash = do
pkhs <- ownPaymentPubKeyHashes
case pkhs of
[] -> throwError $ review _WalletContractError NoPaymentPubKeyHashError
(pkh:_) -> pure pkh

-- | Send an unbalanced transaction to be balanced and signed. Returns the ID
-- of the final transaction when the transaction was submitted. Throws an
-- error if balancing or signing failed.
Expand Down
9 changes: 4 additions & 5 deletions plutus-contract/src/Plutus/Contract/StateMachine.hs
Expand Up @@ -82,8 +82,8 @@ import Ledger.Value qualified as Value
import Plutus.ChainIndex (ChainIndexTx (_citxInputs))
import Plutus.Contract (AsContractError (_ConstraintResolutionContractError, _ContractError), Contract, ContractError,
Promise, adjustUnbalancedTx, awaitPromise, isSlot, isTime, logWarn, mapError, never,
ownPaymentPubKeyHash, promiseBind, select, submitTxConfirmed, utxoIsProduced, utxoIsSpent,
utxosAt, utxosTxOutTxFromTx)
ownFirstPaymentPubKeyHash, ownUtxos, promiseBind, select, submitTxConfirmed, utxoIsProduced,
utxoIsSpent, utxosAt, utxosTxOutTxFromTx)
import Plutus.Contract.Request (mkTxContract)
import Plutus.Contract.StateMachine.MintingPolarity (MintingPolarity (Burn, Mint))
import Plutus.Contract.StateMachine.OnChain (State (State, stateData, stateValue),
Expand Down Expand Up @@ -423,8 +423,7 @@ runInitialiseWith ::
-- ^ The value locked by the contract at the beginning
-> Contract w schema e state
runInitialiseWith customLookups customConstraints StateMachineClient{scInstance} initialState initialValue = mapError (review _SMContractError) $ do
ownPK <- ownPaymentPubKeyHash
utxo <- utxosAt (Ledger.pubKeyHashAddress ownPK Nothing)
utxo <- ownUtxos
let StateMachineInstance{stateMachine, typedValidator} = scInstance
constraints = mustPayToTheScript initialState (initialValue <> SM.threadTokenValueOrZero scInstance)
<> foldMap ttConstraints (smThreadToken stateMachine)
Expand Down Expand Up @@ -483,7 +482,7 @@ runGuardedStepWith ::
-> Contract w schema e (Either a (TransitionResult state input))
runGuardedStepWith userLookups userConstraints smc input guard = mapError (review _SMContractError) $ mkStep smc input >>= \case
Right StateMachineTransition{smtConstraints,smtOldState=State{stateData=os}, smtNewState=State{stateData=ns}, smtLookups} -> do
pk <- ownPaymentPubKeyHash
pk <- ownFirstPaymentPubKeyHash
let lookups = smtLookups { Constraints.slOwnPaymentPubKeyHash = Just pk }
utx <- either (throwing _ConstraintResolutionContractError)
pure
Expand Down
9 changes: 9 additions & 0 deletions plutus-contract/src/Plutus/Contract/Trace.hs
Expand Up @@ -28,6 +28,7 @@ module Plutus.Contract.Trace
, handleSlotNotifications
, handleTimeNotifications
, handleOwnPaymentPubKeyHashQueries
, handleOwnAddressesQueries
, handleCurrentSlotQueries
, handleCurrentTimeQueries
, handleTimeToSlotConversions
Expand Down Expand Up @@ -183,6 +184,14 @@ handleOwnPaymentPubKeyHashQueries ::
handleOwnPaymentPubKeyHashQueries =
generalise (preview E._OwnPaymentPublicKeyHashReq) E.OwnPaymentPublicKeyHashResp RequestHandler.handleOwnPaymentPubKeyHash

handleOwnAddressesQueries ::
( Member (LogObserve (LogMessage Text)) effs
, Member WalletEffect effs
)
=> RequestHandler effs PABReq PABResp
handleOwnAddressesQueries =
generalise (preview E._OwnAddressesReq) E.OwnAddressesResp RequestHandler.handleOwnAddresses

handleOwnInstanceIdQueries ::
( Member (LogObserve (LogMessage Text)) effs
, Member (Reader ContractInstanceId) effs
Expand Down
13 changes: 13 additions & 0 deletions plutus-contract/src/Plutus/Contract/Trace/RequestHandler.hs
Expand Up @@ -19,6 +19,7 @@ module Plutus.Contract.Trace.RequestHandler(
-- * handlers for common requests
, handleAdjustUnbalancedTx
, handleOwnPaymentPubKeyHash
, handleOwnAddresses
, handleSlotNotifications
, handleCurrentSlot
, handleTimeNotifications
Expand Down Expand Up @@ -48,6 +49,7 @@ import Plutus.Contract.Resumable (Request (Request, itID, rqID, rqRequest),
Response (Response, rspItID, rspResponse, rspRqID))

import Control.Monad.Freer.Extras.Log (LogMessage, LogMsg, LogObserve, logDebug, logWarn, surroundDebug)
import Data.List.NonEmpty (NonEmpty)
import Ledger (POSIXTime, POSIXTimeRange, Params (..), PaymentPubKeyHash, Slot, SlotRange)
import Ledger.Constraints.OffChain (UnbalancedTx, adjustUnbalancedTx)
import Ledger.TimeSlot qualified as TimeSlot
Expand All @@ -56,6 +58,7 @@ import Plutus.ChainIndex (ChainIndexQueryEffect)
import Plutus.ChainIndex.Effects qualified as ChainIndexEff
import Plutus.Contract.Effects (ChainIndexQuery (..), ChainIndexResponse (..))
import Plutus.Contract.Wallet qualified as Wallet
import Plutus.V1.Ledger.Api (Address)
import Wallet.API (WalletAPIError)
import Wallet.Effects (NodeClientEffect, WalletEffect)
import Wallet.Effects qualified
Expand Down Expand Up @@ -122,6 +125,16 @@ handleOwnPaymentPubKeyHash =
RequestHandler $ \_ ->
surroundDebug @Text "handleOwnPaymentPubKeyHash" Wallet.Effects.ownPaymentPubKeyHash

handleOwnAddresses ::
forall a effs.
( Member WalletEffect effs
, Member (LogObserve (LogMessage Text)) effs
)
=> RequestHandler effs a (NonEmpty Address)
handleOwnAddresses =
RequestHandler $ \_ ->
surroundDebug @Text "handleOwnAddresses" Wallet.Effects.ownAddresses

handleSlotNotifications ::
forall effs.
( Member NodeClientEffect effs
Expand Down
4 changes: 2 additions & 2 deletions plutus-contract/src/Plutus/Contract/Wallet.hs
Expand Up @@ -114,7 +114,7 @@ handleTx = balanceTx >=> either throwError WAPI.signTxAndSubmit
-- | Get an unspent output belonging to the wallet.
getUnspentOutput :: AsContractError e => Contract w s e TxOutRef
getUnspentOutput = do
ownPkh <- Contract.ownPaymentPubKeyHash
ownPkh <- Contract.ownFirstPaymentPubKeyHash
let constraints = mustPayToPubKey ownPkh (Ada.lovelaceValueOf 1)
utx <- either (throwing _ConstraintResolutionContractError) pure (mkTx @Void mempty constraints)
tx <- Contract.adjustUnbalancedTx utx >>= Contract.balanceTx
Expand Down Expand Up @@ -281,7 +281,7 @@ toExportTxInput networkId Plutus.TxOutRef{Plutus.txOutRefId, Plutus.txOutRefIdx}
ExportTxInput
<$> CardanoAPI.toCardanoTxId txOutRefId
<*> pure (C.TxIx $ fromInteger txOutRefIdx)
<*> CardanoAPI.toCardanoAddress networkId txOutAddress
<*> CardanoAPI.toCardanoAddressInEra networkId txOutAddress
<*> pure (C.selectLovelace cardanoValue)
<*> sequence (CardanoAPI.toCardanoScriptDataHash <$> txOutDatumHash)
<*> pure otherQuantities
Expand Down
Expand Up @@ -251,6 +251,7 @@ handleBlockchainQueries =
<> RequestHandler.handlePendingTransactions
<> RequestHandler.handleChainIndexQueries
<> RequestHandler.handleOwnPaymentPubKeyHashQueries
<> RequestHandler.handleOwnAddressesQueries
<> RequestHandler.handleOwnInstanceIdQueries
<> RequestHandler.handleSlotNotifications
<> RequestHandler.handleCurrentSlotQueries
Expand Down
5 changes: 3 additions & 2 deletions plutus-contract/src/Wallet/API.hs
Expand Up @@ -24,6 +24,7 @@ module Wallet.API(
WalletEffect,
submitTxn,
ownPaymentPubKeyHash,
ownAddresses,
balanceTx,
yieldUnbalancedTx,
NodeClientEffect,
Expand Down Expand Up @@ -70,8 +71,8 @@ import Ledger (CardanoTx, Interval (Interval, ivFrom, ivTo), Params (..), Paymen
import Ledger.Constraints qualified as Constraints
import Ledger.Constraints.OffChain (adjustUnbalancedTx)
import Ledger.TimeSlot qualified as TimeSlot
import Wallet.Effects (NodeClientEffect, WalletEffect, balanceTx, getClientParams, getClientSlot, ownPaymentPubKeyHash,
publishTx, submitTxn, walletAddSignature, yieldUnbalancedTx)
import Wallet.Effects (NodeClientEffect, WalletEffect, balanceTx, getClientParams, getClientSlot, ownAddresses,
ownPaymentPubKeyHash, publishTx, submitTxn, walletAddSignature, yieldUnbalancedTx)
import Wallet.Emulator.LogMessages (RequestHandlerLogMsg (AdjustingUnbalancedTx))
import Wallet.Error (WalletAPIError (PaymentMkTxError, ToCardanoError))
import Wallet.Error qualified
Expand Down
5 changes: 4 additions & 1 deletion plutus-contract/src/Wallet/Effects.hs
Expand Up @@ -14,6 +14,7 @@ module Wallet.Effects(
WalletEffect(..)
, submitTxn
, ownPaymentPubKeyHash
, ownAddresses
, balanceTx
, totalFunds
, walletAddSignature
Expand All @@ -26,13 +27,15 @@ module Wallet.Effects(
) where

import Control.Monad.Freer.TH (makeEffect)
import Ledger (CardanoTx, Params, PaymentPubKeyHash, Slot, Value)
import Data.List.NonEmpty (NonEmpty)
import Ledger (Address, CardanoTx, Params, PaymentPubKeyHash, Slot, Value)
import Ledger.Constraints.OffChain (UnbalancedTx)
import Wallet.Error (WalletAPIError)

data WalletEffect r where
SubmitTxn :: CardanoTx -> WalletEffect ()
OwnPaymentPubKeyHash :: WalletEffect PaymentPubKeyHash
OwnAddresses :: WalletEffect (NonEmpty Address)
BalanceTx :: UnbalancedTx -> WalletEffect (Either WalletAPIError CardanoTx)
TotalFunds :: WalletEffect Value -- ^ Total of all funds that are in the wallet (incl. tokens)
WalletAddSignature :: CardanoTx -> WalletEffect CardanoTx
Expand Down
5 changes: 5 additions & 0 deletions plutus-contract/src/Wallet/Emulator/Error.hs
Expand Up @@ -25,6 +25,9 @@ data WalletAPIError =
| 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
Expand All @@ -45,6 +48,8 @@ instance Pretty WalletAPIError where
"Insufficient funds:" <+> pretty t
ChangeHasLessThanNAda v ada ->
"Coin change has less than" <+> pretty ada <> ":" <+> pretty v
NoPaymentPubKeyHashError ->
"No payment public hash found"
PaymentPrivateKeyNotFound pk ->
"Payment private key not found:" <+> viaShow pk
ValidationError e ->
Expand Down

0 comments on commit 8f31273

Please sign in to comment.