Skip to content

Commit

Permalink
Merge pull request #9 from wowica/fix-query-get-era-start
Browse files Browse the repository at this point in the history
Fix get era start example
  • Loading branch information
caike authored Jan 17, 2024
2 parents 403384c + 4ebe423 commit b868239
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
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

0 comments on commit b868239

Please sign in to comment.