From 0928f562400ca73bfdc5833463035fdf017ddb0e Mon Sep 17 00:00:00 2001 From: Bram Borggreve Date: Tue, 15 Oct 2024 00:02:05 -0500 Subject: [PATCH] refactor: clean up community and profile ui --- .eslintrc.json | 4 + .github/workflows/ci.yml | 4 + anchor/target/idl/pubkey_protocol.json | 569 +---- anchor/target/types/pubkey_protocol.ts | 1985 +++++++---------- anchor/tests/utils/get-avatar-url.ts | 2 +- anchor/tests/utils/index.ts | 4 +- sdk/src/index.ts | 1 + sdk/src/lib/pubkey-protocol-sdk.spec.ts | 3 +- sdk/src/lib/pubkey-protocol-sdk.ts | 50 +- sdk/src/lib/utils.ts | 55 + web/src/app/app-routes.tsx | 4 +- .../features/cluster/cluster-data-access.tsx | 25 +- .../use-mutation-create-community.tsx | 10 +- .../pubkey-community-feature-create.tsx | 28 +- .../pubkey-community-feature-detail.tsx | 19 +- .../feature/pubkey-community-feature-list.tsx | 21 +- .../feature/pubkey-community.routes.tsx | 50 +- .../pubkey-protocol-ui-community-anchor.tsx | 14 +- .../pubkey-protocol-ui-community-avatar.tsx | 2 +- ...bkey-protocol-ui-community-create-form.tsx | 6 +- ...pubkey-protocol-ui-community-list-item.tsx | 2 +- .../ui/pubkey-protocol-ui-community.tsx | 8 +- .../feature/pubkey-profile-feature-create.tsx | 45 +- .../feature/pubkey-profile-feature-list.tsx | 21 +- .../feature/pubkey-profile.routes.tsx | 58 +- ...pubkey-protocol-ui-profile-create-form.tsx | 4 +- .../ui/pubkey-protocol-ui-profile.tsx | 4 +- .../pubkey-protocol/data-access/index.ts | 1 + .../data-access/pubkey-protocol-loader.tsx | 20 + .../data-access/pubkey-protocol-provider.tsx | 2 +- .../feature/pubkey-protocol.routes.tsx | 13 +- .../solana/solana-connection-loader.tsx | 14 +- 32 files changed, 1087 insertions(+), 1961 deletions(-) create mode 100644 sdk/src/lib/utils.ts create mode 100644 web/src/app/features/pubkey-protocol/data-access/pubkey-protocol-loader.tsx diff --git a/.eslintrc.json b/.eslintrc.json index 46b63e7..29074a4 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -3,6 +3,10 @@ "ignorePatterns": ["**/*"], "plugins": ["@nx"], "overrides": [ + { + "files": ["*.json"], + "parser": "jsonc-eslint-parser" + }, { "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], "rules": { diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f758979..4e84d36 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,10 @@ permissions: actions: read contents: read +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.ref }} + cancel-in-progress: true + jobs: main: runs-on: ubuntu-latest diff --git a/anchor/target/idl/pubkey_protocol.json b/anchor/target/idl/pubkey_protocol.json index 10c06d8..90c357b 100644 --- a/anchor/target/idl/pubkey_protocol.json +++ b/anchor/target/idl/pubkey_protocol.json @@ -9,16 +9,7 @@ "instructions": [ { "name": "add_community_provider", - "discriminator": [ - 73, - 163, - 30, - 215, - 158, - 165, - 114, - 55 - ], + "discriminator": [73, 163, 30, 215, 158, 165, 114, 55], "accounts": [ { "name": "community", @@ -51,16 +42,7 @@ }, { "name": "add_identity", - "discriminator": [ - 212, - 100, - 104, - 34, - 15, - 136, - 248, - 225 - ], + "discriminator": [212, 100, 104, 34, 15, 136, 248, 225], "accounts": [ { "name": "profile", @@ -69,35 +51,11 @@ "seeds": [ { "kind": "const", - "value": [ - 112, - 117, - 98, - 107, - 101, - 121, - 95, - 112, - 114, - 111, - 116, - 111, - 99, - 111, - 108 - ] + "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 - ] + "value": [112, 114, 111, 102, 105, 108, 101] }, { "kind": "account", @@ -119,9 +77,7 @@ "name": "fee_payer", "writable": true, "signer": true, - "relations": [ - "profile" - ] + "relations": ["profile"] }, { "name": "system_program", @@ -141,16 +97,7 @@ }, { "name": "add_profile_authority", - "discriminator": [ - 193, - 106, - 183, - 12, - 216, - 250, - 151, - 31 - ], + "discriminator": [193, 106, 183, 12, 216, 250, 151, 31], "accounts": [ { "name": "profile", @@ -159,35 +106,11 @@ "seeds": [ { "kind": "const", - "value": [ - 112, - 117, - 98, - 107, - 101, - 121, - 95, - 112, - 114, - 111, - 116, - 111, - 99, - 111, - 108 - ] + "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 - ] + "value": [112, 114, 111, 102, 105, 108, 101] }, { "kind": "account", @@ -205,9 +128,7 @@ "name": "fee_payer", "writable": true, "signer": true, - "relations": [ - "profile" - ] + "relations": ["profile"] }, { "name": "system_program", @@ -227,16 +148,7 @@ }, { "name": "cancel_update_community_authority", - "discriminator": [ - 35, - 173, - 125, - 89, - 189, - 117, - 252, - 233 - ], + "discriminator": [35, 173, 125, 89, 189, 117, 252, 233], "accounts": [ { "name": "community", @@ -245,37 +157,11 @@ "seeds": [ { "kind": "const", - "value": [ - 112, - 117, - 98, - 107, - 101, - 121, - 95, - 112, - 114, - 111, - 116, - 111, - 99, - 111, - 108 - ] + "value": [112, 117, 98, 107, 101, 121, 95, 112, 114, 111, 116, 111, 99, 111, 108] }, { "kind": "const", - "value": [ - 99, - 111, - 109, - 109, - 117, - 110, - 105, - 116, - 121 - ] + "value": [99, 111, 109, 109, 117, 110, 105, 116, 121] }, { "kind": "account", @@ -294,16 +180,7 @@ }, { "name": "create_community", - "discriminator": [ - 203, - 214, - 176, - 194, - 13, - 207, - 22, - 60 - ], + "discriminator": [203, 214, 176, 194, 13, 207, 22, 60], "accounts": [ { "name": "community", @@ -312,37 +189,11 @@ "seeds": [ { "kind": "const", - "value": [ - 112, - 117, - 98, - 107, - 101, - 121, - 95, - 112, - 114, - 111, - 116, - 111, - 99, - 111, - 108 - ] + "value": [112, 117, 98, 107, 101, 121, 95, 112, 114, 111, 116, 111, 99, 111, 108] }, { "kind": "const", - "value": [ - 99, - 111, - 109, - 109, - 117, - 110, - 105, - 116, - 121 - ] + "value": [99, 111, 109, 109, 117, 110, 105, 116, 121] }, { "kind": "arg", @@ -378,16 +229,7 @@ }, { "name": "create_profile", - "discriminator": [ - 225, - 205, - 234, - 143, - 17, - 186, - 50, - 220 - ], + "discriminator": [225, 205, 234, 143, 17, 186, 50, 220], "accounts": [ { "name": "profile", @@ -396,35 +238,11 @@ "seeds": [ { "kind": "const", - "value": [ - 112, - 117, - 98, - 107, - 101, - 121, - 95, - 112, - 114, - 111, - 116, - 111, - 99, - 111, - 108 - ] + "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 - ] + "value": [112, 114, 111, 102, 105, 108, 101] }, { "kind": "arg", @@ -464,16 +282,7 @@ }, { "name": "finalize_update_community_authority", - "discriminator": [ - 124, - 226, - 211, - 212, - 102, - 247, - 120, - 101 - ], + "discriminator": [124, 226, 211, 212, 102, 247, 120, 101], "accounts": [ { "name": "community", @@ -482,37 +291,11 @@ "seeds": [ { "kind": "const", - "value": [ - 112, - 117, - 98, - 107, - 101, - 121, - 95, - 112, - 114, - 111, - 116, - 111, - 99, - 111, - 108 - ] + "value": [112, 117, 98, 107, 101, 121, 95, 112, 114, 111, 116, 111, 99, 111, 108] }, { "kind": "const", - "value": [ - 99, - 111, - 109, - 109, - 117, - 110, - 105, - 116, - 121 - ] + "value": [99, 111, 109, 109, 117, 110, 105, 116, 121] }, { "kind": "account", @@ -531,16 +314,7 @@ }, { "name": "initiate_update_community_authority", - "discriminator": [ - 30, - 152, - 215, - 7, - 192, - 28, - 143, - 39 - ], + "discriminator": [30, 152, 215, 7, 192, 28, 143, 39], "accounts": [ { "name": "community", @@ -549,37 +323,11 @@ "seeds": [ { "kind": "const", - "value": [ - 112, - 117, - 98, - 107, - 101, - 121, - 95, - 112, - 114, - 111, - 116, - 111, - 99, - 111, - 108 - ] + "value": [112, 117, 98, 107, 101, 121, 95, 112, 114, 111, 116, 111, 99, 111, 108] }, { "kind": "const", - "value": [ - 99, - 111, - 109, - 109, - 117, - 110, - 105, - 116, - 121 - ] + "value": [99, 111, 109, 109, 117, 110, 105, 116, 121] }, { "kind": "account", @@ -607,16 +355,7 @@ }, { "name": "remove_authority", - "discriminator": [ - 242, - 104, - 208, - 132, - 190, - 250, - 74, - 216 - ], + "discriminator": [242, 104, 208, 132, 190, 250, 74, 216], "accounts": [ { "name": "profile", @@ -625,35 +364,11 @@ "seeds": [ { "kind": "const", - "value": [ - 112, - 117, - 98, - 107, - 101, - 121, - 95, - 112, - 114, - 111, - 116, - 111, - 99, - 111, - 108 - ] + "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 - ] + "value": [112, 114, 111, 102, 105, 108, 101] }, { "kind": "account", @@ -671,9 +386,7 @@ "name": "fee_payer", "writable": true, "signer": true, - "relations": [ - "profile" - ] + "relations": ["profile"] } ], "args": [ @@ -689,16 +402,7 @@ }, { "name": "remove_identity", - "discriminator": [ - 146, - 93, - 160, - 7, - 61, - 138, - 181, - 113 - ], + "discriminator": [146, 93, 160, 7, 61, 138, 181, 113], "accounts": [ { "name": "profile", @@ -707,35 +411,11 @@ "seeds": [ { "kind": "const", - "value": [ - 112, - 117, - 98, - 107, - 101, - 121, - 95, - 112, - 114, - 111, - 116, - 111, - 99, - 111, - 108 - ] + "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 - ] + "value": [112, 114, 111, 102, 105, 108, 101] }, { "kind": "account", @@ -744,9 +424,7 @@ } ] }, - "relations": [ - "pointer" - ] + "relations": ["pointer"] }, { "name": "pointer", @@ -760,9 +438,7 @@ "name": "fee_payer", "writable": true, "signer": true, - "relations": [ - "profile" - ] + "relations": ["profile"] }, { "name": "system_program", @@ -782,16 +458,7 @@ }, { "name": "update_community_details", - "discriminator": [ - 147, - 202, - 232, - 110, - 107, - 125, - 130, - 125 - ], + "discriminator": [147, 202, 232, 110, 107, 125, 130, 125], "accounts": [ { "name": "community", @@ -800,37 +467,11 @@ "seeds": [ { "kind": "const", - "value": [ - 112, - 117, - 98, - 107, - 101, - 121, - 95, - 112, - 114, - 111, - 116, - 111, - 99, - 111, - 108 - ] + "value": [112, 117, 98, 107, 101, 121, 95, 112, 114, 111, 116, 111, 99, 111, 108] }, { "kind": "const", - "value": [ - 99, - 111, - 109, - 109, - 117, - 110, - 105, - 116, - 121 - ] + "value": [99, 111, 109, 109, 117, 110, 105, 116, 121] }, { "kind": "account", @@ -844,9 +485,7 @@ "name": "authority", "writable": true, "signer": true, - "relations": [ - "community" - ] + "relations": ["community"] } ], "args": [ @@ -862,16 +501,7 @@ }, { "name": "update_community_feepayers", - "discriminator": [ - 252, - 235, - 116, - 149, - 213, - 20, - 3, - 12 - ], + "discriminator": [252, 235, 116, 149, 213, 20, 3, 12], "accounts": [ { "name": "community", @@ -880,37 +510,11 @@ "seeds": [ { "kind": "const", - "value": [ - 112, - 117, - 98, - 107, - 101, - 121, - 95, - 112, - 114, - 111, - 116, - 111, - 99, - 111, - 108 - ] + "value": [112, 117, 98, 107, 101, 121, 95, 112, 114, 111, 116, 111, 99, 111, 108] }, { "kind": "const", - "value": [ - 99, - 111, - 109, - 109, - 117, - 110, - 105, - 116, - 121 - ] + "value": [99, 111, 109, 109, 117, 110, 105, 116, 121] }, { "kind": "account", @@ -924,9 +528,7 @@ "name": "authority", "writable": true, "signer": true, - "relations": [ - "community" - ] + "relations": ["community"] }, { "name": "system_program", @@ -946,16 +548,7 @@ }, { "name": "update_profile_details", - "discriminator": [ - 218, - 18, - 64, - 5, - 242, - 160, - 11, - 38 - ], + "discriminator": [218, 18, 64, 5, 242, 160, 11, 38], "accounts": [ { "name": "profile", @@ -964,35 +557,11 @@ "seeds": [ { "kind": "const", - "value": [ - 112, - 117, - 98, - 107, - 101, - 121, - 95, - 112, - 114, - 111, - 116, - 111, - 99, - 111, - 108 - ] + "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 - ] + "value": [112, 114, 111, 102, 105, 108, 101] }, { "kind": "account", @@ -1006,9 +575,7 @@ "name": "fee_payer", "writable": true, "signer": true, - "relations": [ - "profile" - ] + "relations": ["profile"] } ], "args": [ @@ -1024,16 +591,7 @@ }, { "name": "verify_profile_identity", - "discriminator": [ - 179, - 83, - 99, - 171, - 14, - 91, - 192, - 133 - ], + "discriminator": [179, 83, 99, 171, 14, 91, 192, 133], "accounts": [ { "name": "community", @@ -1075,42 +633,15 @@ "accounts": [ { "name": "Community", - "discriminator": [ - 192, - 73, - 211, - 158, - 178, - 81, - 19, - 112 - ] + "discriminator": [192, 73, 211, 158, 178, 81, 19, 112] }, { "name": "Pointer", - "discriminator": [ - 31, - 144, - 159, - 52, - 95, - 134, - 207, - 237 - ] + "discriminator": [31, 144, 159, 52, 95, 134, 207, 237] }, { "name": "Profile", - "discriminator": [ - 184, - 101, - 165, - 188, - 95, - 63, - 127, - 188 - ] + "discriminator": [184, 101, 165, 188, 95, 63, 127, 188] } ], "errors": [ @@ -1751,4 +1282,4 @@ } } ] -} \ No newline at end of file +} diff --git a/anchor/target/types/pubkey_protocol.ts b/anchor/target/types/pubkey_protocol.ts index 369ec3b..39d1529 100644 --- a/anchor/target/types/pubkey_protocol.ts +++ b/anchor/target/types/pubkey_protocol.ts @@ -5,1756 +5,1287 @@ * IDL can be found at `target/idl/pubkey_protocol.json`. */ export type PubkeyProtocol = { - "address": "PUBKEYsiC4c87gFa5qGcH7t6VobVu3A4QqPUA2wzvam", - "metadata": { - "name": "pubkeyProtocol", - "version": "0.1.0", - "spec": "0.1.0", - "description": "Created with Anchor" - }, - "instructions": [ - { - "name": "addCommunityProvider", - "discriminator": [ - 73, - 163, - 30, - 215, - 158, - 165, - 114, - 55 - ], - "accounts": [ + address: 'PUBKEYsiC4c87gFa5qGcH7t6VobVu3A4QqPUA2wzvam' + metadata: { + name: 'pubkeyProtocol' + version: '0.1.0' + spec: '0.1.0' + description: 'Created with Anchor' + } + instructions: [ + { + name: 'addCommunityProvider' + discriminator: [73, 163, 30, 215, 158, 165, 114, 55] + accounts: [ { - "name": "community", - "writable": true + name: 'community' + writable: true }, { - "name": "authority", - "signer": true + name: 'authority' + signer: true }, { - "name": "feePayer", - "writable": true, - "signer": true + name: 'feePayer' + writable: true + signer: true }, { - "name": "systemProgram", - "address": "11111111111111111111111111111111" - } - ], - "args": [ + name: 'systemProgram' + address: '11111111111111111111111111111111' + }, + ] + args: [ { - "name": "args", - "type": { - "defined": { - "name": "addCommunityProviderArgs" + name: 'args' + type: { + defined: { + name: 'addCommunityProviderArgs' } } - } + }, ] }, { - "name": "addIdentity", - "discriminator": [ - 212, - 100, - 104, - 34, - 15, - 136, - 248, - 225 - ], - "accounts": [ + name: 'addIdentity' + discriminator: [212, 100, 104, 34, 15, 136, 248, 225] + accounts: [ { - "name": "profile", - "writable": true, - "pda": { - "seeds": [ + 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, 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: 'const' + value: [112, 114, 111, 102, 105, 108, 101] }, { - "kind": "account", - "path": "profile.username", - "account": "profile" - } + kind: 'account' + path: 'profile.username' + account: 'profile' + }, ] } }, { - "name": "pointer", - "writable": true + name: 'pointer' + writable: true }, { - "name": "authority", - "signer": true + name: 'authority' + signer: true }, { - "name": "feePayer", - "writable": true, - "signer": true, - "relations": [ - "profile" - ] + name: 'feePayer' + writable: true + signer: true + relations: ['profile'] }, { - "name": "systemProgram", - "address": "11111111111111111111111111111111" - } - ], - "args": [ + name: 'systemProgram' + address: '11111111111111111111111111111111' + }, + ] + args: [ { - "name": "args", - "type": { - "defined": { - "name": "addIdentityArgs" + name: 'args' + type: { + defined: { + name: 'addIdentityArgs' } } - } + }, ] }, { - "name": "addProfileAuthority", - "discriminator": [ - 193, - 106, - 183, - 12, - 216, - 250, - 151, - 31 - ], - "accounts": [ + name: 'addProfileAuthority' + discriminator: [193, 106, 183, 12, 216, 250, 151, 31] + accounts: [ { - "name": "profile", - "writable": true, - "pda": { - "seeds": [ + 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, 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: 'const' + value: [112, 114, 111, 102, 105, 108, 101] }, { - "kind": "account", - "path": "profile.username", - "account": "profile" - } + kind: 'account' + path: 'profile.username' + account: 'profile' + }, ] } }, { - "name": "authority", - "signer": true + name: 'authority' + signer: true }, { - "name": "feePayer", - "writable": true, - "signer": true, - "relations": [ - "profile" - ] + name: 'feePayer' + writable: true + signer: true + relations: ['profile'] }, { - "name": "systemProgram", - "address": "11111111111111111111111111111111" - } - ], - "args": [ + name: 'systemProgram' + address: '11111111111111111111111111111111' + }, + ] + args: [ { - "name": "args", - "type": { - "defined": { - "name": "addAuthorityArgs" + name: 'args' + type: { + defined: { + name: 'addAuthorityArgs' } } - } + }, ] }, { - "name": "cancelUpdateCommunityAuthority", - "discriminator": [ - 35, - 173, - 125, - 89, - 189, - 117, - 252, - 233 - ], - "accounts": [ + name: 'cancelUpdateCommunityAuthority' + discriminator: [35, 173, 125, 89, 189, 117, 252, 233] + accounts: [ { - "name": "community", - "writable": true, - "pda": { - "seeds": [ + name: 'community' + 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, 117, 98, 107, 101, 121, 95, 112, 114, 111, 116, 111, 99, 111, 108] }, { - "kind": "const", - "value": [ - 99, - 111, - 109, - 109, - 117, - 110, - 105, - 116, - 121 - ] + kind: 'const' + value: [99, 111, 109, 109, 117, 110, 105, 116, 121] }, { - "kind": "account", - "path": "community.slug", - "account": "community" - } + kind: 'account' + path: 'community.slug' + account: 'community' + }, ] } }, { - "name": "authority", - "signer": true - } - ], - "args": [] - }, - { - "name": "createCommunity", - "discriminator": [ - 203, - 214, - 176, - 194, - 13, - 207, - 22, - 60 - ], - "accounts": [ + name: 'authority' + signer: true + }, + ] + args: [] + }, + { + name: 'createCommunity' + discriminator: [203, 214, 176, 194, 13, 207, 22, 60] + accounts: [ { - "name": "community", - "writable": true, - "pda": { - "seeds": [ + name: 'community' + 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, 117, 98, 107, 101, 121, 95, 112, 114, 111, 116, 111, 99, 111, 108] }, { - "kind": "const", - "value": [ - 99, - 111, - 109, - 109, - 117, - 110, - 105, - 116, - 121 - ] + kind: 'const' + value: [99, 111, 109, 109, 117, 110, 105, 116, 121] }, { - "kind": "arg", - "path": "args.slug" - } + kind: 'arg' + path: 'args.slug' + }, ] } }, { - "name": "authority", - "signer": true + name: 'authority' + signer: true }, { - "name": "feePayer", - "writable": true, - "signer": true + name: 'feePayer' + writable: true + signer: true }, { - "name": "systemProgram", - "address": "11111111111111111111111111111111" - } - ], - "args": [ + name: 'systemProgram' + address: '11111111111111111111111111111111' + }, + ] + args: [ { - "name": "args", - "type": { - "defined": { - "name": "createCommunityArgs" + name: 'args' + type: { + defined: { + name: 'createCommunityArgs' } } - } + }, ] }, { - "name": "createProfile", - "discriminator": [ - 225, - 205, - 234, - 143, - 17, - 186, - 50, - 220 - ], - "accounts": [ + name: 'createProfile' + discriminator: [225, 205, 234, 143, 17, 186, 50, 220] + accounts: [ { - "name": "profile", - "writable": true, - "pda": { - "seeds": [ + 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, 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: 'const' + value: [112, 114, 111, 102, 105, 108, 101] }, { - "kind": "arg", - "path": "args.username" - } + kind: 'arg' + path: 'args.username' + }, ] } }, { - "name": "pointer", - "writable": true + name: 'pointer' + writable: true }, { - "name": "authority", - "signer": true + name: 'authority' + signer: true }, { - "name": "feePayer", - "writable": true, - "signer": true + name: 'feePayer' + writable: true + signer: true }, { - "name": "systemProgram", - "address": "11111111111111111111111111111111" - } - ], - "args": [ + name: 'systemProgram' + address: '11111111111111111111111111111111' + }, + ] + args: [ { - "name": "args", - "type": { - "defined": { - "name": "createProfileArgs" + name: 'args' + type: { + defined: { + name: 'createProfileArgs' } } - } + }, ] }, { - "name": "finalizeUpdateCommunityAuthority", - "discriminator": [ - 124, - 226, - 211, - 212, - 102, - 247, - 120, - 101 - ], - "accounts": [ + name: 'finalizeUpdateCommunityAuthority' + discriminator: [124, 226, 211, 212, 102, 247, 120, 101] + accounts: [ { - "name": "community", - "writable": true, - "pda": { - "seeds": [ + name: 'community' + 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, 117, 98, 107, 101, 121, 95, 112, 114, 111, 116, 111, 99, 111, 108] }, { - "kind": "const", - "value": [ - 99, - 111, - 109, - 109, - 117, - 110, - 105, - 116, - 121 - ] + kind: 'const' + value: [99, 111, 109, 109, 117, 110, 105, 116, 121] }, { - "kind": "account", - "path": "community.slug", - "account": "community" - } + kind: 'account' + path: 'community.slug' + account: 'community' + }, ] } }, { - "name": "newAuthority", - "signer": true - } - ], - "args": [] - }, - { - "name": "initiateUpdateCommunityAuthority", - "discriminator": [ - 30, - 152, - 215, - 7, - 192, - 28, - 143, - 39 - ], - "accounts": [ + name: 'newAuthority' + signer: true + }, + ] + args: [] + }, + { + name: 'initiateUpdateCommunityAuthority' + discriminator: [30, 152, 215, 7, 192, 28, 143, 39] + accounts: [ { - "name": "community", - "writable": true, - "pda": { - "seeds": [ + name: 'community' + 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, 117, 98, 107, 101, 121, 95, 112, 114, 111, 116, 111, 99, 111, 108] }, { - "kind": "const", - "value": [ - 99, - 111, - 109, - 109, - 117, - 110, - 105, - 116, - 121 - ] + kind: 'const' + value: [99, 111, 109, 109, 117, 110, 105, 116, 121] }, { - "kind": "account", - "path": "community.slug", - "account": "community" - } + kind: 'account' + path: 'community.slug' + account: 'community' + }, ] } }, { - "name": "authority", - "signer": true - } - ], - "args": [ + name: 'authority' + signer: true + }, + ] + args: [ { - "name": "args", - "type": { - "defined": { - "name": "initiateUpdateAuthorityArgs" + name: 'args' + type: { + defined: { + name: 'initiateUpdateAuthorityArgs' } } - } + }, ] }, { - "name": "removeAuthority", - "discriminator": [ - 242, - 104, - 208, - 132, - 190, - 250, - 74, - 216 - ], - "accounts": [ + name: 'removeAuthority' + discriminator: [242, 104, 208, 132, 190, 250, 74, 216] + accounts: [ { - "name": "profile", - "writable": true, - "pda": { - "seeds": [ + 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, 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: 'const' + value: [112, 114, 111, 102, 105, 108, 101] }, { - "kind": "account", - "path": "profile.username", - "account": "profile" - } + kind: 'account' + path: 'profile.username' + account: 'profile' + }, ] } }, { - "name": "authority", - "signer": true + name: 'authority' + signer: true }, { - "name": "feePayer", - "writable": true, - "signer": true, - "relations": [ - "profile" - ] - } - ], - "args": [ + name: 'feePayer' + writable: true + signer: true + relations: ['profile'] + }, + ] + args: [ { - "name": "args", - "type": { - "defined": { - "name": "removeAuthorityArgs" + name: 'args' + type: { + defined: { + name: 'removeAuthorityArgs' } } - } + }, ] }, { - "name": "removeIdentity", - "discriminator": [ - 146, - 93, - 160, - 7, - 61, - 138, - 181, - 113 - ], - "accounts": [ + name: 'removeIdentity' + discriminator: [146, 93, 160, 7, 61, 138, 181, 113] + accounts: [ { - "name": "profile", - "writable": true, - "pda": { - "seeds": [ + 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, 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: 'const' + value: [112, 114, 111, 102, 105, 108, 101] }, { - "kind": "account", - "path": "profile.username", - "account": "profile" - } + kind: 'account' + path: 'profile.username' + account: 'profile' + }, ] - }, - "relations": [ - "pointer" - ] + } + relations: ['pointer'] }, { - "name": "pointer", - "writable": true + name: 'pointer' + writable: true }, { - "name": "authority", - "signer": true + name: 'authority' + signer: true }, { - "name": "feePayer", - "writable": true, - "signer": true, - "relations": [ - "profile" - ] + name: 'feePayer' + writable: true + signer: true + relations: ['profile'] }, { - "name": "systemProgram", - "address": "11111111111111111111111111111111" - } - ], - "args": [ + name: 'systemProgram' + address: '11111111111111111111111111111111' + }, + ] + args: [ { - "name": "args", - "type": { - "defined": { - "name": "removeIdentityArgs" + name: 'args' + type: { + defined: { + name: 'removeIdentityArgs' } } - } + }, ] }, { - "name": "updateCommunityDetails", - "discriminator": [ - 147, - 202, - 232, - 110, - 107, - 125, - 130, - 125 - ], - "accounts": [ + name: 'updateCommunityDetails' + discriminator: [147, 202, 232, 110, 107, 125, 130, 125] + accounts: [ { - "name": "community", - "writable": true, - "pda": { - "seeds": [ + name: 'community' + 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, 117, 98, 107, 101, 121, 95, 112, 114, 111, 116, 111, 99, 111, 108] }, { - "kind": "const", - "value": [ - 99, - 111, - 109, - 109, - 117, - 110, - 105, - 116, - 121 - ] + kind: 'const' + value: [99, 111, 109, 109, 117, 110, 105, 116, 121] }, { - "kind": "account", - "path": "community.slug", - "account": "community" - } + kind: 'account' + path: 'community.slug' + account: 'community' + }, ] } }, { - "name": "authority", - "writable": true, - "signer": true, - "relations": [ - "community" - ] - } - ], - "args": [ + name: 'authority' + writable: true + signer: true + relations: ['community'] + }, + ] + args: [ { - "name": "args", - "type": { - "defined": { - "name": "updateCommunityDetailsArgs" + name: 'args' + type: { + defined: { + name: 'updateCommunityDetailsArgs' } } - } + }, ] }, { - "name": "updateCommunityFeepayers", - "discriminator": [ - 252, - 235, - 116, - 149, - 213, - 20, - 3, - 12 - ], - "accounts": [ + name: 'updateCommunityFeepayers' + discriminator: [252, 235, 116, 149, 213, 20, 3, 12] + accounts: [ { - "name": "community", - "writable": true, - "pda": { - "seeds": [ + name: 'community' + 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, 117, 98, 107, 101, 121, 95, 112, 114, 111, 116, 111, 99, 111, 108] }, { - "kind": "const", - "value": [ - 99, - 111, - 109, - 109, - 117, - 110, - 105, - 116, - 121 - ] + kind: 'const' + value: [99, 111, 109, 109, 117, 110, 105, 116, 121] }, { - "kind": "account", - "path": "community.slug", - "account": "community" - } + kind: 'account' + path: 'community.slug' + account: 'community' + }, ] } }, { - "name": "authority", - "writable": true, - "signer": true, - "relations": [ - "community" - ] + name: 'authority' + writable: true + signer: true + relations: ['community'] }, { - "name": "systemProgram", - "address": "11111111111111111111111111111111" - } - ], - "args": [ + name: 'systemProgram' + address: '11111111111111111111111111111111' + }, + ] + args: [ { - "name": "args", - "type": { - "defined": { - "name": "updateFeePayersArgs" + name: 'args' + type: { + defined: { + name: 'updateFeePayersArgs' } } - } + }, ] }, { - "name": "updateProfileDetails", - "discriminator": [ - 218, - 18, - 64, - 5, - 242, - 160, - 11, - 38 - ], - "accounts": [ + name: 'updateProfileDetails' + discriminator: [218, 18, 64, 5, 242, 160, 11, 38] + accounts: [ { - "name": "profile", - "writable": true, - "pda": { - "seeds": [ + 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, 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: 'const' + value: [112, 114, 111, 102, 105, 108, 101] }, { - "kind": "account", - "path": "profile.username", - "account": "profile" - } + kind: 'account' + path: 'profile.username' + account: 'profile' + }, ] } }, { - "name": "feePayer", - "writable": true, - "signer": true, - "relations": [ - "profile" - ] - } - ], - "args": [ + name: 'feePayer' + writable: true + signer: true + relations: ['profile'] + }, + ] + args: [ { - "name": "args", - "type": { - "defined": { - "name": "updateProfileDetailsArgs" + name: 'args' + type: { + defined: { + name: 'updateProfileDetailsArgs' } } - } + }, ] }, { - "name": "verifyProfileIdentity", - "discriminator": [ - 179, - 83, - 99, - 171, - 14, - 91, - 192, - 133 - ], - "accounts": [ + name: 'verifyProfileIdentity' + discriminator: [179, 83, 99, 171, 14, 91, 192, 133] + accounts: [ { - "name": "community", - "writable": true + name: 'community' + writable: true }, { - "name": "profile", - "writable": true + name: 'profile' + writable: true }, { - "name": "pointer" + name: 'pointer' }, { - "name": "authority", - "signer": true + name: 'authority' + signer: true }, { - "name": "feePayer", - "writable": true, - "signer": true + name: 'feePayer' + writable: true + signer: true }, { - "name": "systemProgram", - "address": "11111111111111111111111111111111" - } - ], - "args": [ + name: 'systemProgram' + address: '11111111111111111111111111111111' + }, + ] + args: [ { - "name": "args", - "type": { - "defined": { - "name": "verifyProfileIdentityArgs" + name: 'args' + type: { + defined: { + name: 'verifyProfileIdentityArgs' } } - } - ] - } - ], - "accounts": [ - { - "name": "community", - "discriminator": [ - 192, - 73, - 211, - 158, - 178, - 81, - 19, - 112 + }, ] }, + ] + accounts: [ { - "name": "pointer", - "discriminator": [ - 31, - 144, - 159, - 52, - 95, - 134, - 207, - 237 - ] + name: 'community' + discriminator: [192, 73, 211, 158, 178, 81, 19, 112] }, { - "name": "profile", - "discriminator": [ - 184, - 101, - 165, - 188, - 95, - 63, - 127, - 188 - ] - } - ], - "errors": [ + name: 'pointer' + discriminator: [31, 144, 159, 52, 95, 134, 207, 237] + }, { - "code": 6000, - "name": "invalidAccountOwner", - "msg": "Account not owned by program" + name: 'profile' + discriminator: [184, 101, 165, 188, 95, 63, 127, 188] }, + ] + errors: [ { - "code": 6001, - "name": "accountTooLarge", - "msg": "Account too large" + code: 6000 + name: 'invalidAccountOwner' + msg: 'Account not owned by program' }, { - "code": 6002, - "name": "unAuthorized", - "msg": "Account unauthorized to perform this action" + code: 6001 + name: 'accountTooLarge' + msg: 'Account too large' }, { - "code": 6003, - "name": "authorityAlreadyExists", - "msg": "Authority already exists" + code: 6002 + name: 'unAuthorized' + msg: 'Account unauthorized to perform this action' }, { - "code": 6004, - "name": "authorityNonExistent", - "msg": "Authority does not exist" + code: 6003 + name: 'authorityAlreadyExists' + msg: 'Authority already exists' }, { - "code": 6005, - "name": "invalidAvatarUrl", - "msg": "Invalid Avatar Url" + code: 6004 + name: 'authorityNonExistent' + msg: 'Authority does not exist' }, { - "code": 6006, - "name": "invalidDiscordId", - "msg": "Invalid Discord ID" + code: 6005 + name: 'invalidAvatarUrl' + msg: 'Invalid Avatar Url' }, { - "code": 6007, - "name": "invalidDiscordUrl", - "msg": "Invalid Discord URL" + code: 6006 + name: 'invalidDiscordId' + msg: 'Invalid Discord ID' }, { - "code": 6008, - "name": "invalidFarcasterId", - "msg": "Invalid Farcaster ID" + code: 6007 + name: 'invalidDiscordUrl' + msg: 'Invalid Discord URL' }, { - "code": 6009, - "name": "invalidFarcasterUrl", - "msg": "Invalid Farcaster URL" + code: 6008 + name: 'invalidFarcasterId' + msg: 'Invalid Farcaster ID' }, { - "code": 6010, - "name": "invalidFeePayer", - "msg": "Invalid Fee payer" + code: 6009 + name: 'invalidFarcasterUrl' + msg: 'Invalid Farcaster URL' }, { - "code": 6011, - "name": "invalidGitHubId", - "msg": "Invalid GitHub ID" + code: 6010 + name: 'invalidFeePayer' + msg: 'Invalid Fee payer' }, { - "code": 6012, - "name": "invalidGitHubUrl", - "msg": "Invalid GitHub URL" + code: 6011 + name: 'invalidGitHubId' + msg: 'Invalid GitHub ID' }, { - "code": 6013, - "name": "invalidGoogleId", - "msg": "Invalid Google ID" + code: 6012 + name: 'invalidGitHubUrl' + msg: 'Invalid GitHub URL' }, { - "code": 6014, - "name": "invalidGoogleUrl", - "msg": "Invalid Google URL" + code: 6013 + name: 'invalidGoogleId' + msg: 'Invalid Google ID' }, { - "code": 6015, - "name": "invalidName", - "msg": "Invalid Name" + code: 6014 + name: 'invalidGoogleUrl' + msg: 'Invalid Google URL' }, { - "code": 6016, - "name": "invalidProviderIdTooLong", - "msg": "Invalid Provider ID (too long)" + code: 6015 + name: 'invalidName' + msg: 'Invalid Name' }, { - "code": 6017, - "name": "invalidProviderIdNotFound", - "msg": "Invalid Provider ID (not found)" + code: 6016 + name: 'invalidProviderIdTooLong' + msg: 'Invalid Provider ID (too long)' }, { - "code": 6018, - "name": "invalidProviderNameTooLong", - "msg": "Invalid Provider Name (too long)" + code: 6017 + name: 'invalidProviderIdNotFound' + msg: 'Invalid Provider ID (not found)' }, { - "code": 6019, - "name": "invalidSlug", - "msg": "Invalid Slug" + code: 6018 + name: 'invalidProviderNameTooLong' + msg: 'Invalid Provider Name (too long)' }, { - "code": 6020, - "name": "invalidSolanaPubKey", - "msg": "Invalid Solana Public Key" + code: 6019 + name: 'invalidSlug' + msg: 'Invalid Slug' }, { - "code": 6021, - "name": "invalidTelegramId", - "msg": "Invalid Telegram ID" + code: 6020 + name: 'invalidSolanaPubKey' + msg: 'Invalid Solana Public Key' }, { - "code": 6022, - "name": "invalidTelegramUrl", - "msg": "Invalid Telegram URL" + code: 6021 + name: 'invalidTelegramId' + msg: 'Invalid Telegram ID' }, { - "code": 6023, - "name": "invalidUsername", - "msg": "Invalid Username" + code: 6022 + name: 'invalidTelegramUrl' + msg: 'Invalid Telegram URL' }, { - "code": 6024, - "name": "invalidWebsiteUrl", - "msg": "Invalid Website URL" + code: 6023 + name: 'invalidUsername' + msg: 'Invalid Username' }, { - "code": 6025, - "name": "invalidXid", - "msg": "Invalid X ID" + code: 6024 + name: 'invalidWebsiteUrl' + msg: 'Invalid Website URL' }, { - "code": 6026, - "name": "invalidXurl", - "msg": "Invalid X URL" + code: 6025 + name: 'invalidXid' + msg: 'Invalid X ID' }, { - "code": 6027, - "name": "identityProfileInvalid", - "msg": "Invalid Identity Profile Authority" + code: 6026 + name: 'invalidXurl' + msg: 'Invalid X URL' }, { - "code": 6028, - "name": "cannotRemoveSoloAuthority", - "msg": "Cannot remove last remaining authority" + code: 6027 + name: 'identityProfileInvalid' + msg: 'Invalid Identity Profile Authority' }, { - "code": 6029, - "name": "maxSizeReached", - "msg": "Array reached max size" + code: 6028 + name: 'cannotRemoveSoloAuthority' + msg: 'Cannot remove last remaining authority' }, { - "code": 6030, - "name": "identityAlreadyExists", - "msg": "Identity already exists" + code: 6029 + name: 'maxSizeReached' + msg: 'Array reached max size' }, { - "code": 6031, - "name": "identityNonExistent", - "msg": "Identity does not exist" + code: 6030 + name: 'identityAlreadyExists' + msg: 'Identity already exists' }, { - "code": 6032, - "name": "unauthorizedCommunityAction", - "msg": "Unauthorized community action" + code: 6031 + name: 'identityNonExistent' + msg: 'Identity does not exist' }, { - "code": 6033, - "name": "communityVerificationAlreadyExists", - "msg": "Community verification already exists" + code: 6032 + name: 'unauthorizedCommunityAction' + msg: 'Unauthorized community action' }, { - "code": 6034, - "name": "providerAlreadyExists", - "msg": "Provider already exists" - } - ], - "types": [ + code: 6033 + name: 'communityVerificationAlreadyExists' + msg: 'Community verification already exists' + }, + { + code: 6034 + name: 'providerAlreadyExists' + msg: 'Provider already exists' + }, + ] + types: [ { - "name": "addAuthorityArgs", - "type": { - "kind": "struct", - "fields": [ + name: 'addAuthorityArgs' + type: { + kind: 'struct' + fields: [ { - "name": "newAuthority", - "type": "pubkey" - } + name: 'newAuthority' + type: 'pubkey' + }, ] } }, { - "name": "addCommunityProviderArgs", - "type": { - "kind": "struct", - "fields": [ + name: 'addCommunityProviderArgs' + type: { + kind: 'struct' + fields: [ { - "name": "provider", - "type": { - "defined": { - "name": "identityProvider" + name: 'provider' + type: { + defined: { + name: 'identityProvider' } } - } + }, ] } }, { - "name": "addIdentityArgs", - "type": { - "kind": "struct", - "fields": [ + name: 'addIdentityArgs' + type: { + kind: 'struct' + fields: [ { - "name": "provider", - "type": { - "defined": { - "name": "identityProvider" + name: 'provider' + type: { + defined: { + name: 'identityProvider' } } }, { - "name": "providerId", - "type": "string" + name: 'providerId' + type: 'string' }, { - "name": "name", - "type": "string" - } + name: 'name' + type: 'string' + }, ] } }, { - "name": "community", - "type": { - "kind": "struct", - "fields": [ + name: 'community' + type: { + kind: 'struct' + fields: [ { - "name": "bump", - "type": "u8" + name: 'bump' + type: 'u8' }, { - "name": "slug", - "type": "string" + name: 'slug' + type: 'string' }, { - "name": "name", - "type": "string" + name: 'name' + type: 'string' }, { - "name": "avatarUrl", - "type": "string" + name: 'avatarUrl' + type: 'string' }, { - "name": "feePayers", - "type": { - "vec": "pubkey" + name: 'feePayers' + type: { + vec: 'pubkey' } }, { - "name": "authority", - "type": "pubkey" + name: 'authority' + type: 'pubkey' }, { - "name": "pendingAuthority", - "type": { - "option": "pubkey" + name: 'pendingAuthority' + type: { + option: 'pubkey' } }, { - "name": "providers", - "type": { - "vec": { - "defined": { - "name": "identityProvider" + name: 'providers' + type: { + vec: { + defined: { + name: 'identityProvider' } } } }, { - "name": "discord", - "type": { - "option": "string" + name: 'discord' + type: { + option: 'string' } }, { - "name": "farcaster", - "type": { - "option": "string" + name: 'farcaster' + type: { + option: 'string' } }, { - "name": "github", - "type": { - "option": "string" + name: 'github' + type: { + option: 'string' } }, { - "name": "telegram", - "type": { - "option": "string" + name: 'telegram' + type: { + option: 'string' } }, { - "name": "website", - "type": { - "option": "string" + name: 'website' + type: { + option: 'string' } }, { - "name": "x", - "type": { - "option": "string" + name: 'x' + type: { + option: 'string' } - } + }, ] } }, { - "name": "createCommunityArgs", - "type": { - "kind": "struct", - "fields": [ + name: 'createCommunityArgs' + type: { + kind: 'struct' + fields: [ { - "name": "slug", - "type": "string" + name: 'slug' + type: 'string' }, { - "name": "avatarUrl", - "type": "string" + name: 'avatarUrl' + type: 'string' }, { - "name": "name", - "type": "string" - } + name: 'name' + type: 'string' + }, ] } }, { - "name": "createProfileArgs", - "type": { - "kind": "struct", - "fields": [ + name: 'createProfileArgs' + type: { + kind: 'struct' + fields: [ { - "name": "username", - "type": "string" + name: 'username' + type: 'string' }, { - "name": "name", - "type": "string" + name: 'name' + type: 'string' }, { - "name": "avatarUrl", - "type": "string" - } + name: 'avatarUrl' + type: 'string' + }, ] } }, { - "name": "identity", - "type": { - "kind": "struct", - "fields": [ + name: 'identity' + type: { + kind: 'struct' + fields: [ { - "name": "provider", - "type": { - "defined": { - "name": "identityProvider" + name: 'provider' + type: { + defined: { + name: 'identityProvider' } } }, { - "name": "providerId", - "type": "string" + name: 'providerId' + type: 'string' }, { - "name": "name", - "type": "string" + name: 'name' + type: 'string' }, { - "name": "communities", - "type": { - "vec": "pubkey" + name: 'communities' + type: { + vec: 'pubkey' } - } + }, ] } }, { - "name": "identityProvider", - "type": { - "kind": "enum", - "variants": [ + name: 'identityProvider' + type: { + kind: 'enum' + variants: [ { - "name": "discord" + name: 'discord' }, { - "name": "farcaster" + name: 'farcaster' }, { - "name": "github" + name: 'github' }, { - "name": "google" + name: 'google' }, { - "name": "solana" + name: 'solana' }, { - "name": "telegram" + name: 'telegram' }, { - "name": "x" - } + name: 'x' + }, ] } }, { - "name": "initiateUpdateAuthorityArgs", - "type": { - "kind": "struct", - "fields": [ + name: 'initiateUpdateAuthorityArgs' + type: { + kind: 'struct' + fields: [ { - "name": "newAuthority", - "type": "pubkey" - } + name: 'newAuthority' + type: 'pubkey' + }, ] } }, { - "name": "pointer", - "type": { - "kind": "struct", - "fields": [ + name: 'pointer' + type: { + kind: 'struct' + fields: [ { - "name": "bump", - "type": "u8" + name: 'bump' + type: 'u8' }, { - "name": "provider", - "type": { - "defined": { - "name": "identityProvider" + name: 'provider' + type: { + defined: { + name: 'identityProvider' } } }, { - "name": "providerId", - "type": "string" + name: 'providerId' + type: 'string' }, { - "name": "profile", - "type": "pubkey" - } + name: 'profile' + type: 'pubkey' + }, ] } }, { - "name": "profile", - "type": { - "kind": "struct", - "fields": [ + name: 'profile' + type: { + kind: 'struct' + fields: [ { - "name": "bump", - "type": "u8" + name: 'bump' + type: 'u8' }, { - "name": "username", - "type": "string" + name: 'username' + type: 'string' }, { - "name": "name", - "type": "string" + name: 'name' + type: 'string' }, { - "name": "avatarUrl", - "type": "string" + name: 'avatarUrl' + type: 'string' }, { - "name": "feePayer", - "type": "pubkey" + name: 'feePayer' + type: 'pubkey' }, { - "name": "authorities", - "type": { - "vec": "pubkey" + name: 'authorities' + type: { + vec: 'pubkey' } }, { - "name": "identities", - "type": { - "vec": { - "defined": { - "name": "identity" + name: 'identities' + type: { + vec: { + defined: { + name: 'identity' } } } - } + }, ] } }, { - "name": "removeAuthorityArgs", - "type": { - "kind": "struct", - "fields": [ + name: 'removeAuthorityArgs' + type: { + kind: 'struct' + fields: [ { - "name": "authorityToRemove", - "type": "pubkey" - } + name: 'authorityToRemove' + type: 'pubkey' + }, ] } }, { - "name": "removeIdentityArgs", - "type": { - "kind": "struct", - "fields": [ + name: 'removeIdentityArgs' + type: { + kind: 'struct' + fields: [ { - "name": "providerId", - "type": "string" - } + name: 'providerId' + type: 'string' + }, ] } }, { - "name": "updateCommunityDetailsArgs", - "type": { - "kind": "struct", - "fields": [ + name: 'updateCommunityDetailsArgs' + type: { + kind: 'struct' + fields: [ { - "name": "avatarUrl", - "type": { - "option": "string" + name: 'avatarUrl' + type: { + option: 'string' } }, { - "name": "discord", - "type": { - "option": "string" + name: 'discord' + type: { + option: 'string' } }, { - "name": "farcaster", - "type": { - "option": "string" + name: 'farcaster' + type: { + option: 'string' } }, { - "name": "github", - "type": { - "option": "string" + name: 'github' + type: { + option: 'string' } }, { - "name": "name", - "type": { - "option": "string" + name: 'name' + type: { + option: 'string' } }, { - "name": "telegram", - "type": { - "option": "string" + name: 'telegram' + type: { + option: 'string' } }, { - "name": "website", - "type": { - "option": "string" + name: 'website' + type: { + option: 'string' } }, { - "name": "x", - "type": { - "option": "string" + name: 'x' + type: { + option: 'string' } - } + }, ] } }, { - "name": "updateFeePayersArgs", - "type": { - "kind": "struct", - "fields": [ + name: 'updateFeePayersArgs' + type: { + kind: 'struct' + fields: [ { - "name": "newFeePayers", - "type": { - "vec": "pubkey" + name: 'newFeePayers' + type: { + vec: 'pubkey' } - } + }, ] } }, { - "name": "updateProfileDetailsArgs", - "type": { - "kind": "struct", - "fields": [ + name: 'updateProfileDetailsArgs' + type: { + kind: 'struct' + fields: [ { - "name": "authority", - "type": "pubkey" + name: 'authority' + type: 'pubkey' }, { - "name": "newName", - "type": { - "option": "string" + name: 'newName' + type: { + option: 'string' } }, { - "name": "newAvatarUrl", - "type": { - "option": "string" + name: 'newAvatarUrl' + type: { + option: 'string' } - } + }, ] } }, { - "name": "verifyProfileIdentityArgs", - "type": { - "kind": "struct", - "fields": [ + name: 'verifyProfileIdentityArgs' + type: { + kind: 'struct' + fields: [ { - "name": "provider", - "type": { - "defined": { - "name": "identityProvider" + name: 'provider' + type: { + defined: { + name: 'identityProvider' } } }, { - "name": "providerId", - "type": "string" - } + name: 'providerId' + type: 'string' + }, ] } - } + }, ] -}; +} diff --git a/anchor/tests/utils/get-avatar-url.ts b/anchor/tests/utils/get-avatar-url.ts index 0910923..dcb77a9 100644 --- a/anchor/tests/utils/get-avatar-url.ts +++ b/anchor/tests/utils/get-avatar-url.ts @@ -1,5 +1,5 @@ export function getCommunityAvatarUrl(slug: string) { - return `https://api.dicebear.com/9.x/glass/svg?seed=${slug}` + return `https://api.dicebear.com/9.x/initials/svg?seed=${slug}` } export function getProfileAvatarUrl(username: string) { return `https://api.dicebear.com/9.x/bottts-neutral/svg?seed=${username}` diff --git a/anchor/tests/utils/index.ts b/anchor/tests/utils/index.ts index 475b32c..17b573b 100644 --- a/anchor/tests/utils/index.ts +++ b/anchor/tests/utils/index.ts @@ -6,7 +6,7 @@ import { IdentityProvider, PubkeyProtocol, } from '../../src' -import { getCommunityAvatarUrl } from './get-avatar-url' +import { getCommunityAvatarUrl, getProfileAvatarUrl } from './get-avatar-url' import { SystemProgram } from '@solana/web3.js' export async function createTestCommunity( @@ -56,7 +56,7 @@ export async function createTestProfile( await program.methods .createProfile({ - avatarUrl: `https://api.dicebear.com/9.x/bottts-neutral/svg?seed=${username}`, + avatarUrl: getProfileAvatarUrl(username), name: 'Test Verified User', username, }) diff --git a/sdk/src/index.ts b/sdk/src/index.ts index 4cd725d..72fec57 100644 --- a/sdk/src/index.ts +++ b/sdk/src/index.ts @@ -1,2 +1,3 @@ export * from './lib/anchor-keypair-wallet' export * from './lib/pubkey-protocol-sdk' +export * from './lib/utils' diff --git a/sdk/src/lib/pubkey-protocol-sdk.spec.ts b/sdk/src/lib/pubkey-protocol-sdk.spec.ts index 1632727..a31d3e9 100644 --- a/sdk/src/lib/pubkey-protocol-sdk.spec.ts +++ b/sdk/src/lib/pubkey-protocol-sdk.spec.ts @@ -4,6 +4,7 @@ import { airdropIfRequired, getKeypairFromFile } from '@solana-developers/helper import { Connection, Keypair, LAMPORTS_PER_SOL, PublicKey } from '@solana/web3.js' import { AnchorKeypairWallet } from './anchor-keypair-wallet' import { PubkeyProtocolSdk } from './pubkey-protocol-sdk' +import { getProfileAvatarUrl } from './utils' const programId = PUBKEY_PROTOCOL_PROGRAM_ID const connection = new Connection('http://localhost:8899', 'confirmed') @@ -47,7 +48,7 @@ xdescribe('sdk', () => { // ARRANGE const username = `test-${Date.now()}` const name = `Test Profile` - const avatarUrl = `https://avatars.dicebear.com/api/avataaars/${username}.svg` + const avatarUrl = getProfileAvatarUrl(username) // ACT console.log({ authority, diff --git a/sdk/src/lib/pubkey-protocol-sdk.ts b/sdk/src/lib/pubkey-protocol-sdk.ts index 7fc08b5..35bea38 100644 --- a/sdk/src/lib/pubkey-protocol-sdk.ts +++ b/sdk/src/lib/pubkey-protocol-sdk.ts @@ -23,6 +23,7 @@ import { TransactionMessage, VersionedTransaction, } from '@solana/web3.js' +import { getCommunityAvatarUrl, getProfileAvatarUrl, slugify } from './utils' export interface PubKeyProfileSdkOptions { readonly connection: Connection @@ -85,20 +86,32 @@ export interface AddAuthorityOptions { username: string } -export interface CreateCommunityOptions { +export interface CreateCommunityInput { avatarUrl: string + name: string + slug: string +} + +export interface CreateCommunityOptions { authority: PublicKey + avatarUrl?: string + discord?: string + farcaster?: string feePayer: PublicKey + github?: string name: string - slug: string + slug?: string + telegram?: string + website?: string + x?: string } export interface CreateProfileOptions { - avatarUrl: string + avatarUrl?: string authority: PublicKey feePayer: PublicKey name: string - username: string + username?: string } export interface UpdateAvatarUrlOptions { @@ -160,32 +173,41 @@ export class PubkeyProtocolSdk { return this.createTransaction({ ix, feePayer }) } - async createCommunity({ authority, avatarUrl, feePayer, name, slug }: CreateCommunityOptions) { + async createCommunity(options: CreateCommunityOptions): Promise<{ + input: CreateCommunityInput + tx: VersionedTransaction + }> { + const slug = options.slug || slugify(options.name) + const avatarUrl = options.avatarUrl || getCommunityAvatarUrl(slug) const [community] = this.getCommunityPda({ slug }) + const input: CreateCommunityInput = { + avatarUrl, + name: options.name, + slug, + } const ix = await this.program.methods - .createCommunity({ - avatarUrl: avatarUrl || `https://api.dicebear.com/9.x/glass/svg?seed=${slug}`, - name, - slug, - }) + .createCommunity(input) .accountsStrict({ - authority, - feePayer, + authority: options.authority, + feePayer: options.feePayer, community, systemProgram: SystemProgram.programId, }) .instruction() - return this.createTransaction({ ix, feePayer }) + const tx = await this.createTransaction({ ix, feePayer: options.feePayer }) + + return { input, tx } } async createProfile({ authority, avatarUrl, feePayer, name, username }: CreateProfileOptions) { + username = username || slugify(name) const [profile] = this.getProfilePda({ username }) const [pointer] = this.getPointerPda({ provider: IdentityProvider.Solana, providerId: authority.toString() }) const ix = await this.program.methods .createProfile({ - avatarUrl: avatarUrl || `https://api.dicebear.com/9.x/bottts-neutral/svg?seed=${username}`, + avatarUrl: avatarUrl || getProfileAvatarUrl(username), name, username, }) diff --git a/sdk/src/lib/utils.ts b/sdk/src/lib/utils.ts new file mode 100644 index 0000000..5c3f231 --- /dev/null +++ b/sdk/src/lib/utils.ts @@ -0,0 +1,55 @@ +import { Cluster } from '@solana/web3.js' + +export function slugify(str: string): string { + // Convert to lowercase + let slug = str.toLowerCase() + + // Replace non-alphanumeric characters (except underscore) with '_' + slug = slug.replace(/[^a-z0-9_]/g, '_') + + // Trim to max length of 20 characters + if (slug.length > 20) { + slug = slug.substring(0, 20) + } + + // Ensure minimum length of 3 characters, pad with underscores if needed + if (slug.length < 3) { + slug = slug.padEnd(3, '_') + } + + return slug +} + +export type SolanaCluster = Cluster | 'local' + +export function getExplorerUrl(path: string, cluster: SolanaCluster, endpoint = 'http://localhost:8899'): string { + return `https://explorer.solana.com/${path}${getClusterUrlParam(cluster, endpoint)}` +} + +export function getClusterUrlParam(cluster: SolanaCluster, endpoint = 'http://localhost:8899'): string { + let suffix = '' + switch (cluster) { + case 'devnet': + suffix = 'devnet' + break + case 'mainnet-beta': + suffix = 'mainnet' + break + case 'testnet': + suffix = 'testnet' + break + default: + suffix = `custom&customUrl=${encodeURIComponent(endpoint)}` + break + } + + return suffix.length ? `?cluster=${suffix}` : '' +} + +export function getCommunityAvatarUrl(slug: string) { + return `https://api.dicebear.com/9.x/initials/svg?seed=${slug}` +} + +export function getProfileAvatarUrl(username: string) { + return `https://api.dicebear.com/9.x/bottts-neutral/svg?seed=${username}` +} diff --git a/web/src/app/app-routes.tsx b/web/src/app/app-routes.tsx index a5ba30e..2420bf3 100644 --- a/web/src/app/app-routes.tsx +++ b/web/src/app/app-routes.tsx @@ -6,7 +6,7 @@ import { AppLayout } from './app-layout' import { ClusterUiSelect } from './features/cluster/cluster-ui' import { KeypairFeature } from './features/keypair/feature' import { KeypairUiBalance, KeypairUiSelect } from './features/keypair/ui' -import { WalletIcon } from './features/solana/solana-provider' +import { WalletIcon } from './features/solana' const ClusterFeature = lazy(() => import('./features/cluster/cluster-feature')) @@ -30,7 +30,7 @@ const routes: RouteObject[] = [ export function AppRoutes() { const router = useRoutes([ - { path: '/', element: }, + { path: '/', element: }, ...routes, { path: '*', element: }, diff --git a/web/src/app/features/cluster/cluster-data-access.tsx b/web/src/app/features/cluster/cluster-data-access.tsx index 8d77872..f14391f 100644 --- a/web/src/app/features/cluster/cluster-data-access.tsx +++ b/web/src/app/features/cluster/cluster-data-access.tsx @@ -1,7 +1,8 @@ -import { clusterApiUrl } from '@solana/web3.js' +import { Cluster as SolanaCluster, clusterApiUrl } from '@solana/web3.js' import { atom, useAtomValue, useSetAtom } from 'jotai' import { atomWithStorage } from 'jotai/utils' import { createContext, ReactNode, useContext } from 'react' +import { getExplorerUrl } from '@pubkey-protocol/sdk' export interface Cluster { name: string @@ -76,7 +77,7 @@ export function ClusterProvider({ children }: { children: ReactNode }) { setClusters(clusters.filter((item) => item.name !== cluster.name)) }, setCluster: (cluster: Cluster) => setCluster(cluster), - getExplorerUrl: (path: string) => `https://explorer.solana.com/${path}${getClusterUrlParam(cluster)}`, + getExplorerUrl: (path: string) => getExplorerUrl(path, cluster.network as SolanaCluster), } return {children} } @@ -84,23 +85,3 @@ export function ClusterProvider({ children }: { children: ReactNode }) { export function useCluster() { return useContext(Context) } - -function getClusterUrlParam(cluster: Cluster): string { - let suffix = '' - switch (cluster.network) { - case ClusterNetwork.Devnet: - suffix = 'devnet' - break - case ClusterNetwork.Mainnet: - suffix = 'mainnet' - break - case ClusterNetwork.Testnet: - suffix = 'testnet' - break - default: - suffix = `custom&customUrl=${encodeURIComponent(cluster.endpoint)}` - break - } - - return suffix.length ? `?cluster=${suffix}` : '' -} diff --git a/web/src/app/features/pubkey-community/data-access/use-mutation-create-community.tsx b/web/src/app/features/pubkey-community/data-access/use-mutation-create-community.tsx index d338eb2..6a9adb7 100644 --- a/web/src/app/features/pubkey-community/data-access/use-mutation-create-community.tsx +++ b/web/src/app/features/pubkey-community/data-access/use-mutation-create-community.tsx @@ -15,8 +15,14 @@ export function useMutationCreateCommunity() { authority, feePayer, }) - .then(signAndConfirmTransaction), + .then(async ({ input, tx }) => { + const signature = await signAndConfirmTransaction(tx) + + return { input, tx, signature } + }), onError, - onSuccess, + onSuccess: ({ signature }) => { + return onSuccess(signature) + }, }) } diff --git a/web/src/app/features/pubkey-community/feature/pubkey-community-feature-create.tsx b/web/src/app/features/pubkey-community/feature/pubkey-community-feature-create.tsx index 57d34d1..b059d30 100644 --- a/web/src/app/features/pubkey-community/feature/pubkey-community-feature-create.tsx +++ b/web/src/app/features/pubkey-community/feature/pubkey-community-feature-create.tsx @@ -1,23 +1,21 @@ -import { toastError, toastSuccess, UiCard, UiPage } from '@pubkey-ui/core' -import { IconUserPlus } from '@tabler/icons-react' +import { toastError, UiCard } from '@pubkey-ui/core' +import { useNavigate } from 'react-router-dom' import { useMutationCreateCommunity } from '../data-access' import { PubkeyProtocolUiCommunityCreateForm } from '../ui' export function PubkeyCommunityFeatureCreate() { const mutation = useMutationCreateCommunity() - + const navigate = useNavigate() return ( - } title="Create Community"> - - - mutation - .mutateAsync(input) - .then(() => toastSuccess(`Community created`)) - .catch((err) => toastError(`Error: ${err}`)) - } - /> - - + + + mutation + .mutateAsync(input) + .then((res) => navigate(`../${res.input.slug}`)) + .catch((err) => toastError(`Error: ${err}`)) + } + /> + ) } 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 c6a7f89..00ecdb5 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,5 +1,4 @@ -import { UiLoader, UiPage, UiWarning } from '@pubkey-ui/core' -import { IconUsers } from '@tabler/icons-react' +import { UiLoader, UiWarning } from '@pubkey-ui/core' import { useParams } from 'react-router-dom' import { useQueryGetCommunityBySlug } from '../data-access' import { PubkeyProtocolUiCommunityCard } from '../ui' @@ -9,15 +8,11 @@ export function PubkeyCommunityFeatureDetail() { const query = useQueryGetCommunityBySlug({ slug }) - return ( - } title={slug}> - {query.isLoading ? ( - - ) : query.data ? ( - - ) : ( - - )} - + return query.isLoading ? ( + + ) : query.data ? ( + + ) : ( + ) } diff --git a/web/src/app/features/pubkey-community/feature/pubkey-community-feature-list.tsx b/web/src/app/features/pubkey-community/feature/pubkey-community-feature-list.tsx index bc202ab..c95854c 100644 --- a/web/src/app/features/pubkey-community/feature/pubkey-community-feature-list.tsx +++ b/web/src/app/features/pubkey-community/feature/pubkey-community-feature-list.tsx @@ -1,21 +1,16 @@ -import { UiDebug, UiLoader, UiPage, UiStack } from '@pubkey-ui/core' -import { IconUsers } from '@tabler/icons-react' +import { UiDebug, UiLoader, UiStack } from '@pubkey-ui/core' import { useQueryGetCommunities } from '../data-access' import { PubkeyProtocolUiCommunityGrid } from '../ui/pubkey-protocol-ui-community-grid' export function PubkeyCommunityFeatureList({ basePath }: { basePath: string }) { const query = useQueryGetCommunities() - return ( - } title="Communities"> - {query.isLoading ? ( - - ) : ( - - - - - )} - + return query.isLoading ? ( + + ) : ( + + + + ) } diff --git a/web/src/app/features/pubkey-community/feature/pubkey-community.routes.tsx b/web/src/app/features/pubkey-community/feature/pubkey-community.routes.tsx index b522907..e79eb83 100644 --- a/web/src/app/features/pubkey-community/feature/pubkey-community.routes.tsx +++ b/web/src/app/features/pubkey-community/feature/pubkey-community.routes.tsx @@ -1,42 +1,34 @@ -import { IconUsers, IconUsersPlus } from '@tabler/icons-react' -import { Navigate, useRoutes } from 'react-router-dom' -import { KeypairUiGridItem } from '../../keypair/ui' +import { IconUsers } from '@tabler/icons-react' +import { Link, useRoutes } from 'react-router-dom' import { PubkeyCommunityFeatureList } from './pubkey-community-feature-list' import { PubkeyCommunityFeatureCreate } from './pubkey-community-feature-create' import { PubkeyCommunityFeatureDetail } from './pubkey-community-feature-detail' -import { PubkeyProtocolProvider } from '../../pubkey-protocol' -import { UiSidebar } from '../../../ui' -import { SolanaConnectionLoader } from '../../solana' +import { PubKeyProtocolLoader } from '../../pubkey-protocol' +import { Button, Group } from '@mantine/core' +import { UiPage } from '@pubkey-ui/core' export default function PubkeyCommunityRoutes({ basePath }: { basePath: string }) { - const sidebar: KeypairUiGridItem[] = [ - { - label: 'Communities', - path: 'list', - leftSection: , - }, - { - label: 'Create', - path: 'create', - leftSection: , - }, - ] const routes = useRoutes([ - { index: true, element: }, - { path: 'list', element: }, + { index: true, element: }, { path: 'create', element: }, { path: ':slug', element: }, ]) return ( - ( - - - {routes} - - - )} - /> + + } + title="Communities" + rightAction={ + + + + } + > + {routes} + + ) } diff --git a/web/src/app/features/pubkey-community/ui/pubkey-protocol-ui-community-anchor.tsx b/web/src/app/features/pubkey-community/ui/pubkey-protocol-ui-community-anchor.tsx index 5dfe89a..d484afe 100644 --- a/web/src/app/features/pubkey-community/ui/pubkey-protocol-ui-community-anchor.tsx +++ b/web/src/app/features/pubkey-community/ui/pubkey-protocol-ui-community-anchor.tsx @@ -1,14 +1,22 @@ import { Anchor, Text } from '@mantine/core' import { Link } from 'react-router-dom' -export function PubkeyProtocolUiCommunityAnchor({ slug, basePath }: { slug: string; basePath?: string }) { +export function PubkeyProtocolUiCommunityAnchor({ + name, + slug, + basePath, +}: { + name: string + slug: string + basePath?: string +}) { return basePath ? ( - {slug} + {name} ) : ( - {slug} + {name} ) } diff --git a/web/src/app/features/pubkey-community/ui/pubkey-protocol-ui-community-avatar.tsx b/web/src/app/features/pubkey-community/ui/pubkey-protocol-ui-community-avatar.tsx index 2f18024..767dfde 100644 --- a/web/src/app/features/pubkey-community/ui/pubkey-protocol-ui-community-avatar.tsx +++ b/web/src/app/features/pubkey-community/ui/pubkey-protocol-ui-community-avatar.tsx @@ -2,5 +2,5 @@ import { PubKeyCommunity } from '@pubkey-protocol/anchor' import { UiAvatar } from '../../../ui/ui-avatar' export function PubkeyProtocolUiCommunityAvatar({ community: { avatarUrl, slug } }: { community: PubKeyCommunity }) { - return + return } diff --git a/web/src/app/features/pubkey-community/ui/pubkey-protocol-ui-community-create-form.tsx b/web/src/app/features/pubkey-community/ui/pubkey-protocol-ui-community-create-form.tsx index 86d8dc1..64c5ce6 100644 --- a/web/src/app/features/pubkey-community/ui/pubkey-protocol-ui-community-create-form.tsx +++ b/web/src/app/features/pubkey-community/ui/pubkey-protocol-ui-community-create-form.tsx @@ -8,12 +8,12 @@ export function PubkeyProtocolUiCommunityCreateForm({ }: { submit: (input: PubKeyCommunityCreateInput) => Promise }) { - const form = useForm({ initialValues: { avatarUrl: '', name: '', slug: '' } }) + const form = useForm({ initialValues: { name: '' } }) return ( -
submit({ ...values, name: values.slug }))}> + submit({ ...values }))}> - + diff --git a/web/src/app/features/pubkey-community/ui/pubkey-protocol-ui-community-list-item.tsx b/web/src/app/features/pubkey-community/ui/pubkey-protocol-ui-community-list-item.tsx index 24b3514..2ff2687 100644 --- a/web/src/app/features/pubkey-community/ui/pubkey-protocol-ui-community-list-item.tsx +++ b/web/src/app/features/pubkey-community/ui/pubkey-protocol-ui-community-list-item.tsx @@ -22,7 +22,7 @@ export function PubkeyProtocolUiCommunityListItem({ - + - + - - {children ?? community.name} + + {children ?? community.slug} 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 09fdad0..e8356be 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 @@ -1,6 +1,5 @@ import { IdentityProvider } from '@pubkey-protocol/anchor' -import { toastError, toastSuccess, UiCard, UiInfo, UiLoader, UiPage } from '@pubkey-ui/core' -import { IconUserPlus } from '@tabler/icons-react' +import { toastError, toastSuccess, UiCard, UiInfo, UiLoader } from '@pubkey-ui/core' import { ellipsify } from '../../../ui' import { useMutationCreateProfile, useQueryGetProfileByProviderNullable } from '../data-access' import { PubkeyProtocolUiProfileCreateForm } from '../ui' @@ -14,28 +13,24 @@ export function PubkeyProfileFeatureCreate() { providerId: authority.toString(), }) - return ( - } title="Create Profile"> - {pointerQuery.isLoading ? ( - - ) : pointerQuery.data ? ( - - ) : ( - - - mutation - .mutateAsync(input) - .then(() => toastSuccess(`Profile created`)) - .catch((err) => toastError(`Error: ${err}`)) - } - /> - - )} - + return pointerQuery.isLoading ? ( + + ) : pointerQuery.data ? ( + + ) : ( + + + mutation + .mutateAsync(input) + .then(() => toastSuccess(`Profile created`)) + .catch((err) => toastError(`Error: ${err}`)) + } + /> + ) } diff --git a/web/src/app/features/pubkey-profile/feature/pubkey-profile-feature-list.tsx b/web/src/app/features/pubkey-profile/feature/pubkey-profile-feature-list.tsx index be66e53..a6d5983 100644 --- a/web/src/app/features/pubkey-profile/feature/pubkey-profile-feature-list.tsx +++ b/web/src/app/features/pubkey-profile/feature/pubkey-profile-feature-list.tsx @@ -1,21 +1,16 @@ -import { UiDebug, UiLoader, UiPage, UiStack } from '@pubkey-ui/core' -import { IconUser } from '@tabler/icons-react' +import { UiDebug, UiLoader, UiStack } from '@pubkey-ui/core' import { useQueryGetProfiles } from '../data-access' import { PubkeyProtocolUiProfileGrid } from '../ui' export function PubkeyProfileFeatureList({ basePath }: { basePath: string }) { const query = useQueryGetProfiles() - return ( - } title="Profiles"> - {query.isLoading ? ( - - ) : ( - - - - - )} - + return query.isLoading ? ( + + ) : ( + + + + ) } diff --git a/web/src/app/features/pubkey-profile/feature/pubkey-profile.routes.tsx b/web/src/app/features/pubkey-profile/feature/pubkey-profile.routes.tsx index 13ded4f..4139c27 100644 --- a/web/src/app/features/pubkey-profile/feature/pubkey-profile.routes.tsx +++ b/web/src/app/features/pubkey-profile/feature/pubkey-profile.routes.tsx @@ -1,50 +1,40 @@ -import { IconSearch, IconUser, IconUserPlus } from '@tabler/icons-react' -import { Navigate, useRoutes } from 'react-router-dom' -import { KeypairUiGridItem } from '../../keypair/ui' +import { IconUser } from '@tabler/icons-react' +import { Link, useRoutes } from 'react-router-dom' import { PubkeyProfileFeatureCreate } from './pubkey-profile-feature-create' import { PubkeyProfileFeatureDetail } from './pubkey-profile-feature-detail' import { PubkeyProfileFeatureList } from './pubkey-profile-feature-list' import { PubkeyProfileFeatureSearch } from './pubkey-profile-feature-search' -import { PubkeyProtocolProvider } from '../../pubkey-protocol' -import { UiSidebar } from '../../../ui' -import { SolanaConnectionLoader } from '../../solana' +import { PubKeyProtocolLoader } from '../../pubkey-protocol' +import { Button, Group } from '@mantine/core' +import { UiPage } from '@pubkey-ui/core' export default function PubkeyProfileRoutes({ basePath }: { basePath: string }) { - const sidebar: KeypairUiGridItem[] = [ - { - label: 'Profiles', - path: 'list', - leftSection: , - }, - { - label: 'Create', - path: 'create', - leftSection: , - }, - { - label: 'Search', - path: 'search', - leftSection: , - }, - ] const routes = useRoutes([ - { index: true, element: }, - { path: 'list', element: }, + { index: true, element: }, { path: 'create', element: }, { path: 'search', element: }, { path: ':username', element: }, ]) return ( - ( - - - {routes} - - - )} - /> + + } + title="Profiles" + rightAction={ + + + + + } + > + {routes} + + ) } diff --git a/web/src/app/features/pubkey-profile/ui/pubkey-protocol-ui-profile-create-form.tsx b/web/src/app/features/pubkey-profile/ui/pubkey-protocol-ui-profile-create-form.tsx index 8c66dac..09f5a2b 100644 --- a/web/src/app/features/pubkey-profile/ui/pubkey-protocol-ui-profile-create-form.tsx +++ b/web/src/app/features/pubkey-profile/ui/pubkey-protocol-ui-profile-create-form.tsx @@ -11,9 +11,9 @@ export function PubkeyProtocolUiProfileCreateForm({ const form = useForm({ initialValues: { avatarUrl: '', name: '', username: '' } }) return ( - submit({ ...values, name: values.username }))}> + submit({ ...values }))}> - + diff --git a/web/src/app/features/pubkey-profile/ui/pubkey-protocol-ui-profile.tsx b/web/src/app/features/pubkey-profile/ui/pubkey-protocol-ui-profile.tsx index dce8030..00aa074 100644 --- a/web/src/app/features/pubkey-profile/ui/pubkey-protocol-ui-profile.tsx +++ b/web/src/app/features/pubkey-profile/ui/pubkey-protocol-ui-profile.tsx @@ -2,9 +2,9 @@ import { Group, Stack } from '@mantine/core' import { PubKeyProfile } from '@pubkey-protocol/anchor' import { UiDebugModal } from '@pubkey-ui/core' import { ReactNode } from 'react' -import { UiAvatar } from '../../../ui/ui-avatar' import { PubkeyProtocolUiProfileAnchor } from './pubkey-protocol-ui-profile-anchor' import { PubkeyProtocolUiIdentity } from './pubkey-protocol-ui-identity' +import { PubkeyProtocolUiProfileAvatar } from './pubkey-protocol-ui-profile-avatar' export function PubkeyProtocolUiProfile({ children, @@ -18,7 +18,7 @@ export function PubkeyProtocolUiProfile({ return ( - + diff --git a/web/src/app/features/pubkey-protocol/data-access/index.ts b/web/src/app/features/pubkey-protocol/data-access/index.ts index c871f4f..8843c6d 100644 --- a/web/src/app/features/pubkey-protocol/data-access/index.ts +++ b/web/src/app/features/pubkey-protocol/data-access/index.ts @@ -1,3 +1,4 @@ +export * from './pubkey-protocol-loader' export * from './pubkey-protocol-provider' export * from './use-pubkey-protocol-sdk' export * from './use-query-get-program-account' diff --git a/web/src/app/features/pubkey-protocol/data-access/pubkey-protocol-loader.tsx b/web/src/app/features/pubkey-protocol/data-access/pubkey-protocol-loader.tsx new file mode 100644 index 0000000..73e7ea9 --- /dev/null +++ b/web/src/app/features/pubkey-protocol/data-access/pubkey-protocol-loader.tsx @@ -0,0 +1,20 @@ +import { ReactNode } from 'react' +import { SolanaConnectionLoader } from '../../solana' +import { PubKeyProtocolProvider } from './pubkey-protocol-provider' + +export function PubKeyProtocolLoader({ + children, + ...props +}: { + children: ReactNode + loader?: ReactNode + noConnection?: ReactNode + noWallet?: ReactNode +}) { + return ( + {children}} + /> + ) +} diff --git a/web/src/app/features/pubkey-protocol/data-access/pubkey-protocol-provider.tsx b/web/src/app/features/pubkey-protocol/data-access/pubkey-protocol-provider.tsx index 628a0ae..08b673b 100644 --- a/web/src/app/features/pubkey-protocol/data-access/pubkey-protocol-provider.tsx +++ b/web/src/app/features/pubkey-protocol/data-access/pubkey-protocol-provider.tsx @@ -31,7 +31,7 @@ export interface PubKeyProfileProviderContext { const Context = createContext({} as PubKeyProfileProviderContext) -export function PubkeyProtocolProvider({ +export function PubKeyProtocolProvider({ children, connection, publicKey, diff --git a/web/src/app/features/pubkey-protocol/feature/pubkey-protocol.routes.tsx b/web/src/app/features/pubkey-protocol/feature/pubkey-protocol.routes.tsx index 07151c8..b72182d 100644 --- a/web/src/app/features/pubkey-protocol/feature/pubkey-protocol.routes.tsx +++ b/web/src/app/features/pubkey-protocol/feature/pubkey-protocol.routes.tsx @@ -1,15 +1,10 @@ -import { PubkeyProtocolProvider } from '../data-access' +import { PubKeyProtocolLoader } from '../data-access' import { PubkeyProtocolFeatureDebug } from './pubkey-protocol-feature-debug' -import { SolanaConnectionLoader } from '../../solana' export default function PubkeyProtocolRoutes() { return ( - ( - - - - )} - /> + + + ) } diff --git a/web/src/app/features/solana/solana-connection-loader.tsx b/web/src/app/features/solana/solana-connection-loader.tsx index 485f445..aa8f0cd 100644 --- a/web/src/app/features/solana/solana-connection-loader.tsx +++ b/web/src/app/features/solana/solana-connection-loader.tsx @@ -12,27 +12,33 @@ export interface SolanaConnectionRenderProps { } export function SolanaConnectionLoader({ + loader = , + noConnection =
No Solana Connection in context
, + noWallet = , render, }: { + loader?: ReactNode + noConnection?: ReactNode + noWallet?: ReactNode render: ({ connection, publicKey, signTransaction, wallet }: SolanaConnectionRenderProps) => ReactNode }) { const { publicKey, signTransaction, wallet } = useWallet() const { connection } = useConnection() if (!connection) { - return null + return noConnection } if (!wallet) { - return + return noWallet } if (!publicKey) { - return + return loader } if (!signTransaction) { - return + return loader } return render({ connection, publicKey, signTransaction, wallet })