View Source Ethers.RPC (Ethers v0.0.6)

RPC Methods for interacting with the Ethereum blockchain

Summary

Functions

Link to this function

call(params, overrides \\ [])

View Source
@spec call(map(), Keyword.t()) :: {:ok, [...]} | {:error, term()}

Makes an eth_call to with the given data and overrides, Than parses the response using the selector in the params

Overrides

This function accepts all of options which Ethereumex.BaseClient.eth_send_transaction accepts. Notable you can use these.

  • :to: Indicates recepient address. (Contract address in this case)

Options

  • :block: The block number or block alias. Defaults to latest
  • :rpc_client: The RPC Client to use. It should implement ethereum jsonRPC API. default: Ethereumex.HttpClient
  • :rpc_opts: Extra options to pass to rpc_client. (Like timeout, Server URL, etc.)

Examples

iex> Ethers.Contract.ERC20.total_supply() |> Ethers.Contract.call(to: "0xa0b...ef6")
{:ok, [100000000000000]}
Link to this function

estimate_gas(params, overrides \\ [])

View Source
Link to this function

eth_block_number(opts \\ [])

View Source
Link to this function

eth_call(params, block, opts \\ [])

View Source
Link to this function

eth_estimate_gas(params, opts \\ [])

View Source
Link to this function

eth_gas_price(opts \\ [])

View Source
Link to this function

eth_get_block_by_number(block_number, include_details?, opts \\ [])

View Source
Link to this function

eth_get_logs(params, opts \\ [])

View Source
Link to this function

eth_get_transaction_receipt(tx_hash, opts \\ [])

View Source
Link to this function

eth_send_transaction(params, opts \\ [])

View Source
Link to this function

send(params, overrides \\ [])

View Source
@spec send(map(), Keyword.t()) :: {:ok, String.t()} | {:error, term()}

Makes an eth_send to with the given data and overrides, Then returns the transaction binary.

Overrides

This function accepts all of options which Ethereumex.BaseClient.eth_send_transaction accepts. Notable you can use these.

  • :to: Indicates recepient address. (Contract address in this case)

Options

  • :rpc_client: The RPC Client to use. It should implement ethereum jsonRPC API. default: Ethereumex.HttpClient
  • :rpc_opts: Extra options to pass to rpc_client. (Like timeout, Server URL, etc.)

Examples

iex> Ethers.Contract.ERC20.transfer("0xff0...ea2", 1000) |> Ethers.Contract.send(to: "0xa0b...ef6")
{:ok, transaction_bin}