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 e79bdd0efe57 of https://github.com/team-toast/elm-ethereum (zip prefix burnable-tech-elm-ethereum-e941bde/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 01059137ad1764d5dd33de9f23e5d647595ca709.
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.2/
Ethereum RPC Methods
See the official docs for reference.
Make sure to use the elm-ethereum-generator
to auto-generate the necessary Elm <-> Contract interface from a contract's ABI.
If you're making Eth transactions, you'll need to build a Call,
convert it to a Send, and use Eth.Sentry.Tx to hand it off to your browser's wallet (e.g., MetaMask, Trust).
( newSentry, sentryCmd ) =
myCallParams
|> Eth.toSend
|> TxSentry.send TxSendResponse model.txSentryReturns the value from a storage position at a given address. See Ethereum JSON-RPC methods for specification on retrieving data from complex data structures like maps.
Returns the bytecode from a contract at a given contract's address.
Call a function on an Ethereum contract from a particular point in history.
Returns the value from a storage position at a given address, at a certain block height.
Returns the bytecode from a contract at a given address, at a certain block height.
Get transaction information from it's hash. Includes pre-execution info: value, nonce, data/input, gas, gasPrice, to, and from.
Get the receipt of a transaction from it's hash. Only exists after the transaction has been mined!
Includes post-execution info: gasUsed, cumulativeGasUsed, contractAddress, logs, logsBloom. Also includes the tx execution status (only if block is post-byzantium).
Prepare a Call to be executed on chain.
Used in Eth.Sentry.Tx, a means to interact with MetaMask.
Useful if your handling txParams in javascript land yourself. Will return Error if params are invalid. e.g., buffer overflow
Execute a transaction on chain. Only useful if your keys live on the node your talking too, which is generally considered very poor practice.
NOTE: You probably don't need this.
If you're writing a proper dApp, look at using the Eth.Sentry.Tx to interface with wallets like MetaMask.
Broadcast a signed and RLP encoded transaction.
Get a transaction by it's index in a certain block given the block hash.
Get a transaction by it's index in a certain block given the block number.
Get the balance of a given address/account. Returns Wei amount as BigInt
Get the number of transactions sent from a given address/account.
Get the balance of a given address/account, at a certain block height
Get the number of transactions sent from a given address/account at a given block height.
Get the block number of the most recently mined block.
Get information about a block given a valid block number.
The transactions field will be an array of TxHash's mined during this block.
Get information about a block given a valid block hash.
Get information about a block given a valid block number.
The transactions field will be an array of Tx objects instead of TxHash's.
See getBlockWithTxObjs above.
Uses block hash instead of number for the identifier.
Get the number of transactions in a block from a given block number.
Get the number of transactions in a block from a given block hash.
Get the number of uncles in a given block given a block number.
Get the number of uncles in a given block given a block hash.
Get information about an uncle given it's index in a block by block number
Get information about an uncle given it's index in a block by block hash
If you have access to a websocket RPC endpoint, it's much easier to just use Eth.Sentry.Event.
Geth, Parity, and Infura support websockets.
Get an array of all logs matching a given filter object. Most likely you won't need this, as they are generated for you in elm-ethereum-generator
Establishes a filter object on a given node. Useful for contract events.
To check if the state has changed, call getFilterChanges.
Creates a filter in the node to notify when a new block arrives. To check if the state has changed, call getFilterChanges.
Creates a filter in the node to notify when new pending transactions arrive. To check if the state has changed, call getFilterChanges.
Polling method for a filter, which returns an array of logs which occurred since last poll.
Use the correct decoder for the given filter type:
For a newFilter:
import Eth.Abi.Decode as Abi
import Eth.Decode as Decode
import Json.Decode exposing (Decoder)
import Json.Decode.Pipeline exposing (custom)
transferEventDecoder : Decoder (Event Erc20Transfer)
transferEventDecoder =
Decode.event erc20TransferDecoder
type alias Erc20Transfer =
{ from : Address
, to : Address
, value : BigInt
}
erc20TransferDecoder : Decoder Erc20Transfer
erc20TransferDecoder =
decode Transfer
|> custom (Evm.topic 1 Abi.address)
|> custom (Evm.topic 2 Abi.address)
|> custom (Evm.data 0 Abi.uint)For a newBlockFilter:
newBlockDecoder : Decoder BlockHead
newBlockDecoder =
Eth.Decode.blockHeadFor a newPendingTxFilter:
newPendingTxDecoder : Decoder TxHash
newPendingTxDecoder =
Eth.Decode.txReturns an array of all logs matching filter with given id. See above note on decoders.
Uninstalls a filter with given id. Should always be called when watch is no longer needed. Additonally Filters timeout when they aren't requested with eth_getFilterChanges for a period of time.
Sign an arbitrary chunk of N bytes.
The sign method calculates an Ethereum specific signature with: sign(keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))).
By adding a prefix to the message makes the calculated signature recognisable as an Ethereum specific signature. This prevents misuse where a malicious DApp can sign arbitrary data (e.g. transaction) and use the signature to impersonate the victim.
Note the address to sign with must be unlocked.
Get the current ethereum protocol version.
Get the sync status of a particular node.
Nothing == Not Syncing
Just SyncStatus == starting, current, and highestBlockGet the client's coinbase address.
See whether or not a given node is mining.
Returns the number of hashes per second that the node is mining with.
Get the current price per gas in wei
Note: not always accurate. See EthGasStation website
Returns a list of addresses owned by client.
Generates and returns an estimate of how much gas is necessary to allow the transaction to complete. Note that the estimate may be significantly more than the amount of gas actually used by the transaction, for a variety of reasons including EVM mechanics and node performance.
Call a function on an Ethereum contract. Useful for reading data from contracts, or simulating a transaction before doing a real
Send.Use the elm-ethereum-generator code generator to produce an interface for a smart contract from it's ABI.
Note The decoder for a call is baked into the Call record to allow for a smoother developer experience.