Skip to content

Commit

Permalink
Merge pull request #86 from pyth-network/example-pythnet
Browse files Browse the repository at this point in the history
use pythnet example
cctdaniel authored Nov 24, 2022
2 parents 8a78f2a + bb3ee87 commit 47f8bca
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyth-sdk-solana/README.md
Original file line number Diff line number Diff line change
@@ -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:

```
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;
@@ -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();

0 comments on commit 47f8bca

Please sign in to comment.