@@ -6,24 +6,24 @@ use star_frame::{empty_star_frame_instruction, pinocchio::sysvars::rent::Rent, p
66#[ repr( u8 ) ]
77pub enum TokenInstructionSet {
88 InitializeMint ( InitializeMint ) ,
9- InitializeAccount ( InitializeAccount ) ,
9+ InitializeTokenAccount ( InitializeTokenAccount ) ,
1010 InitializeMultisig ( InitializeMultisig ) ,
11- Transfer ( Transfer ) ,
12- Approve ( Approve ) ,
13- Revoke ( Revoke ) ,
11+ TokenTransfer ( TokenTransfer ) ,
12+ ApproveTokenDelegate ( ApproveTokenDelegate ) ,
13+ RevokeTokenDelegate ( RevokeTokenDelegate ) ,
1414 SetAuthority ( SetAuthority ) ,
1515 MintTo ( MintTo ) ,
1616 Burn ( Burn ) ,
17- CloseAccount ( CloseAccount ) ,
17+ CloseTokenAccount ( CloseTokenAccount ) ,
1818 FreezeAccount ( FreezeAccount ) ,
1919 ThawAccount ( ThawAccount ) ,
20- TransferChecked ( TransferChecked ) ,
20+ TokenTransferChecked ( TokenTransferChecked ) ,
2121 ApproveChecked ( ApproveChecked ) ,
2222 MintToChecked ( MintToChecked ) ,
2323 BurnChecked ( BurnChecked ) ,
24- InitializeAccount2 ( InitializeAccount2 ) ,
24+ InitializeTokenAccount2 ( InitializeTokenAccount2 ) ,
2525 SyncNative ( SyncNative ) ,
26- InitializeAccount3 ( InitializeAccount3 ) ,
26+ InitializeTokenAccount3 ( InitializeTokenAccount3 ) ,
2727 InitializeMultisig2 ( InitializeMultisig2 ) ,
2828 InitializeMint2 ( InitializeMint2 ) ,
2929 GetAccountDataSize ( GetAccountDataSize ) ,
@@ -68,16 +68,16 @@ empty_star_frame_instruction!(InitializeMint, InitializeMintAccounts);
6868/// See [`spl_token::instruction::TokenInstruction::InitializeAccount`].
6969#[ derive( Copy , Clone , Debug , Eq , PartialEq , InstructionArgs , BorshDeserialize , BorshSerialize ) ]
7070#[ type_to_idl( program = crate :: token:: Token ) ]
71- pub struct InitializeAccount ;
72- /// Accounts for the [`InitializeAccount `] instruction.
71+ pub struct InitializeTokenAccount ;
72+ /// Accounts for the [`InitializeTokenAccount `] instruction.
7373#[ derive( Debug , Clone , AccountSet ) ]
74- pub struct InitializeAccountAccounts {
74+ pub struct InitializeTokenAccountAccounts {
7575 pub account : Mut < AccountInfo > ,
7676 pub mint : AccountInfo ,
7777 pub owner : AccountInfo ,
7878 pub rent : Sysvar < Rent > ,
7979}
80- empty_star_frame_instruction ! ( InitializeAccount , InitializeAccountAccounts ) ;
80+ empty_star_frame_instruction ! ( InitializeTokenAccount , InitializeTokenAccountAccounts ) ;
8181
8282// initialize multisig
8383/// See [`spl_token::instruction::TokenInstruction::InitializeMultisig`].
@@ -99,49 +99,49 @@ empty_star_frame_instruction!(InitializeMultisig, InitializeMultisigAccounts);
9999/// See [`spl_token::instruction::TokenInstruction::Transfer`].
100100#[ derive( Copy , Clone , Debug , Eq , PartialEq , InstructionArgs , BorshDeserialize , BorshSerialize ) ]
101101#[ type_to_idl( program = crate :: token:: Token ) ]
102- pub struct Transfer {
102+ pub struct TokenTransfer {
103103 pub amount : u64 ,
104104}
105105// todo: handle multisig with AccountSet enums
106- /// Accounts for the [`Transfer `] instruction.
106+ /// Accounts for the [`TokenTransfer `] instruction.
107107#[ derive( Debug , Clone , AccountSet ) ]
108- pub struct TransferAccounts {
108+ pub struct TokenTransferAccounts {
109109 pub source : Mut < AccountInfo > ,
110110 pub destination : Mut < AccountInfo > ,
111111 pub owner : Signer ,
112112}
113- empty_star_frame_instruction ! ( Transfer , TransferAccounts ) ;
113+ empty_star_frame_instruction ! ( TokenTransfer , TokenTransferAccounts ) ;
114114
115115// approve
116116/// See [`spl_token::instruction::TokenInstruction::Approve`].
117117#[ derive( Copy , Clone , Debug , Eq , PartialEq , InstructionArgs , BorshDeserialize , BorshSerialize ) ]
118118#[ type_to_idl( program = crate :: token:: Token ) ]
119- pub struct Approve {
119+ pub struct ApproveTokenDelegate {
120120 pub amount : u64 ,
121121}
122122// todo: handle multisig with AccountSet enums
123- /// Accounts for the [`Approve `] instruction.
123+ /// Accounts for the [`ApproveTokenDelegate `] instruction.
124124#[ derive( Debug , Clone , AccountSet ) ]
125- pub struct ApproveAccounts {
125+ pub struct ApproveTokenDelegateAccounts {
126126 pub source : Mut < AccountInfo > ,
127127 pub delegate : AccountInfo ,
128128 pub owner : Signer ,
129129}
130- empty_star_frame_instruction ! ( Approve , ApproveAccounts ) ;
130+ empty_star_frame_instruction ! ( ApproveTokenDelegate , ApproveTokenDelegateAccounts ) ;
131131
132132// revoke
133133/// See [`spl_token::instruction::TokenInstruction::Revoke`].
134134#[ derive( Copy , Clone , Debug , Eq , PartialEq , InstructionArgs , BorshDeserialize , BorshSerialize ) ]
135135#[ type_to_idl( program = crate :: token:: Token ) ]
136- pub struct Revoke ;
136+ pub struct RevokeTokenDelegate ;
137137// todo: handle multisig with AccountSet enums
138- /// Accounts for the [`Revoke `] instruction.
138+ /// Accounts for the [`RevokeTokenDelegate `] instruction.
139139#[ derive( Debug , Clone , AccountSet ) ]
140- pub struct RevokeAccounts {
140+ pub struct RevokeTokenDelegateAccounts {
141141 pub source : Mut < AccountInfo > ,
142142 pub owner : Signer ,
143143}
144- empty_star_frame_instruction ! ( Revoke , RevokeAccounts ) ;
144+ empty_star_frame_instruction ! ( RevokeTokenDelegate , RevokeTokenDelegateAccounts ) ;
145145
146146// set authority
147147/// See [`spl_token::instruction::TokenInstruction::SetAuthority`].
@@ -198,16 +198,16 @@ empty_star_frame_instruction!(Burn, BurnAccounts);
198198/// See [`spl_token::instruction::TokenInstruction::CloseAccount`].
199199#[ derive( Copy , Clone , Debug , Eq , PartialEq , InstructionArgs , BorshDeserialize , BorshSerialize ) ]
200200#[ type_to_idl( program = crate :: token:: Token ) ]
201- pub struct CloseAccount ;
201+ pub struct CloseTokenAccount ;
202202// todo: handle multisig with AccountSet enums
203- /// Accounts for the [`CloseAccount `] instruction.
203+ /// Accounts for the [`CloseTokenAccount `] instruction.
204204#[ derive( Debug , Clone , AccountSet ) ]
205205pub struct CloseAccountAccounts {
206206 pub account : Mut < AccountInfo > ,
207207 pub destination : Mut < AccountInfo > ,
208208 pub owner : Signer ,
209209}
210- empty_star_frame_instruction ! ( CloseAccount , CloseAccountAccounts ) ;
210+ empty_star_frame_instruction ! ( CloseTokenAccount , CloseAccountAccounts ) ;
211211
212212// freeze account
213213/// See [`spl_token::instruction::TokenInstruction::FreezeAccount`].
@@ -243,11 +243,11 @@ empty_star_frame_instruction!(ThawAccount, ThawAccountAccounts);
243243/// See [`spl_token::instruction::TokenInstruction::TransferChecked`].
244244#[ derive( Copy , Clone , Debug , Eq , PartialEq , InstructionArgs , BorshDeserialize , BorshSerialize ) ]
245245#[ type_to_idl( program = crate :: token:: Token ) ]
246- pub struct TransferChecked {
246+ pub struct TokenTransferChecked {
247247 pub amount : u64 ,
248248 pub decimals : u8 ,
249249}
250- /// Accounts for the [`TransferChecked `] instruction.
250+ /// Accounts for the [`TokenTransferChecked `] instruction.
251251/// todo: Handle multisig with AccountSet enums.
252252#[ derive( Debug , Clone , AccountSet ) ]
253253pub struct TransferCheckedAccounts {
@@ -256,7 +256,7 @@ pub struct TransferCheckedAccounts {
256256 pub destination : Mut < AccountInfo > ,
257257 pub owner : Signer ,
258258}
259- empty_star_frame_instruction ! ( TransferChecked , TransferCheckedAccounts ) ;
259+ empty_star_frame_instruction ! ( TokenTransferChecked , TransferCheckedAccounts ) ;
260260
261261// approve checked
262262/// See [`spl_token::instruction::TokenInstruction::ApproveChecked`].
@@ -317,18 +317,18 @@ empty_star_frame_instruction!(BurnChecked, BurnCheckedAccounts);
317317/// See [`spl_token::instruction::TokenInstruction::InitializeAccount2`].
318318#[ derive( Copy , Clone , Debug , Eq , PartialEq , InstructionArgs , BorshDeserialize , BorshSerialize ) ]
319319#[ type_to_idl( program = crate :: token:: Token ) ]
320- pub struct InitializeAccount2 {
320+ pub struct InitializeTokenAccount2 {
321321 pub owner : Pubkey ,
322322}
323- /// Accounts for the [`InitializeAccount2 `] instruction.
323+ /// Accounts for the [`InitializeTokenAccount2 `] instruction.
324324/// todo: Consider multisig ownership scenarios if required.
325325#[ derive( Debug , Clone , AccountSet ) ]
326- pub struct InitializeAccount2Accounts {
326+ pub struct InitializeTokenAccount2Accounts {
327327 pub account : Mut < AccountInfo > ,
328328 pub mint : AccountInfo ,
329329 pub rent : Sysvar < Rent > ,
330330}
331- empty_star_frame_instruction ! ( InitializeAccount2 , InitializeAccount2Accounts ) ;
331+ empty_star_frame_instruction ! ( InitializeTokenAccount2 , InitializeTokenAccount2Accounts ) ;
332332
333333// sync native
334334/// See [`spl_token::instruction::TokenInstruction::SyncNative`].
@@ -346,16 +346,16 @@ empty_star_frame_instruction!(SyncNative, SyncNativeAccounts);
346346/// See [`spl_token::instruction::TokenInstruction::InitializeAccount3`].
347347#[ derive( Copy , Clone , Debug , Eq , PartialEq , InstructionArgs , BorshDeserialize , BorshSerialize ) ]
348348#[ type_to_idl( program = crate :: token:: Token ) ]
349- pub struct InitializeAccount3 {
349+ pub struct InitializeTokenAccount3 {
350350 pub owner : Pubkey ,
351351}
352- /// Accounts for the [`InitializeAccount3 `] instruction.
352+ /// Accounts for the [`InitializeTokenAccount3 `] instruction.
353353#[ derive( Debug , Clone , AccountSet ) ]
354- pub struct InitializeAccount3Accounts {
354+ pub struct InitializeTokenAccount3Accounts {
355355 pub account : Mut < AccountInfo > ,
356356 pub mint : AccountInfo ,
357357}
358- empty_star_frame_instruction ! ( InitializeAccount3 , InitializeAccount3Accounts ) ;
358+ empty_star_frame_instruction ! ( InitializeTokenAccount3 , InitializeTokenAccount3Accounts ) ;
359359
360360// initialize multisig 2
361361/// See [`spl_token::instruction::TokenInstruction::InitializeMultisig2`].
@@ -475,8 +475,8 @@ mod tests {
475475 let owner = Pubkey :: new_unique ( ) ;
476476
477477 let initialize_account_sf = Token :: instruction (
478- & InitializeAccount ,
479- InitializeAccountClientAccounts {
478+ & InitializeTokenAccount ,
479+ InitializeTokenAccountClientAccounts {
480480 account,
481481 mint,
482482 owner,
@@ -520,8 +520,8 @@ mod tests {
520520 let amount = 500u64 ;
521521
522522 let transfer_sf = Token :: instruction (
523- & Transfer { amount } ,
524- TransferClientAccounts {
523+ & TokenTransfer { amount } ,
524+ TokenTransferClientAccounts {
525525 source,
526526 destination,
527527 owner,
@@ -548,8 +548,8 @@ mod tests {
548548 let amount = 250u64 ;
549549
550550 let approve_sf = Token :: instruction (
551- & Approve { amount } ,
552- ApproveClientAccounts {
551+ & ApproveTokenDelegate { amount } ,
552+ ApproveTokenDelegateClientAccounts {
553553 source,
554554 delegate,
555555 owner,
@@ -573,7 +573,10 @@ mod tests {
573573 let source = Pubkey :: new_unique ( ) ;
574574 let owner = Pubkey :: new_unique ( ) ;
575575
576- let revoke_sf = Token :: instruction ( & Revoke , RevokeClientAccounts { source, owner } ) ?;
576+ let revoke_sf = Token :: instruction (
577+ & RevokeTokenDelegate ,
578+ RevokeTokenDelegateClientAccounts { source, owner } ,
579+ ) ?;
577580
578581 let revoke_ix = spl_token:: instruction:: revoke ( & spl_token:: id ( ) , & source, & owner, & [ ] ) ?;
579582 assert_eq ! ( revoke_sf, revoke_ix) ;
@@ -668,7 +671,7 @@ mod tests {
668671 let owner = Pubkey :: new_unique ( ) ;
669672
670673 let close_account_sf = Token :: instruction (
671- & CloseAccount ,
674+ & CloseTokenAccount ,
672675 CloseAccountClientAccounts {
673676 account,
674677 destination,
@@ -749,7 +752,7 @@ mod tests {
749752 let decimals = 2u8 ;
750753
751754 let transfer_checked_sf = Token :: instruction (
752- & TransferChecked { amount, decimals } ,
755+ & TokenTransferChecked { amount, decimals } ,
753756 TransferCheckedClientAccounts {
754757 source,
755758 mint,
@@ -883,8 +886,8 @@ mod tests {
883886 let owner = Pubkey :: new_unique ( ) ;
884887
885888 let initialize_account2_sf = Token :: instruction (
886- & InitializeAccount2 { owner } ,
887- InitializeAccount2ClientAccounts {
889+ & InitializeTokenAccount2 { owner } ,
890+ InitializeTokenAccount2ClientAccounts {
888891 account,
889892 mint,
890893 rent : None ,
@@ -904,8 +907,8 @@ mod tests {
904907 let owner = Pubkey :: new_unique ( ) ;
905908
906909 let initialize_account3_sf = Token :: instruction (
907- & InitializeAccount3 { owner } ,
908- InitializeAccount3ClientAccounts { account, mint } ,
910+ & InitializeTokenAccount3 { owner } ,
911+ InitializeTokenAccount3ClientAccounts { account, mint } ,
909912 ) ?;
910913
911914 let initialize_account3_ix =
0 commit comments