diff --git a/anchor/programs/pubkey-protocol/src/instructions/profile/mod.rs b/anchor/programs/pubkey-protocol/src/instructions/profile/mod.rs index e468997..1186fa4 100644 --- a/anchor/programs/pubkey-protocol/src/instructions/profile/mod.rs +++ b/anchor/programs/pubkey-protocol/src/instructions/profile/mod.rs @@ -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::*; diff --git a/anchor/programs/pubkey-protocol/src/instructions/profile/add_profile_authority.rs b/anchor/programs/pubkey-protocol/src/instructions/profile/profile_authority_add.rs similarity index 89% rename from anchor/programs/pubkey-protocol/src/instructions/profile/add_profile_authority.rs rename to anchor/programs/pubkey-protocol/src/instructions/profile/profile_authority_add.rs index 0b32344..3bdde23 100644 --- a/anchor/programs/pubkey-protocol/src/instructions/profile/add_profile_authority.rs +++ b/anchor/programs/pubkey-protocol/src/instructions/profile/profile_authority_add.rs @@ -6,7 +6,7 @@ use crate::state::*; use crate::utils::*; #[derive(Accounts)] -pub struct AddAuthority<'info> { +pub struct ProfileAuthorityAdd<'info> { #[account( mut, seeds = [ @@ -30,7 +30,7 @@ pub struct AddAuthority<'info> { pub system_program: Program<'info, System>, } -pub fn add_authority(ctx: Context, args: AddAuthorityArgs) -> Result<()> { +pub fn profile_authority_add(ctx: Context, args: ProfileAuthorityAddArgs) -> Result<()> { let profile = &mut ctx.accounts.profile; let fee_payer = &mut ctx.accounts.fee_payer; @@ -60,6 +60,6 @@ pub fn add_authority(ctx: Context, args: AddAuthorityArgs) -> Resu } #[derive(AnchorSerialize, AnchorDeserialize)] -pub struct AddAuthorityArgs { +pub struct ProfileAuthorityAddArgs { pub new_authority: Pubkey, } diff --git a/anchor/programs/pubkey-protocol/src/instructions/profile/remove_profile_authority.rs b/anchor/programs/pubkey-protocol/src/instructions/profile/profile_authority_remove.rs similarity index 87% rename from anchor/programs/pubkey-protocol/src/instructions/profile/remove_profile_authority.rs rename to anchor/programs/pubkey-protocol/src/instructions/profile/profile_authority_remove.rs index 875f55d..7b54462 100644 --- a/anchor/programs/pubkey-protocol/src/instructions/profile/remove_profile_authority.rs +++ b/anchor/programs/pubkey-protocol/src/instructions/profile/profile_authority_remove.rs @@ -5,7 +5,7 @@ use crate::errors::*; use crate::state::*; #[derive(Accounts)] -pub struct RemoveAuthority<'info> { +pub struct ProfileAuthorityRemove<'info> { #[account( mut, seeds = [ @@ -28,7 +28,7 @@ pub struct RemoveAuthority<'info> { pub fee_payer: Signer<'info>, } -pub fn remove_authority(ctx: Context, args: RemoveAuthorityArgs) -> Result<()> { +pub fn profile_authority_remove(ctx: Context, args: ProfileAuthorityRemoveArgs) -> Result<()> { let profile = &mut ctx.accounts.profile; let authority_to_remove = args.authority_to_remove; @@ -53,6 +53,6 @@ pub fn remove_authority(ctx: Context, args: RemoveAuthorityArgs } #[derive(AnchorSerialize, AnchorDeserialize)] -pub struct RemoveAuthorityArgs { +pub struct ProfileAuthorityRemoveArgs { pub authority_to_remove: Pubkey, } diff --git a/anchor/programs/pubkey-protocol/src/instructions/profile/create_profile.rs b/anchor/programs/pubkey-protocol/src/instructions/profile/profile_create.rs similarity index 90% rename from anchor/programs/pubkey-protocol/src/instructions/profile/create_profile.rs rename to anchor/programs/pubkey-protocol/src/instructions/profile/profile_create.rs index 8265cb8..4e47272 100644 --- a/anchor/programs/pubkey-protocol/src/instructions/profile/create_profile.rs +++ b/anchor/programs/pubkey-protocol/src/instructions/profile/profile_create.rs @@ -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, @@ -42,7 +42,7 @@ pub struct CreateProfile<'info> { pub system_program: Program<'info, System>, } -pub fn create(ctx: Context, args: CreateProfileArgs) -> Result<()> { +pub fn profile_create(ctx: Context, args: ProfileCreateArgs) -> Result<()> { let profile = &mut ctx.accounts.profile; let authority = ctx.accounts.authority.key(); let fee_payer = ctx.accounts.fee_payer.key(); @@ -59,7 +59,7 @@ pub fn create(ctx: Context, args: CreateProfileArgs) -> Result<() pointer.validate()?; // Creating profile account - let CreateProfileArgs { + let ProfileCreateArgs { username, name, avatar_url, @@ -88,7 +88,7 @@ pub fn create(ctx: Context, args: CreateProfileArgs) -> Result<() } #[derive(AnchorSerialize, AnchorDeserialize)] -pub struct CreateProfileArgs { +pub struct ProfileCreateArgs { pub username: String, pub name: String, pub avatar_url: String, diff --git a/anchor/programs/pubkey-protocol/src/instructions/profile/update_profile_details.rs b/anchor/programs/pubkey-protocol/src/instructions/profile/profile_update_details.rs similarity index 97% rename from anchor/programs/pubkey-protocol/src/instructions/profile/update_profile_details.rs rename to anchor/programs/pubkey-protocol/src/instructions/profile/profile_update_details.rs index 82d120e..27f1318 100644 --- a/anchor/programs/pubkey-protocol/src/instructions/profile/update_profile_details.rs +++ b/anchor/programs/pubkey-protocol/src/instructions/profile/profile_update_details.rs @@ -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, args: UpdateProfileDetailsArgs, ) -> Result<()> { diff --git a/anchor/programs/pubkey-protocol/src/lib.rs b/anchor/programs/pubkey-protocol/src/lib.rs index 84c8d38..c43cbcf 100644 --- a/anchor/programs/pubkey-protocol/src/lib.rs +++ b/anchor/programs/pubkey-protocol/src/lib.rs @@ -16,26 +16,26 @@ pub mod pubkey_protocol { use super::*; // Profile Actions - pub fn create_profile(ctx: Context, args: CreateProfileArgs) -> Result<()> { - profile::create(ctx, args) + pub fn profile_authority_add(ctx: Context, args: ProfileAuthorityAddArgs) -> Result<()> { + profile::profile_authority_add(ctx, args) } - pub fn update_profile_details( - ctx: Context, - args: UpdateProfileDetailsArgs, + pub fn profile_authority_remove( + ctx: Context, + args: ProfileAuthorityRemoveArgs, ) -> Result<()> { - profile::update_profile_details(ctx, args) + profile::profile_authority_remove(ctx, args) } - pub fn add_profile_authority(ctx: Context, args: AddAuthorityArgs) -> Result<()> { - profile::add_authority(ctx, args) + pub fn profile_create(ctx: Context, args: ProfileCreateArgs) -> Result<()> { + profile::profile_create(ctx, args) } - pub fn remove_authority( - ctx: Context, - args: RemoveAuthorityArgs, + pub fn profile_update_details( + ctx: Context, + args: UpdateProfileDetailsArgs, ) -> Result<()> { - profile::remove_authority(ctx, args) + profile::profile_update_details(ctx, args) } // Identity Actions diff --git a/anchor/target/idl/pubkey_protocol.json b/anchor/target/idl/pubkey_protocol.json index 91383d9..7faa7fc 100644 --- a/anchor/target/idl/pubkey_protocol.json +++ b/anchor/target/idl/pubkey_protocol.json @@ -97,92 +97,6 @@ } ] }, - { - "name": "add_profile_authority", - "discriminator": [ - 193, - 106, - 183, - 12, - 216, - 250, - 151, - 31 - ], - "accounts": [ - { - "name": "profile", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 117, - 98, - 107, - 101, - 121, - 95, - 112, - 114, - 111, - 116, - 111, - 99, - 111, - 108 - ] - }, - { - "kind": "const", - "value": [ - 112, - 114, - 111, - 102, - 105, - 108, - 101 - ] - }, - { - "kind": "account", - "path": "profile.username", - "account": "Profile" - } - ] - } - }, - { - "name": "authority", - "signer": true - }, - { - "name": "fee_payer", - "writable": true, - "signer": true, - "relations": [ - "profile" - ] - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - } - ], - "args": [ - { - "name": "args", - "type": { - "defined": { - "name": "AddAuthorityArgs" - } - } - } - ] - }, { "name": "community_create", "discriminator": [ @@ -726,16 +640,16 @@ ] }, { - "name": "create_profile", + "name": "profile_authority_add", "discriminator": [ - 225, - 205, - 234, - 143, - 17, - 186, - 50, - 220 + 60, + 2, + 107, + 19, + 25, + 126, + 252, + 248 ], "accounts": [ { @@ -776,16 +690,13 @@ ] }, { - "kind": "arg", - "path": "args.username" + "kind": "account", + "path": "profile.username", + "account": "Profile" } ] } }, - { - "name": "pointer", - "writable": true - }, { "name": "authority", "signer": true @@ -793,7 +704,10 @@ { "name": "fee_payer", "writable": true, - "signer": true + "signer": true, + "relations": [ + "profile" + ] }, { "name": "system_program", @@ -805,23 +719,23 @@ "name": "args", "type": { "defined": { - "name": "CreateProfileArgs" + "name": "ProfileAuthorityAddArgs" } } } ] }, { - "name": "remove_authority", + "name": "profile_authority_remove", "discriminator": [ - 242, - 104, - 208, - 132, - 190, - 250, - 74, - 216 + 107, + 162, + 170, + 103, + 144, + 101, + 63, + 237 ], "accounts": [ { @@ -887,23 +801,23 @@ "name": "args", "type": { "defined": { - "name": "RemoveAuthorityArgs" + "name": "ProfileAuthorityRemoveArgs" } } } ] }, { - "name": "remove_identity", + "name": "profile_create", "discriminator": [ - 146, - 93, - 160, - 7, - 61, - 138, - 181, - 113 + 119, + 211, + 42, + 30, + 71, + 78, + 152, + 201 ], "accounts": [ { @@ -944,15 +858,11 @@ ] }, { - "kind": "account", - "path": "profile.username", - "account": "Profile" + "kind": "arg", + "path": "args.username" } ] - }, - "relations": [ - "pointer" - ] + } }, { "name": "pointer", @@ -965,10 +875,7 @@ { "name": "fee_payer", "writable": true, - "signer": true, - "relations": [ - "profile" - ] + "signer": true }, { "name": "system_program", @@ -980,23 +887,23 @@ "name": "args", "type": { "defined": { - "name": "RemoveIdentityArgs" + "name": "ProfileCreateArgs" } } } ] }, { - "name": "update_profile_details", + "name": "profile_update_details", "discriminator": [ - 218, - 18, - 64, - 5, - 242, - 160, - 11, - 38 + 157, + 158, + 155, + 130, + 206, + 93, + 40, + 61 ], "accounts": [ { @@ -1064,6 +971,99 @@ } ] }, + { + "name": "remove_identity", + "discriminator": [ + 146, + 93, + 160, + 7, + 61, + 138, + 181, + 113 + ], + "accounts": [ + { + "name": "profile", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 117, + 98, + 107, + 101, + 121, + 95, + 112, + 114, + 111, + 116, + 111, + 99, + 111, + 108 + ] + }, + { + "kind": "const", + "value": [ + 112, + 114, + 111, + 102, + 105, + 108, + 101 + ] + }, + { + "kind": "account", + "path": "profile.username", + "account": "Profile" + } + ] + }, + "relations": [ + "pointer" + ] + }, + { + "name": "pointer", + "writable": true + }, + { + "name": "authority", + "signer": true + }, + { + "name": "fee_payer", + "writable": true, + "signer": true, + "relations": [ + "profile" + ] + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "RemoveIdentityArgs" + } + } + } + ] + }, { "name": "verify_profile_identity", "discriminator": [ @@ -1343,18 +1343,6 @@ } ], "types": [ - { - "name": "AddAuthorityArgs", - "type": { - "kind": "struct", - "fields": [ - { - "name": "new_authority", - "type": "pubkey" - } - ] - } - }, { "name": "AddIdentityArgs", "type": { @@ -1529,26 +1517,6 @@ ] } }, - { - "name": "CreateProfileArgs", - "type": { - "kind": "struct", - "fields": [ - { - "name": "username", - "type": "string" - }, - { - "name": "name", - "type": "string" - }, - { - "name": "avatar_url", - "type": "string" - } - ] - } - }, { "name": "Identity", "type": { @@ -1681,7 +1649,19 @@ } }, { - "name": "RemoveAuthorityArgs", + "name": "ProfileAuthorityAddArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "new_authority", + "type": "pubkey" + } + ] + } + }, + { + "name": "ProfileAuthorityRemoveArgs", "type": { "kind": "struct", "fields": [ @@ -1692,6 +1672,26 @@ ] } }, + { + "name": "ProfileCreateArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "username", + "type": "string" + }, + { + "name": "name", + "type": "string" + }, + { + "name": "avatar_url", + "type": "string" + } + ] + } + }, { "name": "RemoveIdentityArgs", "type": { diff --git a/anchor/target/types/pubkey_protocol.ts b/anchor/target/types/pubkey_protocol.ts index 230502f..788f302 100644 --- a/anchor/target/types/pubkey_protocol.ts +++ b/anchor/target/types/pubkey_protocol.ts @@ -103,92 +103,6 @@ export type PubkeyProtocol = { } ] }, - { - "name": "addProfileAuthority", - "discriminator": [ - 193, - 106, - 183, - 12, - 216, - 250, - 151, - 31 - ], - "accounts": [ - { - "name": "profile", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 117, - 98, - 107, - 101, - 121, - 95, - 112, - 114, - 111, - 116, - 111, - 99, - 111, - 108 - ] - }, - { - "kind": "const", - "value": [ - 112, - 114, - 111, - 102, - 105, - 108, - 101 - ] - }, - { - "kind": "account", - "path": "profile.username", - "account": "profile" - } - ] - } - }, - { - "name": "authority", - "signer": true - }, - { - "name": "feePayer", - "writable": true, - "signer": true, - "relations": [ - "profile" - ] - }, - { - "name": "systemProgram", - "address": "11111111111111111111111111111111" - } - ], - "args": [ - { - "name": "args", - "type": { - "defined": { - "name": "addAuthorityArgs" - } - } - } - ] - }, { "name": "communityCreate", "discriminator": [ @@ -732,16 +646,16 @@ export type PubkeyProtocol = { ] }, { - "name": "createProfile", + "name": "profileAuthorityAdd", "discriminator": [ - 225, - 205, - 234, - 143, - 17, - 186, - 50, - 220 + 60, + 2, + 107, + 19, + 25, + 126, + 252, + 248 ], "accounts": [ { @@ -782,16 +696,13 @@ export type PubkeyProtocol = { ] }, { - "kind": "arg", - "path": "args.username" + "kind": "account", + "path": "profile.username", + "account": "profile" } ] } }, - { - "name": "pointer", - "writable": true - }, { "name": "authority", "signer": true @@ -799,7 +710,10 @@ export type PubkeyProtocol = { { "name": "feePayer", "writable": true, - "signer": true + "signer": true, + "relations": [ + "profile" + ] }, { "name": "systemProgram", @@ -811,23 +725,23 @@ export type PubkeyProtocol = { "name": "args", "type": { "defined": { - "name": "createProfileArgs" + "name": "profileAuthorityAddArgs" } } } ] }, { - "name": "removeAuthority", + "name": "profileAuthorityRemove", "discriminator": [ - 242, - 104, - 208, - 132, - 190, - 250, - 74, - 216 + 107, + 162, + 170, + 103, + 144, + 101, + 63, + 237 ], "accounts": [ { @@ -893,23 +807,23 @@ export type PubkeyProtocol = { "name": "args", "type": { "defined": { - "name": "removeAuthorityArgs" + "name": "profileAuthorityRemoveArgs" } } } ] }, { - "name": "removeIdentity", + "name": "profileCreate", "discriminator": [ - 146, - 93, - 160, - 7, - 61, - 138, - 181, - 113 + 119, + 211, + 42, + 30, + 71, + 78, + 152, + 201 ], "accounts": [ { @@ -950,15 +864,11 @@ export type PubkeyProtocol = { ] }, { - "kind": "account", - "path": "profile.username", - "account": "profile" + "kind": "arg", + "path": "args.username" } ] - }, - "relations": [ - "pointer" - ] + } }, { "name": "pointer", @@ -971,10 +881,7 @@ export type PubkeyProtocol = { { "name": "feePayer", "writable": true, - "signer": true, - "relations": [ - "profile" - ] + "signer": true }, { "name": "systemProgram", @@ -986,23 +893,23 @@ export type PubkeyProtocol = { "name": "args", "type": { "defined": { - "name": "removeIdentityArgs" + "name": "profileCreateArgs" } } } ] }, { - "name": "updateProfileDetails", + "name": "profileUpdateDetails", "discriminator": [ - 218, - 18, - 64, - 5, - 242, - 160, - 11, - 38 + 157, + 158, + 155, + 130, + 206, + 93, + 40, + 61 ], "accounts": [ { @@ -1070,6 +977,99 @@ export type PubkeyProtocol = { } ] }, + { + "name": "removeIdentity", + "discriminator": [ + 146, + 93, + 160, + 7, + 61, + 138, + 181, + 113 + ], + "accounts": [ + { + "name": "profile", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 117, + 98, + 107, + 101, + 121, + 95, + 112, + 114, + 111, + 116, + 111, + 99, + 111, + 108 + ] + }, + { + "kind": "const", + "value": [ + 112, + 114, + 111, + 102, + 105, + 108, + 101 + ] + }, + { + "kind": "account", + "path": "profile.username", + "account": "profile" + } + ] + }, + "relations": [ + "pointer" + ] + }, + { + "name": "pointer", + "writable": true + }, + { + "name": "authority", + "signer": true + }, + { + "name": "feePayer", + "writable": true, + "signer": true, + "relations": [ + "profile" + ] + }, + { + "name": "systemProgram", + "address": "11111111111111111111111111111111" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "removeIdentityArgs" + } + } + } + ] + }, { "name": "verifyProfileIdentity", "discriminator": [ @@ -1349,18 +1349,6 @@ export type PubkeyProtocol = { } ], "types": [ - { - "name": "addAuthorityArgs", - "type": { - "kind": "struct", - "fields": [ - { - "name": "newAuthority", - "type": "pubkey" - } - ] - } - }, { "name": "addIdentityArgs", "type": { @@ -1535,26 +1523,6 @@ export type PubkeyProtocol = { ] } }, - { - "name": "createProfileArgs", - "type": { - "kind": "struct", - "fields": [ - { - "name": "username", - "type": "string" - }, - { - "name": "name", - "type": "string" - }, - { - "name": "avatarUrl", - "type": "string" - } - ] - } - }, { "name": "identity", "type": { @@ -1687,7 +1655,19 @@ export type PubkeyProtocol = { } }, { - "name": "removeAuthorityArgs", + "name": "profileAuthorityAddArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "newAuthority", + "type": "pubkey" + } + ] + } + }, + { + "name": "profileAuthorityRemoveArgs", "type": { "kind": "struct", "fields": [ @@ -1698,6 +1678,26 @@ export type PubkeyProtocol = { ] } }, + { + "name": "profileCreateArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "username", + "type": "string" + }, + { + "name": "name", + "type": "string" + }, + { + "name": "avatarUrl", + "type": "string" + } + ] + } + }, { "name": "removeIdentityArgs", "type": { diff --git a/anchor/tests/pubkey-protocol-profile.spec.ts b/anchor/tests/pubkey-protocol-profile.spec.ts index 0b1bc7c..ba557b3 100644 --- a/anchor/tests/pubkey-protocol-profile.spec.ts +++ b/anchor/tests/pubkey-protocol-profile.spec.ts @@ -77,7 +77,7 @@ describe('pubkey-protocol-profile', () => { newAvatarUrl: getProfileAvatarUrl(`${username}_new`), } await program.methods - .updateProfileDetails(input) + .profileUpdateDetails(input) .accounts({ profile, feePayer: feePayer.publicKey, @@ -95,7 +95,7 @@ describe('pubkey-protocol-profile', () => { const [profile] = getPubKeyProfilePda({ username, programId: program.programId }) await program.methods - .addProfileAuthority({ newAuthority: communityMember2.publicKey }) + .profileAuthorityAdd({ newAuthority: communityMember2.publicKey }) .accountsStrict({ profile, authority: communityMember1.publicKey, @@ -117,7 +117,7 @@ describe('pubkey-protocol-profile', () => { const [profile] = getPubKeyProfilePda({ username, programId: program.programId }) await program.methods - .removeAuthority({ authorityToRemove: communityMember2.publicKey }) + .profileAuthorityRemove({ authorityToRemove: communityMember2.publicKey }) .accountsStrict({ profile, authority: communityMember1.publicKey, feePayer: feePayer.publicKey }) .signers([communityMember1]) .rpc() diff --git a/anchor/tests/utils/index.ts b/anchor/tests/utils/index.ts index ba3fe7e..fd5cadd 100644 --- a/anchor/tests/utils/index.ts +++ b/anchor/tests/utils/index.ts @@ -55,7 +55,7 @@ export async function createTestProfile( }) await program.methods - .createProfile({ + .profileCreate({ avatarUrl: getProfileAvatarUrl(username), name: 'Test Verified User', username, diff --git a/sdk/src/lib/pubkey-protocol-sdk.spec.ts b/sdk/src/lib/pubkey-protocol-sdk.spec.ts index 447a191..cd06e3a 100644 --- a/sdk/src/lib/pubkey-protocol-sdk.spec.ts +++ b/sdk/src/lib/pubkey-protocol-sdk.spec.ts @@ -56,7 +56,7 @@ xdescribe('sdk', () => { feePayer, username, }) - const created = await sdk.createProfile({ + const created = await sdk.profileCreate({ authority, avatarUrl, feePayer: feePayer.publicKey, @@ -64,7 +64,7 @@ xdescribe('sdk', () => { username, }) console.log('Created', created) - const profile = await sdk.getProfileByUsername({ username }) + const profile = await sdk.profileGetByUsername({ username }) console.log('Profile', profile) // ASSERT }) diff --git a/sdk/src/lib/pubkey-protocol-sdk.ts b/sdk/src/lib/pubkey-protocol-sdk.ts index df586e0..309c1b0 100644 --- a/sdk/src/lib/pubkey-protocol-sdk.ts +++ b/sdk/src/lib/pubkey-protocol-sdk.ts @@ -62,16 +62,16 @@ export interface RemoveIdentityOptions { } export interface RemoveAuthorityOptions { - authorityToRemove: PublicKey - authority: PublicKey - feePayer: PublicKey + authorityToRemove: PublicKeyString + authority: PublicKeyString + feePayer: PublicKeyString username: string } export interface AddAuthorityOptions { - newAuthority: PublicKey - authority: PublicKey - feePayer: PublicKey + newAuthority: PublicKeyString + authority: PublicKeyString + feePayer: PublicKeyString username: string } @@ -95,7 +95,7 @@ export interface CommunityCreateOptions { x?: string } -export interface CreateProfileOptions { +export interface ProfileCreateOptions { avatarUrl?: string authority: PublicKey feePayer: PublicKey @@ -117,10 +117,10 @@ export interface UpdateCommunityOptions { x?: string } -export interface UpdateProfileOptions { +export interface ProfileUpdateOptions { avatarUrl: string - authority: PublicKey - feePayer: PublicKey + authority: PublicKeyString + feePayer: PublicKeyString name: string username: string } @@ -138,69 +138,6 @@ export class PubkeyProtocolSdk { this.program = getPubkeyProtocolProgram(this.provider) } - async addProfileAuthority({ newAuthority, authority, feePayer, username }: AddAuthorityOptions) { - const [profile] = this.pdaProfile({ username }) - - const ix = await this.program.methods - .addProfileAuthority({ newAuthority }) - .accountsStrict({ - authority, - feePayer, - profile, - systemProgram: SystemProgram.programId, - }) - .instruction() - - return this.createTransaction({ ix, feePayer }) - } - - async addIdentity({ authority, feePayer, username, providerId, provider, name }: AddIdentityOptions) { - const [profile] = this.pdaProfile({ username }) - const [pointer] = this.pdaPointer({ providerId, provider }) - - const ix = await this.program.methods - .addIdentity({ - name, - provider: convertToAnchorIdentityProvider(provider), - providerId, - }) - .accountsStrict({ - authority, - feePayer, - profile, - pointer, - systemProgram: SystemProgram.programId, - }) - .instruction() - - return this.createTransaction({ ix, feePayer }) - } - - async createProfile(options: CreateProfileOptions) { - const username = options.username?.length ? options.username : slugify(options.name) - const [profile] = this.pdaProfile({ username }) - const [pointer] = this.pdaPointer({ - provider: IdentityProvider.Solana, - providerId: options.authority.toString(), - }) - const ix = await this.program.methods - .createProfile({ - avatarUrl: options.avatarUrl || getProfileAvatarUrl(username), - name: options.name, - username, - }) - .accountsStrict({ - authority: options.authority, - feePayer: options.feePayer, - pointer, - profile, - systemProgram: SystemProgram.programId, - }) - .instruction() - - return this.createTransaction({ ix, feePayer: options.feePayer }) - } - async communityCreate(options: CommunityCreateOptions): Promise<{ input: CommunityCreateInput tx: VersionedTransaction @@ -378,25 +315,13 @@ export class PubkeyProtocolSdk { return this.createTransaction({ ix, feePayer: new PublicKey(options.feePayer) }) } - async getProfiles(): Promise { - return this.program.account.profile.all().then((accounts) => - accounts.map(({ account, publicKey }) => ({ - publicKey, - authorities: account.authorities, - avatarUrl: account.avatarUrl, - bump: account.bump, - identities: account.identities.map((identity) => ({ - ...identity, - provider: convertAnchorIdentityProvider(identity.provider), - })), - feePayer: account.feePayer, - name: account.name, - username: account.username, - })), - ) + async getProgramAccount(): Promise> { + return this.connection + .getParsedAccountInfo(this.programId) + .then((res) => res.value as AccountInfo) } - async getPointers(): Promise { + async pointerGetAll(): Promise { return this.program.account.pointer.all().then((accounts) => accounts.map(({ account, publicKey }) => ({ publicKey, @@ -408,36 +333,34 @@ export class PubkeyProtocolSdk { ) } - async getProfileByProvider({ provider, providerId }: GetProfileByProvider): Promise { - const [pointerPda] = this.pdaPointer({ provider, providerId }) - - const { profile } = await this.getPointer({ pointerPda }) - - return this.getProfile({ profilePda: profile }) + async pointerGet(options: { pointer: PublicKey }) { + return this.program.account.pointer.fetch(options.pointer) } - async getProfileByProviderNullable({ provider, providerId }: GetProfileByProvider): Promise { - const [pointerPda] = this.pdaPointer({ provider, providerId }) - - const { profile } = await this.getPointer({ pointerPda }) - - return this.getProfileNullable({ profilePda: profile }) - } - - async getProfileByUsername({ username }: GetProfileByUsername): Promise { - const [profilePda] = this.pdaProfile({ username }) - - return this.getProfile({ profilePda }) + async pointerGetNullable(options: { pointer: PublicKey }) { + return this.program.account.pointer.fetchNullable(options.pointer) } - async getProfileByUsernameNullable({ username }: GetProfileByUsername): Promise { - const [profilePda] = this.pdaProfile({ username }) - - return this.getProfileNullable({ profilePda }) + async profilesGetAll(): Promise { + return this.program.account.profile.all().then((accounts) => + accounts.map(({ account, publicKey }) => ({ + publicKey, + authorities: account.authorities, + avatarUrl: account.avatarUrl, + bump: account.bump, + identities: account.identities.map((identity) => ({ + ...identity, + provider: convertAnchorIdentityProvider(identity.provider), + })), + feePayer: account.feePayer, + name: account.name, + username: account.username, + })), + ) } - async getProfile({ profilePda }: { profilePda: PublicKey }): Promise { - return this.program.account.profile.fetch(profilePda).then((res) => { + async profileGet(options: { profile: PublicKey }): Promise { + return this.program.account.profile.fetch(options.profile).then((res) => { const identities = res.identities.map((identity) => ({ ...identity, provider: convertAnchorIdentityProvider(identity.provider), @@ -445,14 +368,14 @@ export class PubkeyProtocolSdk { return { ...res, - publicKey: profilePda, + publicKey: options.profile, identities, } }) } - async getProfileNullable({ profilePda }: { profilePda: PublicKey }): Promise { - return this.program.account.profile.fetchNullable(profilePda).then((res) => { + async profileGetNullable(options: { profile: PublicKey }): Promise { + return this.program.account.profile.fetchNullable(options.profile).then((res) => { if (!res) { return null } @@ -463,47 +386,128 @@ export class PubkeyProtocolSdk { return { ...res, - publicKey: profilePda, + publicKey: options.profile, identities, } }) } - async getPointer({ pointerPda }: { pointerPda: PublicKey }) { - return this.program.account.pointer.fetch(pointerPda) + async profileGetByProvider(options: GetProfileByProvider): Promise { + const [pointer] = this.pdaPointer(options) + + const { profile } = await this.pointerGet({ pointer }) + + return this.profileGet({ profile }) } - async getPointerNullable({ pointerPda }: { pointerPda: PublicKey }) { - return this.program.account.pointer.fetchNullable(pointerPda) + async profileGetByProviderNullable(options: GetProfileByProvider): Promise { + const [pointer] = this.pdaPointer(options) + + const { profile } = await this.pointerGet({ pointer }) + + return this.profileGetNullable({ profile }) } - async getProgramAccount(): Promise> { - return this.connection - .getParsedAccountInfo(this.programId) - .then((res) => res.value as AccountInfo) + async profileGetByUsername(options: GetProfileByUsername): Promise { + const [profile] = this.pdaProfile({ username: options.username }) + + return this.profileGet({ profile }) } - async removeAuthority({ authorityToRemove, authority, feePayer, username }: RemoveAuthorityOptions) { - const [profile] = this.pdaProfile({ username }) + async profileGetByUsernameNullable(options: GetProfileByUsername): Promise { + const [profile] = this.pdaProfile({ username: options.username }) + + return this.profileGetNullable({ profile }) + } + + async profileAuthorityAdd(options: AddAuthorityOptions) { + const [profile] = this.pdaProfile({ username: options.username }) + const authority = new PublicKey(options.authority) + const feePayer = new PublicKey(options.feePayer) + const newAuthority = new PublicKey(options.newAuthority) const ix = await this.program.methods - .removeAuthority({ authorityToRemove }) + .profileAuthorityAdd({ newAuthority }) + .accountsStrict({ + authority, + feePayer, + profile, + systemProgram: SystemProgram.programId, + }) + .instruction() + + return this.createTransaction({ ix, feePayer }) + } + + async profileAuthorityRemove(options: RemoveAuthorityOptions) { + const [profile] = this.pdaProfile({ username: options.username }) + const authorityToRemove = new PublicKey(options.authorityToRemove) + const authority = new PublicKey(options.authority) + const feePayer = new PublicKey(options.feePayer) + + const ix = await this.program.methods + .profileAuthorityRemove({ authorityToRemove }) .accountsStrict({ authority, feePayer, profile }) .instruction() return this.createTransaction({ ix, feePayer }) } - async removeIdentity({ authority, feePayer, username, providerId, provider }: RemoveIdentityOptions) { + async profileCreate(options: ProfileCreateOptions) { + const username = options.username?.length ? options.username : slugify(options.name) const [profile] = this.pdaProfile({ username }) - const [pointer] = this.pdaPointer({ providerId, provider }) + const [pointer] = this.pdaPointer({ + provider: IdentityProvider.Solana, + providerId: options.authority.toString(), + }) const ix = await this.program.methods - .removeIdentity({ providerId }) + .profileCreate({ + avatarUrl: options.avatarUrl || getProfileAvatarUrl(username), + name: options.name, + username, + }) + .accountsStrict({ + authority: options.authority, + feePayer: options.feePayer, + pointer, + profile, + systemProgram: SystemProgram.programId, + }) + .instruction() + + return this.createTransaction({ ix, feePayer: options.feePayer }) + } + + async profileUpdate(options: ProfileUpdateOptions) { + const [profile] = this.pdaProfile({ username: options.username }) + const authority = new PublicKey(options.authority) + const feePayer = new PublicKey(options.feePayer) + + const ix = await this.program.methods + .profileUpdateDetails({ newAvatarUrl: options.avatarUrl, newName: options.name, authority }) + .accounts({ feePayer, profile }) + .instruction() + + return this.createTransaction({ ix, feePayer }) + } + + async profileIdentityAdd(options: AddIdentityOptions) { + const [profile] = this.pdaProfile({ username: options.username }) + const [pointer] = this.pdaPointer({ providerId: options.providerId, provider: options.provider }) + const authority = new PublicKey(options.authority) + const feePayer = new PublicKey(options.feePayer) + + const ix = await this.program.methods + .addIdentity({ + name: options.name, + provider: convertToAnchorIdentityProvider(options.provider), + providerId: options.providerId, + }) .accountsStrict({ authority, feePayer, - pointer, profile, + pointer, systemProgram: SystemProgram.programId, }) .instruction() @@ -511,12 +515,21 @@ export class PubkeyProtocolSdk { return this.createTransaction({ ix, feePayer }) } - async updateProfile({ avatarUrl, authority, feePayer, name: newName, username }: UpdateProfileOptions) { - const [profile] = this.pdaProfile({ username }) + async profileIdentityRemove(options: RemoveIdentityOptions) { + const [profile] = this.pdaProfile({ username: options.username }) + const [pointer] = this.pdaPointer({ providerId: options.providerId, provider: options.provider }) + const authority = new PublicKey(options.authority) + const feePayer = new PublicKey(options.feePayer) const ix = await this.program.methods - .updateProfileDetails({ newAvatarUrl: avatarUrl, newName, authority }) - .accounts({ feePayer, profile }) + .removeIdentity({ providerId: options.providerId }) + .accountsStrict({ + authority, + feePayer, + pointer, + profile, + systemProgram: SystemProgram.programId, + }) .instruction() return this.createTransaction({ ix, feePayer }) diff --git a/web/src/app/features/pubkey-community/feature/pubkey-community-feature-detail.tsx b/web/src/app/features/pubkey-community/feature/pubkey-community-feature-detail.tsx index 616d7e1..c8abb27 100644 --- a/web/src/app/features/pubkey-community/feature/pubkey-community-feature-detail.tsx +++ b/web/src/app/features/pubkey-community/feature/pubkey-community-feature-detail.tsx @@ -1,4 +1,6 @@ -import { UiCard, UiDebug, UiInfoTable, UiLoader, UiStack, UiTabRoutes, UiWarning } from '@pubkey-ui/core' +import { PubKeyCommunity } from '@pubkey-protocol/anchor' +import { ellipsify } from '@pubkey-protocol/sdk' +import { UiAnchor, UiCard, UiDebugModal, UiInfoTable, UiLoader, UiStack, UiTabRoutes, UiWarning } from '@pubkey-ui/core' import { useParams } from 'react-router-dom' import { ExplorerLink } from '../../cluster/cluster-ui' import { useQueryCommunityGetBySlug } from '../data-access' @@ -25,23 +27,7 @@ export function PubkeyCommunityFeatureDetail() { element: ( - , - ], - ['Debug', ], - ]} - /> + ), @@ -68,3 +54,39 @@ export function PubkeyCommunityFeatureDetail() { ) } + +export function CommunityInfo({ community }: { community: PubKeyCommunity }) { + return ( + ], + ['Farcaster', ], + ['Github', ], + ['Telegram', ], + ['Website', ], + ['X', ], + [ + 'Account', + , + ], + ['Debug', ], + ]} + /> + ) +} + +function MaybeLink({ link }: { link?: string }) { + return link ? ( + + {link.replace('https://', '')} + + ) : ( + 'None' + ) +} diff --git a/web/src/app/features/pubkey-profile/data-access/index.ts b/web/src/app/features/pubkey-profile/data-access/index.ts index 4b7a8ab..a3b24eb 100644 --- a/web/src/app/features/pubkey-profile/data-access/index.ts +++ b/web/src/app/features/pubkey-profile/data-access/index.ts @@ -1,7 +1,7 @@ -export * from './use-mutation-add-authority' +export * from './use-mutation-profile-authority-add' export * from './use-mutation-add-identity' export * from './use-mutation-create-profile' -export * from './use-mutation-remove-authority' +export * from './use-mutation-profile-authority-remove' export * from './use-mutation-remove-identity' export * from './use-mutation-update-avatar-url' export * from './use-query-get-pointers' diff --git a/web/src/app/features/pubkey-profile/data-access/use-mutation-add-identity.tsx b/web/src/app/features/pubkey-profile/data-access/use-mutation-add-identity.tsx index a6e2eeb..f036cb5 100644 --- a/web/src/app/features/pubkey-profile/data-access/use-mutation-add-identity.tsx +++ b/web/src/app/features/pubkey-profile/data-access/use-mutation-add-identity.tsx @@ -9,7 +9,7 @@ export function useMutationAddIdentity() { return useMutation({ mutationFn: (options: PubKeyAddIdentity) => - sdk.addIdentity({ ...options, authority, feePayer }).then(signAndConfirmTransaction), + sdk.profileIdentityAdd({ ...options, authority, feePayer }).then(signAndConfirmTransaction), onError, onSuccess, }) diff --git a/web/src/app/features/pubkey-profile/data-access/use-mutation-create-profile.tsx b/web/src/app/features/pubkey-profile/data-access/use-mutation-create-profile.tsx index e020d6e..4d78292 100644 --- a/web/src/app/features/pubkey-profile/data-access/use-mutation-create-profile.tsx +++ b/web/src/app/features/pubkey-profile/data-access/use-mutation-create-profile.tsx @@ -1,16 +1,16 @@ -import { CreateProfileOptions } from '@pubkey-protocol/sdk' +import { ProfileCreateOptions } from '@pubkey-protocol/sdk' import { useMutation } from '@tanstack/react-query' import { usePubKeyProtocol } from '../../pubkey-protocol' -export type PubKeyProfileCreateInput = Omit +export type PubKeyProfileCreateInput = Omit -export function useMutationCreateProfile() { +export function useMutationProfileCreate() { const { authority, feePayer, sdk, signAndConfirmTransaction, onError, onSuccess } = usePubKeyProtocol() return useMutation({ mutationFn: (options: PubKeyProfileCreateInput) => sdk - .createProfile({ + .profileCreate({ ...options, authority, feePayer, diff --git a/web/src/app/features/pubkey-profile/data-access/use-mutation-add-authority.tsx b/web/src/app/features/pubkey-profile/data-access/use-mutation-profile-authority-add.tsx similarity index 65% rename from web/src/app/features/pubkey-profile/data-access/use-mutation-add-authority.tsx rename to web/src/app/features/pubkey-profile/data-access/use-mutation-profile-authority-add.tsx index ca10971..c13128b 100644 --- a/web/src/app/features/pubkey-profile/data-access/use-mutation-add-authority.tsx +++ b/web/src/app/features/pubkey-profile/data-access/use-mutation-profile-authority-add.tsx @@ -2,11 +2,11 @@ import { AddAuthorityOptions } from '@pubkey-protocol/sdk' import { useMutation } from '@tanstack/react-query' import { usePubKeyProtocol } from '../../pubkey-protocol' -export function useMutationAddAuthority() { +export function useMutationProfileAuthorityAdd() { const { sdk, signAndConfirmTransaction, onError, onSuccess } = usePubKeyProtocol() return useMutation({ - mutationFn: (options: AddAuthorityOptions) => sdk.addProfileAuthority(options).then(signAndConfirmTransaction), + mutationFn: (options: AddAuthorityOptions) => sdk.profileAuthorityAdd(options).then(signAndConfirmTransaction), onError, onSuccess, }) diff --git a/web/src/app/features/pubkey-profile/data-access/use-mutation-remove-authority.tsx b/web/src/app/features/pubkey-profile/data-access/use-mutation-profile-authority-remove.tsx similarity index 63% rename from web/src/app/features/pubkey-profile/data-access/use-mutation-remove-authority.tsx rename to web/src/app/features/pubkey-profile/data-access/use-mutation-profile-authority-remove.tsx index e6eb2da..3d3fb1d 100644 --- a/web/src/app/features/pubkey-profile/data-access/use-mutation-remove-authority.tsx +++ b/web/src/app/features/pubkey-profile/data-access/use-mutation-profile-authority-remove.tsx @@ -2,11 +2,12 @@ import { RemoveAuthorityOptions } from '@pubkey-protocol/sdk' import { useMutation } from '@tanstack/react-query' import { usePubKeyProtocol } from '../../pubkey-protocol' -export function useMutationRemoveAuthority() { +export function useMutationProfileAuthorityRemove() { const { sdk, signAndConfirmTransaction, onError, onSuccess } = usePubKeyProtocol() return useMutation({ - mutationFn: (options: RemoveAuthorityOptions) => sdk.removeAuthority(options).then(signAndConfirmTransaction), + mutationFn: (options: RemoveAuthorityOptions) => + sdk.profileAuthorityRemove(options).then(signAndConfirmTransaction), onError, onSuccess, }) diff --git a/web/src/app/features/pubkey-profile/data-access/use-mutation-remove-identity.tsx b/web/src/app/features/pubkey-profile/data-access/use-mutation-remove-identity.tsx index 2a8e179..a91cade 100644 --- a/web/src/app/features/pubkey-profile/data-access/use-mutation-remove-identity.tsx +++ b/web/src/app/features/pubkey-profile/data-access/use-mutation-remove-identity.tsx @@ -6,7 +6,7 @@ export function useMutationRemoveIdentity() { const { sdk, signAndConfirmTransaction, onError, onSuccess } = usePubKeyProtocol() return useMutation({ - mutationFn: (options: RemoveIdentityOptions) => sdk.removeIdentity(options).then(signAndConfirmTransaction), + mutationFn: (options: RemoveIdentityOptions) => sdk.profileIdentityRemove(options).then(signAndConfirmTransaction), onError, onSuccess, }) diff --git a/web/src/app/features/pubkey-profile/data-access/use-mutation-update-avatar-url.tsx b/web/src/app/features/pubkey-profile/data-access/use-mutation-update-avatar-url.tsx index b96e4c1..22b64b4 100644 --- a/web/src/app/features/pubkey-profile/data-access/use-mutation-update-avatar-url.tsx +++ b/web/src/app/features/pubkey-profile/data-access/use-mutation-update-avatar-url.tsx @@ -1,4 +1,4 @@ -import { UpdateProfileOptions } from '@pubkey-protocol/sdk' +import { ProfileUpdateOptions } from '@pubkey-protocol/sdk' import { useMutation } from '@tanstack/react-query' import { usePubKeyProtocol } from '../../pubkey-protocol' @@ -6,7 +6,7 @@ export function useMutationUpdateAvatarUrl() { const { sdk, signAndConfirmTransaction, onError, onSuccess } = usePubKeyProtocol() return useMutation({ - mutationFn: (options: UpdateProfileOptions) => sdk.updateProfile(options).then(signAndConfirmTransaction), + mutationFn: (options: ProfileUpdateOptions) => sdk.profileUpdate(options).then(signAndConfirmTransaction), onError, onSuccess, }) diff --git a/web/src/app/features/pubkey-profile/data-access/use-query-get-pointers.tsx b/web/src/app/features/pubkey-profile/data-access/use-query-get-pointers.tsx index dacbf41..9dddf77 100644 --- a/web/src/app/features/pubkey-profile/data-access/use-query-get-pointers.tsx +++ b/web/src/app/features/pubkey-profile/data-access/use-query-get-pointers.tsx @@ -6,6 +6,6 @@ export function useQueryGetPointers() { return useQuery({ queryKey: ['pubkey-protocol', 'getPointers', { cluster }], - queryFn: () => sdk.getPointers(), + queryFn: () => sdk.pointerGetAll(), }) } diff --git a/web/src/app/features/pubkey-profile/data-access/use-query-get-profile-by-provider-nullable.tsx b/web/src/app/features/pubkey-profile/data-access/use-query-get-profile-by-provider-nullable.tsx index 62579e4..e9f1c9e 100644 --- a/web/src/app/features/pubkey-profile/data-access/use-query-get-profile-by-provider-nullable.tsx +++ b/web/src/app/features/pubkey-profile/data-access/use-query-get-profile-by-provider-nullable.tsx @@ -13,7 +13,7 @@ export function useQueryGetProfileByProviderNullable({ return useQuery({ queryKey: ['pubkey-protocol', 'getProfileByProviderNullable', { cluster, provider, providerId }], - queryFn: () => sdk.getProfileByProviderNullable({ provider, providerId }), + queryFn: () => sdk.profileGetByProviderNullable({ provider, providerId }), retry: false, }) } diff --git a/web/src/app/features/pubkey-profile/data-access/use-query-get-profile-by-username.tsx b/web/src/app/features/pubkey-profile/data-access/use-query-get-profile-by-username.tsx index 64b1e6d..c5c665f 100644 --- a/web/src/app/features/pubkey-profile/data-access/use-query-get-profile-by-username.tsx +++ b/web/src/app/features/pubkey-profile/data-access/use-query-get-profile-by-username.tsx @@ -6,6 +6,6 @@ export function useQueryGetProfileByUsername({ username }: { username: string }) return useQuery({ queryKey: ['pubkey-protocol', 'getProfileByUsername', { cluster, username }], - queryFn: () => sdk.getProfileByUsername({ username }), + queryFn: () => sdk.profileGetByUsername({ username }), }) } diff --git a/web/src/app/features/pubkey-profile/data-access/use-query-get-profiles.tsx b/web/src/app/features/pubkey-profile/data-access/use-query-get-profiles.tsx index 6290b47..d3dd312 100644 --- a/web/src/app/features/pubkey-profile/data-access/use-query-get-profiles.tsx +++ b/web/src/app/features/pubkey-profile/data-access/use-query-get-profiles.tsx @@ -6,6 +6,6 @@ export function useQueryGetProfiles() { return useQuery({ queryKey: ['pubkey-protocol', 'getProfiles', { cluster }], - queryFn: () => sdk.getProfiles(), + queryFn: () => sdk.profilesGetAll(), }) } diff --git a/web/src/app/features/pubkey-profile/feature/pubkey-profile-feature-create.tsx b/web/src/app/features/pubkey-profile/feature/pubkey-profile-feature-create.tsx index a02154d..c8a5089 100644 --- a/web/src/app/features/pubkey-profile/feature/pubkey-profile-feature-create.tsx +++ b/web/src/app/features/pubkey-profile/feature/pubkey-profile-feature-create.tsx @@ -2,11 +2,11 @@ import { IdentityProvider } from '@pubkey-protocol/anchor' import { ellipsify } from '@pubkey-protocol/sdk' import { toastError, toastSuccess, UiCard, UiInfo, UiLoader } from '@pubkey-ui/core' import { usePubKeyProtocol } from '../../pubkey-protocol' -import { useMutationCreateProfile, useQueryGetProfileByProviderNullable } from '../data-access' +import { useMutationProfileCreate, useQueryGetProfileByProviderNullable } from '../data-access' import { PubkeyProtocolUiProfileCreateForm } from '../ui' export function PubkeyProfileFeatureCreate() { - const mutation = useMutationCreateProfile() + const mutation = useMutationProfileCreate() const { authority } = usePubKeyProtocol() const pointerQuery = useQueryGetProfileByProviderNullable({ provider: IdentityProvider.Solana, diff --git a/web/src/app/features/pubkey-profile/feature/pubkey-profile-feature-search.tsx b/web/src/app/features/pubkey-profile/feature/pubkey-profile-feature-search.tsx index a3c5bf6..fcca7c2 100644 --- a/web/src/app/features/pubkey-profile/feature/pubkey-profile-feature-search.tsx +++ b/web/src/app/features/pubkey-profile/feature/pubkey-profile-feature-search.tsx @@ -35,7 +35,7 @@ function SearchByProvider() { async function submit({ provider, providerId }: GetProfileByProvider) { setResult(null) sdk - .getProfileByProvider({ provider, providerId }) + .profileGetByProvider({ provider, providerId }) .then((profile) => { toastSuccess(`Found ${profile.username}`) setResult(profile) @@ -85,7 +85,7 @@ function SearchByUsername() { async function submit({ username }: GetProfileByUsername) { setResult(null) sdk - .getProfileByUsernameNullable({ username }) + .profileGetByUsernameNullable({ username }) .then((profile) => { if (profile) { toastSuccess(`Found ${profile.username}`) diff --git a/web/src/app/features/pubkey-profile/ui/index.ts b/web/src/app/features/pubkey-profile/ui/index.ts index a743773..0014d52 100644 --- a/web/src/app/features/pubkey-profile/ui/index.ts +++ b/web/src/app/features/pubkey-profile/ui/index.ts @@ -4,9 +4,9 @@ export * from './pubkey-protocol-ui-profile' export * from './pubkey-protocol-ui-profile-anchor' export * from './pubkey-protocol-ui-profile-avatar' export * from './pubkey-protocol-ui-profile-avatar-update-button' -export * from './pubkey-protocol-ui-profile-button-add-authority' +export * from './pubkey-protocol-ui-profile-profile-authority-add-button' export * from './pubkey-protocol-ui-profile-button-add-identity' -export * from './pubkey-protocol-ui-profile-button-remove-authority' +export * from './pubkey-protocol-ui-profile-authority-remove-button' export * from './pubkey-protocol-ui-profile-button-remove-identity' export * from './pubkey-protocol-ui-profile-card' export * from './pubkey-protocol-ui-profile-card-authorities' diff --git a/web/src/app/features/pubkey-profile/ui/pubkey-protocol-ui-profile-button-remove-authority.tsx b/web/src/app/features/pubkey-profile/ui/pubkey-protocol-ui-profile-authority-remove-button.tsx similarity index 79% rename from web/src/app/features/pubkey-profile/ui/pubkey-protocol-ui-profile-button-remove-authority.tsx rename to web/src/app/features/pubkey-profile/ui/pubkey-protocol-ui-profile-authority-remove-button.tsx index 2a062cb..d3409f7 100644 --- a/web/src/app/features/pubkey-profile/ui/pubkey-protocol-ui-profile-button-remove-authority.tsx +++ b/web/src/app/features/pubkey-profile/ui/pubkey-protocol-ui-profile-authority-remove-button.tsx @@ -2,9 +2,9 @@ import { ActionIcon } from '@mantine/core' import { PubKeyProfile } from '@pubkey-protocol/anchor' import { PublicKey } from '@solana/web3.js' import { IconTrash } from '@tabler/icons-react' -import { useMutationRemoveAuthority } from '../data-access' +import { useMutationProfileAuthorityRemove } from '../data-access' -export function PubkeyProtocolUiProfileButtonRemoveAuthority({ +export function PubkeyProtocolUiProfileAuthorityRemoveButton({ authorityToRemove, authority, feePayer, @@ -15,7 +15,7 @@ export function PubkeyProtocolUiProfileButtonRemoveAuthority({ feePayer: PublicKey profile: PubKeyProfile }) { - const mutation = useMutationRemoveAuthority() + const mutation = useMutationProfileAuthorityRemove() return ( + ) : null } > @@ -31,7 +35,7 @@ export function PubkeyProtocolUiProfileCardAuthorities({ {ellipsify(item.toString())} {canSign ? ( -