4
0
Fork 0

Merge branch 'deployment_tx_hash' into error_messages

# Conflicts:
#	lib/exw3.ex
pull/12/head
Piotr Żelazko 6 years ago
commit 8d3701478b
No known key found for this signature in database
GPG Key ID: 27E11A19853A7913
  1. 9
      lib/exw3.ex
  2. 14
      test/exw3_test.exs

@ -513,11 +513,11 @@ defmodule ExW3 do
gas: "0x#{gas}"
}
{:ok, tx_receipt_id} = Ethereumex.HttpClient.eth_send_transaction(tx)
{:ok, tx_hash} = Ethereumex.HttpClient.eth_send_transaction(tx)
{:ok, tx_receipt} = Ethereumex.HttpClient.eth_get_transaction_receipt(tx_receipt_id)
{:ok, tx_receipt} = Ethereumex.HttpClient.eth_get_transaction_receipt(tx_hash)
tx_receipt["contractAddress"]
{tx_receipt["contractAddress"], tx_hash}
end
def eth_call_helper(address, abi, method_name, args) do
@ -580,7 +580,8 @@ defmodule ExW3 do
{:ok,_} <- check_option(args[:options][:gas], :missing_gas),
{:ok, bin} <- check_option([state[:bin], args[:bin]], :missing_binary)
do
result = {:ok, deploy_helper(bin, state[:abi], args)}
{contract_addr, tx_hash} = deploy_helper(bin, state[:abi], args)
result = {:ok, contract_addr, tx_hash}
{:reply, result , state}
else
err -> {:reply, err, state}

@ -60,7 +60,7 @@ defmodule EXW3Test do
test "starts a Contract GenServer for simple storage contract", context do
ExW3.Contract.start_link(SimpleStorage, abi: context[:simple_storage_abi])
{:ok, address} =
{:ok, address, _} =
ExW3.Contract.deploy(
SimpleStorage,
bin: ExW3.load_bin("test/examples/build/SimpleStorage.bin"),
@ -89,7 +89,7 @@ defmodule EXW3Test do
test "starts a Contract GenServer for array tester contract", context do
ExW3.Contract.start_link(ArrayTester, abi: context[:array_tester_abi])
{:ok, address} =
{:ok, address, _} =
ExW3.Contract.deploy(
ArrayTester,
bin: ExW3.load_bin("test/examples/build/ArrayTester.bin"),
@ -117,7 +117,7 @@ defmodule EXW3Test do
test "starts a Contract GenServer for event tester contract", context do
ExW3.Contract.start_link(EventTester, abi: context[:event_tester_abi])
{:ok, address} =
{:ok, address, _} =
ExW3.Contract.deploy(
EventTester,
bin: ExW3.load_bin("test/examples/build/EventTester.bin"),
@ -153,7 +153,7 @@ defmodule EXW3Test do
test "starts a Contract GenServer and uses the event listener", context do
ExW3.Contract.start_link(EventTester, abi: context[:event_tester_abi])
{:ok, address} =
{:ok, address, _} =
ExW3.Contract.deploy(
EventTester,
bin: ExW3.load_bin("test/examples/build/EventTester.bin"),
@ -200,7 +200,7 @@ defmodule EXW3Test do
test "starts a Contract GenServer for Complex contract", context do
ExW3.Contract.start_link(Complex, abi: context[:complex_abi])
{:ok, address} =
{:ok, address, _} =
ExW3.Contract.deploy(
Complex,
bin: ExW3.load_bin("test/examples/build/Complex.bin"),
@ -225,7 +225,7 @@ defmodule EXW3Test do
test "starts a Contract GenServer for AddressTester contract", context do
ExW3.Contract.start_link(AddressTester, abi: context[:address_tester_abi])
{:ok, address} =
{:ok, address, _} =
ExW3.Contract.deploy(
AddressTester,
bin: ExW3.load_bin("test/examples/build/AddressTester.bin"),
@ -320,7 +320,7 @@ defmodule EXW3Test do
test "return proper error messages at send and call", context do
ExW3.Contract.start_link(SimpleStorage, abi: context[:simple_storage_abi])
{:ok, address} =
{:ok, address, _} =
ExW3.Contract.deploy(
SimpleStorage,
bin: ExW3.load_bin("test/examples/build/SimpleStorage.bin"),

Loading…
Cancel
Save