Skip to content

Commit 75f403e

Browse files
authored
core:update readme (#71)
* Update CHANGELOG * Update README with examples of HTTP API.
1 parent cb08e0d commit 75f403e

File tree

2 files changed

+16
-45
lines changed

2 files changed

+16
-45
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717
- Comprehensive test suite with mocks and error handling
1818
- HTTP client usage example (`examples/http_client.ex`) demonstrating stateless operations
1919

20+
- **HTTP support for Tx Submission protocol**: New stateless HTTP API for one-off transaction submissions without maintaining persistent WebSocket connections.
21+
- New `Xogmios.TxSubmission.HTTP` module for direct HTTP transaction submissions
22+
- Support for both transaction submission and execution unit evaluation via HTTP
23+
- Automatic URL parsing and WebSocket-to-HTTP conversion (ws:// → http://, wss:// → https://)
24+
- Comprehensive test suite with mocks and error handling
25+
- HTTP client usage example (`examples/http_client.ex`) demonstrating stateless operations
26+
27+
2028
## [v0.7.1](https://github.com/wowica/xogmios/releases/tag/v0.7.1) (2025-07-16)
2129

2230
### Fixed

README.md

Lines changed: 8 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ See section below for examples of client modules.
137137

138138
## Examples
139139

140-
### Chain Sync
140+
### Chain Synchronization
141141

142142
The following is an example of a module that implement the **Chain Sync** behaviour. In this example, the client syncs with the tip of the chain, reads the next 3 blocks and then closes the connection with the server.
143143

@@ -184,57 +184,20 @@ For other options available to start the chain sync link, see the docs for [Xogm
184184
The following illustrates working with the **State Query** protocol. It runs queries against the tip of the chain.
185185

186186
```elixir
187-
defmodule StateQueryClient do
188-
use Xogmios, :state_query
189-
alias Xogmios.StateQuery
190-
191-
def start_link(opts) do
192-
Xogmios.start_state_link(__MODULE__, opts)
193-
end
194-
195-
def get_current_epoch(pid \\ __MODULE__) do
196-
# Defaults to Ledger-state queries.
197-
# The following call is the same as calling
198-
# `StateQuery.send_query(pid, "queryLedgerState/epoch")`
199-
StateQuery.send_query(pid, "epoch")
200-
end
201-
202-
def get_network_height(pid \\ __MODULE__) do
203-
# For network queries, scope must be explicitly used.
204-
StateQuery.send_query(pid, "queryNetwork/blockHeight")`
205-
end
206-
207-
def send_query_no_params(pid \\ __MODULE__, query_name) do
208-
StateQuery.send_query(pid, query_name)
209-
end
210-
211-
def send_query(pid \\ __MODULE__, query_name, query_params) do
212-
# Optional query params are sent as the third argument
213-
# to StateQuery.send_query/3
214-
StateQuery.send_query(pid, query_name, query_params)
215-
end
216-
end
187+
Xogmios.HTTP.send_query(ogmios_url, "protocolParameters")
188+
Xogmios.HTTP.send_query(ogmios_url, "queryNetwork/blockHeight")
189+
# Despite being supported, querying for utxos using Ogmios is not recommended
190+
# as it's not performant. Advised to use an indexer for this.
191+
Xogmios.HTTP.send_query(url, "utxo", %{addresses: ["addr1..."]}),
217192
```
218193

219194
### Tx Submission
220195

221196
The following illustrates working with the **Transaction Submission** protocol. It submits a signed transaction, represented as a CBOR, to the Ogmios server.
222197

223198
```elixir
224-
defmodule TxSubmissionClient do
225-
use Xogmios, :tx_submission
226-
alias Xogmios.TxSubmission
227-
228-
def start_link(opts) do
229-
Xogmios.start_tx_submission_link(__MODULE__, opts)
230-
end
231-
232-
def submit_tx(pid \\ __MODULE__, cbor) do
233-
# The CBOR must be a valid transaction,
234-
# properly built and signed
235-
TxSubmission.submit_tx(pid, cbor)
236-
end
237-
end
199+
Xogmios.HTTP.submit_tx(ogmios_url, cbor)
200+
Xogmios.HTTP.evaluate_tx(ogmios_url, cbor)
238201
```
239202

240203
### Mempool Monitoring

0 commit comments

Comments
 (0)