ExW3.Rpc (exw3 v0.6.1) View Source

Link to this section Summary

Functions

returns all available accounts

Returns current balance of account

Returns block data for specified block number

Returns the current block number

Simple eth_call to client. Recommended to use ExW3.Contract.call instead.

Simple eth_send_transaction. Recommended to use ExW3.Contract.send instead.

Calculates an Ethereum specific signature and signs the data provided, using the accounts private key

Gets event changes (logs) by filter. Unlike ExW3.Contract.get_filter_changes it does not return the data in a formatted way

Mines number of blocks specified. Default is 1

Creates a new filter, returns filter id. For more sophisticated use, prefer ExW3.Contract.filter.

Using the personal api, this method returns the address associated with the private key that was used to calculate the signature with personal_sign.

Using the personal api, returns list of accounts.

Using the personal api, this method creates a new account with the passphrase, and returns new account address.

Using the personal api, this method sends a transaction and signs it in one call, and returns a transaction id hash.

Using the personal api, this method calculates an Ethereum specific signature, and returns that signature.

Using the personal api, this method signs a transaction, and returns the signed transaction.

Using the personal api, this method unlocks account using the passphrase provided, and returns a boolean.

Returns transaction receipt for specified transaction hash(id)

Uninstalls filter from the ethereum node

Link to this section Types

Specs

earliest() :: String.t()

Specs

hex_block_number() :: String.t()
Link to this type

invalid_hex_string_error()

View Source

Specs

invalid_hex_string_error() :: ExW3.Utils.invalid_hex_string_error()

Specs

latest() :: String.t()

Specs

log_filter() :: %{
  optional(:address) => String.t(),
  optional(:fromBlock) =>
    hex_block_number() | latest() | earliest() | pending(),
  optional(:toBlock) => hex_block_number() | latest() | earliest() | pending(),
  optional(:topics) => [String.t()],
  optional(:blockhash) => String.t()
}

Specs

opts() :: {:url, String.t()}

Specs

pending() :: String.t()

Specs

request_error() :: Ethereumex.Client.Behaviour.error()

Link to this section Functions

Specs

accounts([opts()]) :: list()

returns all available accounts

Link to this function

balance(account, opts \\ [])

View Source

Specs

balance(binary(), [opts()]) :: integer() | {:error, any()}

Returns current balance of account

Specs

block(integer()) :: any() | {:error, any()}

Returns block data for specified block number

Link to this function

block_number(opts \\ [])

View Source

Specs

block_number([opts()]) ::
  {:ok, non_neg_integer()} | {:error, ExW3.Utils.invalid_hex_string()}

Returns the current block number

Specs

eth_call(list()) :: any()

Simple eth_call to client. Recommended to use ExW3.Contract.call instead.

Specs

eth_send(list()) :: any()

Simple eth_send_transaction. Recommended to use ExW3.Contract.send instead.

Link to this function

eth_sign(data0, data1, opts \\ [])

View Source

Specs

eth_sign(binary(), binary(), list()) :: {:ok, binary()} | {:error, any()}

Calculates an Ethereum specific signature and signs the data provided, using the accounts private key

Link to this function

get_filter_changes(filter_id)

View Source

Specs

get_filter_changes(binary()) :: any()

Gets event changes (logs) by filter. Unlike ExW3.Contract.get_filter_changes it does not return the data in a formatted way

Link to this function

get_logs(filter, opts \\ [])

View Source

Specs

get_logs(log_filter(), [opts()]) ::
  {:ok, list()} | {:error, term()} | request_error()

Specs

mine(integer()) :: any() | {:error, any()}

Mines number of blocks specified. Default is 1

Specs

new_filter(map()) :: binary() | {:error, any()}

Creates a new filter, returns filter id. For more sophisticated use, prefer ExW3.Contract.filter.

Link to this function

personal_ec_recover(data0, data1, opts \\ [])

View Source

Specs

personal_ec_recover(binary(), binary(), []) :: {:ok, binary()} | {:error, any()}

Using the personal api, this method returns the address associated with the private key that was used to calculate the signature with personal_sign.

Link to this function

personal_list_accounts(opts \\ [])

View Source

Specs

personal_list_accounts(list()) :: {:ok, list()} | {:error, any()}

Using the personal api, returns list of accounts.

Link to this function

personal_new_account(password, opts \\ [])

View Source

Specs

personal_new_account(binary(), list()) :: {:ok, binary()} | {:error, any()}

Using the personal api, this method creates a new account with the passphrase, and returns new account address.

Link to this function

personal_send_transaction(param_map, passphrase, opts \\ [])

View Source

Specs

personal_send_transaction(map(), binary(), list()) ::
  {:ok, binary()} | {:error, any()}

Using the personal api, this method sends a transaction and signs it in one call, and returns a transaction id hash.

Link to this function

personal_sign(data, address, passphrase, opts \\ [])

View Source

Specs

personal_sign(binary(), binary(), binary(), list()) ::
  {:ok, binary()} | {:error, any()}

Using the personal api, this method calculates an Ethereum specific signature, and returns that signature.

Link to this function

personal_sign_transaction(param_map, passphrase, opts \\ [])

View Source

Specs

personal_sign_transaction(map(), binary(), list()) ::
  {:ok, map()} | {:error, any()}

Using the personal api, this method signs a transaction, and returns the signed transaction.

Link to this function

personal_unlock_account(params, opts \\ [])

View Source

Specs

personal_unlock_account(binary(), list()) :: {:ok, boolean()} | {:error, any()}

Using the personal api, this method unlocks account using the passphrase provided, and returns a boolean.

Specs

tx_receipt(binary()) :: {:ok, map()} | {:error, any()}

Returns transaction receipt for specified transaction hash(id)

Link to this function

uninstall_filter(filter_id)

View Source

Specs

uninstall_filter(binary()) :: boolean() | {:error, any()}

Uninstalls filter from the ethereum node