lambdaclass/ethereum_war_game_tooling

Modify functions that send transactions to accept an `opts` map with transaction sending parameters

Opened this issue · 0 comments

Problem:

I wanted to deploy a transaction using EthClient.deploy/2, but it got stuck in the mempool. After retrying it, I got the error:

** (MatchError) no match of right hand side value: {:error, %{"code" => -32000, "message" => "replacement transaction underpriced"}}
    (eth_client 0.1.0) lib/eth_client.ex:42: EthClient.deploy/1
    (eth_client 0.1.0) lib/eth_client.ex:61: EthClient.deploy/2

This can be manually fixed by incrementing the gas price, but EthClient.deploy does not offer this functionality.

Proposal:

Modify deploy and other functions alike to accept an opts dictionary:

def deploy(bin, abi, opts \\ []) do
  ...
end

So that we can set parameters like:

EthClient.deploy(bin, abi, gas_price: ...)