Skip to content

Commit c0e7ae9

Browse files
Add external wallet filter and display (#7669)
Co-authored-by: Cursor Agent <[email protected]>
1 parent 1e8190a commit c0e7ae9

File tree

5 files changed

+79
-1
lines changed

5 files changed

+79
-1
lines changed

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/wallets/users/components/AdvancedSearchInput.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export function AdvancedSearchInput(props: {
5555
<SelectItem value="phone">Phone</SelectItem>
5656
<SelectItem value="id">ID</SelectItem>
5757
<SelectItem value="address">Address</SelectItem>
58+
<SelectItem value="externalWallet">External Wallet</SelectItem>
5859
</SelectContent>
5960
</Select>
6061

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/wallets/users/components/SearchResults.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ export function SearchResults(props: {
5252
const email = mainDetail?.email as string | undefined;
5353
const phone = mainDetail?.phone as string | undefined;
5454

55+
// Get external wallet addresses from linkedAccounts where type is 'siwe'
56+
const externalWalletAccounts =
57+
user.linkedAccounts?.filter((account) => account.type === "siwe") ||
58+
[];
59+
5560
return (
5661
<Card key={user.id}>
5762
<CardHeader>
@@ -96,6 +101,29 @@ export function SearchResults(props: {
96101
</div>
97102
)}
98103

104+
{externalWalletAccounts.length > 0 && (
105+
<div className="col-span-full">
106+
<p className="text-sm font-medium text-muted-foreground">
107+
External Wallets
108+
</p>
109+
<div className="space-y-1">
110+
{externalWalletAccounts.map((account, index) => {
111+
const address = account.details?.address as
112+
| string
113+
| undefined;
114+
return address ? (
115+
<div key={`${user.id}-external-${index}`}>
116+
<WalletAddress
117+
address={address}
118+
client={props.client}
119+
/>
120+
</div>
121+
) : null;
122+
})}
123+
</div>
124+
</div>
125+
)}
126+
99127
{createdAt && (
100128
<div>
101129
<p className="text-sm font-medium text-muted-foreground">

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/wallets/users/components/index.tsx

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ const getUserIdentifier = (accounts: WalletUser["linkedAccounts"]) => {
3636
);
3737
};
3838

39+
const getExternalWallets = (accounts: WalletUser["linkedAccounts"]) => {
40+
return accounts?.filter((account) => account.type === "siwe") || [];
41+
};
42+
3943
const columnHelper = createColumnHelper<WalletUser>();
4044

4145
export function InAppWalletUsersPageContent(
@@ -69,6 +73,36 @@ export function InAppWalletUsersPageContent(
6973
header: "Address",
7074
id: "address",
7175
}),
76+
columnHelper.accessor("linkedAccounts", {
77+
cell: (cell) => {
78+
const externalWallets = getExternalWallets(cell.getValue());
79+
if (externalWallets.length === 0) {
80+
return <span className="text-muted-foreground text-xs">None</span>;
81+
}
82+
return (
83+
<div className="space-y-1">
84+
{externalWallets.slice(0, 2).map((account) => {
85+
const address = account.details?.address as string | undefined;
86+
return address ? (
87+
<div
88+
key={`external-${address}-${account.details?.id}`}
89+
className="text-xs"
90+
>
91+
<WalletAddress address={address} client={props.client} />
92+
</div>
93+
) : null;
94+
})}
95+
{externalWallets.length > 2 && (
96+
<span className="text-muted-foreground text-xs">
97+
+{externalWallets.length - 2} more
98+
</span>
99+
)}
100+
</div>
101+
);
102+
},
103+
header: "External Wallets",
104+
id: "external_wallets",
105+
}),
72106
columnHelper.accessor("wallets", {
73107
cell: (cell) => {
74108
const value = cell.getValue()[0]?.createdAt;
@@ -172,11 +206,18 @@ export function InAppWalletUsersPageContent(
172206
});
173207
const csv = Papa.unparse(
174208
usersWallets.map((row) => {
209+
const externalWallets = getExternalWallets(row.linkedAccounts);
210+
const externalWalletAddresses = externalWallets
211+
.map((account) => account.details?.address)
212+
.filter(Boolean)
213+
.join(", ");
214+
175215
return {
176216
address: row.wallets[0]?.address || "Uninitialized",
177217
created: row.wallets[0]?.createdAt
178218
? format(new Date(row.wallets[0].createdAt), "MMM dd, yyyy")
179219
: "Wallet not created yet",
220+
external_wallets: externalWalletAddresses || "None",
180221
login_methods: row.linkedAccounts.map((acc) => acc.type).join(", "),
181222
user_identifier: getUserIdentifier(row.linkedAccounts),
182223
};

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/wallets/users/components/searchUsers.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ export async function searchUsers(
3333
case "address":
3434
url.searchParams.append("address", query);
3535
break;
36+
case "externalWallet":
37+
url.searchParams.append("externalWalletAddress", query);
38+
break;
3639
}
3740

3841
const response = await fetch(url.toString(), {
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
export type SearchType = "email" | "phone" | "id" | "address";
1+
export type SearchType =
2+
| "email"
3+
| "phone"
4+
| "id"
5+
| "address"
6+
| "externalWallet";

0 commit comments

Comments
 (0)