Skip to content

doc(solana/twap): reduce duplication in example app documentation #665

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 11, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions pages/price-feeds/use-real-time-data/solana.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -361,20 +361,17 @@ await pythSolanaReceiver.provider.sendAll(

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.

### Example Application

See an end-to-end example of using Price Update Accounts for spot prices or TWAP Accounts for time-averaged prices in the [SendUSD Solana Demo App](https://github.com/pyth-network/pyth-examples/tree/main/price_feeds/solana/send_usd). It demonstrates how to fetch data from Hermes, post it to Solana, and consume it from a smart contract. The example includes:

- A React frontend for interacting with the contract
- A Solana program that consumes TWAP updates
- Complete transaction building for posting and consuming TWAP data

The example allows users to send a USD-denominated amount of SOL using either spot prices or TWAP prices, demonstrating how TWAP can be used to reduce the impact of price volatility.

## Additional Resources

You may find these additional resources helpful for developing your Solana application.

### Example application
### Example Application

See an end-to-end example of using Pyth Network prices in the [SendUSD Solana Demo App](https://github.com/pyth-network/pyth-examples/tree/main/price_feeds/solana/send_usd). The app allows users to send a USD-denominated amount of SOL using either spot prices or TWAP prices.
It demonstrates how to fetch price data from Hermes from a frontend, post it to the Solana blockchain, and consume it from a smart contract.

The [Solana example application](https://github.com/pyth-network/pyth-examples/tree/main/price_feeds/solana/send_usd) is an end-to-end application that uses Pyth Network prices on the Solana blockchain and in a frontend.
The example includes:

- A React frontend for interacting with the contract
- Solana programs that consumes spot price updates (Price Update Accounts) and time-averaged price updates (TWAP Accounts)
- Complete transaction building for posting and consuming price data
Loading