Skip to content

Commit fff682c

Browse files
authored
fix: update solana docs to hermes client (#555)
* go * fix: update solana docs to hermes client
1 parent b78b1d4 commit fff682c

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

pages/price-feeds/use-real-time-data/solana.mdx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ If you are on `v0.30.0{:js}` or any other version, please move to `v0.30.1{:js}`
2929

3030
### Typescript SDK
3131

32-
Pyth provides two Typescript packages, [@pythnetwork/price-service-client](https://github.com/pyth-network/pyth-crosschain/tree/main/price_service/client/js) and [@pythnetwork/pyth-solana-receiver](https://github.com/pyth-network/pyth-crosschain/tree/main/target_chains/solana/sdk/js/pyth_solana_receiver), for fetching Pyth prices and submitting them to the blockchain respectively.
32+
Pyth provides two Typescript packages, [@pythnetwork/hermes-client](https://github.com/pyth-network/pyth-crosschain/tree/main/apps/hermes/client/js) and [@pythnetwork/pyth-solana-receiver](https://github.com/pyth-network/pyth-crosschain/tree/main/target_chains/solana/sdk/js/pyth_solana_receiver), for fetching Pyth prices and submitting them to the blockchain respectively.
3333
Add these packages to your off-chain dependencies:
3434

3535
```bash copy
36-
npm install --save @pythnetwork/price-service-client @pythnetwork/pyth-solana-receiver
36+
npm install --save @pythnetwork/hermes-client @pythnetwork/pyth-solana-receiver
3737
```
3838

3939
## Write Contract Code
@@ -155,24 +155,27 @@ To use price update accounts, the frontend code needs to perform two different t
155155

156156
#### Fetch price updates
157157

158-
Use `PriceServiceConnection` from `@pythnetwork/price-service-client` to fetch Pyth price updates from Hermes:
158+
Use `PriceServiceConnection` from `@pythnetwork/hermes-client` to fetch Pyth price updates from Hermes:
159159

160160
```typescript copy
161-
import { PriceServiceConnection } from "@pythnetwork/price-service-client";
161+
import { HermesClient } from "@pythnetwork/hermes-client";
162162

163163
// The URL below is a public Hermes instance operated by the Pyth Data Association.
164164
// Hermes is also available from several third-party providers listed here:
165165
// https://docs.pyth.network/price-feeds/api-instances-and-providers/hermes
166-
const priceServiceConnection = new PriceServiceConnection(
166+
const priceServiceConnection = new HermesClient(
167167
"https://hermes.pyth.network/",
168-
{ priceFeedRequestConfig: { binary: true } }
168+
{}
169169
);
170170

171171
// Hermes provides other methods for retrieving price updates. See
172172
// https://hermes.pyth.network/docs for more information.
173-
const priceUpdateData: string[] = await priceServiceConnection.getLatestVaas([
174-
"0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43",
175-
]);
173+
const priceUpdateData = (
174+
await priceServiceConnection.getLatestPriceUpdates(
175+
["0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43"],
176+
{ encoding: "base64" }
177+
)
178+
).binary.data;
176179

177180
// Price updates are strings of base64-encoded binary data. Example:
178181
// ["UE5BVQEAAAADuAEAAAADDQJoIZzihVp30/71MXDexqiJDjGpEUEcHj/D06pRiYTPPlRPZKKiVFaZdqiGZ7vvGBj1kK69fKRncCKHXlGyS0LcAQPREzVlm7AcY+X0/hCupv8M5KMhEgOCxq5LxCCKQjL/xwm4jTCJrwkHn/PBaoirnlbHMjxAlwJaFF4RGeE1KRDeAASQIFjfbbobiq2OcSRnK3Ny1NY2Zd012ahIhoWpqxbv4UqDZXLh+bPm4Q14SfO/llRTOmqG6O4v+nfjZa7WNjgxAAZFANqAEooKvijK+476YBITKono+vJ4bSQHUiXOaiGs/zcI6WYGRM0xc6ov2mfCaTuH7mx3ElaLyPGvRX4D9DyHAAf+dPg+NEepwMJI1qPLRcTy0xoz2Yq0k2MuL87gCBsYVlS31atGsQcrXfHr4xcTKKyEUh1tIaOfRbPdX1cvs4D6AAj2/vuKpAgYWhd2gtqHsQLV1vMgq8SKH8wiOmhaMZ06GAQSM1pYLpHZRhYaUQbrUJAeqEeX+qMMqQFMPSSUnEKNAAmCE98NUYbHuEoxJGMDybTGCyDEXCmaNM0q6GT0qrbSmT6NF50yz9CE30WWHNOZzFtK2rCyBYFH2aAp6lQ1JKfmAQpW/wUa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