burnable-tech/elm-ethereum/1.0.1

NOTE: the latest version is 1.0.2

Renamed to team-toast/elm-ethereum. That is where the repository lives now. It has not been published as a package under the new name.

Versions published as burnable-tech/elm-ethereum still install under that name. 3 versions of 3 come from the new location (see their notes).

Rerouted (renamed, verified). The GitHub user or repository was renamed. The tag is still there, at the new name. The Lamdera package server serves a copy recovered from https://github.com/team-toast/elm-ethereum.

What we checked: The repo moved to github.com/team-toast/elm-ethereum. Rebuilt with git archive from commit 2793bdd9647f of https://github.com/team-toast/elm-ethereum (zip prefix burnable-tech-elm-ethereum-ae0242e/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 ddaab897a449a9db648d3b90c259963440d50b84.

The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.

Details · package.elm-lang.org's zip: https://github.com/burnable-tech/elm-ethereum/zipball/1.0.1/

Eth.Units

Conversions and Helpers

Concise Units

Useful helpers for concise value declarations.

txParams : Send
txParams =
    { to = Just myContract
    , from = Nothing
    , gas = Nothing
    , gasPrice = Just (gwei 3)
    , value = Just (eth 3)
    , data = Just data
    , nonce = Nothing
    }
gwei : Int -> BigInt
eth : Int -> BigInt

Precise Units

Helpers for dealing with floats.

type EthUnit
= Wei
| Kwei
| Mwei
| Gwei
| Microether
| Milliether
| Ether
| Kether
| Mether
| Gether
| Tether

Eth Unit Useful for displaying to, and taking user input from, the UI

toWei : EthUnit -> String -> Result String BigInt

Convert a given stringy EthUnit to it's Wei equivalent

toWei Gwei "50" == Ok (BigInt.fromInt 50000000000)


toWei Wei "40.9123" == Ok (BigInt.fromInt 40)


toWei Kwei "40.9123" == Ok (BigInt.fromInt 40912)


toWei Gwei "ten" == Err
fromWei : EthUnit -> BigInt -> String

Convert stringy Wei to a given EthUnit

fromWei Gwei (BigInt.fromInt 123456789) == "0.123456789"


fromWei Ether (BigInt.fromInt 123456789) == "0.000000000123456789"

Note Do not pass anything larger than MAX_SAFE_INTEGER into BigInt.fromInt MAX_SAFE_INTEGER == 9007199254740991

bigIntToWei : EthUnit -> BigInt -> BigInt

Convert a given BigInt EthUnit to it's Wei equivalent