@@ -288,16 +288,16 @@ pub mod world {
288288 Ok ( ( ) )
289289 }
290290
291- pub fn delegate_buffer ( ctx : Context < DelegateBuffer > , commit_frequency_ms : u32 , validator : Option < Pubkey > ) -> Result < ( ) > {
291+ pub fn delegate_component ( ctx : Context < DelegateComponent > , commit_frequency_ms : u32 , validator : Option < Pubkey > ) -> Result < ( ) > {
292292 let pda_seeds: & [ & [ u8 ] ] = & [ b"buffer" , & ctx. accounts . component . key ( ) . to_bytes ( ) ] ;
293293
294294 let del_accounts = ephemeral_rollups_sdk:: cpi:: DelegateAccounts {
295295 payer : & ctx. accounts . payer ,
296296 pda : & ctx. accounts . component_buffer ,
297- owner_program : & ctx. accounts . owner_program ,
298- buffer : & ctx. accounts . buffer ,
299- delegation_record : & ctx. accounts . delegation_record ,
300- delegation_metadata : & ctx. accounts . delegation_metadata ,
297+ owner_program : & ctx. accounts . world_program ,
298+ buffer : & ctx. accounts . buffer_buffer ,
299+ delegation_record : & ctx. accounts . buffer_delegation_record ,
300+ delegation_metadata : & ctx. accounts . buffer_delegation_metadata ,
301301 delegation_program : & ctx. accounts . delegation_program ,
302302 system_program : & ctx. accounts . system_program ,
303303 } ;
@@ -313,20 +313,40 @@ pub mod world {
313313 config,
314314 ) ?;
315315
316+ bolt_component:: cpi:: delegate (
317+ CpiContext :: new (
318+ ctx. accounts . component_program . to_account_info ( ) ,
319+ bolt_component:: cpi:: accounts:: DelegateInput {
320+ payer : ctx. accounts . payer . to_account_info ( ) ,
321+ entity : ctx. accounts . entity . to_account_info ( ) ,
322+ account : ctx. accounts . component . to_account_info ( ) ,
323+ owner_program : ctx. accounts . component_program . to_account_info ( ) ,
324+ buffer : ctx. accounts . buffer . to_account_info ( ) ,
325+ delegation_metadata : ctx. accounts . delegation_metadata . to_account_info ( ) ,
326+ delegation_record : ctx. accounts . delegation_record . to_account_info ( ) ,
327+ delegation_program : ctx. accounts . delegation_program . to_account_info ( ) ,
328+ system_program : ctx. accounts . system_program . to_account_info ( )
329+ }
330+ ) ,
331+ commit_frequency_ms,
332+ validator
333+ ) ?;
334+
316335 Ok ( ( ) )
317336 }
318337
319338 #[ derive( Accounts ) ]
320- pub struct DelegateBuffer < ' info > {
339+ pub struct DelegateComponent < ' info > {
340+ #[ account( mut ) ]
321341 pub payer : Signer < ' info > ,
322342 /// CHECK:
323- #[ account( ) ]
343+ #[ account( mut ) ]
324344 pub component : AccountInfo < ' info > ,
325345 /// CHECK:
326346 #[ account( mut ) ]
327347 pub component_buffer : AccountInfo < ' info > ,
328348 /// CHECK:`
329- pub owner_program : AccountInfo < ' info > ,
349+ pub component_program : AccountInfo < ' info > ,
330350 /// CHECK:
331351 #[ account( mut ) ]
332352 pub buffer : AccountInfo < ' info > ,
@@ -340,6 +360,21 @@ pub mod world {
340360 pub delegation_program : AccountInfo < ' info > ,
341361 /// CHECK:`
342362 pub system_program : Program < ' info , System > ,
363+ /// CHECK:
364+ #[ account( ) ]
365+ pub entity : AccountInfo < ' info > ,
366+ /// CHECK:`
367+ pub world_program : AccountInfo < ' info > ,
368+ /// CHECK:
369+ #[ account( mut ) ]
370+ pub buffer_buffer : AccountInfo < ' info > ,
371+ /// CHECK:`
372+ #[ account( mut ) ]
373+ pub buffer_delegation_record : AccountInfo < ' info > ,
374+ /// CHECK:`
375+ #[ account( mut ) ]
376+ pub buffer_delegation_metadata : AccountInfo < ' info > ,
377+
343378 }
344379
345380 pub fn destroy_component ( ctx : Context < DestroyComponent > ) -> Result < ( ) > {
0 commit comments