Skip to content

Commit 974e8b0

Browse files
committed
chore(dashboard): delete user dashboard
1 parent 3ebf07a commit 974e8b0

132 files changed

Lines changed: 665 additions & 16563 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { ethers } from 'ethers';
2+
3+
const YELLOWSTONE_RPC_URL = 'https://yellowstone-rpc.litprotocol.com/';
4+
const DATIL_PUBKEY_ROUTER_ADDRESS = '0xF182d6bEf16Ba77e69372dD096D8B70Bc3d5B475';
5+
const DATIL_PKP_NFT_ADDRESS = '0x487A9D096BB4B7Ac1520Cb12370e31e677B175EA';
6+
7+
const PUBKEY_ROUTER_ABI = [
8+
'function ethAddressToPkpId(address ethAddress) public view returns (uint256)',
9+
];
10+
11+
const PKP_NFT_ABI = ['function ownerOf(uint256 tokenId) public view returns (address)'];
12+
13+
async function getPkpOwner(pkpEthAddress: string): Promise<string> {
14+
const provider = new ethers.providers.JsonRpcProvider(YELLOWSTONE_RPC_URL);
15+
16+
// Checksum the address
17+
const checksummedAddress = ethers.utils.getAddress(pkpEthAddress);
18+
console.log(`Checksummed address: ${checksummedAddress}`);
19+
20+
// Get the token ID from the PKP eth address
21+
const pubkeyRouter = new ethers.Contract(
22+
DATIL_PUBKEY_ROUTER_ADDRESS,
23+
PUBKEY_ROUTER_ABI,
24+
provider,
25+
);
26+
const tokenId = await pubkeyRouter.ethAddressToPkpId(checksummedAddress);
27+
console.log(`Token ID: ${tokenId.toString()}`);
28+
29+
if (tokenId.isZero()) {
30+
throw new Error(`No PKP found for address: ${checksummedAddress}`);
31+
}
32+
33+
// Get the owner from the PKP NFT contract
34+
const pkpNft = new ethers.Contract(DATIL_PKP_NFT_ADDRESS, PKP_NFT_ABI, provider);
35+
const owner = await pkpNft.ownerOf(tokenId);
36+
37+
return owner;
38+
}
39+
40+
// PKP address to look up
41+
const PKP_ADDRESS = '0xa23fd4b36a59466912b0ff8cae6a1802525d60aa';
42+
43+
getPkpOwner(PKP_ADDRESS)
44+
.then((owner) => {
45+
console.log(`PKP Address: ${PKP_ADDRESS}`);
46+
console.log(`Owner Address: ${owner}`);
47+
})
48+
.catch((error) => {
49+
console.error('Error:', error.message);
50+
process.exit(1);
51+
});

packages/apps/app-dashboard/src/components/developer-dashboard/app/forms/ManageDelegateesForm.tsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ import { Plus, Trash2, Dices, Check } from 'lucide-react';
1818
import { TextField } from '../../form-fields';
1919
import { CopyButton } from '@/components/shared/ui/CopyButton';
2020
import { getClient } from '@lit-protocol/vincent-contracts-sdk';
21-
import { initPkpSigner } from '@/utils/developer-dashboard/initPkpSigner';
22-
import { addPayee } from '@/utils/user-dashboard/addPayee';
23-
import useReadAuthInfo from '@/hooks/user-dashboard/useAuthInfo';
21+
import { useWagmiSigner } from '@/hooks/developer-dashboard/useWagmiSigner';
2422
import { theme, fonts } from '@/components/user-dashboard/connect/ui/theme';
2523

