You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/hermes/client/js/README.md
+30-33
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Price Service Client
1
+
# Hermes Client
2
2
3
3
[Pyth Network](https://pyth.network/) provides real-time pricing data in a variety of asset classes, including cryptocurrency, equities, FX and commodities.
4
4
These prices are available either via HTTP or WebSocket from [Hermes](/apps/hermes).
@@ -9,70 +9,67 @@ This library is a client for interacting with Hermes, allowing your application
// To stop listening to the updates, you can call eventSource.close();
61
+
console.log("Closing event source.");
62
+
eventSource.close();
63
63
```
64
64
65
65
### On-chain Applications
66
66
67
67
On-chain applications will need to submit the price updates returned by Hermes to the Pyth contract on their blockchain.
68
-
These applications should pass the `binary: true` option to the constructor as shown above, to ensure that all methods on `HermesConnection` return the required information.
69
-
This option will add a `vaa` field to `PriceFeed` that represents a signed price update.
70
-
The `vaa` is a binary blob serialized as a base64 string.
71
-
Depending on the blockchain, you may need to reformat this into hex or another format before submitting it to the Pyth contract.
68
+
By default, these updates are returned as binary data and is serialized as either a base64 string or a hex string depending on the chosen encoding. This binary data will need to be submitted to the Pyth contract.
72
69
73
70
### Examples
74
71
75
-
The [HermesClient](./src/examples/HermesClient.ts) example demonstrates both the HTTP and websocket APIs described above.
72
+
The [HermesClient](./src/examples/HermesClient.ts) example demonstrates both the examples above.
76
73
You can run it with `npm run example`.
77
74
A full command that prints BTC and ETH price feeds, in the testnet network, looks like so:
0 commit comments