Skip to content
This repository was archived by the owner on Jun 30, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 17 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
13 changes: 11 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,19 @@ description = "pyth price oracle data structures and example usage"
keywords = [ "pyth", "solana", "oracle" ]
readme = "README.md"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
test-bpf = []

[dependencies]
solana-program = "1.6.7"

[dev-dependencies]
solana-client = "1.6.7"
solana-sdk = "1.6.7"
solana-program = "1.6.7"

[lib]
crate-type = ["cdylib", "lib"]

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# pyth-client-rs

A rust API for desribing on-chain pyth account structures. A primer on pyth accounts can be found at https://github.com/pyth-network/pyth-client/blob/main/doc/aggregate_price.md
A rust API for describing on-chain pyth account structures. A primer on pyth accounts can be found at https://github.com/pyth-network/pyth-client/blob/main/doc/aggregate_price.md


Contains a library for use in on-chain program development and an off-chain example program for loading and printing product reference data and aggregate prices from all devnet pyth accounts.
Expand Down Expand Up @@ -37,4 +37,4 @@ product_account .. 6MEwdxe4g1NeAF9u6KDG14anJpFsVEa2cvr5H6iriFZ8
publish_slot . 91340925
twap ......... 7426390900
twac ......... 2259870
```
```
2 changes: 2 additions & 0 deletions Xargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[target.bpfel-unknown-unknown.dependencies.std]
features = []
14 changes: 7 additions & 7 deletions examples/get_accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ fn main() {

let maybe_price = pa.get_current_price();
match maybe_price {
Some((price, confidence, expo)) => {
println!(" price ........ {} x 10^{}", price, expo);
println!(" conf ......... {} x 10^{}", confidence, expo);
Some(p) => {
println!(" price ........ {} x 10^{}", p.price, p.expo);
println!(" conf ......... {} x 10^{}", p.conf, p.expo);
}
None => {
println!(" price ........ unavailable");
Expand All @@ -138,16 +138,16 @@ fn main() {

let maybe_twap = pa.get_twap();
match maybe_twap {
Some((twap, expo)) => {
println!( " twap ......... {} x 10^{}", twap, expo );
Some(twap) => {
println!( " twap ......... {} x 10^{}", twap.price, twap.expo );
println!( " twac ......... {} x 10^{}", twap.conf, twap.expo );
}
None => {
println!( " twap ......... unavailable");
println!( " twac ......... unavailable");
}
}

println!( " twac ......... {}", pa.twac.val );

// go to next price account in list
if pa.next.is_valid() {
px_pkey = Pubkey::new( &pa.next.val );
Expand Down
Loading