Skip to content

Commit c481184

Browse files
refactor: extract instruction handlers for cutils, nft-operations, group, permanent-delegate
- compression/cutils: rename actions/ → instructions/, update mod references - tokens/nft-operations: rename contexts/ → instructions/, rename handlers to handler() - tokens/token-2022/group: extract handler and context into instructions/ - tokens/token-2022/permanent-delegate: extract handler and context into instructions/ All programs now follow the standard instructions/ directory pattern matching anchor init.
1 parent d14d779 commit c481184

15 files changed

Lines changed: 142 additions & 122 deletions

File tree

compression/cutils/anchor/programs/cutils/src/actions/mint.rs renamed to compression/cutils/anchor/programs/cutils/src/instructions/mint.rs

File renamed without changes.

compression/cutils/anchor/programs/cutils/src/actions/mod.rs renamed to compression/cutils/anchor/programs/cutils/src/instructions/mod.rs

File renamed without changes.

compression/cutils/anchor/programs/cutils/src/actions/verify.rs renamed to compression/cutils/anchor/programs/cutils/src/instructions/verify.rs

File renamed without changes.

compression/cutils/anchor/programs/cutils/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
pub mod actions;
2-
pub use actions::*;
1+
pub mod instructions;
2+
pub use instructions::*;
33

44
pub mod bubblegum_types;
55

tokens/nft-operations/anchor/programs/mint-nft/src/contexts/create_collection.rs renamed to tokens/nft-operations/anchor/programs/mint-nft/src/instructions/create_collection.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pub struct CreateCollection<'info> {
6363
token_metadata_program: Program<'info, Metadata>,
6464
}
6565

66-
pub fn handle_create_collection(accounts: &mut CreateCollection, bumps: &CreateCollectionBumps) -> Result<()> {
66+
pub fn handler(accounts: &mut CreateCollection, bumps: &CreateCollectionBumps) -> Result<()> {
6767

6868
let metadata = &accounts.metadata.to_account_info();
6969
let master_edition = &accounts.master_edition.to_account_info();

tokens/nft-operations/anchor/programs/mint-nft/src/contexts/mint_nft.rs renamed to tokens/nft-operations/anchor/programs/mint-nft/src/instructions/mint_nft.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pub struct MintNFT<'info> {
6565
pub token_metadata_program: Program<'info, Metadata>,
6666
}
6767

68-
pub fn handle_mint_nft(accounts: &mut MintNFT, bumps: &MintNFTBumps) -> Result<()> {
68+
pub fn handler(accounts: &mut MintNFT, bumps: &MintNFTBumps) -> Result<()> {
6969

7070
let metadata = &accounts.metadata.to_account_info();
7171
let master_edition = &accounts.master_edition.to_account_info();

tokens/nft-operations/anchor/programs/mint-nft/src/contexts/mod.rs renamed to tokens/nft-operations/anchor/programs/mint-nft/src/instructions/mod.rs

File renamed without changes.

tokens/nft-operations/anchor/programs/mint-nft/src/contexts/verify_collection.rs renamed to tokens/nft-operations/anchor/programs/mint-nft/src/instructions/verify_collection.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub struct VerifyCollectionMint<'info> {
3838
pub token_metadata_program: Program<'info, Metadata>,
3939
}
4040

41-
pub fn handle_verify_collection(accounts: &mut VerifyCollectionMint, bumps: &VerifyCollectionMintBumps) -> Result<()> {
41+
pub fn handler(accounts: &mut VerifyCollectionMint, bumps: &VerifyCollectionMintBumps) -> Result<()> {
4242
let metadata = &accounts.metadata.to_account_info();
4343
let authority = &accounts.mint_authority.to_account_info();
4444
let collection_mint = &accounts.collection_mint.to_account_info();

tokens/nft-operations/anchor/programs/mint-nft/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@ use anchor_lang::prelude::*;
22

33
declare_id!("3EMcczaGi9ivdLxvvFwRbGYeEUEHpGwabXegARw4jLxa");
44

5-
pub mod contexts;
5+
pub mod instructions;
66

7-
pub use contexts::*;
7+
pub use instructions::*;
88

99
#[program]
1010
pub mod mint_nft {
1111

1212
use super::*;
1313
pub fn create_collection(mut context: Context<CreateCollection>) -> Result<()> {
14-
handle_create_collection(&mut context.accounts, &context.bumps)
14+
instructions::create_collection::handler(&mut context.accounts, &context.bumps)
1515
}
1616

1717
pub fn mint_nft(mut context: Context<MintNFT>) -> Result<()> {
18-
handle_mint_nft(&mut context.accounts, &context.bumps)
18+
instructions::mint_nft::handler(&mut context.accounts, &context.bumps)
1919
}
2020

2121
pub fn verify_collection(mut context: Context<VerifyCollectionMint>) -> Result<()> {
22-
handle_verify_collection(&mut context.accounts, &context.bumps)
22+
instructions::verify_collection::handler(&mut context.accounts, &context.bumps)
2323
}
2424
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pub mod test_initialize_group;
2+
3+
pub use test_initialize_group::*;

0 commit comments

Comments
 (0)