changed README.md
 
@@ -82,7 +82,7 @@ by adding `eth` to your list of dependencies in `mix.exs`:
82
82
```elixir
83
83
def deps do
84
84
[
85
- {:eth, "~> 0.3.0"}
85
+ {:eth, "~> 0.6.5"}
86
86
]
87
87
end
88
88
```
changed hex_metadata.config
 
@@ -4,8 +4,8 @@
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/signer.ex">>,
8
- <<"lib/eth/transaction/builder.ex">>,<<"lib/eth/wallet.ex">>,
7
+ <<"lib/eth/transaction/builder.ex">>,<<"lib/eth/transaction/parser.ex">>,
8
+ <<"lib/eth/transaction/signer.ex">>,<<"lib/eth/wallet.ex">>,
9
9
<<"lib/eth/transaction_queries.ex">>,<<"lib/eth/utils.ex">>,
10
10
<<"lib/eth/transaction.ex">>,<<"lib/eth.ex">>,<<"mix.exs">>,<<"README.md">>,
11
11
<<"LICENSE.md">>]}.
 
@@ -47,4 +47,4 @@
47
47
{<<"optional">>,false},
48
48
{<<"repository">>,<<"hexpm">>},
49
49
{<<"requirement">>,<<"~> 0.2.1">>}]]}.
50
- {<<"version">>,<<"0.6.5">>}.
50
+ {<<"version">>,<<"0.6.7">>}.
changed lib/eth/transaction/builder.ex
 
@@ -92,6 +92,7 @@ defmodule ETH.Transaction.Builder do
92
92
)
93
93
94
94
%{
95
+ chain_id: chain_id,
95
96
nonce: nonce,
96
97
gas_price: gas_price,
97
98
gas_limit: gas_limit,
 
@@ -131,6 +132,7 @@ defmodule ETH.Transaction.Builder do
131
132
)
132
133
133
134
%{
135
+ chain_id: chain_id,
134
136
nonce: nonce,
135
137
gas_price: gas_price,
136
138
gas_limit: gas_limit,
changed lib/eth/transaction/parser.ex
 
@@ -70,6 +70,7 @@ defmodule ETH.Transaction.Parser do
70
70
71
71
def parse(
72
72
_transaction = %{
73
+ chain_id: chain_id,
73
74
nonce: nonce,
74
75
gas_price: gas_price,
75
76
gas_limit: gas_limit,
 
@@ -82,6 +83,7 @@ defmodule ETH.Transaction.Parser do
82
83
}
83
84
) do
84
85
%{
86
+ chain_id: to_buffer(chain_id),
85
87
nonce: to_buffer(nonce),
86
88
gas_price: to_buffer(gas_price),
87
89
gas_limit: to_buffer(gas_limit),
 
@@ -96,6 +98,7 @@ defmodule ETH.Transaction.Parser do
96
98
97
99
def parse(
98
100
_transaction = %{
101
+ chain_id: chain_id,
99
102
nonce: nonce,
100
103
gas_price: gas_price,
101
104
gas_limit: gas_limit,
 
@@ -105,6 +108,7 @@ defmodule ETH.Transaction.Parser do
105
108
}
106
109
) do
107
110
%{
111
+ chain_id: to_buffer(chain_id),
108
112
nonce: to_buffer(nonce),
109
113
gas_price: to_buffer(gas_price),
110
114
gas_limit: to_buffer(gas_limit),
 
@@ -139,6 +143,7 @@ defmodule ETH.Transaction.Parser do
139
143
140
144
def to_list(
141
145
transaction = %{
146
+ chain_id: chain_id,
142
147
nonce: nonce,
143
148
gas_price: gas_price,
144
149
gas_limit: gas_limit,
 
@@ -151,7 +156,7 @@ defmodule ETH.Transaction.Parser do
151
156
r = Map.get(transaction, :r, "")
152
157
s = Map.get(transaction, :s, "")
153
158
154
- [nonce, gas_price, gas_limit, to, value, data, v, r, s]
159
+ [nonce, gas_price, gas_limit, to, value, data, v, r, s, chain_id]
155
160
|> Enum.map(fn value -> to_buffer(value) end)
156
161
end
157
162
end
changed lib/eth/transaction/signer.ex
 
@@ -73,7 +73,8 @@ defmodule ETH.Transaction.Signer do
73
73
_data,
74
74
_v,
75
75
_r,
76
- _s
76
+ _s,
77
+ _chain_id
77
78
],
78
79
<<private_key::binary-size(32)>>
79
80
)
 
@@ -91,7 +92,8 @@ defmodule ETH.Transaction.Signer do
91
92
_data,
92
93
_v,
93
94
_r,
94
- _s
95
+ _s,
96
+ _chain_id
95
97
],
96
98
<<encoded_private_key::binary-size(64)>>
97
99
)
 
@@ -110,11 +112,15 @@ defmodule ETH.Transaction.Signer do
110
112
data,
111
113
v,
112
114
_r,
113
- _s
115
+ _s,
116
+ _chain_id
114
117
],
115
118
<<private_key::binary-size(32)>>
116
119
) do
117
120
chain_id = get_chain_id(v, Enum.at(transaction_list, 9))
121
+
122
+ <<chain_id_int>> = chain_id
123
+
118
124
message_hash = hash_transaction(transaction_list, false)
119
125
120
126
[signature: signature, recovery: recovery] = secp256k1_signature(message_hash, private_key)
 
@@ -122,7 +128,8 @@ defmodule ETH.Transaction.Signer do
122
128
<<sig_r::binary-size(32)>> <> <<sig_s::binary-size(32)>> = signature
123
129
initial_v = recovery + 27
124
130
125
- sig_v = if chain_id > 0, do: initial_v + (chain_id * 2 + 8), else: initial_v
131
+ sig_v = if chain_id_int > 0, do: initial_v + (chain_id_int * 2 + 8), else: initial_v
132
+
126
133
127
134
[nonce, gas_price, gas_limit, to, value, data, <<sig_v>>, sig_r, sig_s]
128
135
|> ExRLP.encode()
changed mix.exs
 
@@ -1,7 +1,7 @@
1
1
defmodule Eth.Mixfile do
2
2
use Mix.Project
3
3
4
- @version "0.6.5"
4
+ @version "0.6.7"
5
5
@source_url "https://github.com/izelnakri/eth"
6
6
7
7
def project() do