gmsol_sdk/client/pyth/pull_oracle/
mod.rs1pub mod wormhole;
3
4pub mod receiver;
6
7pub mod hermes;
9
10pub mod utils;
12
13mod pull_oracle_impl;
14
15use std::ops::Deref;
16
17use gmsol_solana_utils::program::Program;
18use solana_sdk::signer::Signer;
19
20use self::wormhole::WORMHOLE_PROGRAM_ID;
21
22pub use self::{
23 pull_oracle_impl::{PriceUpdates, PythPullOracleWithHermes},
24 receiver::PythReceiverOps,
25 wormhole::WormholeOps,
26};
27
28const VAA_SPLIT_INDEX: usize = 755;
29
30pub struct PythPullOracle<C> {
32 wormhole: Program<C>,
33 pyth: Program<C>,
34}
35
36impl<S, C> PythPullOracle<C>
37where
38 C: Deref<Target = S> + Clone,
39 S: Signer,
40{
41 pub fn try_new(client: &crate::Client<C>) -> crate::Result<Self> {
43 Ok(Self {
44 wormhole: client.program(WORMHOLE_PROGRAM_ID),
45 pyth: client.program(pyth_solana_receiver_sdk::ID),
46 })
47 }
48}