Skip to content

use pythnet example #86

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 1 commit into from
Nov 24, 2022
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion pyth-sdk-solana/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ For more information on the different types of Pyth accounts, see the [account s

## Off-chain Example Programs

The example [eth_price](examples/eth_price.rs) program prints the product reference data and current price information for Pyth on Solana devnet.
The example [eth_price](examples/eth_price.rs) program prints the product reference data and current price information for Pyth on pythnet. You can use the same example and replace the url with the relevant Solana cluster urls to get the same information for Solana clusters.
Run the following commands to try this example program:

```
Expand Down
6 changes: 3 additions & 3 deletions pyth-sdk-solana/examples/eth_price.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// example usage of reading pyth price from solana price account
// example usage of reading pyth price from solana/pythnet price account

use pyth_sdk_solana::load_price_feed_from_account;
use solana_client::rpc_client::RpcClient;
Expand All @@ -15,8 +15,8 @@ use std::{


fn main() {
let url = "http://api.mainnet-beta.solana.com";
// Pyth eth/usd price account on mainnet. can be found from https://pyth.network
let url = "http:/pythnet.rpcpool.com";
// Pyth ETH/USD price account on pythnet (can be found on https://pyth.network/developers/price-feed-ids#solana-mainnet-beta which has the same price feed IDs as pythnet)
let key = "JBu1AL4obBcCMqKBBxhpWCNUt136ijcuMZLFvTP7iWdB";
let clnt = RpcClient::new(url.to_string());
let eth_price_key = Pubkey::from_str(key).unwrap();
Expand Down