I'm facing issues with Pyth SDK
I'm getting these errors
error[E0599]: no function or associated item named `create_type` found for struct `states::states::PriceFeed` in the current scope --> programs/pricelocker/src/contexts/price_unlock_funds.rs:9:10 |9 | #[derive(Accounts)] | ^^^^^^^^ function or associated item not found in `PriceFeed` | ::: programs/pricelocker/src/states/states.rs:51:1 |51 | pub struct PriceFeed(pyth_sdk::PriceFeed); | -------------------- function or associated item `create_type` not found for this struct | = help: items from traits can only be used if the trait is implemented and in scope = note: the following trait defines an item `create_type`, perhaps you need to implement it: candidate #1: `anchor_lang::IdlBuild` = note: this error originates in the derive macro `Accounts` (in Nightly builds, run with -Z macro-backtrace for more info)error[E0277]: the trait bound `states::states::PriceFeed: Discriminator` is not satisfied --> programs/pricelocker/src/contexts/price_unlock_funds.rs:23:47 |23 | pub pyth_solprice_account: Account<'info, PriceFeed>, | ^^^^^^^^^ the trait `Discriminator` is not implemented for `states::states::PriceFeed` | = help: the following other types implement trait `Discriminator`: StakeFunds __idl::IdlAccount anchor_lang::ProgramData anchor_lang::idl::IdlAccount anchor_spl::token::Mint anchor_spl::token::TokenAccount anchor_spl::token_interface::Mint anchor_spl::token_interface::TokenAccount and 10 otherserror[E0599]: no function or associated item named `insert_types` found for struct `states::states::PriceFeed` in the current scope --> programs/pricelocker/src/contexts/price_unlock_funds.rs:9:10 |9 | #[derive(Accounts)] | ^^^^^^^^ function or associated item not found in `PriceFeed` | ::: programs/pricelocker/src/states/states.rs:51:1 |51 | pub struct PriceFeed(pyth_sdk::PriceFeed); | -------------------- function or associated item `insert_types` not found for this struct | = help: items from traits can only be used if the trait is implemented and in scope = note: the following trait defines an item `insert_types`, perhaps you need to implement it: candidate #1: `anchor_lang::IdlBuild` = note: this error originates in the derive macro `Accounts` (in Nightly builds, run with -Z macro-backtrace for more info)
This is my cargo.toml
[package]name = "pricelocker"version = "0.1.0"description = "Created with Anchor"edition = "2021"[lib]crate-type = ["cdylib", "lib"]name = "pricelocker"[features]default = []cpi = ["no-entrypoint"]no-entrypoint = []no-idl = []no-log-ix-name = []idl-build = ["anchor-lang/idl-build", "anchor-spl/idl-build"][dependencies]anchor-lang = "0.30.1"pyth-sdk = "0.8.0"pyth-sdk-solana = "0.10.2"anchor-spl = { version = "0.30.1", features = ["token"] }
This is my PriceFeed
use crate::*;use pyth_sdk_solana::state::{load_price_account, SolanaPriceAccount};use std::ops::Deref;use std::str::FromStr;use crate::PythErrorCode;// PYTH integrations#[derive(Clone)]pub struct PriceFeed(pyth_sdk::PriceFeed);impl anchor_lang::Owner for PriceFeed { fn owner() -> Pubkey { // Make sure the owner is the pyth oracle account on solana devnet let oracle_addr = "gSbePebfvPy7tRqimPoVecS2UsBvYv46ynrzWocc92s"; return Pubkey::from_str(&oracle_addr).unwrap(); }}impl anchor_lang::AccountDeserialize for PriceFeed { fn try_deserialize_unchecked(data: &mut &[u8]) -> Result<Self> { let account: &SolanaPriceAccount = load_price_account(data).map_err(|_x| error!(PythErrorCode::PythError))?; // Use a dummy key since the key field will be removed from the SDK let zeros: [u8; 32] = [0; 32]; let dummy_key = Pubkey::new(&zeros); let feed = account.to_price_feed(&dummy_key); return Ok(PriceFeed(feed)); }}impl anchor_lang::AccountSerialize for PriceFeed { fn try_serialize<W: std::io::Write>(&self, _writer: &mut W) -> std::result::Result<(), Error> { Err(error!(PythErrorCode::TryToSerializePriceAccount)) }}impl Deref for PriceFeed { type Target = pyth_sdk::PriceFeed; fn deref(&self) -> &Self::Target {&self.0 }}
Any help will be much appreciated!