File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,7 +25,38 @@ Mini-Protocols supported by this library:
2525
2626See [ Examples] ( #examples ) section below for information on how to use this library.
2727
28- ## Installation
28+ ## Quick Start
29+
30+ ``` elixir
31+ Mix .install ([{:xogmios , " > 0.0.0" }])
32+
33+ defmodule ChainSyncClient do
34+ use Xogmios , :chain_sync
35+
36+ def start_link (opts) do
37+ Xogmios .start_chain_sync_link (__MODULE__ , opts)
38+ end
39+
40+ @impl true
41+ def handle_block (block, state) do
42+ IO .puts (block[" height" ])
43+ {:ok , :next_block , state}
44+ end
45+ end
46+
47+ opts = [
48+ # Populate OGMIOS_URL with your Ogmios Server WS URL
49+ # or use https://demeter.run/
50+ url: System .fetch_env! (" OGMIOS_URL" ),
51+ sync_from: :origin
52+ ]
53+
54+ {:ok , _pid } = ChainSyncClient .start_link (opts)
55+
56+ Process .sleep (:infinity )
57+ ```
58+
59+ ## Using it on a mix project
2960
3061Add the dependency to ` mix.exs ` :
3162
You can’t perform that action at this time.
0 commit comments