Skip to content

Commit 8ec1bf5

Browse files
committed
Merge branch 'main' into 05-30-wip_brige_embed
2 parents b88f8ba + 81c66f4 commit 8ec1bf5

File tree

159 files changed

+4914
-1733
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+4914
-1733
lines changed

.changeset/whole-ends-like.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@thirdweb-dev/service-utils": patch
3+
---
4+
5+
chore: pass allowImpersonation to auth server

.github/workflows/CI.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
uses: ./.github/composite-actions/install
6262

6363
- name: Setup Biome
64-
uses: biomejs/setup-biome@f382a98e582959e6aaac8e5f8b17b31749018780 # v2.5.0
64+
uses: biomejs/setup-biome@a9763ed3d2388f5746f9dc3e1a55df7f4609bc89 # v2.5.1
6565
with:
6666
version: latest
6767

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646

4747
# Initializes the CodeQL tools for scanning.
4848
- name: Initialize CodeQL
49-
uses: github/codeql-action/init@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
49+
uses: github/codeql-action/init@fca7ace96b7d713c7035871441bd52efbe39e27e # v3.28.19
5050
with:
5151
languages: ${{ matrix.language }}
5252
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -59,7 +59,7 @@ jobs:
5959
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
6060
# If this step fails, then you should remove it and run the build manually (see below)
6161
- name: Autobuild
62-
uses: github/codeql-action/autobuild@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
62+
uses: github/codeql-action/autobuild@fca7ace96b7d713c7035871441bd52efbe39e27e # v3.28.19
6363

6464
# ℹ️ Command-line programs to run using the OS shell.
6565
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -72,4 +72,4 @@ jobs:
7272
# ./location_of_script_within_repo/buildscript.sh
7373

7474
- name: Perform CodeQL Analysis
75-
uses: github/codeql-action/analyze@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
75+
uses: github/codeql-action/analyze@fca7ace96b7d713c7035871441bd52efbe39e27e # v3.28.19

