sealevel_tools/cpi/token_program/
sync_native.rs1use crate::{
2 cpi::{CpiAuthority, CpiInstruction},
3 entrypoint::NoStdAccountInfo,
4 pubkey::Pubkey,
5};
6
7#[derive(Clone, PartialEq, Eq)]
11pub struct SyncNative<'a, 'b: 'a> {
12 pub token_program_id: &'a Pubkey,
13 pub source: &'b NoStdAccountInfo,
14 pub authority: CpiAuthority<'a, 'b>,
15}
16
17impl<'a, 'b: 'a> SyncNative<'a, 'b> {
18 #[inline(always)]
20 pub fn into_invoke(self) {
21 let Self {
22 token_program_id,
23 source,
24 authority,
25 } = self;
26
27 CpiInstruction {
28 program_id: token_program_id,
29 accounts: &[source.to_meta_c(), authority.to_meta_c_signer()],
30 data: &[17],
32 }
33 .invoke_possibly_signed(
34 &[source.to_info_c(), authority.to_info_c()],
35 &[authority.signer_seeds],
36 );
37 }
38}