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
{{ message }}
This repository was archived by the owner on Apr 3, 2023. It is now read-only.
// When using subscription, make sure to close the websocket upon termination to finish the process gracefully.
51
+
setTimeout(() => {
52
+
connection.closeWebSocket();
53
+
}, 60000);
54
+
44
55
// In order to use Pyth prices in your protocol you need to submit the price update data to Pyth contract in your target
45
56
// chain. `getPriceUpdateData` creates the update data which can be submitted to your contract. Then your contract should
46
57
// call the Pyth Contract with this data.
@@ -83,10 +94,10 @@ There are two examples in [examples](./src/examples/).
83
94
84
95
#### EvmPriceServiceClient
85
96
86
-
[This example](./src/examples/EvmPriceServiceClient.ts) fetches a `PriceFeed`for each given price id and prints them. You can run it with `npm run example-client`. A full command that prints BTC and ETH Price Feeds, in the testnet network, looks like so:
97
+
[This example](./src/examples/EvmPriceServiceClient.ts) fetches `PriceFeed`updates using both a HTTP-request API and a streaming websocket API. You can run it with `npm run example-client`. A full command that prints BTC and ETH price feeds, in the testnet network, looks like so:
87
98
88
99
```bash
89
-
npm run example-client -- --http https://prices-testnet.pyth.network --price-ids 0xf9c0172ba10dfa4d19088d94f5bf61d3b54d5bd7483a322a982e1373ee8ea31b 0xca80ba6dc32e08d06f1aa886011eed1d77c77be9eb761cc10d72b7d0a2fd57a6
100
+
npm run example-client -- --endpoint https://prices-testnet.pyth.network --price-ids 0xf9c0172ba10dfa4d19088d94f5bf61d3b54d5bd7483a322a982e1373ee8ea31b 0xca80ba6dc32e08d06f1aa886011eed1d77c77be9eb761cc10d72b7d0a2fd57a6
You can run this example with `npm run example-relay`. A full command that updates BTC and ETH prices on the BNB Chain testnet network looks like so:
101
112
102
113
```bash
103
-
npm run example-relay -- --network bnb_testnet --mnemonic "my good mnemonic" --http https://prices-testnet.pyth.network --price-ids 0xf9c0172ba10dfa4d19088d94f5bf61d3b54d5bd7483a322a982e1373ee8ea31b 0xca80ba6dc32e08d06f1aa886011eed1d77c77be9eb761cc10d72b7d0a2fd57a6
114
+
npm run example-relay -- --network bnb_testnet --mnemonic "my good mnemonic" --endpoint https://prices-testnet.pyth.network --price-ids 0xf9c0172ba10dfa4d19088d94f5bf61d3b54d5bd7483a322a982e1373ee8ea31b 0xca80ba6dc32e08d06f1aa886011eed1d77c77be9eb761cc10d72b7d0a2fd57a6
104
115
```
105
116
106
117
## How Pyth Works on EVM Chains
@@ -113,7 +124,7 @@ This signed message can then be submitted to the Pyth contract on the EVM networ
113
124
114
125
Price updates are not submitted on the EVM networks automatically: rather, when a consumer needs to use the value of a price they should first submit the latest Wormhole update for that price to the Pyth contract on the EVM network they are working on. This will make the most recent price update available on-chain for EVM contracts to use.
115
126
116
-
## Price Service Endpoints
127
+
## Price Service endpoints
117
128
118
129
Public endpoints for the Price Service are provided for both mainnet and testnet. These can be used regardless of which network you deploy your own contracts to as long as it is a Pyth supported network. For example, you can use the testnet Price Service whether you are deploying your contract to the BNB or Polygon testnet.
0 commit comments