apps/dashboard/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@
6666
"flat": "^6.0.1",
6767
"framer-motion": "12.9.2",
6868
"fuse.js": "7.1.0",
69-
"idb-keyval": "^6.2.1",
7069
"input-otp": "^1.4.1",
7170
"ioredis": "^5.6.1",
7271
"ipaddr.js": "^2.2.0",
@@ -105,6 +104,7 @@
105104
"thirdweb": "workspace:*",
106105
"tiny-invariant": "^1.3.3",
107106
"use-debounce": "^10.0.4",
107+
"vaul": "^1.1.2",
108108
"zod": "3.25.24"
109109
},
110110
"devDependencies": {
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
"use server";
2+
import "server-only";
3+
4+
import { randomBytes } from "node:crypto";
5+
import type { Team } from "@/api/team";
6+
import { format } from "date-fns";
7+
import { getAuthToken } from "../../app/(app)/api/lib/getAuthToken";
8+
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "../constants/public-envs";
9+
10+
export async function createTeam(options?: {
11+
name?: string;
12+
slug?: string;
13+
}) {
14+
const token = await getAuthToken();
15+
16+
if (!token) {
17+
return {
18+
status: "error",
19+
errorMessage: "You are not authorized to perform this action",
20+
} as const;
21+
}
22+
23+
const res = await fetch(`${NEXT_PUBLIC_THIRDWEB_API_HOST}/v1/teams`, {
24+
method: "POST",
25+
headers: {
26+
Authorization: `Bearer ${token}`,
27+
"Content-Type": "application/json",
28+
},
29+
body: JSON.stringify({
30+
name:
31+
options?.name ?? `Your Projects ${format(new Date(), "MMM d yyyy")}`,
32+
slug: options?.slug ?? randomBytes(20).toString("hex"),
33+
billingEmail: null,
34+
image: null,
35+
}),
36+
});
37+
38+
if (!res.ok) {
39+
const reason = await res.text();
40+
console.error("failed to create team", {
41+
status: res.status,
42+
reason,
43+
});
44+
switch (res.status) {
45+
case 400: {
46+
return {
47+
status: "error",
48+
errorMessage: "Invalid team name or slug.",
49+
} as const;
50+
}
51+
case 401: {
52+
return {
53+
status: "error",
54+
errorMessage: "You are not authorized to perform this action.",
55+
} as const;
56+
}
57+
default: {
58+
return {
59+
status: "error",
60+
errorMessage: "An unknown error occurred.",
61+
} as const;
62+
}
63+
}
64+
}
65+
66+
const json = (await res.json()) as {
67+
result: Team;
68+
};
69+
70+
return {
71+
status: "success",
72+
data: json.result,
73+
} as const;
74+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
"use server";
2+
import "server-only";
3+
import { getAuthToken } from "../../app/(app)/api/lib/getAuthToken";
4+
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "../constants/public-envs";
5+
6+
export async function deleteTeam(options: {
7+
teamId: string;
8+
}) {
9+
const token = await getAuthToken();
10+
if (!token) {
11+
return {
12+
status: "error",
13+
errorMessage: "You are not authorized to perform this action.",
14+
} as const;
15+
}
16+
17+
const res = await fetch(
18+
`${NEXT_PUBLIC_THIRDWEB_API_HOST}/v1/teams/${options.teamId}`,
19+
{
20+
method: "DELETE",
21+
headers: {
22+
Authorization: `Bearer ${token}`,
23+
},
24+
},
25+
);
26+
// handle errors
27+
if (!res.ok) {
28+
const reason = await res.text();
29+
console.error("failed to delete team", {
30+
status: res.status,
31+
reason,
32+
});
33+
switch (res.status) {
34+
case 400: {
35+
return {
36+
status: "error",
37+
errorMessage: "Invalid team ID.",
38+
} as const;
39+
}
40+
case 401: {
41+
return {
42+
status: "error",
43+
errorMessage: "You are not authorized to perform this action.",
44+
} as const;
45+
}
46+
47+
case 403: {
48+
return {
49+
status: "error",
50+
errorMessage: "You do not have permission to delete this team.",
51+
} as const;
52+
}
53+
case 404: {
54+
return {
55+
status: "error",
56+
errorMessage: "Team not found.",
57+
} as const;
58+
}
59+
default: {
60+
return {
61+
status: "error",
62+
errorMessage: "An unknown error occurred.",
63+
} as const;
64+
}
65+
}
66+
}
67+
return {
68+
status: "success",
69+
} as const;
70+
}

apps/dashboard/src/@/api/analytics.ts

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ async function fetchAnalytics(
2222
init?: RequestInit,
2323
): Promise<Response> {
2424
const token = await getAuthToken();
25-
2625
if (!token) {
2726
throw new Error("You are not authorized to perform this action");
2827
}
@@ -48,22 +47,11 @@ async function fetchAnalytics(
4847
decodeURIComponent(value),
4948
);
5049
}
51-
// client id DEBUG OVERRIDE
52-
// analyticsServiceUrl.searchParams.delete("projectId");
53-
// analyticsServiceUrl.searchParams.delete("teamId");
54-
// analyticsServiceUrl.searchParams.append(
55-
// "teamId",
56-
// "team_cm0lde33r02344w129k5hm2xz",
57-
// );
58-
// analyticsServiceUrl.searchParams.append(
59-
// "projectId",
60-
// "prj_cm4rqwx9b002qrnsnr37wqpo6",
61-
// );
6250

6351
return fetch(analyticsServiceUrl, {
6452
...init,
6553
headers: {
66-
"content-type": "application/json",
54+
Authorization: `Bearer ${token}`,
6755
...init?.headers,
6856
},
6957
});
@@ -99,7 +87,6 @@ export async function getWalletConnections(
9987
`v2/sdk/wallet-connects?${searchParams.toString()}`,
10088
{
10189
method: "GET",
102-
headers: { "Content-Type": "application/json" },
10390
},
10491
);
10592

@@ -123,7 +110,6 @@ export async function getInAppWalletUsage(
123110
`v2/wallet/connects?${searchParams.toString()}`,
124111
{
125112
method: "GET",
126-
headers: { "Content-Type": "application/json" },
127113
},
128114
);
129115

@@ -147,7 +133,6 @@ export async function getUserOpUsage(
147133
`v2/bundler/usage?${searchParams.toString()}`,
148134
{
149135
method: "GET",
150-
headers: { "Content-Type": "application/json" },
151136
},
152137
);
153138

@@ -205,7 +190,6 @@ export async function getClientTransactions(
205190
`v2/sdk/contract-transactions?${searchParams.toString()}`,
206191
{
207192
method: "GET",
208-
headers: { "Content-Type": "application/json" },
209193
},
210194
);
211195

@@ -229,7 +213,6 @@ export async function getRpcMethodUsage(
229213
`v2/rpc/evm-methods?${searchParams.toString()}`,
230214
{
231215
method: "GET",
232-
headers: { "Content-Type": "application/json" },
233216
},
234217
);
235218

@@ -250,7 +233,6 @@ export async function getWalletUsers(
250233
`v2/sdk/wallet-connects/users?${searchParams.toString()}`,
251234
{
252235
method: "GET",
253-
headers: { "Content-Type": "application/json" },
254236
},
255237
);
256238

@@ -287,7 +269,6 @@ export async function isProjectActive(params: {
287269
`v2/active-usage?${searchParams.toString()}`,
288270
{
289271
method: "GET",
290-
headers: { "Content-Type": "application/json" },
291272
},
292273
);
293274

@@ -357,9 +338,6 @@ export async function getEcosystemWalletUsage(args: {
357338
`v2/wallet/connects?${searchParams.toString()}`,
358339
{
359340
method: "GET",
360-
headers: {
361-
"Content-Type": "application/json",
362-
},
363341
},
364342
);
365343

@@ -386,9 +364,6 @@ export async function getUniversalBridgeUsage(args: {
386364
const searchParams = buildSearchParams(args);
387365
const res = await fetchAnalytics(`v2/universal?${searchParams.toString()}`, {
388366
method: "GET",
389-
headers: {
390-
"Content-Type": "application/json",
391-
},
392367
});
393368

394369
if (res?.status !== 200) {
@@ -415,9 +390,6 @@ export async function getUniversalBridgeWalletUsage(args: {
415390
`v2/universal/wallets?${searchParams.toString()}`,
416391
{
417392
method: "GET",
418-
headers: {
419-
"Content-Type": "application/json",
420-
},
421393
},
422394
);
423395

@@ -441,7 +413,6 @@ export async function getEngineCloudMethodUsage(
441413
`v2/engine-cloud/requests?${searchParams.toString()}`,
442414
{
443415
method: "GET",
444-
headers: { "Content-Type": "application/json" },
445416
},
446417
);
447418

0 commit comments

Comments
 (0)