Skip to content

Commit a7269f2

Browse files
Add references to example scripts for Hermes client and Solana TWAP
Co-Authored-By: Tejas Badadare <[email protected]>
1 parent 8d43b1b commit a7269f2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,8 @@ const twapUpdateData = await hermesClient.getLatestTwaps(
322322
console.log(twapUpdateData.binary.data);
323323
```
324324

325+
For a complete example of fetching TWAP updates from Hermes, see the [HermesClient example script](https://github.com/pyth-network/pyth-crosschain/blob/main/apps/hermes/client/js/src/examples/HermesClient.ts) in the Pyth crosschain repository.
326+
325327
#### Post TWAP updates to Solana
326328

327329
Use `PythSolanaReceiver` to post the TWAP updates and consume them in your application:
@@ -358,10 +360,12 @@ await pythSolanaReceiver.provider.sendAll(
358360
await transactionBuilder.buildVersionedTransactions({
359361
computeUnitPriceMicroLamports: 50000,
360362
}),
361-
{ skipPreflight: true }
363+
{ skipPreflight: true }
362364
);
363365
```
364366

367+
For a complete example of posting TWAP updates to Solana, see the [post_twap_update.ts example script](https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/solana/sdk/js/pyth_solana_receiver/examples/post_twap_update.ts) in the Pyth crosschain repository.
368+
365369
### Example Application
366370

367371
The [Solana TWAP example](https://github.com/pyth-network/pyth-examples/tree/main/price_feeds/solana/send_usd) demonstrates how to fetch TWAP data from Hermes, post it to Solana, and consume it from a smart contract. The example includes:

0 commit comments

Comments
 (0)