-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add token::price module Adjust to using pyth sponsored price feeds * Add price command to current feed price * Add feed id checks in price fetches * Fix optimistic price calculation * adjust to passing in solana client for price::get
- Loading branch information
Showing
9 changed files
with
226 additions
and
154 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use crate::cmd::*; | ||
use helium_lib::token; | ||
|
||
#[derive(Clone, Debug, clap::Args)] | ||
/// Get the current price from the pyth price feed for the given token | ||
pub struct Cmd { | ||
/// Token to look up | ||
#[arg(value_parser = token::Token::pricekey_value_parser)] | ||
token: token::Token, | ||
} | ||
|
||
impl Cmd { | ||
pub async fn run(&self, opts: Opts) -> Result { | ||
let settings: Settings = opts.try_into()?; | ||
let solana_client = settings.mk_solana_client()?; | ||
let price = token::price::get(&solana_client, self.token).await?; | ||
|
||
print_json(&price) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters