@@ -183,24 +183,18 @@ impl<'a, 'info> AccountSetCleanup<'info, ()> for &'a AccountInfo<'info> {
183183#[ cfg( feature = "idl" ) ]
184184pub mod idl_impl {
185185 use super :: * ;
186- use crate :: idl:: AccountSetToIdl ;
186+ use crate :: idl:: { AccountSetToIdl , FindIdlSeeds } ;
187+ use crate :: prelude:: Seeds ;
187188 use star_frame_idl:: account_set:: { IdlAccountSetDef , IdlSingleAccountSet } ;
189+ use star_frame_idl:: seeds:: IdlFindSeeds ;
188190 use star_frame_idl:: IdlDefinition ;
189191
190192 impl < ' info > AccountSetToIdl < ' info , ( ) > for AccountInfo < ' info > {
191193 fn account_set_to_idl (
192194 _idl_definition : & mut IdlDefinition ,
193195 _arg : ( ) ,
194196 ) -> Result < IdlAccountSetDef > {
195- Ok ( IdlAccountSetDef :: Single ( IdlSingleAccountSet {
196- program_accounts : vec ! [ ] ,
197- seeds : None ,
198- address : None ,
199- writable : false ,
200- signer : false ,
201- optional : false ,
202- is_init : false ,
203- } ) )
197+ Ok ( IdlAccountSetDef :: Single ( IdlSingleAccountSet :: default ( ) ) )
204198 }
205199 }
206200 impl < ' info > AccountSetToIdl < ' info , Pubkey > for AccountInfo < ' info > {
@@ -209,16 +203,49 @@ pub mod idl_impl {
209203 arg : Pubkey ,
210204 ) -> Result < IdlAccountSetDef > {
211205 Ok ( IdlAccountSetDef :: Single ( IdlSingleAccountSet {
212- program_accounts : vec ! [ ] ,
213- seeds : None ,
214206 address : Some ( arg) ,
215- writable : false ,
216- signer : false ,
217- optional : false ,
218- is_init : false ,
207+ ..Default :: default ( )
208+ } ) )
209+ }
210+ }
211+
212+ impl < ' info , T > AccountSetToIdl < ' info , Seeds < ( T , Pubkey ) > > for AccountInfo < ' info >
213+ where
214+ T : FindIdlSeeds ,
215+ {
216+ fn account_set_to_idl (
217+ _idl_definition : & mut IdlDefinition ,
218+ arg : Seeds < ( T , Pubkey ) > ,
219+ ) -> Result < IdlAccountSetDef > {
220+ let ( seeds, program) = arg. 0 ;
221+ Ok ( IdlAccountSetDef :: Single ( IdlSingleAccountSet {
222+ seeds : Some ( IdlFindSeeds {
223+ seeds : T :: find_seeds ( & seeds) ?,
224+ program : Some ( program) ,
225+ } ) ,
226+ ..Default :: default ( )
219227 } ) )
220228 }
221229 }
230+
231+ impl < ' info , T > AccountSetToIdl < ' info , Seeds < T > > for AccountInfo < ' info >
232+ where
233+ T : FindIdlSeeds ,
234+ {
235+ fn account_set_to_idl (
236+ _idl_definition : & mut IdlDefinition ,
237+ arg : Seeds < T > ,
238+ ) -> Result < IdlAccountSetDef > {
239+ Ok ( IdlAccountSetDef :: Single ( IdlSingleAccountSet {
240+ seeds : Some ( IdlFindSeeds {
241+ seeds : T :: find_seeds ( & arg. 0 ) ?,
242+ program : None ,
243+ } ) ,
244+ ..Default :: default ( )
245+ } ) )
246+ }
247+ }
248+
222249 impl < ' a , ' info , A > AccountSetToIdl < ' info , A > for & ' a AccountInfo < ' info >
223250 where
224251 AccountInfo < ' info > : AccountSetToIdl < ' info , A > ,
0 commit comments