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 55### Bug Fixes
66
77- Remove leading zeros from signature r and s values
8+ - Support hex decoded raw transaction in ` Ethers.Transaction.decode/1 `
89
910## v0.6.0 (2025-01-01)
1011
Original file line number Diff line number Diff line change @@ -167,11 +167,16 @@ defmodule Ethers.Transaction do
167167 - `{:ok, transaction}` - Decoded transaction struct
168168 - `{:error, reason}` - Error decoding transaction
169169 """
170- @ spec decode ( String . t ( ) ) :: { :ok , t ( ) } | { :error , term ( ) }
170+ @ spec decode ( String . t ( ) | binary ( ) ) :: { :ok , t ( ) } | { :error , term ( ) }
171171 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
175180 { :ok , transaction , signature } ->
176181 maybe_decode_signature ( transaction , signature )
177182
You can’t perform that action at this time.
0 commit comments