Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eth/client: always return hash even if transaction didn't succeed #284

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/eth/abi/decoder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,18 @@ def type(type, arg)
elsif type.base_type == "tuple"
offset = 0
data = {}
raise DecodingError, "Cannot decode tuples without known components" if type.components.nil?
type.components.each do |c|
if c.dynamic?
pointer = Util.deserialize_big_endian_to_int arg[offset, 32] # Pointer to the size of the array's element
data_len = Util.deserialize_big_endian_to_int arg[pointer, 32] # length of the element

data[c.name] = type(c, arg[pointer, Util.ceil32(data_len) + 32])
# puts data
offset += 32
else
size = c.size
data[c.name] = type(c, arg[offset, size])
offset += size
# puts data
end
end
data
Expand Down
4 changes: 2 additions & 2 deletions lib/eth/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -315,11 +315,11 @@ def transact(contract, function, *args, **kwargs)
# See {#transact} for params and overloads.
#
# @raise [Client::ContractExecutionError] if the execution fails.
# @return [Object] returns the result of the transaction.
# @return [Object, Boolean] returns the result of the transaction (hash and execution status).
def transact_and_wait(contract, function, *args, **kwargs)
begin
hash = wait_for_tx(transact(contract, function, *args, **kwargs))
return hash if tx_succeeded? hash
return hash, tx_succeeded?(hash)
rescue IOError => e
raise ContractExecutionError, e
end
Expand Down
Loading
Loading