Skip to content

keyan-m/elm-cardano

 
 

Repository files navigation

Elm Cardano

Elm offchain package for Cardano. This project aims to be the friendliest and most productive way of handling an offchain Cardano frontend. It should be a perfect match to Aiken for onchain code.

Usage

Remark: this is aspiration as the elm-cardano package is not published yet.

Install the Elm package with your usual tool. We recommand using elm-json.

# Install 
elm install mpizenberg/elm-cardano
# Or better, use elm-json
elm-json install mpizenberg/elm-cardano

Once the elm-cardano package is installed in your elm project, you need to add the corresponding JS file elm-cardano.js to your index.html. Finally, you need to call initElmCardanoJs(app) after initializing the main of the elm app.

TODO: this file currently lives in examples/wallet-cip30/elm-cardano.js we should bring it up in the repo once things have stabilized a bit.

<html>
<head>
    <meta charset="UTF-8">
    <title>Main</title>
    <script src="main.js"></script>
    <script src="elm-cardano.js"></script>
</head>
<body>
    <div id="myapp"></div>
    <script>
        var app = Elm.Main.init({
            node: document.getElementById('myapp'),
            flags: null,
        });
        initElmCardanoJs(app)
    </script>
</body>
</html>

After that, just follow the elm-cardano package docs to know how to use it.

Contributions

Contributions are welcomed! For now things are moving fast so I suggest discussing first over TxPipe discord, in the Elm Cardano thread.

The tools needed for this repo are all installed via npm.

# Install all the tools:
# elm, elm-format, elm-test-rs, elm-review, elm-watch
npm install

You can then run the tools you need by prefixing the command with npx.

# compile the elm package
npx elm make
# run the tests
npx elm-test-rs
# review the code
npx elm-review
# run the CIP30 example
cd examples/wallet-cip30 && npx elm-watch hot

About

Elm offchain package for Cardano

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Elm 100.0%