intrepidshape/elm-web3/1.0.0

NOTE: the latest version is 3.0.0

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/IntrepidShape/elm-web3.

What we checked: The repo moved to github.com/IntrepidShape/elm-web3 and tag 1.0.0 is there; its commit 9d919244f65e is from 2026-05-09 11:48 UTC, before the version was published (2026-05-09 11:58 UTC); elm.json is byte-identical to package.elm-lang.org's; the exposed modules match docs.json; the zip's SHA-1 is not the published one (GitHub's zip no longer comes out byte for byte the same), so the contents were checked instead.

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/intrepidshape/elm-web3/zipball/1.0.0/

Web3.Types

Core opaque types for EVM interaction.

All types are opaque — you can't accidentally pass a TxHash where an Address is expected. Construction validates format and returns Maybe so invalid input is a compile-time-visible code path, not a runtime crash.

import Web3.Types as T


-- Validate on input boundary (e.g. from a URL param or user field):
case T.address rawString of
    Just addr ->
        -- addr : T.Address — safe to use everywhere
    Nothing ->
        -- show validation error


-- BlockNumber is used by Contract.Call, Block, Fee, and Query:
T.encodeBlockNumber T.Latest    == Json.Encode.string "latest"
T.encodeBlockNumber (T.BlockNum 1000) == Json.Encode.int 1000

Wei is an alias for Web3.BigInt.BigInt — use Web3.Units.formatEther to convert to a human-readable string.

type Address

A validated Ethereum address (0x + 40 hex chars).

type TxHash

A transaction hash (0x + 64 hex chars).

= BlockNum Int
| Latest
| Pending
| Earliest

A block number — specific or a tag.

type ChainId

An EVM chain ID.

type alias Wei =

Wei amount as a string (uint256 — too large for Int).

A raw hex string.

address : String -> Maybe Address

Create an Address from a hex string. Returns Nothing if invalid.

Extract the string value of an Address.

txHash : String -> Maybe TxHash

Create a TxHash from a hex string.

Extract the string value of a TxHash.

chainId : Int -> ChainId

Create a ChainId.

Extract the integer value of a ChainId.

hexString : String -> Maybe HexString

Create a HexString.

Extract the string value of a HexString.

Encode a BlockNumber for JSON-RPC (e.g. for eth_call block parameter).