Skip to content

Purescript interface to Cardano wallets over FFI to Cip30

Notifications You must be signed in to change notification settings

anton-k/purescript-cip30

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Purescript interface to Cardano Wallets over Cip30

Implements FFI for purescript to the Cardano Cip-30 wallet interface. See the js or typescript docs to match the functions: With this library we can interact with cardano in browser wallets like Nami or Eternl if they support Cip30.

By Cip30 standard the cardano object is injected to the window. Note that it takes some time to inject the object so it might be beneficial to add 1 sec delay before your first function invocation to interact with the wallet. Otherwise no cardano object will be available and code will end up with error.

Most likely that you will use this library in pair with CSL (cardano-serialisation-lib). Also you can checkout the purescript-cardano-serialization-lib which offers bindings to CSL in purescript. Note that Cbor-strings of this library are Hex-encoded strings in terms of CSL. So for example if function signTx takes tx argument as Cbor we can get that from CSL tx by converting it to Hex-encoded string with to_hex method. Also to get meaningful data from return type of Cip30 function we can use CSL's from_hex method.

This library is low-level implementation so the export types are kept aligned with original implementation in Cip30. Use CSL converters like to_hex/from_hex or to_bytes/from_bytes to match the types.

The only improvement on type level which was taken is to turn JS style promises to the more convenient for Purescript Aff-type.

About

Purescript interface to Cardano wallets over FFI to Cip30

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published