|
|
@ -89,6 +89,15 @@ iex(11)> ExW3.Contract.call(:SimpleStorage, :get) |
|
|
|
{:ok, 1} |
|
|
|
{:ok, 1} |
|
|
|
``` |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Asynchronous |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ExW3 now provides async versions of `call` and `send`. They both return a `Task` that can be awaited on. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```elixir |
|
|
|
|
|
|
|
t = ExW3.Contract.call_async(:SimpleStorage, :get) |
|
|
|
|
|
|
|
{:ok, data} = Task.await(t) |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
## Listening for Events |
|
|
|
## Listening for Events |
|
|
|
|
|
|
|
|
|
|
|
Elixir doesn't have event listeners like say JS. However, we can simulate that behavior with message passing. |
|
|
|
Elixir doesn't have event listeners like say JS. However, we can simulate that behavior with message passing. |
|
|
|