Skip to content

Cardano wallet standard bindings with error handling via purescript-variant

Notifications You must be signed in to change notification settings

mlabs-haskell/purescript-cip30-typesafe

Repository files navigation

purescript-cip30-typesafe

An extension of purescript-cip30 with PureScript wrapper types for CIP-30 errors.

Simply put, it lets you dispatch on known error values by using Variant:

-- purescript-cip30 ignores the errors:
signTx :: Cip30Connection -> Cbor -> Boolean -> Aff Cbor

-- purescript-cip30-typesafe catches and lifts exceptions into the PureScript world as values:
signTx
  :: Cip30Connection
  -> Cbor
  -> Boolean
  -> Aff
       ( Variant
           (apiError :: APIError, txSignError :: TxSignError, success :: Cbor)
       )

This interface forces the user to explicitly handle all known CIP-30 errors. Note that the presence of Aff still implies possibility of exceptions.

About

Cardano wallet standard bindings with error handling via purescript-variant

Resources

Stars

Watchers

Forks

Packages

No packages published