2624
const AddDelegateeSchema = z.object({
@@ -41,7 +39,7 @@ export function ManageDelegateesForm({
4139
refetchBlockchainData,
4240
}: ManageDelegateesFormProps) {
4341
const { appId } = useParams<{ appId: string }>();
44-
const { authInfo, sessionSigs } = useReadAuthInfo();
42+
const { getSigner } = useWagmiSigner();
4543
const [error, setError] = useState<string>('');
4644
const [removingDelegatee, setRemovingDelegatee] = useState<string | null>(null);
4745
const [generatedWallet, setGeneratedWallet] = useState<{
@@ -98,8 +96,8 @@ export function ManageDelegateesForm({
9896
setRemovingDelegatee(addressToRemove);
9997

10098
try {
101-
const pkpSigner = await initPkpSigner({ authInfo, sessionSigs });
102-
const client = getClient({ signer: pkpSigner });
99+
const signer = await getSigner();
100+
const client = getClient({ signer });
103101

104102
await client.removeDelegatee({
105103
appId: Number(appId),
@@ -138,11 +136,10 @@ export function ManageDelegateesForm({
138136
throw new Error('DelegateeAlreadyRegistered');
139137
}
140138

141-
// Add the specific delegatee address as a payee
142-
await addPayee(address);
139+
// TODO: Add delegatees batch endpoint in the contracts, make sure to addPayees as well
143140

144-
const pkpSigner = await initPkpSigner({ authInfo, sessionSigs });
145-
const client = getClient({ signer: pkpSigner });
141+
const signer = await getSigner();
142+
const client = getClient({ signer });
146143

147144
await client.addDelegatee({
148145
appId: Number(appId),

packages/apps/app-dashboard/src/components/developer-dashboard/app/wrappers/AppOverviewWrapper.tsx

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ import { reactClient as vincentApiClient } from '@lit-protocol/vincent-registry-
44
import { getClient } from '@lit-protocol/vincent-contracts-sdk';
55
import * as Sentry from '@sentry/react';
66

7-
import { initPkpSigner } from '@/utils/developer-dashboard/initPkpSigner';
8-
import useReadAuthInfo from '@/hooks/user-dashboard/useAuthInfo';
9-
import { addPayee } from '@/utils/user-dashboard/addPayee';
7+
import { useWagmiSigner } from '@/hooks/developer-dashboard/useWagmiSigner';
108
import { AppDetailsView } from '../views/AppDetailsView';
119
import { EditAppForm } from '../forms/EditAppForm';
1210
import { EditPublishedAppForm } from '../forms/EditPublishedAppForm';
@@ -43,7 +41,7 @@ export function AppOverviewWrapper() {
4341
const [searchParams, setSearchParams] = useSearchParams();
4442
const [currentView, setCurrentView] = useState<ViewType>('details');
4543
const [isSubmitting, setIsSubmitting] = useState(false);
46-
const { authInfo, sessionSigs } = useReadAuthInfo();
44+
const { getSigner, address } = useWagmiSigner();
4745

4846
const {
4947
data: app,
@@ -109,18 +107,6 @@ export function AppOverviewWrapper() {
109107
const handleEditAppSubmit = async (data: EditAppFormData | EditPublishedAppFormData) => {
110108
setIsSubmitting(true);
111109
try {
112-
// identify NEW delegatee addresses that weren't in the original app
113-
const originalDelegateeAddresses = app?.delegateeAddresses || [];
114-
const newDelegateeAddresses = (
115-
'delegateeAddresses' in data ? data.delegateeAddresses || [] : []
116-
).filter((address: string) => !originalDelegateeAddresses.includes(address));
117-
118-
await Promise.all(
119-
newDelegateeAddresses.map(async (address: string) => {
120-
await addPayee(address);
121-
}),
122-
);
123-
124110
await editApp({
125111
appId: Number(appId),
126112
appEdit: data,
@@ -170,8 +156,8 @@ export function AppOverviewWrapper() {
170156
// Step 2: If published on-chain, also delete on-chain
171157
if (isPublished) {
172158
try {
173-
const pkpSigner = await initPkpSigner({ authInfo, sessionSigs });
174-
const client = getClient({ signer: pkpSigner });
159+
const signer = await getSigner();
160+
const client = getClient({ signer });
175161

176162
await client.deleteApp({
177163
appId: Number(appId),
@@ -186,7 +172,7 @@ export function AppOverviewWrapper() {
186172
appId: appId,
187173
registryDeleted: true,
188174
onChainDeleted: false,
189-
userPkp: authInfo?.userPKP?.ethAddress,
175+
userAddress: address,
190176
},
191177
});
192178
}

packages/apps/app-dashboard/src/components/developer-dashboard/app/wrappers/CreateAppWrapper.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { reactClient as vincentApiClient } from '@lit-protocol/vincent-registry-
44
import { CreateAppForm, type CreateAppFormData } from '../forms/CreateAppForm';
55
import { navigateWithDelay } from '@/utils/developer-dashboard/app-forms';
66
import { Breadcrumb } from '@/components/shared/ui/Breadcrumb';
7-
import { addPayee } from '@/utils/user-dashboard/addPayee';
87

98
export function CreateAppWrapper() {
109
// Mutation
@@ -21,13 +20,6 @@ export function CreateAppWrapper() {
2120
}, [isSuccess, data, navigate]);
2221

2322
const handleSubmit = async (data: CreateAppFormData) => {
24-
// Add all delegatee addresses as payees before creating the app
25-
await Promise.all(
26-
(data.delegateeAddresses || []).map(async (address) => {
27-
await addPayee(address);
28-
}),
29-
);
30-
3123
await createApp({
3224
appCreate: { ...data },
3325
}).unwrap();

packages/apps/app-dashboard/src/components/developer-dashboard/app/wrappers/PublishAppVersionWrapper.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ import { AbilityVersion, PolicyVersion } from '@/types/developer-dashboard/appTy
66
import { StatusMessage } from '@/components/shared/ui/statusMessage';
77
import { getClient } from '@lit-protocol/vincent-contracts-sdk';
88
import { PublishAppVersionButton } from './ui/PublishAppVersionButton';
9-
import { initPkpSigner } from '@/utils/developer-dashboard/initPkpSigner';
10-
import useReadAuthInfo from '@/hooks/user-dashboard/useAuthInfo';
9+
import { useWagmiSigner } from '@/hooks/developer-dashboard/useWagmiSigner';
1110
import { theme } from '@/components/user-dashboard/connect/ui/theme';
1211

1312
export function PublishAppVersionWrapper({ isAppPublished }: { isAppPublished: boolean }) {
1413
const { appId, versionId } = useParams<{ appId: string; versionId: string }>();
15-
const { authInfo, sessionSigs } = useReadAuthInfo();
14+
const { getSigner } = useWagmiSigner();
1615
const navigate = useNavigate();
1716

1817
// Fetching
@@ -244,8 +243,8 @@ export function PublishAppVersionWrapper({ isAppPublished }: { isAppPublished: b
244243
return;
245244
}
246245

247-
const pkpSigner = await initPkpSigner({ authInfo, sessionSigs });
248-
const client = getClient({ signer: pkpSigner });
246+
const signer = await getSigner();
247+
const client = getClient({ signer });
249248

250249
for (const delegatee of delegatees) {
251250
// Validate that delegatee is a proper Ethereum address

packages/apps/app-dashboard/src/components/developer-dashboard/app/wrappers/ui/AppMismatchResolution.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import { reactClient as vincentApiClient } from '@lit-protocol/vincent-registry-
44
import { getClient } from '@lit-protocol/vincent-contracts-sdk';
55
import MutationButtonStates, { SkeletonButton } from '@/components/shared/ui/MutationButtonStates';
66
import { StatusMessage } from '@/components/shared/ui/statusMessage';
7-
import { initPkpSigner } from '@/utils/developer-dashboard/initPkpSigner';
8-
import useReadAuthInfo from '@/hooks/user-dashboard/useAuthInfo';
7+
import { useWagmiSigner } from '@/hooks/developer-dashboard/useWagmiSigner';
98

109
type AppMismatchResolutionProps = {
1110
appId: number;
@@ -23,7 +22,7 @@ export function AppMismatchResolution({
2322
const [isProcessing, setIsProcessing] = useState(false);
2423
const [error, setError] = useState<string | null>(null);
2524
const [success, setSuccess] = useState<string | null>(null);
26-
const { authInfo, sessionSigs } = useReadAuthInfo();
25+
const { getSigner } = useWagmiSigner();
2726

2827
// Registry mutations
2928
const [deleteAppInRegistry, { isLoading: isDeletingInRegistry, error: deleteAppError }] =
@@ -37,8 +36,8 @@ export function AppMismatchResolution({
3736
setIsProcessing(true);
3837

3938
try {
40-
const pkpSigner = await initPkpSigner({ authInfo, sessionSigs });
41-
const client = getClient({ signer: pkpSigner });
39+
const signer = await getSigner();
40+
const client = getClient({ signer });
4241

4342
if (registryDeleted) {
4443
await client.deleteApp({

packages/apps/app-dashboard/src/components/developer-dashboard/app/wrappers/ui/AppPublishedButtons.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import { App } from '@/types/developer-dashboard/appTypes';
77
import { App as ContractApp } from '@lit-protocol/vincent-contracts-sdk';
88
import MutationButtonStates from '@/components/shared/ui/MutationButtonStates';
99
import { AppMismatchResolution } from './AppMismatchResolution';
10-
import { initPkpSigner } from '@/utils/developer-dashboard/initPkpSigner';
11-
import useReadAuthInfo from '@/hooks/user-dashboard/useAuthInfo';
10+
import { useWagmiSigner } from '@/hooks/developer-dashboard/useWagmiSigner';
1211
import { theme, fonts } from '@/components/user-dashboard/connect/ui/theme';
1312
import { ActionButton } from '@/components/developer-dashboard/ui/ActionButton';
1413

@@ -28,7 +27,7 @@ export function AppPublishedButtons({
2827
const [isProcessing, setIsProcessing] = useState(false);
2928
const [error, setError] = useState<string | null>(null);
3029
const [success, setSuccess] = useState<string | null>(null);
31-
const { authInfo, sessionSigs } = useReadAuthInfo();
30+
const { getSigner, address } = useWagmiSigner();
3231

3332
// Registry mutations
3433
const [undeleteAppInRegistry, { isLoading: isUndeletingInRegistry, error: undeleteAppError }] =
@@ -47,8 +46,8 @@ export function AppPublishedButtons({
4746

4847
try {
4948
// Step 1: Update on-chain first (if published)
50-
const pkpSigner = await initPkpSigner({ authInfo, sessionSigs });
51-
const client = getClient({ signer: pkpSigner });
49+
const signer = await getSigner();
50+
const client = getClient({ signer });
5251

5352
await client.undeleteApp({
5453
appId: appData.appId,
@@ -74,7 +73,7 @@ export function AppPublishedButtons({
7473
Sentry.captureException(error, {
7574
extra: {
7675
context: 'AppPublishedButtons.undeleteApp',
77-
userPkp: authInfo?.userPKP?.ethAddress,
76+
userAddress: address,
7877
},
7978
});
8079
}

packages/apps/app-dashboard/src/components/developer-dashboard/app/wrappers/ui/AppVersionMismatchResolution.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import { reactClient as vincentApiClient } from '@lit-protocol/vincent-registry-
44
import { getClient } from '@lit-protocol/vincent-contracts-sdk';
55
import MutationButtonStates, { SkeletonButton } from '@/components/shared/ui/MutationButtonStates';
66
import { StatusMessage } from '@/components/shared/ui/statusMessage';
7-
import { initPkpSigner } from '@/utils/developer-dashboard/initPkpSigner';
8-
import useReadAuthInfo from '@/hooks/user-dashboard/useAuthInfo';
7+
import { useWagmiSigner } from '@/hooks/developer-dashboard/useWagmiSigner';
98

109
type AppVersionMismatchResolutionProps = {
1110
appId: number;
@@ -25,7 +24,7 @@ export function AppVersionMismatchResolution({
2524
const [isProcessing, setIsProcessing] = useState(false);
2625
const [error, setError] = useState<string | null>(null);
2726
const [success, setSuccess] = useState<string | null>(null);
28-
const { authInfo, sessionSigs } = useReadAuthInfo();
27+
const { getSigner } = useWagmiSigner();
2928

3029
// Mutations for enable/disable
3130
const [enableAppVersion, { isLoading: isEnabling, error: enableAppVersionError }] =
@@ -39,8 +38,8 @@ export function AppVersionMismatchResolution({
3938
setIsProcessing(true);
4039

4140
try {
42-
const pkpSigner = await initPkpSigner({ authInfo, sessionSigs });
43-
const client = getClient({ signer: pkpSigner });
41+
const signer = await getSigner();
42+
const client = getClient({ signer });
4443

4544
await client.enableAppVersion({
4645
appId: Number(appId),

packages/apps/app-dashboard/src/components/developer-dashboard/app/wrappers/ui/AppVersionPublishedButtons.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import { AppVersion } from '@/types/developer-dashboard/appTypes';
44
import { AppVersion as ContractAppVersion, getClient } from '@lit-protocol/vincent-contracts-sdk';
55
import { reactClient as vincentApiClient } from '@lit-protocol/vincent-registry-sdk';
66
import { AppVersionMismatchResolution } from './AppVersionMismatchResolution';
7-
import { initPkpSigner } from '@/utils/developer-dashboard/initPkpSigner';
8-
import useReadAuthInfo from '@/hooks/user-dashboard/useAuthInfo';
7+
import { useWagmiSigner } from '@/hooks/developer-dashboard/useWagmiSigner';
98
import { theme } from '@/components/user-dashboard/connect/ui/theme';
109
import { ActionButton } from '@/components/developer-dashboard/ui/ActionButton';
1110
import { StatusMessage } from '@/components/shared/ui/statusMessage';
@@ -32,7 +31,7 @@ export function AppVersionPublishedButtons({
3231
null,
3332
);
3433
const [actionError, setActionError] = useState<string | null>(null);
35-
const { authInfo, sessionSigs } = useReadAuthInfo();
34+
const { getSigner } = useWagmiSigner();
3635

3736
// Mutations for enable/disable
3837
const [enableAppVersion, { isLoading: isEnabling }] =
@@ -69,8 +68,8 @@ export function AppVersionPublishedButtons({
6968
}
7069

7170
// Step 2: Update on-chain
72-
const pkpSigner = await initPkpSigner({ authInfo, sessionSigs });
73-
const client = getClient({ signer: pkpSigner });
71+
const signer = await getSigner();
72+
const client = getClient({ signer });
7473

7574
await client.enableAppVersion({
7675
appId: Number(appId),

0 commit comments

Comments
 (0)