This is saying you don't have the BorshDeserialize
trait in scope/are using the wrong try_from_slice_unchecked
. Unfortunately solana_program
exports a bunch of borsh versions that all work with a different combination of types. Anyway:
If you're using spl_stake_pool 1.0.0
the correct import is:
use spl_stake_pool::{solana_program::borsh0_10::try_from_slice_unchecked, state::StakePool};
...
let stake = try_from_slice_unchecked::<StakePool>(&bytes).unwrap();
If you're using spl_stake_pool 2.0.0
the correct import is (notice the difference in the borsh import!):
use spl_stake_pool::{solana_program::borsh1::try_from_slice_unchecked, state::StakePool};
...
let stake = try_from_slice_unchecked::<StakePool>(&bytes).unwrap();