Skip to content

Commit

Permalink
major ongoing progress on queries rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
izelnakri committed Jan 21, 2018
1 parent 30a43bb commit 40513f8
Show file tree
Hide file tree
Showing 23 changed files with 1,320 additions and 406 deletions.
4 changes: 4 additions & 0 deletions .formatter.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Used by "mix format"
[
inputs: ["mix.exs", "{config,lib,test}/**/*.{ex,exs}"]
]
3 changes: 2 additions & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ use Mix.Config
# Configuration from the imported file will override the ones defined
# here (which is why it is important to import them last).
#
# import_config "#{Mix.env}.exs"

import_config "#{Mix.env()}.exs"
3 changes: 3 additions & 0 deletions config/dev.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
use Mix.Config

config :ethereumex, scheme: "https", host: "localhost", port: 8545
3 changes: 3 additions & 0 deletions config/test.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
use Mix.Config

config :ethereumex, scheme: "https", host: "localhost", port: 8545
54 changes: 41 additions & 13 deletions lib/eth.ex
Original file line number Diff line number Diff line change
@@ -1,35 +1,55 @@
defmodule ETH do
@moduledoc """
Documentation for Eth.
Elixir module that provides Ethereum utility functions
"""

@doc """
Hello world.
In order to use most of the functions in this library you need to be connected to an ethereum node.
This could be your own self-hosted node running locally or a public proxy.
## Examples
iex> Eth.hello
:world
iex> ETH.block_number
46080211
"""
Application.put_env(:ethereumex, :scheme, Application.get_env(:eth, :scheme, "http"))
Application.put_env(:ethereumex, :host, Application.get_env(:eth, :host, "localhost"))
Application.put_env(:ethereumex, :port, Application.get_env(:eth, :port, 8545))

defdelegate block_number, to: ETH.Query
defdelegate block_number!, to: ETH.Query
defdelegate syncing, to: ETH.Query
defdelegate syncing!, to: ETH.Query
defdelegate get_accounts, to: ETH.Query
defdelegate get_accounts!, to: ETH.Query
defdelegate gas_price, to: ETH.Query
defdelegate gas_price!, to: ETH.Query
defdelegate call(call_params), to: ETH.Query
defdelegate call!(call_params), to: ETH.Query
defdelegate get_block, to: ETH.Query
defdelegate get_block(identifier), to: ETH.Query
defdelegate get_block_transactions(identifier), to: ETH.Query
defdelegate get_block_transaction_count(identifier), to: ETH.Query
defdelegate get_transaction_from_block(identifier, index), to: ETH.Query
defdelegate get_block!, to: ETH.Query
defdelegate get_block!(identifier), to: ETH.Query
defdelegate get_balance(wallet_or_address), to: ETH.Query
defdelegate get_balance(wallet_or_address, denomination), to: ETH.Query
defdelegate get_transaction(transaction_hash), to: ETH.Query
defdelegate get_transaction_receipt(transaction_hash), to: ETH.Query
defdelegate get_transaction_count(wallet_or_address), to: ETH.Query
defdelegate get_balance!(wallet_or_address), to: ETH.Query
defdelegate get_balance!(wallet_or_address, denomination), to: ETH.Query
defdelegate estimate_gas(transaction), to: ETH.Query
defdelegate estimate_gas!(transaction), to: ETH.Query
defdelegate estimate_gas(transaction, denomination), to: ETH.Query
defdelegate estimate_gas!(transaction, denomination), to: ETH.Query

defdelegate get_block_transactions(identifier), to: ETH.TransactionQueries
defdelegate get_block_transactions!(identifier), to: ETH.TransactionQueries
defdelegate get_block_transaction_count(identifier), to: ETH.TransactionQueries
defdelegate get_block_transaction_count!(identifier), to: ETH.TransactionQueries
defdelegate get_transaction_from_block(identifier, index), to: ETH.TransactionQueries
defdelegate get_transaction_from_block!(identifier, index), to: ETH.TransactionQueries
defdelegate get_transaction(transaction_hash), to: ETH.TransactionQueries
defdelegate get_transaction_receipt(transaction_hash), to: ETH.TransactionQueries
defdelegate get_transaction_count(wallet_or_address), to: ETH.TransactionQueries
defdelegate get_transaction_count!(wallet_or_address), to: ETH.TransactionQueries

defdelegate parse(data), to: ETH.Transaction.Parser
defdelegate to_list(data), to: ETH.Transaction.Parser
Expand All @@ -41,16 +61,24 @@ defmodule ETH do
defdelegate hash_transaction(transaction), to: ETH.Transaction.Signer
defdelegate hash_transaction(transaction, include_signature), to: ETH.Transaction.Signer
defdelegate hash_transaction_list(transaction_list), to: ETH.Transaction.Signer
defdelegate hash_transaction_list(transaction_list, include_signature), to: ETH.Transaction.Signer

defdelegate hash_transaction_list(transaction_list, include_signature),
to: ETH.Transaction.Signer

defdelegate sign_transaction(transaction, private_key), to: ETH.Transaction.Signer
defdelegate sign_transaction_list(transaction_list, private_key), to: ETH.Transaction.Signer
defdelegate decode(rlp_encoded_transaction), to: ETH.Transaction.Signer
defdelegate encode(signed_transaction_list), to: ETH.Transaction.Signer

defdelegate hash(transaction, include_signature), to: ETH.Transaction
defdelegate send_transaction(params_or_wallet, private_key_or_params), to: ETH.Transaction
defdelegate send_transaction(sender_wallet, receiver_wallet, value_or_params), to: ETH.Transaction
defdelegate send_transaction(sender_wallet, receiver_wallet, value_or_params, private_key), to: ETH.Transaction

defdelegate send_transaction(sender_wallet, receiver_wallet, value_or_params),
to: ETH.Transaction

defdelegate send_transaction(sender_wallet, receiver_wallet, value_or_params, private_key),
to: ETH.Transaction

defdelegate send(signature), to: ETH.Transaction
defdelegate get_senders_public_key(transaction_input), to: ETH.Transaction
defdelegate get_sender_address(transaction_input), to: ETH.Transaction
Expand Down
Loading

0 comments on commit 40513f8

Please sign in to comment.