Cargo.toml
[dependencies]
anchor-lang = "0.25.0"
switchboard-v2 = "0.1.16"
lib.rs
pub fn initialize(ctx: Context<GetResult>) -> Result<()> {
let aggregator = &ctx.accounts.aggregator_feed;
let val: u64 = AggregatorAccountData::new(aggregator)?
.get_result()?
.try_into()?;
Ok(())
}
AggregatorAccountData::new(aggregator) throws an error saying
lifetime may not live long enough
argument requires that `'1` must outlive `'2`