quietgarden/elm-web3/1.0.0

NOTE: the latest version is 2.0.1

Unavailable. Nobody can download this version any more, with elm or with the Lamdera compiler: github.com/quietgarden/elm-web3 is gone (deleted or private); Software Heritage not asked yet (this run's --swh-calls were used up); no fork with tag 1.0.0 found (5 same-name repos checked); no cached copy. Use another version.

Details

Web3.BigInt

Arbitrary-precision integers for EVM applications.

Supports the full uint256 range (0 to 2^256-1) and int256 range. Implemented as a base-10^7 digit list with no external dependencies.

All values crossing the port boundary are decimal strings — this module handles the conversion safely.

type BigInt

An arbitrary-precision integer.

fromInt : Int -> BigInt

Create a BigInt from an Elm Int.

fromString : String -> Maybe BigInt

Parse a decimal integer string. Returns Nothing for invalid input.

Accepts optional leading '-' or '+' sign. Rejects empty strings, non-digit characters, and floating-point notation.

fromString "0"                    == Just zero
fromString "-42"                  == Just (fromInt -42)
fromString "115792...9935"        -- uint256 max: Just <big>
fromString "abc"                  == Nothing
fromString ""                     == Nothing
toString : BigInt -> String

Convert to decimal string.

Add two BigInts.

Subtract.

Multiply.

div : BigInt -> BigInt -> Maybe BigInt

Divide. Returns Nothing if divisor is zero.

compare : BigInt -> BigInt -> Order

Compare two BigInts.

eq : BigInt -> BigInt -> Bool

Equality.

lt : BigInt -> BigInt -> Bool

Less than.

lte : BigInt -> BigInt -> Bool

Less than or equal.

gt : BigInt -> BigInt -> Bool

Greater than.

gte : BigInt -> BigInt -> Bool

Greater than or equal.

Zero.

isZero : BigInt -> Bool

Is this BigInt zero?