|
@@ -1,6 +1,6 @@
|
|
|
use crate::{
|
|
|
- AccountDeserialize, AccountSerialize, Accounts, AccountsInit, ToAccountInfo, ToAccountInfos,
|
|
|
- ToAccountMetas,
|
|
|
+ AccountDeserialize, AccountSerialize, Accounts, AccountsInit, CpiAccount, ToAccountInfo,
|
|
|
+ ToAccountInfos, ToAccountMetas,
|
|
|
};
|
|
|
use solana_sdk::account_info::AccountInfo;
|
|
|
use solana_sdk::instruction::AccountMeta;
|
|
@@ -129,3 +129,15 @@ impl<'a, T: AccountSerialize + AccountDeserialize + Clone> DerefMut for ProgramA
|
|
|
&mut self.account
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+impl<'info, T> From<CpiAccount<'info, T>> for ProgramAccount<'info, T>
|
|
|
+where
|
|
|
+ T: AccountSerialize + AccountDeserialize + Clone,
|
|
|
+{
|
|
|
+ fn from(a: CpiAccount<'info, T>) -> Self {
|
|
|
+ Self {
|
|
|
+ info: a.to_account_info(),
|
|
|
+ account: Deref::deref(&a).clone(),
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|