changed hex_metadata.config
 
@@ -4,10 +4,10 @@
4
4
{<<"elixir">>,<<"~> 1.12">>}.
5
5
{<<"files">>,
6
6
[<<"lib">>,<<"lib/eth">>,<<"lib/eth/query.ex">>,<<"lib/eth/transaction">>,
7
- <<"lib/eth/transaction/parser.ex">>,<<"lib/eth/transaction/builder.ex">>,
8
- <<"lib/eth/transaction/signer.ex">>,<<"lib/eth/wallet.ex">>,
9
- <<"lib/eth/transaction_queries.ex">>,<<"lib/eth/transaction.ex">>,
10
- <<"lib/eth/utils.ex">>,<<"lib/eth.ex">>,<<"mix.exs">>,<<"README.md">>,
7
+ <<"lib/eth/transaction/parser.ex">>,<<"lib/eth/transaction/signer.ex">>,
8
+ <<"lib/eth/transaction/builder.ex">>,<<"lib/eth/wallet.ex">>,
9
+ <<"lib/eth/transaction_queries.ex">>,<<"lib/eth/utils.ex">>,
10
+ <<"lib/eth/transaction.ex">>,<<"lib/eth.ex">>,<<"mix.exs">>,<<"README.md">>,
11
11
<<"LICENSE.md">>]}.
12
12
{<<"licenses">>,[<<"MIT License">>]}.
13
13
{<<"links">>,
 
@@ -52,4 +52,4 @@
52
52
{<<"optional">>,false},
53
53
{<<"repository">>,<<"hexpm">>},
54
54
{<<"requirement">>,<<"~> 0.2.1">>}]]}.
55
- {<<"version">>,<<"0.6.3">>}.
55
+ {<<"version">>,<<"0.6.4">>}.
changed lib/eth/transaction.ex
 
@@ -221,10 +221,10 @@ defmodule ETH.Transaction do
221
221
end
222
222
223
223
defp set_default_from(params, private_key) when is_list(params) do
224
- put_in(params, [:from], Keyword.get(params, :from, get_address(private_key)))
224
+ put_in(params, [:from], Keyword.get_lazy(params, :from, fn -> get_address(private_key) end))
225
225
end
226
226
227
227
defp set_default_from(params, private_key) when is_map(params) do
228
- Map.merge(params, %{from: Map.get(params, :from, get_address(private_key))})
228
+ Map.merge(params, %{from: Map.get_lazy(params, :from, fn -> get_address(private_key) end)})
229
229
end
230
230
end
changed lib/eth/transaction/builder.ex
 
@@ -65,7 +65,7 @@ defmodule ETH.Transaction.Builder do
65
65
defp build_params_from_list(params) do
66
66
to = Keyword.get(params, :to, "")
67
67
value = Keyword.get(params, :value, 0)
68
- gas_price = Keyword.get(params, :gas_price, ETH.gas_price!())
68
+ gas_price = Keyword.get_lazy(params, :gas_price, fn -> ETH.gas_price!() end)
69
69
data = Keyword.get(params, :data, "")
70
70
71
71
target_data =
 
@@ -73,20 +73,22 @@ defmodule ETH.Transaction.Builder do
73
73
do: "0x" <> Hexate.encode(data),
74
74
else: data
75
75
76
- nonce = Keyword.get(params, :nonce, generate_nonce(Keyword.get(params, :from)))
76
+ nonce = Keyword.get_lazy(params, :nonce, fn -> generate_nonce(Keyword.get(params, :from)) end)
77
77
chain_id = Keyword.get(params, :chain_id, 3)
78
78
79
79
gas_limit =
80
- Keyword.get(
80
+ Keyword.get_lazy(
81
81
params,
82
82
:gas_limit,
83
- ETH.estimate_gas!(%{
84
- to: to,
85
- value: value,
86
- data: target_data,
87
- nonce: nonce,
88
- chain_id: chain_id
89
- })
83
+ fn ->
84
+ ETH.estimate_gas!(%{
85
+ to: to,
86
+ value: value,
87
+ data: target_data,
88
+ nonce: nonce,
89
+ chain_id: chain_id
90
+ })
91
+ end
90
92
)
91
93
92
94
%{
 
@@ -102,7 +104,7 @@ defmodule ETH.Transaction.Builder do
102
104
defp build_params_from_map(params) do
103
105
to = Map.get(params, :to, "")
104
106
value = Map.get(params, :value, 0)
105
- gas_price = Map.get(params, :gas_price, ETH.gas_price!())
107
+ gas_price = Map.get_lazy(params, :gas_price, fn -> ETH.gas_price!() end)
106
108
data = Map.get(params, :data, "")
107
109
108
110
target_data =
 
@@ -110,20 +112,22 @@ defmodule ETH.Transaction.Builder do
110
112
do: "0x" <> Hexate.encode(data),
111
113
else: data
112
114
113
- nonce = Map.get(params, :nonce, generate_nonce(Map.get(params, :from)))
115
+ nonce = Map.get_lazy(params, :nonce, fn -> generate_nonce(Map.get(params, :from)) end)
114
116
chain_id = Map.get(params, :chain_id, 3)
115
117
116
118
gas_limit =
117
- Map.get(
119
+ Map.get_lazy(
118
120
params,
119
121
:gas_limit,
120
- ETH.estimate_gas!(%{
121
- to: to,
122
- value: value,
123
- data: target_data,
124
- nonce: nonce,
125
- chain_id: chain_id
126
- })
122
+ fn ->
123
+ ETH.estimate_gas!(%{
124
+ to: to,
125
+ value: value,
126
+ data: target_data,
127
+ nonce: nonce,
128
+ chain_id: chain_id
129
+ })
130
+ end
127
131
)
128
132
129
133
%{
changed mix.exs
 
@@ -1,7 +1,7 @@
1
1
defmodule Eth.Mixfile do
2
2
use Mix.Project
3
3
4
- @version "0.6.3"
4
+ @version "0.6.4"
5
5
@source_url "https://github.com/izelnakri/eth"
6
6
7
7
def project() do