Method: Eth::Client#transact_and_wait

Defined in:
lib/eth/client.rb

#transact_and_wait(contract, function, *args, **kwargs) ⇒ Object, Boolean

Executes a contract function with a transaction and waits for it to be mined (transactional contract read/write).

See #transact for params and overloads.

Returns:

  • (Object, Boolean)

    returns the result of the transaction (hash and execution status).

Raises:



342
343
344
345
346
347
348
349
# File 'lib/eth/client.rb', line 342

def transact_and_wait(contract, function, *args, **kwargs)
  begin
    hash = wait_for_tx(transact(contract, function, *args, **kwargs))
    return hash, tx_succeeded?(hash)
  rescue RpcError => e
    raise ContractExecutionError, contract.decode_error(e)
  end
end