quietgarden/elm-web3/2.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 2.0.0 found (5 same-name repos checked); no cached copy. Use another version.

Details

Web3.Contract.Send

Type-safe contract write calls (eth_sendTransaction).

Build a write call, encode it for the JS port, optionally estimate gas first.

-- Non-payable: approve
approve : Address -> BigInt -> WriteCall
approve spender amount =
    writeCall
        { contract = tokenAddress
        , method = "approve"
        , args = [ Encode.address spender, Encode.uint256 amount ]
        }


-- Payable: buy
buy : BigInt -> Wei -> WriteCall
buy minTokens value =
    payableCall
        { contract = routerAddress
        , method = "buy"
        , args = [ Encode.uint256 minTokens ]
        , value = value
        }

A write call to a contract.

{ contract : Address
, method : String
, args : List Value
}

Create a non-payable write call.

{ contract : Address
, method : String
, args : List Value
, value : BigInt
}

Create a payable write call with a value.

Set a gas limit.

encode : WriteCall -> Value

Encode a write call for the JS port.

Encode a write call as an estimateGas command for the JS port.

estimateGas myWriteCall
-- sends { tag: "estimateGas", contract: ..., method: ..., args: ..., value: ... }
-- JS responds with { tag: "gasEstimate", gas: "21000" }
{ bytecode : String
, args : List Value
, gasLimit : Maybe Int
}
-> Value

Encode a contract deployment for submission via the port.

encodeRawSend : String -> Value

Encode a raw signed transaction for broadcast via the port.