Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix get era start example #9

Merged
merged 2 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Add the dependency to `mix.exs`:
```elixir
defp deps do
[
{:xogmios, git: "https://github.com/wowica/xogmios"}
{:xogmios, github: "wowica/xogmios", ref: "403384c"}
]
end
```
Expand All @@ -24,5 +24,5 @@ See [ChainSyncClient](./examples/chain_sync_client.ex) and [StateQueryClient](./

## Test

Run `mix test`. Tests do not rely on a running OGMIOS instance.
Run `mix test`. Tests do NOT rely on a running Ogmios instance.

12 changes: 10 additions & 2 deletions examples/state_query_client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ defmodule StateQueryClient do

Then invoke functions:
* StateQueryClient.get_current_epoch()
* StateQueryClient.get_era_start() # not yet supported
* StateQueryClient.get_era_start()
* StateQueryClient.get_bananas() # Returns error message

Not all queries are supported yet.
"""
Expand All @@ -32,7 +33,14 @@ defmodule StateQueryClient do
end

def get_era_start() do
case send_query(:era_start) do
case send_query(:get_era_start) do
{:ok, result} -> result
{:error, reason} -> "Something went wrong #{inspect(reason)}"
end
end

def get_bananas() do
case send_query(:get_bananas) do
{:ok, result} -> result
{:error, reason} -> "Something went wrong #{inspect(reason)}"
end
Expand Down
Loading