Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: more consistency in naming #42

Merged
merged 1 commit into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions anchor/programs/pubkey-protocol/src/instructions/profile/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
pub mod add_profile_authority;
pub mod create_profile;
pub mod remove_profile_authority;
pub mod update_profile_details;
pub mod profile_authority_add;
pub mod profile_create;
pub mod profile_authority_remove;
pub mod profile_update_details;

pub use add_profile_authority::*;
pub use create_profile::*;
pub use remove_profile_authority::*;
pub use update_profile_details::*;
pub use profile_authority_add::*;
pub use profile_authority_remove::*;
pub use profile_create::*;
pub use profile_update_details::*;
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::state::*;
use crate::utils::*;

#[derive(Accounts)]
pub struct AddAuthority<'info> {
pub struct ProfileAuthorityAdd<'info> {
#[account(
mut,
seeds = [
Expand All @@ -30,7 +30,7 @@ pub struct AddAuthority<'info> {
pub system_program: Program<'info, System>,
}

pub fn add_authority(ctx: Context<AddAuthority>, args: AddAuthorityArgs) -> Result<()> {
pub fn profile_authority_add(ctx: Context<ProfileAuthorityAdd>, args: ProfileAuthorityAddArgs) -> Result<()> {
let profile = &mut ctx.accounts.profile;

let fee_payer = &mut ctx.accounts.fee_payer;
Expand Down Expand Up @@ -60,6 +60,6 @@ pub fn add_authority(ctx: Context<AddAuthority>, args: AddAuthorityArgs) -> Resu
}

#[derive(AnchorSerialize, AnchorDeserialize)]
pub struct AddAuthorityArgs {
pub struct ProfileAuthorityAddArgs {
pub new_authority: Pubkey,
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::errors::*;
use crate::state::*;

#[derive(Accounts)]
pub struct RemoveAuthority<'info> {
pub struct ProfileAuthorityRemove<'info> {
#[account(
mut,
seeds = [
Expand All @@ -28,7 +28,7 @@ pub struct RemoveAuthority<'info> {
pub fee_payer: Signer<'info>,
}

pub fn remove_authority(ctx: Context<RemoveAuthority>, args: RemoveAuthorityArgs) -> Result<()> {
pub fn profile_authority_remove(ctx: Context<ProfileAuthorityRemove>, args: ProfileAuthorityRemoveArgs) -> Result<()> {
let profile = &mut ctx.accounts.profile;
let authority_to_remove = args.authority_to_remove;

Expand All @@ -53,6 +53,6 @@ pub fn remove_authority(ctx: Context<RemoveAuthority>, args: RemoveAuthorityArgs
}

#[derive(AnchorSerialize, AnchorDeserialize)]
pub struct RemoveAuthorityArgs {
pub struct ProfileAuthorityRemoveArgs {
pub authority_to_remove: Pubkey,
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use crate::errors::*;
use crate::state::*;

#[derive(Accounts)]
#[instruction(args: CreateProfileArgs)]
pub struct CreateProfile<'info> {
#[instruction(args: ProfileCreateArgs)]
pub struct ProfileCreate<'info> {
#[account(
init,
payer = fee_payer,
Expand Down Expand Up @@ -42,7 +42,7 @@ pub struct CreateProfile<'info> {
pub system_program: Program<'info, System>,
}

pub fn create(ctx: Context<CreateProfile>, args: CreateProfileArgs) -> Result<()> {
pub fn profile_create(ctx: Context<ProfileCreate>, args: ProfileCreateArgs) -> Result<()> {
let profile = &mut ctx.accounts.profile;
let authority = ctx.accounts.authority.key();
let fee_payer = ctx.accounts.fee_payer.key();
Expand All @@ -59,7 +59,7 @@ pub fn create(ctx: Context<CreateProfile>, args: CreateProfileArgs) -> Result<()
pointer.validate()?;

// Creating profile account
let CreateProfileArgs {
let ProfileCreateArgs {
username,
name,
avatar_url,
Expand Down Expand Up @@ -88,7 +88,7 @@ pub fn create(ctx: Context<CreateProfile>, args: CreateProfileArgs) -> Result<()
}

#[derive(AnchorSerialize, AnchorDeserialize)]
pub struct CreateProfileArgs {
pub struct ProfileCreateArgs {
pub username: String,
pub name: String,
pub avatar_url: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub struct UpdateProfileDetails<'info> {
pub fee_payer: Signer<'info>,
}

pub fn update_profile_details(
pub fn profile_update_details(
ctx: Context<UpdateProfileDetails>,
args: UpdateProfileDetailsArgs,
) -> Result<()> {
Expand Down
24 changes: 12 additions & 12 deletions anchor/programs/pubkey-protocol/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,26 @@ pub mod pubkey_protocol {
use super::*;

// Profile Actions
pub fn create_profile(ctx: Context<CreateProfile>, args: CreateProfileArgs) -> Result<()> {
profile::create(ctx, args)
pub fn profile_authority_add(ctx: Context<ProfileAuthorityAdd>, args: ProfileAuthorityAddArgs) -> Result<()> {
profile::profile_authority_add(ctx, args)
}

pub fn update_profile_details(
ctx: Context<UpdateProfileDetails>,
args: UpdateProfileDetailsArgs,
pub fn profile_authority_remove(
ctx: Context<ProfileAuthorityRemove>,
args: ProfileAuthorityRemoveArgs,
) -> Result<()> {
profile::update_profile_details(ctx, args)
profile::profile_authority_remove(ctx, args)
}

pub fn add_profile_authority(ctx: Context<AddAuthority>, args: AddAuthorityArgs) -> Result<()> {
profile::add_authority(ctx, args)
pub fn profile_create(ctx: Context<ProfileCreate>, args: ProfileCreateArgs) -> Result<()> {
profile::profile_create(ctx, args)
}

pub fn remove_authority(
ctx: Context<RemoveAuthority>,
args: RemoveAuthorityArgs,
pub fn profile_update_details(
ctx: Context<UpdateProfileDetails>,
args: UpdateProfileDetailsArgs,
) -> Result<()> {
profile::remove_authority(ctx, args)
profile::profile_update_details(ctx, args)
}

// Identity Actions
Expand Down
Loading
Loading