Skip to content

mlabs-haskell/purescript-cardano-key-wallet

Repository files navigation

purescript-cardano-key-wallet

Provides a common interface for wallet operations:

newtype KeyWallet = KeyWallet
  { address :: NetworkId -> Aff Address
  , selectCollateral ::
      Coin
      -> Int
      -> UtxoMap
      -> Aff (Maybe (Array TransactionUnspentOutput))
  , signTx :: Transaction -> Aff TransactionWitnessSet
  , signData :: NetworkId -> RawBytes -> Aff DataSignature
  , paymentKey :: Aff PrivatePaymentKey
  , stakeKey :: Aff (Maybe PrivateStakeKey)
  , drepKey :: Aff PrivateDrepKey
  }

This interface is used in cardano-transaction-lib to encapsulate private keys.

It can be used to provide signing services remotely (note the Aff) without revealing the private keys.

To create a KeyWallet from private key(s), use this function:

Cardano.Wallet.Key.privateKeysToKeyWallet
  :: PrivatePaymentKey
  -> Maybe PrivateStakeKey
  -> PrivateDrepKey
  -> KeyWallet

Test coverage

CTL's test suite uses KeyWallet to run every contract.