File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 5
5
### Bug Fixes
6
6
7
7
- Remove leading zeros from signature r and s values
8
+ - Support hex decoded raw transaction in ` Ethers.Transaction.decode/1 `
8
9
9
10
## v0.6.0 (2025-01-01)
10
11
Original file line number Diff line number Diff line change @@ -167,11 +167,16 @@ defmodule Ethers.Transaction do
167
167
- `{:ok, transaction}` - Decoded transaction struct
168
168
- `{:error, reason}` - Error decoding transaction
169
169
"""
170
- @ spec decode ( String . t ( ) ) :: { :ok , t ( ) } | { :error , term ( ) }
170
+ @ spec decode ( String . t ( ) | binary ( ) ) :: { :ok , t ( ) } | { :error , term ( ) }
171
171
def decode ( "0x" <> raw_transaction ) do
172
- case raw_transaction
173
- |> Utils . hex_decode! ( )
174
- |> decode_transaction_data ( ) do
172
+ case Utils . hex_decode ( raw_transaction ) do
173
+ { :ok , hex_decoded } -> decode ( hex_decoded )
174
+ :error -> { :error , :invalid_hex }
175
+ end
176
+ end
177
+
178
+ def decode ( raw_transaction_bin ) when is_binary ( raw_transaction_bin ) do
179
+ case decode_transaction_data ( raw_transaction_bin ) do
175
180
{ :ok , transaction , signature } ->
176
181
maybe_decode_signature ( transaction , signature )
177
182
You can’t perform that action at this time.
0 commit comments