hswick / exw3

High level Ethereum RPC Client for Elixir
Apache License 2.0
151 stars 45 forks source link

Fix function calls using proper decode fn #153

Open yashh opened 1 year ago

yashh commented 1 year ago

ex_abi library converts function signature back to ABI function selector to decode the output. Since we already have the abi we can call the decode function directly.

iex(7)> ExW3.Contract.call(:Contract, :symbol)
{:ok, "BAYC"}
iex(8)> ExW3.Contract.call(:Contract, :tokenURI, [1])
{:ok, "ipfs://QmeSjSinHpPnmXmspMjwiXyN6zS4E9zccariGR3jxcaWtq/1"}
iex(9)> ExW3.Contract.call(:Contract, :getApproved, [1])       
{:ok, <<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0>>}