This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
feed the tree some ether.
version 9.0.0
license BSD3
native-modules False
elm-version 0.18.0 <= v < 0.19.0
Tag 9.0.0
Committed At 2018-05-11 22:20:24 UTC
zwilias/elm-utf-tools 1.0.1 <= v < 2.0.0 1.0.1
rtfeldman/hex 1.0.0 <= v < 2.0.0 1.0.0
prozacchiwawa/elm-keccak 1.0.1 <= v < 2.0.0 1.0.3
nathanjohnson320/base58 2.0.0 <= v < 3.0.0 2.0.2
hickscorp/elm-bigint 1.0.1 <= v < 2.0.0 1.1.1
elm-lang/websocket 1.0.2 <= v < 2.0.0 1.0.2
elm-lang/http 1.0.0 <= v < 2.0.0 1.0.0
elm-lang/core 5.1.1 <= v < 6.0.0 5.1.1
elm-community/string-extra 1.4.0 <= v < 2.0.0 1.5.0
elm-community/result-extra 2.2.0 <= v < 3.0.0 2.2.1
elm-community/maybe-extra 4.0.0 <= v < 5.0.0 4.0.0
elm-community/list-extra 6.1.0 <= v < 7.0.0 6.1.0
elm-community/json-extra 2.7.0 <= v < 3.0.0 2.7.0
Warry/ascii-table 1.0.0 <= v < 2.0.0 1.0.2
NoRedInk/elm-decode-pipeline 3.0.0 <= v < 4.0.0 3.0.1
Chadtech/elm-bool-extra 1.2.1 <= v < 2.0.0 1.2.1

README

elm-ethereum

DApps in Pure Elm

This library allows you to interact with the Ethereum blockchain much like purescript-web3, ethers.js, or web3.js. You can hook into web wallets like MetaMask and send transactions, as well as perform read-only operations on smart contracts.

See why elm?

Setup

  • Setup and define your node endpoint.
    import Eth
    import Eth.Types exposing (..)


    type alias Model =
        { ethNode : HttpProvider }

    init =
        { ethNode = "https://mainnet.infura.com/" }

It's good to keep the node url in your model. This way it can be kept in sync with MetaMask. Example code of this "sync" pattern to come.

Examples

  • Simple - Look at the blockchain

    Get an account balance at a specific block height.

    getMyBalanceInHistory : Int -> Task Http.Error BigInt
    getMyBalanceInHistory blockNum =
        Eth.getBalanceAtBlock model.ethNode myAddress (BlockNum blockNum)
  • Advanced - Chain tasks together

    Get all newly created contract addresses in the latest block. In a few lines of code.

    findNewestContracts : Task String (List Address)
    findNewestContracts =
        Eth.getBlockNumber model.ethNode
            |> Task.andThen (Eth.getBlock model.ethNode)
            |> Task.andThen
                (\block ->
                    block.transactions
                        |> List.map (Eth.getTxReceipt model.ethNode)
                        |> Task.sequence
                )
            |> Task.map (List.map .contractAddress >> MaybeExtra.values)
            |> Task.mapError prettifyHttpError

Do not fret if the above looks perplexing. This is fairly advanced Elm. Lots is going on here. Partial function application. Function composition. Maps within maps. Record accessor sugar. The point is, your code can be terse, expressive, with great error handling baked in.

Btw, this is an example of Railway Oriented Programming. A great video by Scott Wlaschin.

Why Elm

I'd sum up the experience of programming in Elm in two words: Fearless Refactoring

This is by no means the only pleasantry the fine tree has to offer.

Elm's claim to fame is zero runtime exceptions. It's compiler and static types are your best friends. Both from an error catching standpoint, but just as importantly, from a domain modeling standpoint.

Union Types allow you to fully leverage the compiler when modeling your business domain. See BlockId or NetworkId for instance.

Union types also allow you to hide implementation details by using them as "opaque types". An Address is just a string under the hood, but you can never directly touch that string.

Why else

  • Simplicity and cohesion
    Javascript                    Elm
    ---------------------------------
    npm/yarn                 built in
    Webpack                  built in
    React                    built in
    Redux                    built in
    Typescript/Flow          built in
    Immutable.JS             built in
  • Phenomenal tooling and resources

    Time traveling debugger - Import/Export history. QA like a champ.
    elm-format - Adds up to hours of tedius "work" saved.
    elm-reactor - Nice dev server.
    elm-test - Fuzz testing == legit.
    elm-benchmark - Clone this package and give it a whirl.
    Elm Package and Docs - Pleasant and consistent. Enforced semantic versioning.

  • Strong static types

    Find errors fast with readable compiler messages.
    Less millions of dollars lost from typos.

  • No null or undefined

    Never miss a potential problem.

  • Purely functional

    Leads to decoupled and easily refactorable code.

  • Great Community

    Thoughtful, responsive, intelligent, and kind.
    Great Slack and Discourse.

Contributing

Pull requests and issues are greatly appreciated!
If you think there's a better way to implement parts of this library, I'd love to hear your feedback.

Feed the tree some ether

🌳Ξ🌳Ξ🌳